diff --git a/.fernignore b/.fernignore new file mode 100644 index 000000000..084a8ebb0 --- /dev/null +++ b/.fernignore @@ -0,0 +1 @@ +# Specify files that shouldn't be modified by Fern diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 5c6efcd10..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve Square SDKs -title: '' -labels: '' -assignees: '' - ---- - -## **ATTENTION** -This issue template is for **bugs** or **documentation** errors in this SDK Repo. Please direct all technical support questions, feature requests, API-related issues, and general discussions to our Square-supported developer channels. For public support, [join us in our Square Developer Discord server](https://discord.com/invite/squaredev) or [post in our Developer Forums](https://developer.squareup.com/forums). For private support, [contact our Developer Success Engineers](https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68) directly. - -**Describe the bug** -A clear and concise description of what the bug is. - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**To Reproduce** -Steps to reproduce the bug: -1. (step 1) -2. (step 2) -3. (step 3) -4. ... - -**Screenshots** -If applicable, add screenshots to help explain the bug. - -**Square SDK version** -For example: 17.2.x - -**Additional context** -Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index f38eff76c..000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,11 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Square Developer Forums - url: https://developer.squareup.com/forums - about: Public discussion threads for technical support, feature requests, api discussion, and all things related to square development. - - name: Square Developer Discord Server - url: https://discord.com/invite/squaredev - about: Community slack channel for real time support and conversations about building with square. - - name: Developer Support - url: https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68 - about: Private support directly with Square Developer Success Engineers. diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 1d486d977..000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,21 +0,0 @@ - -# configuration settings for labeler - -version: v1 - -labels: - - label: "automerge" - sync: true - matcher: - title: "^Generated PR for Release:" - - - label: "automerge-author" - sync: true - matcher: - author: - - square-sdk-deployer - - - label: "automerge-branch" - sync: true - matcher: - branch: "^release" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 77bc5759f..000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,4 +0,0 @@ -# **ATTENTION** -This repository **cannot** accept Pull Requests. If you wish to proceed with opening this PR, please understand that your code **will not** be pulled into this repository. Consider opening an issue which lays out the problem instead. Thank you very much for your efforts and highlighting issues! - -Please direct all technical support questions, feature requests, API-related issues, and general discussions to our Square-supported developer channels. For public support, [join us in our Square Developer Discord server](https://discord.com/invite/squaredev) or [post in our Developer Forums](https://developer.squareup.com/forums). For private support, [contact our Developer Success Engineers](https://squareup.com/help/us/en/contact?panel=BF53A9C8EF68) directly. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..1a55fdb1a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: ci + +on: [push] + +jobs: + compile: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up node + uses: actions/setup-node@v3 + + - name: Compile + run: yarn && yarn build + + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up node + uses: actions/setup-node@v3 + + - name: Compile + run: yarn && yarn test + + publish: + needs: [ compile, test ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Set up node + uses: actions/setup-node@v3 + - name: Install dependencies + run: yarn install + - name: Build + run: yarn build + + - name: Publish to npm + run: | + npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} + if [[ ${GITHUB_REF} == *alpha* ]]; then + npm publish --access public --tag alpha + elif [[ ${GITHUB_REF} == *beta* ]]; then + npm publish --access public --tag beta + else + npm publish --access public + fi + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index ddebc061f..000000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,52 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Node.js CI - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - build: - env: - SQUARE_ENVIRONMENT: sandbox - SQUARE_SANDBOX_TOKEN: ${{ secrets.SQUARE_SANDBOX_TOKEN }} - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [14.x, 16.x, 18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - run: npm install --no-save - - run: npm run build --if-present - - run: npm test - - labeler: - needs: build - if: ${{ github.event_name == 'pull_request' }} - runs-on: ubuntu-latest - steps: - - name: automerge-labeler - uses: fuxingloh/multi-labeler@v1 - - automerge: - needs: labeler - if: ${{ github.event_name == 'pull_request' }} - runs-on: ubuntu-latest - steps: - - name: automerge - uses: "pascalgn/automerge-action@v0.14.2" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_LABELS: "automerge,automerge-branch,automerge-author" diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..72271e049 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +.DS_Store +/dist \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000..6db0876c4 --- /dev/null +++ b/.npmignore @@ -0,0 +1,9 @@ +node_modules +src +tests +.gitignore +.github +.fernignore +.prettierrc.yml +tsconfig.json +yarn.lock \ No newline at end of file diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 000000000..0c06786bf --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1,2 @@ +tabWidth: 4 +printWidth: 120 diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 03990c0f4..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,618 +0,0 @@ -# Change Log - -For general API and SDK changelogs, see [Square APIs and SDKs Release Notes](https://developer.squareup.com/docs/changelog/connect). - -## Version 17.0.0 (2021-12-15) -### API updates - -* **Invoices API:** - * The Invoices API now supports seller accounts in France. For more information, see [International availability and considerations.](https://developer.squareup.com/docs/invoices-api/overview#international-availability-invoices) - * France only: [`Invoice`](https://developer.squareup.com/reference/square_2021-12-15/objects/Invoice) object. Added a new `payment_conditions` field, which contains payment terms and conditions that are displayed on the invoice. This field is available only for sellers in France. For more information, see [Payment conditions.](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions) - - Square version 2021-12-15 or higher is required to set this field, but it is returned in `ListInvoices` and `RetrieveInvoice` requests for all Square versions. - -* **Cards API** - * Added the `CARD_DECLINED_VERIFICATION_REQUIRED` error code to the list of error codes returned by [CreateCard](https://developer.squareup.com/reference/square_2021-12-15/cards-api/CreateCard). -* **Catalog API:** - * [CreateCatalogImage](https://developer.squareup.com/reference/square_2021-12-15/catalog-api/create-catalog-image) endpoint - * Updated to support attaching multiple images to a [Catalogbject](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogObject) instance. - * Added `is_primary` option to let the caller choose to attach an image as the primary image on the object for display with the Square Point of Sale and other first-party Square applications. For more information, see [Upload and Attach Images.](https://developer.squareup.com/docs/catalog-api/upload-and-attach-images) - * [CatalogObject](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogObject) object - * Retired the `image_id` field, used to hold a single image object attached to an image-supporting object of the `ITEM`, `ITEM_VARIATION`, `CATEGORY`, or `MODIFIER_LIST` type, in Square API version 2021-12-15 and later, which supports attachment of multiple images. The `image_id` field is still supported in Square API version prior to 2021-12-15. For more information, see [Work with Images: Overview.](https://developer.squareup.com/docs/catalog-api/cookbook/create-catalog-image#overview) - * [CatalogItem](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogItem), [CatalogItemVariation](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogItemVariation), [CatalogCategory](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogCategory) or [CatalogModifierList](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogModifierList) object - * Added `image_ids` list to hold attached image objects. The first element of `image_ids` list refers to the primary image attached to the catalog object. For more information, see [Work with Images: Overview.](https://developer.squareup.com/docs/catalog-api/cookbook/create-catalog-image#overview) - * [UpdateCatalogImage](https://developer.squareup.com/reference/square_2021-12-15/catalog-api/update-catalog-image) endpoint - * Added to support replacing the image file encapsulated by an existing [CatalogImage](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogImage) object. For more information, see [Replace image file on a CatalogImage object.](https://developer.squareup.com/docs/catalog-api/manage-images#replace-the-image-file-of-a-catalogimage-object) - - * [CatalogPricingRule](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogPricingRule) object - * Added [minimum_order_subtotal_money](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogPricingRule#definition__property-minimum_order_subtotal_money) field to require that the minimum order subtotal be reached before the pricing rule may be applied. - -### Documentation updates -* Added a new top-level node for Developer Tools. This node includes such features as Sandbox, API Logs, and Webhooks. -* Added [Webhook Event Logs (beta)](https://developer.squareup.com/docs/devtools/webhook-logs) documentation to the Developer Tools node. - - -## Version 16.0.0 (2021-11-17) -## API updates - -* **Cards API.** The [Card](https://developer.squareup.com/reference/square_2021-11-17/objects/card) object and webhook response body for all webhooks are updated updated with fields. - * Added the [Card.merchant_id](https://developer.squareup.com/reference/square_2021-11-17/objects/Card#definition__property-merchant_id) field to identify the Square seller that stored the payment card on file. - * Added a [Card](https://developer.squareup.com/reference/square_2021-11-17/objects/Card) object to the response bodies of all [Cards API webhooks](https://developer.squareup.com/docs/webhooks/v2webhook-events-tech-ref#cards-api). The `Card` is added as a child of the `data.object` field in all webhook responses. - -* **Bookings API.** The new [ListBookings](https://developer.squareup.com/reference/square_2021-11-17/bookings-api/list-bookings) endpoint supports browsing a collection of bookings of a seller. For more information, see [Use the Bookings API: list bookings.](https://developer.squareup.com/docs/bookings-api/use-the-api#list-bookings) - -* **Subscriptions API.** Introduced the new [actions framework](https://developer.squareup.com/docs/subscriptions-api/overview#subscriptions-actions-overview) representing scheduled, future changes to subscriptions. - * The new [PauseSubscription](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/pause-subscription) endpoint supports temporarily pausing a subscription. Calling this endpoint schedules a new `PAUSE` action. - * The new [SwapPlan](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/swap-plan) endpoint supports changing the subscription plan associated with a single customer. Calling this endpoint schedules a new `SWAP_PLAN` action. - * The new [DeleteSubscriptionAction](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/delete-subscription-action) endpoint supports deleting a scheduled action. - * The [ResumeSubscription](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/resume-subscription) endpoint has been updated to support resuming a paused subscription. Calling this endpoint schedules a new `RESUME` action. - * The [CancelSubscription](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/cancel-subscription) endpoint now schedules a new `CANCEL` action. - * Added an optional `include` body parameter to the [SearchSubscriptions](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/search-subscriptions) endpoint. Include `actions` in the request to return all [actions](https://developer.squareup.com/docs/subscriptions-api/overview#subscriptions-actions-overview) associated with the subscriptions. - -## Documentation Update - -* **Migration Guides.** - * [Migrate from the Connect V1 Refunds API.](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-refunds) The topic is updated to include information to migrate from the v1 ListRefunds endpoint to the appropriate Square API counterparts. - * [Migrate from the Connect V1 Payments API.](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-payments) The topic provides developers information to migrate from the Connect V1 Payments API to the appropriate Square API counterparts. - - Code that relies on these V1 API endpoints must be updated to avoid breaking when these APIs reach retirement. - - -## Version 15.0.0 (2021-10-20) -## API updates -* **Transactions API.** Three previously deprecated endpoints (`ListRefunds`, `Charge`, and `CreateRefund`) in the [Transactions API](https://developer.squareup.com/reference/square_2021-10-20/transactions-api) are removed from Square API version 2021-10-20 and later. These endpoints will work if you are using Square API versions prior to 2021-10-20. However, these endpoints will eventually be retired from all Square versions. - - * Instead of the Transactions API `Charge` endpoint, use the Payments API [CreatePayment](https://developer.squareup.com/reference/square_2021-10-20/payments-api/create-payment) endpoint. - * Instead of the Transactions API `CreateRefund` endpoint, use the Refunds API [RefundPayment](https://developer.squareup.com/reference/square_2021-10-20/payments-api/refund-payment) endpoint. - * Instead of the Transactions API `ListRefunds` endpoint, use the Refunds API [ListPaymentRefund](https://developer.squareup.com/reference/square_2021-10-20/payments-api/list-payment-refunds) endpoint. - -* **Payments API:** - * [Payment](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment) object. - * Added the [device_details](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-device_details) read-only field to view details of the device used to take a payment. This `Payment`-level field provides device information for all types of payments. Previously, device details were only available for card payments (`Payment.card_details.device_details`), which is now deprecated. - * Added the [team_member_id](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-team_member_id) that applications can use to view the ID of the [TeamMember](https://developer.squareup.com/reference/square_2021-10-20/objects/TeamMember) associated with the payment. Use this field instead of the `Payment.employee_id` field, which is now deprecated. - * Added the [application_details](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-application_details) read-only field to view details of the application that took the payment. - - * These `Payment` fields have moved to the [general availability](https://developer.squareup.com/docs/build-basics/api-lifecycle) (GA) state:[tip_money](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-tip_money), [delay_duration](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-delay_duration), [statement_description_identifier](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-statement_description_identifier), [delay_duration](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-delay_duration), [delay_action](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-delay_action), [delayed_until](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-delayed_until), and [statement_description_identifier](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-statement_description_identifier). - - * The [ACH Bank Transfer Payments](https://developer.squareup.com/docs/payments-api/take-payments/ach-payments) feature has moved to the GA state. Accordingly, the [bank_account_details](https://developer.squareup.com/reference/square_2021-10-20/objects/Payment#definition__property-bank_account_details) field (and its [BankAccountPaymentDetails](https://developer.squareup.com/reference/square_2021-10-20/objects/BankAccountPaymentDetails) type) are moved to the GA state. - * [CreatePayment](https://developer.squareup.com/reference/square_2021-10-20/payments-api/create-payment) endpoint. - * Added the [team_member_id](https://developer.squareup.com/reference/square_2021-10-20/payments-api/create-payment#request__property-team_member_id) request field to record the ID of the team member associated with the payment. - * The [accept_partial_authorization](https://developer.squareup.com/reference/square_2021-10-20/payments-api/create-payment#request__property-accept_partial_authorization) request field has moved to the GA state. - * [CompletePayment](https://developer.squareup.com/reference/square_2021-10-20/payments-api/complete-payment) endpoint. Added the `version_token` request field to support optimistic concurrency. For more information, see [Delayed capture of a card payment.](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment) - -* **Refunds API:** - * [RefundPayment](https://developer.squareup.com/reference/square_2021-10-20/refunds-api/refund-payment) endpoint. - * Added the `team_member_id` request field to record the ID of the team member associated with the refund. - * Added the `payment_version_token` request field to support optimistic concurrency. For more information, see [Refund Payment.](https://developer.squareup.com/docs/payments-api/refund-payments#optimistic-concurrency) - -* **Customers API:** - * [Customer](https://developer.squareup.com/reference/square_2021-10-20/objects/Customer) object. Added a new `tax_ids` field of the [CustomerTaxIds](https://developer.squareup.com/reference/square_2021-10-20/objects/CustomerTaxIds) type, which can contain the EU VAT ID of the customer. This field is available only for customers of sellers in France, Ireland, or the United Kingdom. For more information, see [Customer tax IDs.](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids) - - * [UpdateCustomer](https://developer.squareup.com/reference/square_2021-10-20/customers-api/update-customer) endpoint. The Customers API now returns a `400 BAD_REQUEST` error if the request body does not contain any fields. For earlier Square versions, the Customers API will continue to return a `200 OK` response along with the customer profile. For more information, see [Migration notes.](https://developer.squareup.com/docs/customers-api/what-it-does#migration-notes) - -* **Invoices API:** - * [InvoiceRecipient](https://developer.squareup.com/reference/square_2021-10-20/objects/InvoiceRecipient) object. Added a new, read-only `tax_ids` field of the [InvoiceRecipientTaxIds](https://developer.squareup.com/reference/square_2021-10-20/objects/InvoiceRecipientTaxIds) type, which can contain the EU VAT ID of the invoice recipient. This field is available only for customers of sellers in Ireland or the United Kingdom. If defined, `tax_ids` is returned for all Square API versions. For more information, see [Invoice recipient tax IDs.](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids) - * Square now sends emails for test invoices that are published in the Sandbox environment. - -* **Catalog API:** - * [CatalogSubscriptionPlan.name](https://developer.squareup.com/reference/square_2021-10-20/objects/CatalogSubscriptionPlan#definition__property-name) can be updated after the subscription plan is created. The change is retroactively applicable to prior versions of the Square API. - -* **Subscriptions API:** - * The new [SubscriptionSource](https://developer.squareup.com/reference/square_2021-10-20/objects/SubscriptionSource) data type is introduced to encapsulate the source where a subscription is created. The new `SubscriptionSource.name` value is propagated to the `Order.source` attribute when an order is made on the subscription. The new feature is retroactively applicable to prior versions of the Square API. - * The new [Subscription.source](https://developer.squareup.com/reference/square_2021-10-20/objects/Subscription#definition__property-source) attribute is introduced to indicate the source where the subscription was created. This new feature is retroactively applicable to prior versions of the Square API. - * The new [SearchSubscriptionsFilter.source_names](https://developer.squareup.com/reference/square_2021-10-20/objects/SearchSubscriptionFilter#definition__property-source_names) query expression is introduced to enable search for subscriptions by the subscription source name. This new feature is retroactively applicable to prior versions of the Square API. - - -## Version 14.1.0 (2021-09-15) -## API updates - -* **Invoices API:** - * [Invoice](https://developer.squareup.com/reference/square_2021-09-15/objects/Invoice) object. Added a new, optional `sale_or_service_date` field used to specify the date of the sale or the date that the service is rendered. If specified, this date is displayed on the invoice. - -* **Orders API:** - * [CreateOrder](https://developer.squareup.com/reference/square_2021-09-15/orders-api/create-order). The endpoint now supports creating temporary, draft orders. For more information, see [Create a draft order.](https://developer.squareup.com/docs/orders-api/create-orders#create-a-draft-order) - * [CloneOrder](https://developer.squareup.com/reference/square_2021-09-15/orders-api/clone-order). The Orders API supports this new endpoint to clone an existing order. For more information, see [Clone an order.](https://developer.squareup.com/docs/orders-api/create-orders#clone-an-order) - * These fields have moved to the [general availability (GA)](https://developer.squareup.com/docs/build-basics/api-lifecycle#general-availability) state: [OrderLineItem.item_type](https://developer.squareup.com/reference/square_2021-09-15/objects/OrderLineItem#definition__property-item_type), [OrderServiceCharge.type](https://developer.squareup.com/reference/square_2021-09-15/objects/OrderServiceCharge#definition__property-type), and `catalog_version` field on every order type that contains this field. - -* **Team API:** - * [SearchTeamMembersFilter](https://developer.squareup.com/reference/square_2021-09-15/objects/SearchTeamMembersFilter) object now has an `is_owner` field that when set, causes a team member search to return only the seller who owns a Square account. - -* **Terminal API:** - * [TerminalCheckout](https://developer.squareup.com/reference/square_2021-09-15/objects/TerminalCheckout) object. The `customer_id` field is now GA. - -## Documentation updates -* **OAuth API:** - * Revised API descriptions for the ObtainToken and Authorize endpoints. Clarified that the Authorize endpoint is not a callable API but is used to direct the seller to the Square authorization page. For more information about the Authorize endpoint, see [Create the Redirect URL and Square Authorization Page URL.](https://developer.squareup.com/docs/oauth-api/create-urls-for-square-authorization) - - -## Version 13.1.0 (2021-08-18) -## API updates - -* **Customers API:** - * [Customer](https://developer.squareup.com/reference/square_2021-08-18/objects/Customer) object. The `version` field has moved to the [general availability](https://developer.squareup.com/docs/build-basics/api-lifecycle#general-availability) (GA) state. This field represents the current version of the customer profile and enables optimistic concurrency control. For more information, see [Customer profile versions and optimistic concurrency support.](https://developer.squareup.com/docs/customers-api/what-it-does#customer-profile-versions-and-optimistic-concurrency-support) - * [ListCustomers](https://developer.squareup.com/reference/square_2021-08-18/customers-api/list-customers) endpoint. The new, optional `limit` query parameter can be used to specify the maximum number of results in a paginated response. - -* **Customer Groups API:** - * [ListCustomerGroups](https://developer.squareup.com/reference/square_2021-08-18/customer-groups-api/list-customer-groups) endpoint. The new, optional `limit` query parameter can be used to specify the maximum number of results in a paginated response. - -* **Customer Segments API:** - * [ListCustomerSegments](https://developer.squareup.com/reference/square_2021-08-18/customer-segments-api/list-customer-segments) endpoint. The new, optional `limit` query parameter can be used to specify the maximum number of results in a paginated response. - -* **Invoices API:** - * Square Invoices Plus is a monthly subscription plan that allows access to premium invoice features. After Invoices Plus is launched in September 2021, a subscription will be required to create invoices with custom fields and installment payments. For more information, including how to handle new errors, see [Premium features available with Invoices Plus.](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription) - -* **Loyalty API:** - * [LoyaltyAccount](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyAccount) object. Added a new `expiring_point_deadlines` field that specifies when points in the account balance are scheduled to expire. This field contains a list of [LoyaltyAccountExpiringPointDeadline](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyAccountExpiringPointDeadline) objects. For more information, see [Expiring points.](https://developer.squareup.com/docs/loyalty-api/overview#expiring-points) - -## Documentation updates - -* [App Marketplace.](https://developer.squareup.com/docs/app-marketplace) Added the following topics: - * [How to apply.](https://developer.squareup.com/docs/app-marketplace#how-to-apply) Documented the process to list an application on the Square App Marketplace. - * [App Marketplace API Usage Requirements.](https://developer.squareup.com/docs/app-marketplace/requirements) Added a topic that describes a set of API usage requirements and recommendations for partner applications. - -* [Automatic communications from Square about invoices.](https://developer.squareup.com/docs/invoices-api/overview#automatic-communication-from-square-to-customers) Documented the invoice-related communications sent from Square to customers and sellers. - -* [Snippets best practices.](https://developer.squareup.com/docs/snippets-api/overview#best-practices) Documented best practices and additional requirements for snippets and applications that integrate with the Snippets API. - - -## Version 13.0.0 (2021-07-21) -## API updates - -* **Orders API:** - * [OrderServiceCharge](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderServiceCharge) object. Added a new field, `type`. It identifies the service charge type. - - * [OrderQuantityUnit](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderQuantityUnit), - [OrderLineItem](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderLineItem), - [OrderLineItemDiscount](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderLineItemDiscount), - [OrderLineItemModifier](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderLineItemModifier), - [OrderLineItemTax](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderLineItemTax), - [OrderServiceCharge](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderServiceCharge), - [OrderReturnLineItem](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderReturnLineItem), - [OrderReturnLineItemModifier](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderReturnLineItemModifier), - [OrderReturnServiceCharge](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderReturnServiceCharge), - [OrderReturnTax](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderReturnTax), and - [OrderReturnDiscount](https://developer.squareup.com/reference/square_2021-07-21/objects/OrderReturnDiscount) objects. Added a new field, `catalog_version`. -* **Locations API:** - * [Location](https://developer.squareup.com/reference/square_2021-07-21/objects/Location) object. Added a new field `tax_ids` of type `TaxIds`. In the current implementation, sellers in Ireland and France can configure tax IDs during the onboarding process. They can also provide the information later by updating the location information in the Seller Dashboard. These tax IDs appear in this field. - -* **Loyalty API:** - * As of July 15, 2021, the country in which the seller’s Square account is activated determines whether Square uses pretax or post-tax purchase amounts to calculate accrued points. This change supports consumption tax models, such as value-added tax (VAT). Previously, point accrual was based on pretax purchase amounts only. This change does not affect the existing point balance of loyalty accounts. For more information, see [Availability of Square Loyalty.](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-market-availability) - -* **Payments API:** - * [UpdatePayment](https://developer.squareup.com/reference/square_2021-07-21/payments-api/update-payment). The endpoint has moved to the [general availability](https://developer.squareup.com/docs/build-basics/api-lifecycle#general-availability) (GA) state. Also, you can now update gift card payments (similar to card, cash, and external payments). - -* **Subscriptions API:** - * The [Subscriptions API](https://developer.squareup.com/docs/subscriptions-api/overview) has moved to the [general availability](https://developer.squareup.com/docs/build-basics/api-lifecycle#general-availability) (GA) state. - * [CatalogSubscriptionPlan](https://developer.squareup.com/reference/square_2021-07-21/objects/CatalogSubscriptionPlan) object. The `name` and `price` are now write-once fields. You specify these values at the time of creating a plan. After the plan is created, these fields cannot be updated. This makes a subscription plan immutable. - -* **Inventory API:** - * [RetrieveInventoryTransfer.](https://developer.squareup.com/reference/square_2021-07-21/inventory-api/Retrieve-Inventory-Transfer) This new endpoint is introduced to support the retrieval of inventory transfer. - * [RetrieveInventoryChanges.](https://developer.squareup.com/reference/square_2021-07-21/inventory-api/Retrieve-Inventory-Changes) This endpoint is deprecated. Its support ends when it is retired in about 12 months. - * The following endpoints have updated URLs to conform to the standard REST API convention. For more information about migrating deprecated URLs to updated URLs in your application, see [Inventory API: Migrate to Updated API Entities.](https://developer.squareup.com/docs/inventory-api/migrate-to-updated-api-entities) - * [RetrieveInventoryAdjustment](https://developer.squareup.com/reference/square_2021-07-21/inventory-api/Retrieve-Inventory-Adjustment) - * [BatchChangeInventory](https://developer.squareup.com/reference/square_2021-07-21/inventory-api/Batch-Change-Inventory) - * [BatchRetrieveInventoryChanges](https://developer.squareup.com/reference/square_2021-07-21/inventory-api/Batch-Retrieve-Inventory-Changes) - * [BatchRetrieveInventoryCounts](https://developer.squareup.com/reference/square_2021-07-21/inventory-api/Batch-Retrieve-Inventory-Counts) - * [RetrieveInventoryPhysicalCount](https://developer.squareup.com/reference/square_2021-07-21/inventory-api/Retrieve-Inventory-Physical-Count) - -## Documentation updates -* **Webhooks.** Revised the steps and descriptions for creating and using webhooks. For more information, see [Webhooks Overview.](https://developer.squareup.com/docs/webhooks/overview) - - -## Version 12.0.0 (2021-06-16) -## New API releases -* **Gift Cards API and Gift Card Activities API.** Gift card support is integrated in the [Square Seller Dashboard](https://squareup.com/dashboard/) and the [Square Point of Sale](https://squareup.com/us/en/point-of-sale) application. Sellers can sell, redeem, track, and reload Square gift cards. Now developers can use the [Gift Cards API](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api) and the [Gift Card Activities API](https://developer.squareup.com/reference/square_2021-06-16/gift-card-activities-api) to integrate Square gift cards into third-party applications. For more information, see [Gift Cards API Overview.](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api) - -* **Cards API.** The [Cards API](https://developer.squareup.com/reference/square_2021-06-16/cards-api) replaces the deprecated `CreateCustomerCard` and `DeleteCustomerCard` endpoints and lets an application save a customer payment card on file along with other card management operations. For more information, see [Cards API Overview.](https://developer.squareup.com/docs/cards-api/overview) - -## API updates -* **Catalog API:** - * [CatalogPricingRule](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogPricingRule). Support of the [customer group discount](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogPricingRule#definition__property-customer_group_ids_any) becomes GA. For more information, see [CreateCustomerGroupDiscounts.](https://developer.squareup.com/docs/catalog-api/configure-customer-group-discounts) - * [CatalogItemVariation](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation). Offers Beta support of the [stockable](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation#definition__property-stockable) and [stockable_conversion](https://developer.squareup.com/reference/square_2021-06-16/objects/CatalogItemVariation#definition__property-stockable_conversion) attributes to enable sales of a product in multiple measurement units. - * [UpsertCatalogObject](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/upsert-catalog-object) and [BatchUpsertCatalogObjects](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/batch-upsert-catalog-objects). Support creating an item with stockable and non-stockable variations with a specified stock conversion between the two. For more information, see [Enable Stock Conversion.](https://developer.squareup.com/docs/inventory-api/enable-stock-conversion) - * [UpsertCatalogObject](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/upsert-catalog-object) and [BatchUpsertCatalogObjects](https://developer.squareup.com/reference/square_2021-06-16/catalog-api/batch-upsert-catalog-objects). Require that an item be created with at least one variation. Otherwise, an `INVALID_REQUEST` error is returned. - -* **Customers API:** - * Using the Customers API to manage cards on file is deprecated: - * The [CreateCustomerCard](https://developer.squareup.com/reference/square_2021-06-16/customers-api/create-customer-card) endpoint is deprecated and replaced by the [CreateCard](https://developer.squareup.com/reference/square_2021-06-16/cards-api/create-card) and [LinkCustomerToGiftCard](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/link-customer-to-gift-card) endpoints. - * The [DeleteCustomerCard](https://developer.squareup.com/reference/square_2021-06-16/customers-api/delete-customer-card) endpoint is deprecated and replaced by the [DisableCard](https://developer.squareup.com/reference/square_2021-06-16/cards-api/disable-card) and [UnlinkCustomerFromGiftCard](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/unlink-customer-from-gift-card) endpoints. - * The `cards` field in the [Customer](https://developer.squareup.com/reference/square_2021-06-16/objects/Customer) object is deprecated and replaced by the following endpoints: - * [ListCards](https://developer.squareup.com/reference/square_2021-06-16/cards-api/list-cards) to retrieve credit and debit cards on file. - * [ListGiftCards](https://developer.squareup.com/reference/square_2021-06-16/gift-cards-api/list-gift-cards) to retrieve gift cards on file. - - For more information, see [Migrate to the Cards API and Gift Cards API.](https://developer.squareup.com/docs/customers-api/use-the-api/integrate-with-other-services#migrate-customer-cards) - - * [Customer](https://developer.squareup.com/reference/square_2021-06-16/objects/Customer) object. In the `cards` field, the IDs for gift cards now have a `gftc:` prefix followed by the card number. This is a service-level change that applies to all Square API versions. - -* **Disputes API:** - * The Disputes API is now GA. - * `RemoveDisputeEvidence`. Renamed to [DeleteDisputeEvidence](https://developer.squareup.com/reference/square_2021-06-16/objects/DeleteDisputeEvidence). - * [CreateDisputeEvidenceFile.](https://developer.squareup.com/reference/square_2021-06-16/objects/CreateDisputeEvidenceFile) The URL is changed from `/v2/disputes/{dispute_id}/evidence_file` to `/v2/disputes/{dispute_id}/evidence-files`. - * [CreateDisputeEvidenceText.](https://developer.squareup.com/reference/square_2021-06-16/objects/CreateDisputeEvidenceText) The URL is changed from `/v2/disputes/{dispute_id}/evidence_text` to `/v2/disputes/{dispute_id}/evidence-text`. - * [ListDisputeEvidence.](https://developer.squareup.com/reference/square_2021-06-16/objects/ListDisputeEvidence) The endpoint now returns a pagination cursor and accepts a pagination cursor in requests. - * `DISPUTES_READ` and `DISPUTES_WRITE` permissions are required for all Disputes API endpoints instead of `PAYMENTS_READ` and `PAYMENTS_WRITE`. - * [DisputeEvidence.](https://developer.squareup.com/reference/square_2021-06-16/objects/DisputeEvidence) The `evidence_id` field is deprecated and replaced by the `id` field. - * The `dispute.state.changed` webhook is renamed to `dispute.state.updated`. - * [Dispute](https://developer.squareup.com/reference/square_2021-06-16/objects/Dispute) object. The following breaking changes are made: - * The `dispute_id` field is deprecated and replaced by the `id` field. - * The `reported_date` field is deprecated and replaced by the `reported_at` field. - * The `evidence_ids` field is deprecated with no replacement. - - For more information about the GA release of the Disputes API, see [Disputes Overview.](https://developer.squareup.com/docs/disputes-api/overview) - - -* **Inventory API:** - * [CatalogStockConversion](https://developer.squareup.com/docs/{SQUARE_TECH_REF}/objects/CatalogStockConversion) (Beta). Enables selling a product in multiple measurement units and lets Square sellers manage inventory counts of the product's stockable and a non-stockable variations in a self-consistent manner. For more information, see [Enable Stock Conversion.](https://developer.squareup.com/docs/inventory-api/enable-stock-conversion) - -* **Invoices API:** - * [CreateInvoice.](https://developer.squareup.com/reference/square_2021-06-16/invoices-api/create-invoice) The `location_id` field is now optional and defaults to the location ID of the associated order. If specified in the request, the value must match the location ID of the associated order. This is a service-level change that applies to all Square API versions. - -* **Loyalty API:** - * [LoyaltyProgramAccrualRule](https://developer.squareup.com/reference/square_2021-06-16/objects/LoyaltyProgramAccrualRule) object. New `excluded_category_ids` and `excluded_item_variation_ids` fields that represent any categories and items that are excluded from accruing points in spend-based loyalty programs. - -* **Subscriptions API:** - * [Subscription.](https://developer.squareup.com/reference/square_2021-06-16/objects/Subscription) The `paid_until_date` field is renamed to `charge_through_date`. - * [UpdateSubscription.](https://developer.squareup.com/reference/square_2021-06-16/subscriptions-api/update-subscription) The `version` field is now optional because it can update only the latest version of a subscription. - - * [CreateSubscription.](https://developer.squareup.com/reference/square_2021-06-16/subscriptions-api/create-subscription) The `idempotency_key` field is now optional in the request. If you do not provide it, each `CreateSubscription` assumes a unique (never used before) value and creates a subscription for each call. - -## Documentation updates -* [Order fee structure.](https://developer.squareup.com/docs/payments-pricing#orders-api-fee-structure) Documented the transaction fee related to using the Orders API with a non-Square payments provider. - - -## Version 11.0.0 (2021-05-13) -## New API releases - -* **Sites API.** The [Sites API](https://developer.squareup.com/reference/square_2021-05-13/sites-api) lets you retrieve basic details about the Square Online sites that belong to a Square seller. For more information, see [Sites API Overview.](https://developer.squareup.com/docs/sites-api/overview) - - -* **Snippets API.** The [Snippets API](https://developer.squareup.com/reference/square_2021-05-13/snippets-api) lets you manage snippets that provide custom functionality on Square Online sites. A snippet is a script that is injected into all pages on a site, except for checkout pages. For more information, see [Snippets API Overview.](https://developer.squareup.com/docs/snippets-api/overview) - -The Sites API and Snippets API are publicly available to all developers as part of an early access program (EAP). For more information, see [Early access program for Square Online APIs.](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis) - -## API updates - -* **Payments API.** - * [CreatePayment.](https://developer.squareup.com/reference/square_2021-05-13/payments-api/create-payment) The endpoint now supports ACH bank transfer payments. For more information, see [ACH Payment](https://developer.squareup.com/docs/payments-api/take-payments/ach-payments). - -* **Loyalty API:** - * The [Loyalty API](https://developer.squareup.com/docs/loyalty-api/overview) has moved to the [general availability](https://developer.squareup.com/docs/build-basics/api-lifecycle#general-availability) (GA) state. - - * The [ListLoyaltyPrograms](https://developer.squareup.com/reference/square_2021-05-13/loyalty-api/list-loyalty-programs) endpoint is deprecated and replaced by the [RetrieveLoyaltyProgram](https://developer.squareup.com/reference/square_2021-05-13/loyalty-api/retrieve-loyalty-program) endpoint when used with the `main` keyword. - - * [LoyaltyAccount](https://developer.squareup.com/reference/square_2021-05-13/objects/LoyaltyAccount)  object. The `mappings` field is retired and replaced by `mapping`. - - * [LoyaltyAccountMapping](https://developer.squareup.com/reference/square_2021-05-13/objects/LoyaltyAccountMapping) object. The `type` and `value` fields are retired and replaced by `phone_number`. - - Starting in Square version 2021-05-13: - * `mappings` is not accepted in `CreateLoyaltyAccount` requests or returned in responses. - * `type` and `value` are not accepted in `CreateLoyaltyAccount` or `SearchLoyaltyAccounts` requests or returned in responses. - - For more information, see [Migration notes.](https://developer.squareup.com/docs/loyalty-api/overview#migration-notes) - -## Documentation updates -* **Getting Started** Added step that shows how to use the API Logs to examine a transaction. - - -## Version 10.0.0 (2021-04-21) -## New API releases - -## Existing API updates - -* **Subscriptions API:** - * [ResumeSubscription.](https://developer.squareup.com/reference/square_2021-04-21/subscriptions-api/resume-subscription) This new endpoint enables applications to resume [deactivated subscriptions.](https://developer.squareup.com/docs/subscriptions-api/overview#deactivated-subscriptions) After a subscription is created, there are events that can make a subscription non-billable, causing Square to deactivate the subscription. A seller can also resume deactivated subscriptions in the Seller Dashboard. Applications can call [ListSubscriptionEvents](https://developer.squareup.com/reference/square_2021-04-21/subscriptions-api/list-subscription-events) to determine why Square deactivated a subscription. - -* **Customers API:** - - * [Customer](https://developer.squareup.com/reference/square_2021-04-21/objects/Customer) object: - * New `version` field (beta). This field represents the current version of the customer profile. You can include it in your `UpdateCustomer` and `DeleteCustomer` requests to enable optimistic concurrency. For more information, see [Customer profile versions and optimistic concurrency support.](https://developer.squareup.com/docs/customers-api/what-it-does#customer-profile-versions-and-optimistic-concurrency-support) - * The `groups` field and corresponding `CustomerGroupInfo` object are retired. - - * [Customer webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks) have moved to the [general availability](https://developer.squareup.com/docs/build-basics/api-lifecycle#general-availability) (GA) state. Event notifications now include the `version` field (beta). - -* **Invoices API:** - - * The [Invoices API](https://developer.squareup.com/docs/invoices-api/overview) has moved to the GA state. - - * [Invoice](https://developer.squareup.com/reference/square_2021-04-21/objects/Invoice) object: - * A new required `accepted_payment_methods` field that defines the methods of payment that customers can use to pay an invoice on the Square-hosted invoice page. Valid values are defined in the new [InvoiceAcceptedPaymentMethods](https://developer.squareup.com/reference/square_2021-04-21/objects/InvoiceAcceptedPaymentMethods) enum. For more information, see the [migration notes.](https://developer.squareup.com/docs/invoices-api/overview#migration-notes) - * A new `subscription_id` field, which is included in invoices created for subscription billing. - -* **Loyalty API:** (beta) - - * [RetrieveLoyaltyProgram](https://developer.squareup.com/reference/square_2021-04-21/loyalty-api/retrieve-loyalty-program) endpoint. This new endpoint accepts a program ID or the `main` keyword and returns the loyalty program in a seller's account. For more information, see [Retrieve a loyalty program.](https://developer.squareup.com/docs/loyalty-api/overview#retrieve-loyalty-program) This endpoint is preferred over the `ListLoyaltyPrograms` endpoint. - - * Introduced a new mapping implementation for loyalty accounts: - * [LoyaltyAccount](https://developer.squareup.com/reference/square_2021-04-21/objects/LoyaltyAccount) object. Added the `mapping` field (of type `LoyaltyAccountMapping`), which is used to associate the loyalty account with a buyer. This field is recommended over the `mappings` field. - * [LoyaltyAccountMapping](https://developer.squareup.com/reference/square_2021-04-21/objects/LoyaltyAccountMapping) object. Added the `phone_number` field to represent a phone number mapping. This field is recommended over the `type` and `value` fields. - - * A new [loyalty.program.created](https://developer.squareup.com/reference/square_2021-04-21/webhooks/loyalty.program.created) webhook. Square now publishes an event notification when a loyalty program is created in the Square Seller Dashboard. - -* **Inventory API:** - * [InventoryChange](https://developer.squareup.com/reference/square_2021-04-21/objects/InventoryChange) can now have its own measurement unit. - -* **Catalog API:** - * [CatalogItem](https://developer.squareup.com/reference/square_2021-04-21/objects/CatalogItem) introduces the `sort_name` attribute that can take Japanese writing scripts to sort items by. When it is unspecified, the regular `name` attribute is used for sorting. - * [CatalogPricingRule](https://developer.squareup.com/reference/square_2021-04-21/objects/CatalogCatalogPricingRule) has the new `customer_group_ids_any` attribute included to support automatic application of discounts to specified product set purchased by members of any of the customer groups identified by the `customer_group_ids_any` attribute values. -* **Team API** - * New [Team webhooks](https://developer.squareup.com/reference/square_2021-04-21/team-api/webhooks): `team_member.created`, `team_member.updated`, `team_member.wage_setting.updated` to notify on created and updated team members and wage settings. - -## SDKs -* **Connect Node.js SDK:** (retired) - * The Connect Node.js SDK is retired and replaced by the [Square Node.js SDK.](https://github.com/square/square-nodejs-sdk) For migration information, see [Connect Node.js SDK README.](https://github.com/square/connect-nodejs-sdk/blob/master/README.md) - - - - -## Version 9.1.0 (2021-03-17) - -## Existing API updates - -* **Payments API:** - * [CreatePayment](https://developer.squareup.com/reference/square_2021-03-17/payments-api/create-payment). Until now, the `CreatePayment` endpoint supported only taking card payments. In this release, the API now supports cash and external payments. For more information, see [Take Payments.](https://developer.squareup.com/docs/payments-api/take-payments) - * [UpdatePayment](https://developer.squareup.com/reference/square_2021-03-17/payments-api/update-payment). This new endpoint enables developers to change the payment amount and tip amount after a payment is created. For more information, see [Update Payments.](https://developer.squareup.com/docs/payments-api/update-payments) - -* **Invoices API:** - * [InvoiceDeliveryMethod](https://developer.squareup.com/reference/square_2021-03-17/enums/InvoiceDeliveryMethod) enum. Added the read-only `SMS` value. - * [InvoiceRequestMethod](https://developer.squareup.com/reference/square_2021-03-17/enums/InvoiceRequestMethod) enum (deprecated). Added the read-only `SMS`, `SMS_CHARGE_CARD_ON_FILE`, and `SMS_CHARGE_BANK_ON_FILE` values for backward compatibility. - - These values direct Square to send invoices and receipts to customers using SMS (text message). SMS settings can be configured from first-party Square applications only; they cannot be configured from the Invoices API. Square does not send invoice reminders when using SMS to communicate with customers. - - -* **Terminal API:** - * [TerminalCheckout](https://developer.squareup.com/reference/square_2021-03-17/objects/TerminalCheckout). Previously, `TerminalCheckout` only supported tapped, dipped, or swiped credit cards. It now supports manual card entry and e-money. Added the `payment_type` field to denote a request for a manually entered payment card or an e-money payment. - * [TerminalCheckoutPaymentType.](https://developer.squareup.com/reference/square_2021-03-17enums/TerminalCheckoutPaymentType) A new enum for the Terminal checkout payment types that can be requested. - * [E-money support](https://developer.squareup.com/docs/terminal-api/e-money-payments) is now available for Terminal checkout requests in Japan. - - -## SDKs -* **Square Java SDK:** - * Updated the OkHttp dependency to version 4.9.0. - * Fixed a `NullPointerException` when passing an empty order ID to the `UpdateOrder` method. - -## Documentation updates - -* **Multi-language code examples.** Previously, various topics showed only cURL examples for the REST API operations. These topics now show examples in multiple languages. You can use the language drop-down list to choose a language. - -* [When to Use Connect V1.](https://developer.squareup.com/docs/build-basics/using-connect-v1) Content is revised to reflect the most current information about when to use the Connect V1 API. - - -## Version 9.0.0 (2021-02-26) -## Existing API updates - -* **Customers API:** - - * [New webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks) (beta). Square now sends notifications for the following events: - * [customer.created](https://developer.squareup.com/reference/square_2021-02-26/webhooks/customer.created) - * [customer.deleted](https://developer.squareup.com/reference/square_2021-02-26/webhooks/customer.deleted) - * [customer.updated](https://developer.squareup.com/reference/square_2021-02-26/webhooks/customer.updated) - -* **Orders API:** - * [CreateOrder](https://developer.squareup.com/reference/square_2021-02-26/orders-api/create-order). Removed the `location_id` field from the request. It was an unused field. - -* **Payments API:** - * [Payment](https://developer.squareup.com/reference/square_2021-02-26/objects/Payment). This type now returns the `card_payment_timeline` [(CardPaymentTimeline](https://developer.squareup.com/reference/square_2021-02-26/objects/CardPaymentTimeline)) as part of the `card_details` field. - -* **v1 Items API:** - * The following endpoints are [retired:](https://developer.squareup.com/docs/build-basics/api-lifecycle) - * `AdjustInventory`: Use the Square Inventory API [BatchChangeInventory](https://developer.squareup.com/reference/square_2021-02-26/inventory-api/batch-change-inventory) endpoint. - * `ListInventory`: Use the Square Inventory API [BatchRetrieveInventoryCounts](https://developer.squareup.com/reference/square_2021-02-26/inventory-api/batch-retrieve-inventory-counts) endpoint. - -* **v1 Employees.Timecards:** - * The following endpoints are retired: - * `CreateTimecard`: Use the Square Labor API [CreateShift](https://developer.squareup.com/reference/square_2021-02-26/labor-api/create-shift) endpoint. - * `DeleteTimecard`: Use the Square Labor API [DeleteShift](https://developer.squareup.com/reference/square_2021-02-26/labor-api/delete-shift) endpoint. - * `ListTimecards`: Use the Square Labor API [SearchShift](https://developer.squareup.com/reference/square_2021-02-26/labor-api/search-shift) endpoint. - * `RetrieveTimecards`: Use the Square Labor API [GetShift](https://developer.squareup.com/reference/square_2021-02-26/labor-api/get-shift) endpoint. - * `UpdateTimecard`: Use the Square Labor API [UpdateShift](https://developer.squareup.com/reference/square_2021-02-26/labor-api/update-shift) endpoint. - * `ListTimecardEvents`: No direct replacement. To learn about replacing the v1 functionality, see the [migration guide.](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-timecards#endpoints) - -* **v1 Employees.CashDrawers:** - * The following endpoints are retired: - * `ListCashDrawerShifts`: Use the Square CashDrawerShifts API [ListCashDrawerShifts](https://developer.squareup.com/reference/square_2021-02-26/cash-drawers-api/list-cash-drawer-shifts) endpoint. - * `RetrieveCashDrawerShift`: Use the Square CashDrawerShifts API [RetrieveCashDrawerShift](https://developer.squareup.com/reference/square_2021-02-26/cash-drawers-api/retrieve-cash-drawer-shift) endpoint. -* **v1 Transactions.BankAccounts:** - * The following endpoints are retired: - * `ListBankAccounts`: Use the Square Bank Accounts API [ListBankAccounts](https://developer.squareup.com/reference/square_2021-02-26/bank-accounts-api/list-bank-accounts) endpoint. - * `RetrieveBankAccount`: Use the Square Bank Accounts API [GetBankAccount](https://developer.squareup.com/reference/square_2021-02-26/bank-accounts-api/get-bank-account) endpoint. - -## SDKs - -* **All Square SDKs:** - - By default, all SDKs send requests to Square's production (https://connect.squareup.com) or sandbox (https://connect.squareupsandbox.com) hosts based on the client's `environment` parameter. - - You now have the option to use a custom URL instead. To use a custom URL, follow the example for your language to set the `environment` parameter to `custom` and the `customUrl` parameter to your URL: - - - Java - - ```java - new SquareClient.Builder() - .environment(Environment.CUSTOM) - .customUrl("https://example.com") - ``` - - - .NET - - ```csharp - new Square.SquareClient.Builder() - .Environment(Environment.Custom) - .CustomUrl("https://example.com") - ``` - - - Node.js - - ```javascript - new Client({ - environment: Environment.Custom, - customUrl: 'https://example.com' - }); - ``` - - - PHP - - ```php - new Square\SquareClient([ - 'environment' => Environment::CUSTOM, - 'customUrl' => 'https://example.com', - ]); - ``` - - - Python - - ```python - Client( - environment = 'custom', - custom_url = 'https://example.com',) - ``` - - - Ruby - - ```ruby - Square::Client.new( - environment: 'custom', - custom_url: 'https://example.com' - }); - ``` - - -* **Square .NET SDK:** - - Square has overridden the `Equals` and `GetHashCode` methods for models: - - * In the `Equals` override, Square has implemented a field-level comparison. - * The Square `GetHashCode` override now ensures that hashes are deterministic and unique for each object. - -* **Square Node.js SDK:** - - Endpoints that return 64-bit integers now return a `BigInt` object instead of a `Number` object. - - -* **Connect Node.js SDK:** (deprecated) - - The deprecated Connect Node.js SDK is in the security [maintenance state.](https://developer.squareup.com/docs/build-basics/api-lifecycle#maintenance) It does not receive any bug fixes or API updates from the Square version 2021-02-26 release. However, the SDK will receive support and security patches until it is retired (end of life) in the second quarter of 2021. For more information, including steps for migrating to the [Square Node.js SDK,](https://github.com/square/square-nodejs-sdk) see the [Connect SDK README.](https://github.com/square/connect-nodejs-sdk/blob/master/README.md) - -## Documentation updates -* **Catalog API:** - * [Update Catalog Objects.](https://developer.squareup.com/docs/catalog-api/update-catalog-objects) Provides programming guidance to update catalog objects. - -* **Inventory API:** - * [List or retrieve inventory.](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-items#list-or-retrieve-inventory) Migrate the retired v1 endpoint of `ListInventory` to the v2 endpoint of `BatchRetrieveInventoryCounts`. Compare and contrast the programming patterns between the v1 endpoint of `ListInventory` and its v2 counterparts of [BatchRetrieveInventoryCounts](https://developer.squareup.com/reference/square_2021-02-26/inventory-api/batch-retrieve-inventory-counts) or [RetrieveInventoryCount](https://developer.squareup.com/reference/square_2021-02-26/inventory-api/retrieve-inventory-count). - * [Adjust or change inventory.](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-items#adjust-or-change-inventory) Migrate the retired v1 endpoint of `AdjustInventory` to the v2 endpoint of `BatchChangeInventory`. Compare and contrast the programming patterns between the v1 endpoint of `AdjustInventory` and its v2 counterparts of [BatchChangeInventory](https://developer.squareup.com/reference/square_2021-02-26/inventory-api/batch-change-inventory). - -* **Get Started topic.** Revised the [Get Started](https://developer.squareup.com/docs/get-started) experience. In addition to clarifications, it now includes the use of the Square Sandbox and API Explorer. These are the tools and environments developers use to explore Square APIs. - - -## Version 8.1.1 (2021-01-27T00:00) -## SDKs -* Fixed Node.js test `testCreateInvoice`. Uses `Invoice.delivery_method` instead of deprecated field `InvoicePaymentRequest.request_method` - -## Version 8.1.0 (2021-01-21T00:00) -## Existing API updates - -* **Invoices API:** (beta) - - The `InvoicePaymentRequest.request_method` field is deprecated, and its current options are separated into two new fields that better represent their scope: - * `Invoice.delivery_method` specifies how Square should send invoices, reminders, and receipts to the customer. - * `InvoicePaymentRequest.automatic_payment_source` specifies the payment method for an automatic payment. - - As part of this change, the [InvoiceDeliveryMethod](https://developer.squareup.com/reference/square_2021-01-21/enums/InvoiceDeliveryMethod) and [InvoiceAutomaticPaymentSource](https://developer.squareup.com/reference/square_2021-01-21/enums/InvoiceAutomaticPaymentSource) enums are added and the `InvoiceRequestMethod` enum is deprecated. - - The Invoices API will continue to accept `request_method` in create and update requests until the field is retired, but starting in this version, `request_method` is not included in returned `Invoice` objects. For more information, see the [migration notes.](https://developer.squareup.com/docs/invoices-api/overview#migrate-InvoicePaymentRequest.request_method) - - -* **Locations API:** - * The [Locations.MCC](https://developer.squareup.com/reference/square_2021-01-21/objects/Location#definition__property-mcc) field is now updatable (beta). You can use the `UpdateLocation` endpoint to update the merchant category code (MCC) associated with a seller location. For more information, see [Initialize a merchant category code.](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) - - - - -## SDKs -* **Connect Node.js SDK:** (deprecated) - - The deprecated Connect Node.js SDK is in the security [maintenance state.](https://developer.squareup.com/docs/build-basics/api-lifecycle#maintenance) It will not receive any bug fixes or API updates from the Square version 2021-01-21 release. However, the SDK will receive support and security patches until it is retired (EOL) in Q2, 2021. For more information, including steps for migrating to the [Square Node.js SDK,](https://github.com/square/square-nodejs-sdk) see the [Connect SDK README.](https://github.com/square/connect-nodejs-sdk/blob/master/README.md) - -## Documentation updates -* **Catalog API:** - * The [Use Item Options to Manage Item Variations](https://developer.squareup.com/docs/catalog-api/item-options-migration) topic is added. It demonstrates how item variations are usually used and how item options can be used to enable random access to item variations. - -* **Inventory API:** - * The [Inventory API](inventory-api/what-it-does) content is updated. It provides clearer guidance about how to use the API, with a task-oriented TOC and improved code examples. - - - -## Version 8.0.0 (2020-12-16T00:00) -## Existing API updates - -* **Orders API:** - * [OrderLineItemPricingBlocklists.](https://developer.squareup.com/reference/square_2020-12-16/objects/OrderLineItemPricingBlocklists) You can explicitly specify taxes and discounts in an order or automatically apply preconfigured taxes and discounts to an order. In addition, you can now block applying these taxes and discounts to a specific [OrderLineItem](https://developer.squareup.com/reference/square_2020-12-16/objects/OrderLineItem) in an [order](https://developer.squareup.com/reference/square_2020-12-16/objects/Order). You add the `pricing_blocklists` attribute to individual line items and specify the `blocked_discounts` and `blocked_taxes` that you do not want to apply. For more information, see [Apply Taxes and Discounts.](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts) For example walkthroughs, see [Automatically Apply Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-discounts) and [Automatically Apply Taxes.](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes) - * [OrderPricingOptions](https://developer.squareup.com/reference/square_2020-12-16/objects/OrderPricingOptions). Previously, the `pricing_options` field in an [order](https://developer.squareup.com/reference/square_2020-12-16/objects/OrderPricingOptions) supported only `auto_apply_discounts` to enable the automatic application of preconfigured discounts. Now it also supports `auto_apply_taxes` to enable the automatic application of preconfigured taxes. For more information, see [Automatically apply preconfigured catalog taxes or discounts.](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts#automatically-apply-preconfigured-catalog-taxes-or-discounts) - - * [OrderLineItemTax](https://developer.squareup.com/reference/square_2020-12-16/objects/OrderLineItemTax). It now includes the new `auto_applied` field. It indicates whether the tax was automatically applied using a preconfigured [CatalogTax](https://developer.squareup.com/reference/square_2020-12-16/objects/CatalogTax). - - -* **Bookings API:** - * The [CancelBooking](https://developer.squareup.com/reference/square_2020-12-16/bookings-api/cancel-booking) endpoint supports canceling an accepted or pending booking. - * The [booking.created](https://developer.squareup.com/reference/square_2020-12-16/webhooks/booking.created) webhook event notifies when a new booking is created by calling the [CreateBooking](https://developer.squareup.com/reference/square_2020-12-16/bookings-api/cancel-booking) endpoint. - * The [booking.updated](https://developer.squareup.com/reference/square_2020-12-16/webhooks/booking.updated) webhook event notifies when an existing booking is updated. - -* **Catalog API:** - * [ListCatalog](https://developer.squareup.com/reference/square_2020-12-16/catalog-api/list-catalog), [RetrieveCatalogObject](https://developer.squareup.com/reference/square_2020-12-16/catalog-api/retrieve-catalog-object), and [BatchRetrieveCatalogObjects](https://developer.squareup.com/reference/square_2020-12-16/catalog-api/batch-retrieve-catalog-objects) now support the `catalog_version` filter to return catalog objects of the specified version. - -* **Customers API:** - * [SearchCustomers](https://developer.squareup.com/reference/square_2020-12-16/customers-api/search-customers) endpoint. The `email_address`, `group_ids`, `phone_number`, and `reference_id` query filters are now generally available (GA). - * The [Customer Groups](https://developer.squareup.com/reference/square_2020-12-16/customer-groups-api) API is now GA. - * The [Customer Segments](https://developer.squareup.com/reference/square_2020-12-16/customer-segments-api) API is now GA. - - -* **Invoices API:** (beta) - * [Invoice](https://developer.squareup.com/reference/square_2020-12-16/objects/Invoice) object. Added the `custom_fields` field, which contains up to two customer-facing, seller-defined fields to display on the invoice. For more information, see [Custom fields.](https://developer.squareup.com/docs/invoices-api/overview#custom-fields) - As part of this change, the following objects are added: - * [InvoiceCustomField](https://developer.squareup.com/reference/square_2020-12-16/objects/InvoiceCustomField) object - * [InvoiceCustomFieldPlacement](https://developer.squareup.com/reference/square_2020-12-16/enums/InvoiceCustomFieldPlacement) enum - * [InvoiceRequestMethod](https://developer.squareup.com/reference/square_2020-12-16/enums/InvoiceRequestMethod) enum. Added the read-only CHARGE_BANK_ON_FILE value, which represents a bank transfer automatic payment method for a recurring invoice. - - -* **Loyalty API:** (beta) - * [LoyaltyProgramRewardTier](https://developer.squareup.com/reference/square_2020-12-16/objects/LoyaltyProgramRewardTier) object. The `definition` field in this type is deprecated and replaced by the new `pricing_rule_reference` field. You can use `pricing_rule_reference` fields to retrieve catalog objects that define the discount details for the reward tier. For more information, see [Get discount details for a reward tier.](https://developer.squareup.com/docs/loyalty-api/overview#get-discount-details-for-a-reward-tier) - As part of this change, the following APIs are deprecated: - * [LoyaltyProgramRewardDefinition](https://developer.squareup.com/reference/square_2020-12-16/objects/LoyaltyProgramRewardDefinition) object - * [LoyaltyProgramRewardDefinitionScope](https://developer.squareup.com/reference/square_2020-12-16/enums/LoyaltyProgramRewardDefinitionScope) enum - * [LoyaltyProgramRewardDefinitionType](https://developer.squareup.com/reference/square_2020-12-16/enums/LoyaltyProgramRewardDefinitionType) enum - -## New SDK release -* **Square Node.js SDK:** - - The new [Square Node.js SDK](https://github.com/square/square-nodejs-sdk) is now GA and replaces the deprecated Connect Node.js SDK. For migration information, see the [Connect SDK README.](https://github.com/square/connect-nodejs-sdk/blob/master/README.md) - - -## Documentation updates - -* [Get Right-Sized Permissions with Down-Scoped OAuth Tokens.](https://developer.squareup.com/docs/oauth-api/cookbook/downscoped-access) This new OAuth API topic shows how to get an additional reduced-scope OAuth token with a 24-hour expiration by using the refresh token from the Square account authorization OAuth flow. - - -## Version 7.0.0 (2020-11-18T00:00) -## New API releases - -* **Bookings API** (beta). This API enables you, as an application developer, to create applications to set up and manage bookings for appointments of fixed duration in which selected staff members of a Square seller provide specified services in supported locations for particular customers. - * For an overview, see [Manage Bookings for Square Sellers](https://developer.squareup.com/docs/bookings-api/what-it-is). - * For technical reference, see [Bookings API](https://developer.squareup.com/reference/square_2020-11-18/bookings-api). - -## Existing API updates - -* **Payments API:** - * [Payment.](https://developer.squareup.com/reference/square_2020-11-18/objects/Payment) The object now includes the `risk_evaluation` field to identify the Square-assigned risk level associated with the payment. Sellers can use this information to provide the goods and services or refund the payment. - -## New SDK release -* **New Square Node.js SDK (beta)** - - The new [Square Node.js SDK](https://github.com/square/square-nodejs-sdk) is available in beta and will eventually replace the deprecated Connect Node.js SDK. For migration information, see the [Connect SDK README.](https://github.com/square/connect-nodejs-sdk/blob/master/README.md) The following topics are updated to use the new SDK: - * [Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/payment-form/payment-form-walkthrough) - * [Verify the Buyer When Using a Nonce for an Online Payment](https://developer.squareup.com/docs/payment-form/cookbook/verify-buyer-on-card-charge) - * [Create a Gift Card Payment Endpoint](https://developer.squareup.com/docs/payment-form/gift-cards/part-2) - - -## Documentation Updates - -* The **Testing** topics are moved from the end of the table of contents to the top, in the **Home** section under [Testing your App](https://developer.squareup.com/docs/testing-your-app). -* [Pay for orders.]](https://developer.squareup.com/docs/orders-api/pay-for-order) Topic revised to add clarity when to use Payments API and Orders API to pay for an order. The [Orders Integration]](https://developer.squareup.com/docs/payments-api/take-payments?preview=true#orders-integration) topic in Payments API simplified accordingly. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 830654f59..000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,21 +0,0 @@ -# Contributing to Square SDKs - -Thank you for your willingness to help improve the Square SDKs. Your feedback and expertise ultimately benefits everyone who builds with Square. - -If you encounter a bug while using Square SDKs, please [let us know](#bug-reporting). We'll investigate the issue and fix it as soon as possible. - -We also accept feedback in the form of a pull request (PR), and will follow up with you if we need more information. However, any code changes required will be perfomed by Square engineering, and we'll close the PR. - -## Bug report - -To report a bug: -* Go to the **[Issues](../../issues)** page. -* Click **New issue**. -* Click **Get started**. - -## Other support - -For all other support, including new feature requests, see: - -* Square developer forums: [https://developer.squareup.com/forums](https://developer.squareup.com/forums) -* Square support center: [https://squareup.com/help/us/en](https://squareup.com/help/us/en) diff --git a/LICENSE b/LICENSE index 71fb2ce0d..f5669d1d5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,10 +1,21 @@ -Copyright 2024 Square, Inc. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +MIT License + +Copyright (c) 2025 Square. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 82be4626c..a84d22ec0 100644 --- a/README.md +++ b/README.md @@ -1,189 +1,280 @@ -[![Build](https://github.com/square/square-nodejs-sdk/actions/workflows/node.js.yml/badge.svg)](https://github.com/square/square-nodejs-sdk/actions/workflows/node.js.yml) -[![npm version](https://badge.fury.io/js/square.svg)](https://badge.fury.io/js/square) -[![Apache-2 license](https://img.shields.io/badge/license-Apache2-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0) +# Square TypeScript Library -# Square Node.js SDK +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fsquare%2Fsquare-nodejs-sdk) +[![npm shield](https://img.shields.io/npm/v/square)](https://www.npmjs.com/package/square) -Use this JavaScript library to manage Square resources (such as payments, orders, items, and inventory) for your own Square account or on behalf of Square sellers. +The Square TypeScript library provides convenient access to the Square API from TypeScript. -* [Requirements](#requirements) -* [Installation](#installation) -* [Quickstart](#quickstart) -* [Usage](#usage) -* [Tests](#tests) -* [SDK Reference](#sdk-reference) -* [Deprecated APIs](#deprecated-apis) +## Installation -## Requirements +```sh +npm i -s square +``` -Use of the Square Node.js SDK requires: +## Reference -* Node.js 14 or higher +A full reference for this library is available [here](./reference.md). -This SDK supports Node.js versions that are either current, or that are in long-term support status (LTS). The SDK does not support Node.js versions that have reached their end-of-life (EOL). For more information on Node.js versioning, see . +## Versioning -This SDK is for use with Node.js only. It does not support other usages, such as for web browsers or frontend applications. +By default, the SDK is pinned to the latest version. If you would like +to override this version you can simply pass in a request option. -## Installation +```ts +await client.payments.create(..., { + version: "2024-05-04" // override the version used +}) +``` -For more information, see [Set Up Your Square SDK for a Node.js Project](https://developer.squareup.com/docs/sdks/nodejs/setup-project). +## Usage -## Quickstart +Instantiate and use the client with the following: + +```typescript +import { SquareClient } from "square"; + +const client = new SquareClient({ token: "YOUR_TOKEN" }); +await client.payments.create({ + sourceId: "ccof:GaJGNaZa8x4OgDJn4GB", + idempotencyKey: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + amountMoney: { + amount: 1000, + currency: "USD", + }, + appFeeMoney: { + amount: 10, + currency: "USD", + }, + autocomplete: true, + customerId: "W92WH6P11H4Z77CTET0RNTGFW8", + locationId: "L88917AVBK2S5", + referenceId: "123456", + note: "Brief description", +}); +``` -For more information, see [Square Node.js SDK Quickstart](https://developer.squareup.com/docs/sdks/nodejs/quick-start). +## Request And Response Types -## Usage -For more information, see [Using the Square Node.js SDK](https://developer.squareup.com/docs/sdks/nodejs/using-nodejs-sdk). +The SDK exports all request and response types as TypeScript interfaces. Simply import them with the +following namespace: -## Tests +```typescript +import { Square } from "square"; -First, clone the repo locally and `cd` into the directory. +const request: Square.CreateMobileAuthorizationCodeRequest = { + ... +}; +``` -```sh -git clone https://github.com/square/square-nodejs-sdk.git -cd square-nodejs-sdk +## Legacy SDK + +> If you're using TypeScript, make sure that the `moduleResolution` setting in your `tsconfig.json` is equal to `node16`, `nodenext`, +> or `bundler` to consume the legacy SDK. + +While the new SDK has a lot of improvements, we at Square understand that it takes time to upgrade when there are breaking changes. +To make the migration easier, the new SDK also exports the legacy SDK as `square/legacy`. Here's an example of how you can use the +legacy SDK alongside the new SDK inside a single file: + +```typescript +import { randomUUID } from "crypto"; +import { Square, SquareClient } from "square"; +import { Client } from "square/legacy"; + +const client = new SquareClient({ + token: process.env.SQUARE_ACCESS_TOKEN, +}); + +const legacyClient = new Client({ + bearerAuthCredentials: { + accessToken: process.env.SQUARE_ACCESS_TOKEN!, + }, +}); + +async function getLocation(): Promise { + return ( + await client.locations.get({ + locationId: "YOUR_LOCATION_ID", + }) + ).location!; +} + +async function createOrder() { + const location = await getLocation(); + await legacyClient.ordersApi.createOrder({ + idempotencyKey: randomUUID(), + order: { + locationId: location.id!, + lineItems: [ + { + name: "New Item", + quantity: "1", + basePriceMoney: { + amount: BigInt(100), + currency: "USD", + }, + }, + ], + }, + }); +} + +createOrder(); ``` -Next, install dependencies and build. +We recommend migrating to the new SDK using the following steps: -```sh -npm install -npm run build +1. Upgrade the NPM module to `^40.0.0` +2. Search and replace all requires and imports from `"square"` to `"square/legacy"` + +- For required, replace `require("square")` with `require("square/legacy")` +- For imports, replace `from "square"` with `from "square/legacy"` +- For dynamic imports, replace `import("square")` with `import("square/legacy")` + +3. Gradually move over to use the new SDK by importing it from the `"square"` import. + +## Exception Handling + +When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error +will be thrown. + +```typescript +import { SquareError } from "square"; + +try { + await client.payments.create(...); +} catch (err) { + if (err instanceof SquareError) { + console.log(err.statusCode); + console.log(err.message); + console.log(err.body); + } +} ``` -Before running the tests, get a sandbox access token from your [Developer Dashboard] and use it to set a `SQUARE_SANDBOX_TOKEN` environment variable. +## Pagination -```sh -export SQUARE_SANDBOX_TOKEN="YOUR SANDBOX ACCESS TOKEN HERE" +List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items: + +```typescript +import { SquareClient } from "square"; + +const client = new SquareClient({ token: "YOUR_TOKEN" }); +const response = await client.bankAccounts.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.bankAccounts.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ``` -And run the tests. +## Advanced -```sh -npm test +### Additional Headers + +If you would like to send additional headers as part of the request, use the `headers` request option. + +```typescript +const response = await client.payments.create(..., { + headers: { + 'X-Custom-Header': 'custom value' + } +}); +``` + +### Retries + +The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long +as the request is deemed retriable and the number of retry attempts has not grown larger than the configured +retry limit (default: 2). + +A request is deemed retriable when any of the following HTTP status codes is returned: + +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + +Use the `maxRetries` request option to configure this behavior. + +```typescript +const response = await client.payments.create(..., { + maxRetries: 0 // override maxRetries at the request level +}); +``` + +### Timeouts + +The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior. + +```typescript +const response = await client.payments.create(..., { + timeoutInSeconds: 30 // override timeout to 30s +}); ``` -## SDK Reference - -### Payments -* [Payments] -* [Refunds] -* [Disputes] -* [Checkout] -* [Apple Pay] -* [Cards] -* [Payouts] - -### Terminal -* [Terminal] - -### Orders -* [Orders] -* [Order Custom Attributes] - -### Subscriptions -* [Subscriptions] - -### Invoices -* [Invoices] - -### Items -* [Catalog] -* [Inventory] - -### Customers -* [Customers] -* [Customer Groups] -* [Customer Segments] - -### Loyalty -* [Loyalty] - -### Gift Cards -* [Gift Cards] -* [Gift Card Activities] - -### Bookings -* [Bookings] -* [Booking Custom Attributes] - -### Business -* [Merchants] -* [Merchant Custom Attributes] -* [Locations] -* [Location Custom Attributes] -* [Devices] -* [Cash Drawers] - -### Team -* [Team] -* [Labor] - -### Financials -* [Bank Accounts] - -### Online -* [Sites] -* [Snippets] - -### Authorization -* [Mobile Authorization] -* [OAuth] - -### Webhook Subscriptions -* [Webhook Subscriptions] -## Deprecated APIs - -The following Square APIs are [deprecated](https://developer.squareup.com/docs/build-basics/api-lifecycle): - -* [Employees] - replaced by the [Team] API. For more information, see [Migrate from the Employees API](https://developer.squareup.com/docs/team/migrate-from-v2-employees). - -* [Transactions] - replaced by the [Orders] and [Payments] APIs. For more information, see [Migrate from the Transactions API](https://developer.squareup.com/docs/payments-api/migrate-from-transactions-api). - - -[Developer Dashboard]: https://developer.squareup.com/apps -[Square API]: https://squareup.com/developers -[sign up for a developer account]: https://squareup.com/signup?v=developers -[Locations overview]: https://developer.squareup.com/docs/locations-api -[OAuth overview]: https://developer.squareup.com/docs/oauth-api/overview -[Client]: doc/client.md -[Devices]: doc/api/devices.md -[Disputes]: doc/api/disputes.md -[Terminal]: doc/api/terminal.md -[Team]: doc/api/team.md -[Cash Drawers]: doc/api/cash-drawers.md -[Vendors]: doc/api/vendors.md -[Customer Groups]: doc/api/customer-groups.md -[Customer Segments]: doc/api/customer-segments.md -[Bank Accounts]: doc/api/bank-accounts.md -[Payments]: doc/api/payments.md -[Checkout]: doc/api/checkout.md -[Catalog]: doc/api/catalog.md -[Customers]: doc/api/customers.md -[Customer Custom Attributes]: doc/api/customer-custom-attributes.md -[Inventory]: doc/api/inventory.md -[Labor]: doc/api/labor.md -[Loyalty]: doc/api/loyalty.md -[Bookings]: doc/api/bookings.md -[Booking Custom Attributes]: doc/api/booking-custom-attributes.md -[Locations]: doc/api/locations.md -[Location Custom Attributes]: doc/api/location-custom-attributes.md -[Merchants]: doc/api/merchants.md -[Merchant Custom Attributes]: doc/api/merchant-custom-attributes.md -[Orders]: doc/api/orders.md -[Order Custom Attributes]: doc/api/order-custom-attributes.md -[Invoices]: doc/api/invoices.md -[Apple Pay]: doc/api/apple-pay.md -[Refunds]: doc/api/refunds.md -[Subscriptions]: doc/api/subscriptions.md -[Mobile Authorization]: doc/api/mobile-authorization.md -[OAuth]: doc/api/o-auth.md -[Sites]: doc/api/sites.md -[Snippets]: doc/api/snippets.md -[Cards]: doc/api/cards.md -[Payouts]: doc/api/payouts.md -[Gift Cards]: doc/api/gift-cards.md -[Gift Card Activities]: doc/api/gift-card-activities.md -[Employees]: doc/api/employees.md -[Transactions]: doc/api/transactions.md -[Webhook Subscriptions]: doc/api/webhook-subscriptions.md +### Aborting Requests + +The SDK allows users to abort requests at any point by passing in an abort signal. + +```typescript +const controller = new AbortController(); +const response = await client.payments.create(..., { + abortSignal: controller.signal +}); +controller.abort(); // aborts the request +``` + +### Runtime Compatibility + +The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following +runtimes: + +- Node.js 18+ +- Vercel +- Cloudflare Workers +- Deno v1.25+ +- Bun 1.0+ +- React Native + +### Customizing Fetch Client + +The SDK provides a way for your to customize the underlying HTTP client / Fetch function. If you're running in an +unsupported environment, this provides a way for you to break glass and ensure the SDK works. + +```typescript +import { SquareClient } from "square"; + +const client = new SquareClient({ + ... + fetcher: // provide your implementation here +}); +``` + +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. +Additions made directly to this library would have to be moved over to our generation code, +otherwise they would be overwritten upon the next generated release. Feel free to open a PR as +a proof of concept, but know that we will not be able to merge it as-is. We suggest opening +an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! + +## Webhook Signature Verification + +The SDK provides utility methods that allow you to verify webhook signatures and ensure that all +webhook events originate from Square. The `Webhooks.verifySignature` method will verify the signature. + +```ts +import { WebhooksHelper } from "square"; + +const isValid = WebhooksHelper.verifySignature({ + requestBody, + signatureHeader: request.headers["x-square-hmacsha256-signature"], + signatureKey: "YOUR_SIGNATURE_KEY", + notificationUrl: "https://example.com/webhook", // The URL where event notifications are sent. +}); +``` diff --git a/doc/api-error.md b/doc/api-error.md deleted file mode 100644 index 60d30c4f4..000000000 --- a/doc/api-error.md +++ /dev/null @@ -1,18 +0,0 @@ - -# ApiError - -Thrown when the HTTP status code is not okay. - -The ApiError extends the ApiResponse interface, so all ApiResponse properties are available. - -## Properties - -| Name | Type | Description | -| --- | --- | --- | -| request | HttpRequest | Original request that resulted in this response. | -| statusCode | number | Response status code. | -| headers | Record | Response headers. | -| result | T | Response data. | -| body | string \| Blob \| NodeJS.ReadableStream | Original body from the response. | -| errors? | Error[] | Represents an error encountered during a request to the Connect API | - diff --git a/doc/api-response.md b/doc/api-response.md deleted file mode 100644 index 1e886c9e1..000000000 --- a/doc/api-response.md +++ /dev/null @@ -1,15 +0,0 @@ - -# ApiResponse - -An interface for the result of an API call. - -## Properties - -| Name | Type | Description | -| --- | --- | --- | -| request | HttpRequest | Original request that resulted in this response. | -| statusCode | number | Response status codee. | -| headers | Record | Response headers. | -| result | T | Response data. | -| body | string \| Blob \| NodeJS.ReadableStream | Original body from the response. | - diff --git a/doc/api/apple-pay.md b/doc/api/apple-pay.md deleted file mode 100644 index 867c9b2de..000000000 --- a/doc/api/apple-pay.md +++ /dev/null @@ -1,65 +0,0 @@ -# Apple Pay - -```ts -const applePayApi = client.applePayApi; -``` - -## Class Name - -`ApplePayApi` - - -# Register Domain - -Activates a domain for use with Apple Pay on the Web and Square. A validation -is performed on this domain by Apple to ensure that it is properly set up as -an Apple Pay enabled domain. - -This endpoint provides an easy way for platform developers to bulk activate -Apple Pay on the Web with Square for merchants using their platform. - -Note: You will need to host a valid domain verification file on your domain to support Apple Pay. The -current version of this file is always available at https://app.squareup.com/digital-wallets/apple-pay/apple-developer-merchantid-domain-association, -and should be hosted at `.well_known/apple-developer-merchantid-domain-association` on your -domain. This file is subject to change; we strongly recommend checking for updates regularly and avoiding -long-lived caches that might not keep in sync with the correct file version. - -To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an Apple Pay Payment](https://developer.squareup.com/docs/web-payments/apple-pay). - -```ts -async registerDomain( - body: RegisterDomainRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`RegisterDomainRequest`](../../doc/models/register-domain-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RegisterDomainResponse`](../../doc/models/register-domain-response.md) - -## Example Usage - -```ts -const body: RegisterDomainRequest = { - domainName: 'example.com', -}; - -try { - const { result, ...httpResponse } = await applePayApi.registerDomain(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 7bfa7a63f..000000000 --- a/doc/api/bank-accounts.md +++ /dev/null @@ -1,139 +0,0 @@ -# Bank Accounts - -```ts -const bankAccountsApi = client.bankAccountsApi; -``` - -## Class Name - -`BankAccountsApi` - -## Methods - -* [List Bank Accounts](../../doc/api/bank-accounts.md#list-bank-accounts) -* [Get Bank Account by V1 Id](../../doc/api/bank-accounts.md#get-bank-account-by-v1-id) -* [Get Bank Account](../../doc/api/bank-accounts.md#get-bank-account) - - -# List Bank Accounts - -Returns a list of [BankAccount](../../doc/models/bank-account.md) objects linked to a Square account. - -```ts -async listBankAccounts( - cursor?: string, - limit?: number, - locationId?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | The pagination cursor returned by a previous call to this endpoint.
Use it in the next `ListBankAccounts` request to retrieve the next set
of results.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | -| `limit` | `number \| undefined` | Query, Optional | Upper limit on the number of bank accounts to return in the response.
Currently, 1000 is the largest supported limit. You can specify a limit
of up to 1000 bank accounts. This is also the default limit. | -| `locationId` | `string \| undefined` | Query, Optional | Location ID. You can specify this optional filter
to retrieve only the linked bank accounts belonging to a specific location. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListBankAccountsResponse`](../../doc/models/list-bank-accounts-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await bankAccountsApi.listBankAccounts(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Bank Account by V1 Id - -Returns details of a [BankAccount](../../doc/models/bank-account.md) identified by V1 bank account ID. - -```ts -async getBankAccountByV1Id( - v1BankAccountId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `v1BankAccountId` | `string` | Template, Required | Connect V1 ID of the desired `BankAccount`. For more information, see
[Retrieve a bank account by using an ID issued by V1 Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api#retrieve-a-bank-account-by-using-an-id-issued-by-v1-bank-accounts-api). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetBankAccountByV1IdResponse`](../../doc/models/get-bank-account-by-v1-id-response.md) - -## Example Usage - -```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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Bank Account - -Returns details of a [BankAccount](../../doc/models/bank-account.md) -linked to a Square account. - -```ts -async getBankAccount( - bankAccountId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bankAccountId` | `string` | Template, Required | Square-issued ID of the desired `BankAccount`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetBankAccountResponse`](../../doc/models/get-bank-account-response.md) - -## Example Usage - -```ts -const bankAccountId = 'bank_account_id0'; - -try { - const { result, ...httpResponse } = await bankAccountsApi.getBankAccount(bankAccountId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index c051cf499..000000000 --- a/doc/api/booking-custom-attributes.md +++ /dev/null @@ -1,606 +0,0 @@ -# Booking Custom Attributes - -```ts -const bookingCustomAttributesApi = client.bookingCustomAttributesApi; -``` - -## Class Name - -`BookingCustomAttributesApi` - -## Methods - -* [List Booking Custom Attribute Definitions](../../doc/api/booking-custom-attributes.md#list-booking-custom-attribute-definitions) -* [Create Booking Custom Attribute Definition](../../doc/api/booking-custom-attributes.md#create-booking-custom-attribute-definition) -* [Delete Booking Custom Attribute Definition](../../doc/api/booking-custom-attributes.md#delete-booking-custom-attribute-definition) -* [Retrieve Booking Custom Attribute Definition](../../doc/api/booking-custom-attributes.md#retrieve-booking-custom-attribute-definition) -* [Update Booking Custom Attribute Definition](../../doc/api/booking-custom-attributes.md#update-booking-custom-attribute-definition) -* [Bulk Delete Booking Custom Attributes](../../doc/api/booking-custom-attributes.md#bulk-delete-booking-custom-attributes) -* [Bulk Upsert Booking Custom Attributes](../../doc/api/booking-custom-attributes.md#bulk-upsert-booking-custom-attributes) -* [List Booking Custom Attributes](../../doc/api/booking-custom-attributes.md#list-booking-custom-attributes) -* [Delete Booking Custom Attribute](../../doc/api/booking-custom-attributes.md#delete-booking-custom-attribute) -* [Retrieve Booking Custom Attribute](../../doc/api/booking-custom-attributes.md#retrieve-booking-custom-attribute) -* [Upsert Booking Custom Attribute](../../doc/api/booking-custom-attributes.md#upsert-booking-custom-attribute) - - -# List Booking Custom Attribute Definitions - -Get all bookings custom attribute definitions. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. - -```ts -async listBookingCustomAttributeDefinitions( - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListBookingCustomAttributeDefinitionsResponse`](../../doc/models/list-booking-custom-attribute-definitions-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.listBookingCustomAttributeDefinitions(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Booking Custom Attribute Definition - -Creates a bookings custom attribute definition. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async createBookingCustomAttributeDefinition( - body: CreateBookingCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateBookingCustomAttributeDefinitionRequest`](../../doc/models/create-booking-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateBookingCustomAttributeDefinitionResponse`](../../doc/models/create-booking-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const body: CreateBookingCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - }, -}; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.createBookingCustomAttributeDefinition(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Booking Custom Attribute Definition - -Deletes a bookings custom attribute definition. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async deleteBookingCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteBookingCustomAttributeDefinitionResponse`](../../doc/models/delete-booking-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.deleteBookingCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Booking Custom Attribute Definition - -Retrieves a bookings custom attribute definition. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. - -```ts -async retrieveBookingCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to retrieve. If the requesting application
is not the definition owner, you must use the qualified key. | -| `version` | `number \| undefined` | Query, Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveBookingCustomAttributeDefinitionResponse`](../../doc/models/retrieve-booking-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.retrieveBookingCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Booking Custom Attribute Definition - -Updates a bookings custom attribute definition. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async updateBookingCustomAttributeDefinition( - key: string, - body: UpdateBookingCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to update. | -| `body` | [`UpdateBookingCustomAttributeDefinitionRequest`](../../doc/models/update-booking-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateBookingCustomAttributeDefinitionResponse`](../../doc/models/update-booking-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -const body: UpdateBookingCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - }, -}; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.updateBookingCustomAttributeDefinition( - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Delete Booking Custom Attributes - -Bulk deletes bookings custom attributes. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async bulkDeleteBookingCustomAttributes( - body: BulkDeleteBookingCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkDeleteBookingCustomAttributesRequest`](../../doc/models/bulk-delete-booking-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkDeleteBookingCustomAttributesResponse`](../../doc/models/bulk-delete-booking-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkDeleteBookingCustomAttributesRequest = { - values: { - 'key0': { - bookingId: 'booking_id4', - key: 'key0', - }, - 'key1': { - bookingId: 'booking_id4', - key: 'key0', - } - }, -}; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.bulkDeleteBookingCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Upsert Booking Custom Attributes - -Bulk upserts bookings custom attributes. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async bulkUpsertBookingCustomAttributes( - body: BulkUpsertBookingCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkUpsertBookingCustomAttributesRequest`](../../doc/models/bulk-upsert-booking-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkUpsertBookingCustomAttributesResponse`](../../doc/models/bulk-upsert-booking-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkUpsertBookingCustomAttributesRequest = { - values: { - 'key0': { - bookingId: 'booking_id4', - customAttribute: { - }, - }, - 'key1': { - bookingId: 'booking_id4', - customAttribute: { - }, - } - }, -}; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.bulkUpsertBookingCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Booking Custom Attributes - -Lists a booking's custom attributes. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. - -```ts -async listBookingCustomAttributes( - bookingId: string, - limit?: number, - cursor?: string, - withDefinitions?: boolean, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Template, Required | The ID of the target [booking](entity:Booking). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListBookingCustomAttributesResponse`](../../doc/models/list-booking-custom-attributes-response.md) - -## Example Usage - -```ts -const bookingId = 'booking_id4'; - -const withDefinitions = false; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.listBookingCustomAttributes( - bookingId, - undefined, - undefined, - withDefinitions -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Booking Custom Attribute - -Deletes a bookings custom attribute. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async deleteBookingCustomAttribute( - bookingId: string, - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Template, Required | The ID of the target [booking](entity:Booking). | -| `key` | `string` | Template, Required | The key of the custom attribute to delete. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteBookingCustomAttributeResponse`](../../doc/models/delete-booking-custom-attribute-response.md) - -## Example Usage - -```ts -const bookingId = 'booking_id4'; - -const key = 'key0'; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.deleteBookingCustomAttribute( - bookingId, - key -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Booking Custom Attribute - -Retrieves a bookings custom attribute. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. - -```ts -async retrieveBookingCustomAttribute( - bookingId: string, - key: string, - withDefinition?: boolean, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Template, Required | The ID of the target [booking](entity:Booking). | -| `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `withDefinition` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `version` | `number \| undefined` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveBookingCustomAttributeResponse`](../../doc/models/retrieve-booking-custom-attribute-response.md) - -## Example Usage - -```ts -const bookingId = 'booking_id4'; - -const key = 'key0'; - -const withDefinition = false; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.retrieveBookingCustomAttribute( - bookingId, - key, - withDefinition -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Upsert Booking Custom Attribute - -Upserts a bookings custom attribute. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async upsertBookingCustomAttribute( - bookingId: string, - key: string, - body: UpsertBookingCustomAttributeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Template, Required | The ID of the target [booking](entity:Booking). | -| `key` | `string` | Template, Required | The key of the custom attribute to create or update. This key must match the `key` of a
custom attribute definition in the Square seller account. If the requesting application is not
the definition owner, you must use the qualified key. | -| `body` | [`UpsertBookingCustomAttributeRequest`](../../doc/models/upsert-booking-custom-attribute-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpsertBookingCustomAttributeResponse`](../../doc/models/upsert-booking-custom-attribute-response.md) - -## Example Usage - -```ts -const bookingId = 'booking_id4'; - -const key = 'key0'; - -const body: UpsertBookingCustomAttributeRequest = { - customAttribute: { - }, -}; - -try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.upsertBookingCustomAttribute( - bookingId, - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index cfb229f45..000000000 --- a/doc/api/bookings.md +++ /dev/null @@ -1,636 +0,0 @@ -# Bookings - -```ts -const bookingsApi = client.bookingsApi; -``` - -## Class Name - -`BookingsApi` - -## Methods - -* [List Bookings](../../doc/api/bookings.md#list-bookings) -* [Create Booking](../../doc/api/bookings.md#create-booking) -* [Search Availability](../../doc/api/bookings.md#search-availability) -* [Bulk Retrieve Bookings](../../doc/api/bookings.md#bulk-retrieve-bookings) -* [Retrieve Business Booking Profile](../../doc/api/bookings.md#retrieve-business-booking-profile) -* [List Location Booking Profiles](../../doc/api/bookings.md#list-location-booking-profiles) -* [Retrieve Location Booking Profile](../../doc/api/bookings.md#retrieve-location-booking-profile) -* [List Team Member Booking Profiles](../../doc/api/bookings.md#list-team-member-booking-profiles) -* [Bulk Retrieve Team Member Booking Profiles](../../doc/api/bookings.md#bulk-retrieve-team-member-booking-profiles) -* [Retrieve Team Member Booking Profile](../../doc/api/bookings.md#retrieve-team-member-booking-profile) -* [Retrieve Booking](../../doc/api/bookings.md#retrieve-booking) -* [Update Booking](../../doc/api/bookings.md#update-booking) -* [Cancel Booking](../../doc/api/bookings.md#cancel-booking) - - -# List Bookings - -Retrieve a collection of bookings. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. - -```ts -async listBookings( - limit?: number, - cursor?: string, - customerId?: string, - teamMemberId?: string, - locationId?: string, - startAtMin?: string, - startAtMax?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results per page to return in a paged response. | -| `cursor` | `string \| undefined` | Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. | -| `customerId` | `string \| undefined` | Query, Optional | The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all customers are retrieved. | -| `teamMemberId` | `string \| undefined` | Query, Optional | The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved. | -| `locationId` | `string \| undefined` | Query, Optional | The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved. | -| `startAtMin` | `string \| undefined` | Query, Optional | The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used. | -| `startAtMax` | `string \| undefined` | Query, Optional | The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days after `start_at_min` is used. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListBookingsResponse`](../../doc/models/list-bookings-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await bookingsApi.listBookings(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Booking - -Creates a booking. - -The required input must include the following: - -- `Booking.location_id` -- `Booking.start_at` -- `Booking.AppointmentSegment.team_member_id` -- `Booking.AppointmentSegment.service_variation_id` -- `Booking.AppointmentSegment.service_variation_version` - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async createBooking( - body: CreateBookingRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateBookingRequest`](../../doc/models/create-booking-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateBookingResponse`](../../doc/models/create-booking-response.md) - -## Example Usage - -```ts -const body: CreateBookingRequest = { - booking: { - }, -}; - -try { - const { result, ...httpResponse } = await bookingsApi.createBooking(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Availability - -Searches for availabilities for booking. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. - -```ts -async searchAvailability( - body: SearchAvailabilityRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchAvailabilityRequest`](../../doc/models/search-availability-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchAvailabilityResponse`](../../doc/models/search-availability-response.md) - -## Example Usage - -```ts -const body: SearchAvailabilityRequest = { - query: { - filter: { - startAtRange: { - }, - }, - }, -}; - -try { - const { result, ...httpResponse } = await bookingsApi.searchAvailability(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Retrieve Bookings - -Bulk-Retrieves a list of bookings by booking IDs. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. - -```ts -async bulkRetrieveBookings( - body: BulkRetrieveBookingsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkRetrieveBookingsRequest`](../../doc/models/bulk-retrieve-bookings-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkRetrieveBookingsResponse`](../../doc/models/bulk-retrieve-bookings-response.md) - -## Example Usage - -```ts -const body: BulkRetrieveBookingsRequest = { - bookingIds: [ - 'booking_ids8', - 'booking_ids9', - 'booking_ids0' - ], -}; - -try { - const { result, ...httpResponse } = await bookingsApi.bulkRetrieveBookings(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Business Booking Profile - -Retrieves a seller's booking profile. - -```ts -async retrieveBusinessBookingProfile( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveBusinessBookingProfileResponse`](../../doc/models/retrieve-business-booking-profile-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await bookingsApi.retrieveBusinessBookingProfile(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Location Booking Profiles - -Lists location booking profiles of a seller. - -```ts -async listLocationBookingProfiles( - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a paged response. | -| `cursor` | `string \| undefined` | Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListLocationBookingProfilesResponse`](../../doc/models/list-location-booking-profiles-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await bookingsApi.listLocationBookingProfiles(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Location Booking Profile - -Retrieves a seller's location booking profile. - -```ts -async retrieveLocationBookingProfile( - locationId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location to retrieve the booking profile. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLocationBookingProfileResponse`](../../doc/models/retrieve-location-booking-profile-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -try { - const { result, ...httpResponse } = await bookingsApi.retrieveLocationBookingProfile(locationId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Team Member Booking Profiles - -Lists booking profiles for team members. - -```ts -async listTeamMemberBookingProfiles( - bookableOnly?: boolean, - limit?: number, - cursor?: string, - locationId?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookableOnly` | `boolean \| undefined` | Query, Optional | Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`).
**Default**: `false` | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a paged response. | -| `cursor` | `string \| undefined` | Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. | -| `locationId` | `string \| undefined` | Query, Optional | Indicates whether to include only team members enabled at the given location in the returned result. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListTeamMemberBookingProfilesResponse`](../../doc/models/list-team-member-booking-profiles-response.md) - -## Example Usage - -```ts -const bookableOnly = false; - -try { - const { result, ...httpResponse } = await bookingsApi.listTeamMemberBookingProfiles(bookableOnly); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Retrieve Team Member Booking Profiles - -Retrieves one or more team members' booking profiles. - -```ts -async bulkRetrieveTeamMemberBookingProfiles( - body: BulkRetrieveTeamMemberBookingProfilesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkRetrieveTeamMemberBookingProfilesRequest`](../../doc/models/bulk-retrieve-team-member-booking-profiles-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkRetrieveTeamMemberBookingProfilesResponse`](../../doc/models/bulk-retrieve-team-member-booking-profiles-response.md) - -## Example Usage - -```ts -const body: BulkRetrieveTeamMemberBookingProfilesRequest = { - teamMemberIds: [ - 'team_member_ids3', - 'team_member_ids4', - 'team_member_ids5' - ], -}; - -try { - const { result, ...httpResponse } = await bookingsApi.bulkRetrieveTeamMemberBookingProfiles(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Team Member Booking Profile - -Retrieves a team member's booking profile. - -```ts -async retrieveTeamMemberBookingProfile( - teamMemberId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string` | Template, Required | The ID of the team member to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveTeamMemberBookingProfileResponse`](../../doc/models/retrieve-team-member-booking-profile-response.md) - -## Example Usage - -```ts -const teamMemberId = 'team_member_id0'; - -try { - const { result, ...httpResponse } = await bookingsApi.retrieveTeamMemberBookingProfile(teamMemberId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Booking - -Retrieves a booking. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. - -```ts -async retrieveBooking( - bookingId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Template, Required | The ID of the [Booking](entity:Booking) object representing the to-be-retrieved booking. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveBookingResponse`](../../doc/models/retrieve-booking-response.md) - -## Example Usage - -```ts -const bookingId = 'booking_id4'; - -try { - const { result, ...httpResponse } = await bookingsApi.retrieveBooking(bookingId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Booking - -Updates a booking. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async updateBooking( - bookingId: string, - body: UpdateBookingRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Template, Required | The ID of the [Booking](entity:Booking) object representing the to-be-updated booking. | -| `body` | [`UpdateBookingRequest`](../../doc/models/update-booking-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateBookingResponse`](../../doc/models/update-booking-response.md) - -## Example Usage - -```ts -const bookingId = 'booking_id4'; - -const body: UpdateBookingRequest = { - booking: { - }, -}; - -try { - const { result, ...httpResponse } = await bookingsApi.updateBooking( - bookingId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Booking - -Cancels an existing booking. - -To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. -To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. - -For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* -or *Appointments Premium*. - -```ts -async cancelBooking( - bookingId: string, - body: CancelBookingRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Template, Required | The ID of the [Booking](entity:Booking) object representing the to-be-cancelled booking. | -| `body` | [`CancelBookingRequest`](../../doc/models/cancel-booking-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelBookingResponse`](../../doc/models/cancel-booking-response.md) - -## Example Usage - -```ts -const bookingId = 'booking_id4'; - -const body: CancelBookingRequest = { -}; - -try { - const { result, ...httpResponse } = await bookingsApi.cancelBooking( - bookingId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 004664f10..000000000 --- a/doc/api/cards.md +++ /dev/null @@ -1,207 +0,0 @@ -# Cards - -```ts -const cardsApi = client.cardsApi; -``` - -## Class Name - -`CardsApi` - -## Methods - -* [List Cards](../../doc/api/cards.md#list-cards) -* [Create Card](../../doc/api/cards.md#create-card) -* [Retrieve Card](../../doc/api/cards.md#retrieve-card) -* [Disable Card](../../doc/api/cards.md#disable-card) - - -# List Cards - -Retrieves a list of cards owned by the account making the request. -A max of 25 cards will be returned. - -```ts -async listCards( - cursor?: string, - customerId?: string, - includeDisabled?: boolean, - referenceId?: string, - sortOrder?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `customerId` | `string \| undefined` | Query, Optional | Limit results to cards associated with the customer supplied.
By default, all cards owned by the merchant are returned. | -| `includeDisabled` | `boolean \| undefined` | Query, Optional | Includes disabled cards.
By default, all enabled cards owned by the merchant are returned.
**Default**: `false` | -| `referenceId` | `string \| undefined` | Query, Optional | Limit results to cards associated with the reference_id supplied. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | Sorts the returned list by when the card was created with the specified order.
This field defaults to ASC. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCardsResponse`](../../doc/models/list-cards-response.md) - -## Example Usage - -```ts -const includeDisabled = false; - -try { - const { result, ...httpResponse } = await cardsApi.listCards( - undefined, - undefined, - includeDisabled -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Card - -Adds a card on file to an existing merchant. - -```ts -async createCard( - body: CreateCardRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateCardRequest`](../../doc/models/create-card-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateCardResponse`](../../doc/models/create-card-response.md) - -## Example Usage - -```ts -const body: CreateCardRequest = { - idempotencyKey: '4935a656-a929-4792-b97c-8848be85c27c', - sourceId: 'cnon:uIbfJXhXETSP197M3GB', - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Card - -Retrieves details for a specific Card. - -```ts -async retrieveCard( - cardId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cardId` | `string` | Template, Required | Unique ID for the desired Card. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveCardResponse`](../../doc/models/retrieve-card-response.md) - -## Example Usage - -```ts -const cardId = 'card_id4'; - -try { - const { result, ...httpResponse } = await cardsApi.retrieveCard(cardId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Disable Card - -Disables the card, preventing any further updates or charges. -Disabling an already disabled card is allowed but has no effect. - -```ts -async disableCard( - cardId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cardId` | `string` | Template, Required | Unique ID for the desired Card. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DisableCardResponse`](../../doc/models/disable-card-response.md) - -## Example Usage - -```ts -const cardId = 'card_id4'; - -try { - const { result, ...httpResponse } = await cardsApi.disableCard(cardId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index fdafbe0ce..000000000 --- a/doc/api/cash-drawers.md +++ /dev/null @@ -1,166 +0,0 @@ -# Cash Drawers - -```ts -const cashDrawersApi = client.cashDrawersApi; -``` - -## Class Name - -`CashDrawersApi` - -## Methods - -* [List Cash Drawer Shifts](../../doc/api/cash-drawers.md#list-cash-drawer-shifts) -* [Retrieve Cash Drawer Shift](../../doc/api/cash-drawers.md#retrieve-cash-drawer-shift) -* [List Cash Drawer Shift Events](../../doc/api/cash-drawers.md#list-cash-drawer-shift-events) - - -# List Cash Drawer Shifts - -Provides the details for all of the cash drawer shifts for a location -in a date range. - -```ts -async listCashDrawerShifts( - locationId: string, - sortOrder?: string, - beginTime?: string, - endTime?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Query, Required | The ID of the location to query for a list of cash drawer shifts. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | The order in which cash drawer shifts are listed in the response,
based on their opened_at field. Default value: ASC | -| `beginTime` | `string \| undefined` | Query, Optional | The inclusive start time of the query on opened_at, in ISO 8601 format. | -| `endTime` | `string \| undefined` | Query, Optional | The exclusive end date of the query on opened_at, in ISO 8601 format. | -| `limit` | `number \| undefined` | Query, Optional | Number of cash drawer shift events in a page of results (200 by
default, 1000 max). | -| `cursor` | `string \| undefined` | Query, Optional | Opaque cursor for fetching the next page of results. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCashDrawerShiftsResponse`](../../doc/models/list-cash-drawer-shifts-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -try { - const { result, ...httpResponse } = await cashDrawersApi.listCashDrawerShifts(locationId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Cash Drawer Shift - -Provides the summary details for a single cash drawer shift. See -[ListCashDrawerShiftEvents](../../doc/api/cash-drawers.md#list-cash-drawer-shift-events) for a list of cash drawer shift events. - -```ts -async retrieveCashDrawerShift( - locationId: string, - shiftId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Query, Required | The ID of the location to retrieve cash drawer shifts from. | -| `shiftId` | `string` | Template, Required | The shift ID. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveCashDrawerShiftResponse`](../../doc/models/retrieve-cash-drawer-shift-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const shiftId = 'shift_id0'; - -try { - const { result, ...httpResponse } = await cashDrawersApi.retrieveCashDrawerShift( - locationId, - shiftId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Cash Drawer Shift Events - -Provides a paginated list of events for a single cash drawer shift. - -```ts -async listCashDrawerShiftEvents( - locationId: string, - shiftId: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Query, Required | The ID of the location to list cash drawer shifts for. | -| `shiftId` | `string` | Template, Required | The shift ID. | -| `limit` | `number \| undefined` | Query, Optional | Number of resources to be returned in a page of results (200 by
default, 1000 max). | -| `cursor` | `string \| undefined` | Query, Optional | Opaque cursor for fetching the next page of results. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCashDrawerShiftEventsResponse`](../../doc/models/list-cash-drawer-shift-events-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const shiftId = 'shift_id0'; - -try { - const { result, ...httpResponse } = await cashDrawersApi.listCashDrawerShiftEvents( - locationId, - shiftId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 65015c855..000000000 --- a/doc/api/catalog.md +++ /dev/null @@ -1,936 +0,0 @@ -# Catalog - -```ts -const catalogApi = client.catalogApi; -``` - -## Class Name - -`CatalogApi` - -## Methods - -* [Batch Delete Catalog Objects](../../doc/api/catalog.md#batch-delete-catalog-objects) -* [Batch Retrieve Catalog Objects](../../doc/api/catalog.md#batch-retrieve-catalog-objects) -* [Batch Upsert Catalog Objects](../../doc/api/catalog.md#batch-upsert-catalog-objects) -* [Create Catalog Image](../../doc/api/catalog.md#create-catalog-image) -* [Update Catalog Image](../../doc/api/catalog.md#update-catalog-image) -* [Catalog Info](../../doc/api/catalog.md#catalog-info) -* [List Catalog](../../doc/api/catalog.md#list-catalog) -* [Upsert Catalog Object](../../doc/api/catalog.md#upsert-catalog-object) -* [Delete Catalog Object](../../doc/api/catalog.md#delete-catalog-object) -* [Retrieve Catalog Object](../../doc/api/catalog.md#retrieve-catalog-object) -* [Search Catalog Objects](../../doc/api/catalog.md#search-catalog-objects) -* [Search Catalog Items](../../doc/api/catalog.md#search-catalog-items) -* [Update Item Modifier Lists](../../doc/api/catalog.md#update-item-modifier-lists) -* [Update Item Taxes](../../doc/api/catalog.md#update-item-taxes) - - -# Batch Delete Catalog Objects - -Deletes a set of [CatalogItem](../../doc/models/catalog-item.md)s based on the -provided list of target IDs and returns a set of successfully deleted IDs in -the response. Deletion is a cascading event such that all children of the -targeted object are also deleted. For example, deleting a CatalogItem will -also delete all of its [CatalogItemVariation](../../doc/models/catalog-item-variation.md) -children. - -`BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted -IDs can be deleted. The response will only include IDs that were -actually deleted. - -To ensure consistency, only one delete request is processed at a time per seller account. -While one (batch or non-batch) delete request is being processed, other (batched and non-batched) -delete requests are rejected with the `429` error code. - -```ts -async batchDeleteCatalogObjects( - body: BatchDeleteCatalogObjectsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchDeleteCatalogObjectsRequest`](../../doc/models/batch-delete-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchDeleteCatalogObjectsResponse`](../../doc/models/batch-delete-catalog-objects-response.md) - -## Example Usage - -```ts -const body: BatchDeleteCatalogObjectsRequest = { - objectIds: [ - 'W62UWFY35CWMYGVWK6TWJDNI', - 'AA27W3M2GGTF3H6AVPNB77CK' - ], -}; - -try { - const { result, ...httpResponse } = await catalogApi.batchDeleteCatalogObjects(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Batch Retrieve Catalog Objects - -Returns a set of objects based on the provided ID. -Each [CatalogItem](../../doc/models/catalog-item.md) returned in the set includes all of its -child information including: all of its -[CatalogItemVariation](../../doc/models/catalog-item-variation.md) objects, references to -its [CatalogModifierList](../../doc/models/catalog-modifier-list.md) objects, and the ids of -any [CatalogTax](../../doc/models/catalog-tax.md) objects that apply to it. - -```ts -async batchRetrieveCatalogObjects( - body: BatchRetrieveCatalogObjectsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchRetrieveCatalogObjectsRequest`](../../doc/models/batch-retrieve-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchRetrieveCatalogObjectsResponse`](../../doc/models/batch-retrieve-catalog-objects-response.md) - -## Example Usage - -```ts -const body: BatchRetrieveCatalogObjectsRequest = { - objectIds: [ - 'W62UWFY35CWMYGVWK6TWJDNI', - 'AA27W3M2GGTF3H6AVPNB77CK' - ], - includeRelatedObjects: true, -}; - -try { - const { result, ...httpResponse } = await catalogApi.batchRetrieveCatalogObjects(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Batch Upsert Catalog Objects - -Creates or updates up to 10,000 target objects based on the provided -list of objects. The target objects are grouped into batches and each batch is -inserted/updated in an all-or-nothing manner. If an object within a batch is -malformed in some way, or violates a database constraint, the entire batch -containing that item will be disregarded. However, other batches in the same -request may still succeed. Each batch may contain up to 1,000 objects, and -batches will be processed in order as long as the total object count for the -request (items, variations, modifier lists, discounts, and taxes) is no more -than 10,000. - -To ensure consistency, only one update request is processed at a time per seller account. -While one (batch or non-batch) update request is being processed, other (batched and non-batched) -update requests are rejected with the `429` error code. - -```ts -async batchUpsertCatalogObjects( - body: BatchUpsertCatalogObjectsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchUpsertCatalogObjectsRequest`](../../doc/models/batch-upsert-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchUpsertCatalogObjectsResponse`](../../doc/models/batch-upsert-catalog-objects-response.md) - -## Example Usage - -```ts -const body: BatchUpsertCatalogObjectsRequest = { - idempotencyKey: '789ff020-f723-43a9-b4b5-43b5dc1fa3dc', - batches: [ - { - objects: [ - { - type: 'ITEM', - id: '#Tea', - presentAtAllLocations: true, - itemData: { - name: 'Tea', - 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', - }, - }, - } - ], - categories: [ - { - id: '#Beverages', - } - ], - descriptionHtml: '

Hot Leaf Juice

', - }, - }, - { - type: 'ITEM', - id: '#Coffee', - presentAtAllLocations: true, - itemData: { - name: 'Coffee', - 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', - }, - }, - } - ], - categories: [ - { - id: '#Beverages', - } - ], - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Catalog Image - -Uploads an image file to be represented by a [CatalogImage](../../doc/models/catalog-image.md) object that can be linked to an existing -[CatalogObject](../../doc/models/catalog-object.md) instance. The resulting `CatalogImage` is unattached to any `CatalogObject` if the `object_id` -is not specified. - -This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in -JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. - -```ts -async createCatalogImage( - request?: CreateCatalogImageRequest, - imageFile?: FileWrapper, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `request` | [`CreateCatalogImageRequest \| undefined`](../../doc/models/create-catalog-image-request.md) | Form (JSON-Encoded), Optional | - | -| `imageFile` | `FileWrapper \| undefined` | Form, Optional | - | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateCatalogImageResponse`](../../doc/models/create-catalog-image-response.md) - -## Example Usage - -```ts -const request: CreateCatalogImageRequest = { - idempotencyKey: '528dea59-7bfb-43c1-bd48-4a6bba7dd61f86', - image: { - type: 'IMAGE', - id: '#TEMP_ID', - imageData: { - caption: 'A picture of a cup of coffee', - }, - }, - objectId: 'ND6EA5AAJEO5WL3JNNIAQA32', -}; - -try { - const { result, ...httpResponse } = await catalogApi.createCatalogImage(request); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Catalog Image - -Uploads a new image file to replace the existing one in the specified [CatalogImage](../../doc/models/catalog-image.md) object. - -This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in -JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. - -```ts -async updateCatalogImage( - imageId: string, - request?: UpdateCatalogImageRequest, - imageFile?: FileWrapper, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `imageId` | `string` | Template, Required | The ID of the `CatalogImage` object to update the encapsulated image file. | -| `request` | [`UpdateCatalogImageRequest \| undefined`](../../doc/models/update-catalog-image-request.md) | Form (JSON-Encoded), Optional | - | -| `imageFile` | `FileWrapper \| undefined` | Form, Optional | - | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateCatalogImageResponse`](../../doc/models/update-catalog-image-response.md) - -## Example Usage - -```ts -const imageId = 'image_id4'; - -const request: UpdateCatalogImageRequest = { - idempotencyKey: '528dea59-7bfb-43c1-bd48-4a6bba7dd61f86', -}; - -try { - const { result, ...httpResponse } = await catalogApi.updateCatalogImage( - imageId, - request -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Catalog Info - -Retrieves information about the Square Catalog API, such as batch size -limits that can be used by the `BatchUpsertCatalogObjects` endpoint. - -```ts -async catalogInfo( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CatalogInfoResponse`](../../doc/models/catalog-info-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await catalogApi.catalogInfo(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Catalog - -Returns a list of all [CatalogObject](../../doc/models/catalog-object.md)s of the specified types in the catalog. - -The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](../../doc/models/catalog-object-type.md) values, -for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`". - -__Important:__ ListCatalog does not return deleted catalog items. To retrieve -deleted catalog items, use [SearchCatalogObjects](../../doc/api/catalog.md#search-catalog-objects) -and set the `include_deleted_objects` attribute value to `true`. - -```ts -async listCatalog( - cursor?: string, - types?: string, - catalogVersion?: bigint, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | The pagination cursor returned in the previous response. Leave unset for an initial request.
The page size is currently set to be 100.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `types` | `string \| undefined` | Query, Optional | An optional case-insensitive, comma-separated list of object types to retrieve.

The valid values are defined in the [CatalogObjectType](entity:CatalogObjectType) enum, for example,
`ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,
`MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc.

If this is unspecified, the operation returns objects of all the top level types at the version
of the Square API used to make the request. Object types that are nested onto other object types
are not included in the defaults.

At the current API version the default object types are:
ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST,
PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,
SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. | -| `catalogVersion` | `bigint \| undefined` | Query, Optional | The specific version of the catalog objects to be included in the response.
This allows you to retrieve historical versions of objects. The specified version value is matched against
the [CatalogObject](../../doc/models/catalog-object.md)s' `version` attribute. If not included, results will be from the
current version of the catalog. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCatalogResponse`](../../doc/models/list-catalog-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await catalogApi.listCatalog(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Upsert Catalog Object - -Creates a new or updates the specified [CatalogObject](../../doc/models/catalog-object.md). - -To ensure consistency, only one update request is processed at a time per seller account. -While one (batch or non-batch) update request is being processed, other (batched and non-batched) -update requests are rejected with the `429` error code. - -```ts -async upsertCatalogObject( - body: UpsertCatalogObjectRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`UpsertCatalogObjectRequest`](../../doc/models/upsert-catalog-object-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpsertCatalogObjectResponse`](../../doc/models/upsert-catalog-object-response.md) - -## Example Usage - -```ts -const body: UpsertCatalogObjectRequest = { - idempotencyKey: 'af3d1afc-7212-4300-b463-0bfc5314a5ae', - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Catalog Object - -Deletes a single [CatalogObject](../../doc/models/catalog-object.md) based on the -provided ID and returns the set of successfully deleted IDs in the response. -Deletion is a cascading event such that all children of the targeted object -are also deleted. For example, deleting a [CatalogItem](../../doc/models/catalog-item.md) -will also delete all of its -[CatalogItemVariation](../../doc/models/catalog-item-variation.md) children. - -To ensure consistency, only one delete request is processed at a time per seller account. -While one (batch or non-batch) delete request is being processed, other (batched and non-batched) -delete requests are rejected with the `429` error code. - -```ts -async deleteCatalogObject( - objectId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `objectId` | `string` | Template, Required | The ID of the catalog object to be deleted. When an object is deleted, other
objects in the graph that depend on that object will be deleted as well (for example, deleting a
catalog item will delete its catalog item variations). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteCatalogObjectResponse`](../../doc/models/delete-catalog-object-response.md) - -## Example Usage - -```ts -const objectId = 'object_id8'; - -try { - const { result, ...httpResponse } = await catalogApi.deleteCatalogObject(objectId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Catalog Object - -Returns a single [CatalogItem](../../doc/models/catalog-item.md) as a -[CatalogObject](../../doc/models/catalog-object.md) based on the provided ID. The returned -object includes all of the relevant [CatalogItem](../../doc/models/catalog-item.md) -information including: [CatalogItemVariation](../../doc/models/catalog-item-variation.md) -children, references to its -[CatalogModifierList](../../doc/models/catalog-modifier-list.md) objects, and the ids of -any [CatalogTax](../../doc/models/catalog-tax.md) objects that apply to it. - -```ts -async retrieveCatalogObject( - objectId: string, - includeRelatedObjects?: boolean, - catalogVersion?: bigint, - includeCategoryPathToRoot?: boolean, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `objectId` | `string` | Template, Required | The object ID of any type of catalog objects to be retrieved. | -| `includeRelatedObjects` | `boolean \| undefined` | Query, Optional | If `true`, the response will include additional objects that are related to the
requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field
of the response. These objects are put in the `related_objects` field. Setting this to `true` is
helpful when the objects are needed for immediate display to a user.
This process only goes one level deep. Objects referenced by the related objects will not be included. For example,

if the `objects` field of the response contains a CatalogItem, its associated
CatalogCategory objects, CatalogTax objects, CatalogImage objects and
CatalogModifierLists will be returned in the `related_objects` field of the
response. If the `objects` field of the response contains a CatalogItemVariation,
its parent CatalogItem will be returned in the `related_objects` field of
the response.

Default value: `false`
**Default**: `false` | -| `catalogVersion` | `bigint \| undefined` | Query, Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical
versions of objects. The value to retrieve a specific version of an object can be found
in the version field of [CatalogObject](../../doc/models/catalog-object.md)s. If not included, results will
be from the current version of the catalog. | -| `includeCategoryPathToRoot` | `boolean \| undefined` | Query, Optional | Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists
of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category
and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned
in the response payload.
**Default**: `false` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveCatalogObjectResponse`](../../doc/models/retrieve-catalog-object-response.md) - -## Example Usage - -```ts -const objectId = 'object_id8'; - -const includeRelatedObjects = false; - -const includeCategoryPathToRoot = false; - -try { - const { result, ...httpResponse } = await catalogApi.retrieveCatalogObject( - objectId, - includeRelatedObjects, - undefined, - includeCategoryPathToRoot -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Catalog Objects - -Searches for [CatalogObject](../../doc/models/catalog-object.md) of any type by matching supported search attribute values, -excluding custom attribute values on items or item variations, against one or more of the specified query filters. - -This (`SearchCatalogObjects`) endpoint differs from the [SearchCatalogItems](../../doc/api/catalog.md#search-catalog-items) -endpoint in the following aspects: - -- `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. -- `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not. -- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does. -- The both endpoints have different call conventions, including the query filter formats. - -```ts -async searchCatalogObjects( - body: SearchCatalogObjectsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchCatalogObjectsRequest`](../../doc/models/search-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchCatalogObjectsResponse`](../../doc/models/search-catalog-objects-response.md) - -## Example Usage - -```ts -const body: SearchCatalogObjectsRequest = { - objectTypes: [ - 'ITEM' - ], - query: { - prefixQuery: { - attributeName: 'name', - attributePrefix: 'tea', - }, - }, - limit: 100, -}; - -try { - const { result, ...httpResponse } = await catalogApi.searchCatalogObjects(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Catalog Items - -Searches for catalog items or item variations by matching supported search attribute values, including -custom attribute values, against one or more of the specified query filters. - -This (`SearchCatalogItems`) endpoint differs from the [SearchCatalogObjects](../../doc/api/catalog.md#search-catalog-objects) -endpoint in the following aspects: - -- `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. -- `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not. -- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does. -- The both endpoints use different call conventions, including the query filter formats. - -```ts -async searchCatalogItems( - body: SearchCatalogItemsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchCatalogItemsRequest`](../../doc/models/search-catalog-items-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchCatalogItemsResponse`](../../doc/models/search-catalog-items-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Item Modifier Lists - -Updates the [CatalogModifierList](../../doc/models/catalog-modifier-list.md) objects -that apply to the targeted [CatalogItem](../../doc/models/catalog-item.md) without having -to perform an upsert on the entire item. - -```ts -async updateItemModifierLists( - body: UpdateItemModifierListsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`UpdateItemModifierListsRequest`](../../doc/models/update-item-modifier-lists-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateItemModifierListsResponse`](../../doc/models/update-item-modifier-lists-response.md) - -## Example Usage - -```ts -const body: UpdateItemModifierListsRequest = { - itemIds: [ - 'H42BRLUJ5KTZTTMPVSLFAACQ', - '2JXOBJIHCWBQ4NZ3RIXQGJA6' - ], - modifierListsToEnable: [ - 'H42BRLUJ5KTZTTMPVSLFAACQ', - '2JXOBJIHCWBQ4NZ3RIXQGJA6' - ], - modifierListsToDisable: [ - '7WRC16CJZDVLSNDQ35PP6YAD' - ], -}; - -try { - const { result, ...httpResponse } = await catalogApi.updateItemModifierLists(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Item Taxes - -Updates the [CatalogTax](../../doc/models/catalog-tax.md) objects that apply to the -targeted [CatalogItem](../../doc/models/catalog-item.md) without having to perform an -upsert on the entire item. - -```ts -async updateItemTaxes( - body: UpdateItemTaxesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`UpdateItemTaxesRequest`](../../doc/models/update-item-taxes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateItemTaxesResponse`](../../doc/models/update-item-taxes-response.md) - -## Example Usage - -```ts -const body: UpdateItemTaxesRequest = { - itemIds: [ - 'H42BRLUJ5KTZTTMPVSLFAACQ', - '2JXOBJIHCWBQ4NZ3RIXQGJA6' - ], - taxesToEnable: [ - '4WRCNHCJZDVLSNDQ35PP6YAD' - ], - taxesToDisable: [ - 'AQCEGCEBBQONINDOHRGZISEX' - ], -}; - -try { - const { result, ...httpResponse } = await catalogApi.updateItemTaxes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 47f9faafc..000000000 --- a/doc/api/checkout.md +++ /dev/null @@ -1,561 +0,0 @@ -# Checkout - -```ts -const checkoutApi = client.checkoutApi; -``` - -## Class Name - -`CheckoutApi` - -## Methods - -* [Create Checkout](../../doc/api/checkout.md#create-checkout) -* [Retrieve Location Settings](../../doc/api/checkout.md#retrieve-location-settings) -* [Update Location Settings](../../doc/api/checkout.md#update-location-settings) -* [Retrieve Merchant Settings](../../doc/api/checkout.md#retrieve-merchant-settings) -* [Update Merchant Settings](../../doc/api/checkout.md#update-merchant-settings) -* [List Payment Links](../../doc/api/checkout.md#list-payment-links) -* [Create Payment Link](../../doc/api/checkout.md#create-payment-link) -* [Delete Payment Link](../../doc/api/checkout.md#delete-payment-link) -* [Retrieve Payment Link](../../doc/api/checkout.md#retrieve-payment-link) -* [Update Payment Link](../../doc/api/checkout.md#update-payment-link) - - -# Create Checkout - -**This endpoint is deprecated.** - -Links a `checkoutId` to a `checkout_page_url` that customers are -directed to in order to provide their payment information using a -payment processing workflow hosted on connect.squareup.com. - -NOTE: The Checkout API has been updated with new features. -For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights). - -```ts -async createCheckout( - locationId: string, - body: CreateCheckoutRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the business location to associate the checkout with. | -| `body` | [`CreateCheckoutRequest`](../../doc/models/create-checkout-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateCheckoutResponse`](../../doc/models/create-checkout-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const body: CreateCheckoutRequest = { - idempotencyKey: '86ae1696-b1e3-4328-af6d-f1e04d947ad6', - 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', - }, - } - ], -}; - -try { - const { result, ...httpResponse } = await checkoutApi.createCheckout( - locationId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Location Settings - -Retrieves the location-level settings for a Square-hosted checkout page. - -```ts -async retrieveLocationSettings( - locationId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location for which to retrieve settings. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLocationSettingsResponse`](../../doc/models/retrieve-location-settings-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -try { - const { result, ...httpResponse } = await checkoutApi.retrieveLocationSettings(locationId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Location Settings - -Updates the location-level settings for a Square-hosted checkout page. - -```ts -async updateLocationSettings( - locationId: string, - body: UpdateLocationSettingsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location for which to retrieve settings. | -| `body` | [`UpdateLocationSettingsRequest`](../../doc/models/update-location-settings-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateLocationSettingsResponse`](../../doc/models/update-location-settings-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const body: UpdateLocationSettingsRequest = { - locationSettings: { - }, -}; - -try { - const { result, ...httpResponse } = await checkoutApi.updateLocationSettings( - locationId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Merchant Settings - -Retrieves the merchant-level settings for a Square-hosted checkout page. - -```ts -async retrieveMerchantSettings( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveMerchantSettingsResponse`](../../doc/models/retrieve-merchant-settings-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await checkoutApi.retrieveMerchantSettings(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Merchant Settings - -Updates the merchant-level settings for a Square-hosted checkout page. - -```ts -async updateMerchantSettings( - body: UpdateMerchantSettingsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`UpdateMerchantSettingsRequest`](../../doc/models/update-merchant-settings-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateMerchantSettingsResponse`](../../doc/models/update-merchant-settings-response.md) - -## Example Usage - -```ts -const body: UpdateMerchantSettingsRequest = { - merchantSettings: { - }, -}; - -try { - const { result, ...httpResponse } = await checkoutApi.updateMerchantSettings(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Payment Links - -Lists all payment links. - -```ts -async listPaymentLinks( - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first 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 | A limit on the number of results to return per page. The limit is advisory and
the implementation might return more or less results. If the supplied limit is negative, zero, or
greater than the maximum limit of 1000, it is ignored.

Default value: `100` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListPaymentLinksResponse`](../../doc/models/list-payment-links-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await checkoutApi.listPaymentLinks(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Payment Link - -Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. - -```ts -async createPaymentLink( - body: CreatePaymentLinkRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreatePaymentLinkRequest`](../../doc/models/create-payment-link-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreatePaymentLinkResponse`](../../doc/models/create-payment-link-response.md) - -## Example Usage - -```ts -const body: CreatePaymentLinkRequest = { - idempotencyKey: 'cd9e25dc-d9f2-4430-aedb-61605070e95f', - quickPay: { - name: 'Auto Detailing', - priceMoney: { - amount: BigInt(10000), - currency: 'USD', - }, - locationId: 'A9Y43N9ABXZBP', - }, -}; - -try { - const { result, ...httpResponse } = await checkoutApi.createPaymentLink(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Payment Link - -Deletes a payment link. - -```ts -async deletePaymentLink( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The ID of the payment link to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeletePaymentLinkResponse`](../../doc/models/delete-payment-link-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await checkoutApi.deletePaymentLink(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Payment Link - -Retrieves a payment link. - -```ts -async retrievePaymentLink( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The ID of link to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrievePaymentLinkResponse`](../../doc/models/retrieve-payment-link-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await checkoutApi.retrievePaymentLink(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Payment Link - -Updates a payment link. You can update the `payment_link` fields such as -`description`, `checkout_options`, and `pre_populated_data`. -You cannot update other fields such as the `order_id`, `version`, `URL`, or `timestamp` field. - -```ts -async updatePaymentLink( - id: string, - body: UpdatePaymentLinkRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The ID of the payment link to update. | -| `body` | [`UpdatePaymentLinkRequest`](../../doc/models/update-payment-link-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdatePaymentLinkResponse`](../../doc/models/update-payment-link-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -const body: UpdatePaymentLinkRequest = { - paymentLink: { - version: 1, - checkoutOptions: { - askForShippingAddress: true, - }, - }, -}; - -try { - const { result, ...httpResponse } = await checkoutApi.updatePaymentLink( - id, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index b6c2b9b96..000000000 --- a/doc/api/customer-custom-attributes.md +++ /dev/null @@ -1,575 +0,0 @@ -# Customer Custom Attributes - -```ts -const customerCustomAttributesApi = client.customerCustomAttributesApi; -``` - -## Class Name - -`CustomerCustomAttributesApi` - -## Methods - -* [List Customer Custom Attribute Definitions](../../doc/api/customer-custom-attributes.md#list-customer-custom-attribute-definitions) -* [Create Customer Custom Attribute Definition](../../doc/api/customer-custom-attributes.md#create-customer-custom-attribute-definition) -* [Delete Customer Custom Attribute Definition](../../doc/api/customer-custom-attributes.md#delete-customer-custom-attribute-definition) -* [Retrieve Customer Custom Attribute Definition](../../doc/api/customer-custom-attributes.md#retrieve-customer-custom-attribute-definition) -* [Update Customer Custom Attribute Definition](../../doc/api/customer-custom-attributes.md#update-customer-custom-attribute-definition) -* [Bulk Upsert Customer Custom Attributes](../../doc/api/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) -* [List Customer Custom Attributes](../../doc/api/customer-custom-attributes.md#list-customer-custom-attributes) -* [Delete Customer Custom Attribute](../../doc/api/customer-custom-attributes.md#delete-customer-custom-attribute) -* [Retrieve Customer Custom Attribute](../../doc/api/customer-custom-attributes.md#retrieve-customer-custom-attribute) -* [Upsert Customer Custom Attribute](../../doc/api/customer-custom-attributes.md#upsert-customer-custom-attribute) - - -# List Customer Custom Attribute Definitions - -Lists the customer-related [custom attribute definitions](../../doc/models/custom-attribute-definition.md) that belong to a Square seller account. - -When all response pages are retrieved, the results include all custom attribute definitions -that are visible to the requesting application, including those that are created by other -applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that -seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async listCustomerCustomAttributeDefinitions( - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCustomerCustomAttributeDefinitionsResponse`](../../doc/models/list-customer-custom-attribute-definitions-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.listCustomerCustomAttributeDefinitions(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Customer Custom Attribute Definition - -Creates a customer-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) for a Square seller account. -Use this endpoint to define a custom attribute that can be associated with customer profiles. - -A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties -for a custom attribute. After the definition is created, you can call -[UpsertCustomerCustomAttribute](../../doc/api/customer-custom-attributes.md#upsert-customer-custom-attribute) or -[BulkUpsertCustomerCustomAttributes](../../doc/api/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) -to set the custom attribute for customer profiles in the seller's Customer Directory. - -Sellers can view all custom attributes in exported customer data, including those set to -`VISIBILITY_HIDDEN`. - -```ts -async createCustomerCustomAttributeDefinition( - body: CreateCustomerCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateCustomerCustomAttributeDefinitionRequest`](../../doc/models/create-customer-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateCustomerCustomAttributeDefinitionResponse`](../../doc/models/create-customer-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const body: CreateCustomerCustomAttributeDefinitionRequest = { - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Customer Custom Attribute Definition - -Deletes a customer-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. - -Deleting a custom attribute definition also deletes the corresponding custom attribute from -all customer profiles in the seller's Customer Directory. - -Only the definition owner can delete a custom attribute definition. - -```ts -async deleteCustomerCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteCustomerCustomAttributeDefinitionResponse`](../../doc/models/delete-customer-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.deleteCustomerCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Customer Custom Attribute Definition - -Retrieves a customer-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. - -To retrieve a custom attribute definition created by another application, the `visibility` -setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async retrieveCustomerCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to retrieve. If the requesting application
is not the definition owner, you must use the qualified key. | -| `version` | `number \| undefined` | Query, Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveCustomerCustomAttributeDefinitionResponse`](../../doc/models/retrieve-customer-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.retrieveCustomerCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Customer Custom Attribute Definition - -Updates a customer-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) for a Square seller account. - -Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the -`schema` for a `Selection` data type. - -Only the definition owner can update a custom attribute definition. Note that sellers can view -all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. - -```ts -async updateCustomerCustomAttributeDefinition( - key: string, - body: UpdateCustomerCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to update. | -| `body` | [`UpdateCustomerCustomAttributeDefinitionRequest`](../../doc/models/update-customer-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateCustomerCustomAttributeDefinitionResponse`](../../doc/models/update-customer-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -const body: UpdateCustomerCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - description: 'Update the description as desired.', - visibility: 'VISIBILITY_READ_ONLY', - }, -}; - -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.updateCustomerCustomAttributeDefinition( - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Upsert Customer Custom Attributes - -Creates or updates [custom attributes](../../doc/models/custom-attribute.md) for customer profiles as a bulk operation. - -Use this endpoint to set the value of one or more custom attributes for one or more customer profiles. -A custom attribute is based on a custom attribute definition in a Square seller account, which is -created using the [CreateCustomerCustomAttributeDefinition](../../doc/api/customer-custom-attributes.md#create-customer-custom-attribute-definition) endpoint. - -This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert -requests and returns a map of individual upsert responses. Each upsert request has a unique ID -and provides a customer ID and custom attribute. Each upsert response is returned with the ID -of the corresponding request. - -To create or update a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async bulkUpsertCustomerCustomAttributes( - body: BulkUpsertCustomerCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkUpsertCustomerCustomAttributesRequest`](../../doc/models/bulk-upsert-customer-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkUpsertCustomerCustomAttributesResponse`](../../doc/models/bulk-upsert-customer-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkUpsertCustomerCustomAttributesRequest = { - values: { - 'key0': { - customerId: 'customer_id8', - customAttribute: { - }, - }, - 'key1': { - customerId: 'customer_id8', - customAttribute: { - }, - } - }, -}; - -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.bulkUpsertCustomerCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Customer Custom Attributes - -Lists the [custom attributes](../../doc/models/custom-attribute.md) associated with a customer profile. - -You can use the `with_definitions` query parameter to also retrieve custom attribute definitions -in the same call. - -When all response pages are retrieved, the results include all custom attributes that are -visible to the requesting application, including those that are owned by other applications -and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async listCustomerCustomAttributes( - customerId: string, - limit?: number, - cursor?: string, - withDefinitions?: boolean, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the target [customer profile](entity:Customer). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCustomerCustomAttributesResponse`](../../doc/models/list-customer-custom-attributes-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -const withDefinitions = false; - -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.listCustomerCustomAttributes( - customerId, - undefined, - undefined, - withDefinitions -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Customer Custom Attribute - -Deletes a [custom attribute](../../doc/models/custom-attribute.md) associated with a customer profile. - -To delete a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async deleteCustomerCustomAttribute( - customerId: string, - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the target [customer profile](entity:Customer). | -| `key` | `string` | Template, Required | The key of the custom attribute to delete. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteCustomerCustomAttributeResponse`](../../doc/models/delete-customer-custom-attribute-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -const key = 'key0'; - -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.deleteCustomerCustomAttribute( - customerId, - key -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Customer Custom Attribute - -Retrieves a [custom attribute](../../doc/models/custom-attribute.md) associated with a customer profile. - -You can use the `with_definition` query parameter to also retrieve the custom attribute definition -in the same call. - -To retrieve a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async retrieveCustomerCustomAttribute( - customerId: string, - key: string, - withDefinition?: boolean, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the target [customer profile](entity:Customer). | -| `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `withDefinition` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `version` | `number \| undefined` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveCustomerCustomAttributeResponse`](../../doc/models/retrieve-customer-custom-attribute-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -const key = 'key0'; - -const withDefinition = false; - -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.retrieveCustomerCustomAttribute( - customerId, - key, - withDefinition -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Upsert Customer Custom Attribute - -Creates or updates a [custom attribute](../../doc/models/custom-attribute.md) for a customer profile. - -Use this endpoint to set the value of a custom attribute for a specified customer profile. -A custom attribute is based on a custom attribute definition in a Square seller account, which -is created using the [CreateCustomerCustomAttributeDefinition](../../doc/api/customer-custom-attributes.md#create-customer-custom-attribute-definition) endpoint. - -To create or update a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async upsertCustomerCustomAttribute( - customerId: string, - key: string, - body: UpsertCustomerCustomAttributeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the target [customer profile](entity:Customer). | -| `key` | `string` | Template, Required | The key of the custom attribute to create or update. This key must match the `key` of a
custom attribute definition in the Square seller account. If the requesting application is not
the definition owner, you must use the qualified key. | -| `body` | [`UpsertCustomerCustomAttributeRequest`](../../doc/models/upsert-customer-custom-attribute-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpsertCustomerCustomAttributeResponse`](../../doc/models/upsert-customer-custom-attribute-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -const key = 'key0'; - -const body: UpsertCustomerCustomAttributeRequest = { - customAttribute: { - }, -}; - -try { - const { result, ...httpResponse } = await customerCustomAttributesApi.upsertCustomerCustomAttribute( - customerId, - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 0fd88d68b..000000000 --- a/doc/api/customer-groups.md +++ /dev/null @@ -1,235 +0,0 @@ -# Customer Groups - -```ts -const customerGroupsApi = client.customerGroupsApi; -``` - -## Class Name - -`CustomerGroupsApi` - -## Methods - -* [List Customer Groups](../../doc/api/customer-groups.md#list-customer-groups) -* [Create Customer Group](../../doc/api/customer-groups.md#create-customer-group) -* [Delete Customer Group](../../doc/api/customer-groups.md#delete-customer-group) -* [Retrieve Customer Group](../../doc/api/customer-groups.md#retrieve-customer-group) -* [Update Customer Group](../../doc/api/customer-groups.md#update-customer-group) - - -# List Customer Groups - -Retrieves the list of customer groups of a business. - -```ts -async listCustomerGroups( - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCustomerGroupsResponse`](../../doc/models/list-customer-groups-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await customerGroupsApi.listCustomerGroups(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Customer Group - -Creates a new customer group for a business. - -The request must include the `name` value of the group. - -```ts -async createCustomerGroup( - body: CreateCustomerGroupRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateCustomerGroupRequest`](../../doc/models/create-customer-group-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateCustomerGroupResponse`](../../doc/models/create-customer-group-response.md) - -## Example Usage - -```ts -const body: CreateCustomerGroupRequest = { - group: { - name: 'Loyal Customers', - }, -}; - -try { - const { result, ...httpResponse } = await customerGroupsApi.createCustomerGroup(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Customer Group - -Deletes a customer group as identified by the `group_id` value. - -```ts -async deleteCustomerGroup( - groupId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `groupId` | `string` | Template, Required | The ID of the customer group to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteCustomerGroupResponse`](../../doc/models/delete-customer-group-response.md) - -## Example Usage - -```ts -const groupId = 'group_id0'; - -try { - const { result, ...httpResponse } = await customerGroupsApi.deleteCustomerGroup(groupId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Customer Group - -Retrieves a specific customer group as identified by the `group_id` value. - -```ts -async retrieveCustomerGroup( - groupId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `groupId` | `string` | Template, Required | The ID of the customer group to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveCustomerGroupResponse`](../../doc/models/retrieve-customer-group-response.md) - -## Example Usage - -```ts -const groupId = 'group_id0'; - -try { - const { result, ...httpResponse } = await customerGroupsApi.retrieveCustomerGroup(groupId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Customer Group - -Updates a customer group as identified by the `group_id` value. - -```ts -async updateCustomerGroup( - groupId: string, - body: UpdateCustomerGroupRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `groupId` | `string` | Template, Required | The ID of the customer group to update. | -| `body` | [`UpdateCustomerGroupRequest`](../../doc/models/update-customer-group-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateCustomerGroupResponse`](../../doc/models/update-customer-group-response.md) - -## Example Usage - -```ts -const groupId = 'group_id0'; - -const body: UpdateCustomerGroupRequest = { - group: { - name: 'Loyal Customers', - }, -}; - -try { - const { result, ...httpResponse } = await customerGroupsApi.updateCustomerGroup( - groupId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 01e1370da..000000000 --- a/doc/api/customer-segments.md +++ /dev/null @@ -1,95 +0,0 @@ -# Customer Segments - -```ts -const customerSegmentsApi = client.customerSegmentsApi; -``` - -## Class Name - -`CustomerSegmentsApi` - -## Methods - -* [List Customer Segments](../../doc/api/customer-segments.md#list-customer-segments) -* [Retrieve Customer Segment](../../doc/api/customer-segments.md#retrieve-customer-segment) - - -# List Customer Segments - -Retrieves the list of customer segments of a business. - -```ts -async listCustomerSegments( - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by previous calls to `ListCustomerSegments`.
This cursor is used to retrieve the next set of query results.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCustomerSegmentsResponse`](../../doc/models/list-customer-segments-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await customerSegmentsApi.listCustomerSegments(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Customer Segment - -Retrieves a specific customer segment as identified by the `segment_id` value. - -```ts -async retrieveCustomerSegment( - segmentId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `segmentId` | `string` | Template, Required | The Square-issued ID of the customer segment. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveCustomerSegmentResponse`](../../doc/models/retrieve-customer-segment-response.md) - -## Example Usage - -```ts -const segmentId = 'segment_id4'; - -try { - const { result, ...httpResponse } = await customerSegmentsApi.retrieveCustomerSegment(segmentId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index b6ac01988..000000000 --- a/doc/api/customers.md +++ /dev/null @@ -1,818 +0,0 @@ -# Customers - -```ts -const customersApi = client.customersApi; -``` - -## Class Name - -`CustomersApi` - -## Methods - -* [List Customers](../../doc/api/customers.md#list-customers) -* [Create Customer](../../doc/api/customers.md#create-customer) -* [Bulk Create Customers](../../doc/api/customers.md#bulk-create-customers) -* [Bulk Delete Customers](../../doc/api/customers.md#bulk-delete-customers) -* [Bulk Retrieve Customers](../../doc/api/customers.md#bulk-retrieve-customers) -* [Bulk Update Customers](../../doc/api/customers.md#bulk-update-customers) -* [Search Customers](../../doc/api/customers.md#search-customers) -* [Delete Customer](../../doc/api/customers.md#delete-customer) -* [Retrieve Customer](../../doc/api/customers.md#retrieve-customer) -* [Update Customer](../../doc/api/customers.md#update-customer) -* [Create Customer Card](../../doc/api/customers.md#create-customer-card) -* [Delete Customer Card](../../doc/api/customers.md#delete-customer-card) -* [Remove Group From Customer](../../doc/api/customers.md#remove-group-from-customer) -* [Add Group to Customer](../../doc/api/customers.md#add-group-to-customer) - - -# List Customers - -Lists customer profiles associated with a Square account. - -Under normal operating conditions, newly created or updated customer profiles become available -for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated -profiles can take closer to one minute or longer, especially during network incidents and outages. - -```ts -async listCustomers( - cursor?: string, - limit?: number, - sortField?: string, - sortOrder?: string, - count?: boolean, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `sortField` | [`string \| undefined`](../../doc/models/customer-sort-field.md) | Query, Optional | Indicates how customers should be sorted.

The default value is `DEFAULT`. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | Indicates whether customers should be sorted in ascending (`ASC`) or
descending (`DESC`) order.

The default value is `ASC`. | -| `count` | `boolean \| undefined` | Query, Optional | Indicates whether to return the total count of customers in the `count` field of the response.

The default value is `false`.
**Default**: `false` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListCustomersResponse`](../../doc/models/list-customers-response.md) - -## Example Usage - -```ts -const count = false; - -try { - const { result, ...httpResponse } = await customersApi.listCustomers( - undefined, - undefined, - undefined, - undefined, - count -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Customer - -Creates a new customer for a business. - -You must provide at least one of the following values in your request to this -endpoint: - -- `given_name` -- `family_name` -- `company_name` -- `email_address` -- `phone_number` - -```ts -async createCustomer( - body: CreateCustomerRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateCustomerRequest`](../../doc/models/create-customer-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateCustomerResponse`](../../doc/models/create-customer-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Create Customers - -Creates multiple [customer profiles](../../doc/models/customer.md) for a business. - -This endpoint takes a map of individual create requests and returns a map of responses. - -You must provide at least one of the following values in each create request: - -- `given_name` -- `family_name` -- `company_name` -- `email_address` -- `phone_number` - -```ts -async bulkCreateCustomers( - body: BulkCreateCustomersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkCreateCustomersRequest`](../../doc/models/bulk-create-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkCreateCustomersResponse`](../../doc/models/bulk-create-customers-response.md) - -## Example Usage - -```ts -const body: BulkCreateCustomersRequest = { - customers: { - '8bb76c4f-e35d-4c5b-90de-1194cd9179f0': { - 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', - }, - 'd1689f23-b25d-4932-b2f0-aed00f5e2029': { - givenName: 'Marie', - familyName: 'Curie', - emailAddress: 'Marie.Curie@example.com', - address: { - addressLine1: '500 Electric Ave', - addressLine2: 'Suite 601', - locality: 'New York', - administrativeDistrictLevel1: 'NY', - postalCode: '10003', - country: 'US', - }, - phoneNumber: '+1-212-444-4240', - referenceId: 'YOUR_REFERENCE_ID', - note: 'another customer', - } - }, -}; - -try { - const { result, ...httpResponse } = await customersApi.bulkCreateCustomers(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Delete Customers - -Deletes multiple customer profiles. - -The endpoint takes a list of customer IDs and returns a map of responses. - -```ts -async bulkDeleteCustomers( - body: BulkDeleteCustomersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkDeleteCustomersRequest`](../../doc/models/bulk-delete-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkDeleteCustomersResponse`](../../doc/models/bulk-delete-customers-response.md) - -## Example Usage - -```ts -const body: BulkDeleteCustomersRequest = { - customerIds: [ - '8DDA5NZVBZFGAX0V3HPF81HHE0', - 'N18CPRVXR5214XPBBA6BZQWF3C', - '2GYD7WNXF7BJZW1PMGNXZ3Y8M8' - ], -}; - -try { - const { result, ...httpResponse } = await customersApi.bulkDeleteCustomers(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Retrieve Customers - -Retrieves multiple customer profiles. - -This endpoint takes a list of customer IDs and returns a map of responses. - -```ts -async bulkRetrieveCustomers( - body: BulkRetrieveCustomersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkRetrieveCustomersRequest`](../../doc/models/bulk-retrieve-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkRetrieveCustomersResponse`](../../doc/models/bulk-retrieve-customers-response.md) - -## Example Usage - -```ts -const body: BulkRetrieveCustomersRequest = { - customerIds: [ - '8DDA5NZVBZFGAX0V3HPF81HHE0', - 'N18CPRVXR5214XPBBA6BZQWF3C', - '2GYD7WNXF7BJZW1PMGNXZ3Y8M8' - ], -}; - -try { - const { result, ...httpResponse } = await customersApi.bulkRetrieveCustomers(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Update Customers - -Updates multiple customer profiles. - -This endpoint takes a map of individual update requests and returns a map of responses. - -You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](../../doc/api/cards.md) or [Gift Cards API](../../doc/api/gift-cards.md). - -```ts -async bulkUpdateCustomers( - body: BulkUpdateCustomersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkUpdateCustomersRequest`](../../doc/models/bulk-update-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkUpdateCustomersResponse`](../../doc/models/bulk-update-customers-response.md) - -## Example Usage - -```ts -const body: BulkUpdateCustomersRequest = { - customers: { - '8DDA5NZVBZFGAX0V3HPF81HHE0': { - emailAddress: 'New.Amelia.Earhart@example.com', - phoneNumber: 'phone_number2', - note: 'updated customer note', - version: BigInt(2), - }, - 'N18CPRVXR5214XPBBA6BZQWF3C': { - givenName: 'Marie', - familyName: 'Curie', - version: BigInt(0), - } - }, -}; - -try { - const { result, ...httpResponse } = await customersApi.bulkUpdateCustomers(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Customers - -Searches the customer profiles associated with a Square account using one or more supported query filters. - -Calling `SearchCustomers` without any explicit query filter returns all -customer profiles ordered alphabetically based on `given_name` and -`family_name`. - -Under normal operating conditions, newly created or updated customer profiles become available -for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated -profiles can take closer to one minute or longer, especially during network incidents and outages. - -```ts -async searchCustomers( - body: SearchCustomersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchCustomersRequest`](../../doc/models/search-customers-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchCustomersResponse`](../../doc/models/search-customers-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Customer - -Deletes a customer profile from a business. This operation also unlinks any associated cards on file. - -To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. - -```ts -async deleteCustomer( - customerId: string, - version?: bigint, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the customer to delete. | -| `version` | `bigint \| undefined` | Query, Optional | The current version of the customer profile.

As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteCustomerResponse`](../../doc/models/delete-customer-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -try { - const { result, ...httpResponse } = await customersApi.deleteCustomer(customerId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Customer - -Returns details for a single customer. - -```ts -async retrieveCustomer( - customerId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the customer to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveCustomerResponse`](../../doc/models/retrieve-customer-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -try { - const { result, ...httpResponse } = await customersApi.retrieveCustomer(customerId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Customer - -Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. -To add or update a field, specify the new value. To remove a field, specify `null`. - -To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. - -You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](../../doc/api/cards.md) or [Gift Cards API](../../doc/api/gift-cards.md). - -```ts -async updateCustomer( - customerId: string, - body: UpdateCustomerRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the customer to update. | -| `body` | [`UpdateCustomerRequest`](../../doc/models/update-customer-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateCustomerResponse`](../../doc/models/update-customer-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -const body: UpdateCustomerRequest = { - emailAddress: 'New.Amelia.Earhart@example.com', - phoneNumber: 'phone_number2', - note: 'updated customer note', - version: BigInt(2), -}; - -try { - const { result, ...httpResponse } = await customersApi.updateCustomer( - customerId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Customer Card - -**This endpoint is deprecated.** - -Adds a card on file to an existing customer. - -As with charges, calls to `CreateCustomerCard` are idempotent. Multiple -calls with the same card nonce return the same card record that was created -with the provided nonce during the _first_ call. - -```ts -async createCustomerCard( - customerId: string, - body: CreateCustomerCardRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The Square ID of the customer profile the card is linked to. | -| `body` | [`CreateCustomerCardRequest`](../../doc/models/create-customer-card-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateCustomerCardResponse`](../../doc/models/create-customer-card-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -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', -}; - -try { - const { result, ...httpResponse } = await customersApi.createCustomerCard( - customerId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Customer Card - -**This endpoint is deprecated.** - -Removes a card on file from a customer. - -```ts -async deleteCustomerCard( - customerId: string, - cardId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the customer that the card on file belongs to. | -| `cardId` | `string` | Template, Required | The ID of the card on file to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteCustomerCardResponse`](../../doc/models/delete-customer-card-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -const cardId = 'card_id4'; - -try { - const { result, ...httpResponse } = await customersApi.deleteCustomerCard( - customerId, - cardId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Remove Group From Customer - -Removes a group membership from a customer. - -The customer is identified by the `customer_id` value -and the customer group is identified by the `group_id` value. - -```ts -async removeGroupFromCustomer( - customerId: string, - groupId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the customer to remove from the group. | -| `groupId` | `string` | Template, Required | The ID of the customer group to remove the customer from. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RemoveGroupFromCustomerResponse`](../../doc/models/remove-group-from-customer-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -const groupId = 'group_id0'; - -try { - const { result, ...httpResponse } = await customersApi.removeGroupFromCustomer( - customerId, - groupId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Add Group to Customer - -Adds a group membership to a customer. - -The customer is identified by the `customer_id` value -and the customer group is identified by the `group_id` value. - -```ts -async addGroupToCustomer( - customerId: string, - groupId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Template, Required | The ID of the customer to add to a group. | -| `groupId` | `string` | Template, Required | The ID of the customer group to add the customer to. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`AddGroupToCustomerResponse`](../../doc/models/add-group-to-customer-response.md) - -## Example Usage - -```ts -const customerId = 'customer_id8'; - -const groupId = 'group_id0'; - -try { - const { result, ...httpResponse } = await customersApi.addGroupToCustomer( - customerId, - groupId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index f370647fe..000000000 --- a/doc/api/devices.md +++ /dev/null @@ -1,235 +0,0 @@ -# Devices - -```ts -const devicesApi = client.devicesApi; -``` - -## Class Name - -`DevicesApi` - -## Methods - -* [List Devices](../../doc/api/devices.md#list-devices) -* [List Device Codes](../../doc/api/devices.md#list-device-codes) -* [Create Device Code](../../doc/api/devices.md#create-device-code) -* [Get Device Code](../../doc/api/devices.md#get-device-code) -* [Get Device](../../doc/api/devices.md#get-device) - - -# List Devices - -List devices associated with the merchant. Currently, only Terminal API -devices are supported. - -```ts -async listDevices( - cursor?: string, - sortOrder?: string, - limit?: number, - locationId?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | The order in which results are listed.

- `ASC` - Oldest to newest.
- `DESC` - Newest to oldest (default). | -| `limit` | `number \| undefined` | Query, Optional | The number of results to return in a single page. | -| `locationId` | `string \| undefined` | Query, Optional | If present, only returns devices at the target location. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListDevicesResponse`](../../doc/models/list-devices-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await devicesApi.listDevices(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Device Codes - -Lists all DeviceCodes associated with the merchant. - -```ts -async listDeviceCodes( - cursor?: string, - locationId?: string, - productType?: string, - status?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | -| `locationId` | `string \| undefined` | Query, Optional | If specified, only returns DeviceCodes of the specified location.
Returns DeviceCodes of all locations if empty. | -| `productType` | [`string \| undefined`](../../doc/models/product-type.md) | Query, Optional | If specified, only returns DeviceCodes targeting the specified product type.
Returns DeviceCodes of all product types if empty. | -| `status` | [`string \| undefined`](../../doc/models/device-code-status.md) | Query, Optional | If specified, returns DeviceCodes with the specified statuses.
Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListDeviceCodesResponse`](../../doc/models/list-device-codes-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await devicesApi.listDeviceCodes(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Device Code - -Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected -terminal mode. - -```ts -async createDeviceCode( - body: CreateDeviceCodeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateDeviceCodeRequest`](../../doc/models/create-device-code-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateDeviceCodeResponse`](../../doc/models/create-device-code-response.md) - -## Example Usage - -```ts -const body: CreateDeviceCodeRequest = { - idempotencyKey: '01bb00a6-0c86-4770-94ed-f5fca973cd56', - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Device Code - -Retrieves DeviceCode with the associated ID. - -```ts -async getDeviceCode( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The unique identifier for the device code. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetDeviceCodeResponse`](../../doc/models/get-device-code-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await devicesApi.getDeviceCode(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Device - -Retrieves Device with the associated `device_id`. - -```ts -async getDevice( - deviceId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `deviceId` | `string` | Template, Required | The unique ID for the desired `Device`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetDeviceResponse`](../../doc/models/get-device-response.md) - -## Example Usage - -```ts -const deviceId = 'device_id6'; - -try { - const { result, ...httpResponse } = await devicesApi.getDevice(deviceId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 1356cba01..000000000 --- a/doc/api/disputes.md +++ /dev/null @@ -1,429 +0,0 @@ -# Disputes - -```ts -const disputesApi = client.disputesApi; -``` - -## Class Name - -`DisputesApi` - -## Methods - -* [List Disputes](../../doc/api/disputes.md#list-disputes) -* [Retrieve Dispute](../../doc/api/disputes.md#retrieve-dispute) -* [Accept Dispute](../../doc/api/disputes.md#accept-dispute) -* [List Dispute Evidence](../../doc/api/disputes.md#list-dispute-evidence) -* [Create Dispute Evidence File](../../doc/api/disputes.md#create-dispute-evidence-file) -* [Create Dispute Evidence Text](../../doc/api/disputes.md#create-dispute-evidence-text) -* [Delete Dispute Evidence](../../doc/api/disputes.md#delete-dispute-evidence) -* [Retrieve Dispute Evidence](../../doc/api/disputes.md#retrieve-dispute-evidence) -* [Submit Evidence](../../doc/api/disputes.md#submit-evidence) - - -# List Disputes - -Returns a list of disputes associated with a particular account. - -```ts -async listDisputes( - cursor?: string, - states?: string, - locationId?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `states` | [`string \| undefined`](../../doc/models/dispute-state.md) | Query, Optional | The dispute states used to filter the result. If not specified, the endpoint returns all disputes. | -| `locationId` | `string \| undefined` | Query, Optional | The ID of the location for which to return a list of disputes.
If not specified, the endpoint returns disputes associated with all locations. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListDisputesResponse`](../../doc/models/list-disputes-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await disputesApi.listDisputes(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Dispute - -Returns details about a specific dispute. - -```ts -async retrieveDispute( - disputeId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string` | Template, Required | The ID of the dispute you want more details about. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveDisputeResponse`](../../doc/models/retrieve-dispute-response.md) - -## Example Usage - -```ts -const disputeId = 'dispute_id2'; - -try { - const { result, ...httpResponse } = await disputesApi.retrieveDispute(disputeId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Accept Dispute - -Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and -updates the dispute state to ACCEPTED. - -Square debits the disputed amount from the seller’s Square account. If the Square account -does not have sufficient funds, Square debits the associated bank account. - -```ts -async acceptDispute( - disputeId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string` | Template, Required | The ID of the dispute you want to accept. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`AcceptDisputeResponse`](../../doc/models/accept-dispute-response.md) - -## Example Usage - -```ts -const disputeId = 'dispute_id2'; - -try { - const { result, ...httpResponse } = await disputesApi.acceptDispute(disputeId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Dispute Evidence - -Returns a list of evidence associated with a dispute. - -```ts -async listDisputeEvidence( - disputeId: string, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string` | Template, Required | The ID of the dispute. | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListDisputeEvidenceResponse`](../../doc/models/list-dispute-evidence-response.md) - -## Example Usage - -```ts -const disputeId = 'dispute_id2'; - -try { - const { result, ...httpResponse } = await disputesApi.listDisputeEvidence(disputeId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Dispute Evidence File - -Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP -multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats. - -```ts -async createDisputeEvidenceFile( - disputeId: string, - request?: CreateDisputeEvidenceFileRequest, - imageFile?: FileWrapper, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string` | Template, Required | The ID of the dispute for which you want to upload evidence. | -| `request` | [`CreateDisputeEvidenceFileRequest \| undefined`](../../doc/models/create-dispute-evidence-file-request.md) | Form (JSON-Encoded), Optional | Defines the parameters for a `CreateDisputeEvidenceFile` request. | -| `imageFile` | `FileWrapper \| undefined` | Form, Optional | - | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateDisputeEvidenceFileResponse`](../../doc/models/create-dispute-evidence-file-response.md) - -## Example Usage - -```ts -const disputeId = 'dispute_id2'; - -try { - const { result, ...httpResponse } = await disputesApi.createDisputeEvidenceFile(disputeId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Dispute Evidence Text - -Uploads text to use as evidence for a dispute challenge. - -```ts -async createDisputeEvidenceText( - disputeId: string, - body: CreateDisputeEvidenceTextRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string` | Template, Required | The ID of the dispute for which you want to upload evidence. | -| `body` | [`CreateDisputeEvidenceTextRequest`](../../doc/models/create-dispute-evidence-text-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateDisputeEvidenceTextResponse`](../../doc/models/create-dispute-evidence-text-response.md) - -## Example Usage - -```ts -const disputeId = 'dispute_id2'; - -const body: CreateDisputeEvidenceTextRequest = { - idempotencyKey: 'ed3ee3933d946f1514d505d173c82648', - evidenceText: '1Z8888888888888888', - evidenceType: 'TRACKING_NUMBER', -}; - -try { - const { result, ...httpResponse } = await disputesApi.createDisputeEvidenceText( - disputeId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Dispute Evidence - -Removes specified evidence from a dispute. -Square does not send the bank any evidence that is removed. - -```ts -async deleteDisputeEvidence( - disputeId: string, - evidenceId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string` | Template, Required | The ID of the dispute from which you want to remove evidence. | -| `evidenceId` | `string` | Template, Required | The ID of the evidence you want to remove. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteDisputeEvidenceResponse`](../../doc/models/delete-dispute-evidence-response.md) - -## Example Usage - -```ts -const disputeId = 'dispute_id2'; - -const evidenceId = 'evidence_id2'; - -try { - const { result, ...httpResponse } = await disputesApi.deleteDisputeEvidence( - disputeId, - evidenceId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Dispute Evidence - -Returns the metadata for the evidence specified in the request URL path. - -You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it. - -```ts -async retrieveDisputeEvidence( - disputeId: string, - evidenceId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string` | Template, Required | The ID of the dispute from which you want to retrieve evidence metadata. | -| `evidenceId` | `string` | Template, Required | The ID of the evidence to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveDisputeEvidenceResponse`](../../doc/models/retrieve-dispute-evidence-response.md) - -## Example Usage - -```ts -const disputeId = 'dispute_id2'; - -const evidenceId = 'evidence_id2'; - -try { - const { result, ...httpResponse } = await disputesApi.retrieveDisputeEvidence( - disputeId, - evidenceId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Submit Evidence - -Submits evidence to the cardholder's bank. - -The evidence submitted by this endpoint includes evidence uploaded -using the [CreateDisputeEvidenceFile](../../doc/api/disputes.md#create-dispute-evidence-file) and -[CreateDisputeEvidenceText](../../doc/api/disputes.md#create-dispute-evidence-text) endpoints and -evidence automatically provided by Square, when available. Evidence cannot be removed from -a dispute after submission. - -```ts -async submitEvidence( - disputeId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string` | Template, Required | The ID of the dispute for which you want to submit evidence. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SubmitEvidenceResponse`](../../doc/models/submit-evidence-response.md) - -## Example Usage - -```ts -const disputeId = 'dispute_id2'; - -try { - const { result, ...httpResponse } = await disputesApi.submitEvidence(disputeId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 8b3bb97f7..000000000 --- a/doc/api/employees.md +++ /dev/null @@ -1,99 +0,0 @@ -# Employees - -```ts -const employeesApi = client.employeesApi; -``` - -## Class Name - -`EmployeesApi` - -## Methods - -* [List Employees](../../doc/api/employees.md#list-employees) -* [Retrieve Employee](../../doc/api/employees.md#retrieve-employee) - - -# List Employees - -**This endpoint is deprecated.** - -```ts -async listEmployees( - locationId?: string, - status?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| undefined` | Query, Optional | - | -| `status` | [`string \| undefined`](../../doc/models/employee-status.md) | Query, Optional | Specifies the EmployeeStatus to filter the employee by. | -| `limit` | `number \| undefined` | Query, Optional | The number of employees to be returned on each page. | -| `cursor` | `string \| undefined` | Query, Optional | The token required to retrieve the specified page of results. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListEmployeesResponse`](../../doc/models/list-employees-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await employeesApi.listEmployees(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Employee - -**This endpoint is deprecated.** - -```ts -async retrieveEmployee( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | UUID for the employee that was requested. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveEmployeeResponse`](../../doc/models/retrieve-employee-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await employeesApi.retrieveEmployee(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - diff --git a/doc/api/events.md b/doc/api/events.md deleted file mode 100644 index aba749909..000000000 --- a/doc/api/events.md +++ /dev/null @@ -1,170 +0,0 @@ -# Events - -```ts -const eventsApi = client.eventsApi; -``` - -## Class Name - -`EventsApi` - -## Methods - -* [Search Events](../../doc/api/events.md#search-events) -* [Disable Events](../../doc/api/events.md#disable-events) -* [Enable Events](../../doc/api/events.md#enable-events) -* [List Event Types](../../doc/api/events.md#list-event-types) - - -# Search Events - -Search for Square API events that occur within a 28-day timeframe. - -```ts -async searchEvents( - body: SearchEventsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchEventsRequest`](../../doc/models/search-events-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchEventsResponse`](../../doc/models/search-events-response.md) - -## Example Usage - -```ts -const body: SearchEventsRequest = { -}; - -try { - const { result, ...httpResponse } = await eventsApi.searchEvents(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Disable Events - -Disables events to prevent them from being searchable. -All events are disabled by default. You must enable events to make them searchable. -Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later. - -```ts -async disableEvents( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DisableEventsResponse`](../../doc/models/disable-events-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await eventsApi.disableEvents(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Enable Events - -Enables events to make them searchable. Only events that occur while in the enabled state are searchable. - -```ts -async enableEvents( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`EnableEventsResponse`](../../doc/models/enable-events-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await eventsApi.enableEvents(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Event Types - -Lists all event types that you can subscribe to as webhooks or query using the Events API. - -```ts -async listEventTypes( - apiVersion?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `apiVersion` | `string \| undefined` | Query, Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListEventTypesResponse`](../../doc/models/list-event-types-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await eventsApi.listEventTypes(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 04c24c484..000000000 --- a/doc/api/gift-card-activities.md +++ /dev/null @@ -1,122 +0,0 @@ -# Gift Card Activities - -```ts -const giftCardActivitiesApi = client.giftCardActivitiesApi; -``` - -## Class Name - -`GiftCardActivitiesApi` - -## Methods - -* [List Gift Card Activities](../../doc/api/gift-card-activities.md#list-gift-card-activities) -* [Create Gift Card Activity](../../doc/api/gift-card-activities.md#create-gift-card-activity) - - -# List Gift Card Activities - -Lists gift card activities. By default, you get gift card activities for all -gift cards in the seller's account. You can optionally specify query parameters to -filter the list. For example, you can get a list of gift card activities for a gift card, -for all gift cards in a specific region, or for activities within a time window. - -```ts -async listGiftCardActivities( - giftCardId?: string, - type?: string, - locationId?: string, - beginTime?: string, - endTime?: string, - limit?: number, - cursor?: string, - sortOrder?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `giftCardId` | `string \| undefined` | Query, Optional | If a gift card ID is provided, the endpoint returns activities related
to the specified gift card. Otherwise, the endpoint returns all gift card activities for
the seller. | -| `type` | `string \| undefined` | Query, Optional | If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type.
Otherwise, the endpoint returns all types of gift card activities. | -| `locationId` | `string \| undefined` | Query, Optional | If a location ID is provided, the endpoint returns gift card activities for the specified location.
Otherwise, the endpoint returns gift card activities for all locations. | -| `beginTime` | `string \| undefined` | Query, Optional | The timestamp for the beginning of the reporting period, in RFC 3339 format.
This start time is inclusive. The default value is the current time minus one year. | -| `endTime` | `string \| undefined` | Query, Optional | The timestamp for the end of the reporting period, in RFC 3339 format.
This end time is inclusive. The default value is the current time. | -| `limit` | `number \| undefined` | Query, Optional | If a limit is provided, the endpoint returns the specified number
of results (or fewer) per page. The maximum value is 100. The default value is 50.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `sortOrder` | `string \| undefined` | Query, Optional | The order in which the endpoint returns the activities, based on `created_at`.

- `ASC` - Oldest to newest.
- `DESC` - Newest to oldest (default). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListGiftCardActivitiesResponse`](../../doc/models/list-gift-card-activities-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await giftCardActivitiesApi.listGiftCardActivities(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Gift Card Activity - -Creates a gift card activity to manage the balance or state of a [gift card](../../doc/models/gift-card.md). -For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use. - -```ts -async createGiftCardActivity( - body: CreateGiftCardActivityRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateGiftCardActivityRequest`](../../doc/models/create-gift-card-activity-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateGiftCardActivityResponse`](../../doc/models/create-gift-card-activity-response.md) - -## Example Usage - -```ts -const body: CreateGiftCardActivityRequest = { - idempotencyKey: 'U16kfr-kA70er-q4Rsym-7U7NnY', - 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) { - 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 deleted file mode 100644 index fcdf4b737..000000000 --- a/doc/api/gift-cards.md +++ /dev/null @@ -1,339 +0,0 @@ -# Gift Cards - -```ts -const giftCardsApi = client.giftCardsApi; -``` - -## Class Name - -`GiftCardsApi` - -## Methods - -* [List Gift Cards](../../doc/api/gift-cards.md#list-gift-cards) -* [Create Gift Card](../../doc/api/gift-cards.md#create-gift-card) -* [Retrieve Gift Card From GAN](../../doc/api/gift-cards.md#retrieve-gift-card-from-gan) -* [Retrieve Gift Card From Nonce](../../doc/api/gift-cards.md#retrieve-gift-card-from-nonce) -* [Link Customer to Gift Card](../../doc/api/gift-cards.md#link-customer-to-gift-card) -* [Unlink Customer From Gift Card](../../doc/api/gift-cards.md#unlink-customer-from-gift-card) -* [Retrieve Gift Card](../../doc/api/gift-cards.md#retrieve-gift-card) - - -# List Gift Cards - -Lists all gift cards. You can specify optional filters to retrieve -a subset of the gift cards. Results are sorted by `created_at` in ascending order. - -```ts -async listGiftCards( - type?: string, - state?: string, - limit?: number, - cursor?: string, - customerId?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | `string \| undefined` | Query, Optional | If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type.
Otherwise, the endpoint returns gift cards of all types. | -| `state` | `string \| undefined` | Query, Optional | If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state.
Otherwise, the endpoint returns the gift cards of all states. | -| `limit` | `number \| undefined` | Query, Optional | If a limit is provided, the endpoint returns only the specified number of results per page.
The maximum value is 200. The default value is 30.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `customerId` | `string \| undefined` | Query, Optional | If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListGiftCardsResponse`](../../doc/models/list-gift-cards-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await giftCardsApi.listGiftCards(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Gift Card - -Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card -has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call -[CreateGiftCardActivity](../../doc/api/gift-card-activities.md#create-gift-card-activity) and create an `ACTIVATE` -activity with the initial balance. Alternatively, you can use [RefundPayment](../../doc/api/refunds.md#refund-payment) -to refund a payment to the new gift card. - -```ts -async createGiftCard( - body: CreateGiftCardRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateGiftCardRequest`](../../doc/models/create-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateGiftCardResponse`](../../doc/models/create-gift-card-response.md) - -## Example Usage - -```ts -const body: CreateGiftCardRequest = { - idempotencyKey: 'NC9Tm69EjbjtConu', - locationId: '81FN9BNFZTKS4', - giftCard: { - type: 'DIGITAL', - }, -}; - -try { - const { result, ...httpResponse } = await giftCardsApi.createGiftCard(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Gift Card From GAN - -Retrieves a gift card using the gift card account number (GAN). - -```ts -async retrieveGiftCardFromGAN( - body: RetrieveGiftCardFromGANRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`RetrieveGiftCardFromGANRequest`](../../doc/models/retrieve-gift-card-from-gan-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveGiftCardFromGANResponse`](../../doc/models/retrieve-gift-card-from-gan-response.md) - -## Example Usage - -```ts -const body: RetrieveGiftCardFromGANRequest = { - gan: '7783320001001635', -}; - -try { - const { result, ...httpResponse } = await giftCardsApi.retrieveGiftCardFromGAN(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Gift Card From Nonce - -Retrieves a gift card using a secure payment token that represents the gift card. - -```ts -async retrieveGiftCardFromNonce( - body: RetrieveGiftCardFromNonceRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`RetrieveGiftCardFromNonceRequest`](../../doc/models/retrieve-gift-card-from-nonce-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveGiftCardFromNonceResponse`](../../doc/models/retrieve-gift-card-from-nonce-response.md) - -## Example Usage - -```ts -const body: RetrieveGiftCardFromNonceRequest = { - nonce: 'cnon:7783322135245171', -}; - -try { - const { result, ...httpResponse } = await giftCardsApi.retrieveGiftCardFromNonce(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Link Customer to Gift Card - -Links a customer to a gift card, which is also referred to as adding a card on file. - -```ts -async linkCustomerToGiftCard( - giftCardId: string, - body: LinkCustomerToGiftCardRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `giftCardId` | `string` | Template, Required | The ID of the gift card to be linked. | -| `body` | [`LinkCustomerToGiftCardRequest`](../../doc/models/link-customer-to-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`LinkCustomerToGiftCardResponse`](../../doc/models/link-customer-to-gift-card-response.md) - -## Example Usage - -```ts -const giftCardId = 'gift_card_id8'; - -const body: LinkCustomerToGiftCardRequest = { - customerId: 'GKY0FZ3V717AH8Q2D821PNT2ZW', -}; - -try { - const { result, ...httpResponse } = await giftCardsApi.linkCustomerToGiftCard( - giftCardId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Unlink Customer From Gift Card - -Unlinks a customer from a gift card, which is also referred to as removing a card on file. - -```ts -async unlinkCustomerFromGiftCard( - giftCardId: string, - body: UnlinkCustomerFromGiftCardRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `giftCardId` | `string` | Template, Required | The ID of the gift card to be unlinked. | -| `body` | [`UnlinkCustomerFromGiftCardRequest`](../../doc/models/unlink-customer-from-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UnlinkCustomerFromGiftCardResponse`](../../doc/models/unlink-customer-from-gift-card-response.md) - -## Example Usage - -```ts -const giftCardId = 'gift_card_id8'; - -const body: UnlinkCustomerFromGiftCardRequest = { - customerId: 'GKY0FZ3V717AH8Q2D821PNT2ZW', -}; - -try { - const { result, ...httpResponse } = await giftCardsApi.unlinkCustomerFromGiftCard( - giftCardId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Gift Card - -Retrieves a gift card using the gift card ID. - -```ts -async retrieveGiftCard( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The ID of the gift card to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveGiftCardResponse`](../../doc/models/retrieve-gift-card-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await giftCardsApi.retrieveGiftCard(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 765f5f824..000000000 --- a/doc/api/inventory.md +++ /dev/null @@ -1,690 +0,0 @@ -# Inventory - -```ts -const inventoryApi = client.inventoryApi; -``` - -## Class Name - -`InventoryApi` - -## Methods - -* [Deprecated Retrieve Inventory Adjustment](../../doc/api/inventory.md#deprecated-retrieve-inventory-adjustment) -* [Retrieve Inventory Adjustment](../../doc/api/inventory.md#retrieve-inventory-adjustment) -* [Deprecated Batch Change Inventory](../../doc/api/inventory.md#deprecated-batch-change-inventory) -* [Deprecated Batch Retrieve Inventory Changes](../../doc/api/inventory.md#deprecated-batch-retrieve-inventory-changes) -* [Deprecated Batch Retrieve Inventory Counts](../../doc/api/inventory.md#deprecated-batch-retrieve-inventory-counts) -* [Batch Change Inventory](../../doc/api/inventory.md#batch-change-inventory) -* [Batch Retrieve Inventory Changes](../../doc/api/inventory.md#batch-retrieve-inventory-changes) -* [Batch Retrieve Inventory Counts](../../doc/api/inventory.md#batch-retrieve-inventory-counts) -* [Deprecated Retrieve Inventory Physical Count](../../doc/api/inventory.md#deprecated-retrieve-inventory-physical-count) -* [Retrieve Inventory Physical Count](../../doc/api/inventory.md#retrieve-inventory-physical-count) -* [Retrieve Inventory Transfer](../../doc/api/inventory.md#retrieve-inventory-transfer) -* [Retrieve Inventory Count](../../doc/api/inventory.md#retrieve-inventory-count) -* [Retrieve Inventory Changes](../../doc/api/inventory.md#retrieve-inventory-changes) - - -# Deprecated Retrieve Inventory Adjustment - -**This endpoint is deprecated.** - -Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL -is updated to conform to the standard convention. - -```ts -async deprecatedRetrieveInventoryAdjustment( - adjustmentId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `adjustmentId` | `string` | Template, Required | ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveInventoryAdjustmentResponse`](../../doc/models/retrieve-inventory-adjustment-response.md) - -## Example Usage - -```ts -const adjustmentId = 'adjustment_id0'; - -try { - const { result, ...httpResponse } = await inventoryApi.deprecatedRetrieveInventoryAdjustment(adjustmentId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Inventory Adjustment - -Returns the [InventoryAdjustment](../../doc/models/inventory-adjustment.md) object -with the provided `adjustment_id`. - -```ts -async retrieveInventoryAdjustment( - adjustmentId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `adjustmentId` | `string` | Template, Required | ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveInventoryAdjustmentResponse`](../../doc/models/retrieve-inventory-adjustment-response.md) - -## Example Usage - -```ts -const adjustmentId = 'adjustment_id0'; - -try { - const { result, ...httpResponse } = await inventoryApi.retrieveInventoryAdjustment(adjustmentId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Deprecated Batch Change Inventory - -**This endpoint is deprecated.** - -Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL -is updated to conform to the standard convention. - -```ts -async deprecatedBatchChangeInventory( - body: BatchChangeInventoryRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchChangeInventoryRequest`](../../doc/models/batch-change-inventory-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchChangeInventoryResponse`](../../doc/models/batch-change-inventory-response.md) - -## Example Usage - -```ts -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, -}; - -try { - const { result, ...httpResponse } = await inventoryApi.deprecatedBatchChangeInventory(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Deprecated Batch Retrieve Inventory Changes - -**This endpoint is deprecated.** - -Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL -is updated to conform to the standard convention. - -```ts -async deprecatedBatchRetrieveInventoryChanges( - body: BatchRetrieveInventoryChangesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchRetrieveInventoryChangesRequest`](../../doc/models/batch-retrieve-inventory-changes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchRetrieveInventoryChangesResponse`](../../doc/models/batch-retrieve-inventory-changes-response.md) - -## Example Usage - -```ts -const body: BatchRetrieveInventoryChangesRequest = { - catalogObjectIds: [ - 'W62UWFY35CWMYGVWK6TWJDNI' - ], - locationIds: [ - 'C6W5YS5QM06F5' - ], - types: [ - 'PHYSICAL_COUNT' - ], - states: [ - 'IN_STOCK' - ], - updatedAfter: '2016-11-01T00:00:00.000Z', - updatedBefore: '2016-12-01T00:00:00.000Z', -}; - -try { - const { result, ...httpResponse } = await inventoryApi.deprecatedBatchRetrieveInventoryChanges(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Deprecated Batch Retrieve Inventory Counts - -**This endpoint is deprecated.** - -Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL -is updated to conform to the standard convention. - -```ts -async deprecatedBatchRetrieveInventoryCounts( - body: BatchRetrieveInventoryCountsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchRetrieveInventoryCountsRequest`](../../doc/models/batch-retrieve-inventory-counts-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchRetrieveInventoryCountsResponse`](../../doc/models/batch-retrieve-inventory-counts-response.md) - -## Example Usage - -```ts -const body: BatchRetrieveInventoryCountsRequest = { - catalogObjectIds: [ - 'W62UWFY35CWMYGVWK6TWJDNI' - ], - locationIds: [ - '59TNP9SA8VGDA' - ], - updatedAfter: '2016-11-16T00:00:00.000Z', -}; - -try { - const { result, ...httpResponse } = await inventoryApi.deprecatedBatchRetrieveInventoryCounts(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Batch Change Inventory - -Applies adjustments and counts to the provided item quantities. - -On success: returns the current calculated counts for all objects -referenced in the request. -On failure: returns a list of related errors. - -```ts -async batchChangeInventory( - body: BatchChangeInventoryRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchChangeInventoryRequest`](../../doc/models/batch-change-inventory-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchChangeInventoryResponse`](../../doc/models/batch-change-inventory-response.md) - -## Example Usage - -```ts -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, -}; - -try { - const { result, ...httpResponse } = await inventoryApi.batchChangeInventory(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Batch Retrieve Inventory Changes - -Returns historical physical counts and adjustments based on the -provided filter criteria. - -Results are paginated and sorted in ascending order according their -`occurred_at` timestamp (oldest first). - -BatchRetrieveInventoryChanges is a catch-all query endpoint for queries -that cannot be handled by other, simpler endpoints. - -```ts -async batchRetrieveInventoryChanges( - body: BatchRetrieveInventoryChangesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchRetrieveInventoryChangesRequest`](../../doc/models/batch-retrieve-inventory-changes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchRetrieveInventoryChangesResponse`](../../doc/models/batch-retrieve-inventory-changes-response.md) - -## Example Usage - -```ts -const body: BatchRetrieveInventoryChangesRequest = { - catalogObjectIds: [ - 'W62UWFY35CWMYGVWK6TWJDNI' - ], - locationIds: [ - 'C6W5YS5QM06F5' - ], - types: [ - 'PHYSICAL_COUNT' - ], - states: [ - 'IN_STOCK' - ], - updatedAfter: '2016-11-01T00:00:00.000Z', - updatedBefore: '2016-12-01T00:00:00.000Z', -}; - -try { - const { result, ...httpResponse } = await inventoryApi.batchRetrieveInventoryChanges(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Batch Retrieve Inventory Counts - -Returns current counts for the provided -[CatalogObject](../../doc/models/catalog-object.md)s at the requested -[Location](../../doc/models/location.md)s. - -Results are paginated and sorted in descending order according to their -`calculated_at` timestamp (newest first). - -When `updated_after` is specified, only counts that have changed since that -time (based on the server timestamp for the most recent change) are -returned. This allows clients to perform a "sync" operation, for example -in response to receiving a Webhook notification. - -```ts -async batchRetrieveInventoryCounts( - body: BatchRetrieveInventoryCountsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchRetrieveInventoryCountsRequest`](../../doc/models/batch-retrieve-inventory-counts-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchRetrieveInventoryCountsResponse`](../../doc/models/batch-retrieve-inventory-counts-response.md) - -## Example Usage - -```ts -const body: BatchRetrieveInventoryCountsRequest = { - catalogObjectIds: [ - 'W62UWFY35CWMYGVWK6TWJDNI' - ], - locationIds: [ - '59TNP9SA8VGDA' - ], - updatedAfter: '2016-11-16T00:00:00.000Z', -}; - -try { - const { result, ...httpResponse } = await inventoryApi.batchRetrieveInventoryCounts(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Deprecated Retrieve Inventory Physical Count - -**This endpoint is deprecated.** - -Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL -is updated to conform to the standard convention. - -```ts -async deprecatedRetrieveInventoryPhysicalCount( - physicalCountId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `physicalCountId` | `string` | Template, Required | ID of the
[InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveInventoryPhysicalCountResponse`](../../doc/models/retrieve-inventory-physical-count-response.md) - -## Example Usage - -```ts -const physicalCountId = 'physical_count_id2'; - -try { - const { result, ...httpResponse } = await inventoryApi.deprecatedRetrieveInventoryPhysicalCount(physicalCountId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Inventory Physical Count - -Returns the [InventoryPhysicalCount](../../doc/models/inventory-physical-count.md) -object with the provided `physical_count_id`. - -```ts -async retrieveInventoryPhysicalCount( - physicalCountId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `physicalCountId` | `string` | Template, Required | ID of the
[InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveInventoryPhysicalCountResponse`](../../doc/models/retrieve-inventory-physical-count-response.md) - -## Example Usage - -```ts -const physicalCountId = 'physical_count_id2'; - -try { - const { result, ...httpResponse } = await inventoryApi.retrieveInventoryPhysicalCount(physicalCountId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Inventory Transfer - -Returns the [InventoryTransfer](../../doc/models/inventory-transfer.md) object -with the provided `transfer_id`. - -```ts -async retrieveInventoryTransfer( - transferId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `transferId` | `string` | Template, Required | ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveInventoryTransferResponse`](../../doc/models/retrieve-inventory-transfer-response.md) - -## Example Usage - -```ts -const transferId = 'transfer_id6'; - -try { - const { result, ...httpResponse } = await inventoryApi.retrieveInventoryTransfer(transferId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Inventory Count - -Retrieves the current calculated stock count for a given -[CatalogObject](../../doc/models/catalog-object.md) at a given set of -[Location](../../doc/models/location.md)s. Responses are paginated and unsorted. -For more sophisticated queries, use a batch endpoint. - -```ts -async retrieveInventoryCount( - catalogObjectId: string, - locationIds?: string, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `catalogObjectId` | `string` | Template, Required | ID of the [CatalogObject](entity:CatalogObject) to retrieve. | -| `locationIds` | `string \| undefined` | Query, Optional | The [Location](entity:Location) IDs to look up as a comma-separated
list. An empty list queries all locations. | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveInventoryCountResponse`](../../doc/models/retrieve-inventory-count-response.md) - -## Example Usage - -```ts -const catalogObjectId = 'catalog_object_id6'; - -try { - const { result, ...httpResponse } = await inventoryApi.retrieveInventoryCount(catalogObjectId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Inventory Changes - -**This endpoint is deprecated.** - -Returns a set of physical counts and inventory adjustments for the -provided [CatalogObject](entity:CatalogObject) at the requested -[Location](entity:Location)s. - -You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) -and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID. - -Results are paginated and sorted in descending order according to their -`occurred_at` timestamp (newest first). - -There are no limits on how far back the caller can page. This endpoint can be -used to display recent changes for a specific item. For more -sophisticated queries, use a batch endpoint. - -```ts -async retrieveInventoryChanges( - catalogObjectId: string, - locationIds?: string, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `catalogObjectId` | `string` | Template, Required | ID of the [CatalogObject](entity:CatalogObject) to retrieve. | -| `locationIds` | `string \| undefined` | Query, Optional | The [Location](entity:Location) IDs to look up as a comma-separated
list. An empty list queries all locations. | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveInventoryChangesResponse`](../../doc/models/retrieve-inventory-changes-response.md) - -## Example Usage - -```ts -const catalogObjectId = 'catalog_object_id6'; - -try { - const { result, ...httpResponse } = await inventoryApi.retrieveInventoryChanges(catalogObjectId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index dd450a4a1..000000000 --- a/doc/api/invoices.md +++ /dev/null @@ -1,596 +0,0 @@ -# Invoices - -```ts -const invoicesApi = client.invoicesApi; -``` - -## Class Name - -`InvoicesApi` - -## Methods - -* [List Invoices](../../doc/api/invoices.md#list-invoices) -* [Create Invoice](../../doc/api/invoices.md#create-invoice) -* [Search Invoices](../../doc/api/invoices.md#search-invoices) -* [Delete Invoice](../../doc/api/invoices.md#delete-invoice) -* [Get Invoice](../../doc/api/invoices.md#get-invoice) -* [Update Invoice](../../doc/api/invoices.md#update-invoice) -* [Create Invoice Attachment](../../doc/api/invoices.md#create-invoice-attachment) -* [Delete Invoice Attachment](../../doc/api/invoices.md#delete-invoice-attachment) -* [Cancel Invoice](../../doc/api/invoices.md#cancel-invoice) -* [Publish Invoice](../../doc/api/invoices.md#publish-invoice) - - -# List Invoices - -Returns a list of invoices for a given location. The response -is paginated. If truncated, the response includes a `cursor` that you -use in a subsequent request to retrieve the next set of invoices. - -```ts -async listInvoices( - locationId: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Query, Required | The ID of the location for which to list invoices. | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of invoices to return (200 is the maximum `limit`).
If not provided, the server uses a default limit of 100 invoices. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListInvoicesResponse`](../../doc/models/list-invoices-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -try { - const { result, ...httpResponse } = await invoicesApi.listInvoices(locationId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Invoice - -Creates a draft [invoice](../../doc/models/invoice.md) -for an order created using the Orders API. - -A draft invoice remains in your account and no action is taken. -You must publish the invoice before Square can process it (send it to the customer's email address or charge the customer’s card on file). - -```ts -async createInvoice( - body: CreateInvoiceRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateInvoiceRequest`](../../doc/models/create-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateInvoiceResponse`](../../doc/models/create-invoice-response.md) - -## Example Usage - -```ts -const body: CreateInvoiceRequest = { - 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, - cashAppPay: 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', -}; - -try { - const { result, ...httpResponse } = await invoicesApi.createInvoice(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Invoices - -Searches for invoices from a location specified in -the filter. You can optionally specify customers in the filter for whom to -retrieve invoices. In the current implementation, you can only specify one location and -optionally one customer. - -The response is paginated. If truncated, the response includes a `cursor` -that you use in a subsequent request to retrieve the next set of invoices. - -```ts -async searchInvoices( - body: SearchInvoicesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchInvoicesRequest`](../../doc/models/search-invoices-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchInvoicesResponse`](../../doc/models/search-invoices-response.md) - -## Example Usage - -```ts -const body: SearchInvoicesRequest = { - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Invoice - -Deletes the specified invoice. When an invoice is deleted, the -associated order status changes to CANCELED. You can only delete a draft -invoice (you cannot delete a published invoice, including one that is scheduled for processing). - -```ts -async deleteInvoice( - invoiceId: string, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoiceId` | `string` | Template, Required | The ID of the invoice to delete. | -| `version` | `number \| undefined` | Query, Optional | The version of the [invoice](entity:Invoice) to delete.
If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or
[ListInvoices](api-endpoint:Invoices-ListInvoices). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteInvoiceResponse`](../../doc/models/delete-invoice-response.md) - -## Example Usage - -```ts -const invoiceId = 'invoice_id0'; - -try { - const { result, ...httpResponse } = await invoicesApi.deleteInvoice(invoiceId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Invoice - -Retrieves an invoice by invoice ID. - -```ts -async getInvoice( - invoiceId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoiceId` | `string` | Template, Required | The ID of the invoice to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetInvoiceResponse`](../../doc/models/get-invoice-response.md) - -## Example Usage - -```ts -const invoiceId = 'invoice_id0'; - -try { - const { result, ...httpResponse } = await invoicesApi.getInvoice(invoiceId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Invoice - -Updates an invoice. This endpoint supports sparse updates, so you only need -to specify the fields you want to change along with the required `version` field. -Some restrictions apply to updating invoices. For example, you cannot change the -`order_id` or `location_id` field. - -```ts -async updateInvoice( - invoiceId: string, - body: UpdateInvoiceRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoiceId` | `string` | Template, Required | The ID of the invoice to update. | -| `body` | [`UpdateInvoiceRequest`](../../doc/models/update-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateInvoiceResponse`](../../doc/models/update-invoice-response.md) - -## Example Usage - -```ts -const invoiceId = 'invoice_id0'; - -const body: UpdateInvoiceRequest = { - invoice: { - version: 1, - paymentRequests: [ - { - uid: '2da7964f-f3d2-4f43-81e8-5aa220bf3355', - tippingEnabled: false, - reminders: [ - { - }, - { - }, - { - } - ], - } - ], - }, - idempotencyKey: '4ee82288-0910-499e-ab4c-5d0071dad1be', -}; - -try { - const { result, ...httpResponse } = await invoicesApi.updateInvoice( - invoiceId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Invoice Attachment - -Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads -with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file -in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF. - -Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices -in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. - -```ts -async createInvoiceAttachment( - invoiceId: string, - request?: CreateInvoiceAttachmentRequest, - imageFile?: FileWrapper, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoiceId` | `string` | Template, Required | The ID of the [invoice](entity:Invoice) to attach the file to. | -| `request` | [`CreateInvoiceAttachmentRequest \| undefined`](../../doc/models/create-invoice-attachment-request.md) | Form (JSON-Encoded), Optional | Represents a [CreateInvoiceAttachment](../../doc/api/invoices.md#create-invoice-attachment) request. | -| `imageFile` | `FileWrapper \| undefined` | Form, Optional | - | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateInvoiceAttachmentResponse`](../../doc/models/create-invoice-attachment-response.md) - -## Example Usage - -```ts -const invoiceId = 'invoice_id0'; - -const request: CreateInvoiceAttachmentRequest = { - idempotencyKey: 'ae5e84f9-4742-4fc1-ba12-a3ce3748f1c3', - description: 'Service contract', -}; - -try { - const { result, ...httpResponse } = await invoicesApi.createInvoiceAttachment( - invoiceId, - request -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Invoice Attachment - -Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only -from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. - -```ts -async deleteInvoiceAttachment( - invoiceId: string, - attachmentId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoiceId` | `string` | Template, Required | The ID of the [invoice](entity:Invoice) to delete the attachment from. | -| `attachmentId` | `string` | Template, Required | The ID of the [attachment](entity:InvoiceAttachment) to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteInvoiceAttachmentResponse`](../../doc/models/delete-invoice-attachment-response.md) - -## Example Usage - -```ts -const invoiceId = 'invoice_id0'; - -const attachmentId = 'attachment_id6'; - -try { - const { result, ...httpResponse } = await invoicesApi.deleteInvoiceAttachment( - invoiceId, - attachmentId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Invoice - -Cancels an invoice. The seller cannot collect payments for -the canceled invoice. - -You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`. - -```ts -async cancelInvoice( - invoiceId: string, - body: CancelInvoiceRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoiceId` | `string` | Template, Required | The ID of the [invoice](entity:Invoice) to cancel. | -| `body` | [`CancelInvoiceRequest`](../../doc/models/cancel-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelInvoiceResponse`](../../doc/models/cancel-invoice-response.md) - -## Example Usage - -```ts -const invoiceId = 'invoice_id0'; - -const body: CancelInvoiceRequest = { - version: 0, -}; - -try { - const { result, ...httpResponse } = await invoicesApi.cancelInvoice( - invoiceId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Publish Invoice - -Publishes the specified draft invoice. - -After an invoice is published, Square -follows up based on the invoice configuration. For example, Square -sends the invoice to the customer's email address, charges the customer's card on file, or does -nothing. Square also makes the invoice available on a Square-hosted invoice page. - -The invoice `status` also changes from `DRAFT` to a status -based on the invoice configuration. For example, the status changes to `UNPAID` if -Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the -invoice amount. - -In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ` -and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments. - -```ts -async publishInvoice( - invoiceId: string, - body: PublishInvoiceRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoiceId` | `string` | Template, Required | The ID of the invoice to publish. | -| `body` | [`PublishInvoiceRequest`](../../doc/models/publish-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`PublishInvoiceResponse`](../../doc/models/publish-invoice-response.md) - -## Example Usage - -```ts -const invoiceId = 'invoice_id0'; - -const body: PublishInvoiceRequest = { - version: 1, - idempotencyKey: '32da42d0-1997-41b0-826b-f09464fc2c2e', -}; - -try { - const { result, ...httpResponse } = await invoicesApi.publishInvoice( - invoiceId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 07260f848..000000000 --- a/doc/api/labor.md +++ /dev/null @@ -1,851 +0,0 @@ -# Labor - -```ts -const laborApi = client.laborApi; -``` - -## Class Name - -`LaborApi` - -## Methods - -* [List Break Types](../../doc/api/labor.md#list-break-types) -* [Create Break Type](../../doc/api/labor.md#create-break-type) -* [Delete Break Type](../../doc/api/labor.md#delete-break-type) -* [Get Break Type](../../doc/api/labor.md#get-break-type) -* [Update Break Type](../../doc/api/labor.md#update-break-type) -* [List Employee Wages](../../doc/api/labor.md#list-employee-wages) -* [Get Employee Wage](../../doc/api/labor.md#get-employee-wage) -* [Create Shift](../../doc/api/labor.md#create-shift) -* [Search Shifts](../../doc/api/labor.md#search-shifts) -* [Delete Shift](../../doc/api/labor.md#delete-shift) -* [Get Shift](../../doc/api/labor.md#get-shift) -* [Update Shift](../../doc/api/labor.md#update-shift) -* [List Team Member Wages](../../doc/api/labor.md#list-team-member-wages) -* [Get Team Member Wage](../../doc/api/labor.md#get-team-member-wage) -* [List Workweek Configs](../../doc/api/labor.md#list-workweek-configs) -* [Update Workweek Config](../../doc/api/labor.md#update-workweek-config) - - -# List Break Types - -Returns a paginated list of `BreakType` instances for a business. - -```ts -async listBreakTypes( - locationId?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| undefined` | Query, Optional | Filter the returned `BreakType` results to only those that are associated with the
specified location. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of `BreakType` results to return per page. The number can range between 1
and 200. The default is 200. | -| `cursor` | `string \| undefined` | Query, Optional | A pointer to the next page of `BreakType` results to fetch. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListBreakTypesResponse`](../../doc/models/list-break-types-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await laborApi.listBreakTypes(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Break Type - -Creates a new `BreakType`. - -A `BreakType` is a template for creating `Break` objects. -You must provide the following values in your request to this -endpoint: - -- `location_id` -- `break_name` -- `expected_duration` -- `is_paid` - -You can only have three `BreakType` instances per location. If you attempt to add a fourth -`BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location." -is returned. - -```ts -async createBreakType( - body: CreateBreakTypeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateBreakTypeRequest`](../../doc/models/create-break-type-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateBreakTypeResponse`](../../doc/models/create-break-type-response.md) - -## Example Usage - -```ts -const body: CreateBreakTypeRequest = { - breakType: { - locationId: 'CGJN03P1D08GF', - breakName: 'Lunch Break', - expectedDuration: 'PT30M', - isPaid: true, - }, - idempotencyKey: 'PAD3NG5KSN2GL', -}; - -try { - const { result, ...httpResponse } = await laborApi.createBreakType(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Break Type - -Deletes an existing `BreakType`. - -A `BreakType` can be deleted even if it is referenced from a `Shift`. - -```ts -async deleteBreakType( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The UUID for the `BreakType` being deleted. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteBreakTypeResponse`](../../doc/models/delete-break-type-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await laborApi.deleteBreakType(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Break Type - -Returns a single `BreakType` specified by `id`. - -```ts -async getBreakType( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The UUID for the `BreakType` being retrieved. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetBreakTypeResponse`](../../doc/models/get-break-type-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await laborApi.getBreakType(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Break Type - -Updates an existing `BreakType`. - -```ts -async updateBreakType( - id: string, - body: UpdateBreakTypeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The UUID for the `BreakType` being updated. | -| `body` | [`UpdateBreakTypeRequest`](../../doc/models/update-break-type-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateBreakTypeResponse`](../../doc/models/update-break-type-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -const body: UpdateBreakTypeRequest = { - breakType: { - locationId: '26M7H24AZ9N6R', - breakName: 'Lunch', - expectedDuration: 'PT50M', - isPaid: true, - version: 1, - }, -}; - -try { - const { result, ...httpResponse } = await laborApi.updateBreakType( - id, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Employee Wages - -**This endpoint is deprecated.** - -Returns a paginated list of `EmployeeWage` instances for a business. - -```ts -async listEmployeeWages( - employeeId?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `employeeId` | `string \| undefined` | Query, Optional | Filter the returned wages to only those that are associated with the specified employee. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of `EmployeeWage` results to return per page. The number can range between
1 and 200. The default is 200. | -| `cursor` | `string \| undefined` | Query, Optional | A pointer to the next page of `EmployeeWage` results to fetch. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListEmployeeWagesResponse`](../../doc/models/list-employee-wages-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await laborApi.listEmployeeWages(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Employee Wage - -**This endpoint is deprecated.** - -Returns a single `EmployeeWage` specified by `id`. - -```ts -async getEmployeeWage( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The UUID for the `EmployeeWage` being retrieved. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetEmployeeWageResponse`](../../doc/models/get-employee-wage-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await laborApi.getEmployeeWage(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Shift - -Creates a new `Shift`. - -A `Shift` represents a complete workday for a single team member. -You must provide the following values in your request to this -endpoint: - -- `location_id` -- `team_member_id` -- `start_at` - -An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when: - -- The `status` of the new `Shift` is `OPEN` and the team member has another - shift with an `OPEN` status. -- The `start_at` date is in the future. -- The `start_at` or `end_at` date overlaps another shift for the same team member. -- The `Break` instances are set in the request and a break `start_at` - is before the `Shift.start_at`, a break `end_at` is after - the `Shift.end_at`, or both. - -```ts -async createShift( - body: CreateShiftRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateShiftRequest`](../../doc/models/create-shift-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateShiftResponse`](../../doc/models/create-shift-response.md) - -## Example Usage - -```ts -const body: CreateShiftRequest = { - shift: { - locationId: 'PAA1RJZZKXBFG', - startAt: '2019-01-25T03:11:00-05:00', - endAt: '2019-01-25T13:11:00-05:00', - wage: { - title: 'Barista', - hourlyRate: { - amount: BigInt(1100), - currency: 'USD', - }, - tipEligible: true, - }, - breaks: [ - { - startAt: '2019-01-25T06:11:00-05:00', - breakTypeId: 'REGS1EQR1TPZ5', - name: 'Tea Break', - expectedDuration: 'PT5M', - isPaid: true, - endAt: '2019-01-25T06:16:00-05:00', - } - ], - teamMemberId: 'ormj0jJJZ5OZIzxrZYJI', - declaredCashTipMoney: { - amount: BigInt(500), - currency: 'USD', - }, - }, - idempotencyKey: 'HIDSNG5KS478L', -}; - -try { - const { result, ...httpResponse } = await laborApi.createShift(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Shifts - -Returns a paginated list of `Shift` records for a business. -The list to be returned can be filtered by: - -- Location IDs -- Team member IDs -- Shift status (`OPEN` or `CLOSED`) -- Shift start -- Shift end -- Workday details - -The list can be sorted by: - -- `START_AT` -- `END_AT` -- `CREATED_AT` -- `UPDATED_AT` - -```ts -async searchShifts( - body: SearchShiftsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchShiftsRequest`](../../doc/models/search-shifts-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchShiftsResponse`](../../doc/models/search-shifts-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Shift - -Deletes a `Shift`. - -```ts -async deleteShift( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The UUID for the `Shift` being deleted. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteShiftResponse`](../../doc/models/delete-shift-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await laborApi.deleteShift(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Shift - -Returns a single `Shift` specified by `id`. - -```ts -async getShift( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The UUID for the `Shift` being retrieved. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetShiftResponse`](../../doc/models/get-shift-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await laborApi.getShift(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Shift - -Updates an existing `Shift`. - -When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have -the `end_at` property set to a valid RFC-3339 datetime string. - -When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at` -set on each `Break`. - -```ts -async updateShift( - id: string, - body: UpdateShiftRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The ID of the object being updated. | -| `body` | [`UpdateShiftRequest`](../../doc/models/update-shift-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateShiftResponse`](../../doc/models/update-shift-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -const body: UpdateShiftRequest = { - shift: { - locationId: 'PAA1RJZZKXBFG', - startAt: '2019-01-25T03:11:00-05:00', - endAt: '2019-01-25T13:11:00-05:00', - wage: { - title: 'Bartender', - hourlyRate: { - amount: BigInt(1500), - currency: 'USD', - }, - tipEligible: true, - }, - breaks: [ - { - startAt: '2019-01-25T06:11:00-05:00', - breakTypeId: 'REGS1EQR1TPZ5', - name: 'Tea Break', - expectedDuration: 'PT5M', - isPaid: true, - id: 'X7GAQYVVRRG6P', - endAt: '2019-01-25T06:16:00-05:00', - } - ], - version: 1, - teamMemberId: 'ormj0jJJZ5OZIzxrZYJI', - declaredCashTipMoney: { - amount: BigInt(500), - currency: 'USD', - }, - }, -}; - -try { - const { result, ...httpResponse } = await laborApi.updateShift( - id, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Team Member Wages - -Returns a paginated list of `TeamMemberWage` instances for a business. - -```ts -async listTeamMemberWages( - teamMemberId?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string \| undefined` | Query, Optional | Filter the returned wages to only those that are associated with the
specified team member. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of `TeamMemberWage` results to return per page. The number can range between
1 and 200. The default is 200. | -| `cursor` | `string \| undefined` | Query, Optional | A pointer to the next page of `EmployeeWage` results to fetch. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListTeamMemberWagesResponse`](../../doc/models/list-team-member-wages-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await laborApi.listTeamMemberWages(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Team Member Wage - -Returns a single `TeamMemberWage` specified by `id`. - -```ts -async getTeamMemberWage( - id: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The UUID for the `TeamMemberWage` being retrieved. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetTeamMemberWageResponse`](../../doc/models/get-team-member-wage-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -try { - const { result, ...httpResponse } = await laborApi.getTeamMemberWage(id); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Workweek Configs - -Returns a list of `WorkweekConfig` instances for a business. - -```ts -async listWorkweekConfigs( - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of `WorkweekConfigs` results to return per page. | -| `cursor` | `string \| undefined` | Query, Optional | A pointer to the next page of `WorkweekConfig` results to fetch. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListWorkweekConfigsResponse`](../../doc/models/list-workweek-configs-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await laborApi.listWorkweekConfigs(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Workweek Config - -Updates a `WorkweekConfig`. - -```ts -async updateWorkweekConfig( - id: string, - body: UpdateWorkweekConfigRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Template, Required | The UUID for the `WorkweekConfig` object being updated. | -| `body` | [`UpdateWorkweekConfigRequest`](../../doc/models/update-workweek-config-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateWorkweekConfigResponse`](../../doc/models/update-workweek-config-response.md) - -## Example Usage - -```ts -const id = 'id0'; - -const body: UpdateWorkweekConfigRequest = { - workweekConfig: { - startOfWeek: 'MON', - startOfDayLocalTime: '10:00', - version: 10, - }, -}; - -try { - const { result, ...httpResponse } = await laborApi.updateWorkweekConfig( - id, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 9fc777f78..000000000 --- a/doc/api/location-custom-attributes.md +++ /dev/null @@ -1,605 +0,0 @@ -# Location Custom Attributes - -```ts -const locationCustomAttributesApi = client.locationCustomAttributesApi; -``` - -## Class Name - -`LocationCustomAttributesApi` - -## Methods - -* [List Location Custom Attribute Definitions](../../doc/api/location-custom-attributes.md#list-location-custom-attribute-definitions) -* [Create Location Custom Attribute Definition](../../doc/api/location-custom-attributes.md#create-location-custom-attribute-definition) -* [Delete Location Custom Attribute Definition](../../doc/api/location-custom-attributes.md#delete-location-custom-attribute-definition) -* [Retrieve Location Custom Attribute Definition](../../doc/api/location-custom-attributes.md#retrieve-location-custom-attribute-definition) -* [Update Location Custom Attribute Definition](../../doc/api/location-custom-attributes.md#update-location-custom-attribute-definition) -* [Bulk Delete Location Custom Attributes](../../doc/api/location-custom-attributes.md#bulk-delete-location-custom-attributes) -* [Bulk Upsert Location Custom Attributes](../../doc/api/location-custom-attributes.md#bulk-upsert-location-custom-attributes) -* [List Location Custom Attributes](../../doc/api/location-custom-attributes.md#list-location-custom-attributes) -* [Delete Location Custom Attribute](../../doc/api/location-custom-attributes.md#delete-location-custom-attribute) -* [Retrieve Location Custom Attribute](../../doc/api/location-custom-attributes.md#retrieve-location-custom-attribute) -* [Upsert Location Custom Attribute](../../doc/api/location-custom-attributes.md#upsert-location-custom-attribute) - - -# List Location Custom Attribute Definitions - -Lists the location-related [custom attribute definitions](../../doc/models/custom-attribute-definition.md) that belong to a Square seller account. -When all response pages are retrieved, the results include all custom attribute definitions -that are visible to the requesting application, including those that are created by other -applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async listLocationCustomAttributeDefinitions( - visibilityFilter?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Query, Optional | Filters the `CustomAttributeDefinition` results by their `visibility` values. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListLocationCustomAttributeDefinitionsResponse`](../../doc/models/list-location-custom-attribute-definitions-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.listLocationCustomAttributeDefinitions(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Location Custom Attribute Definition - -Creates a location-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) for a Square seller account. -Use this endpoint to define a custom attribute that can be associated with locations. -A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties -for a custom attribute. After the definition is created, you can call -[UpsertLocationCustomAttribute](../../doc/api/location-custom-attributes.md#upsert-location-custom-attribute) or -[BulkUpsertLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-upsert-location-custom-attributes) -to set the custom attribute for locations. - -```ts -async createLocationCustomAttributeDefinition( - body: CreateLocationCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateLocationCustomAttributeDefinitionRequest`](../../doc/models/create-location-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateLocationCustomAttributeDefinitionResponse`](../../doc/models/create-location-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const body: CreateLocationCustomAttributeDefinitionRequest = { - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Location Custom Attribute Definition - -Deletes a location-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. -Deleting a custom attribute definition also deletes the corresponding custom attribute from -all locations. -Only the definition owner can delete a custom attribute definition. - -```ts -async deleteLocationCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteLocationCustomAttributeDefinitionResponse`](../../doc/models/delete-location-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.deleteLocationCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Location Custom Attribute Definition - -Retrieves a location-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. -To retrieve a custom attribute definition created by another application, the `visibility` -setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async retrieveLocationCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to retrieve. If the requesting application
is not the definition owner, you must use the qualified key. | -| `version` | `number \| undefined` | Query, Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLocationCustomAttributeDefinitionResponse`](../../doc/models/retrieve-location-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.retrieveLocationCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Location Custom Attribute Definition - -Updates a location-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) for a Square seller account. -Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the -`schema` for a `Selection` data type. -Only the definition owner can update a custom attribute definition. - -```ts -async updateLocationCustomAttributeDefinition( - key: string, - body: UpdateLocationCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to update. | -| `body` | [`UpdateLocationCustomAttributeDefinitionRequest`](../../doc/models/update-location-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateLocationCustomAttributeDefinitionResponse`](../../doc/models/update-location-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -const body: UpdateLocationCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - description: 'Update the description as desired.', - visibility: 'VISIBILITY_READ_ONLY', - }, -}; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.updateLocationCustomAttributeDefinition( - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Delete Location Custom Attributes - -Deletes [custom attributes](../../doc/models/custom-attribute.md) for locations as a bulk operation. -To delete a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_WRITE_VALUES`. - -```ts -async bulkDeleteLocationCustomAttributes( - body: BulkDeleteLocationCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkDeleteLocationCustomAttributesRequest`](../../doc/models/bulk-delete-location-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkDeleteLocationCustomAttributesResponse`](../../doc/models/bulk-delete-location-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkDeleteLocationCustomAttributesRequest = { - values: { - 'id1': { - }, - 'id2': { - }, - 'id3': { - } - }, -}; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.bulkDeleteLocationCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Upsert Location Custom Attributes - -Creates or updates [custom attributes](../../doc/models/custom-attribute.md) for locations as a bulk operation. -Use this endpoint to set the value of one or more custom attributes for one or more locations. -A custom attribute is based on a custom attribute definition in a Square seller account, which is -created using the [CreateLocationCustomAttributeDefinition](../../doc/api/location-custom-attributes.md#create-location-custom-attribute-definition) endpoint. -This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert -requests and returns a map of individual upsert responses. Each upsert request has a unique ID -and provides a location ID and custom attribute. Each upsert response is returned with the ID -of the corresponding request. -To create or update a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async bulkUpsertLocationCustomAttributes( - body: BulkUpsertLocationCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkUpsertLocationCustomAttributesRequest`](../../doc/models/bulk-upsert-location-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkUpsertLocationCustomAttributesResponse`](../../doc/models/bulk-upsert-location-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkUpsertLocationCustomAttributesRequest = { - values: { - 'key0': { - locationId: 'location_id4', - customAttribute: { - }, - }, - 'key1': { - locationId: 'location_id4', - customAttribute: { - }, - } - }, -}; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.bulkUpsertLocationCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Location Custom Attributes - -Lists the [custom attributes](../../doc/models/custom-attribute.md) associated with a location. -You can use the `with_definitions` query parameter to also retrieve custom attribute definitions -in the same call. -When all response pages are retrieved, the results include all custom attributes that are -visible to the requesting application, including those that are owned by other applications -and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async listLocationCustomAttributes( - locationId: string, - visibilityFilter?: string, - limit?: number, - cursor?: string, - withDefinitions?: boolean, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the target [location](entity:Location). | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Query, Optional | Filters the `CustomAttributeDefinition` results by their `visibility` values. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListLocationCustomAttributesResponse`](../../doc/models/list-location-custom-attributes-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const withDefinitions = false; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.listLocationCustomAttributes( - locationId, - undefined, - undefined, - undefined, - withDefinitions -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Location Custom Attribute - -Deletes a [custom attribute](../../doc/models/custom-attribute.md) associated with a location. -To delete a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_WRITE_VALUES`. - -```ts -async deleteLocationCustomAttribute( - locationId: string, - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the target [location](entity:Location). | -| `key` | `string` | Template, Required | The key of the custom attribute to delete. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteLocationCustomAttributeResponse`](../../doc/models/delete-location-custom-attribute-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const key = 'key0'; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.deleteLocationCustomAttribute( - locationId, - key -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Location Custom Attribute - -Retrieves a [custom attribute](../../doc/models/custom-attribute.md) associated with a location. -You can use the `with_definition` query parameter to also retrieve the custom attribute definition -in the same call. -To retrieve a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async retrieveLocationCustomAttribute( - locationId: string, - key: string, - withDefinition?: boolean, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the target [location](entity:Location). | -| `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `withDefinition` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `version` | `number \| undefined` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLocationCustomAttributeResponse`](../../doc/models/retrieve-location-custom-attribute-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const key = 'key0'; - -const withDefinition = false; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.retrieveLocationCustomAttribute( - locationId, - key, - withDefinition -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Upsert Location Custom Attribute - -Creates or updates a [custom attribute](../../doc/models/custom-attribute.md) for a location. -Use this endpoint to set the value of a custom attribute for a specified location. -A custom attribute is based on a custom attribute definition in a Square seller account, which -is created using the [CreateLocationCustomAttributeDefinition](../../doc/api/location-custom-attributes.md#create-location-custom-attribute-definition) endpoint. -To create or update a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async upsertLocationCustomAttribute( - locationId: string, - key: string, - body: UpsertLocationCustomAttributeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the target [location](entity:Location). | -| `key` | `string` | Template, Required | The key of the custom attribute to create or update. This key must match the `key` of a
custom attribute definition in the Square seller account. If the requesting application is not
the definition owner, you must use the qualified key. | -| `body` | [`UpsertLocationCustomAttributeRequest`](../../doc/models/upsert-location-custom-attribute-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpsertLocationCustomAttributeResponse`](../../doc/models/upsert-location-custom-attribute-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const key = 'key0'; - -const body: UpsertLocationCustomAttributeRequest = { - customAttribute: { - }, -}; - -try { - const { result, ...httpResponse } = await locationCustomAttributesApi.upsertLocationCustomAttribute( - locationId, - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 4a9bccb00..000000000 --- a/doc/api/locations.md +++ /dev/null @@ -1,222 +0,0 @@ -# Locations - -```ts -const locationsApi = client.locationsApi; -``` - -## Class Name - -`LocationsApi` - -## Methods - -* [List Locations](../../doc/api/locations.md#list-locations) -* [Create Location](../../doc/api/locations.md#create-location) -* [Retrieve Location](../../doc/api/locations.md#retrieve-location) -* [Update Location](../../doc/api/locations.md#update-location) - - -# List Locations - -Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api), -including those with an inactive status. Locations are listed alphabetically by `name`. - -```ts -async listLocations( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListLocationsResponse`](../../doc/models/list-locations-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await locationsApi.listLocations(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Location - -Creates a [location](https://developer.squareup.com/docs/locations-api). -Creating new locations allows for separate configuration of receipt layouts, item prices, -and sales reports. Developers can use locations to separate sales activity through applications -that integrate with Square from sales activity elsewhere in a seller's account. -Locations created programmatically with the Locations API last forever and -are visible to the seller for their own management. Therefore, ensure that -each location has a sensible and unique name. - -```ts -async createLocation( - body: CreateLocationRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateLocationRequest`](../../doc/models/create-location-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateLocationResponse`](../../doc/models/create-location-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Location - -Retrieves details of a single location. Specify "main" -as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location). - -```ts -async retrieveLocation( - locationId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location to retrieve. Specify the string
"main" to return the main location. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLocationResponse`](../../doc/models/retrieve-location-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -try { - const { result, ...httpResponse } = await locationsApi.retrieveLocation(locationId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Location - -Updates a [location](https://developer.squareup.com/docs/locations-api). - -```ts -async updateLocation( - locationId: string, - body: UpdateLocationRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location to update. | -| `body` | [`UpdateLocationRequest`](../../doc/models/update-location-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateLocationResponse`](../../doc/models/update-location-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -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 -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 2841c3090..000000000 --- a/doc/api/loyalty.md +++ /dev/null @@ -1,976 +0,0 @@ -# Loyalty - -```ts -const loyaltyApi = client.loyaltyApi; -``` - -## Class Name - -`LoyaltyApi` - -## Methods - -* [Create Loyalty Account](../../doc/api/loyalty.md#create-loyalty-account) -* [Search Loyalty Accounts](../../doc/api/loyalty.md#search-loyalty-accounts) -* [Retrieve Loyalty Account](../../doc/api/loyalty.md#retrieve-loyalty-account) -* [Accumulate Loyalty Points](../../doc/api/loyalty.md#accumulate-loyalty-points) -* [Adjust Loyalty Points](../../doc/api/loyalty.md#adjust-loyalty-points) -* [Search Loyalty Events](../../doc/api/loyalty.md#search-loyalty-events) -* [List Loyalty Programs](../../doc/api/loyalty.md#list-loyalty-programs) -* [Retrieve Loyalty Program](../../doc/api/loyalty.md#retrieve-loyalty-program) -* [Calculate Loyalty Points](../../doc/api/loyalty.md#calculate-loyalty-points) -* [List Loyalty Promotions](../../doc/api/loyalty.md#list-loyalty-promotions) -* [Create Loyalty Promotion](../../doc/api/loyalty.md#create-loyalty-promotion) -* [Retrieve Loyalty Promotion](../../doc/api/loyalty.md#retrieve-loyalty-promotion) -* [Cancel Loyalty Promotion](../../doc/api/loyalty.md#cancel-loyalty-promotion) -* [Create Loyalty Reward](../../doc/api/loyalty.md#create-loyalty-reward) -* [Search Loyalty Rewards](../../doc/api/loyalty.md#search-loyalty-rewards) -* [Delete Loyalty Reward](../../doc/api/loyalty.md#delete-loyalty-reward) -* [Retrieve Loyalty Reward](../../doc/api/loyalty.md#retrieve-loyalty-reward) -* [Redeem Loyalty Reward](../../doc/api/loyalty.md#redeem-loyalty-reward) - - -# Create Loyalty Account - -Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer. - -```ts -async createLoyaltyAccount( - body: CreateLoyaltyAccountRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateLoyaltyAccountRequest`](../../doc/models/create-loyalty-account-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateLoyaltyAccountResponse`](../../doc/models/create-loyalty-account-response.md) - -## Example Usage - -```ts -const body: CreateLoyaltyAccountRequest = { - loyaltyAccount: { - programId: 'd619f755-2d17-41f3-990d-c04ecedd64dd', - mapping: { - phoneNumber: '+14155551234', - }, - }, - idempotencyKey: 'ec78c477-b1c3-4899-a209-a4e71337c996', -}; - -try { - const { result, ...httpResponse } = await loyaltyApi.createLoyaltyAccount(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Loyalty Accounts - -Searches for loyalty accounts in a loyalty program. - -You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty `query` object or omit it entirely. - -Search results are sorted by `created_at` in ascending order. - -```ts -async searchLoyaltyAccounts( - body: SearchLoyaltyAccountsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchLoyaltyAccountsRequest`](../../doc/models/search-loyalty-accounts-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchLoyaltyAccountsResponse`](../../doc/models/search-loyalty-accounts-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Loyalty Account - -Retrieves a loyalty account. - -```ts -async retrieveLoyaltyAccount( - accountId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `accountId` | `string` | Template, Required | The ID of the [loyalty account](entity:LoyaltyAccount) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLoyaltyAccountResponse`](../../doc/models/retrieve-loyalty-account-response.md) - -## Example Usage - -```ts -const accountId = 'account_id2'; - -try { - const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyAccount(accountId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Accumulate Loyalty Points - -Adds points earned from a purchase to a [loyalty account](../../doc/models/loyalty-account.md). - -- If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order - to compute the points earned from both the base loyalty program and an associated - [loyalty promotion](../../doc/models/loyalty-promotion.md). For purchases that qualify for multiple accrual - rules, Square computes points based on the accrual rule that grants the most points. - For purchases that qualify for multiple promotions, Square computes points based on the most - recently created promotion. A purchase must first qualify for program points to be eligible for promotion points. - -- If you are not using the Orders API to manage orders, provide `points` with the number of points to add. - You must first perform a client-side computation of the points earned from the loyalty program and - loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](../../doc/api/loyalty.md#calculate-loyalty-points) - to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see - [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). - -```ts -async accumulateLoyaltyPoints( - accountId: string, - body: AccumulateLoyaltyPointsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `accountId` | `string` | Template, Required | The ID of the target [loyalty account](entity:LoyaltyAccount). | -| `body` | [`AccumulateLoyaltyPointsRequest`](../../doc/models/accumulate-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`AccumulateLoyaltyPointsResponse`](../../doc/models/accumulate-loyalty-points-response.md) - -## Example Usage - -```ts -const accountId = 'account_id2'; - -const body: AccumulateLoyaltyPointsRequest = { - accumulatePoints: { - orderId: 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY', - }, - idempotencyKey: '58b90739-c3e8-4b11-85f7-e636d48d72cb', - locationId: 'P034NEENMD09F', -}; - -try { - const { result, ...httpResponse } = await loyaltyApi.accumulateLoyaltyPoints( - accountId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Adjust Loyalty Points - -Adds points to or subtracts points from a buyer's account. - -Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call -[AccumulateLoyaltyPoints](../../doc/api/loyalty.md#accumulate-loyalty-points) -to add points when a buyer pays for the purchase. - -```ts -async adjustLoyaltyPoints( - accountId: string, - body: AdjustLoyaltyPointsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `accountId` | `string` | Template, Required | The ID of the target [loyalty account](entity:LoyaltyAccount). | -| `body` | [`AdjustLoyaltyPointsRequest`](../../doc/models/adjust-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`AdjustLoyaltyPointsResponse`](../../doc/models/adjust-loyalty-points-response.md) - -## Example Usage - -```ts -const accountId = 'account_id2'; - -const body: AdjustLoyaltyPointsRequest = { - idempotencyKey: 'bc29a517-3dc9-450e-aa76-fae39ee849d1', - adjustPoints: { - points: 10, - reason: 'Complimentary points', - }, -}; - -try { - const { result, ...httpResponse } = await loyaltyApi.adjustLoyaltyPoints( - accountId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Loyalty Events - -Searches for loyalty events. - -A Square loyalty program maintains a ledger of events that occur during the lifetime of a -buyer's loyalty account. Each change in the point balance -(for example, points earned, points redeemed, and points expired) is -recorded in the ledger. Using this endpoint, you can search the ledger for events. - -Search results are sorted by `created_at` in descending order. - -```ts -async searchLoyaltyEvents( - body: SearchLoyaltyEventsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchLoyaltyEventsRequest`](../../doc/models/search-loyalty-events-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchLoyaltyEventsResponse`](../../doc/models/search-loyalty-events-response.md) - -## Example Usage - -```ts -const body: SearchLoyaltyEventsRequest = { - query: { - filter: { - orderFilter: { - orderId: 'PyATxhYLfsMqpVkcKJITPydgEYfZY', - }, - }, - }, - limit: 30, -}; - -try { - const { result, ...httpResponse } = await loyaltyApi.searchLoyaltyEvents(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Loyalty Programs - -**This endpoint is deprecated.** - -Returns a list of loyalty programs in the seller's account. -Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). - -Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword `main`. - -```ts -async listLoyaltyPrograms( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListLoyaltyProgramsResponse`](../../doc/models/list-loyalty-programs-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await loyaltyApi.listLoyaltyPrograms(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Loyalty Program - -Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`. - -Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). - -```ts -async retrieveLoyaltyProgram( - programId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `programId` | `string` | Template, Required | The ID of the loyalty program or the keyword `main`. Either value can be used to retrieve the single loyalty program that belongs to the seller. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLoyaltyProgramResponse`](../../doc/models/retrieve-loyalty-program-response.md) - -## Example Usage - -```ts -const programId = 'program_id0'; - -try { - const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyProgram(programId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Calculate Loyalty Points - -Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint -to display the points to the buyer. - -- If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`. - Square reads the order to compute the points earned from the base loyalty program and an associated - [loyalty promotion](../../doc/models/loyalty-promotion.md). - -- If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the - purchase amount. Square uses this amount to calculate the points earned from the base loyalty program, - but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode` - setting of the accrual rule indicates how taxes should be treated for loyalty points accrual. - If the purchase qualifies for program points, call - [ListLoyaltyPromotions](../../doc/api/loyalty.md#list-loyalty-promotions) and perform a client-side computation - to calculate whether the purchase also qualifies for promotion points. For more information, see - [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). - -```ts -async calculateLoyaltyPoints( - programId: string, - body: CalculateLoyaltyPointsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `programId` | `string` | Template, Required | The ID of the [loyalty program](entity:LoyaltyProgram), which defines the rules for accruing points. | -| `body` | [`CalculateLoyaltyPointsRequest`](../../doc/models/calculate-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CalculateLoyaltyPointsResponse`](../../doc/models/calculate-loyalty-points-response.md) - -## Example Usage - -```ts -const programId = 'program_id0'; - -const body: CalculateLoyaltyPointsRequest = { - orderId: 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY', - loyaltyAccountId: '79b807d2-d786-46a9-933b-918028d7a8c5', -}; - -try { - const { result, ...httpResponse } = await loyaltyApi.calculateLoyaltyPoints( - programId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Loyalty Promotions - -Lists the loyalty promotions associated with a [loyalty program](../../doc/models/loyalty-program.md). -Results are sorted by the `created_at` date in descending order (newest to oldest). - -```ts -async listLoyaltyPromotions( - programId: string, - status?: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `programId` | `string` | Template, Required | The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword. | -| `status` | [`string \| undefined`](../../doc/models/loyalty-promotion-status.md) | Query, Optional | The status to filter the results by. If a status is provided, only loyalty promotions
with the specified status are returned. Otherwise, all loyalty promotions associated with
the loyalty program are returned. | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response.
The minimum value is 1 and the maximum value is 30. The default value is 30.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListLoyaltyPromotionsResponse`](../../doc/models/list-loyalty-promotions-response.md) - -## Example Usage - -```ts -const programId = 'program_id0'; - -try { - const { result, ...httpResponse } = await loyaltyApi.listLoyaltyPromotions(programId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Loyalty Promotion - -Creates a loyalty promotion for a [loyalty program](../../doc/models/loyalty-program.md). A loyalty promotion -enables buyers to earn points in addition to those earned from the base loyalty program. - -This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the -`available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an -`ACTIVE` or `SCHEDULED` status. - -```ts -async createLoyaltyPromotion( - programId: string, - body: CreateLoyaltyPromotionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `programId` | `string` | Template, Required | The ID of the [loyalty program](entity:LoyaltyProgram) to associate with the promotion.
To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram)
using the `main` keyword. | -| `body` | [`CreateLoyaltyPromotionRequest`](../../doc/models/create-loyalty-promotion-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateLoyaltyPromotionResponse`](../../doc/models/create-loyalty-promotion-response.md) - -## Example Usage - -```ts -const programId = 'program_id0'; - -const body: CreateLoyaltyPromotionRequest = { - loyaltyPromotion: { - name: 'Tuesday Happy Hour Promo', - incentive: { - type: 'POINTS_MULTIPLIER', - pointsMultiplierData: { - multiplier: '3.0', - }, - }, - 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 -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Loyalty Promotion - -Retrieves a loyalty promotion. - -```ts -async retrieveLoyaltyPromotion( - promotionId: string, - programId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `promotionId` | `string` | Template, Required | The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve. | -| `programId` | `string` | Template, Required | The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID,
call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLoyaltyPromotionResponse`](../../doc/models/retrieve-loyalty-promotion-response.md) - -## Example Usage - -```ts -const promotionId = 'promotion_id0'; - -const programId = 'program_id0'; - -try { - const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyPromotion( - promotionId, - programId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Loyalty Promotion - -Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the -end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion. -Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before -you create a new one. - -This endpoint sets the loyalty promotion to the `CANCELED` state - -```ts -async cancelLoyaltyPromotion( - promotionId: string, - programId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `promotionId` | `string` | Template, Required | The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can cancel a
promotion that has an `ACTIVE` or `SCHEDULED` status. | -| `programId` | `string` | Template, Required | The ID of the base [loyalty program](entity:LoyaltyProgram). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelLoyaltyPromotionResponse`](../../doc/models/cancel-loyalty-promotion-response.md) - -## Example Usage - -```ts -const promotionId = 'promotion_id0'; - -const programId = 'program_id0'; - -try { - const { result, ...httpResponse } = await loyaltyApi.cancelLoyaltyPromotion( - promotionId, - programId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Loyalty Reward - -Creates a loyalty reward. In the process, the endpoint does following: - -- Uses the `reward_tier_id` in the request to determine the number of points - to lock for this reward. -- If the request includes `order_id`, it adds the reward and related discount to the order. - -After a reward is created, the points are locked and -not available for the buyer to redeem another reward. - -```ts -async createLoyaltyReward( - body: CreateLoyaltyRewardRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateLoyaltyRewardRequest`](../../doc/models/create-loyalty-reward-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateLoyaltyRewardResponse`](../../doc/models/create-loyalty-reward-response.md) - -## Example Usage - -```ts -const body: CreateLoyaltyRewardRequest = { - reward: { - loyaltyAccountId: '5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd', - rewardTierId: 'e1b39225-9da5-43d1-a5db-782cdd8ad94f', - orderId: 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY', - }, - idempotencyKey: '18c2e5ea-a620-4b1f-ad60-7b167285e451', -}; - -try { - const { result, ...httpResponse } = await loyaltyApi.createLoyaltyReward(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Loyalty Rewards - -Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. -If you include a `query` object, `loyalty_account_id` is required and `status` is optional. - -If you know a reward ID, use the -[RetrieveLoyaltyReward](../../doc/api/loyalty.md#retrieve-loyalty-reward) endpoint. - -Search results are sorted by `updated_at` in descending order. - -```ts -async searchLoyaltyRewards( - body: SearchLoyaltyRewardsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchLoyaltyRewardsRequest`](../../doc/models/search-loyalty-rewards-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchLoyaltyRewardsResponse`](../../doc/models/search-loyalty-rewards-response.md) - -## Example Usage - -```ts -const body: SearchLoyaltyRewardsRequest = { - query: { - loyaltyAccountId: '5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd', - }, - limit: 10, -}; - -try { - const { result, ...httpResponse } = await loyaltyApi.searchLoyaltyRewards(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Loyalty Reward - -Deletes a loyalty reward by doing the following: - -- Returns the loyalty points back to the loyalty account. -- If an order ID was specified when the reward was created - (see [CreateLoyaltyReward](../../doc/api/loyalty.md#create-loyalty-reward)), - it updates the order by removing the reward and related - discounts. - -You cannot delete a reward that has reached the terminal state (REDEEMED). - -```ts -async deleteLoyaltyReward( - rewardId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](entity:LoyaltyReward) to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteLoyaltyRewardResponse`](../../doc/models/delete-loyalty-reward-response.md) - -## Example Usage - -```ts -const rewardId = 'reward_id4'; - -try { - const { result, ...httpResponse } = await loyaltyApi.deleteLoyaltyReward(rewardId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Loyalty Reward - -Retrieves a loyalty reward. - -```ts -async retrieveLoyaltyReward( - rewardId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](entity:LoyaltyReward) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveLoyaltyRewardResponse`](../../doc/models/retrieve-loyalty-reward-response.md) - -## Example Usage - -```ts -const rewardId = 'reward_id4'; - -try { - const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyReward(rewardId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Redeem Loyalty Reward - -Redeems a loyalty reward. - -The endpoint sets the reward to the `REDEEMED` terminal state. - -If you are using your own order processing system (not using the -Orders API), you call this endpoint after the buyer paid for the -purchase. - -After the reward reaches the terminal state, it cannot be deleted. -In other words, points used for the reward cannot be returned -to the account. - -```ts -async redeemLoyaltyReward( - rewardId: string, - body: RedeemLoyaltyRewardRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](entity:LoyaltyReward) to redeem. | -| `body` | [`RedeemLoyaltyRewardRequest`](../../doc/models/redeem-loyalty-reward-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RedeemLoyaltyRewardResponse`](../../doc/models/redeem-loyalty-reward-response.md) - -## Example Usage - -```ts -const rewardId = 'reward_id4'; - -const body: RedeemLoyaltyRewardRequest = { - idempotencyKey: '98adc7f7-6963-473b-b29c-f3c9cdd7d994', - locationId: 'P034NEENMD09F', -}; - -try { - const { result, ...httpResponse } = await loyaltyApi.redeemLoyaltyReward( - rewardId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 499597bf4..000000000 --- a/doc/api/merchant-custom-attributes.md +++ /dev/null @@ -1,603 +0,0 @@ -# Merchant Custom Attributes - -```ts -const merchantCustomAttributesApi = client.merchantCustomAttributesApi; -``` - -## Class Name - -`MerchantCustomAttributesApi` - -## Methods - -* [List Merchant Custom Attribute Definitions](../../doc/api/merchant-custom-attributes.md#list-merchant-custom-attribute-definitions) -* [Create Merchant Custom Attribute Definition](../../doc/api/merchant-custom-attributes.md#create-merchant-custom-attribute-definition) -* [Delete Merchant Custom Attribute Definition](../../doc/api/merchant-custom-attributes.md#delete-merchant-custom-attribute-definition) -* [Retrieve Merchant Custom Attribute Definition](../../doc/api/merchant-custom-attributes.md#retrieve-merchant-custom-attribute-definition) -* [Update Merchant Custom Attribute Definition](../../doc/api/merchant-custom-attributes.md#update-merchant-custom-attribute-definition) -* [Bulk Delete Merchant Custom Attributes](../../doc/api/merchant-custom-attributes.md#bulk-delete-merchant-custom-attributes) -* [Bulk Upsert Merchant Custom Attributes](../../doc/api/merchant-custom-attributes.md#bulk-upsert-merchant-custom-attributes) -* [List Merchant Custom Attributes](../../doc/api/merchant-custom-attributes.md#list-merchant-custom-attributes) -* [Delete Merchant Custom Attribute](../../doc/api/merchant-custom-attributes.md#delete-merchant-custom-attribute) -* [Retrieve Merchant Custom Attribute](../../doc/api/merchant-custom-attributes.md#retrieve-merchant-custom-attribute) -* [Upsert Merchant Custom Attribute](../../doc/api/merchant-custom-attributes.md#upsert-merchant-custom-attribute) - - -# List Merchant Custom Attribute Definitions - -Lists the merchant-related [custom attribute definitions](../../doc/models/custom-attribute-definition.md) that belong to a Square seller account. -When all response pages are retrieved, the results include all custom attribute definitions -that are visible to the requesting application, including those that are created by other -applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async listMerchantCustomAttributeDefinitions( - visibilityFilter?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Query, Optional | Filters the `CustomAttributeDefinition` results by their `visibility` values. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListMerchantCustomAttributeDefinitionsResponse`](../../doc/models/list-merchant-custom-attribute-definitions-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.listMerchantCustomAttributeDefinitions(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Merchant Custom Attribute Definition - -Creates a merchant-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) for a Square seller account. -Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application. -A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties -for a custom attribute. After the definition is created, you can call -[UpsertMerchantCustomAttribute](../../doc/api/merchant-custom-attributes.md#upsert-merchant-custom-attribute) or -[BulkUpsertMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-upsert-merchant-custom-attributes) -to set the custom attribute for a merchant. - -```ts -async createMerchantCustomAttributeDefinition( - body: CreateMerchantCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateMerchantCustomAttributeDefinitionRequest`](../../doc/models/create-merchant-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateMerchantCustomAttributeDefinitionResponse`](../../doc/models/create-merchant-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const body: CreateMerchantCustomAttributeDefinitionRequest = { - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Merchant Custom Attribute Definition - -Deletes a merchant-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. -Deleting a custom attribute definition also deletes the corresponding custom attribute from -the merchant. -Only the definition owner can delete a custom attribute definition. - -```ts -async deleteMerchantCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteMerchantCustomAttributeDefinitionResponse`](../../doc/models/delete-merchant-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.deleteMerchantCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Merchant Custom Attribute Definition - -Retrieves a merchant-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. -To retrieve a custom attribute definition created by another application, the `visibility` -setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async retrieveMerchantCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to retrieve. If the requesting application
is not the definition owner, you must use the qualified key. | -| `version` | `number \| undefined` | Query, Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveMerchantCustomAttributeDefinitionResponse`](../../doc/models/retrieve-merchant-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.retrieveMerchantCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Merchant Custom Attribute Definition - -Updates a merchant-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) for a Square seller account. -Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the -`schema` for a `Selection` data type. -Only the definition owner can update a custom attribute definition. - -```ts -async updateMerchantCustomAttributeDefinition( - key: string, - body: UpdateMerchantCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to update. | -| `body` | [`UpdateMerchantCustomAttributeDefinitionRequest`](../../doc/models/update-merchant-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateMerchantCustomAttributeDefinitionResponse`](../../doc/models/update-merchant-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -const body: UpdateMerchantCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - description: 'Update the description as desired.', - visibility: 'VISIBILITY_READ_ONLY', - }, -}; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.updateMerchantCustomAttributeDefinition( - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Delete Merchant Custom Attributes - -Deletes [custom attributes](../../doc/models/custom-attribute.md) for a merchant as a bulk operation. -To delete a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_WRITE_VALUES`. - -```ts -async bulkDeleteMerchantCustomAttributes( - body: BulkDeleteMerchantCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkDeleteMerchantCustomAttributesRequest`](../../doc/models/bulk-delete-merchant-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkDeleteMerchantCustomAttributesResponse`](../../doc/models/bulk-delete-merchant-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkDeleteMerchantCustomAttributesRequest = { - values: { - 'id1': { - }, - 'id2': { - } - }, -}; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.bulkDeleteMerchantCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Upsert Merchant Custom Attributes - -Creates or updates [custom attributes](../../doc/models/custom-attribute.md) for a merchant as a bulk operation. -Use this endpoint to set the value of one or more custom attributes for a merchant. -A custom attribute is based on a custom attribute definition in a Square seller account, which is -created using the [CreateMerchantCustomAttributeDefinition](../../doc/api/merchant-custom-attributes.md#create-merchant-custom-attribute-definition) endpoint. -This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert -requests and returns a map of individual upsert responses. Each upsert request has a unique ID -and provides a merchant ID and custom attribute. Each upsert response is returned with the ID -of the corresponding request. -To create or update a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async bulkUpsertMerchantCustomAttributes( - body: BulkUpsertMerchantCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkUpsertMerchantCustomAttributesRequest`](../../doc/models/bulk-upsert-merchant-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkUpsertMerchantCustomAttributesResponse`](../../doc/models/bulk-upsert-merchant-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkUpsertMerchantCustomAttributesRequest = { - values: { - 'key0': { - merchantId: 'merchant_id0', - customAttribute: { - }, - }, - 'key1': { - merchantId: 'merchant_id0', - customAttribute: { - }, - } - }, -}; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.bulkUpsertMerchantCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Merchant Custom Attributes - -Lists the [custom attributes](../../doc/models/custom-attribute.md) associated with a merchant. -You can use the `with_definitions` query parameter to also retrieve custom attribute definitions -in the same call. -When all response pages are retrieved, the results include all custom attributes that are -visible to the requesting application, including those that are owned by other applications -and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async listMerchantCustomAttributes( - merchantId: string, - visibilityFilter?: string, - limit?: number, - cursor?: string, - withDefinitions?: boolean, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantId` | `string` | Template, Required | The ID of the target [merchant](entity:Merchant). | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Query, Optional | Filters the `CustomAttributeDefinition` results by their `visibility` values. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListMerchantCustomAttributesResponse`](../../doc/models/list-merchant-custom-attributes-response.md) - -## Example Usage - -```ts -const merchantId = 'merchant_id0'; - -const withDefinitions = false; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.listMerchantCustomAttributes( - merchantId, - undefined, - undefined, - undefined, - withDefinitions -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Merchant Custom Attribute - -Deletes a [custom attribute](../../doc/models/custom-attribute.md) associated with a merchant. -To delete a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_WRITE_VALUES`. - -```ts -async deleteMerchantCustomAttribute( - merchantId: string, - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantId` | `string` | Template, Required | The ID of the target [merchant](entity:Merchant). | -| `key` | `string` | Template, Required | The key of the custom attribute to delete. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteMerchantCustomAttributeResponse`](../../doc/models/delete-merchant-custom-attribute-response.md) - -## Example Usage - -```ts -const merchantId = 'merchant_id0'; - -const key = 'key0'; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.deleteMerchantCustomAttribute( - merchantId, - key -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Merchant Custom Attribute - -Retrieves a [custom attribute](../../doc/models/custom-attribute.md) associated with a merchant. -You can use the `with_definition` query parameter to also retrieve the custom attribute definition -in the same call. -To retrieve a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async retrieveMerchantCustomAttribute( - merchantId: string, - key: string, - withDefinition?: boolean, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantId` | `string` | Template, Required | The ID of the target [merchant](entity:Merchant). | -| `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom
attribute definition in the Square seller account. If the requesting application is not the
definition owner, you must use the qualified key. | -| `withDefinition` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `version` | `number \| undefined` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveMerchantCustomAttributeResponse`](../../doc/models/retrieve-merchant-custom-attribute-response.md) - -## Example Usage - -```ts -const merchantId = 'merchant_id0'; - -const key = 'key0'; - -const withDefinition = false; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.retrieveMerchantCustomAttribute( - merchantId, - key, - withDefinition -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Upsert Merchant Custom Attribute - -Creates or updates a [custom attribute](../../doc/models/custom-attribute.md) for a merchant. -Use this endpoint to set the value of a custom attribute for a specified merchant. -A custom attribute is based on a custom attribute definition in a Square seller account, which -is created using the [CreateMerchantCustomAttributeDefinition](../../doc/api/merchant-custom-attributes.md#create-merchant-custom-attribute-definition) endpoint. -To create or update a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async upsertMerchantCustomAttribute( - merchantId: string, - key: string, - body: UpsertMerchantCustomAttributeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantId` | `string` | Template, Required | The ID of the target [merchant](entity:Merchant). | -| `key` | `string` | Template, Required | The key of the custom attribute to create or update. This key must match the `key` of a
custom attribute definition in the Square seller account. If the requesting application is not
the definition owner, you must use the qualified key. | -| `body` | [`UpsertMerchantCustomAttributeRequest`](../../doc/models/upsert-merchant-custom-attribute-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpsertMerchantCustomAttributeResponse`](../../doc/models/upsert-merchant-custom-attribute-response.md) - -## Example Usage - -```ts -const merchantId = 'merchant_id0'; - -const key = 'key0'; - -const body: UpsertMerchantCustomAttributeRequest = { - customAttribute: { - }, -}; - -try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.upsertMerchantCustomAttribute( - merchantId, - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index e3d13e89d..000000000 --- a/doc/api/merchants.md +++ /dev/null @@ -1,102 +0,0 @@ -# Merchants - -```ts -const merchantsApi = client.merchantsApi; -``` - -## Class Name - -`MerchantsApi` - -## Methods - -* [List Merchants](../../doc/api/merchants.md#list-merchants) -* [Retrieve Merchant](../../doc/api/merchants.md#retrieve-merchant) - - -# List Merchants - -Provides details about the merchant associated with a given access token. - -The access token used to connect your application to a Square seller is associated -with a single merchant. That means that `ListMerchants` returns a list -with a single `Merchant` object. You can specify your personal access token -to get your own merchant information or specify an OAuth token to get the -information for the merchant that granted your application access. - -If you know the merchant ID, you can also use the [RetrieveMerchant](../../doc/api/merchants.md#retrieve-merchant) -endpoint to retrieve the merchant information. - -```ts -async listMerchants( - cursor?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `number \| undefined` | Query, Optional | The cursor generated by the previous response. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListMerchantsResponse`](../../doc/models/list-merchants-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await merchantsApi.listMerchants(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Merchant - -Retrieves the `Merchant` object for the given `merchant_id`. - -```ts -async retrieveMerchant( - merchantId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantId` | `string` | Template, Required | The ID of the merchant to retrieve. If the string "me" is supplied as the ID,
then retrieve the merchant that is currently accessible to this call. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveMerchantResponse`](../../doc/models/retrieve-merchant-response.md) - -## Example Usage - -```ts -const merchantId = 'merchant_id0'; - -try { - const { result, ...httpResponse } = await merchantsApi.retrieveMerchant(merchantId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index ad614acc7..000000000 --- a/doc/api/mobile-authorization.md +++ /dev/null @@ -1,63 +0,0 @@ -# Mobile Authorization - -```ts -const mobileAuthorizationApi = client.mobileAuthorizationApi; -``` - -## Class Name - -`MobileAuthorizationApi` - - -# Create Mobile Authorization Code - -Generates code to authorize a mobile application to connect to a Square card reader. - -Authorization codes are one-time-use codes and expire 60 minutes after being issued. - -__Important:__ The `Authorization` header you provide to this endpoint must have the following format: - -``` -Authorization: Bearer ACCESS_TOKEN -``` - -Replace `ACCESS_TOKEN` with a -[valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). - -```ts -async createMobileAuthorizationCode( - body: CreateMobileAuthorizationCodeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateMobileAuthorizationCodeRequest`](../../doc/models/create-mobile-authorization-code-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateMobileAuthorizationCodeResponse`](../../doc/models/create-mobile-authorization-code-response.md) - -## Example Usage - -```ts -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) { - 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 deleted file mode 100644 index 9de69302d..000000000 --- a/doc/api/o-auth.md +++ /dev/null @@ -1,193 +0,0 @@ -# O Auth - -```ts -const oAuthApi = client.oAuthApi; -``` - -## Class Name - -`OAuthApi` - -## Methods - -* [Revoke Token](../../doc/api/o-auth.md#revoke-token) -* [Obtain Token](../../doc/api/o-auth.md#obtain-token) -* [Retrieve Token Status](../../doc/api/o-auth.md#retrieve-token-status) - - -# Revoke Token - -Revokes an access token generated with the OAuth flow. - -If an account has more than one OAuth access token for your application, this -endpoint revokes all of them, regardless of which token you specify. - -__Important:__ The `Authorization` header for this endpoint must have the -following format: - -``` -Authorization: Client APPLICATION_SECRET -``` - -Replace `APPLICATION_SECRET` with the application secret on the **OAuth** -page for your application in the Developer Dashboard. - -:information_source: **Note** This endpoint does not require authentication. - -```ts -async revokeToken( - body: RevokeTokenRequest, - authorization: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`RevokeTokenRequest`](../../doc/models/revoke-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. | - -## Response Type - -[`RevokeTokenResponse`](../../doc/models/revoke-token-response.md) - -## Example Usage - -```ts -const body: RevokeTokenRequest = { - clientId: 'CLIENT_ID', - accessToken: 'ACCESS_TOKEN', -}; - -const authorization = 'Client CLIENT_SECRET'; - -try { - const { result, ...httpResponse } = await oAuthApi.revokeToken( - body, - authorization -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Obtain Token - -Returns an OAuth access token and a refresh token unless the -`short_lived` parameter is set to `true`, in which case the endpoint -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'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. - -You can use the `scopes` parameter to limit the set of permissions granted -to the access token and refresh token. You can use the `short_lived` parameter -to create an access token that expires in 24 hours. - -__Note:__ OAuth tokens should be encrypted and stored on a secure server. -Application clients should never interact directly with OAuth tokens. - -:information_source: **Note** This endpoint does not require authentication. - -```ts -async obtainToken( - body: ObtainTokenRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`ObtainTokenRequest`](../../doc/models/obtain-token-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ObtainTokenResponse`](../../doc/models/obtain-token-response.md) - -## Example Usage - -```ts -const body: ObtainTokenRequest = { - clientId: 'APPLICATION_ID', - grantType: 'authorization_code', - clientSecret: 'APPLICATION_SECRET', - code: 'CODE_FROM_AUTHORIZE', -}; - -try { - const { result, ...httpResponse } = await oAuthApi.obtainToken(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Token Status - -Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token). - -Add the access token to the Authorization header of the request. - -__Important:__ The `Authorization` header you provide to this endpoint must have the following format: - -``` -Authorization: Bearer ACCESS_TOKEN -``` - -where `ACCESS_TOKEN` is a -[valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). - -If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error. - -```ts -async retrieveTokenStatus( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveTokenStatusResponse`](../../doc/models/retrieve-token-status-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await oAuthApi.retrieveTokenStatus(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 5bdfaf4af..000000000 --- a/doc/api/order-custom-attributes.md +++ /dev/null @@ -1,634 +0,0 @@ -# Order Custom Attributes - -```ts -const orderCustomAttributesApi = client.orderCustomAttributesApi; -``` - -## Class Name - -`OrderCustomAttributesApi` - -## Methods - -* [List Order Custom Attribute Definitions](../../doc/api/order-custom-attributes.md#list-order-custom-attribute-definitions) -* [Create Order Custom Attribute Definition](../../doc/api/order-custom-attributes.md#create-order-custom-attribute-definition) -* [Delete Order Custom Attribute Definition](../../doc/api/order-custom-attributes.md#delete-order-custom-attribute-definition) -* [Retrieve Order Custom Attribute Definition](../../doc/api/order-custom-attributes.md#retrieve-order-custom-attribute-definition) -* [Update Order Custom Attribute Definition](../../doc/api/order-custom-attributes.md#update-order-custom-attribute-definition) -* [Bulk Delete Order Custom Attributes](../../doc/api/order-custom-attributes.md#bulk-delete-order-custom-attributes) -* [Bulk Upsert Order Custom Attributes](../../doc/api/order-custom-attributes.md#bulk-upsert-order-custom-attributes) -* [List Order Custom Attributes](../../doc/api/order-custom-attributes.md#list-order-custom-attributes) -* [Delete Order Custom Attribute](../../doc/api/order-custom-attributes.md#delete-order-custom-attribute) -* [Retrieve Order Custom Attribute](../../doc/api/order-custom-attributes.md#retrieve-order-custom-attribute) -* [Upsert Order Custom Attribute](../../doc/api/order-custom-attributes.md#upsert-order-custom-attribute) - - -# List Order Custom Attribute Definitions - -Lists the order-related [custom attribute definitions](../../doc/models/custom-attribute-definition.md) that belong to a Square seller account. - -When all response pages are retrieved, the results include all custom attribute definitions -that are visible to the requesting application, including those that are created by other -applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that -seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async listOrderCustomAttributeDefinitions( - visibilityFilter?: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Query, Optional | Requests that all of the custom attributes be returned, or only those that are read-only or read-write. | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListOrderCustomAttributeDefinitionsResponse`](../../doc/models/list-order-custom-attribute-definitions-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.listOrderCustomAttributeDefinitions(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Order Custom Attribute Definition - -Creates an order-related custom attribute definition. Use this endpoint to -define a custom attribute that can be associated with orders. - -After creating a custom attribute definition, you can set the custom attribute for orders -in the Square seller account. - -```ts -async createOrderCustomAttributeDefinition( - body: CreateOrderCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateOrderCustomAttributeDefinitionRequest`](../../doc/models/create-order-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateOrderCustomAttributeDefinitionResponse`](../../doc/models/create-order-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const body: CreateOrderCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - key: 'cover-count', - name: 'Cover count', - description: 'The number of people seated at a table', - visibility: 'VISIBILITY_READ_WRITE_VALUES', - }, - idempotencyKey: 'IDEMPOTENCY_KEY', -}; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.createOrderCustomAttributeDefinition(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Order Custom Attribute Definition - -Deletes an order-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. - -Only the definition owner can delete a custom attribute definition. - -```ts -async deleteOrderCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteOrderCustomAttributeDefinitionResponse`](../../doc/models/delete-order-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.deleteOrderCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Order Custom Attribute Definition - -Retrieves an order-related [custom attribute definition](../../doc/models/custom-attribute-definition.md) from a Square seller account. - -To retrieve a custom attribute definition created by another application, the `visibility` -setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async retrieveOrderCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to retrieve. | -| `version` | `number \| undefined` | Query, Optional | To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
control, include this optional field and specify the current version of the custom attribute. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveOrderCustomAttributeDefinitionResponse`](../../doc/models/retrieve-order-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.retrieveOrderCustomAttributeDefinition(key); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Order Custom Attribute Definition - -Updates an order-related custom attribute definition for a Square seller account. - -Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. - -```ts -async updateOrderCustomAttributeDefinition( - key: string, - body: UpdateOrderCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Template, Required | The key of the custom attribute definition to update. | -| `body` | [`UpdateOrderCustomAttributeDefinitionRequest`](../../doc/models/update-order-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateOrderCustomAttributeDefinitionResponse`](../../doc/models/update-order-custom-attribute-definition-response.md) - -## Example Usage - -```ts -const key = 'key0'; - -const body: UpdateOrderCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - key: 'cover-count', - visibility: 'VISIBILITY_READ_ONLY', - version: 1, - }, - idempotencyKey: 'IDEMPOTENCY_KEY', -}; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.updateOrderCustomAttributeDefinition( - key, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Delete Order Custom Attributes - -Deletes order [custom attributes](../../doc/models/custom-attribute.md) as a bulk operation. - -Use this endpoint to delete one or more custom attributes from one or more orders. -A custom attribute is based on a custom attribute definition in a Square seller account. (To create a -custom attribute definition, use the [CreateOrderCustomAttributeDefinition](../../doc/api/order-custom-attributes.md#create-order-custom-attribute-definition) endpoint.) - -This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete -requests and returns a map of individual delete responses. Each delete request has a unique ID -and provides an order ID and custom attribute. Each delete response is returned with the ID -of the corresponding request. - -To delete a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async bulkDeleteOrderCustomAttributes( - body: BulkDeleteOrderCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkDeleteOrderCustomAttributesRequest`](../../doc/models/bulk-delete-order-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkDeleteOrderCustomAttributesResponse`](../../doc/models/bulk-delete-order-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkDeleteOrderCustomAttributesRequest = { - values: { - 'cover-count': { - orderId: '7BbXGEIWNldxAzrtGf9GPVZTwZ4F', - }, - 'table-number': { - orderId: '7BbXGEIWNldxAzrtGf9GPVZTwZ4F', - } - }, -}; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.bulkDeleteOrderCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Upsert Order Custom Attributes - -Creates or updates order [custom attributes](../../doc/models/custom-attribute.md) as a bulk operation. - -Use this endpoint to delete one or more custom attributes from one or more orders. -A custom attribute is based on a custom attribute definition in a Square seller account. (To create a -custom attribute definition, use the [CreateOrderCustomAttributeDefinition](../../doc/api/order-custom-attributes.md#create-order-custom-attribute-definition) endpoint.) - -This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert -requests and returns a map of individual upsert responses. Each upsert request has a unique ID -and provides an order ID and custom attribute. Each upsert response is returned with the ID -of the corresponding request. - -To create or update a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async bulkUpsertOrderCustomAttributes( - body: BulkUpsertOrderCustomAttributesRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkUpsertOrderCustomAttributesRequest`](../../doc/models/bulk-upsert-order-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkUpsertOrderCustomAttributesResponse`](../../doc/models/bulk-upsert-order-custom-attributes-response.md) - -## Example Usage - -```ts -const body: BulkUpsertOrderCustomAttributesRequest = { - values: { - 'key0': { - customAttribute: { - }, - orderId: 'order_id4', - }, - 'key1': { - customAttribute: { - }, - orderId: 'order_id4', - } - }, -}; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.bulkUpsertOrderCustomAttributes(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Order Custom Attributes - -Lists the [custom attributes](../../doc/models/custom-attribute.md) associated with an order. - -You can use the `with_definitions` query parameter to also retrieve custom attribute definitions -in the same call. - -When all response pages are retrieved, the results include all custom attributes that are -visible to the requesting application, including those that are owned by other applications -and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async listOrderCustomAttributes( - orderId: string, - visibilityFilter?: string, - cursor?: string, - limit?: number, - withDefinitions?: boolean, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | The ID of the target [order](entity:Order). | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Query, Optional | Requests that all of the custom attributes be returned, or only those that are read-only or read-write. | -| `cursor` | `string \| undefined` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `withDefinitions` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListOrderCustomAttributesResponse`](../../doc/models/list-order-custom-attributes-response.md) - -## Example Usage - -```ts -const orderId = 'order_id6'; - -const withDefinitions = false; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.listOrderCustomAttributes( - orderId, - undefined, - undefined, - undefined, - withDefinitions -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Order Custom Attribute - -Deletes a [custom attribute](../../doc/models/custom-attribute.md) associated with a customer profile. - -To delete a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async deleteOrderCustomAttribute( - orderId: string, - customAttributeKey: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | The ID of the target [order](entity:Order). | -| `customAttributeKey` | `string` | Template, Required | The key of the custom attribute to delete. This key must match the key of an
existing custom attribute definition. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteOrderCustomAttributeResponse`](../../doc/models/delete-order-custom-attribute-response.md) - -## Example Usage - -```ts -const orderId = 'order_id6'; - -const customAttributeKey = 'custom_attribute_key2'; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.deleteOrderCustomAttribute( - orderId, - customAttributeKey -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Order Custom Attribute - -Retrieves a [custom attribute](../../doc/models/custom-attribute.md) associated with an order. - -You can use the `with_definition` query parameter to also retrieve the custom attribute definition -in the same call. - -To retrieve a custom attribute owned by another application, the `visibility` setting must be -`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async retrieveOrderCustomAttribute( - orderId: string, - customAttributeKey: string, - version?: number, - withDefinition?: boolean, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | The ID of the target [order](entity:Order). | -| `customAttributeKey` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the key of an
existing custom attribute definition. | -| `version` | `number \| undefined` | Query, Optional | To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
control, include this optional field and specify the current version of the custom attribute. | -| `withDefinition` | `boolean \| undefined` | Query, Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
information about the data type, or other definition details. The default value is `false`.
**Default**: `false` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveOrderCustomAttributeResponse`](../../doc/models/retrieve-order-custom-attribute-response.md) - -## Example Usage - -```ts -const orderId = 'order_id6'; - -const customAttributeKey = 'custom_attribute_key2'; - -const withDefinition = false; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.retrieveOrderCustomAttribute( - orderId, - customAttributeKey, - undefined, - withDefinition -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Upsert Order Custom Attribute - -Creates or updates a [custom attribute](../../doc/models/custom-attribute.md) for an order. - -Use this endpoint to set the value of a custom attribute for a specific order. -A custom attribute is based on a custom attribute definition in a Square seller account. (To create a -custom attribute definition, use the [CreateOrderCustomAttributeDefinition](../../doc/api/order-custom-attributes.md#create-order-custom-attribute-definition) endpoint.) - -To create or update a custom attribute owned by another application, the `visibility` setting -must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes -(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - -```ts -async upsertOrderCustomAttribute( - orderId: string, - customAttributeKey: string, - body: UpsertOrderCustomAttributeRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | The ID of the target [order](entity:Order). | -| `customAttributeKey` | `string` | Template, Required | The key of the custom attribute to create or update. This key must match the key
of an existing custom attribute definition. | -| `body` | [`UpsertOrderCustomAttributeRequest`](../../doc/models/upsert-order-custom-attribute-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpsertOrderCustomAttributeResponse`](../../doc/models/upsert-order-custom-attribute-response.md) - -## Example Usage - -```ts -const orderId = 'order_id6'; - -const customAttributeKey = 'custom_attribute_key2'; - -const body: UpsertOrderCustomAttributeRequest = { - customAttribute: { - }, -}; - -try { - const { result, ...httpResponse } = await orderCustomAttributesApi.upsertOrderCustomAttribute( - orderId, - customAttributeKey, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 8e1bc1bc7..000000000 --- a/doc/api/orders.md +++ /dev/null @@ -1,539 +0,0 @@ -# Orders - -```ts -const ordersApi = client.ordersApi; -``` - -## Class Name - -`OrdersApi` - -## Methods - -* [Create Order](../../doc/api/orders.md#create-order) -* [Batch Retrieve Orders](../../doc/api/orders.md#batch-retrieve-orders) -* [Calculate Order](../../doc/api/orders.md#calculate-order) -* [Clone Order](../../doc/api/orders.md#clone-order) -* [Search Orders](../../doc/api/orders.md#search-orders) -* [Retrieve Order](../../doc/api/orders.md#retrieve-order) -* [Update Order](../../doc/api/orders.md#update-order) -* [Pay Order](../../doc/api/orders.md#pay-order) - - -# Create Order - -Creates a new [order](../../doc/models/order.md) that can include information about products for -purchase and settings to apply to the purchase. - -To pay for a created order, see -[Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). - -You can modify open orders using the [UpdateOrder](../../doc/api/orders.md#update-order) endpoint. - -```ts -async createOrder( - body: CreateOrderRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateOrderRequest`](../../doc/models/create-order-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateOrderResponse`](../../doc/models/create-order-response.md) - -## Example Usage - -```ts -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', -}; - -try { - const { result, ...httpResponse } = await ordersApi.createOrder(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Batch Retrieve Orders - -Retrieves a set of [orders](../../doc/models/order.md) by their IDs. - -If a given order ID does not exist, the ID is ignored instead of generating an error. - -```ts -async batchRetrieveOrders( - body: BatchRetrieveOrdersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BatchRetrieveOrdersRequest`](../../doc/models/batch-retrieve-orders-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BatchRetrieveOrdersResponse`](../../doc/models/batch-retrieve-orders-response.md) - -## Example Usage - -```ts -const body: BatchRetrieveOrdersRequest = { - orderIds: [ - 'CAISEM82RcpmcFBM0TfOyiHV3es', - 'CAISENgvlJ6jLWAzERDzjyHVybY' - ], - locationId: '057P5VYJ4A5X1', -}; - -try { - const { result, ...httpResponse } = await ordersApi.batchRetrieveOrders(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Calculate Order - -Enables applications to preview order pricing without creating an order. - -```ts -async calculateOrder( - body: CalculateOrderRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CalculateOrderRequest`](../../doc/models/calculate-order-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CalculateOrderResponse`](../../doc/models/calculate-order-response.md) - -## Example Usage - -```ts -const body: CalculateOrderRequest = { - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Clone Order - -Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has -only the core fields (such as line items, taxes, and discounts) copied from the original order. - -```ts -async cloneOrder( - body: CloneOrderRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CloneOrderRequest`](../../doc/models/clone-order-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CloneOrderResponse`](../../doc/models/clone-order-response.md) - -## Example Usage - -```ts -const body: CloneOrderRequest = { - orderId: 'ZAISEM52YcpmcWAzERDOyiWS123', - version: 3, - idempotencyKey: 'UNIQUE_STRING', -}; - -try { - const { result, ...httpResponse } = await ordersApi.cloneOrder(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Orders - -Search all orders for one or more locations. Orders include all sales, -returns, and exchanges regardless of how or when they entered the Square -ecosystem (such as Point of Sale, Invoices, and Connect APIs). - -`SearchOrders` requests need to specify which locations to search and define a -[SearchOrdersQuery](../../doc/models/search-orders-query.md) object that controls -how to sort or filter the results. Your `SearchOrdersQuery` can: - -Set filter criteria. -Set the sort order. -Determine whether to return results as complete `Order` objects or as -[OrderEntry](../../doc/models/order-entry.md) objects. - -Note that details for orders processed with Square Point of Sale while in -offline mode might not be transmitted to Square for up to 72 hours. Offline -orders have a `created_at` value that reflects the time the order was created, -not the time it was subsequently transmitted to Square. - -```ts -async searchOrders( - body: SearchOrdersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchOrdersRequest`](../../doc/models/search-orders-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchOrdersResponse`](../../doc/models/search-orders-response.md) - -## Example Usage - -```ts -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, -}; - -try { - const { result, ...httpResponse } = await ordersApi.searchOrders(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Order - -Retrieves an [Order](../../doc/models/order.md) by ID. - -```ts -async retrieveOrder( - orderId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | The ID of the order to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveOrderResponse`](../../doc/models/retrieve-order-response.md) - -## Example Usage - -```ts -const orderId = 'order_id6'; - -try { - const { result, ...httpResponse } = await ordersApi.retrieveOrder(orderId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Order - -Updates an open [order](../../doc/models/order.md) by adding, replacing, or deleting -fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. - -An `UpdateOrder` request requires the following: - -- The `order_id` in the endpoint path, identifying the order to update. -- The latest `version` of the order to update. -- The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects) - containing only the fields to update and the version to which the update is - being applied. -- If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete) - identifying the fields to clear. - -To pay for an order, see -[Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). - -```ts -async updateOrder( - orderId: string, - body: UpdateOrderRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | The ID of the order to update. | -| `body` | [`UpdateOrderRequest`](../../doc/models/update-order-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateOrderResponse`](../../doc/models/update-order-response.md) - -## Example Usage - -```ts -const orderId = 'order_id6'; - -const body: UpdateOrderRequest = { -}; - -try { - const { result, ...httpResponse } = await ordersApi.updateOrder( - orderId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Pay Order - -Pay for an [order](../../doc/models/order.md) using one or more approved [payments](../../doc/models/payment.md) -or settle an order with a total of `0`. - -The total of the `payment_ids` listed in the request must be equal to the order -total. Orders with a total amount of `0` can be marked as paid by specifying an empty -array of `payment_ids` in the request. - -To be used with `PayOrder`, a payment must: - -- Reference the order by specifying the `order_id` when [creating the payment](../../doc/api/payments.md#create-payment). - Any approved payments that reference the same `order_id` not specified in the - `payment_ids` is canceled. -- Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture). - Using a delayed capture payment with `PayOrder` completes the approved payment. - -```ts -async payOrder( - orderId: string, - body: PayOrderRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Template, Required | The ID of the order being paid. | -| `body` | [`PayOrderRequest`](../../doc/models/pay-order-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`PayOrderResponse`](../../doc/models/pay-order-response.md) - -## Example Usage - -```ts -const orderId = 'order_id6'; - -const body: PayOrderRequest = { - idempotencyKey: 'c043a359-7ad9-4136-82a9-c3f1d66dcbff', - paymentIds: [ - 'EnZdNAlWCmfh6Mt5FMNST1o7taB', - '0LRiVlbXVwe8ozu4KbZxd12mvaB' - ], -}; - -try { - const { result, ...httpResponse } = await ordersApi.payOrder( - orderId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 2371fce02..000000000 --- a/doc/api/payments.md +++ /dev/null @@ -1,412 +0,0 @@ -# Payments - -```ts -const paymentsApi = client.paymentsApi; -``` - -## Class Name - -`PaymentsApi` - -## Methods - -* [List Payments](../../doc/api/payments.md#list-payments) -* [Create Payment](../../doc/api/payments.md#create-payment) -* [Cancel Payment by Idempotency Key](../../doc/api/payments.md#cancel-payment-by-idempotency-key) -* [Get Payment](../../doc/api/payments.md#get-payment) -* [Update Payment](../../doc/api/payments.md#update-payment) -* [Cancel Payment](../../doc/api/payments.md#cancel-payment) -* [Complete Payment](../../doc/api/payments.md#complete-payment) - - -# List Payments - -Retrieves a list of payments taken by the account making the request. - -Results are eventually consistent, and new payments or changes to payments might take several -seconds to appear. - -The maximum results per page is 100. - -```ts -async listPayments( - beginTime?: string, - endTime?: string, - sortOrder?: string, - cursor?: string, - locationId?: string, - total?: bigint, - last4?: string, - cardBrand?: string, - limit?: number, - isOfflinePayment?: boolean, - offlineBeginTime?: string, - offlineEndTime?: string, - updatedAtBeginTime?: string, - updatedAtEndTime?: string, - sortField?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `beginTime` | `string \| undefined` | Query, Optional | Indicates the start of the time range to retrieve payments for, in RFC 3339 format.
The range is determined using the `created_at` field for each Payment.
Inclusive. Default: The current time minus one year. | -| `endTime` | `string \| undefined` | Query, Optional | Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
range is determined using the `created_at` field for each Payment.

Default: The current time. | -| `sortOrder` | `string \| undefined` | Query, Optional | The order in which results are listed by `ListPaymentsRequest.sort_field`:

- `ASC` - Oldest to newest.
- `DESC` - Newest to oldest (default). | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `locationId` | `string \| undefined` | Query, Optional | Limit results to the location supplied. By default, results are returned
for the default (main) location associated with the seller. | -| `total` | `bigint \| undefined` | Query, Optional | The exact amount in the `total_money` for a payment. | -| `last4` | `string \| undefined` | Query, Optional | The last four digits of a payment card. | -| `cardBrand` | `string \| undefined` | Query, Optional | The brand of the payment card (for example, VISA). | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.

The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.

Default: `100` | -| `isOfflinePayment` | `boolean \| undefined` | Query, Optional | Whether the payment was taken offline or not.
**Default**: `false` | -| `offlineBeginTime` | `string \| undefined` | Query, Optional | Indicates the start of the time range for which to retrieve offline payments, in RFC 3339
format for timestamps. The range is determined using the
`offline_payment_details.client_created_at` field for each Payment. If set, payments without a
value set in `offline_payment_details.client_created_at` will not be returned.

Default: The current time. | -| `offlineEndTime` | `string \| undefined` | Query, Optional | Indicates the end of the time range for which to retrieve offline payments, in RFC 3339
format for timestamps. The range is determined using the
`offline_payment_details.client_created_at` field for each Payment. If set, payments without a
value set in `offline_payment_details.client_created_at` will not be returned.

Default: The current time. | -| `updatedAtBeginTime` | `string \| undefined` | Query, Optional | Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The
range is determined using the `updated_at` field for each Payment. | -| `updatedAtEndTime` | `string \| undefined` | Query, Optional | Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
range is determined using the `updated_at` field for each Payment. | -| `sortField` | [`string \| undefined`](../../doc/models/payment-sort-field.md) | Query, Optional | The field used to sort results by. The default is `CREATED_AT`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListPaymentsResponse`](../../doc/models/list-payments-response.md) - -## Example Usage - -```ts -const isOfflinePayment = false; - -try { - const { result, ...httpResponse } = await paymentsApi.listPayments( - undefined, - undefined, - undefined, - undefined, - undefined, - undefined, - undefined, - undefined, - undefined, - isOfflinePayment -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Payment - -Creates a payment using the provided source. You can use this endpoint -to charge a card (credit/debit card or -Square gift card) or record a payment that the seller received outside of Square -(cash payment from a buyer or a payment that an external entity -processed on behalf of the seller). - -The endpoint creates a -`Payment` object and returns it in the response. - -```ts -async createPayment( - body: CreatePaymentRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreatePaymentRequest`](../../doc/models/create-payment-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreatePaymentResponse`](../../doc/models/create-payment-response.md) - -## Example Usage - -```ts -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', -}; - -try { - const { result, ...httpResponse } = await paymentsApi.createPayment(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Payment by Idempotency Key - -Cancels (voids) a payment identified by the idempotency key that is specified in the -request. - -Use this method when the status of a `CreatePayment` request is unknown (for example, after you send a -`CreatePayment` request, a network error occurs and you do not get a response). In this case, you can -direct Square to cancel the payment using this endpoint. In the request, you provide the same -idempotency key that you provided in your `CreatePayment` request that you want to cancel. After -canceling the payment, you can submit your `CreatePayment` request again. - -Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint -returns successfully. - -```ts -async cancelPaymentByIdempotencyKey( - body: CancelPaymentByIdempotencyKeyRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CancelPaymentByIdempotencyKeyRequest`](../../doc/models/cancel-payment-by-idempotency-key-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelPaymentByIdempotencyKeyResponse`](../../doc/models/cancel-payment-by-idempotency-key-response.md) - -## Example Usage - -```ts -const body: CancelPaymentByIdempotencyKeyRequest = { - idempotencyKey: 'a7e36d40-d24b-11e8-b568-0800200c9a66', -}; - -try { - const { result, ...httpResponse } = await paymentsApi.cancelPaymentByIdempotencyKey(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Payment - -Retrieves details for a specific payment. - -```ts -async getPayment( - paymentId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string` | Template, Required | A unique ID for the desired payment. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetPaymentResponse`](../../doc/models/get-payment-response.md) - -## Example Usage - -```ts -const paymentId = 'payment_id0'; - -try { - const { result, ...httpResponse } = await paymentsApi.getPayment(paymentId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Payment - -Updates a payment with the APPROVED status. -You can update the `amount_money` and `tip_money` using this endpoint. - -```ts -async updatePayment( - paymentId: string, - body: UpdatePaymentRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string` | Template, Required | The ID of the payment to update. | -| `body` | [`UpdatePaymentRequest`](../../doc/models/update-payment-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdatePaymentResponse`](../../doc/models/update-payment-response.md) - -## Example Usage - -```ts -const paymentId = 'payment_id0'; - -const body: UpdatePaymentRequest = { - idempotencyKey: '956f8b13-e4ec-45d6-85e8-d1d95ef0c5de', - payment: { - amountMoney: { - amount: BigInt(1000), - currency: 'USD', - }, - tipMoney: { - amount: BigInt(100), - currency: 'USD', - }, - versionToken: 'ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o', - }, -}; - -try { - const { result, ...httpResponse } = await paymentsApi.updatePayment( - paymentId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Payment - -Cancels (voids) a payment. You can use this endpoint to cancel a payment with -the APPROVED `status`. - -```ts -async cancelPayment( - paymentId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string` | Template, Required | The ID of the payment to cancel. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelPaymentResponse`](../../doc/models/cancel-payment-response.md) - -## Example Usage - -```ts -const paymentId = 'payment_id0'; - -try { - const { result, ...httpResponse } = await paymentsApi.cancelPayment(paymentId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Complete Payment - -Completes (captures) a payment. -By default, payments are set to complete immediately after they are created. - -You can use this endpoint to complete a payment with the APPROVED `status`. - -```ts -async completePayment( - paymentId: string, - body: CompletePaymentRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string` | Template, Required | The unique ID identifying the payment to be completed. | -| `body` | [`CompletePaymentRequest`](../../doc/models/complete-payment-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CompletePaymentResponse`](../../doc/models/complete-payment-response.md) - -## Example Usage - -```ts -const paymentId = 'payment_id0'; - -const body: CompletePaymentRequest = { -}; - -try { - const { result, ...httpResponse } = await paymentsApi.completePayment( - paymentId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index dc33df5d1..000000000 --- a/doc/api/payouts.md +++ /dev/null @@ -1,156 +0,0 @@ -# Payouts - -```ts -const payoutsApi = client.payoutsApi; -``` - -## Class Name - -`PayoutsApi` - -## Methods - -* [List Payouts](../../doc/api/payouts.md#list-payouts) -* [Get Payout](../../doc/api/payouts.md#get-payout) -* [List Payout Entries](../../doc/api/payouts.md#list-payout-entries) - - -# List Payouts - -Retrieves a list of all payouts for the default location. -You can filter payouts by location ID, status, time range, and order them in ascending or descending order. -To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. - -```ts -async listPayouts( - locationId?: string, - status?: string, - beginTime?: string, - endTime?: string, - sortOrder?: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| undefined` | Query, Optional | The ID of the location for which to list the payouts.
By default, payouts are returned for the default (main) location associated with the seller. | -| `status` | [`string \| undefined`](../../doc/models/payout-status.md) | Query, Optional | If provided, only payouts with the given status are returned. | -| `beginTime` | `string \| undefined` | Query, Optional | The timestamp for the beginning of the payout creation time, in RFC 3339 format.
Inclusive. Default: The current time minus one year. | -| `endTime` | `string \| undefined` | Query, Optional | The timestamp for the end of the payout creation time, in RFC 3339 format.
Default: The current time. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | The order in which payouts are listed. | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
If request parameters change between requests, subsequent results may contain duplicates or missing records. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.
Default: `100` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListPayoutsResponse`](../../doc/models/list-payouts-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await payoutsApi.listPayouts(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Payout - -Retrieves details of a specific payout identified by a payout ID. -To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. - -```ts -async getPayout( - payoutId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `payoutId` | `string` | Template, Required | The ID of the payout to retrieve the information for. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetPayoutResponse`](../../doc/models/get-payout-response.md) - -## Example Usage - -```ts -const payoutId = 'payout_id6'; - -try { - const { result, ...httpResponse } = await payoutsApi.getPayout(payoutId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Payout Entries - -Retrieves a list of all payout entries for a specific payout. -To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. - -```ts -async listPayoutEntries( - payoutId: string, - sortOrder?: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `payoutId` | `string` | Template, Required | The ID of the payout to retrieve the information for. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | The order in which payout entries are listed. | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
If request parameters change between requests, subsequent results may contain duplicates or missing records. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.
Default: `100` | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListPayoutEntriesResponse`](../../doc/models/list-payout-entries-response.md) - -## Example Usage - -```ts -const payoutId = 'payout_id6'; - -try { - const { result, ...httpResponse } = await payoutsApi.listPayoutEntries(payoutId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 6109deaec..000000000 --- a/doc/api/refunds.md +++ /dev/null @@ -1,168 +0,0 @@ -# Refunds - -```ts -const refundsApi = client.refundsApi; -``` - -## Class Name - -`RefundsApi` - -## Methods - -* [List Payment Refunds](../../doc/api/refunds.md#list-payment-refunds) -* [Refund Payment](../../doc/api/refunds.md#refund-payment) -* [Get Payment Refund](../../doc/api/refunds.md#get-payment-refund) - - -# List Payment Refunds - -Retrieves a list of refunds for the account making the request. - -Results are eventually consistent, and new refunds or changes to refunds might take several -seconds to appear. - -The maximum results per page is 100. - -```ts -async listPaymentRefunds( - beginTime?: string, - endTime?: string, - sortOrder?: string, - cursor?: string, - locationId?: string, - status?: string, - sourceType?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `beginTime` | `string \| undefined` | Query, Optional | Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
format. The range is determined using the `created_at` field for each `PaymentRefund`.

Default: The current time minus one year. | -| `endTime` | `string \| undefined` | Query, Optional | Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
format. The range is determined using the `created_at` field for each `PaymentRefund`.

Default: The current time. | -| `sortOrder` | `string \| undefined` | Query, Optional | The order in which results are listed by `PaymentRefund.created_at`:

- `ASC` - Oldest to newest.
- `DESC` - Newest to oldest (default). | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `locationId` | `string \| undefined` | Query, Optional | Limit results to the location supplied. By default, results are returned
for all locations associated with the seller. | -| `status` | `string \| undefined` | Query, Optional | If provided, only refunds with the given status are returned.
For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).

Default: If omitted, refunds are returned regardless of their status. | -| `sourceType` | `string \| undefined` | Query, Optional | If provided, only returns refunds whose payments have the indicated source type.
Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
For information about these payment source types, see
[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).

Default: If omitted, refunds are returned regardless of the source type. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to be returned in a single page.

It is possible to receive fewer results than the specified limit on a given page.

If the supplied value is greater than 100, no more than 100 results are returned.

Default: 100 | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListPaymentRefundsResponse`](../../doc/models/list-payment-refunds-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await refundsApi.listPaymentRefunds(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Refund Payment - -Refunds a payment. You can refund the entire payment amount or a -portion of it. You can use this endpoint to refund a card payment or record a -refund of a cash or external payment. For more information, see -[Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments). - -```ts -async refundPayment( - body: RefundPaymentRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`RefundPaymentRequest`](../../doc/models/refund-payment-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RefundPaymentResponse`](../../doc/models/refund-payment-response.md) - -## Example Usage - -```ts -const body: RefundPaymentRequest = { - idempotencyKey: '9b7f2dcf-49da-4411-b23e-a2d6af21333a', - amountMoney: { - amount: BigInt(1000), - currency: 'USD', - }, - appFeeMoney: { - amount: BigInt(10), - currency: 'USD', - }, - paymentId: 'R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY', - reason: 'Example', -}; - -try { - const { result, ...httpResponse } = await refundsApi.refundPayment(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Payment Refund - -Retrieves a specific refund using the `refund_id`. - -```ts -async getPaymentRefund( - refundId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `refundId` | `string` | Template, Required | The unique ID for the desired `PaymentRefund`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetPaymentRefundResponse`](../../doc/models/get-payment-refund-response.md) - -## Example Usage - -```ts -const refundId = 'refund_id4'; - -try { - const { result, ...httpResponse } = await refundsApi.getPaymentRefund(refundId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index f72f32349..000000000 --- a/doc/api/sites.md +++ /dev/null @@ -1,48 +0,0 @@ -# Sites - -```ts -const sitesApi = client.sitesApi; -``` - -## Class Name - -`SitesApi` - - -# List Sites - -Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date. - -__Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). - -```ts -async listSites( - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListSitesResponse`](../../doc/models/list-sites-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await sitesApi.listSites(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index a05b73db7..000000000 --- a/doc/api/snippets.md +++ /dev/null @@ -1,160 +0,0 @@ -# Snippets - -```ts -const snippetsApi = client.snippetsApi; -``` - -## Class Name - -`SnippetsApi` - -## Methods - -* [Delete Snippet](../../doc/api/snippets.md#delete-snippet) -* [Retrieve Snippet](../../doc/api/snippets.md#retrieve-snippet) -* [Upsert Snippet](../../doc/api/snippets.md#upsert-snippet) - - -# Delete Snippet - -Removes your snippet from a Square Online site. - -You can call [ListSites](../../doc/api/sites.md#list-sites) to get the IDs of the sites that belong to a seller. - -__Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). - -```ts -async deleteSnippet( - siteId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `siteId` | `string` | Template, Required | The ID of the site that contains the snippet. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteSnippetResponse`](../../doc/models/delete-snippet-response.md) - -## Example Usage - -```ts -const siteId = 'site_id6'; - -try { - const { result, ...httpResponse } = await snippetsApi.deleteSnippet(siteId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Snippet - -Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application. - -You can call [ListSites](../../doc/api/sites.md#list-sites) to get the IDs of the sites that belong to a seller. - -__Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). - -```ts -async retrieveSnippet( - siteId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `siteId` | `string` | Template, Required | The ID of the site that contains the snippet. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveSnippetResponse`](../../doc/models/retrieve-snippet-response.md) - -## Example Usage - -```ts -const siteId = 'site_id6'; - -try { - const { result, ...httpResponse } = await snippetsApi.retrieveSnippet(siteId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Upsert Snippet - -Adds a snippet to a Square Online site or updates the existing snippet on the site. -The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site. - -You can call [ListSites](../../doc/api/sites.md#list-sites) to get the IDs of the sites that belong to a seller. - -__Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). - -```ts -async upsertSnippet( - siteId: string, - body: UpsertSnippetRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `siteId` | `string` | Template, Required | The ID of the site where you want to add or update the snippet. | -| `body` | [`UpsertSnippetRequest`](../../doc/models/upsert-snippet-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpsertSnippetResponse`](../../doc/models/upsert-snippet-response.md) - -## Example Usage - -```ts -const siteId = 'site_id6'; - -const body: UpsertSnippetRequest = { - snippet: { - content: '', - }, -}; - -try { - const { result, ...httpResponse } = await snippetsApi.upsertSnippet( - siteId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 85cca5654..000000000 --- a/doc/api/subscriptions.md +++ /dev/null @@ -1,631 +0,0 @@ -# Subscriptions - -```ts -const subscriptionsApi = client.subscriptionsApi; -``` - -## Class Name - -`SubscriptionsApi` - -## Methods - -* [Create Subscription](../../doc/api/subscriptions.md#create-subscription) -* [Bulk Swap Plan](../../doc/api/subscriptions.md#bulk-swap-plan) -* [Search Subscriptions](../../doc/api/subscriptions.md#search-subscriptions) -* [Retrieve Subscription](../../doc/api/subscriptions.md#retrieve-subscription) -* [Update Subscription](../../doc/api/subscriptions.md#update-subscription) -* [Delete Subscription Action](../../doc/api/subscriptions.md#delete-subscription-action) -* [Change Billing Anchor Date](../../doc/api/subscriptions.md#change-billing-anchor-date) -* [Cancel Subscription](../../doc/api/subscriptions.md#cancel-subscription) -* [List Subscription Events](../../doc/api/subscriptions.md#list-subscription-events) -* [Pause Subscription](../../doc/api/subscriptions.md#pause-subscription) -* [Resume Subscription](../../doc/api/subscriptions.md#resume-subscription) -* [Swap Plan](../../doc/api/subscriptions.md#swap-plan) - - -# Create Subscription - -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 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, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateSubscriptionRequest`](../../doc/models/create-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateSubscriptionResponse`](../../doc/models/create-subscription-response.md) - -## Example Usage - -```ts -const body: CreateSubscriptionRequest = { - locationId: 'S8GWD5R9QB376', - customerId: 'CHFGVKYY8RSV93M5KCYTG4PN0G', - idempotencyKey: '8193148c-9586-11e6-99f9-28cfe92138cf', - planVariationId: '6JHXF3B2CW3YKHDV4XEM674H', - startDate: '2023-06-20', - cardId: 'ccof:qy5x8hHGYsgLrp4Q4GB', - timezone: 'America/Los_Angeles', - source: { - name: 'My Application', - }, - phases: [ - { - ordinal: BigInt(0), - orderTemplateId: 'U2NaowWxzXwpsZU697x7ZHOAnCNZY', - } - ], -}; - -try { - const { result, ...httpResponse } = await subscriptionsApi.createSubscription(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Swap Plan - -Schedules a plan variation change for all active subscriptions under a given plan -variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations). - -```ts -async bulkSwapPlan( - body: BulkSwapPlanRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkSwapPlanRequest`](../../doc/models/bulk-swap-plan-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkSwapPlanResponse`](../../doc/models/bulk-swap-plan-response.md) - -## Example Usage - -```ts -const body: BulkSwapPlanRequest = { - newPlanVariationId: 'FQ7CDXXWSLUJRPM3GFJSJGZ7', - oldPlanVariationId: '6JHXF3B2CW3YKHDV4XEM674H', - locationId: 'S8GWD5R9QB376', -}; - -try { - const { result, ...httpResponse } = await subscriptionsApi.bulkSwapPlan(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Subscriptions - -Searches for subscriptions. - -Results are ordered chronologically by subscription creation date. If -the request specifies more than one location ID, -the endpoint orders the result -by location ID, and then by creation date within each location. If no locations are given -in the query, all locations are searched. - -You can also optionally specify `customer_ids` to search by customer. -If left unset, all customers -associated with the specified locations are returned. -If the request specifies customer IDs, the endpoint orders results -first by location, within location by customer ID, and within -customer by subscription creation date. - -```ts -async searchSubscriptions( - body: SearchSubscriptionsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchSubscriptionsRequest`](../../doc/models/search-subscriptions-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchSubscriptionsResponse`](../../doc/models/search-subscriptions-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Subscription - -Retrieves a specific subscription. - -```ts -async retrieveSubscription( - subscriptionId: string, - include?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The ID of the subscription to retrieve. | -| `include` | `string \| undefined` | Query, Optional | A query parameter to specify related information to be included in the response.

The supported query parameter values are:

- `actions`: to include scheduled actions on the targeted subscription. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveSubscriptionResponse`](../../doc/models/retrieve-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -try { - const { result, ...httpResponse } = await subscriptionsApi.retrieveSubscription(subscriptionId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Subscription - -Updates a subscription by modifying or clearing `subscription` field values. -To clear a field, set its value to `null`. - -```ts -async updateSubscription( - subscriptionId: string, - body: UpdateSubscriptionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The ID of the subscription to update. | -| `body` | [`UpdateSubscriptionRequest`](../../doc/models/update-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateSubscriptionResponse`](../../doc/models/update-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const body: UpdateSubscriptionRequest = { - subscription: { - canceledDate: 'canceled_date6', - cardId: '{NEW CARD ID}', - }, -}; - -try { - const { result, ...httpResponse } = await subscriptionsApi.updateSubscription( - subscriptionId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Subscription Action - -Deletes a scheduled action for a subscription. - -```ts -async deleteSubscriptionAction( - subscriptionId: string, - actionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The ID of the subscription the targeted action is to act upon. | -| `actionId` | `string` | Template, Required | The ID of the targeted action to be deleted. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteSubscriptionActionResponse`](../../doc/models/delete-subscription-action-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const actionId = 'action_id6'; - -try { - const { result, ...httpResponse } = await subscriptionsApi.deleteSubscriptionAction( - subscriptionId, - actionId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Change Billing Anchor Date - -Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates) -for a subscription. - -```ts -async changeBillingAnchorDate( - subscriptionId: string, - body: ChangeBillingAnchorDateRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The ID of the subscription to update the billing anchor date. | -| `body` | [`ChangeBillingAnchorDateRequest`](../../doc/models/change-billing-anchor-date-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ChangeBillingAnchorDateResponse`](../../doc/models/change-billing-anchor-date-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const body: ChangeBillingAnchorDateRequest = { - monthlyBillingAnchorDate: 1, -}; - -try { - const { result, ...httpResponse } = await subscriptionsApi.changeBillingAnchorDate( - subscriptionId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Subscription - -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( - subscriptionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The ID of the subscription to cancel. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelSubscriptionResponse`](../../doc/models/cancel-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -try { - const { result, ...httpResponse } = await subscriptionsApi.cancelSubscription(subscriptionId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Subscription Events - -Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription. - -```ts -async listSubscriptionEvents( - subscriptionId: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| 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/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. | - -## Response Type - -[`ListSubscriptionEventsResponse`](../../doc/models/list-subscription-events-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -try { - const { result, ...httpResponse } = await subscriptionsApi.listSubscriptionEvents(subscriptionId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Pause Subscription - -Schedules a `PAUSE` action to pause an active subscription. - -```ts -async pauseSubscription( - subscriptionId: string, - body: PauseSubscriptionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The ID of the subscription to pause. | -| `body` | [`PauseSubscriptionRequest`](../../doc/models/pause-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`PauseSubscriptionResponse`](../../doc/models/pause-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const body: PauseSubscriptionRequest = { -}; - -try { - const { result, ...httpResponse } = await subscriptionsApi.pauseSubscription( - subscriptionId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Resume Subscription - -Schedules a `RESUME` action to resume a paused or a deactivated subscription. - -```ts -async resumeSubscription( - subscriptionId: string, - body: ResumeSubscriptionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The ID of the subscription to resume. | -| `body` | [`ResumeSubscriptionRequest`](../../doc/models/resume-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ResumeSubscriptionResponse`](../../doc/models/resume-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const body: ResumeSubscriptionRequest = { -}; - -try { - const { result, ...httpResponse } = await subscriptionsApi.resumeSubscription( - subscriptionId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Swap Plan - -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( - subscriptionId: string, - body: SwapPlanRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | The ID of the subscription to swap the subscription plan for. | -| `body` | [`SwapPlanRequest`](../../doc/models/swap-plan-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SwapPlanResponse`](../../doc/models/swap-plan-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const body: SwapPlanRequest = { - newPlanVariationId: 'FQ7CDXXWSLUJRPM3GFJSJGZ7', - phases: [ - { - ordinal: BigInt(0), - orderTemplateId: 'uhhnjH9osVv3shUADwaC0b3hNxQZY', - } - ], -}; - -try { - const { result, ...httpResponse } = await subscriptionsApi.swapPlan( - subscriptionId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 3e2df88e0..000000000 --- a/doc/api/team.md +++ /dev/null @@ -1,721 +0,0 @@ -# Team - -```ts -const teamApi = client.teamApi; -``` - -## Class Name - -`TeamApi` - -## Methods - -* [Create Team Member](../../doc/api/team.md#create-team-member) -* [Bulk Create Team Members](../../doc/api/team.md#bulk-create-team-members) -* [Bulk Update Team Members](../../doc/api/team.md#bulk-update-team-members) -* [List Jobs](../../doc/api/team.md#list-jobs) -* [Create Job](../../doc/api/team.md#create-job) -* [Retrieve Job](../../doc/api/team.md#retrieve-job) -* [Update Job](../../doc/api/team.md#update-job) -* [Search Team Members](../../doc/api/team.md#search-team-members) -* [Retrieve Team Member](../../doc/api/team.md#retrieve-team-member) -* [Update Team Member](../../doc/api/team.md#update-team-member) -* [Retrieve Wage Setting](../../doc/api/team.md#retrieve-wage-setting) -* [Update Wage Setting](../../doc/api/team.md#update-wage-setting) - - -# Create Team Member - -Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates. -You must provide the following values in your request to this endpoint: - -- `given_name` -- `family_name` - -Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteammember). - -```ts -async createTeamMember( - body: CreateTeamMemberRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateTeamMemberRequest`](../../doc/models/create-team-member-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateTeamMemberResponse`](../../doc/models/create-team-member-response.md) - -## Example Usage - -```ts -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' - ], - }, - wageSetting: { - jobAssignments: [ - { - payType: 'SALARY', - annualRate: { - amount: BigInt(3000000), - currency: 'USD', - }, - weeklyHours: 40, - jobId: 'FjS8x95cqHiMenw4f1NAUH4P', - }, - { - payType: 'HOURLY', - hourlyRate: { - amount: BigInt(2000), - currency: 'USD', - }, - jobId: 'VDNpRv8da51NU8qZFC5zDWpF', - } - ], - isOvertimeExempt: true, - }, - }, -}; - -try { - const { result, ...httpResponse } = await teamApi.createTeamMember(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Create Team Members - -Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful creates. -This process is non-transactional and processes as much of the request as possible. If one of the creates in -the request cannot be successfully processed, the request is not marked as failed, but the body of the response -contains explicit error information for the failed create. - -Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-team-members). - -```ts -async bulkCreateTeamMembers( - body: BulkCreateTeamMembersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkCreateTeamMembersRequest`](../../doc/models/bulk-create-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkCreateTeamMembersResponse`](../../doc/models/bulk-create-team-members-response.md) - -## Example Usage - -```ts -const body: BulkCreateTeamMembersRequest = { - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Update Team Members - -Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates. -This process is non-transactional and processes as much of the request as possible. If one of the updates in -the request cannot be successfully processed, the request is not marked as failed, but the body of the response -contains explicit error information for the failed update. -Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members). - -```ts -async bulkUpdateTeamMembers( - body: BulkUpdateTeamMembersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkUpdateTeamMembersRequest`](../../doc/models/bulk-update-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkUpdateTeamMembersResponse`](../../doc/models/bulk-update-team-members-response.md) - -## Example Usage - -```ts -const body: BulkUpdateTeamMembersRequest = { - teamMembers: { - 'AFMwA08kR-MIF-3Vs0OE': { - teamMember: { - referenceId: 'reference_id_2', - 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', - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Jobs - -Lists jobs in a seller account. Results are sorted by title in ascending order. - -```ts -async listJobs( - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | The pagination cursor returned by the previous call to this endpoint. Provide this
cursor to retrieve the next page of results for your original request. For more information,
see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListJobsResponse`](../../doc/models/list-jobs-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await teamApi.listJobs(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Job - -Creates a job in a seller account. A job defines a title and tip eligibility. Note that -compensation is defined in a [job assignment](../../doc/models/job-assignment.md) in a team member's wage setting. - -```ts -async createJob( - body: CreateJobRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateJobRequest`](../../doc/models/create-job-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateJobResponse`](../../doc/models/create-job-response.md) - -## Example Usage - -```ts -const body: CreateJobRequest = { - job: { - title: 'Cashier', - isTipEligible: true, - }, - idempotencyKey: 'idempotency-key-0', -}; - -try { - const { result, ...httpResponse } = await teamApi.createJob(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Job - -Retrieves a specified job. - -```ts -async retrieveJob( - jobId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `jobId` | `string` | Template, Required | The ID of the job to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveJobResponse`](../../doc/models/retrieve-job-response.md) - -## Example Usage - -```ts -const jobId = 'job_id2'; - -try { - const { result, ...httpResponse } = await teamApi.retrieveJob(jobId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Job - -Updates the title or tip eligibility of a job. Changes to the title propagate to all -`JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to -tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID. - -```ts -async updateJob( - jobId: string, - body: UpdateJobRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `jobId` | `string` | Template, Required | The ID of the job to update. | -| `body` | [`UpdateJobRequest`](../../doc/models/update-job-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateJobResponse`](../../doc/models/update-job-response.md) - -## Example Usage - -```ts -const jobId = 'job_id2'; - -const body: UpdateJobRequest = { - job: { - title: 'Cashier 1', - isTipEligible: true, - }, -}; - -try { - const { result, ...httpResponse } = await teamApi.updateJob( - jobId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Team Members - -Returns a paginated list of `TeamMember` objects for a business. -The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether -the team member is the Square account owner. - -```ts -async searchTeamMembers( - body: SearchTeamMembersRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchTeamMembersRequest`](../../doc/models/search-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchTeamMembersResponse`](../../doc/models/search-team-members-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Team Member - -Retrieves a `TeamMember` object for the given `TeamMember.id`. -Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member). - -```ts -async retrieveTeamMember( - teamMemberId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string` | Template, Required | The ID of the team member to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveTeamMemberResponse`](../../doc/models/retrieve-team-member-response.md) - -## Example Usage - -```ts -const teamMemberId = 'team_member_id0'; - -try { - const { result, ...httpResponse } = await teamApi.retrieveTeamMember(teamMemberId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Team Member - -Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates. -Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member). - -```ts -async updateTeamMember( - teamMemberId: string, - body: UpdateTeamMemberRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string` | Template, Required | The ID of the team member to update. | -| `body` | [`UpdateTeamMemberRequest`](../../doc/models/update-team-member-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateTeamMemberResponse`](../../doc/models/update-team-member-response.md) - -## Example Usage - -```ts -const teamMemberId = 'team_member_id0'; - -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 -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Wage Setting - -Retrieves a `WageSetting` object for a team member specified -by `TeamMember.id`. For more information, see -[Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrievewagesetting). - -Square recommends using [RetrieveTeamMember](../../doc/api/team.md#retrieve-team-member) or [SearchTeamMembers](../../doc/api/team.md#search-team-members) -to get this information directly from the `TeamMember.wage_setting` field. - -```ts -async retrieveWageSetting( - teamMemberId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string` | Template, Required | The ID of the team member for which to retrieve the wage setting. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveWageSettingResponse`](../../doc/models/retrieve-wage-setting-response.md) - -## Example Usage - -```ts -const teamMemberId = 'team_member_id0'; - -try { - const { result, ...httpResponse } = await teamApi.retrieveWageSetting(teamMemberId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Wage Setting - -Creates or updates a `WageSetting` object. The object is created if a -`WageSetting` with the specified `team_member_id` doesn't exist. Otherwise, -it fully replaces the `WageSetting` object for the team member. -The `WageSetting` is returned on a successful update. For more information, see -[Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting). - -Square recommends using [CreateTeamMember](../../doc/api/team.md#create-team-member) or [UpdateTeamMember](../../doc/api/team.md#update-team-member) -to manage the `TeamMember.wage_setting` field directly. - -```ts -async updateWageSetting( - teamMemberId: string, - body: UpdateWageSettingRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string` | Template, Required | The ID of the team member for which to update the `WageSetting` object. | -| `body` | [`UpdateWageSettingRequest`](../../doc/models/update-wage-setting-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateWageSettingResponse`](../../doc/models/update-wage-setting-response.md) - -## Example Usage - -```ts -const teamMemberId = 'team_member_id0'; - -const body: UpdateWageSettingRequest = { - wageSetting: { - jobAssignments: [ - { - payType: 'SALARY', - jobTitle: 'Manager', - annualRate: { - amount: BigInt(3000000), - currency: 'USD', - }, - weeklyHours: 40, - }, - { - payType: 'HOURLY', - jobTitle: 'Cashier', - hourlyRate: { - amount: BigInt(2000), - currency: 'USD', - }, - } - ], - isOvertimeExempt: true, - }, -}; - -try { - const { result, ...httpResponse } = await teamApi.updateWageSetting( - teamMemberId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index e8ccd3c0b..000000000 --- a/doc/api/terminal.md +++ /dev/null @@ -1,692 +0,0 @@ -# Terminal - -```ts -const terminalApi = client.terminalApi; -``` - -## Class Name - -`TerminalApi` - -## Methods - -* [Create Terminal Action](../../doc/api/terminal.md#create-terminal-action) -* [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) -* [Cancel Terminal Checkout](../../doc/api/terminal.md#cancel-terminal-checkout) -* [Dismiss Terminal Checkout](../../doc/api/terminal.md#dismiss-terminal-checkout) -* [Create Terminal Refund](../../doc/api/terminal.md#create-terminal-refund) -* [Search Terminal Refunds](../../doc/api/terminal.md#search-terminal-refunds) -* [Get Terminal Refund](../../doc/api/terminal.md#get-terminal-refund) -* [Cancel Terminal Refund](../../doc/api/terminal.md#cancel-terminal-refund) -* [Dismiss Terminal Refund](../../doc/api/terminal.md#dismiss-terminal-refund) - - -# Create Terminal Action - -Creates a Terminal action request and sends it to the specified device. - -```ts -async createTerminalAction( - body: CreateTerminalActionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateTerminalActionRequest`](../../doc/models/create-terminal-action-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateTerminalActionResponse`](../../doc/models/create-terminal-action-response.md) - -## Example Usage - -```ts -const body: CreateTerminalActionRequest = { - idempotencyKey: 'thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e', - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Terminal Actions - -Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. - -```ts -async searchTerminalActions( - body: SearchTerminalActionsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchTerminalActionsRequest`](../../doc/models/search-terminal-actions-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchTerminalActionsResponse`](../../doc/models/search-terminal-actions-response.md) - -## Example Usage - -```ts -const body: SearchTerminalActionsRequest = { - query: { - filter: { - createdAt: { - startAt: '2022-04-01T00:00:00.000Z', - }, - }, - sort: { - sortOrder: 'DESC', - }, - }, - limit: 2, -}; - -try { - const { result, ...httpResponse } = await terminalApi.searchTerminalActions(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Terminal Action - -Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days. - -```ts -async getTerminalAction( - actionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `actionId` | `string` | Template, Required | Unique ID for the desired `TerminalAction`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetTerminalActionResponse`](../../doc/models/get-terminal-action-response.md) - -## Example Usage - -```ts -const actionId = 'action_id6'; - -try { - const { result, ...httpResponse } = await terminalApi.getTerminalAction(actionId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Terminal Action - -Cancels a Terminal action request if the status of the request permits it. - -```ts -async cancelTerminalAction( - actionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `actionId` | `string` | Template, Required | Unique ID for the desired `TerminalAction`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelTerminalActionResponse`](../../doc/models/cancel-terminal-action-response.md) - -## Example Usage - -```ts -const actionId = 'action_id6'; - -try { - const { result, ...httpResponse } = await terminalApi.cancelTerminalAction(actionId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 action 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; - } -} -``` - - -# Create Terminal Checkout - -Creates a Terminal checkout request and sends it to the specified device to take a payment -for the requested amount. - -```ts -async createTerminalCheckout( - body: CreateTerminalCheckoutRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateTerminalCheckoutRequest`](../../doc/models/create-terminal-checkout-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateTerminalCheckoutResponse`](../../doc/models/create-terminal-checkout-response.md) - -## Example Usage - -```ts -const body: CreateTerminalCheckoutRequest = { - idempotencyKey: '28a0c3bc-7839-11ea-bc55-0242ac130003', - 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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Terminal Checkouts - -Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. - -```ts -async searchTerminalCheckouts( - body: SearchTerminalCheckoutsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchTerminalCheckoutsRequest`](../../doc/models/search-terminal-checkouts-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchTerminalCheckoutsResponse`](../../doc/models/search-terminal-checkouts-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Terminal Checkout - -Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days. - -```ts -async getTerminalCheckout( - checkoutId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `checkoutId` | `string` | Template, Required | The unique ID for the desired `TerminalCheckout`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetTerminalCheckoutResponse`](../../doc/models/get-terminal-checkout-response.md) - -## Example Usage - -```ts -const checkoutId = 'checkout_id8'; - -try { - const { result, ...httpResponse } = await terminalApi.getTerminalCheckout(checkoutId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Terminal Checkout - -Cancels a Terminal checkout request if the status of the request permits it. - -```ts -async cancelTerminalCheckout( - checkoutId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `checkoutId` | `string` | Template, Required | The unique ID for the desired `TerminalCheckout`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelTerminalCheckoutResponse`](../../doc/models/cancel-terminal-checkout-response.md) - -## Example Usage - -```ts -const checkoutId = 'checkout_id8'; - -try { - const { result, ...httpResponse } = await terminalApi.cancelTerminalCheckout(checkoutId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Dismiss Terminal Checkout - -Dismisses a Terminal checkout request if the status and type of the request permits it. - -```ts -async dismissTerminalCheckout( - checkoutId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `checkoutId` | `string` | Template, Required | Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DismissTerminalCheckoutResponse`](../../doc/models/dismiss-terminal-checkout-response.md) - -## Example Usage - -```ts -const checkoutId = 'checkout_id8'; - -try { - const { result, ...httpResponse } = await terminalApi.dismissTerminalCheckout(checkoutId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Terminal Refund - -Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](../../doc/api/refunds.md). - -```ts -async createTerminalRefund( - body: CreateTerminalRefundRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateTerminalRefundRequest`](../../doc/models/create-terminal-refund-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateTerminalRefundResponse`](../../doc/models/create-terminal-refund-response.md) - -## Example Usage - -```ts -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', - }, -}; - -try { - const { result, ...httpResponse } = await terminalApi.createTerminalRefund(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Terminal Refunds - -Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. - -```ts -async searchTerminalRefunds( - body: SearchTerminalRefundsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchTerminalRefundsRequest`](../../doc/models/search-terminal-refunds-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchTerminalRefundsResponse`](../../doc/models/search-terminal-refunds-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Get Terminal Refund - -Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days. - -```ts -async getTerminalRefund( - terminalRefundId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `terminalRefundId` | `string` | Template, Required | The unique ID for the desired `TerminalRefund`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`GetTerminalRefundResponse`](../../doc/models/get-terminal-refund-response.md) - -## Example Usage - -```ts -const terminalRefundId = 'terminal_refund_id0'; - -try { - const { result, ...httpResponse } = await terminalApi.getTerminalRefund(terminalRefundId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Cancel Terminal Refund - -Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it. - -```ts -async cancelTerminalRefund( - terminalRefundId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `terminalRefundId` | `string` | Template, Required | The unique ID for the desired `TerminalRefund`. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CancelTerminalRefundResponse`](../../doc/models/cancel-terminal-refund-response.md) - -## Example Usage - -```ts -const terminalRefundId = 'terminal_refund_id0'; - -try { - const { result, ...httpResponse } = await terminalApi.cancelTerminalRefund(terminalRefundId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Dismiss Terminal Refund - -Dismisses a Terminal refund request if the status and type of the request permits it. - -```ts -async dismissTerminalRefund( - terminalRefundId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `terminalRefundId` | `string` | Template, Required | Unique ID for the `TerminalRefund` associated with the refund to be dismissed. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DismissTerminalRefundResponse`](../../doc/models/dismiss-terminal-refund-response.md) - -## Example Usage - -```ts -const terminalRefundId = 'terminal_refund_id0'; - -try { - const { result, ...httpResponse } = await terminalApi.dismissTerminalRefund(terminalRefundId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 6f9fbbcf4..000000000 --- a/doc/api/transactions.md +++ /dev/null @@ -1,227 +0,0 @@ -# Transactions - -```ts -const transactionsApi = client.transactionsApi; -``` - -## Class Name - -`TransactionsApi` - -## Methods - -* [List Transactions](../../doc/api/transactions.md#list-transactions) -* [Retrieve Transaction](../../doc/api/transactions.md#retrieve-transaction) -* [Capture Transaction](../../doc/api/transactions.md#capture-transaction) -* [Void Transaction](../../doc/api/transactions.md#void-transaction) - - -# List Transactions - -**This endpoint is deprecated.** - -Lists transactions for a particular location. - -Transactions include payment information from sales and exchanges and refund -information from returns and exchanges. - -Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50 - -```ts -async listTransactions( - locationId: string, - beginTime?: string, - endTime?: string, - sortOrder?: string, - cursor?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location to list transactions for. | -| `beginTime` | `string \| undefined` | Query, Optional | The beginning of the requested reporting period, in RFC 3339 format.

See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.

Default value: The current time minus one year. | -| `endTime` | `string \| undefined` | Query, Optional | The end of the requested reporting period, in RFC 3339 format.

See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.

Default value: The current time. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | The order in which results are listed in the response (`ASC` for
oldest first, `DESC` for newest first).

Default value: `DESC` | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListTransactionsResponse`](../../doc/models/list-transactions-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -try { - const { result, ...httpResponse } = await transactionsApi.listTransactions(locationId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Transaction - -**This endpoint is deprecated.** - -Retrieves details for a single transaction. - -```ts -async retrieveTransaction( - locationId: string, - transactionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the transaction's associated location. | -| `transactionId` | `string` | Template, Required | The ID of the transaction to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveTransactionResponse`](../../doc/models/retrieve-transaction-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const transactionId = 'transaction_id8'; - -try { - const { result, ...httpResponse } = await transactionsApi.retrieveTransaction( - locationId, - transactionId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Capture Transaction - -**This endpoint is deprecated.** - -Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) -endpoint with a `delay_capture` value of `true`. - -See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture) -for more information. - -```ts -async captureTransaction( - locationId: string, - transactionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | - | -| `transactionId` | `string` | Template, Required | - | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CaptureTransactionResponse`](../../doc/models/capture-transaction-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const transactionId = 'transaction_id8'; - -try { - const { result, ...httpResponse } = await transactionsApi.captureTransaction( - locationId, - transactionId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Void Transaction - -**This endpoint is deprecated.** - -Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) -endpoint with a `delay_capture` value of `true`. - -See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture) -for more information. - -```ts -async voidTransaction( - locationId: string, - transactionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | - | -| `transactionId` | `string` | Template, Required | - | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`VoidTransactionResponse`](../../doc/models/void-transaction-response.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const transactionId = 'transaction_id8'; - -try { - const { result, ...httpResponse } = await transactionsApi.voidTransaction( - locationId, - transactionId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 806a95794..000000000 --- a/doc/api/v1-transactions.md +++ /dev/null @@ -1,169 +0,0 @@ -# V1 Transactions - -```ts -const v1TransactionsApi = client.v1TransactionsApi; -``` - -## Class Name - -`V1TransactionsApi` - -## Methods - -* [V1 List Orders](../../doc/api/v1-transactions.md#v1-list-orders) -* [V1 Retrieve Order](../../doc/api/v1-transactions.md#v1-retrieve-order) -* [V1 Update Order](../../doc/api/v1-transactions.md#v1-update-order) - - -# V1 List Orders - -**This endpoint is deprecated.** - -Provides summary information for a merchant's online store orders. - -```ts -async v1ListOrders( - locationId: string, - order?: string, - limit?: number, - batchToken?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the location to list online store orders for. | -| `order` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. | -| `batchToken` | `string \| undefined` | Query, Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`V1Order[]`](../../doc/models/v1-order.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -try { - const { result, ...httpResponse } = await v1TransactionsApi.v1ListOrders(locationId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# V1 Retrieve Order - -**This endpoint is deprecated.** - -Provides comprehensive information for a single online store order, including the order's history. - -```ts -async v1RetrieveOrder( - locationId: string, - orderId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the order's associated location. | -| `orderId` | `string` | Template, Required | The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`V1Order`](../../doc/models/v1-order.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const orderId = 'order_id6'; - -try { - const { result, ...httpResponse } = await v1TransactionsApi.v1RetrieveOrder( - locationId, - orderId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# V1 Update Order - -**This endpoint is deprecated.** - -Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: - -```ts -async v1UpdateOrder( - locationId: string, - orderId: string, - body: V1UpdateOrderRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Template, Required | The ID of the order's associated location. | -| `orderId` | `string` | Template, Required | The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint | -| `body` | [`V1UpdateOrderRequest`](../../doc/models/v1-update-order-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`V1Order`](../../doc/models/v1-order.md) - -## Example Usage - -```ts -const locationId = 'location_id4'; - -const orderId = 'order_id6'; - -const body: V1UpdateOrderRequest = { - action: 'REFUND', -}; - -try { - const { result, ...httpResponse } = await v1TransactionsApi.v1UpdateOrder( - locationId, - orderId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index 9d1427926..000000000 --- a/doc/api/vendors.md +++ /dev/null @@ -1,340 +0,0 @@ -# Vendors - -```ts -const vendorsApi = client.vendorsApi; -``` - -## Class Name - -`VendorsApi` - -## Methods - -* [Bulk Create Vendors](../../doc/api/vendors.md#bulk-create-vendors) -* [Bulk Retrieve Vendors](../../doc/api/vendors.md#bulk-retrieve-vendors) -* [Bulk Update Vendors](../../doc/api/vendors.md#bulk-update-vendors) -* [Create Vendor](../../doc/api/vendors.md#create-vendor) -* [Search Vendors](../../doc/api/vendors.md#search-vendors) -* [Retrieve Vendor](../../doc/api/vendors.md#retrieve-vendor) -* [Update Vendor](../../doc/api/vendors.md#update-vendor) - - -# Bulk Create Vendors - -Creates one or more [Vendor](../../doc/models/vendor.md) objects to represent suppliers to a seller. - -```ts -async bulkCreateVendors( - body: BulkCreateVendorsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkCreateVendorsRequest`](../../doc/models/bulk-create-vendors-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkCreateVendorsResponse`](../../doc/models/bulk-create-vendors-response.md) - -## Example Usage - -```ts -const body: BulkCreateVendorsRequest = { - vendors: { - 'key0': { - }, - 'key1': { - } - }, -}; - -try { - const { result, ...httpResponse } = await vendorsApi.bulkCreateVendors(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Retrieve Vendors - -Retrieves one or more vendors of specified [Vendor](../../doc/models/vendor.md) IDs. - -```ts -async bulkRetrieveVendors( - body: BulkRetrieveVendorsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkRetrieveVendorsRequest`](../../doc/models/bulk-retrieve-vendors-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkRetrieveVendorsResponse`](../../doc/models/bulk-retrieve-vendors-response.md) - -## Example Usage - -```ts -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) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Bulk Update Vendors - -Updates one or more of existing [Vendor](../../doc/models/vendor.md) objects as suppliers to a seller. - -```ts -async bulkUpdateVendors( - body: BulkUpdateVendorsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`BulkUpdateVendorsRequest`](../../doc/models/bulk-update-vendors-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`BulkUpdateVendorsResponse`](../../doc/models/bulk-update-vendors-response.md) - -## Example Usage - -```ts -const body: BulkUpdateVendorsRequest = { - vendors: { - 'key0': { - vendor: { - }, - }, - 'key1': { - vendor: { - }, - } - }, -}; - -try { - const { result, ...httpResponse } = await vendorsApi.bulkUpdateVendors(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Vendor - -Creates a single [Vendor](../../doc/models/vendor.md) object to represent a supplier to a seller. - -```ts -async createVendor( - body: CreateVendorRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateVendorRequest`](../../doc/models/create-vendor-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateVendorResponse`](../../doc/models/create-vendor-response.md) - -## Example Usage - -```ts -const body: CreateVendorRequest = { - idempotencyKey: 'idempotency_key2', -}; - -try { - const { result, ...httpResponse } = await vendorsApi.createVendor(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Search Vendors - -Searches for vendors using a filter against supported [Vendor](../../doc/models/vendor.md) properties and a supported sorter. - -```ts -async searchVendors( - body: SearchVendorsRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`SearchVendorsRequest`](../../doc/models/search-vendors-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`SearchVendorsResponse`](../../doc/models/search-vendors-response.md) - -## Example Usage - -```ts -const body: SearchVendorsRequest = { -}; - -try { - const { result, ...httpResponse } = await vendorsApi.searchVendors(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Vendor - -Retrieves the vendor of a specified [Vendor](../../doc/models/vendor.md) ID. - -```ts -async retrieveVendor( - vendorId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `vendorId` | `string` | Template, Required | ID of the [Vendor](entity:Vendor) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveVendorResponse`](../../doc/models/retrieve-vendor-response.md) - -## Example Usage - -```ts -const vendorId = 'vendor_id8'; - -try { - const { result, ...httpResponse } = await vendorsApi.retrieveVendor(vendorId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Vendor - -Updates an existing [Vendor](../../doc/models/vendor.md) object as a supplier to a seller. - -```ts -async updateVendor( - body: UpdateVendorRequest, - vendorId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`UpdateVendorRequest`](../../doc/models/update-vendor-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `vendorId` | `string` | Template, Required | - | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateVendorResponse`](../../doc/models/update-vendor-response.md) - -## Example Usage - -```ts -const body: UpdateVendorRequest = { - vendor: { - id: 'INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4', - name: 'Jack\'s Chicken Shack', - version: 1, - status: 'ACTIVE', - }, - idempotencyKey: '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe', -}; - -const vendorId = 'vendor_id8'; - -try { - const { result, ...httpResponse } = await vendorsApi.updateVendor( - body, - vendorId -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} 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 deleted file mode 100644 index cfea437f6..000000000 --- a/doc/api/webhook-subscriptions.md +++ /dev/null @@ -1,389 +0,0 @@ -# Webhook Subscriptions - -```ts -const webhookSubscriptionsApi = client.webhookSubscriptionsApi; -``` - -## Class Name - -`WebhookSubscriptionsApi` - -## Methods - -* [List Webhook Event Types](../../doc/api/webhook-subscriptions.md#list-webhook-event-types) -* [List Webhook Subscriptions](../../doc/api/webhook-subscriptions.md#list-webhook-subscriptions) -* [Create Webhook Subscription](../../doc/api/webhook-subscriptions.md#create-webhook-subscription) -* [Delete Webhook Subscription](../../doc/api/webhook-subscriptions.md#delete-webhook-subscription) -* [Retrieve Webhook Subscription](../../doc/api/webhook-subscriptions.md#retrieve-webhook-subscription) -* [Update Webhook Subscription](../../doc/api/webhook-subscriptions.md#update-webhook-subscription) -* [Update Webhook Subscription Signature Key](../../doc/api/webhook-subscriptions.md#update-webhook-subscription-signature-key) -* [Test Webhook Subscription](../../doc/api/webhook-subscriptions.md#test-webhook-subscription) - - -# List Webhook Event Types - -Lists all webhook event types that can be subscribed to. - -```ts -async listWebhookEventTypes( - apiVersion?: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `apiVersion` | `string \| undefined` | Query, Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListWebhookEventTypesResponse`](../../doc/models/list-webhook-event-types-response.md) - -## Example Usage - -```ts -try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.listWebhookEventTypes(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# List Webhook Subscriptions - -Lists all webhook subscriptions owned by your application. - -```ts -async listWebhookSubscriptions( - cursor?: string, - includeDisabled?: boolean, - sortOrder?: string, - limit?: number, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `includeDisabled` | `boolean \| undefined` | Query, Optional | Includes disabled [Subscription](entity:WebhookSubscription)s.
By default, all enabled [Subscription](entity:WebhookSubscription)s are returned.
**Default**: `false` | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Query, Optional | Sorts the returned list by when the [Subscription](entity:WebhookSubscription) was created with the specified order.
This field defaults to ASC. | -| `limit` | `number \| undefined` | Query, Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value.

Default: 100 | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`ListWebhookSubscriptionsResponse`](../../doc/models/list-webhook-subscriptions-response.md) - -## Example Usage - -```ts -const includeDisabled = false; - -try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.listWebhookSubscriptions( - undefined, - includeDisabled -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Create Webhook Subscription - -Creates a webhook subscription. - -```ts -async createWebhookSubscription( - body: CreateWebhookSubscriptionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `body` | [`CreateWebhookSubscriptionRequest`](../../doc/models/create-webhook-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`CreateWebhookSubscriptionResponse`](../../doc/models/create-webhook-subscription-response.md) - -## Example Usage - -```ts -const body: CreateWebhookSubscriptionRequest = { - 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', -}; - -try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.createWebhookSubscription(body); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Delete Webhook Subscription - -Deletes a webhook subscription. - -```ts -async deleteWebhookSubscription( - subscriptionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to delete. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`DeleteWebhookSubscriptionResponse`](../../doc/models/delete-webhook-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.deleteWebhookSubscription(subscriptionId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Retrieve Webhook Subscription - -Retrieves a webhook subscription identified by its ID. - -```ts -async retrieveWebhookSubscription( - subscriptionId: string, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to retrieve. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`RetrieveWebhookSubscriptionResponse`](../../doc/models/retrieve-webhook-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.retrieveWebhookSubscription(subscriptionId); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Webhook Subscription - -Updates a webhook subscription. - -```ts -async updateWebhookSubscription( - subscriptionId: string, - body: UpdateWebhookSubscriptionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update. | -| `body` | [`UpdateWebhookSubscriptionRequest`](../../doc/models/update-webhook-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateWebhookSubscriptionResponse`](../../doc/models/update-webhook-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const body: UpdateWebhookSubscriptionRequest = { - subscription: { - name: 'Updated Example Webhook Subscription', - enabled: false, - }, -}; - -try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.updateWebhookSubscription( - subscriptionId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Update Webhook Subscription Signature Key - -Updates a webhook subscription by replacing the existing signature key with a new one. - -```ts -async updateWebhookSubscriptionSignatureKey( - subscriptionId: string, - body: UpdateWebhookSubscriptionSignatureKeyRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update. | -| `body` | [`UpdateWebhookSubscriptionSignatureKeyRequest`](../../doc/models/update-webhook-subscription-signature-key-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`UpdateWebhookSubscriptionSignatureKeyResponse`](../../doc/models/update-webhook-subscription-signature-key-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const body: UpdateWebhookSubscriptionSignatureKeyRequest = { - idempotencyKey: 'ed80ae6b-0654-473b-bbab-a39aee89a60d', -}; - -try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.updateWebhookSubscriptionSignatureKey( - subscriptionId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - - -# Test Webhook Subscription - -Tests a webhook subscription by sending a test event to the notification URL. - -```ts -async testWebhookSubscription( - subscriptionId: string, - body: TestWebhookSubscriptionRequest, - requestOptions?: RequestOptions -): Promise> -``` - -## Parameters - -| Parameter | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscriptionId` | `string` | Template, Required | [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to test. | -| `body` | [`TestWebhookSubscriptionRequest`](../../doc/models/test-webhook-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | -| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | - -## Response Type - -[`TestWebhookSubscriptionResponse`](../../doc/models/test-webhook-subscription-response.md) - -## Example Usage - -```ts -const subscriptionId = 'subscription_id0'; - -const body: TestWebhookSubscriptionRequest = { - eventType: 'payment.created', -}; - -try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.testWebhookSubscription( - subscriptionId, - body -); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - diff --git a/doc/auth/oauth-2-bearer-token.md b/doc/auth/oauth-2-bearer-token.md deleted file mode 100644 index a21193950..000000000 --- a/doc/auth/oauth-2-bearer-token.md +++ /dev/null @@ -1,32 +0,0 @@ - -# OAuth 2 Bearer token - - - -Documentation for accessing and setting credentials for global. - -## Auth Credentials - -| Name | Type | Description | Setter | -| --- | --- | --- | --- | -| AccessToken | `string` | The OAuth 2.0 Access Token to use for API requests. | `accessToken` | - - - -**Note:** Auth credentials can be set using `bearerAuthCredentials` object in the client. - -## Usage Example - -### Client Initialization - -You must provide credentials in the client as shown in the following code snippet. - -```ts -const client = new Client({ - bearerAuthCredentials: { - accessToken: 'AccessToken' - }, -}); -``` - - diff --git a/doc/client.md b/doc/client.md deleted file mode 100644 index c8fa4c1b1..000000000 --- a/doc/client.md +++ /dev/null @@ -1,136 +0,0 @@ - -# Client Class Documentation - -The following parameters are configurable for the API Client: - -| Parameter | Type | Description | -| --- | --- | --- | -| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2024-12-18'` | -| `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*: `{}` | -| `userAgentDetail` | `string` | User agent detail to append in the user agent header
*Default*: `"''"` | -| `timeout` | `number` | Timeout for API calls.
*Default*: `60000` | -| `httpClientOptions` | `Partial` | Stable configurable http client options. | -| `unstableHttpClientOptions` | `any` | Unstable configurable http client options. | -| `bearerAuthCredentials` | [`BearerAuthCredentials`](auth/oauth-2-bearer-token.md) | The credential object for bearerAuth | - -## HttpClientOptions - -| Parameter | Type | Description | -| --- | --- | --- | -| `timeout` | `number` | Timeout in milliseconds. | -| `httpAgent` | `any` | Custom http agent to be used when performing http requests. | -| `httpsAgent` | `any` | Custom https agent to be used when performing http requests. | -| `retryConfig` | `Partial` | Configurations to retry requests. | - -## RetryConfiguration - -| Parameter | Type | Description | -| --- | --- | --- | -| `maxNumberOfRetries` | `number` | Maximum number of retries.
*Default*: `0` | -| `retryOnTimeout` | `boolean` | Whether to retry on request timeout.
*Default*: `true` | -| `retryInterval` | `number` | Interval before next retry. Used in calculation of wait time for next request in case of failure.
*Default*: `1` | -| `maximumRetryWaitTime` | `number` | Overall wait time for the requests getting retried.
*Default*: `0` | -| `backoffFactor` | `number` | Used in calculation of wait time for next request in case of failure.
*Default*: `2` | -| `httpStatusCodesToRetry` | `number[]` | Http status codes to retry against.
*Default*: `[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]` | -| `httpMethodsToRetry` | `HttpMethod[]` | Http methods to retry against.
*Default*: `['GET', 'PUT']` | - -The API client can be initialized as follows: - -```ts -const client = new Client({ - bearerAuthCredentials: { - accessToken: 'AccessToken' - }, - squareVersion: '2024-12-18', - timeout: 60000, - additionalHeaders: {}, - userAgentDetail: '', - environment: Environment.Production, - customUrl: 'https://connect.squareup.com', -}); -``` - -## Make Calls with the API Client - -```ts -import { ApiError, Client, Environment } from 'square'; - -const client = new Client({ - bearerAuthCredentials: { - accessToken: 'AccessToken' - }, - squareVersion: '2024-12-18', - timeout: 60000, - additionalHeaders: {}, - userAgentDetail: '', - environment: Environment.Production, - customUrl: 'https://connect.squareup.com', -}); - -const locationsApi = client.locationsApi; - -try { - const { result, ...httpResponse } = await locationsApi.listLocations(); - // Get more response info... - // const { statusCode, headers } = httpResponse; -} catch (error) { - if (error instanceof ApiError) { - const errors = error.result; - // const { statusCode, headers } = error; - } -} -``` - -## Square Client - -The gateway for the SDK. This class acts as a factory for the Apis and also holds the configuration of the SDK. - -## API - -| Name | Description | -| --- | --- | -| mobileAuthorization | Gets MobileAuthorizationApi | -| oAuth | Gets OAuthApi | -| v1Transactions | Gets V1TransactionsApi | -| applePay | Gets ApplePayApi | -| bankAccounts | Gets BankAccountsApi | -| bookings | Gets BookingsApi | -| bookingCustomAttributes | Gets BookingCustomAttributesApi | -| cards | Gets CardsApi | -| cashDrawers | Gets CashDrawersApi | -| catalog | Gets CatalogApi | -| customers | Gets CustomersApi | -| customerCustomAttributes | Gets CustomerCustomAttributesApi | -| customerGroups | Gets CustomerGroupsApi | -| customerSegments | Gets CustomerSegmentsApi | -| devices | Gets DevicesApi | -| disputes | Gets DisputesApi | -| employees | Gets EmployeesApi | -| events | Gets EventsApi | -| giftCards | Gets GiftCardsApi | -| giftCardActivities | Gets GiftCardActivitiesApi | -| inventory | Gets InventoryApi | -| invoices | Gets InvoicesApi | -| labor | Gets LaborApi | -| locations | Gets LocationsApi | -| locationCustomAttributes | Gets LocationCustomAttributesApi | -| checkout | Gets CheckoutApi | -| transactions | Gets TransactionsApi | -| loyalty | Gets LoyaltyApi | -| merchants | Gets MerchantsApi | -| merchantCustomAttributes | Gets MerchantCustomAttributesApi | -| orders | Gets OrdersApi | -| orderCustomAttributes | Gets OrderCustomAttributesApi | -| payments | Gets PaymentsApi | -| payouts | Gets PayoutsApi | -| refunds | Gets RefundsApi | -| sites | Gets SitesApi | -| snippets | Gets SnippetsApi | -| subscriptions | Gets SubscriptionsApi | -| team | Gets TeamApi | -| terminal | Gets TerminalApi | -| vendors | Gets VendorsApi | -| webhookSubscriptions | Gets WebhookSubscriptionsApi | - diff --git a/doc/models/accept-dispute-response.md b/doc/models/accept-dispute-response.md deleted file mode 100644 index c9521657d..000000000 --- a/doc/models/accept-dispute-response.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Accept Dispute Response - -Defines the fields in an `AcceptDispute` response. - -## Structure - -`AcceptDisputeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `dispute` | [`Dispute \| undefined`](../../doc/models/dispute.md) | Optional | Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. | - -## Example (as JSON) - -```json -{ - "dispute": { - "amount_money": { - "amount": 2500, - "currency": "USD" - }, - "brand_dispute_id": "100000809947", - "card_brand": "VISA", - "created_at": "2022-06-29T18:45:22.265Z", - "disputed_payment": { - "payment_id": "zhyh1ch64kRBrrlfVhwjCEjZWzNZY" - }, - "due_at": "2022-07-13T00:00:00.000Z", - "id": "XDgyFu7yo1E2S5lQGGpYn", - "location_id": "L1HN3ZMQK64X9", - "reason": "NO_KNOWLEDGE", - "reported_at": "2022-06-29T00:00:00.000Z", - "state": "ACCEPTED", - "updated_at": "2022-07-07T19:14:42.650Z", - "version": 2, - "dispute_id": "dispute_id8" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/accepted-payment-methods.md b/doc/models/accepted-payment-methods.md deleted file mode 100644 index c410e19ea..000000000 --- a/doc/models/accepted-payment-methods.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Accepted Payment Methods - -## Structure - -`AcceptedPaymentMethods` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `applePay` | `boolean \| null \| undefined` | Optional | Whether Apple Pay is accepted at checkout. | -| `googlePay` | `boolean \| null \| undefined` | Optional | Whether Google Pay is accepted at checkout. | -| `cashAppPay` | `boolean \| null \| undefined` | Optional | Whether Cash App Pay is accepted at checkout. | -| `afterpayClearpay` | `boolean \| null \| undefined` | Optional | Whether Afterpay/Clearpay is accepted at checkout. | - -## Example (as JSON) - -```json -{ - "apple_pay": false, - "google_pay": false, - "cash_app_pay": false, - "afterpay_clearpay": false -} -``` - diff --git a/doc/models/accumulate-loyalty-points-request.md b/doc/models/accumulate-loyalty-points-request.md deleted file mode 100644 index 2ac861f07..000000000 --- a/doc/models/accumulate-loyalty-points-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Accumulate Loyalty Points Request - -Represents an [AccumulateLoyaltyPoints](../../doc/api/loyalty.md#accumulate-loyalty-points) request. - -## Structure - -`AccumulateLoyaltyPointsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `accumulatePoints` | [`LoyaltyEventAccumulatePoints`](../../doc/models/loyalty-event-accumulate-points.md) | Required | Provides metadata when the event `type` is `ACCUMULATE_POINTS`. | -| `idempotencyKey` | `string` | Required | A unique string that identifies the `AccumulateLoyaltyPoints` request.
Keys can be any valid string but must be unique for every request.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | -| `locationId` | `string` | Required | The [location](entity:Location) where the purchase was made. | - -## Example (as JSON) - -```json -{ - "accumulate_points": { - "order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", - "loyalty_program_id": "loyalty_program_id8", - "points": 118 - }, - "idempotency_key": "58b90739-c3e8-4b11-85f7-e636d48d72cb", - "location_id": "P034NEENMD09F" -} -``` - diff --git a/doc/models/accumulate-loyalty-points-response.md b/doc/models/accumulate-loyalty-points-response.md deleted file mode 100644 index cde362ed6..000000000 --- a/doc/models/accumulate-loyalty-points-response.md +++ /dev/null @@ -1,99 +0,0 @@ - -# Accumulate Loyalty Points Response - -Represents an [AccumulateLoyaltyPoints](../../doc/api/loyalty.md#accumulate-loyalty-points) response. - -## Structure - -`AccumulateLoyaltyPointsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `event` | [`LoyaltyEvent \| undefined`](../../doc/models/loyalty-event.md) | Optional | Provides information about a loyalty event.
For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). | -| `events` | [`LoyaltyEvent[] \| undefined`](../../doc/models/loyalty-event.md) | Optional | The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event
is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included
if the purchase also qualifies for a loyalty promotion. | - -## Example (as JSON) - -```json -{ - "events": [ - { - "accumulate_points": { - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", - "points": 6 - }, - "created_at": "2020-05-08T21:41:12Z", - "id": "ee46aafd-1af6-3695-a385-276e2ef0be26", - "location_id": "P034NEENMD09F", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "source": "LOYALTY_API", - "type": "ACCUMULATE_POINTS", - "create_reward": { - "loyalty_program_id": "loyalty_program_id2", - "reward_id": "reward_id6", - "points": 90 - }, - "redeem_reward": { - "loyalty_program_id": "loyalty_program_id8", - "reward_id": "reward_id2", - "order_id": "order_id8" - }, - "delete_reward": { - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 104 - }, - "adjust_points": { - "loyalty_program_id": "loyalty_program_id2", - "points": 96, - "reason": "reason2" - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "event": { - "id": "id0", - "type": "ADJUST_POINTS", - "created_at": "created_at8", - "accumulate_points": { - "loyalty_program_id": "loyalty_program_id8", - "points": 118, - "order_id": "order_id8" - }, - "create_reward": { - "loyalty_program_id": "loyalty_program_id2", - "reward_id": "reward_id6", - "points": 90 - }, - "redeem_reward": { - "loyalty_program_id": "loyalty_program_id8", - "reward_id": "reward_id2", - "order_id": "order_id8" - }, - "delete_reward": { - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 104 - }, - "adjust_points": { - "loyalty_program_id": "loyalty_program_id2", - "points": 96, - "reason": "reason2" - }, - "loyalty_account_id": "loyalty_account_id0", - "source": "SQUARE" - } -} -``` - diff --git a/doc/models/ach-details.md b/doc/models/ach-details.md deleted file mode 100644 index 614a12b7a..000000000 --- a/doc/models/ach-details.md +++ /dev/null @@ -1,27 +0,0 @@ - -# ACH Details - -ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`. - -## Structure - -`ACHDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `routingNumber` | `string \| null \| undefined` | Optional | The routing number for the bank account.
**Constraints**: *Maximum Length*: `50` | -| `accountNumberSuffix` | `string \| null \| undefined` | Optional | The last few digits of the bank account number.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `4` | -| `accountType` | `string \| null \| undefined` | Optional | The type of the bank account performing the transfer. The account type can be `CHECKING`,
`SAVINGS`, or `UNKNOWN`.
**Constraints**: *Maximum Length*: `50` | - -## Example (as JSON) - -```json -{ - "routing_number": "routing_number6", - "account_number_suffix": "account_number_suffix6", - "account_type": "account_type8" -} -``` - diff --git a/doc/models/action-cancel-reason.md b/doc/models/action-cancel-reason.md deleted file mode 100644 index c3d54bfb5..000000000 --- a/doc/models/action-cancel-reason.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Action Cancel Reason - -## Enumeration - -`ActionCancelReason` - -## Fields - -| Name | Description | -| --- | --- | -| `BUYER_CANCELED` | A person canceled the `TerminalCheckout` from a Square device. | -| `SELLER_CANCELED` | A client canceled the `TerminalCheckout` using the API. | -| `TIMED_OUT` | The `TerminalCheckout` timed out (see `deadline_duration` on the `TerminalCheckout`). | - diff --git a/doc/models/activity-type.md b/doc/models/activity-type.md deleted file mode 100644 index 04577ccd8..000000000 --- a/doc/models/activity-type.md +++ /dev/null @@ -1,70 +0,0 @@ - -# Activity Type - -## Enumeration - -`ActivityType` - -## Fields - -| Name | Description | -| --- | --- | -| `ADJUSTMENT` | A manual adjustment applied to the seller's account by Square. | -| `APP_FEE_REFUND` | A refund for an application fee on a payment. | -| `APP_FEE_REVENUE` | Revenue generated from an application fee on a payment. | -| `AUTOMATIC_SAVINGS` | An automatic transfer from the payment processing balance to the Square Savings account. These are generally proportional to the seller's sales. | -| `AUTOMATIC_SAVINGS_REVERSED` | An automatic transfer from the Square Savings account back to the processing balance. These are generally proportional to the seller's refunds. | -| `CHARGE` | A credit card payment capture. | -| `DEPOSIT_FEE` | A fee assessed because of a deposit, such as an instant deposit. | -| `DEPOSIT_FEE_REVERSED` | Indicates that Square returned a fee that was previously assessed because of a deposit, such as an instant deposit, back to the seller's account. | -| `DISPUTE` | The balance change due to a dispute event. | -| `ESCHEATMENT` | An escheatment entry for remittance. | -| `FEE` | The cost plus adjustment fee. | -| `FREE_PROCESSING` | Square offers free payments processing for a variety of business scenarios, including seller
referrals or when Square wants to apologize (for example, for a bug, customer service, or repricing complication).
This entry represents a credit to the seller for the purposes of free processing. | -| `HOLD_ADJUSTMENT` | An adjustment made by Square related to holding a payment. | -| `INITIAL_BALANCE_CHANGE` | An external change to a seller's balance (initial, in the sense that it causes the creation of the other activity types, such as a hold and refund). | -| `MONEY_TRANSFER` | The balance change from a money transfer. | -| `MONEY_TRANSFER_REVERSAL` | The reversal of a money transfer. | -| `OPEN_DISPUTE` | The balance change for a chargeback that's been filed. | -| `OTHER` | Any other type that doesn't belong in the rest of the types. | -| `OTHER_ADJUSTMENT` | Any other type of adjustment that doesn't fall under existing types. | -| `PAID_SERVICE_FEE` | A fee paid to a third-party seller. | -| `PAID_SERVICE_FEE_REFUND` | A fee refunded to a third-party seller. | -| `REDEMPTION_CODE` | Repayment for a redemption code. | -| `REFUND` | A refund for an existing card payment. | -| `RELEASE_ADJUSTMENT` | An adjustment made by Square related to releasing a payment. | -| `RESERVE_HOLD` | Fees paid for a funding risk reserve. | -| `RESERVE_RELEASE` | Fees released from a risk reserve. | -| `RETURNED_PAYOUT` | An entry created when Square receives a response for the ACH file that Square sent indicating that the
settlement of the original entry failed. | -| `SQUARE_CAPITAL_PAYMENT` | A capital merchant cash advance (MCA) assessment. These are generally proportional to the merchant's sales but can be issued for other reasons related to the MCA. | -| `SQUARE_CAPITAL_REVERSED_PAYMENT` | A capital merchant cash advance (MCA) assessment refund. These are generally proportional to the merchant's refunds but can be issued for other reasons related to the MCA. | -| `SUBSCRIPTION_FEE` | A fee charged for subscription to a Square product. | -| `SUBSCRIPTION_FEE_PAID_REFUND` | A Square subscription fee that's been refunded. | -| `SUBSCRIPTION_FEE_REFUND` | The refund of a previously charged Square product subscription fee. | -| `TAX_ON_FEE` | The tax paid on fee amounts. | -| `THIRD_PARTY_FEE` | Fees collected by a third-party platform. | -| `THIRD_PARTY_FEE_REFUND` | Refunded fees from a third-party platform. | -| `PAYOUT` | The balance change due to a money transfer. Note that this type is never returned by the Payouts API. | -| `AUTOMATIC_BITCOIN_CONVERSIONS` | Indicates that the portion of each payment withheld by Square was automatically converted into bitcoin using Cash App. The seller manages their bitcoin in their Cash App account. | -| `AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED` | Indicates that a withheld payment, which was scheduled to be converted into bitcoin using Cash App, was deposited back to the Square payments balance. | -| `CREDIT_CARD_REPAYMENT` | Indicates that a repayment toward the outstanding balance on the seller's Square credit card was made. | -| `CREDIT_CARD_REPAYMENT_REVERSED` | Indicates that a repayment toward the outstanding balance on the seller's Square credit card was reversed. | -| `LOCAL_OFFERS_CASHBACK` | Cashback amount given by a Square Local Offers seller to their customer for a purchase. | -| `LOCAL_OFFERS_FEE` | A commission fee paid by a Square Local Offers seller to Square for a purchase discovered through Square Local Offers. | -| `PERCENTAGE_PROCESSING_ENROLLMENT` | When activating Percentage Processing, a credit is applied to the seller’s account to offset any negative balance caused by a dispute. | -| `PERCENTAGE_PROCESSING_DEACTIVATION` | Deducting the outstanding Percentage Processing balance from the seller’s account. It's the final installment in repaying the dispute-induced negative balance through percentage processing. | -| `PERCENTAGE_PROCESSING_REPAYMENT` | Withheld funds from a payment to cover a negative balance. It's an installment to repay the amount from a dispute that had been offset during Percentage Processing enrollment. | -| `PERCENTAGE_PROCESSING_REPAYMENT_REVERSED` | The reversal of a percentage processing repayment that happens for example when a refund is issued for a payment. | -| `PROCESSING_FEE` | The processing fee for a payment. If sellers opt for Gross Settlement, i.e., direct bank withdrawal instead of deducting fees from daily sales, the processing fee is recorded separately as a new payout entry, not part of the CHARGE payout entry. | -| `PROCESSING_FEE_REFUND` | The processing fee for a payment refund issued by sellers enrolled in Gross Settlement. The refunded processing fee is recorded separately as a new payout entry, not part of the REFUND payout entry. | -| `UNDO_PROCESSING_FEE_REFUND` | When undoing a processing fee refund in a Gross Settlement payment, this payout entry type is used. | -| `GIFT_CARD_LOAD_FEE` | Fee collected during the sale or reload of a gift card. This fee, which is a portion of the amount loaded on the gift card, is deducted from the merchant's payment balance. | -| `GIFT_CARD_LOAD_FEE_REFUND` | Refund for fee charged during the sale or reload of a gift card. | -| `UNDO_GIFT_CARD_LOAD_FEE_REFUND` | The undo of a refund for a fee charged during the sale or reload of a gift card. | -| `BALANCE_FOLDERS_TRANSFER` | A transfer of funds to a banking folder. In the United States, the folder name is 'Checking Folder'; in Canada, it's 'Balance Folder.' | -| `BALANCE_FOLDERS_TRANSFER_REVERSED` | A reversal of transfer of funds from a banking folder. In the United States, the folder name is 'Checking Folder'; in Canada, it's 'Balance Folder.' | -| `GIFT_CARD_POOL_TRANSFER` | A transfer of gift card funds to a central gift card pool account. In franchises, when gift cards are loaded or reloaded at any location, the money transfers to the franchisor's account. | -| `GIFT_CARD_POOL_TRANSFER_REVERSED` | A reversal of transfer of gift card funds from a central gift card pool account. In franchises, when gift cards are loaded or reloaded at any location, the money transfers to the franchisor's account. | -| `SQUARE_PAYROLL_TRANSFER` | A payroll payment that was transferred to a team member’s bank account. | -| `SQUARE_PAYROLL_TRANSFER_REVERSED` | A payroll payment to a team member’s bank account that was deposited back to the seller’s account by Square. | - diff --git a/doc/models/add-group-to-customer-response.md b/doc/models/add-group-to-customer-response.md deleted file mode 100644 index 6c1ad7b9d..000000000 --- a/doc/models/add-group-to-customer-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Add Group to Customer Response - -Defines the fields that are included in the response body of -a request to the [AddGroupToCustomer](../../doc/api/customers.md#add-group-to-customer) endpoint. - -## Structure - -`AddGroupToCustomerResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/additional-recipient.md b/doc/models/additional-recipient.md deleted file mode 100644 index 1f7e4e37c..000000000 --- a/doc/models/additional-recipient.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Additional Recipient - -Represents an additional recipient (other than the merchant) receiving a portion of this tender. - -## Structure - -`AdditionalRecipient` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Required | The location ID for a recipient (other than the merchant) receiving a portion of this tender.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `50` | -| `description` | `string \| null \| undefined` | Optional | The description of the additional recipient.
**Constraints**: *Maximum Length*: `100` | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `receivableId` | `string \| null \| undefined` | Optional | The unique ID for the RETIRED `AdditionalRecipientReceivable` object. This field should be empty for any `AdditionalRecipient` objects created after the retirement.
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "location_id": "location_id2", - "description": "description2", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id8" -} -``` - diff --git a/doc/models/address.md b/doc/models/address.md deleted file mode 100644 index 2334fc0e1..000000000 --- a/doc/models/address.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Address - -Represents a postal address in a country. -For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - -## Structure - -`Address` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `addressLine1` | `string \| null \| undefined` | Optional | The first line of the address.

Fields that start with `address_line` provide the address's most specific
details, like street number, street name, and building name. They do *not*
provide less specific details like city, state/province, or country (these
details are provided in other fields). | -| `addressLine2` | `string \| null \| undefined` | Optional | The second line of the address, if any. | -| `addressLine3` | `string \| null \| undefined` | Optional | The third line of the address, if any. | -| `locality` | `string \| null \| undefined` | Optional | The city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `sublocality` | `string \| null \| undefined` | Optional | A civil region within the address's `locality`, if any. | -| `sublocality2` | `string \| null \| undefined` | Optional | A civil region within the address's `sublocality`, if any. | -| `sublocality3` | `string \| null \| undefined` | Optional | A civil region within the address's `sublocality_2`, if any. | -| `administrativeDistrictLevel1` | `string \| null \| undefined` | Optional | A civil entity within the address's country. In the US, this
is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `administrativeDistrictLevel2` | `string \| null \| undefined` | Optional | A civil entity within the address's `administrative_district_level_1`.
In the US, this is the county. | -| `administrativeDistrictLevel3` | `string \| null \| undefined` | Optional | A civil entity within the address's `administrative_district_level_2`,
if any. | -| `postalCode` | `string \| null \| undefined` | Optional | The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `country` | [`string \| undefined`](../../doc/models/country.md) | Optional | Indicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | -| `firstName` | `string \| null \| undefined` | Optional | Optional first name when it's representing recipient. | -| `lastName` | `string \| null \| undefined` | Optional | Optional last name when it's representing recipient. | - -## Example (as JSON) - -```json -{ - "address_line_1": "address_line_18", - "address_line_2": "address_line_28", - "address_line_3": "address_line_34", - "locality": "locality8", - "sublocality": "sublocality8" -} -``` - diff --git a/doc/models/adjust-loyalty-points-request.md b/doc/models/adjust-loyalty-points-request.md deleted file mode 100644 index 402941b6c..000000000 --- a/doc/models/adjust-loyalty-points-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Adjust Loyalty Points Request - -Represents an [AdjustLoyaltyPoints](../../doc/api/loyalty.md#adjust-loyalty-points) request. - -## Structure - -`AdjustLoyaltyPointsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `AdjustLoyaltyPoints` request.
Keys can be any valid string, but must be unique for every request.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | -| `adjustPoints` | [`LoyaltyEventAdjustPoints`](../../doc/models/loyalty-event-adjust-points.md) | Required | Provides metadata when the event `type` is `ADJUST_POINTS`. | -| `allowNegativeBalance` | `boolean \| null \| undefined` | Optional | Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative
balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting
the specified number of points would result in a negative balance. The default value is `false`. | - -## Example (as JSON) - -```json -{ - "adjust_points": { - "points": 10, - "reason": "Complimentary points", - "loyalty_program_id": "loyalty_program_id2" - }, - "idempotency_key": "bc29a517-3dc9-450e-aa76-fae39ee849d1", - "allow_negative_balance": false -} -``` - diff --git a/doc/models/adjust-loyalty-points-response.md b/doc/models/adjust-loyalty-points-response.md deleted file mode 100644 index dd566fa19..000000000 --- a/doc/models/adjust-loyalty-points-response.md +++ /dev/null @@ -1,63 +0,0 @@ - -# Adjust Loyalty Points Response - -Represents an [AdjustLoyaltyPoints](../../doc/api/loyalty.md#adjust-loyalty-points) request. - -## Structure - -`AdjustLoyaltyPointsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `event` | [`LoyaltyEvent \| undefined`](../../doc/models/loyalty-event.md) | Optional | Provides information about a loyalty event.
For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). | - -## Example (as JSON) - -```json -{ - "event": { - "adjust_points": { - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "points": 10, - "reason": "Complimentary points" - }, - "created_at": "2020-05-08T21:42:32Z", - "id": "613a6fca-8d67-39d0-bad2-3b4bc45c8637", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "source": "LOYALTY_API", - "type": "ADJUST_POINTS", - "accumulate_points": { - "loyalty_program_id": "loyalty_program_id8", - "points": 118, - "order_id": "order_id8" - }, - "create_reward": { - "loyalty_program_id": "loyalty_program_id2", - "reward_id": "reward_id6", - "points": 90 - }, - "redeem_reward": { - "loyalty_program_id": "loyalty_program_id8", - "reward_id": "reward_id2", - "order_id": "order_id8" - }, - "delete_reward": { - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 104 - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/afterpay-details.md b/doc/models/afterpay-details.md deleted file mode 100644 index e7e098585..000000000 --- a/doc/models/afterpay-details.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Afterpay Details - -Additional details about Afterpay payments. - -## Structure - -`AfterpayDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `emailAddress` | `string \| null \| undefined` | Optional | Email address on the buyer's Afterpay account.
**Constraints**: *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "email_address": "email_address2" -} -``` - diff --git a/doc/models/application-details-external-square-product.md b/doc/models/application-details-external-square-product.md deleted file mode 100644 index 9fa8cdc37..000000000 --- a/doc/models/application-details-external-square-product.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Application Details External Square Product - -A list of products to return to external callers. - -## Enumeration - -`ApplicationDetailsExternalSquareProduct` - -## Fields - -| Name | -| --- | -| `APPOINTMENTS` | -| `ECOMMERCE_API` | -| `INVOICES` | -| `ONLINE_STORE` | -| `OTHER` | -| `RESTAURANTS` | -| `RETAIL` | -| `SQUARE_POS` | -| `TERMINAL_API` | -| `VIRTUAL_TERMINAL` | - diff --git a/doc/models/application-details.md b/doc/models/application-details.md deleted file mode 100644 index d4b01e742..000000000 --- a/doc/models/application-details.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Application Details - -Details about the application that took the payment. - -## Structure - -`ApplicationDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `squareProduct` | [`string \| undefined`](../../doc/models/application-details-external-square-product.md) | Optional | A list of products to return to external callers. | -| `applicationId` | `string \| null \| undefined` | Optional | The Square ID assigned to the application used to take the payment.
Application developers can use this information to identify payments that
their application processed.
For example, if a developer uses a custom application to process payments,
this field contains the application ID from the Developer Dashboard.
If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace)
application to process payments, the field contains the corresponding application ID. | - -## Example (as JSON) - -```json -{ - "square_product": "APPOINTMENTS", - "application_id": "application_id2" -} -``` - diff --git a/doc/models/application-type.md b/doc/models/application-type.md deleted file mode 100644 index ab57c1f9b..000000000 --- a/doc/models/application-type.md +++ /dev/null @@ -1,13 +0,0 @@ - -# Application Type - -## Enumeration - -`ApplicationType` - -## Fields - -| Name | -| --- | -| `TERMINAL_API` | - diff --git a/doc/models/appointment-segment.md b/doc/models/appointment-segment.md deleted file mode 100644 index 4327b9897..000000000 --- a/doc/models/appointment-segment.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Appointment Segment - -Defines an appointment segment of a booking. - -## Structure - -`AppointmentSegment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `durationMinutes` | `number \| null \| undefined` | Optional | The time span in minutes of an appointment segment.
**Constraints**: `<= 1500` | -| `serviceVariationId` | `string \| null \| undefined` | Optional | The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment.
**Constraints**: *Maximum Length*: `36` | -| `teamMemberId` | `string` | Required | The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this segment.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `32` | -| `serviceVariationVersion` | `bigint \| null \| undefined` | Optional | The current version of the item variation representing the service booked in this segment. | -| `intermissionMinutes` | `number \| undefined` | Optional | Time between the end of this segment and the beginning of the subsequent segment. | -| `anyTeamMember` | `boolean \| undefined` | Optional | Whether the customer accepts any team member, instead of a specific one, to serve this segment. | -| `resourceIds` | `string[] \| undefined` | Optional | The IDs of the seller-accessible resources used for this appointment segment. | - -## Example (as JSON) - -```json -{ - "duration_minutes": 36, - "service_variation_id": "service_variation_id4", - "team_member_id": "team_member_id0", - "service_variation_version": 204, - "intermission_minutes": 210, - "any_team_member": false -} -``` - diff --git a/doc/models/archived-state.md b/doc/models/archived-state.md deleted file mode 100644 index f9e985335..000000000 --- a/doc/models/archived-state.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Archived State - -Defines the values for the `archived_state` query expression -used in [SearchCatalogItems](../../doc/api/catalog.md#search-catalog-items) -to return the archived, not archived or either type of catalog items. - -## Enumeration - -`ArchivedState` - -## Fields - -| Name | Description | -| --- | --- | -| `ARCHIVED_STATE_NOT_ARCHIVED` | Requested items are not archived with the `is_archived` attribute set to `false`. | -| `ARCHIVED_STATE_ARCHIVED` | Requested items are archived with the `is_archived` attribute set to `true`. | -| `ARCHIVED_STATE_ALL` | Requested items can be archived or not archived. | - diff --git a/doc/models/availability.md b/doc/models/availability.md deleted file mode 100644 index 5a66e78cc..000000000 --- a/doc/models/availability.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Availability - -Defines an appointment slot that encapsulates the appointment segments, location and starting time available for booking. - -## Structure - -`Availability` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `startAt` | `string \| null \| undefined` | Optional | The RFC 3339 timestamp specifying the beginning time of the slot available for booking. | -| `locationId` | `string \| undefined` | Optional | The ID of the location available for booking.
**Constraints**: *Maximum Length*: `32` | -| `appointmentSegments` | [`AppointmentSegment[] \| null \| undefined`](../../doc/models/appointment-segment.md) | Optional | The list of appointment segments available for booking | - -## Example (as JSON) - -```json -{ - "start_at": "start_at6", - "location_id": "location_id8", - "appointment_segments": [ - { - "duration_minutes": 136, - "service_variation_id": "service_variation_id4", - "team_member_id": "team_member_id0", - "service_variation_version": 48, - "intermission_minutes": 54, - "any_team_member": false - } - ] -} -``` - diff --git a/doc/models/bank-account-payment-details.md b/doc/models/bank-account-payment-details.md deleted file mode 100644 index 368eb8fea..000000000 --- a/doc/models/bank-account-payment-details.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Bank Account Payment Details - -Additional details about BANK_ACCOUNT type payments. - -## Structure - -`BankAccountPaymentDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bankName` | `string \| null \| undefined` | Optional | The name of the bank associated with the bank account.
**Constraints**: *Maximum Length*: `100` | -| `transferType` | `string \| null \| undefined` | Optional | The type of the bank transfer. The type can be `ACH` or `UNKNOWN`.
**Constraints**: *Maximum Length*: `50` | -| `accountOwnershipType` | `string \| null \| undefined` | Optional | The ownership type of the bank account performing the transfer.
The type can be `INDIVIDUAL`, `COMPANY`, or `ACCOUNT_TYPE_UNKNOWN`.
**Constraints**: *Maximum Length*: `50` | -| `fingerprint` | `string \| null \| undefined` | Optional | Uniquely identifies the bank account for this seller and can be used
to determine if payments are from the same bank account.
**Constraints**: *Maximum Length*: `255` | -| `country` | `string \| null \| undefined` | Optional | The two-letter ISO code representing the country the bank account is located in.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `2` | -| `statementDescription` | `string \| null \| undefined` | Optional | The statement description as sent to the bank.
**Constraints**: *Maximum Length*: `1000` | -| `achDetails` | [`ACHDetails \| undefined`](../../doc/models/ach-details.md) | Optional | ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`. | -| `errors` | [`Error[] \| null \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "bank_name": "bank_name4", - "transfer_type": "transfer_type8", - "account_ownership_type": "account_ownership_type8", - "fingerprint": "fingerprint6", - "country": "country4" -} -``` - diff --git a/doc/models/bank-account-status.md b/doc/models/bank-account-status.md deleted file mode 100644 index 7986f080b..000000000 --- a/doc/models/bank-account-status.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Bank Account Status - -Indicates the current verification status of a `BankAccount` object. - -## Enumeration - -`BankAccountStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `VERIFICATION_IN_PROGRESS` | Indicates that the verification process has started. Some features
(for example, creditable or debitable) may be provisionally enabled on the bank
account. | -| `VERIFIED` | Indicates that the bank account was successfully verified. | -| `DISABLED` | Indicates that the bank account is disabled and is permanently unusable
for funds transfer. A bank account can be disabled because of a failed verification
attempt or a failed deposit attempt. | - diff --git a/doc/models/bank-account-type.md b/doc/models/bank-account-type.md deleted file mode 100644 index 809c07a9c..000000000 --- a/doc/models/bank-account-type.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Bank Account Type - -Indicates the financial purpose of the bank account. - -## Enumeration - -`BankAccountType` - -## Fields - -| Name | Description | -| --- | --- | -| `CHECKING` | An account at a financial institution against which checks can be
drawn by the account depositor. | -| `SAVINGS` | An account at a financial institution that pays interest but cannot be
used directly as money in the narrow sense of a medium of exchange. | -| `INVESTMENT` | An account at a financial institution that contains a deposit of funds
and/or securities. | -| `OTHER` | An account at a financial institution which cannot be described by the
other types. | -| `BUSINESS_CHECKING` | An account at a financial institution against which checks can be
drawn specifically for business purposes (non-personal use). | - diff --git a/doc/models/bank-account.md b/doc/models/bank-account.md deleted file mode 100644 index 97584917f..000000000 --- a/doc/models/bank-account.md +++ /dev/null @@ -1,55 +0,0 @@ - -# Bank Account - -Represents a bank account. For more information about -linking a bank account to a Square account, see -[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). - -## Structure - -`BankAccount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Required | The unique, Square-issued identifier for the bank account.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `30` | -| `accountNumberSuffix` | `string` | Required | The last few digits of the account number.
**Constraints**: *Minimum Length*: `1` | -| `country` | [`string`](../../doc/models/country.md) | Required | Indicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | -| `currency` | [`string`](../../doc/models/currency.md) | Required | Indicates the associated currency for an amount of money. Values correspond
to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). | -| `accountType` | [`string`](../../doc/models/bank-account-type.md) | Required | Indicates the financial purpose of the bank account. | -| `holderName` | `string` | Required | Name of the account holder. This name must match the name
on the targeted bank account record.
**Constraints**: *Minimum Length*: `1` | -| `primaryBankIdentificationNumber` | `string` | Required | Primary identifier for the bank. For more information, see
[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
**Constraints**: *Maximum Length*: `40` | -| `secondaryBankIdentificationNumber` | `string \| null \| undefined` | Optional | Secondary identifier for the bank. For more information, see
[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).
**Constraints**: *Maximum Length*: `40` | -| `debitMandateReferenceId` | `string \| null \| undefined` | Optional | Reference identifier that will be displayed to UK bank account owners
when collecting direct debit authorization. Only required for UK bank accounts. | -| `referenceId` | `string \| null \| undefined` | Optional | Client-provided identifier for linking the banking account to an entity
in a third-party system (for example, a bank account number or a user identifier). | -| `locationId` | `string \| null \| undefined` | Optional | The location to which the bank account belongs. | -| `status` | [`string`](../../doc/models/bank-account-status.md) | Required | Indicates the current verification status of a `BankAccount` object. | -| `creditable` | `boolean` | Required | Indicates whether it is possible for Square to send money to this bank account. | -| `debitable` | `boolean` | Required | Indicates whether it is possible for Square to take money from this
bank account. | -| `fingerprint` | `string \| null \| undefined` | Optional | A Square-assigned, unique identifier for the bank account based on the
account information. The account fingerprint can be used to compare account
entries and determine if the they represent the same real-world bank account. | -| `version` | `number \| undefined` | Optional | The current version of the `BankAccount`. | -| `bankName` | `string \| null \| undefined` | Optional | Read only. Name of actual financial institution.
For example "Bank of America".
**Constraints**: *Maximum Length*: `100` | - -## Example (as JSON) - -```json -{ - "id": "id2", - "account_number_suffix": "account_number_suffix6", - "country": "TT", - "currency": "MVR", - "account_type": "OTHER", - "holder_name": "holder_name8", - "primary_bank_identification_number": "primary_bank_identification_number0", - "secondary_bank_identification_number": "secondary_bank_identification_number2", - "debit_mandate_reference_id": "debit_mandate_reference_id2", - "reference_id": "reference_id0", - "location_id": "location_id6", - "status": "VERIFICATION_IN_PROGRESS", - "creditable": false, - "debitable": false, - "fingerprint": "fingerprint8" -} -``` - diff --git a/doc/models/batch-change-inventory-request.md b/doc/models/batch-change-inventory-request.md deleted file mode 100644 index fff4a91b9..000000000 --- a/doc/models/batch-change-inventory-request.md +++ /dev/null @@ -1,67 +0,0 @@ - -# Batch Change Inventory Request - -## Structure - -`BatchChangeInventoryRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A client-supplied, universally unique identifier (UUID) for the
request.

See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
[API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | -| `changes` | [`InventoryChange[] \| null \| undefined`](../../doc/models/inventory-change.md) | Optional | The set of physical counts and inventory adjustments to be made.
Changes are applied based on the client-supplied timestamp and may be sent
out of order. | -| `ignoreUnchangedCounts` | `boolean \| null \| undefined` | Optional | Indicates whether the current physical count should be ignored if
the quantity is unchanged since the last physical count. Default: `true`. | - -## Example (as JSON) - -```json -{ - "changes": [ - { - "physical_count": { - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "location_id": "C6W5YS5QM06F5", - "occurred_at": "2016-11-16T22:25:24.878Z", - "quantity": "53", - "reference_id": "1536bfbf-efed-48bf-b17d-a197141b2a92", - "state": "IN_STOCK", - "team_member_id": "LRK57NSQ5X7PUD05", - "id": "id2", - "catalog_object_type": "catalog_object_type6" - }, - "type": "PHYSICAL_COUNT", - "adjustment": { - "id": "id4", - "reference_id": "reference_id2", - "from_state": "IN_TRANSIT_TO", - "to_state": "SOLD", - "location_id": "location_id8" - }, - "transfer": { - "id": "id8", - "reference_id": "reference_id6", - "state": "RESERVED_FOR_SALE", - "from_location_id": "from_location_id0", - "to_location_id": "to_location_id0" - }, - "measurement_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 184 - } - } - ], - "idempotency_key": "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", - "ignore_unchanged_counts": true -} -``` - diff --git a/doc/models/batch-change-inventory-response.md b/doc/models/batch-change-inventory-response.md deleted file mode 100644 index ecd3fa0a0..000000000 --- a/doc/models/batch-change-inventory-response.md +++ /dev/null @@ -1,72 +0,0 @@ - -# Batch Change Inventory Response - -## Structure - -`BatchChangeInventoryResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `counts` | [`InventoryCount[] \| undefined`](../../doc/models/inventory-count.md) | Optional | The current counts for all objects referenced in the request. | -| `changes` | [`InventoryChange[] \| undefined`](../../doc/models/inventory-change.md) | Optional | Changes created for the request. | - -## Example (as JSON) - -```json -{ - "counts": [ - { - "calculated_at": "2016-11-16T22:28:01.223Z", - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "catalog_object_type": "ITEM_VARIATION", - "location_id": "C6W5YS5QM06F5", - "quantity": "53", - "state": "IN_STOCK" - } - ], - "errors": [], - "changes": [ - { - "type": "TRANSFER", - "physical_count": { - "id": "id2", - "reference_id": "reference_id0", - "catalog_object_id": "catalog_object_id6", - "catalog_object_type": "catalog_object_type6", - "state": "SUPPORTED_BY_NEWER_VERSION" - }, - "adjustment": { - "id": "id4", - "reference_id": "reference_id2", - "from_state": "IN_TRANSIT_TO", - "to_state": "SOLD", - "location_id": "location_id8" - }, - "transfer": { - "id": "id8", - "reference_id": "reference_id6", - "state": "RESERVED_FOR_SALE", - "from_location_id": "from_location_id0", - "to_location_id": "to_location_id0" - }, - "measurement_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 184 - } - } - ] -} -``` - diff --git a/doc/models/batch-delete-catalog-objects-request.md b/doc/models/batch-delete-catalog-objects-request.md deleted file mode 100644 index 359ef0655..000000000 --- a/doc/models/batch-delete-catalog-objects-request.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Batch Delete Catalog Objects Request - -## Structure - -`BatchDeleteCatalogObjectsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `objectIds` | `string[] \| null \| undefined` | Optional | The IDs of the CatalogObjects to be deleted. When an object is deleted, other objects
in the graph that depend on that object will be deleted as well (for example, deleting a
CatalogItem will delete its CatalogItemVariation. | - -## Example (as JSON) - -```json -{ - "object_ids": [ - "W62UWFY35CWMYGVWK6TWJDNI", - "AA27W3M2GGTF3H6AVPNB77CK" - ] -} -``` - diff --git a/doc/models/batch-delete-catalog-objects-response.md b/doc/models/batch-delete-catalog-objects-response.md deleted file mode 100644 index f4368f645..000000000 --- a/doc/models/batch-delete-catalog-objects-response.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Batch Delete Catalog Objects Response - -## Structure - -`BatchDeleteCatalogObjectsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `deletedObjectIds` | `string[] \| undefined` | Optional | The IDs of all CatalogObjects deleted by this request. | -| `deletedAt` | `string \| undefined` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this deletion in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". | - -## Example (as JSON) - -```json -{ - "deleted_at": "2016-11-16T22:25:24.878Z", - "deleted_object_ids": [ - "W62UWFY35CWMYGVWK6TWJDNI", - "AA27W3M2GGTF3H6AVPNB77CK" - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/batch-retrieve-catalog-objects-request.md b/doc/models/batch-retrieve-catalog-objects-request.md deleted file mode 100644 index e68862f2b..000000000 --- a/doc/models/batch-retrieve-catalog-objects-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Batch Retrieve Catalog Objects Request - -## Structure - -`BatchRetrieveCatalogObjectsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `objectIds` | `string[]` | Required | The IDs of the CatalogObjects to be retrieved. | -| `includeRelatedObjects` | `boolean \| null \| undefined` | Optional | If `true`, the response will include additional objects that are related to the
requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field
of the response. These objects are put in the `related_objects` field. Setting this to `true` is
helpful when the objects are needed for immediate display to a user.
This process only goes one level deep. Objects referenced by the related objects will not be included. For example,

if the `objects` field of the response contains a CatalogItem, its associated
CatalogCategory objects, CatalogTax objects, CatalogImage objects and
CatalogModifierLists will be returned in the `related_objects` field of the
response. If the `objects` field of the response contains a CatalogItemVariation,
its parent CatalogItem will be returned in the `related_objects` field of
the response.

Default value: `false` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The specific version of the catalog objects to be included in the response.
This allows you to retrieve historical versions of objects. The specified version value is matched against
the [CatalogObject](../../doc/models/catalog-object.md)s' `version` attribute. If not included, results will
be from the current version of the catalog. | -| `includeDeletedObjects` | `boolean \| null \| undefined` | Optional | Indicates whether to include (`true`) or not (`false`) in the response deleted objects, namely, those with the `is_deleted` attribute set to `true`. | -| `includeCategoryPathToRoot` | `boolean \| null \| undefined` | Optional | Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists
of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category
and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned
in the response payload. | - -## Example (as JSON) - -```json -{ - "include_related_objects": true, - "object_ids": [ - "W62UWFY35CWMYGVWK6TWJDNI", - "AA27W3M2GGTF3H6AVPNB77CK" - ], - "catalog_version": 190, - "include_deleted_objects": false, - "include_category_path_to_root": false -} -``` - diff --git a/doc/models/batch-retrieve-catalog-objects-response.md b/doc/models/batch-retrieve-catalog-objects-response.md deleted file mode 100644 index 693c41867..000000000 --- a/doc/models/batch-retrieve-catalog-objects-response.md +++ /dev/null @@ -1,276 +0,0 @@ - -# Batch Retrieve Catalog Objects Response - -## Structure - -`BatchRetrieveCatalogObjectsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `objects` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | A list of [CatalogObject](entity:CatalogObject)s returned. | -| `relatedObjects` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | A list of [CatalogObject](entity:CatalogObject)s referenced by the object in the `objects` field. | - -## Example (as JSON) - -```json -{ - "objects": [ - { - "id": "W62UWFY35CWMYGVWK6TWJDNI", - "is_deleted": false, - "item_data": { - "categories": [ - { - "id": "BJNQCF2FJ6S6UIDT65ABHLRX", - "ordinal": 0 - } - ], - "description": "Hot Leaf Juice", - "name": "Tea", - "tax_ids": [ - "HURXQOOAIC4IZSI2BEXQRYFY" - ], - "variations": [ - { - "id": "2TZFAOHWGG7PAK2QEXWYPZSP", - "is_deleted": false, - "item_variation_data": { - "item_id": "W62UWFY35CWMYGVWK6TWJDNI", - "name": "Mug", - "ordinal": 0, - "price_money": { - "amount": 150, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878 - } - ] - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "id": "AA27W3M2GGTF3H6AVPNB77CK", - "is_deleted": false, - "item_data": { - "categories": [ - { - "id": "BJNQCF2FJ6S6UIDT65ABHLRX", - "ordinal": 0 - } - ], - "description": "Hot Bean Juice", - "name": "Coffee", - "tax_ids": [ - "HURXQOOAIC4IZSI2BEXQRYFY" - ], - "variations": [ - { - "id": "LBTYIHNHU52WOIHWT7SNRIYH", - "is_deleted": false, - "item_variation_data": { - "item_id": "AA27W3M2GGTF3H6AVPNB77CK", - "name": "Regular", - "ordinal": 0, - "price_money": { - "amount": 250, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878 - }, - { - "id": "PKYIC7HGGKW5CYVSCVDEIMHY", - "is_deleted": false, - "item_variation_data": { - "item_id": "AA27W3M2GGTF3H6AVPNB77CK", - "name": "Large", - "ordinal": 1, - "price_money": { - "amount": 350, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878 - } - ] - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "related_objects": [ - { - "category_data": { - "name": "Beverages" - }, - "id": "BJNQCF2FJ6S6UIDT65ABHLRX", - "is_deleted": false, - "present_at_all_locations": true, - "type": "CATEGORY", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "id": "HURXQOOAIC4IZSI2BEXQRYFY", - "is_deleted": false, - "present_at_all_locations": true, - "tax_data": { - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "enabled": true, - "inclusion_type": "ADDITIVE", - "name": "Sales Tax", - "percentage": "5.0" - }, - "type": "TAX", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/batch-retrieve-inventory-changes-request.md b/doc/models/batch-retrieve-inventory-changes-request.md deleted file mode 100644 index 0f9f75c84..000000000 --- a/doc/models/batch-retrieve-inventory-changes-request.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Batch Retrieve Inventory Changes Request - -## Structure - -`BatchRetrieveInventoryChangesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `catalogObjectIds` | `string[] \| null \| undefined` | Optional | The filter to return results by `CatalogObject` ID.
The filter is only applicable when set. The default value is null. | -| `locationIds` | `string[] \| null \| undefined` | Optional | The filter to return results by `Location` ID.
The filter is only applicable when set. The default value is null. | -| `types` | [`string[] \| null \| undefined`](../../doc/models/inventory-change-type.md) | Optional | The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. | -| `states` | [`string[] \| null \| undefined`](../../doc/models/inventory-state.md) | Optional | The filter to return `ADJUSTMENT` query results by
`InventoryState`. This filter is only applied when set.
The default value is null. | -| `updatedAfter` | `string \| null \| undefined` | Optional | The filter to return results with their `calculated_at` value
after the given time as specified in an RFC 3339 timestamp.
The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | -| `updatedBefore` | `string \| null \| undefined` | Optional | The filter to return results with their `created_at` or `calculated_at` value
strictly before the given time as specified in an RFC 3339 timestamp.
The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | -| `limit` | `number \| null \| undefined` | Optional | The number of [records](entity:InventoryChange) to return.
**Constraints**: `>= 1`, `<= 1000` | - -## Example (as JSON) - -```json -{ - "catalog_object_ids": [ - "W62UWFY35CWMYGVWK6TWJDNI" - ], - "location_ids": [ - "C6W5YS5QM06F5" - ], - "states": [ - "IN_STOCK" - ], - "types": [ - "PHYSICAL_COUNT" - ], - "updated_after": "2016-11-01T00:00:00.000Z", - "updated_before": "2016-12-01T00:00:00.000Z" -} -``` - diff --git a/doc/models/batch-retrieve-inventory-changes-response.md b/doc/models/batch-retrieve-inventory-changes-response.md deleted file mode 100644 index f3c8283cd..000000000 --- a/doc/models/batch-retrieve-inventory-changes-response.md +++ /dev/null @@ -1,73 +0,0 @@ - -# Batch Retrieve Inventory Changes Response - -## Structure - -`BatchRetrieveInventoryChangesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `changes` | [`InventoryChange[] \| undefined`](../../doc/models/inventory-change.md) | Optional | The current calculated inventory changes for the requested objects
and locations. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.
See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | - -## Example (as JSON) - -```json -{ - "changes": [ - { - "physical_count": { - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "catalog_object_type": "ITEM_VARIATION", - "created_at": "2016-11-16T22:25:24.878Z", - "id": "46YDTW253DWGGK9HMAE6XCAO", - "location_id": "C6W5YS5QM06F5", - "occurred_at": "2016-11-16T22:24:49.028Z", - "quantity": "86", - "reference_id": "22c07cf4-5626-4224-89f9-691112019399", - "source": { - "application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0", - "name": "Square Point of Sale 4.37", - "product": "SQUARE_POS" - }, - "state": "IN_STOCK", - "team_member_id": "LRK57NSQ5X7PUD05" - }, - "type": "PHYSICAL_COUNT", - "adjustment": { - "id": "id4", - "reference_id": "reference_id2", - "from_state": "IN_TRANSIT_TO", - "to_state": "SOLD", - "location_id": "location_id8" - }, - "transfer": { - "id": "id8", - "reference_id": "reference_id6", - "state": "RESERVED_FOR_SALE", - "from_location_id": "from_location_id0", - "to_location_id": "to_location_id0" - }, - "measurement_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 184 - } - } - ], - "errors": [], - "cursor": "cursor2" -} -``` - diff --git a/doc/models/batch-retrieve-inventory-counts-request.md b/doc/models/batch-retrieve-inventory-counts-request.md deleted file mode 100644 index abc52c79a..000000000 --- a/doc/models/batch-retrieve-inventory-counts-request.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Batch Retrieve Inventory Counts Request - -## Structure - -`BatchRetrieveInventoryCountsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `catalogObjectIds` | `string[] \| null \| undefined` | Optional | The filter to return results by `CatalogObject` ID.
The filter is applicable only when set. The default is null. | -| `locationIds` | `string[] \| null \| undefined` | Optional | The filter to return results by `Location` ID.
This filter is applicable only when set. The default is null. | -| `updatedAfter` | `string \| null \| undefined` | Optional | The filter to return results with their `calculated_at` value
after the given time as specified in an RFC 3339 timestamp.
The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | -| `states` | [`string[] \| null \| undefined`](../../doc/models/inventory-state.md) | Optional | The filter to return results by `InventoryState`. The filter is only applicable when set.
Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
The default is null. | -| `limit` | `number \| null \| undefined` | Optional | The number of [records](entity:InventoryCount) to return.
**Constraints**: `>= 1`, `<= 1000` | - -## Example (as JSON) - -```json -{ - "catalog_object_ids": [ - "W62UWFY35CWMYGVWK6TWJDNI" - ], - "location_ids": [ - "59TNP9SA8VGDA" - ], - "updated_after": "2016-11-16T00:00:00.000Z", - "cursor": "cursor2", - "states": [ - "RESERVED_FOR_SALE", - "RETURNED_BY_CUSTOMER" - ] -} -``` - diff --git a/doc/models/batch-retrieve-inventory-counts-response.md b/doc/models/batch-retrieve-inventory-counts-response.md deleted file mode 100644 index a70116058..000000000 --- a/doc/models/batch-retrieve-inventory-counts-response.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Batch Retrieve Inventory Counts Response - -## Structure - -`BatchRetrieveInventoryCountsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `counts` | [`InventoryCount[] \| undefined`](../../doc/models/inventory-count.md) | Optional | The current calculated inventory counts for the requested objects
and locations. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | - -## Example (as JSON) - -```json -{ - "counts": [ - { - "calculated_at": "2016-11-16T22:28:01.223Z", - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "catalog_object_type": "ITEM_VARIATION", - "location_id": "59TNP9SA8VGDA", - "quantity": "79", - "state": "IN_STOCK" - } - ], - "errors": [], - "cursor": "cursor8" -} -``` - diff --git a/doc/models/batch-retrieve-orders-request.md b/doc/models/batch-retrieve-orders-request.md deleted file mode 100644 index 76f619149..000000000 --- a/doc/models/batch-retrieve-orders-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Batch Retrieve Orders Request - -Defines the fields that are included in requests to the -`BatchRetrieveOrders` endpoint. - -## Structure - -`BatchRetrieveOrdersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the location for these orders. This field is optional: omit it to retrieve
orders within the scope of the current authorization's merchant ID. | -| `orderIds` | `string[]` | Required | The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request. | - -## Example (as JSON) - -```json -{ - "location_id": "057P5VYJ4A5X1", - "order_ids": [ - "CAISEM82RcpmcFBM0TfOyiHV3es", - "CAISENgvlJ6jLWAzERDzjyHVybY" - ] -} -``` - diff --git a/doc/models/batch-retrieve-orders-response.md b/doc/models/batch-retrieve-orders-response.md deleted file mode 100644 index d5693842d..000000000 --- a/doc/models/batch-retrieve-orders-response.md +++ /dev/null @@ -1,121 +0,0 @@ - -# Batch Retrieve Orders Response - -Defines the fields that are included in the response body of -a request to the `BatchRetrieveOrders` endpoint. - -## Structure - -`BatchRetrieveOrdersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orders` | [`Order[] \| undefined`](../../doc/models/order.md) | Optional | The requested orders. This will omit any requested orders that do not exist. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "orders": [ - { - "id": "CAISEM82RcpmcFBM0TfOyiHV3es", - "line_items": [ - { - "base_price_money": { - "amount": 1599, - "currency": "USD" - }, - "name": "Awesome product", - "quantity": "1", - "total_money": { - "amount": 1599, - "currency": "USD" - }, - "uid": "945986d1-9586-11e6-ad5a-28cfe92138cf", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "base_price_money": { - "amount": 2000, - "currency": "USD" - }, - "name": "Another awesome product", - "quantity": "3", - "total_money": { - "amount": 6000, - "currency": "USD" - }, - "uid": "a8f4168c-9586-11e6-bdf0-28cfe92138cf", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ], - "location_id": "057P5VYJ4A5X1", - "reference_id": "my-order-001", - "total_money": { - "amount": 7599, - "currency": "USD" - }, - "source": { - "name": "name4" - }, - "customer_id": "customer_id0" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/batch-upsert-catalog-objects-request.md b/doc/models/batch-upsert-catalog-objects-request.md deleted file mode 100644 index 069f4a63c..000000000 --- a/doc/models/batch-upsert-catalog-objects-request.md +++ /dev/null @@ -1,261 +0,0 @@ - -# Batch Upsert Catalog Objects Request - -## Structure - -`BatchUpsertCatalogObjectsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A value you specify that uniquely identifies this
request among all your requests. A common way to create
a valid idempotency key is to use a Universally unique
identifier (UUID).

If you're unsure whether a particular request was successful,
you can reattempt it with the same idempotency key without
worrying about creating duplicate objects.

See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
**Constraints**: *Minimum Length*: `1` | -| `batches` | [`CatalogObjectBatch[]`](../../doc/models/catalog-object-batch.md) | Required | A batch of CatalogObjects to be inserted/updated atomically.
The objects within a batch will be inserted in an all-or-nothing fashion, i.e., if an error occurs
attempting to insert or update an object within a batch, the entire batch will be rejected. However, an error
in one batch will not affect other batches within the same request.

For each object, its `updated_at` field is ignored and replaced with a current [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), and its
`is_deleted` field must not be set to `true`.

To modify an existing object, supply its ID. To create a new object, use an ID starting
with `#`. These IDs may be used to create relationships between an object and attributes of
other objects that reference it. For example, you can create a CatalogItem with
ID `#ABC` and a CatalogItemVariation with its `item_id` attribute set to
`#ABC` in order to associate the CatalogItemVariation with its parent
CatalogItem.

Any `#`-prefixed IDs are valid only within a single atomic batch, and will be replaced by server-generated IDs.

Each batch may contain up to 1,000 objects. The total number of objects across all batches for a single request
may not exceed 10,000. If either of these limits is violated, an error will be returned and no objects will
be inserted or updated. | - -## Example (as JSON) - -```json -{ - "batches": [ - { - "objects": [ - { - "id": "#Tea", - "item_data": { - "categories": [ - { - "id": "#Beverages" - } - ], - "description_html": "

Hot Leaf Juice

", - "name": "Tea", - "tax_ids": [ - "#SalesTax" - ], - "variations": [ - { - "id": "#Tea_Mug", - "item_variation_data": { - "item_id": "#Tea", - "name": "Mug", - "price_money": { - "amount": 150, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION" - } - ] - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "updated_at2", - "version": 164, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "id": "#Coffee", - "item_data": { - "categories": [ - { - "id": "#Beverages" - } - ], - "description_html": "

Hot Bean Juice

", - "name": "Coffee", - "tax_ids": [ - "#SalesTax" - ], - "variations": [ - { - "id": "#Coffee_Regular", - "item_variation_data": { - "item_id": "#Coffee", - "name": "Regular", - "price_money": { - "amount": 250, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION" - }, - { - "id": "#Coffee_Large", - "item_variation_data": { - "item_id": "#Coffee", - "name": "Large", - "price_money": { - "amount": 350, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION" - } - ] - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "updated_at2", - "version": 164, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "category_data": { - "name": "Beverages" - }, - "id": "#Beverages", - "present_at_all_locations": true, - "type": "CATEGORY", - "updated_at": "updated_at2", - "version": 164, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "id": "#SalesTax", - "present_at_all_locations": true, - "tax_data": { - "applies_to_custom_amounts": true, - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "enabled": true, - "inclusion_type": "ADDITIVE", - "name": "Sales Tax", - "percentage": "5.0" - }, - "type": "TAX", - "updated_at": "updated_at2", - "version": 164, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ] - } - ], - "idempotency_key": "789ff020-f723-43a9-b4b5-43b5dc1fa3dc" -} -``` - diff --git a/doc/models/batch-upsert-catalog-objects-response.md b/doc/models/batch-upsert-catalog-objects-response.md deleted file mode 100644 index 0337d30f5..000000000 --- a/doc/models/batch-upsert-catalog-objects-response.md +++ /dev/null @@ -1,340 +0,0 @@ - -# Batch Upsert Catalog Objects Response - -## Structure - -`BatchUpsertCatalogObjectsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `objects` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | The created successfully created CatalogObjects. | -| `updatedAt` | `string \| undefined` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". | -| `idMappings` | [`CatalogIdMapping[] \| undefined`](../../doc/models/catalog-id-mapping.md) | Optional | The mapping between client and server IDs for this upsert. | - -## Example (as JSON) - -```json -{ - "id_mappings": [ - { - "client_object_id": "#Tea", - "object_id": "67GA7XA2FWMRYY2VCONTYZJR" - }, - { - "client_object_id": "#Coffee", - "object_id": "MQ4TZKOG3SR2EQI3TWEK4AH7" - }, - { - "client_object_id": "#Beverages", - "object_id": "XCS4SCGN4WQYE2VU4U3TKXEH" - }, - { - "client_object_id": "#SalesTax", - "object_id": "HP5VNYPKZKTNCKZ2Z5NPUH6A" - }, - { - "client_object_id": "#Tea_Mug", - "object_id": "CAJBHUIQH7ONTSZI2KTVOUP6" - }, - { - "client_object_id": "#Coffee_Regular", - "object_id": "GY2GXJTVVPQAPW43GFRR3NG6" - }, - { - "client_object_id": "#Coffee_Large", - "object_id": "JE6VHPSRQL6IWSN26C36CJ7W" - } - ], - "objects": [ - { - "created_at": "2023-11-30T19:24:35.4Z", - "id": "67GA7XA2FWMRYY2VCONTYZJR", - "is_deleted": false, - "item_data": { - "categories": [ - { - "id": "XCS4SCGN4WQYE2VU4U3TKXEH", - "ordinal": -2251731094208512 - } - ], - "description": "Hot Leaf Juice", - "description_html": "

Hot Leaf Juice

", - "description_plaintext": "Hot Leaf Juice", - "is_archived": false, - "is_taxable": true, - "name": "Tea", - "product_type": "REGULAR", - "tax_ids": [ - "HP5VNYPKZKTNCKZ2Z5NPUH6A" - ], - "variations": [ - { - "created_at": "2023-11-30T19:24:35.4Z", - "id": "CAJBHUIQH7ONTSZI2KTVOUP6", - "is_deleted": false, - "item_variation_data": { - "item_id": "67GA7XA2FWMRYY2VCONTYZJR", - "name": "Mug", - "ordinal": 0, - "price_money": { - "amount": 150, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING", - "sellable": true, - "stockable": true - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2023-11-30T19:24:35.4Z", - "version": 1701372275400 - } - ] - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "2023-11-30T19:24:35.4Z", - "version": 1701372275400, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "created_at": "2023-11-30T19:24:35.4Z", - "id": "MQ4TZKOG3SR2EQI3TWEK4AH7", - "is_deleted": false, - "item_data": { - "categories": [ - { - "id": "XCS4SCGN4WQYE2VU4U3TKXEH", - "ordinal": -2251662374731776 - } - ], - "description": "Hot Bean Juice", - "description_html": "

Hot Bean Juice

", - "description_plaintext": "Hot Bean Juice", - "is_archived": false, - "is_taxable": true, - "name": "Coffee", - "product_type": "REGULAR", - "tax_ids": [ - "HP5VNYPKZKTNCKZ2Z5NPUH6A" - ], - "variations": [ - { - "created_at": "2023-11-30T19:24:35.4Z", - "id": "GY2GXJTVVPQAPW43GFRR3NG6", - "is_deleted": false, - "item_variation_data": { - "item_id": "MQ4TZKOG3SR2EQI3TWEK4AH7", - "name": "Regular", - "ordinal": 0, - "price_money": { - "amount": 250, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING", - "sellable": true, - "stockable": true - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2023-11-30T19:24:35.4Z", - "version": 1701372275400 - }, - { - "created_at": "2023-11-30T19:24:35.4Z", - "id": "JE6VHPSRQL6IWSN26C36CJ7W", - "is_deleted": false, - "item_variation_data": { - "item_id": "MQ4TZKOG3SR2EQI3TWEK4AH7", - "name": "Large", - "ordinal": 1, - "price_money": { - "amount": 350, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING", - "sellable": true, - "stockable": true - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2023-11-30T19:24:35.4Z", - "version": 1701372275400 - } - ] - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "2023-11-30T19:24:35.4Z", - "version": 1701372275400, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "category_data": { - "category_type": "REGULAR_CATEGORY", - "is_top_level": true, - "name": "Beverages", - "online_visibility": true, - "parent_category": { - "ordinal": -2250837741010944 - } - }, - "created_at": "2023-11-30T19:24:35.4Z", - "id": "XCS4SCGN4WQYE2VU4U3TKXEH", - "is_deleted": false, - "present_at_all_locations": true, - "type": "CATEGORY", - "updated_at": "2023-11-30T19:24:35.4Z", - "version": 1701372275400, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "created_at": "2023-11-30T19:24:35.4Z", - "id": "HP5VNYPKZKTNCKZ2Z5NPUH6A", - "is_deleted": false, - "present_at_all_locations": true, - "tax_data": { - "applies_to_custom_amounts": true, - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "enabled": true, - "inclusion_type": "ADDITIVE", - "name": "Sales Tax", - "percentage": "5.0" - }, - "type": "TAX", - "updated_at": "2023-11-30T19:24:35.4Z", - "version": 1701372275400, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "updated_at": "updated_at6" -} -``` - diff --git a/doc/models/booking-booking-source.md b/doc/models/booking-booking-source.md deleted file mode 100644 index 38440cafb..000000000 --- a/doc/models/booking-booking-source.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Booking Booking Source - -Supported sources a booking was created from. - -## Enumeration - -`BookingBookingSource` - -## Fields - -| Name | Description | -| --- | --- | -| `FIRST_PARTY_MERCHANT` | The booking was created by a seller from a Square Appointments application, such as the Square Appointments Dashboard or a Square Appointments mobile app. | -| `FIRST_PARTY_BUYER` | The booking was created by a buyer from a Square Appointments application, such as Square Online Booking Site. | -| `THIRD_PARTY_BUYER` | The booking was created by a buyer created from a third-party application. | -| `API` | The booking was created by a seller or a buyer from the Square Bookings API. | - diff --git a/doc/models/booking-creator-details-creator-type.md b/doc/models/booking-creator-details-creator-type.md deleted file mode 100644 index 1e8c073f8..000000000 --- a/doc/models/booking-creator-details-creator-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Booking Creator Details Creator Type - -Supported types of a booking creator. - -## Enumeration - -`BookingCreatorDetailsCreatorType` - -## Fields - -| Name | Description | -| --- | --- | -| `TEAM_MEMBER` | The creator is of the seller type. | -| `CUSTOMER` | The creator is of the buyer type. | - diff --git a/doc/models/booking-creator-details.md b/doc/models/booking-creator-details.md deleted file mode 100644 index 7e0bbb586..000000000 --- a/doc/models/booking-creator-details.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Booking Creator Details - -Information about a booking creator. - -## Structure - -`BookingCreatorDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `creatorType` | [`string \| undefined`](../../doc/models/booking-creator-details-creator-type.md) | Optional | Supported types of a booking creator. | -| `teamMemberId` | `string \| undefined` | Optional | The ID of the team member who created the booking, when the booking creator is of the `TEAM_MEMBER` type.
Access to this field requires seller-level permissions.
**Constraints**: *Maximum Length*: `32` | -| `customerId` | `string \| undefined` | Optional | The ID of the customer who created the booking, when the booking creator is of the `CUSTOMER` type.
Access to this field requires seller-level permissions.
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "creator_type": "TEAM_MEMBER", - "team_member_id": "team_member_id4", - "customer_id": "customer_id2" -} -``` - diff --git a/doc/models/booking-custom-attribute-delete-request.md b/doc/models/booking-custom-attribute-delete-request.md deleted file mode 100644 index b2c94264f..000000000 --- a/doc/models/booking-custom-attribute-delete-request.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Booking Custom Attribute Delete Request - -Represents an individual delete request in a [BulkDeleteBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#bulk-delete-booking-custom-attributes) -request. An individual request contains a booking ID, the custom attribute to delete, and an optional idempotency key. - -## Structure - -`BookingCustomAttributeDeleteRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Required | The ID of the target [booking](entity:Booking).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `key` | `string` | Required | The key of the custom attribute to delete. This key must match the `key` of a
custom attribute definition in the Square seller account. If the requesting application is not
the definition owner, you must use the qualified key.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "booking_id": "booking_id0", - "key": "key6" -} -``` - diff --git a/doc/models/booking-custom-attribute-delete-response.md b/doc/models/booking-custom-attribute-delete-response.md deleted file mode 100644 index e89103154..000000000 --- a/doc/models/booking-custom-attribute-delete-response.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Booking Custom Attribute Delete Response - -Represents a response for an individual upsert request in a [BulkDeleteBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#bulk-delete-booking-custom-attributes) operation. - -## Structure - -`BookingCustomAttributeDeleteResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string \| undefined` | Optional | The ID of the [booking](entity:Booking) associated with the custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred while processing the individual request. | - -## Example (as JSON) - -```json -{ - "booking_id": "N3NCVYY3WS27HF0HKANA3R9FP8", - "errors": [] -} -``` - diff --git a/doc/models/booking-custom-attribute-upsert-request.md b/doc/models/booking-custom-attribute-upsert-request.md deleted file mode 100644 index 5caa73227..000000000 --- a/doc/models/booking-custom-attribute-upsert-request.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Booking Custom Attribute Upsert Request - -Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#bulk-upsert-booking-custom-attributes) -request. An individual request contains a booking ID, the custom attribute to create or update, -and an optional idempotency key. - -## Structure - -`BookingCustomAttributeUpsertRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string` | Required | The ID of the target [booking](entity:Booking).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this individual upsert request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "booking_id": "booking_id2", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key4" -} -``` - diff --git a/doc/models/booking-custom-attribute-upsert-response.md b/doc/models/booking-custom-attribute-upsert-response.md deleted file mode 100644 index b43d49209..000000000 --- a/doc/models/booking-custom-attribute-upsert-response.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Booking Custom Attribute Upsert Response - -Represents a response for an individual upsert request in a [BulkUpsertBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#bulk-upsert-booking-custom-attributes) operation. - -## Structure - -`BookingCustomAttributeUpsertResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingId` | `string \| undefined` | Optional | The ID of the [booking](entity:Booking) associated with the custom attribute. | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred while processing the individual request. | - -## Example (as JSON) - -```json -{ - "booking_id": "booking_id6", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/booking-status.md b/doc/models/booking-status.md deleted file mode 100644 index 3673283e8..000000000 --- a/doc/models/booking-status.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Booking Status - -Supported booking statuses. - -## Enumeration - -`BookingStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `PENDING` | An unaccepted booking. It is visible to both sellers and customers. | -| `CANCELLED_BY_CUSTOMER` | A customer-cancelled booking. It is visible to both the seller and the customer. | -| `CANCELLED_BY_SELLER` | A seller-cancelled booking. It is visible to both the seller and the customer. | -| `DECLINED` | A declined booking. It had once been pending, but was then declined by the seller. | -| `ACCEPTED` | An accepted booking agreed to or accepted by the seller. | -| `NO_SHOW` | A no-show booking. The booking was accepted at one time, but have now been marked as a no-show by
the seller because the client either missed the booking or cancelled it without enough notice. | - diff --git a/doc/models/booking.md b/doc/models/booking.md deleted file mode 100644 index 8b1a96f46..000000000 --- a/doc/models/booking.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Booking - -Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service -at a given location to a requesting customer in one or more appointment segments. - -## Structure - -`Booking` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique ID of this object representing a booking.
**Constraints**: *Maximum Length*: `36` | -| `version` | `number \| undefined` | Optional | The revision number for the booking used for optimistic concurrency. | -| `status` | [`string \| undefined`](../../doc/models/booking-status.md) | Optional | Supported booking statuses. | -| `createdAt` | `string \| undefined` | Optional | The RFC 3339 timestamp specifying the creation time of this booking. | -| `updatedAt` | `string \| undefined` | Optional | The RFC 3339 timestamp specifying the most recent update time of this booking. | -| `startAt` | `string \| null \| undefined` | Optional | The RFC 3339 timestamp specifying the starting time of this booking. | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the [Location](entity:Location) object representing the location where the booked service is provided. Once set when the booking is created, its value cannot be changed.
**Constraints**: *Maximum Length*: `32` | -| `customerId` | `string \| null \| undefined` | Optional | The ID of the [Customer](entity:Customer) object representing the customer receiving the booked service.
**Constraints**: *Maximum Length*: `192` | -| `customerNote` | `string \| null \| undefined` | Optional | The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](entity:CatalogObject) instance.
**Constraints**: *Maximum Length*: `4096` | -| `sellerNote` | `string \| null \| undefined` | Optional | The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](entity:CatalogObject) instance.
This field should not be visible to customers.
**Constraints**: *Maximum Length*: `4096` | -| `appointmentSegments` | [`AppointmentSegment[] \| null \| undefined`](../../doc/models/appointment-segment.md) | Optional | A list of appointment segments for this booking. | -| `transitionTimeMinutes` | `number \| undefined` | Optional | Additional time at the end of a booking.
Applications should not make this field visible to customers of a seller. | -| `allDay` | `boolean \| undefined` | Optional | Whether the booking is of a full business day. | -| `locationType` | [`string \| undefined`](../../doc/models/business-appointment-settings-booking-location-type.md) | Optional | Supported types of location where service is provided. | -| `creatorDetails` | [`BookingCreatorDetails \| undefined`](../../doc/models/booking-creator-details.md) | Optional | Information about a booking creator. | -| `source` | [`string \| undefined`](../../doc/models/booking-booking-source.md) | Optional | Supported sources a booking was created from. | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | - -## Example (as JSON) - -```json -{ - "id": "id4", - "version": 92, - "status": "PENDING", - "created_at": "created_at2", - "updated_at": "updated_at0" -} -``` - diff --git a/doc/models/break-type.md b/doc/models/break-type.md deleted file mode 100644 index 387b97cfa..000000000 --- a/doc/models/break-type.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Break Type - -A defined break template that sets an expectation for possible `Break` -instances on a `Shift`. - -## Structure - -`BreakType` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The UUID for this object.
**Constraints**: *Maximum Length*: `255` | -| `locationId` | `string` | Required | The ID of the business location this type of break applies to.
**Constraints**: *Minimum Length*: `1` | -| `breakName` | `string` | Required | A human-readable name for this type of break. The name is displayed to
employees in Square products.
**Constraints**: *Minimum Length*: `1` | -| `expectedDuration` | `string` | Required | Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of
this break. Precision less than minutes is truncated.

Example for break expected duration of 15 minutes: T15M
**Constraints**: *Minimum Length*: `1` | -| `isPaid` | `boolean` | Required | Whether this break counts towards time worked for compensation
purposes. | -| `version` | `number \| undefined` | Optional | Used for resolving concurrency issues. The request fails if the version
provided does not match the server version at the time of the request. If a value is not
provided, Square's servers execute a "blind" write; potentially
overwriting another writer's data. | -| `createdAt` | `string \| undefined` | Optional | A read-only timestamp in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | A read-only timestamp in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "location_id": "location_id8", - "break_name": "break_name4", - "expected_duration": "expected_duration0", - "is_paid": false, - "version": 236, - "created_at": "created_at8", - "updated_at": "updated_at0" -} -``` - diff --git a/doc/models/break.md b/doc/models/break.md deleted file mode 100644 index aca71b0c5..000000000 --- a/doc/models/break.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Break - -A record of an employee's break during a shift. - -## Structure - -`Break` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The UUID for this object. | -| `startAt` | `string` | Required | RFC 3339; follows the same timezone information as `Shift`. Precision up to
the minute is respected; seconds are truncated.
**Constraints**: *Minimum Length*: `1` | -| `endAt` | `string \| null \| undefined` | Optional | RFC 3339; follows the same timezone information as `Shift`. Precision up to
the minute is respected; seconds are truncated. | -| `breakTypeId` | `string` | Required | The `BreakType` that this `Break` was templated on.
**Constraints**: *Minimum Length*: `1` | -| `name` | `string` | Required | A human-readable name.
**Constraints**: *Minimum Length*: `1` | -| `expectedDuration` | `string` | Required | Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of
the break.
**Constraints**: *Minimum Length*: `1` | -| `isPaid` | `boolean` | Required | Whether this break counts towards time worked for compensation
purposes. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "start_at": "start_at8", - "end_at": "end_at4", - "break_type_id": "break_type_id2", - "name": "name6", - "expected_duration": "expected_duration8", - "is_paid": false -} -``` - diff --git a/doc/models/bulk-create-customer-data.md b/doc/models/bulk-create-customer-data.md deleted file mode 100644 index 60e0e1ff4..000000000 --- a/doc/models/bulk-create-customer-data.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Bulk Create Customer Data - -Defines the customer data provided in individual create requests for a -[BulkCreateCustomers](../../doc/api/customers.md#bulk-create-customers) operation. - -## Structure - -`BulkCreateCustomerData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `givenName` | `string \| null \| undefined` | Optional | The given name (that is, the first name) associated with the customer profile.
**Constraints**: *Maximum Length*: `300` | -| `familyName` | `string \| null \| undefined` | Optional | The family name (that is, the last name) associated with the customer profile.
**Constraints**: *Maximum Length*: `300` | -| `companyName` | `string \| null \| undefined` | Optional | A business name associated with the customer profile.
**Constraints**: *Maximum Length*: `500` | -| `nickname` | `string \| null \| undefined` | Optional | A nickname for the customer profile.
**Constraints**: *Maximum Length*: `100` | -| `emailAddress` | `string \| null \| undefined` | Optional | The email address associated with the customer profile.
**Constraints**: *Maximum Length*: `254` | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number associated with the customer profile. The phone number must be valid
and can contain 9–16 digits, with an optional `+` prefix and country code. For more information,
see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). | -| `referenceId` | `string \| null \| undefined` | Optional | An optional second ID used to associate the customer profile with an
entity in another system.
**Constraints**: *Maximum Length*: `100` | -| `note` | `string \| null \| undefined` | Optional | A custom note associated with the customer profile. | -| `birthday` | `string \| null \| undefined` | Optional | The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format.
For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21.
Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or
`0000` if a birth year is not specified. | -| `taxIds` | [`CustomerTaxIds \| undefined`](../../doc/models/customer-tax-ids.md) | Optional | Represents the tax ID associated with a [customer profile](../../doc/models/customer.md). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). | - -## Example (as JSON) - -```json -{ - "given_name": "given_name4", - "family_name": "family_name4", - "company_name": "company_name8", - "nickname": "nickname8", - "email_address": "email_address0" -} -``` - diff --git a/doc/models/bulk-create-customers-request.md b/doc/models/bulk-create-customers-request.md deleted file mode 100644 index a46c27240..000000000 --- a/doc/models/bulk-create-customers-request.md +++ /dev/null @@ -1,61 +0,0 @@ - -# Bulk Create Customers Request - -Defines the body parameters that can be included in requests to the -[BulkCreateCustomers](../../doc/api/customers.md#bulk-create-customers) endpoint. - -## Structure - -`BulkCreateCustomersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customers` | [`Record`](../../doc/models/bulk-create-customer-data.md) | Required | A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }`
key-value pairs.

Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
that uniquely identifies the create request. Each value contains the customer data used to create the
customer profile. | - -## Example (as JSON) - -```json -{ - "customers": { - "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "note": "a customer", - "phone_number": "+1-212-555-4240", - "reference_id": "YOUR_REFERENCE_ID", - "company_name": "company_name8", - "nickname": "nickname8" - }, - "d1689f23-b25d-4932-b2f0-aed00f5e2029": { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 601", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "email_address": "Marie.Curie@example.com", - "family_name": "Curie", - "given_name": "Marie", - "note": "another customer", - "phone_number": "+1-212-444-4240", - "reference_id": "YOUR_REFERENCE_ID", - "company_name": "company_name8", - "nickname": "nickname8" - } - } -} -``` - diff --git a/doc/models/bulk-create-customers-response.md b/doc/models/bulk-create-customers-response.md deleted file mode 100644 index 304433ffa..000000000 --- a/doc/models/bulk-create-customers-response.md +++ /dev/null @@ -1,150 +0,0 @@ - -# Bulk Create Customers Response - -Defines the fields included in the response body from the -[BulkCreateCustomers](../../doc/api/customers.md#bulk-create-customers) endpoint. - -## Structure - -`BulkCreateCustomersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `responses` | [`Record \| undefined`](../../doc/models/create-customer-response.md) | Optional | A map of responses that correspond to individual create requests, represented by
key-value pairs.

Each key is the idempotency key that was provided for a create request and each value
is the corresponding response.
If the request succeeds, the value is the new customer profile.
If the request fails, the value contains any errors that occurred during the request. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any top-level errors that prevented the bulk operation from running. | - -## Example (as JSON) - -```json -{ - "responses": { - "8bb76c4f-e35d-4c5b-90de-1194cd9179f4": { - "customer": { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "created_at": "2024-03-23T20:21:54.859Z", - "creation_source": "THIRD_PARTY", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "id": "8DDA5NZVBZFGAX0V3HPF81HHE0", - "note": "a customer", - "phone_number": "+1-212-555-4240", - "preferences": { - "email_unsubscribed": false - }, - "reference_id": "YOUR_REFERENCE_ID", - "updated_at": "2024-03-23T20:21:54.859Z", - "version": 0, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "d1689f23-b25d-4932-b2f0-aed00f5e2029": { - "customer": { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 601", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "created_at": "2024-03-23T20:21:54.859Z", - "creation_source": "THIRD_PARTY", - "email_address": "Marie.Curie@example.com", - "family_name": "Curie", - "given_name": "Marie", - "id": "N18CPRVXR5214XPBBA6BZQWF3C", - "note": "another customer", - "phone_number": "+1-212-444-4240", - "preferences": { - "email_unsubscribed": false - }, - "reference_id": "YOUR_REFERENCE_ID", - "updated_at": "2024-03-23T20:21:54.859Z", - "version": 0, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-create-team-members-request.md b/doc/models/bulk-create-team-members-request.md deleted file mode 100644 index 3756bd72b..000000000 --- a/doc/models/bulk-create-team-members-request.md +++ /dev/null @@ -1,60 +0,0 @@ - -# Bulk Create Team Members Request - -Represents a bulk create request for `TeamMember` objects. - -## Structure - -`BulkCreateTeamMembersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMembers` | [`Record`](../../doc/models/create-team-member-request.md) | Required | The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`.
The maximum number of create objects is 25.

If you include a team member's `wage_setting`, you must provide `job_id` for each job assignment. To get job IDs,
call [ListJobs](api-endpoint:Team-ListJobs). | - -## Example (as JSON) - -```json -{ - "team_members": { - "idempotency-key-1": { - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "YSGH2WBKG94QZ", - "GA2Y9HSJ8KRYT" - ] - }, - "email_address": "joe_doe@gmail.com", - "family_name": "Doe", - "given_name": "Joe", - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "id": "id6", - "is_owner": false, - "status": "ACTIVE" - }, - "idempotency_key": "idempotency_key4" - }, - "idempotency-key-2": { - "team_member": { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "email_address": "jane_smith@gmail.com", - "family_name": "Smith", - "given_name": "Jane", - "phone_number": "+14159223334", - "reference_id": "reference_id_2", - "id": "id6", - "is_owner": false, - "status": "ACTIVE" - }, - "idempotency_key": "idempotency_key4" - } - } -} -``` - diff --git a/doc/models/bulk-create-team-members-response.md b/doc/models/bulk-create-team-members-response.md deleted file mode 100644 index be00eadc8..000000000 --- a/doc/models/bulk-create-team-members-response.md +++ /dev/null @@ -1,95 +0,0 @@ - -# Bulk Create Team Members Response - -Represents a response from a bulk create request containing the created `TeamMember` objects or error messages. - -## Structure - -`BulkCreateTeamMembersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMembers` | [`Record \| undefined`](../../doc/models/create-team-member-response.md) | Optional | The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "team_members": { - "idempotency-key-1": { - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "GA2Y9HSJ8KRYT", - "YSGH2WBKG94QZ" - ] - }, - "email_address": "joe_doe@gmail.com", - "family_name": "Doe", - "given_name": "Joe", - "id": "ywhG1qfIOoqsHfVRubFV", - "is_owner": false, - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "status": "ACTIVE" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "idempotency-key-2": { - "team_member": { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "email_address": "jane_smith@gmail.com", - "family_name": "Smith", - "given_name": "Jane", - "id": "IF_Ncrg7fHhCqxVI9T6R", - "is_owner": false, - "phone_number": "+14159223334", - "reference_id": "reference_id_2", - "status": "ACTIVE" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-create-vendors-request.md b/doc/models/bulk-create-vendors-request.md deleted file mode 100644 index a5f9ca240..000000000 --- a/doc/models/bulk-create-vendors-request.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Bulk Create Vendors Request - -Represents an input to a call to [BulkCreateVendors](../../doc/api/vendors.md#bulk-create-vendors). - -## Structure - -`BulkCreateVendorsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `vendors` | [`Record`](../../doc/models/vendor.md) | Required | Specifies a set of new [Vendor](entity:Vendor) objects as represented by a collection of idempotency-key/`Vendor`-object pairs. | - -## Example (as JSON) - -```json -{ - "vendors": { - "key0": { - "id": "id8", - "created_at": "created_at6", - "updated_at": "updated_at4", - "name": "name8", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - } -} -``` - diff --git a/doc/models/bulk-create-vendors-response.md b/doc/models/bulk-create-vendors-response.md deleted file mode 100644 index f45e27994..000000000 --- a/doc/models/bulk-create-vendors-response.md +++ /dev/null @@ -1,80 +0,0 @@ - -# Bulk Create Vendors Response - -Represents an output from a call to [BulkCreateVendors](../../doc/api/vendors.md#bulk-create-vendors). - -## Structure - -`BulkCreateVendorsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `responses` | [`Record \| undefined`](../../doc/models/create-vendor-response.md) | Optional | A set of [CreateVendorResponse](entity:CreateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor)
objects or error responses for failed attempts. The set is represented by
a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The idempotency keys correspond to those specified
in the input. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "responses": { - "key0": { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - } - } -} -``` - diff --git a/doc/models/bulk-delete-booking-custom-attributes-request.md b/doc/models/bulk-delete-booking-custom-attributes-request.md deleted file mode 100644 index fc75ab336..000000000 --- a/doc/models/bulk-delete-booking-custom-attributes-request.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Bulk Delete Booking Custom Attributes Request - -Represents a [BulkDeleteBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#bulk-delete-booking-custom-attributes) request. - -## Structure - -`BulkDeleteBookingCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/booking-custom-attribute-delete-request.md) | Required | A map containing 1 to 25 individual Delete requests. For each request, provide an
arbitrary ID that is unique for this `BulkDeleteBookingCustomAttributes` request and the
information needed to delete a custom attribute. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "booking_id": "booking_id4", - "key": "key0" - } - } -} -``` - diff --git a/doc/models/bulk-delete-booking-custom-attributes-response.md b/doc/models/bulk-delete-booking-custom-attributes-response.md deleted file mode 100644 index a2e35eb1e..000000000 --- a/doc/models/bulk-delete-booking-custom-attributes-response.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Bulk Delete Booking Custom Attributes Response - -Represents a [BulkDeleteBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#bulk-delete-booking-custom-attributes) response, -which contains a map of responses that each corresponds to an individual delete request. - -## Structure - -`BulkDeleteBookingCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record \| undefined`](../../doc/models/booking-custom-attribute-delete-response.md) | Optional | A map of responses that correspond to individual delete requests. Each response has the
same ID as the corresponding request and contains `booking_id` and `errors` field. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [], - "values": { - "id1": { - "booking_id": "N3NCVYY3WS27HF0HKANA3R9FP8", - "errors": [] - }, - "id2": { - "booking_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM", - "errors": [] - }, - "id3": { - "booking_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM", - "errors": [] - } - } -} -``` - diff --git a/doc/models/bulk-delete-customers-request.md b/doc/models/bulk-delete-customers-request.md deleted file mode 100644 index 6e3b16ca6..000000000 --- a/doc/models/bulk-delete-customers-request.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Bulk Delete Customers Request - -Defines the body parameters that can be included in requests to the -[BulkDeleteCustomers](../../doc/api/customers.md#bulk-delete-customers) endpoint. - -## Structure - -`BulkDeleteCustomersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerIds` | `string[]` | Required | The IDs of the [customer profiles](entity:Customer) to delete. | - -## Example (as JSON) - -```json -{ - "customer_ids": [ - "8DDA5NZVBZFGAX0V3HPF81HHE0", - "N18CPRVXR5214XPBBA6BZQWF3C", - "2GYD7WNXF7BJZW1PMGNXZ3Y8M8" - ] -} -``` - diff --git a/doc/models/bulk-delete-customers-response.md b/doc/models/bulk-delete-customers-response.md deleted file mode 100644 index 6248a455c..000000000 --- a/doc/models/bulk-delete-customers-response.md +++ /dev/null @@ -1,94 +0,0 @@ - -# Bulk Delete Customers Response - -Defines the fields included in the response body from the -[BulkDeleteCustomers](../../doc/api/customers.md#bulk-delete-customers) endpoint. - -## Structure - -`BulkDeleteCustomersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `responses` | [`Record \| undefined`](../../doc/models/delete-customer-response.md) | Optional | A map of responses that correspond to individual delete requests, represented by
key-value pairs.

Each key is the customer ID that was specified for a delete request and each value
is the corresponding response.
If the request succeeds, the value is an empty object (`{ }`).
If the request fails, the value contains any errors that occurred during the request. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any top-level errors that prevented the bulk operation from running. | - -## Example (as JSON) - -```json -{ - "responses": { - "2GYD7WNXF7BJZW1PMGNXZ3Y8M8": { - "errors": [ - { - "category": "INVALID_REQUEST_ERROR", - "code": "NOT_FOUND", - "detail": "Customer with ID `2GYD7WNXF7BJZW1PMGNXZ3Y8M8` not found.", - "field": "field4" - } - ] - }, - "8DDA5NZVBZFGAX0V3HPF81HHE0": { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "N18CPRVXR5214XPBBA6BZQWF3C": { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md b/doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md deleted file mode 100644 index bad552070..000000000 --- a/doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Bulk Delete Location Custom Attributes Request Location Custom Attribute Delete Request - -Represents an individual delete request in a [BulkDeleteLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-delete-location-custom-attributes) -request. An individual request contains an optional ID of the associated custom attribute definition -and optional key of the associated custom attribute definition. - -## Structure - -`BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string \| undefined` | Optional | The key of the associated custom attribute definition.
Represented as a qualified key if the requesting app is not the definition owner.
**Constraints**: *Pattern*: `^([a-zA-Z0-9_-]+:)?[a-zA-Z0-9_-]{1,60}$` | - -## Example (as JSON) - -```json -{ - "key": "key8" -} -``` - diff --git a/doc/models/bulk-delete-location-custom-attributes-request.md b/doc/models/bulk-delete-location-custom-attributes-request.md deleted file mode 100644 index a1aef2f59..000000000 --- a/doc/models/bulk-delete-location-custom-attributes-request.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Bulk Delete Location Custom Attributes Request - -Represents a [BulkDeleteLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-delete-location-custom-attributes) request. - -## Structure - -`BulkDeleteLocationCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-delete-location-custom-attributes-request-location-custom-attribute-delete-request.md) | Required | The data used to update the `CustomAttribute` objects.
The keys must be unique and are used to map to the corresponding response. | - -## Example (as JSON) - -```json -{ - "values": { - "id1": { - "key": "bestseller", - "location_id": "L0TBCBTB7P8RQ" - }, - "id2": { - "key": "bestseller", - "location_id": "L9XMD04V3STJX" - }, - "id3": { - "key": "phone-number", - "location_id": "L0TBCBTB7P8RQ" - } - } -} -``` - diff --git a/doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md b/doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md deleted file mode 100644 index 2126937f1..000000000 --- a/doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Bulk Delete Location Custom Attributes Response Location Custom Attribute Delete Response - -Represents an individual delete response in a [BulkDeleteLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-delete-location-custom-attributes) -request. - -## Structure - -`BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| undefined` | Optional | The ID of the location associated with the custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request | - -## Example (as JSON) - -```json -{ - "errors": [], - "location_id": "L0TBCBTB7P8RQ" -} -``` - diff --git a/doc/models/bulk-delete-location-custom-attributes-response.md b/doc/models/bulk-delete-location-custom-attributes-response.md deleted file mode 100644 index aa13e2c73..000000000 --- a/doc/models/bulk-delete-location-custom-attributes-response.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Bulk Delete Location Custom Attributes Response - -Represents a [BulkDeleteLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-delete-location-custom-attributes) response, -which contains a map of responses that each corresponds to an individual delete request. - -## Structure - -`BulkDeleteLocationCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-delete-location-custom-attributes-response-location-custom-attribute-delete-response.md) | Required | A map of responses that correspond to individual delete requests. Each response has the
same key as the corresponding request. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "values": { - "id1": { - "errors": [], - "location_id": "L0TBCBTB7P8RQ" - }, - "id2": { - "errors": [], - "location_id": "L9XMD04V3STJX" - }, - "id3": { - "errors": [], - "location_id": "L0TBCBTB7P8RQ" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-delete-merchant-custom-attributes-request-merchant-custom-attribute-delete-request.md b/doc/models/bulk-delete-merchant-custom-attributes-request-merchant-custom-attribute-delete-request.md deleted file mode 100644 index 6c60937ba..000000000 --- a/doc/models/bulk-delete-merchant-custom-attributes-request-merchant-custom-attribute-delete-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Bulk Delete Merchant Custom Attributes Request Merchant Custom Attribute Delete Request - -Represents an individual delete request in a [BulkDeleteMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-delete-merchant-custom-attributes) -request. An individual request contains an optional ID of the associated custom attribute definition -and optional key of the associated custom attribute definition. - -## Structure - -`BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string \| undefined` | Optional | The key of the associated custom attribute definition.
Represented as a qualified key if the requesting app is not the definition owner.
**Constraints**: *Pattern*: `^([a-zA-Z0-9_-]+:)?[a-zA-Z0-9_-]{1,60}$` | - -## Example (as JSON) - -```json -{ - "key": "key0" -} -``` - diff --git a/doc/models/bulk-delete-merchant-custom-attributes-request.md b/doc/models/bulk-delete-merchant-custom-attributes-request.md deleted file mode 100644 index 77572b02e..000000000 --- a/doc/models/bulk-delete-merchant-custom-attributes-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Bulk Delete Merchant Custom Attributes Request - -Represents a [BulkDeleteMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-delete-merchant-custom-attributes) request. - -## Structure - -`BulkDeleteMerchantCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-delete-merchant-custom-attributes-request-merchant-custom-attribute-delete-request.md) | Required | The data used to update the `CustomAttribute` objects.
The keys must be unique and are used to map to the corresponding response. | - -## Example (as JSON) - -```json -{ - "values": { - "id1": { - "key": "alternative_seller_name", - "merchant_id": "DM7VKY8Q63GNP" - }, - "id2": { - "key": "has_seen_tutorial", - "merchant_id": "DM7VKY8Q63GNP" - } - } -} -``` - diff --git a/doc/models/bulk-delete-merchant-custom-attributes-response-merchant-custom-attribute-delete-response.md b/doc/models/bulk-delete-merchant-custom-attributes-response-merchant-custom-attribute-delete-response.md deleted file mode 100644 index c852cd851..000000000 --- a/doc/models/bulk-delete-merchant-custom-attributes-response-merchant-custom-attribute-delete-response.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Bulk Delete Merchant Custom Attributes Response Merchant Custom Attribute Delete Response - -Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-delete-merchant-custom-attributes) -request. - -## Structure - -`BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred while processing the individual MerchantCustomAttributeDeleteRequest request | - -## Example (as JSON) - -```json -{ - "errors": [], - "merchant_id": "DM7VKY8Q63GNP" -} -``` - diff --git a/doc/models/bulk-delete-merchant-custom-attributes-response.md b/doc/models/bulk-delete-merchant-custom-attributes-response.md deleted file mode 100644 index 0a40638a2..000000000 --- a/doc/models/bulk-delete-merchant-custom-attributes-response.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Bulk Delete Merchant Custom Attributes Response - -Represents a [BulkDeleteMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-delete-merchant-custom-attributes) response, -which contains a map of responses that each corresponds to an individual delete request. - -## Structure - -`BulkDeleteMerchantCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-delete-merchant-custom-attributes-response-merchant-custom-attribute-delete-response.md) | Required | A map of responses that correspond to individual delete requests. Each response has the
same key as the corresponding request. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "values": { - "id1": { - "errors": [], - "merchant_id": "DM7VKY8Q63GNP" - }, - "id2": { - "errors": [], - "merchant_id": "DM7VKY8Q63GNP" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-delete-order-custom-attributes-request-delete-custom-attribute.md b/doc/models/bulk-delete-order-custom-attributes-request-delete-custom-attribute.md deleted file mode 100644 index 2cecded46..000000000 --- a/doc/models/bulk-delete-order-custom-attributes-request-delete-custom-attribute.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Bulk Delete Order Custom Attributes Request Delete Custom Attribute - -Represents one delete within the bulk operation. - -## Structure - -`BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string \| undefined` | Optional | The key of the custom attribute to delete. This key must match the key
of an existing custom attribute definition.
**Constraints**: *Minimum Length*: `1`, *Pattern*: `^([a-zA-Z0-9_-]+:)?[a-zA-Z0-9_-]{1,60}$` | -| `orderId` | `string` | Required | The ID of the target [order](entity:Order).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "key": "key2", - "order_id": "order_id6" -} -``` - diff --git a/doc/models/bulk-delete-order-custom-attributes-request.md b/doc/models/bulk-delete-order-custom-attributes-request.md deleted file mode 100644 index 576ce6c91..000000000 --- a/doc/models/bulk-delete-order-custom-attributes-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Bulk Delete Order Custom Attributes Request - -Represents a bulk delete request for one or more order custom attributes. - -## Structure - -`BulkDeleteOrderCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-delete-order-custom-attributes-request-delete-custom-attribute.md) | Required | A map of requests that correspond to individual delete operations for custom attributes. | - -## Example (as JSON) - -```json -{ - "values": { - "cover-count": { - "key": "cover-count", - "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" - }, - "table-number": { - "key": "table-number", - "order_id": "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" - } - } -} -``` - diff --git a/doc/models/bulk-delete-order-custom-attributes-response.md b/doc/models/bulk-delete-order-custom-attributes-response.md deleted file mode 100644 index 968c29259..000000000 --- a/doc/models/bulk-delete-order-custom-attributes-response.md +++ /dev/null @@ -1,65 +0,0 @@ - -# Bulk Delete Order Custom Attributes Response - -Represents a response from deleting one or more order custom attributes. - -## Structure - -`BulkDeleteOrderCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `values` | [`Record`](../../doc/models/delete-order-custom-attribute-response.md) | Required | A map of responses that correspond to individual delete requests. Each response has the same ID
as the corresponding request and contains either a `custom_attribute` or an `errors` field. | - -## Example (as JSON) - -```json -{ - "values": { - "cover-count": { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "table-number": { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-retrieve-bookings-request.md b/doc/models/bulk-retrieve-bookings-request.md deleted file mode 100644 index fc710e905..000000000 --- a/doc/models/bulk-retrieve-bookings-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Bulk Retrieve Bookings Request - -Request payload for bulk retrieval of bookings. - -## Structure - -`BulkRetrieveBookingsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookingIds` | `string[]` | Required | A non-empty list of [Booking](entity:Booking) IDs specifying bookings to retrieve. | - -## Example (as JSON) - -```json -{ - "booking_ids": [ - "booking_ids8", - "booking_ids9", - "booking_ids0" - ] -} -``` - diff --git a/doc/models/bulk-retrieve-bookings-response.md b/doc/models/bulk-retrieve-bookings-response.md deleted file mode 100644 index eab550445..000000000 --- a/doc/models/bulk-retrieve-bookings-response.md +++ /dev/null @@ -1,89 +0,0 @@ - -# Bulk Retrieve Bookings Response - -Response payload for bulk retrieval of bookings. - -## Structure - -`BulkRetrieveBookingsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookings` | [`Record \| undefined`](../../doc/models/retrieve-booking-response.md) | Optional | Requested bookings returned as a map containing `booking_id` as the key and `RetrieveBookingResponse` as the value. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "bookings": { - "sc3p3m7dvctfr1": { - "booking": { - "all_day": false, - "appointment_segments": [ - { - "any_team_member": false, - "duration_minutes": 60, - "service_variation_id": "VG4FYBKK3UL6UITOEYQ6MFLS", - "service_variation_version": 1641341724039, - "team_member_id": "TMjiqI3PxyLMKr4k" - } - ], - "created_at": "2023-04-26T18:19:21Z", - "customer_id": "4TDWKN9E8165X8Z77MRS0VFMJM", - "id": "sc3p3m7dvctfr1", - "location_id": "LY6WNBPVM6VGV", - "start_at": "2023-05-01T14:00:00Z", - "status": "ACCEPTED", - "updated_at": "2023-04-26T18:19:21Z", - "version": 0 - }, - "errors": [] - }, - "tdegug1dvctdef": { - "errors": [ - { - "category": "INVALID_REQUEST_ERROR", - "code": "NOT_FOUND", - "detail": "Specified booking was not found.", - "field": "booking_id" - } - ], - "booking": { - "id": "id4", - "version": 156, - "status": "CANCELLED_BY_SELLER", - "created_at": "created_at2", - "updated_at": "updated_at0" - } - }, - "tdegug1fqni3wh": { - "booking": { - "all_day": false, - "appointment_segments": [ - { - "any_team_member": false, - "duration_minutes": 60, - "service_variation_id": "VG4FYBKK3UL6UITOEYQ6MFLS", - "service_variation_version": 1641341724039, - "team_member_id": "TMjiqI3PxyLMKr4k" - } - ], - "created_at": "2023-04-26T18:19:30Z", - "customer_id": "4TDWKN9E8165X8Z77MRS0VFMJM", - "id": "tdegug1fqni3wh", - "location_id": "LY6WNBPVM6VGV", - "start_at": "2023-05-02T14:00:00Z", - "status": "ACCEPTED", - "updated_at": "2023-04-26T18:19:30Z", - "version": 0 - }, - "errors": [] - } - }, - "errors": [] -} -``` - diff --git a/doc/models/bulk-retrieve-customers-request.md b/doc/models/bulk-retrieve-customers-request.md deleted file mode 100644 index 105de43db..000000000 --- a/doc/models/bulk-retrieve-customers-request.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Bulk Retrieve Customers Request - -Defines the body parameters that can be included in requests to the -[BulkRetrieveCustomers](../../doc/api/customers.md#bulk-retrieve-customers) endpoint. - -## Structure - -`BulkRetrieveCustomersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerIds` | `string[]` | Required | The IDs of the [customer profiles](entity:Customer) to retrieve. | - -## Example (as JSON) - -```json -{ - "customer_ids": [ - "8DDA5NZVBZFGAX0V3HPF81HHE0", - "N18CPRVXR5214XPBBA6BZQWF3C", - "2GYD7WNXF7BJZW1PMGNXZ3Y8M8" - ] -} -``` - diff --git a/doc/models/bulk-retrieve-customers-response.md b/doc/models/bulk-retrieve-customers-response.md deleted file mode 100644 index bae160c68..000000000 --- a/doc/models/bulk-retrieve-customers-response.md +++ /dev/null @@ -1,142 +0,0 @@ - -# Bulk Retrieve Customers Response - -Defines the fields included in the response body from the -[BulkRetrieveCustomers](../../doc/api/customers.md#bulk-retrieve-customers) endpoint. - -## Structure - -`BulkRetrieveCustomersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `responses` | [`Record \| undefined`](../../doc/models/retrieve-customer-response.md) | Optional | A map of responses that correspond to individual retrieve requests, represented by
key-value pairs.

Each key is the customer ID that was specified for a retrieve request and each value
is the corresponding response.
If the request succeeds, the value is the requested customer profile.
If the request fails, the value contains any errors that occurred during the request. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any top-level errors that prevented the bulk operation from running. | - -## Example (as JSON) - -```json -{ - "responses": { - "2GYD7WNXF7BJZW1PMGNXZ3Y8M8": { - "errors": [ - { - "category": "INVALID_REQUEST_ERROR", - "code": "NOT_FOUND", - "detail": "Customer with ID `2GYD7WNXF7BJZW1PMGNXZ3Y8M8` not found.", - "field": "field4" - } - ], - "customer": { - "id": "id0", - "created_at": "created_at2", - "updated_at": "updated_at4", - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ], - "given_name": "given_name2" - } - }, - "8DDA5NZVBZFGAX0V3HPF81HHE0": { - "customer": { - "birthday": "1897-07-24", - "created_at": "2024-01-19T00:27:54.59Z", - "creation_source": "THIRD_PARTY", - "email_address": "New.Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "id": "8DDA5NZVBZFGAX0V3HPF81HHE0", - "note": "updated customer note", - "preferences": { - "email_unsubscribed": false - }, - "updated_at": "2024-01-19T00:38:06Z", - "version": 3 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "N18CPRVXR5214XPBBA6BZQWF3C": { - "customer": { - "created_at": "2024-01-19T00:27:54.59Z", - "creation_source": "THIRD_PARTY", - "family_name": "Curie", - "given_name": "Marie", - "id": "N18CPRVXR5214XPBBA6BZQWF3C", - "preferences": { - "email_unsubscribed": false - }, - "updated_at": "2024-01-19T00:38:06Z", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-retrieve-team-member-booking-profiles-request.md b/doc/models/bulk-retrieve-team-member-booking-profiles-request.md deleted file mode 100644 index a14fa8fca..000000000 --- a/doc/models/bulk-retrieve-team-member-booking-profiles-request.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Bulk Retrieve Team Member Booking Profiles Request - -Request payload for the [BulkRetrieveTeamMemberBookingProfiles](../../doc/api/bookings.md#bulk-retrieve-team-member-booking-profiles) endpoint. - -## Structure - -`BulkRetrieveTeamMemberBookingProfilesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberIds` | `string[]` | Required | A non-empty list of IDs of team members whose booking profiles you want to retrieve. | - -## Example (as JSON) - -```json -{ - "team_member_ids": [ - "team_member_ids1", - "team_member_ids2" - ] -} -``` - diff --git a/doc/models/bulk-retrieve-team-member-booking-profiles-response.md b/doc/models/bulk-retrieve-team-member-booking-profiles-response.md deleted file mode 100644 index c4a2465a0..000000000 --- a/doc/models/bulk-retrieve-team-member-booking-profiles-response.md +++ /dev/null @@ -1,59 +0,0 @@ - -# Bulk Retrieve Team Member Booking Profiles Response - -Response payload for the [BulkRetrieveTeamMemberBookingProfiles](../../doc/api/bookings.md#bulk-retrieve-team-member-booking-profiles) endpoint. - -## Structure - -`BulkRetrieveTeamMemberBookingProfilesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberBookingProfiles` | [`Record \| undefined`](../../doc/models/retrieve-team-member-booking-profile-response.md) | Optional | The returned team members' booking profiles, as a map with `team_member_id` as the key and [TeamMemberBookingProfile](entity:TeamMemberBookingProfile) the value. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [], - "team_member_booking_profiles": { - "TMXUrsBWWcHTt79t": { - "errors": [ - { - "category": "INVALID_REQUEST_ERROR", - "code": "NOT_FOUND", - "detail": "Resource not found.", - "field": "field4" - } - ], - "team_member_booking_profile": { - "team_member_id": "team_member_id2", - "description": "description2", - "display_name": "display_name2", - "is_bookable": false, - "profile_image_url": "profile_image_url8" - } - }, - "TMaJcbiRqPIGZuS9": { - "errors": [], - "team_member_booking_profile": { - "display_name": "Sandbox Staff 1", - "is_bookable": true, - "team_member_id": "TMaJcbiRqPIGZuS9" - } - }, - "TMtdegug1fqni3wh": { - "errors": [], - "team_member_booking_profile": { - "display_name": "Sandbox Staff 2", - "is_bookable": true, - "team_member_id": "TMtdegug1fqni3wh" - } - } - } -} -``` - diff --git a/doc/models/bulk-retrieve-vendors-request.md b/doc/models/bulk-retrieve-vendors-request.md deleted file mode 100644 index 23e96b2d2..000000000 --- a/doc/models/bulk-retrieve-vendors-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Bulk Retrieve Vendors Request - -Represents an input to a call to [BulkRetrieveVendors](../../doc/api/vendors.md#bulk-retrieve-vendors). - -## Structure - -`BulkRetrieveVendorsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `vendorIds` | `string[] \| null \| undefined` | Optional | IDs of the [Vendor](entity:Vendor) objects to retrieve. | - -## Example (as JSON) - -```json -{ - "vendor_ids": [ - "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4" - ] -} -``` - diff --git a/doc/models/bulk-retrieve-vendors-response.md b/doc/models/bulk-retrieve-vendors-response.md deleted file mode 100644 index c6138d43f..000000000 --- a/doc/models/bulk-retrieve-vendors-response.md +++ /dev/null @@ -1,109 +0,0 @@ - -# Bulk Retrieve Vendors Response - -Represents an output from a call to [BulkRetrieveVendors](../../doc/api/vendors.md#bulk-retrieve-vendors). - -## Structure - -`BulkRetrieveVendorsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `responses` | [`Record \| undefined`](../../doc/models/retrieve-vendor-response.md) | Optional | The set of [RetrieveVendorResponse](entity:RetrieveVendorResponse) objects encapsulating successfully retrieved [Vendor](entity:Vendor)
objects or error responses for failed attempts. The set is represented by
a collection of `Vendor`-ID/`Vendor`-object or `Vendor`-ID/error-object pairs. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "responses": { - "key0": { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - }, - "key1": { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - } - } -} -``` - diff --git a/doc/models/bulk-swap-plan-request.md b/doc/models/bulk-swap-plan-request.md deleted file mode 100644 index 2b448d4e7..000000000 --- a/doc/models/bulk-swap-plan-request.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Bulk Swap Plan Request - -Defines input parameters in a call to the -[BulkSwapPlan](../../doc/api/subscriptions.md#bulk-swap-plan) endpoint. - -## Structure - -`BulkSwapPlanRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `newPlanVariationId` | `string` | Required | The ID of the new subscription plan variation.

This field is required.
**Constraints**: *Minimum Length*: `1` | -| `oldPlanVariationId` | `string` | Required | The ID of the plan variation whose subscriptions should be swapped. Active subscriptions
using this plan variation will be subscribed to the new plan variation on their next billing
day.
**Constraints**: *Minimum Length*: `1` | -| `locationId` | `string` | Required | The ID of the location to associate with the swapped subscriptions.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "location_id": "S8GWD5R9QB376", - "new_plan_variation_id": "FQ7CDXXWSLUJRPM3GFJSJGZ7", - "old_plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H" -} -``` - diff --git a/doc/models/bulk-swap-plan-response.md b/doc/models/bulk-swap-plan-response.md deleted file mode 100644 index 24f7a8144..000000000 --- a/doc/models/bulk-swap-plan-response.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Bulk Swap Plan Response - -Defines output parameters in a response of the -[BulkSwapPlan](../../doc/api/subscriptions.md#bulk-swap-plan) endpoint. - -## Structure - -`BulkSwapPlanResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `affectedSubscriptions` | `number \| undefined` | Optional | The number of affected subscriptions. | - -## Example (as JSON) - -```json -{ - "affected_subscriptions": 12, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-update-customer-data.md b/doc/models/bulk-update-customer-data.md deleted file mode 100644 index 1f73a64e5..000000000 --- a/doc/models/bulk-update-customer-data.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Bulk Update Customer Data - -Defines the customer data provided in individual update requests for a -[BulkUpdateCustomers](../../doc/api/customers.md#bulk-update-customers) operation. - -## Structure - -`BulkUpdateCustomerData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `givenName` | `string \| null \| undefined` | Optional | The given name (that is, the first name) associated with the customer profile.
**Constraints**: *Maximum Length*: `300` | -| `familyName` | `string \| null \| undefined` | Optional | The family name (that is, the last name) associated with the customer profile.
**Constraints**: *Maximum Length*: `300` | -| `companyName` | `string \| null \| undefined` | Optional | A business name associated with the customer profile.
**Constraints**: *Maximum Length*: `500` | -| `nickname` | `string \| null \| undefined` | Optional | A nickname for the customer profile.
**Constraints**: *Maximum Length*: `100` | -| `emailAddress` | `string \| null \| undefined` | Optional | The email address associated with the customer profile.
**Constraints**: *Maximum Length*: `254` | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number associated with the customer profile. The phone number must be valid
and can contain 9–16 digits, with an optional `+` prefix and country code. For more information,
see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). | -| `referenceId` | `string \| null \| undefined` | Optional | An optional second ID used to associate the customer profile with an
entity in another system.
**Constraints**: *Maximum Length*: `100` | -| `note` | `string \| null \| undefined` | Optional | An custom note associates with the customer profile. | -| `birthday` | `string \| null \| undefined` | Optional | The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format.
For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21.
Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or
`0000` if a birth year is not specified. | -| `taxIds` | [`CustomerTaxIds \| undefined`](../../doc/models/customer-tax-ids.md) | Optional | Represents the tax ID associated with a [customer profile](../../doc/models/customer.md). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). | -| `version` | `bigint \| undefined` | Optional | The current version of the customer profile.

As a best practice, you should include this field to enable
[optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
control. | - -## Example (as JSON) - -```json -{ - "given_name": "given_name4", - "family_name": "family_name4", - "company_name": "company_name8", - "nickname": "nickname8", - "email_address": "email_address0" -} -``` - diff --git a/doc/models/bulk-update-customers-request.md b/doc/models/bulk-update-customers-request.md deleted file mode 100644 index 27863a7a3..000000000 --- a/doc/models/bulk-update-customers-request.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Bulk Update Customers Request - -Defines the body parameters that can be included in requests to the -[BulkUpdateCustomers](../../doc/api/customers.md#bulk-update-customers) endpoint. - -## Structure - -`BulkUpdateCustomersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customers` | [`Record`](../../doc/models/bulk-update-customer-data.md) | Required | A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }`
key-value pairs.

Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile
that was created by merging existing profiles, provide the ID of the newly created profile.

Each value contains the updated customer data. Only new or changed fields are required. To add or
update a field, specify the new value. To remove a field, specify `null`. | - -## Example (as JSON) - -```json -{ - "customers": { - "8DDA5NZVBZFGAX0V3HPF81HHE0": { - "email_address": "New.Amelia.Earhart@example.com", - "note": "updated customer note", - "phone_number": null, - "version": 2, - "given_name": "given_name4", - "family_name": "family_name6", - "company_name": "company_name8", - "nickname": "nickname8" - }, - "N18CPRVXR5214XPBBA6BZQWF3C": { - "family_name": "Curie", - "given_name": "Marie", - "version": 0, - "company_name": "company_name8", - "nickname": "nickname8", - "email_address": "email_address0" - } - } -} -``` - diff --git a/doc/models/bulk-update-customers-response.md b/doc/models/bulk-update-customers-response.md deleted file mode 100644 index abe60297c..000000000 --- a/doc/models/bulk-update-customers-response.md +++ /dev/null @@ -1,135 +0,0 @@ - -# Bulk Update Customers Response - -Defines the fields included in the response body from the -[BulkUpdateCustomers](../../doc/api/customers.md#bulk-update-customers) endpoint. - -## Structure - -`BulkUpdateCustomersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `responses` | [`Record \| undefined`](../../doc/models/update-customer-response.md) | Optional | A map of responses that correspond to individual update requests, represented by
key-value pairs.

Each key is the customer ID that was specified for an update request and each value
is the corresponding response.
If the request succeeds, the value is the updated customer profile.
If the request fails, the value contains any errors that occurred during the request. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any top-level errors that prevented the bulk operation from running. | - -## Example (as JSON) - -```json -{ - "responses": { - "8DDA5NZVBZFGAX0V3HPF81HHE0": { - "customer": { - "birthday": "1897-07-24", - "created_at": "2024-01-19T00:27:54.59Z", - "creation_source": "THIRD_PARTY", - "email_address": "New.Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "id": "8DDA5NZVBZFGAX0V3HPF81HHE0", - "note": "updated customer note", - "preferences": { - "email_unsubscribed": false - }, - "updated_at": "2024-01-19T00:38:06Z", - "version": 3, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "N18CPRVXR5214XPBBA6BZQWF3C": { - "customer": { - "created_at": "2024-01-19T00:27:54.59Z", - "creation_source": "THIRD_PARTY", - "family_name": "Curie", - "given_name": "Marie", - "id": "N18CPRVXR5214XPBBA6BZQWF3C", - "preferences": { - "email_unsubscribed": false - }, - "updated_at": "2024-01-19T00:38:06Z", - "version": 1, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-update-team-members-request.md b/doc/models/bulk-update-team-members-request.md deleted file mode 100644 index d4888a0e7..000000000 --- a/doc/models/bulk-update-team-members-request.md +++ /dev/null @@ -1,58 +0,0 @@ - -# Bulk Update Team Members Request - -Represents a bulk update request for `TeamMember` objects. - -## Structure - -`BulkUpdateTeamMembersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMembers` | [`Record`](../../doc/models/update-team-member-request.md) | Required | The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`.
The maximum number of update objects is 25.

For each team member, include the fields to add, change, or clear. Fields can be cleared using a null value.
To update `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed,
call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values. | - -## Example (as JSON) - -```json -{ - "team_members": { - "AFMwA08kR-MIF-3Vs0OE": { - "team_member": { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "email_address": "jane_smith@gmail.com", - "family_name": "Smith", - "given_name": "Jane", - "is_owner": false, - "phone_number": "+14159223334", - "reference_id": "reference_id_2", - "status": "ACTIVE", - "id": "id6" - } - }, - "fpgteZNMaf0qOK-a4t6P": { - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "YSGH2WBKG94QZ", - "GA2Y9HSJ8KRYT" - ] - }, - "email_address": "joe_doe@gmail.com", - "family_name": "Doe", - "given_name": "Joe", - "is_owner": false, - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "status": "ACTIVE", - "id": "id6" - } - } - } -} -``` - diff --git a/doc/models/bulk-update-team-members-response.md b/doc/models/bulk-update-team-members-response.md deleted file mode 100644 index 1444c8d3a..000000000 --- a/doc/models/bulk-update-team-members-response.md +++ /dev/null @@ -1,99 +0,0 @@ - -# Bulk Update Team Members Response - -Represents a response from a bulk update request containing the updated `TeamMember` objects or error messages. - -## Structure - -`BulkUpdateTeamMembersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMembers` | [`Record \| undefined`](../../doc/models/update-team-member-response.md) | Optional | The successfully updated `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "team_members": { - "AFMwA08kR-MIF-3Vs0OE": { - "team_member": { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T18:14:00Z", - "email_address": "jane_smith@example.com", - "family_name": "Smith", - "given_name": "Jane", - "id": "AFMwA08kR-MIF-3Vs0OE", - "is_owner": false, - "phone_number": "+14159223334", - "reference_id": "reference_id_2", - "status": "ACTIVE", - "updated_at": "2020-03-24T18:18:00Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "fpgteZNMaf0qOK-a4t6P": { - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "GA2Y9HSJ8KRYT", - "YSGH2WBKG94QZ" - ] - }, - "created_at": "2020-03-24T18:14:00Z", - "email_address": "joe_doe@example.com", - "family_name": "Doe", - "given_name": "Joe", - "id": "fpgteZNMaf0qOK-a4t6P", - "is_owner": false, - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "status": "ACTIVE", - "updated_at": "2020-03-24T18:18:00Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-update-vendors-request.md b/doc/models/bulk-update-vendors-request.md deleted file mode 100644 index fc0094e5b..000000000 --- a/doc/models/bulk-update-vendors-request.md +++ /dev/null @@ -1,72 +0,0 @@ - -# Bulk Update Vendors Request - -Represents an input to a call to [BulkUpdateVendors](../../doc/api/vendors.md#bulk-update-vendors). - -## Structure - -`BulkUpdateVendorsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `vendors` | [`Record`](../../doc/models/update-vendor-request.md) | Required | A set of [UpdateVendorRequest](entity:UpdateVendorRequest) objects encapsulating to-be-updated [Vendor](entity:Vendor)
objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorRequest`-object pairs. | - -## Example (as JSON) - -```json -{ - "vendors": { - "key0": { - "idempotency_key": "idempotency_key4", - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - }, - "key1": { - "idempotency_key": "idempotency_key4", - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - }, - "key2": { - "idempotency_key": "idempotency_key4", - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - } - } -} -``` - diff --git a/doc/models/bulk-update-vendors-response.md b/doc/models/bulk-update-vendors-response.md deleted file mode 100644 index 620f87349..000000000 --- a/doc/models/bulk-update-vendors-response.md +++ /dev/null @@ -1,139 +0,0 @@ - -# Bulk Update Vendors Response - -Represents an output from a call to [BulkUpdateVendors](../../doc/api/vendors.md#bulk-update-vendors). - -## Structure - -`BulkUpdateVendorsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered when the request fails. | -| `responses` | [`Record \| undefined`](../../doc/models/update-vendor-response.md) | Optional | A set of [UpdateVendorResponse](entity:UpdateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor)
objects or error responses for failed attempts. The set is represented by a collection of `Vendor`-ID/`UpdateVendorResponse`-object or
`Vendor`-ID/error-object pairs. | - -## Example (as JSON) - -```json -{ - "responses": { - "INV_V_FMCYHBWT1TPL8MFH52PBMEN92A": { - "vendor": { - "address": { - "address_line_1": "202 Mill St", - "administrative_district_level_1": "NJ", - "country": "US", - "locality": "Moorestown", - "postal_code": "08057", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "contacts": [ - { - "email_address": "annie@annieshotsauce.com", - "id": "INV_VC_ABYYHBWT1TPL8MFH52PBMENPJ4", - "name": "Annie Thomas", - "ordinal": 0, - "phone_number": "1-212-555-4250" - } - ], - "created_at": "2022-03-16T10:21:54.859Z", - "id": "INV_V_FMCYHBWT1TPL8MFH52PBMEN92A", - "name": "Annie’s Hot Sauce", - "status": "ACTIVE", - "updated_at": "2022-03-16T20:21:54.859Z", - "version": 11 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4": { - "vendor": { - "account_number": "4025391", - "address": { - "address_line_1": "505 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "contacts": [ - { - "email_address": "joe@joesfreshseafood.com", - "id": "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", - "name": "Joe Burrow", - "ordinal": 0, - "phone_number": "1-212-555-4250" - } - ], - "created_at": "2022-03-16T10:10:54.859Z", - "id": "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", - "name": "Joe's Fresh Seafood", - "note": "favorite vendor", - "status": "ACTIVE", - "updated_at": "2022-03-16T20:21:54.859Z", - "version": 31 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-upsert-booking-custom-attributes-request.md b/doc/models/bulk-upsert-booking-custom-attributes-request.md deleted file mode 100644 index 08c59f243..000000000 --- a/doc/models/bulk-upsert-booking-custom-attributes-request.md +++ /dev/null @@ -1,70 +0,0 @@ - -# Bulk Upsert Booking Custom Attributes Request - -Represents a [BulkUpsertBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#bulk-upsert-booking-custom-attributes) request. - -## Structure - -`BulkUpsertBookingCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/booking-custom-attribute-upsert-request.md) | Required | A map containing 1 to 25 individual upsert requests. For each request, provide an
arbitrary ID that is unique for this `BulkUpsertBookingCustomAttributes` request and the
information needed to create or update a custom attribute. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "booking_id": "booking_id4", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" - }, - "key1": { - "booking_id": "booking_id4", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" - } - } -} -``` - diff --git a/doc/models/bulk-upsert-booking-custom-attributes-response.md b/doc/models/bulk-upsert-booking-custom-attributes-response.md deleted file mode 100644 index 6a91fe092..000000000 --- a/doc/models/bulk-upsert-booking-custom-attributes-response.md +++ /dev/null @@ -1,142 +0,0 @@ - -# Bulk Upsert Booking Custom Attributes Response - -Represents a [BulkUpsertBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#bulk-upsert-booking-custom-attributes) response, -which contains a map of responses that each corresponds to an individual upsert request. - -## Structure - -`BulkUpsertBookingCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record \| undefined`](../../doc/models/booking-custom-attribute-upsert-response.md) | Optional | A map of responses that correspond to individual upsert requests. Each response has the
same ID as the corresponding request and contains either a `booking_id` and `custom_attribute` or an `errors` field. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "booking_id": "booking_id4", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "key1": { - "booking_id": "booking_id4", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "key2": { - "booking_id": "booking_id4", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-upsert-customer-custom-attributes-request-customer-custom-attribute-upsert-request.md b/doc/models/bulk-upsert-customer-custom-attributes-request-customer-custom-attribute-upsert-request.md deleted file mode 100644 index 0456a25c6..000000000 --- a/doc/models/bulk-upsert-customer-custom-attributes-request-customer-custom-attribute-upsert-request.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Bulk Upsert Customer Custom Attributes Request Customer Custom Attribute Upsert Request - -Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes](../../doc/api/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) -request. An individual request contains a customer ID, the custom attribute to create or update, -and an optional idempotency key. - -## Structure - -`BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Required | The ID of the target [customer profile](entity:Customer).
**Constraints**: *Minimum Length*: `1` | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this individual upsert request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "customer_id": "customer_id0", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key8" -} -``` - diff --git a/doc/models/bulk-upsert-customer-custom-attributes-request.md b/doc/models/bulk-upsert-customer-custom-attributes-request.md deleted file mode 100644 index ba313c34f..000000000 --- a/doc/models/bulk-upsert-customer-custom-attributes-request.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Bulk Upsert Customer Custom Attributes Request - -Represents a [BulkUpsertCustomerCustomAttributes](../../doc/api/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) request. - -## Structure - -`BulkUpsertCustomerCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-upsert-customer-custom-attributes-request-customer-custom-attribute-upsert-request.md) | Required | A map containing 1 to 25 individual upsert requests. For each request, provide an
arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the
information needed to create or update a custom attribute. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "customer_id": "customer_id8", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" - } - } -} -``` - diff --git a/doc/models/bulk-upsert-customer-custom-attributes-response-customer-custom-attribute-upsert-response.md b/doc/models/bulk-upsert-customer-custom-attributes-response-customer-custom-attribute-upsert-response.md deleted file mode 100644 index 3a8d7d868..000000000 --- a/doc/models/bulk-upsert-customer-custom-attributes-response-customer-custom-attribute-upsert-response.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Bulk Upsert Customer Custom Attributes Response Customer Custom Attribute Upsert Response - -Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes](../../doc/api/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) operation. - -## Structure - -`BulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string \| undefined` | Optional | The ID of the customer profile associated with the custom attribute. | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred while processing the individual request. | - -## Example (as JSON) - -```json -{ - "customer_id": "customer_id4", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-upsert-customer-custom-attributes-response.md b/doc/models/bulk-upsert-customer-custom-attributes-response.md deleted file mode 100644 index 3c6132856..000000000 --- a/doc/models/bulk-upsert-customer-custom-attributes-response.md +++ /dev/null @@ -1,154 +0,0 @@ - -# Bulk Upsert Customer Custom Attributes Response - -Represents a [BulkUpsertCustomerCustomAttributes](../../doc/api/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) response, -which contains a map of responses that each corresponds to an individual upsert request. - -## Structure - -`BulkUpsertCustomerCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record \| undefined`](../../doc/models/bulk-upsert-customer-custom-attributes-response-customer-custom-attribute-upsert-response.md) | Optional | A map of responses that correspond to individual upsert requests. Each response has the
same ID as the corresponding request and contains either a `customer_id` and `custom_attribute` or an `errors` field. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "customer_id": "customer_id8", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "key1": { - "customer_id": "customer_id8", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "key2": { - "customer_id": "customer_id8", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md b/doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md deleted file mode 100644 index b9adfd557..000000000 --- a/doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Bulk Upsert Location Custom Attributes Request Location Custom Attribute Upsert Request - -Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-upsert-location-custom-attributes) -request. An individual request contains a location ID, the custom attribute to create or update, -and an optional idempotency key. - -## Structure - -`BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Required | The ID of the target [location](entity:Location).
**Constraints**: *Minimum Length*: `1` | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this individual upsert request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "location_id": "location_id2", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key4" -} -``` - diff --git a/doc/models/bulk-upsert-location-custom-attributes-request.md b/doc/models/bulk-upsert-location-custom-attributes-request.md deleted file mode 100644 index 74bde39d8..000000000 --- a/doc/models/bulk-upsert-location-custom-attributes-request.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Bulk Upsert Location Custom Attributes Request - -Represents a [BulkUpsertLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-upsert-location-custom-attributes) request. - -## Structure - -`BulkUpsertLocationCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-upsert-location-custom-attributes-request-location-custom-attribute-upsert-request.md) | Required | A map containing 1 to 25 individual upsert requests. For each request, provide an
arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the
information needed to create or update a custom attribute. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "location_id": "location_id4", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" - } - } -} -``` - diff --git a/doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md b/doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md deleted file mode 100644 index 7cc2d953e..000000000 --- a/doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md +++ /dev/null @@ -1,58 +0,0 @@ - -# Bulk Upsert Location Custom Attributes Response Location Custom Attribute Upsert Response - -Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-upsert-location-custom-attributes) operation. - -## Structure - -`BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| undefined` | Optional | The ID of the location associated with the custom attribute. | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred while processing the individual request. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id8", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-upsert-location-custom-attributes-response.md b/doc/models/bulk-upsert-location-custom-attributes-response.md deleted file mode 100644 index f4d0bb911..000000000 --- a/doc/models/bulk-upsert-location-custom-attributes-response.md +++ /dev/null @@ -1,76 +0,0 @@ - -# Bulk Upsert Location Custom Attributes Response - -Represents a [BulkUpsertLocationCustomAttributes](../../doc/api/location-custom-attributes.md#bulk-upsert-location-custom-attributes) response, -which contains a map of responses that each corresponds to an individual upsert request. - -## Structure - -`BulkUpsertLocationCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record \| undefined`](../../doc/models/bulk-upsert-location-custom-attributes-response-location-custom-attribute-upsert-response.md) | Optional | A map of responses that correspond to individual upsert requests. Each response has the
same ID as the corresponding request and contains either a `location_id` and `custom_attribute` or an `errors` field. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "location_id": "location_id4", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-upsert-merchant-custom-attributes-request-merchant-custom-attribute-upsert-request.md b/doc/models/bulk-upsert-merchant-custom-attributes-request-merchant-custom-attribute-upsert-request.md deleted file mode 100644 index d8c0488e3..000000000 --- a/doc/models/bulk-upsert-merchant-custom-attributes-request-merchant-custom-attribute-upsert-request.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Bulk Upsert Merchant Custom Attributes Request Merchant Custom Attribute Upsert Request - -Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-upsert-merchant-custom-attributes) -request. An individual request contains a merchant ID, the custom attribute to create or update, -and an optional idempotency key. - -## Structure - -`BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantId` | `string` | Required | The ID of the target [merchant](entity:Merchant).
**Constraints**: *Minimum Length*: `1` | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this individual upsert request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "merchant_id": "merchant_id8", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key4" -} -``` - diff --git a/doc/models/bulk-upsert-merchant-custom-attributes-request.md b/doc/models/bulk-upsert-merchant-custom-attributes-request.md deleted file mode 100644 index d3214da78..000000000 --- a/doc/models/bulk-upsert-merchant-custom-attributes-request.md +++ /dev/null @@ -1,93 +0,0 @@ - -# Bulk Upsert Merchant Custom Attributes Request - -Represents a [BulkUpsertMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-upsert-merchant-custom-attributes) request. - -## Structure - -`BulkUpsertMerchantCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-upsert-merchant-custom-attributes-request-merchant-custom-attribute-upsert-request.md) | Required | A map containing 1 to 25 individual upsert requests. For each request, provide an
arbitrary ID that is unique for this `BulkUpsertMerchantCustomAttributes` request and the
information needed to create or update a custom attribute. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "merchant_id": "merchant_id0", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" - }, - "key1": { - "merchant_id": "merchant_id0", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" - }, - "key2": { - "merchant_id": "merchant_id0", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" - } - } -} -``` - diff --git a/doc/models/bulk-upsert-merchant-custom-attributes-response-merchant-custom-attribute-upsert-response.md b/doc/models/bulk-upsert-merchant-custom-attributes-response-merchant-custom-attribute-upsert-response.md deleted file mode 100644 index 0710416bc..000000000 --- a/doc/models/bulk-upsert-merchant-custom-attributes-response-merchant-custom-attribute-upsert-response.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Bulk Upsert Merchant Custom Attributes Response Merchant Custom Attribute Upsert Response - -Represents a response for an individual upsert request in a [BulkUpsertMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-upsert-merchant-custom-attributes) operation. - -## Structure - -`BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantId` | `string \| undefined` | Optional | The ID of the merchant associated with the custom attribute. | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred while processing the individual request. | - -## Example (as JSON) - -```json -{ - "merchant_id": "merchant_id0", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-upsert-merchant-custom-attributes-response.md b/doc/models/bulk-upsert-merchant-custom-attributes-response.md deleted file mode 100644 index 736f11c9c..000000000 --- a/doc/models/bulk-upsert-merchant-custom-attributes-response.md +++ /dev/null @@ -1,106 +0,0 @@ - -# Bulk Upsert Merchant Custom Attributes Response - -Represents a [BulkUpsertMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#bulk-upsert-merchant-custom-attributes) response, -which contains a map of responses that each corresponds to an individual upsert request. - -## Structure - -`BulkUpsertMerchantCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record \| undefined`](../../doc/models/bulk-upsert-merchant-custom-attributes-response-merchant-custom-attribute-upsert-response.md) | Optional | A map of responses that correspond to individual upsert requests. Each response has the
same ID as the corresponding request and contains either a `merchant_id` and `custom_attribute` or an `errors` field. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "merchant_id": "merchant_id0", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - }, - "key1": { - "merchant_id": "merchant_id0", - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/bulk-upsert-order-custom-attributes-request-upsert-custom-attribute.md b/doc/models/bulk-upsert-order-custom-attributes-request-upsert-custom-attribute.md deleted file mode 100644 index ed5b1e6e4..000000000 --- a/doc/models/bulk-upsert-order-custom-attributes-request-upsert-custom-attribute.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Bulk Upsert Order Custom Attributes Request Upsert Custom Attribute - -Represents one upsert within the bulk operation. - -## Structure - -`BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | -| `orderId` | `string` | Required | The ID of the target [order](entity:Order).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key4", - "order_id": "order_id2" -} -``` - diff --git a/doc/models/bulk-upsert-order-custom-attributes-request.md b/doc/models/bulk-upsert-order-custom-attributes-request.md deleted file mode 100644 index 3975a40d4..000000000 --- a/doc/models/bulk-upsert-order-custom-attributes-request.md +++ /dev/null @@ -1,93 +0,0 @@ - -# Bulk Upsert Order Custom Attributes Request - -Represents a bulk upsert request for one or more order custom attributes. - -## Structure - -`BulkUpsertOrderCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`Record`](../../doc/models/bulk-upsert-order-custom-attributes-request-upsert-custom-attribute.md) | Required | A map of requests that correspond to individual upsert operations for custom attributes. | - -## Example (as JSON) - -```json -{ - "values": { - "key0": { - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6", - "order_id": "order_id4" - }, - "key1": { - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6", - "order_id": "order_id4" - }, - "key2": { - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6", - "order_id": "order_id4" - } - } -} -``` - diff --git a/doc/models/bulk-upsert-order-custom-attributes-response.md b/doc/models/bulk-upsert-order-custom-attributes-response.md deleted file mode 100644 index 0f4ba02c8..000000000 --- a/doc/models/bulk-upsert-order-custom-attributes-response.md +++ /dev/null @@ -1,74 +0,0 @@ - -# Bulk Upsert Order Custom Attributes Response - -Represents a response from a bulk upsert of order custom attributes. - -## Structure - -`BulkUpsertOrderCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `values` | [`Record`](../../doc/models/upsert-order-custom-attribute-response.md) | Required | A map of responses that correspond to individual upsert operations for custom attributes. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "values": { - "key0": { - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] - } - } -} -``` - diff --git a/doc/models/business-appointment-settings-alignment-time.md b/doc/models/business-appointment-settings-alignment-time.md deleted file mode 100644 index 65cf656fc..000000000 --- a/doc/models/business-appointment-settings-alignment-time.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Business Appointment Settings Alignment Time - -Time units of a service duration for bookings. - -## Enumeration - -`BusinessAppointmentSettingsAlignmentTime` - -## Fields - -| Name | Description | -| --- | --- | -| `SERVICE_DURATION` | The service duration unit is one visit of a fixed time interval specified by the seller. | -| `QUARTER_HOURLY` | The service duration unit is a 15-minute interval. Bookings can be scheduled every quarter hour. | -| `HALF_HOURLY` | The service duration unit is a 30-minute interval. Bookings can be scheduled every half hour. | -| `HOURLY` | The service duration unit is a 60-minute interval. Bookings can be scheduled every hour. | - diff --git a/doc/models/business-appointment-settings-booking-location-type.md b/doc/models/business-appointment-settings-booking-location-type.md deleted file mode 100644 index 5bf906052..000000000 --- a/doc/models/business-appointment-settings-booking-location-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Business Appointment Settings Booking Location Type - -Supported types of location where service is provided. - -## Enumeration - -`BusinessAppointmentSettingsBookingLocationType` - -## Fields - -| Name | Description | -| --- | --- | -| `BUSINESS_LOCATION` | The service is provided at a seller location. | -| `CUSTOMER_LOCATION` | The service is provided at a customer location. | -| `PHONE` | The service is provided over the phone. | - diff --git a/doc/models/business-appointment-settings-cancellation-policy.md b/doc/models/business-appointment-settings-cancellation-policy.md deleted file mode 100644 index 37710f620..000000000 --- a/doc/models/business-appointment-settings-cancellation-policy.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Business Appointment Settings Cancellation Policy - -The category of the seller’s cancellation policy. - -## Enumeration - -`BusinessAppointmentSettingsCancellationPolicy` - -## Fields - -| Name | Description | -| --- | --- | -| `CANCELLATION_TREATED_AS_NO_SHOW` | Cancellations are treated as no shows and may incur a fee as specified by `cancellation_fee_money`. | -| `CUSTOM_POLICY` | Cancellations follow the seller-specified policy that is described in free-form text and not enforced automatically by Square. | - diff --git a/doc/models/business-appointment-settings-max-appointments-per-day-limit-type.md b/doc/models/business-appointment-settings-max-appointments-per-day-limit-type.md deleted file mode 100644 index 7ce1edea7..000000000 --- a/doc/models/business-appointment-settings-max-appointments-per-day-limit-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Business Appointment Settings Max Appointments Per Day Limit Type - -Types of daily appointment limits. - -## Enumeration - -`BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType` - -## Fields - -| Name | Description | -| --- | --- | -| `PER_TEAM_MEMBER` | The maximum number of daily appointments is set on a per team member basis. | -| `PER_LOCATION` | The maximum number of daily appointments is set on a per location basis. | - diff --git a/doc/models/business-appointment-settings.md b/doc/models/business-appointment-settings.md deleted file mode 100644 index ebcf877cb..000000000 --- a/doc/models/business-appointment-settings.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Business Appointment Settings - -The service appointment settings, including where and how the service is provided. - -## Structure - -`BusinessAppointmentSettings` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationTypes` | [`string[] \| null \| undefined`](../../doc/models/business-appointment-settings-booking-location-type.md) | Optional | Types of the location allowed for bookings.
See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values | -| `alignmentTime` | [`string \| undefined`](../../doc/models/business-appointment-settings-alignment-time.md) | Optional | Time units of a service duration for bookings. | -| `minBookingLeadTimeSeconds` | `number \| null \| undefined` | Optional | The minimum lead time in seconds before a service can be booked. A booking must be created at least this amount of time before its starting time. | -| `maxBookingLeadTimeSeconds` | `number \| null \| undefined` | Optional | The maximum lead time in seconds before a service can be booked. A booking must be created at most this amount of time before its starting time. | -| `anyTeamMemberBookingEnabled` | `boolean \| null \| undefined` | Optional | Indicates whether a customer can choose from all available time slots and have a staff member assigned
automatically (`true`) or not (`false`). | -| `multipleServiceBookingEnabled` | `boolean \| null \| undefined` | Optional | Indicates whether a customer can book multiple services in a single online booking. | -| `maxAppointmentsPerDayLimitType` | [`string \| undefined`](../../doc/models/business-appointment-settings-max-appointments-per-day-limit-type.md) | Optional | Types of daily appointment limits. | -| `maxAppointmentsPerDayLimit` | `number \| null \| undefined` | Optional | The maximum number of daily appointments per team member or per location. | -| `cancellationWindowSeconds` | `number \| null \| undefined` | Optional | The cut-off time in seconds for allowing clients to cancel or reschedule an appointment. | -| `cancellationFeeMoney` | [`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. | -| `cancellationPolicy` | [`string \| undefined`](../../doc/models/business-appointment-settings-cancellation-policy.md) | Optional | The category of the seller’s cancellation policy. | -| `cancellationPolicyText` | `string \| null \| undefined` | Optional | The free-form text of the seller's cancellation policy.
**Constraints**: *Maximum Length*: `65536` | -| `skipBookingFlowStaffSelection` | `boolean \| null \| undefined` | Optional | Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`). | - -## Example (as JSON) - -```json -{ - "location_types": [ - "PHONE" - ], - "alignment_time": "SERVICE_DURATION", - "min_booking_lead_time_seconds": 88, - "max_booking_lead_time_seconds": 98, - "any_team_member_booking_enabled": false -} -``` - diff --git a/doc/models/business-booking-profile-booking-policy.md b/doc/models/business-booking-profile-booking-policy.md deleted file mode 100644 index 5104c3487..000000000 --- a/doc/models/business-booking-profile-booking-policy.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Business Booking Profile Booking Policy - -Policies for accepting bookings. - -## Enumeration - -`BusinessBookingProfileBookingPolicy` - -## Fields - -| Name | Description | -| --- | --- | -| `ACCEPT_ALL` | The seller accepts all booking requests automatically. | -| `REQUIRES_ACCEPTANCE` | The seller must accept requests to complete bookings. | - diff --git a/doc/models/business-booking-profile-customer-timezone-choice.md b/doc/models/business-booking-profile-customer-timezone-choice.md deleted file mode 100644 index a2c122829..000000000 --- a/doc/models/business-booking-profile-customer-timezone-choice.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Business Booking Profile Customer Timezone Choice - -Choices of customer-facing time zone used for bookings. - -## Enumeration - -`BusinessBookingProfileCustomerTimezoneChoice` - -## Fields - -| Name | Description | -| --- | --- | -| `BUSINESS_LOCATION_TIMEZONE` | Use the time zone of the business location for bookings. | -| `CUSTOMER_CHOICE` | Use the customer-chosen time zone for bookings. | - diff --git a/doc/models/business-booking-profile.md b/doc/models/business-booking-profile.md deleted file mode 100644 index 0c5ca30a7..000000000 --- a/doc/models/business-booking-profile.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Business Booking Profile - -A seller's business booking profile, including booking policy, appointment settings, etc. - -## Structure - -`BusinessBookingProfile` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sellerId` | `string \| null \| undefined` | Optional | The ID of the seller, obtainable using the Merchants API.
**Constraints**: *Maximum Length*: `32` | -| `createdAt` | `string \| undefined` | Optional | The RFC 3339 timestamp specifying the booking's creation time. | -| `bookingEnabled` | `boolean \| null \| undefined` | Optional | Indicates whether the seller is open for booking. | -| `customerTimezoneChoice` | [`string \| undefined`](../../doc/models/business-booking-profile-customer-timezone-choice.md) | Optional | Choices of customer-facing time zone used for bookings. | -| `bookingPolicy` | [`string \| undefined`](../../doc/models/business-booking-profile-booking-policy.md) | Optional | Policies for accepting bookings. | -| `allowUserCancel` | `boolean \| null \| undefined` | Optional | Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`). | -| `businessAppointmentSettings` | [`BusinessAppointmentSettings \| undefined`](../../doc/models/business-appointment-settings.md) | Optional | The service appointment settings, including where and how the service is provided. | -| `supportSellerLevelWrites` | `boolean \| null \| undefined` | Optional | Indicates whether the seller's subscription to Square Appointments supports creating, updating or canceling an appointment through the API (`true`) or not (`false`) using seller permission. | - -## Example (as JSON) - -```json -{ - "seller_id": "seller_id8", - "created_at": "created_at8", - "booking_enabled": false, - "customer_timezone_choice": "BUSINESS_LOCATION_TIMEZONE", - "booking_policy": "ACCEPT_ALL" -} -``` - diff --git a/doc/models/business-hours-period.md b/doc/models/business-hours-period.md deleted file mode 100644 index bfc2d3d3f..000000000 --- a/doc/models/business-hours-period.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Business Hours Period - -Represents a period of time during which a business location is open. - -## Structure - -`BusinessHoursPeriod` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `dayOfWeek` | [`string \| undefined`](../../doc/models/day-of-week.md) | Optional | Indicates the specific day of the week. | -| `startLocalTime` | `string \| null \| undefined` | Optional | The start time of a business hours period, specified in local time using partial-time
RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
Note that the seconds value is always :00, but it is appended for conformance to the RFC. | -| `endLocalTime` | `string \| null \| undefined` | Optional | The end time of a business hours period, specified in local time using partial-time
RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
Note that the seconds value is always :00, but it is appended for conformance to the RFC. | - -## Example (as JSON) - -```json -{ - "day_of_week": "SUN", - "start_local_time": "start_local_time2", - "end_local_time": "end_local_time4" -} -``` - diff --git a/doc/models/business-hours.md b/doc/models/business-hours.md deleted file mode 100644 index ccdf86f95..000000000 --- a/doc/models/business-hours.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Business Hours - -The hours of operation for a location. - -## Structure - -`BusinessHours` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `periods` | [`BusinessHoursPeriod[] \| null \| undefined`](../../doc/models/business-hours-period.md) | Optional | The list of time periods during which the business is open. There can be at most 10 periods per day. | - -## Example (as JSON) - -```json -{ - "periods": [ - { - "day_of_week": "WED", - "start_local_time": "start_local_time4", - "end_local_time": "end_local_time6" - }, - { - "day_of_week": "WED", - "start_local_time": "start_local_time4", - "end_local_time": "end_local_time6" - }, - { - "day_of_week": "WED", - "start_local_time": "start_local_time4", - "end_local_time": "end_local_time6" - } - ] -} -``` - diff --git a/doc/models/buy-now-pay-later-details.md b/doc/models/buy-now-pay-later-details.md deleted file mode 100644 index 59a91767d..000000000 --- a/doc/models/buy-now-pay-later-details.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Buy Now Pay Later Details - -Additional details about a Buy Now Pay Later payment type. - -## Structure - -`BuyNowPayLaterDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `brand` | `string \| null \| undefined` | Optional | The brand used for the Buy Now Pay Later payment.
The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`.
**Constraints**: *Maximum Length*: `50` | -| `afterpayDetails` | [`AfterpayDetails \| undefined`](../../doc/models/afterpay-details.md) | Optional | Additional details about Afterpay payments. | -| `clearpayDetails` | [`ClearpayDetails \| undefined`](../../doc/models/clearpay-details.md) | Optional | Additional details about Clearpay payments. | - -## Example (as JSON) - -```json -{ - "brand": "brand6", - "afterpay_details": { - "email_address": "email_address4" - }, - "clearpay_details": { - "email_address": "email_address4" - } -} -``` - diff --git a/doc/models/calculate-loyalty-points-request.md b/doc/models/calculate-loyalty-points-request.md deleted file mode 100644 index 52a6cb64c..000000000 --- a/doc/models/calculate-loyalty-points-request.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Calculate Loyalty Points Request - -Represents a [CalculateLoyaltyPoints](../../doc/api/loyalty.md#calculate-loyalty-points) request. - -## Structure - -`CalculateLoyaltyPointsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string \| null \| undefined` | Optional | The [order](entity:Order) ID for which to calculate the points.
Specify this field if your application uses the Orders API to process orders.
Otherwise, specify the `transaction_amount_money`. | -| `transactionAmountMoney` | [`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. | -| `loyaltyAccountId` | `string \| null \| undefined` | Optional | The ID of the target [loyalty account](entity:LoyaltyAccount). Optionally specify this field
if your application uses the Orders API to process orders.

If specified, the `promotion_points` field in the response shows the number of points the buyer would
earn from the purchase. In this case, Square uses the account ID to determine whether the promotion's
`trigger_limit` (the maximum number of times that a buyer can trigger the promotion) has been reached.
If not specified, the `promotion_points` field shows the number of points the purchase qualifies
for regardless of the trigger limit.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | - -## Example (as JSON) - -```json -{ - "loyalty_account_id": "79b807d2-d786-46a9-933b-918028d7a8c5", - "order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", - "transaction_amount_money": { - "amount": 64, - "currency": "ANG" - } -} -``` - diff --git a/doc/models/calculate-loyalty-points-response.md b/doc/models/calculate-loyalty-points-response.md deleted file mode 100644 index 5ffa3b8be..000000000 --- a/doc/models/calculate-loyalty-points-response.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Calculate Loyalty Points Response - -Represents a [CalculateLoyaltyPoints](../../doc/api/loyalty.md#calculate-loyalty-points) response. - -## Structure - -`CalculateLoyaltyPointsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `points` | `number \| undefined` | Optional | The number of points that the buyer can earn from the base loyalty program. | -| `promotionPoints` | `number \| undefined` | Optional | The number of points that the buyer can earn from a loyalty promotion. To be eligible
to earn promotion points, the purchase must first qualify for program points. When `order_id`
is not provided in the request, this value is always 0. | - -## Example (as JSON) - -```json -{ - "points": 6, - "promotion_points": 12, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/calculate-order-request.md b/doc/models/calculate-order-request.md deleted file mode 100644 index 6bc8e0715..000000000 --- a/doc/models/calculate-order-request.md +++ /dev/null @@ -1,98 +0,0 @@ - -# Calculate Order Request - -## Structure - -`CalculateOrderRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`Order`](../../doc/models/order.md) | Required | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `proposedRewards` | [`OrderReward[] \| null \| undefined`](../../doc/models/order-reward.md) | Optional | Identifies one or more loyalty reward tiers to apply during the order calculation.
The discounts defined by the reward tiers are added to the order only to preview the
effect of applying the specified rewards. The rewards do not correspond to actual
redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are
random strings used only to reference the reward tier. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "b3e98fe3-b8de-471c-82f1-545f371e637c", - "order": { - "discounts": [ - { - "name": "50% Off", - "percentage": "50", - "scope": "ORDER" - } - ], - "line_items": [ - { - "base_price_money": { - "amount": 500, - "currency": "USD" - }, - "name": "Item 1", - "quantity": "1", - "uid": "uid8", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "base_price_money": { - "amount": 300, - "currency": "USD" - }, - "name": "Item 2", - "quantity": "2", - "uid": "uid8", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ], - "location_id": "D7AVYMEAPJ3A3", - "id": "id6", - "reference_id": "reference_id4", - "source": { - "name": "name4" - }, - "customer_id": "customer_id4" - }, - "proposed_rewards": [ - { - "id": "id0", - "reward_tier_id": "reward_tier_id6" - } - ] -} -``` - diff --git a/doc/models/calculate-order-response.md b/doc/models/calculate-order-response.md deleted file mode 100644 index 27af1edd0..000000000 --- a/doc/models/calculate-order-response.md +++ /dev/null @@ -1,231 +0,0 @@ - -# Calculate Order Response - -## Structure - -`CalculateOrderResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "order": { - "created_at": "2020-05-18T16:30:49.614Z", - "discounts": [ - { - "applied_money": { - "amount": 550, - "currency": "USD" - }, - "name": "50% Off", - "percentage": "50", - "scope": "ORDER", - "type": "FIXED_PERCENTAGE", - "uid": "zGsRZP69aqSSR9lq9euSPB" - } - ], - "line_items": [ - { - "applied_discounts": [ - { - "applied_money": { - "amount": 250, - "currency": "USD" - }, - "discount_uid": "zGsRZP69aqSSR9lq9euSPB", - "uid": "9zr9S4dxvPAixvn0lpa1VC" - } - ], - "base_price_money": { - "amount": 500, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 500, - "currency": "USD" - }, - "name": "Item 1", - "quantity": "1", - "total_discount_money": { - "amount": 250, - "currency": "USD" - }, - "total_money": { - "amount": 250, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "ULkg0tQTRK2bkU9fNv3IJD", - "variation_total_price_money": { - "amount": 500, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "applied_discounts": [ - { - "applied_money": { - "amount": 300, - "currency": "USD" - }, - "discount_uid": "zGsRZP69aqSSR9lq9euSPB", - "uid": "qa8LwwZK82FgSEkQc2HYVC" - } - ], - "base_price_money": { - "amount": 300, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 600, - "currency": "USD" - }, - "name": "Item 2", - "quantity": "2", - "total_discount_money": { - "amount": 300, - "currency": "USD" - }, - "total_money": { - "amount": 300, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "mumY8Nun4BC5aKe2yyx5a", - "variation_total_price_money": { - "amount": 600, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ], - "location_id": "D7AVYMEAPJ3A3", - "net_amounts": { - "discount_money": { - "amount": 550, - "currency": "USD" - }, - "service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "tax_money": { - "amount": 0, - "currency": "USD" - }, - "tip_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 550, - "currency": "USD" - } - }, - "state": "OPEN", - "total_discount_money": { - "amount": 550, - "currency": "USD" - }, - "total_money": { - "amount": 550, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "total_tip_money": { - "amount": 0, - "currency": "USD" - }, - "updated_at": "2020-05-18T16:30:49.614Z", - "version": 1, - "id": "id6", - "reference_id": "reference_id4", - "source": { - "name": "name4" - }, - "customer_id": "customer_id4" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/cancel-booking-request.md b/doc/models/cancel-booking-request.md deleted file mode 100644 index eacd1c082..000000000 --- a/doc/models/cancel-booking-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Cancel Booking Request - -## Structure - -`CancelBookingRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique key to make this request an idempotent operation.
**Constraints**: *Maximum Length*: `255` | -| `bookingVersion` | `number \| null \| undefined` | Optional | The revision number for the booking used for optimistic concurrency. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "idempotency_key0", - "booking_version": 224 -} -``` - diff --git a/doc/models/cancel-booking-response.md b/doc/models/cancel-booking-response.md deleted file mode 100644 index ab4e4839d..000000000 --- a/doc/models/cancel-booking-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Cancel Booking Response - -## Structure - -`CancelBookingResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `booking` | [`Booking \| undefined`](../../doc/models/booking.md) | Optional | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "booking": { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t" - } - ], - "created_at": "2020-10-28T15:47:41Z", - "customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M", - "customer_note": "", - "id": "zkras0xv0xwswx", - "location_id": "LEQHH0YY8B42M", - "seller_note": "", - "start_at": "2020-11-26T13:00:00Z", - "status": "CANCELLED_BY_CUSTOMER", - "updated_at": "2020-10-28T15:49:25Z", - "version": 1 - }, - "errors": [] -} -``` - diff --git a/doc/models/cancel-invoice-request.md b/doc/models/cancel-invoice-request.md deleted file mode 100644 index 0c58a0568..000000000 --- a/doc/models/cancel-invoice-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Cancel Invoice Request - -Describes a `CancelInvoice` request. - -## Structure - -`CancelInvoiceRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number` | Required | The version of the [invoice](entity:Invoice) to cancel.
If you do not know the version, you can call
[GetInvoice](api-endpoint:Invoices-GetInvoice) or [ListInvoices](api-endpoint:Invoices-ListInvoices). | - -## Example (as JSON) - -```json -{ - "version": 0 -} -``` - diff --git a/doc/models/cancel-invoice-response.md b/doc/models/cancel-invoice-response.md deleted file mode 100644 index b15c69fc1..000000000 --- a/doc/models/cancel-invoice-response.md +++ /dev/null @@ -1,112 +0,0 @@ - -# Cancel Invoice Response - -The response returned by the `CancelInvoice` request. - -## Structure - -`CancelInvoiceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoice` | [`Invoice \| undefined`](../../doc/models/invoice.md) | Optional | Stores information about an invoice. You use the Invoices API to create and manage
invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "invoice": { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": false - }, - "created_at": "2020-06-18T17:45:13Z", - "custom_fields": [ - { - "label": "Event Reference Number", - "placement": "ABOVE_LINE_ITEMS", - "value": "Ref. #1234" - }, - { - "label": "Terms of Service", - "placement": "BELOW_LINE_ITEMS", - "value": "The terms of service are..." - } - ], - "delivery_method": "EMAIL", - "description": "We appreciate your business!", - "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "invoice_number": "inv-100", - "location_id": "ES0RJRZYEC39A", - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "payment_requests": [ - { - "automatic_payment_source": "NONE", - "computed_amount_money": { - "amount": 10000, - "currency": "USD" - }, - "due_date": "2030-01-24", - "reminders": [ - { - "message": "Your invoice is due tomorrow", - "relative_scheduled_days": -1, - "status": "PENDING", - "uid": "beebd363-e47f-4075-8785-c235aaa7df11" - } - ], - "request_type": "BALANCE", - "tipping_enabled": true, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "sale_or_service_date": "2030-01-24", - "scheduled_at": "2030-01-13T10:00:00Z", - "status": "CANCELED", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "title": "Event Planning Services", - "updated_at": "2020-06-18T18:23:11Z", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/cancel-loyalty-promotion-response.md b/doc/models/cancel-loyalty-promotion-response.md deleted file mode 100644 index c934c97a1..000000000 --- a/doc/models/cancel-loyalty-promotion-response.md +++ /dev/null @@ -1,81 +0,0 @@ - -# Cancel Loyalty Promotion Response - -Represents a [CancelLoyaltyPromotion](../../doc/api/loyalty.md#cancel-loyalty-promotion) response. -Either `loyalty_promotion` or `errors` is present in the response. - -## Structure - -`CancelLoyaltyPromotionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `loyaltyPromotion` | [`LoyaltyPromotion \| undefined`](../../doc/models/loyalty-promotion.md) | Optional | Represents a promotion for a [loyalty program](../../doc/models/loyalty-program.md). Loyalty promotions enable buyers
to earn extra points on top of those earned from the base program.

A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. | - -## Example (as JSON) - -```json -{ - "loyalty_promotion": { - "available_time": { - "start_date": "2022-08-16", - "time_periods": [ - "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT" - ], - "end_date": "end_date8" - }, - "canceled_at": "2022-08-17T12:42:49Z", - "created_at": "2022-08-16T08:38:54Z", - "id": "loypromo_f0f9b849-725e-378d-b810-511237e07b67", - "incentive": { - "points_multiplier_data": { - "multiplier": "3.000", - "points_multiplier": 3 - }, - "type": "POINTS_MULTIPLIER", - "points_addition_data": { - "points_addition": 218 - } - }, - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "minimum_spend_amount_money": { - "amount": 2000, - "currency": "USD" - }, - "name": "Tuesday Happy Hour Promo", - "qualifying_category_ids": [ - "XTQPYLR3IIU9C44VRCB3XD12" - ], - "status": "CANCELED", - "trigger_limit": { - "interval": "DAY", - "times": 1 - }, - "updated_at": "2022-08-17T12:42:49Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/cancel-payment-by-idempotency-key-request.md b/doc/models/cancel-payment-by-idempotency-key-request.md deleted file mode 100644 index a052b4d29..000000000 --- a/doc/models/cancel-payment-by-idempotency-key-request.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Cancel Payment by Idempotency Key Request - -Describes a request to cancel a payment using -[CancelPaymentByIdempotencyKey](../../doc/api/payments.md#cancel-payment-by-idempotency-key). - -## Structure - -`CancelPaymentByIdempotencyKeyRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | The `idempotency_key` identifying the payment to be canceled.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "a7e36d40-d24b-11e8-b568-0800200c9a66" -} -``` - diff --git a/doc/models/cancel-payment-by-idempotency-key-response.md b/doc/models/cancel-payment-by-idempotency-key-response.md deleted file mode 100644 index 21000ad26..000000000 --- a/doc/models/cancel-payment-by-idempotency-key-response.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Cancel Payment by Idempotency Key Response - -Defines the response returned by -[CancelPaymentByIdempotencyKey](../../doc/api/payments.md#cancel-payment-by-idempotency-key). -On success, `errors` is empty. - -## Structure - -`CancelPaymentByIdempotencyKeyResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/cancel-payment-response.md b/doc/models/cancel-payment-response.md deleted file mode 100644 index afdf17760..000000000 --- a/doc/models/cancel-payment-response.md +++ /dev/null @@ -1,98 +0,0 @@ - -# Cancel Payment Response - -Defines the response returned by [CancelPayment](../../doc/api/payments.md#cancel-payment). - -## Structure - -`CancelPaymentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `payment` | [`Payment \| undefined`](../../doc/models/payment.md) | Optional | Represents a payment processed by the Square API. | - -## Example (as JSON) - -```json -{ - "payment": { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "application_details": { - "application_id": "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", - "square_product": "ECOMMERCE_API" - }, - "approved_money": { - "amount": 1000, - "currency": "USD" - }, - "card_details": { - "auth_result_code": "68aLBM", - "avs_status": "AVS_ACCEPTED", - "card": { - "bin": "411111", - "card_brand": "VISA", - "card_type": "DEBIT", - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", - "last_4": "1111", - "prepaid_type": "NOT_PREPAID" - }, - "card_payment_timeline": { - "authorized_at": "2021-10-13T20:26:44.364Z", - "voided_at": "2021-10-13T20:31:21.597Z" - }, - "cvv_status": "CVV_ACCEPTED", - "entry_method": "ON_FILE", - "statement_description": "SQ *EXAMPLE TEST GOSQ.C", - "status": "VOIDED" - }, - "created_at": "2021-10-13T20:26:44.191Z", - "customer_id": "W92WH6P11H4Z77CTET0RNTGFW8", - "delay_action": "CANCEL", - "delay_duration": "PT168H", - "delayed_until": "2021-10-20T20:26:44.191Z", - "id": "1QjqpBVyrI9S4H9sTGDWU9JeiWdZY", - "location_id": "L88917AVBK2S5", - "note": "Example Note", - "order_id": "nUSN9TdxpiK3SrQg3wzmf6r8LP9YY", - "risk_evaluation": { - "created_at": "2021-10-13T20:26:45.271Z", - "risk_level": "NORMAL" - }, - "source_type": "CARD", - "status": "CANCELED", - "tip_money": { - "amount": 100, - "currency": "USD" - }, - "total_money": { - "amount": 1100, - "currency": "USD" - }, - "updated_at": "2021-10-13T20:31:21.597Z", - "version_token": "N8AGYgEjCiY9Q57Jw7aVHEpBq8bzGCDCQMRX8Vs56N06o" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/cancel-subscription-response.md b/doc/models/cancel-subscription-response.md deleted file mode 100644 index b5592134a..000000000 --- a/doc/models/cancel-subscription-response.md +++ /dev/null @@ -1,146 +0,0 @@ - -# Cancel Subscription Response - -Defines output parameters in a response from the -[CancelSubscription](../../doc/api/subscriptions.md#cancel-subscription) endpoint. - -## Structure - -`CancelSubscriptionResponse` - -## Fields - -| 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 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) - -```json -{ - "subscription": { - "canceled_date": "2023-06-05", - "card_id": "ccof:qy5x8hHGYsgLrp4Q4GB", - "created_at": "2022-01-19T21:53:10Z", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "id": "910afd30-464a-4e00-a8d8-2296e", - "invoice_ids": [ - "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA" - ], - "location_id": "S8GWD5R9QB376", - "paid_until_date": "2023-12-31", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "source": { - "name": "My Application" - }, - "start_date": "2022-01-19", - "status": "ACTIVE", - "timezone": "America/Los_Angeles", - "version": 3 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "actions": [ - { - "id": "id8", - "type": "RESUME", - "effective_date": "effective_date8", - "monthly_billing_anchor_date": 186, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - }, - { - "id": "id8", - "type": "RESUME", - "effective_date": "effective_date8", - "monthly_billing_anchor_date": 186, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - }, - { - "id": "id8", - "type": "RESUME", - "effective_date": "effective_date8", - "monthly_billing_anchor_date": 186, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - } - ] -} -``` - diff --git a/doc/models/cancel-terminal-action-response.md b/doc/models/cancel-terminal-action-response.md deleted file mode 100644 index 5a887a1ec..000000000 --- a/doc/models/cancel-terminal-action-response.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Cancel Terminal Action Response - -## Structure - -`CancelTerminalActionResponse` - -## 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", - "cancel_reason": "SELLER_CANCELED", - "created_at": "2021-07-28T23:22:07.476Z", - "deadline_duration": "PT5M", - "device_id": "DEVICE_ID", - "id": "termapia:jveJIAkkAjILHkdCE", - "location_id": "LOCATION_ID", - "save_card_options": { - "customer_id": "CUSTOMER_ID", - "reference_id": "user-id-1" - }, - "status": "CANCELED", - "type": "SAVE_CARD", - "updated_at": "2021-07-28T23:22:29.511Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/cancel-terminal-checkout-response.md b/doc/models/cancel-terminal-checkout-response.md deleted file mode 100644 index c1ef60704..000000000 --- a/doc/models/cancel-terminal-checkout-response.md +++ /dev/null @@ -1,79 +0,0 @@ - -# Cancel Terminal Checkout Response - -## Structure - -`CancelTerminalCheckoutResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `checkout` | [`TerminalCheckout \| undefined`](../../doc/models/terminal-checkout.md) | Optional | Represents a checkout processed by the Square Terminal. | - -## Example (as JSON) - -```json -{ - "checkout": { - "amount_money": { - "amount": 123, - "currency": "USD" - }, - "app_id": "APP_ID", - "cancel_reason": "SELLER_CANCELED", - "created_at": "2020-03-16T15:31:19.934Z", - "deadline_duration": "PT5M", - "device_options": { - "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", - "skip_receipt_screen": true, - "tip_settings": { - "allow_tipping": true, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "collect_signature": false, - "show_itemized_cart": false - }, - "id": "S1yDlPQx7slqO", - "location_id": "LOCATION_ID", - "reference_id": "id36815", - "status": "CANCELED", - "updated_at": "2020-03-16T15:31:45.787Z", - "note": "note8", - "order_id": "order_id6", - "payment_options": { - "autocomplete": false, - "delay_duration": "delay_duration2", - "accept_partial_authorization": false, - "delay_action": "CANCEL" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/cancel-terminal-refund-response.md b/doc/models/cancel-terminal-refund-response.md deleted file mode 100644 index 4469b1fe5..000000000 --- a/doc/models/cancel-terminal-refund-response.md +++ /dev/null @@ -1,69 +0,0 @@ - -# Cancel Terminal Refund Response - -## Structure - -`CancelTerminalRefundResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `refund` | [`TerminalRefund \| undefined`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | - -## Example (as JSON) - -```json -{ - "refund": { - "amount_money": { - "amount": 100, - "currency": "CAD" - }, - "app_id": "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", - "cancel_reason": "SELLER_CANCELED", - "card": { - "bin": "411111", - "card_brand": "INTERAC", - "card_type": "CREDIT", - "exp_month": 1, - "exp_year": 2022, - "fingerprint": "sq-1-B1fP9MNNmZgVVaPKRND6oDKYbz25S2cTvg9Mzwg3RMTK1zT1PiGRT-AE3nTA8vSmmw", - "last_4": "1111" - }, - "created_at": "2020-10-21T22:47:23.241Z", - "deadline_duration": "PT5M", - "device_id": "42690809-faa2-4701-a24b-19d3d34c9aaa", - "id": "g6ycb6HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "location_id": "76C9W6K8CNNQ5", - "order_id": "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", - "payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "reason": "reason", - "status": "CANCELED", - "updated_at": "2020-10-21T22:47:30.096Z", - "refund_id": "refund_id2" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/capture-transaction-response.md b/doc/models/capture-transaction-response.md deleted file mode 100644 index 53215e7e4..000000000 --- a/doc/models/capture-transaction-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Capture Transaction Response - -Defines the fields that are included in the response body of -a request to the [CaptureTransaction](api-endpoint:Transactions-CaptureTransaction) endpoint. - -## Structure - -`CaptureTransactionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/card-brand.md b/doc/models/card-brand.md deleted file mode 100644 index 01ab84733..000000000 --- a/doc/models/card-brand.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Card Brand - -Indicates a card's brand, such as `VISA` or `MASTERCARD`. - -## Enumeration - -`CardBrand` - -## Fields - -| Name | -| --- | -| `OTHER_BRAND` | -| `VISA` | -| `MASTERCARD` | -| `AMERICAN_EXPRESS` | -| `DISCOVER` | -| `DISCOVER_DINERS` | -| `JCB` | -| `CHINA_UNIONPAY` | -| `SQUARE_GIFT_CARD` | -| `SQUARE_CAPITAL_CARD` | -| `INTERAC` | -| `EFTPOS` | -| `FELICA` | -| `EBT` | - diff --git a/doc/models/card-co-brand.md b/doc/models/card-co-brand.md deleted file mode 100644 index 8e5872dac..000000000 --- a/doc/models/card-co-brand.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Card Co Brand - -Indicates the brand for a co-branded card. - -## Enumeration - -`CardCoBrand` - -## Fields - -| Name | -| --- | -| `UNKNOWN` | -| `AFTERPAY` | -| `CLEARPAY` | - diff --git a/doc/models/card-payment-details.md b/doc/models/card-payment-details.md deleted file mode 100644 index 758cdeb3a..000000000 --- a/doc/models/card-payment-details.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Card Payment Details - -Reflects the current status of a card payment. Contains only non-confidential information. - -## Structure - -`CardPaymentDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `status` | `string \| null \| undefined` | Optional | The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or
FAILED.
**Constraints**: *Maximum Length*: `50` | -| `card` | [`Card \| undefined`](../../doc/models/card.md) | Optional | Represents the payment details of a card to be used for payments. These
details are determined by the payment token generated by Web Payments SDK. | -| `entryMethod` | `string \| null \| undefined` | Optional | The method used to enter the card's details for the payment. The method can be
`KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
**Constraints**: *Maximum Length*: `50` | -| `cvvStatus` | `string \| null \| undefined` | Optional | The status code returned from the Card Verification Value (CVV) check. The code can be
`CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`.
**Constraints**: *Maximum Length*: `50` | -| `avsStatus` | `string \| null \| undefined` | Optional | The status code returned from the Address Verification System (AVS) check. The code can be
`AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`.
**Constraints**: *Maximum Length*: `50` | -| `authResultCode` | `string \| null \| undefined` | Optional | The status code returned by the card issuer that describes the payment's
authorization status.
**Constraints**: *Maximum Length*: `10` | -| `applicationIdentifier` | `string \| null \| undefined` | Optional | For EMV payments, the application ID identifies the EMV application used for the payment.
**Constraints**: *Maximum Length*: `32` | -| `applicationName` | `string \| null \| undefined` | Optional | For EMV payments, the human-readable name of the EMV application used for the payment.
**Constraints**: *Maximum Length*: `16` | -| `applicationCryptogram` | `string \| null \| undefined` | Optional | For EMV payments, the cryptogram generated for the payment.
**Constraints**: *Maximum Length*: `16` | -| `verificationMethod` | `string \| null \| undefined` | Optional | For EMV payments, the method used to verify the cardholder's identity. The method can be
`PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`.
**Constraints**: *Maximum Length*: `50` | -| `verificationResults` | `string \| null \| undefined` | Optional | For EMV payments, the results of the cardholder verification. The result can be
`SUCCESS`, `FAILURE`, or `UNKNOWN`.
**Constraints**: *Maximum Length*: `50` | -| `statementDescription` | `string \| null \| undefined` | Optional | The statement description sent to the card networks.

Note: The actual statement description varies and is likely to be truncated and appended with
additional information on a per issuer basis.
**Constraints**: *Maximum Length*: `50` | -| `deviceDetails` | [`DeviceDetails \| undefined`](../../doc/models/device-details.md) | Optional | Details about the device that took the payment. | -| `cardPaymentTimeline` | [`CardPaymentTimeline \| undefined`](../../doc/models/card-payment-timeline.md) | Optional | The timeline for card payments. | -| `refundRequiresCardPresence` | `boolean \| null \| undefined` | Optional | Whether the card must be physically present for the payment to
be refunded. If set to `true`, the card must be present. | -| `errors` | [`Error[] \| null \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "status": "status6", - "card": { - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "entry_method": "entry_method8", - "cvv_status": "cvv_status4", - "avs_status": "avs_status6" -} -``` - diff --git a/doc/models/card-payment-timeline.md b/doc/models/card-payment-timeline.md deleted file mode 100644 index dc1c881de..000000000 --- a/doc/models/card-payment-timeline.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Card Payment Timeline - -The timeline for card payments. - -## Structure - -`CardPaymentTimeline` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `authorizedAt` | `string \| null \| undefined` | Optional | The timestamp when the payment was authorized, in RFC 3339 format. | -| `capturedAt` | `string \| null \| undefined` | Optional | The timestamp when the payment was captured, in RFC 3339 format. | -| `voidedAt` | `string \| null \| undefined` | Optional | The timestamp when the payment was voided, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "authorized_at": "authorized_at2", - "captured_at": "captured_at2", - "voided_at": "voided_at6" -} -``` - diff --git a/doc/models/card-prepaid-type.md b/doc/models/card-prepaid-type.md deleted file mode 100644 index 2e3352df5..000000000 --- a/doc/models/card-prepaid-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Card Prepaid Type - -Indicates a card's prepaid type, such as `NOT_PREPAID` or `PREPAID`. - -## Enumeration - -`CardPrepaidType` - -## Fields - -| Name | -| --- | -| `UNKNOWN_PREPAID_TYPE` | -| `NOT_PREPAID` | -| `PREPAID` | - diff --git a/doc/models/card-type.md b/doc/models/card-type.md deleted file mode 100644 index 97b9f084c..000000000 --- a/doc/models/card-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Card Type - -Indicates a card's type, such as `CREDIT` or `DEBIT`. - -## Enumeration - -`CardType` - -## Fields - -| Name | -| --- | -| `UNKNOWN_CARD_TYPE` | -| `CREDIT` | -| `DEBIT` | - diff --git a/doc/models/card.md b/doc/models/card.md deleted file mode 100644 index 99f9ab552..000000000 --- a/doc/models/card.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Card - -Represents the payment details of a card to be used for payments. These -details are determined by the payment token generated by Web Payments SDK. - -## Structure - -`Card` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | Unique ID for this card. Generated by Square.
**Constraints**: *Maximum Length*: `64` | -| `cardBrand` | [`string \| undefined`](../../doc/models/card-brand.md) | Optional | Indicates a card's brand, such as `VISA` or `MASTERCARD`. | -| `last4` | `string \| undefined` | Optional | The last 4 digits of the card number.
**Constraints**: *Maximum Length*: `4` | -| `expMonth` | `bigint \| null \| undefined` | Optional | The expiration month of the associated card as an integer between 1 and 12. | -| `expYear` | `bigint \| null \| undefined` | Optional | The four-digit year of the card's expiration date. | -| `cardholderName` | `string \| null \| undefined` | Optional | The name of the cardholder.
**Constraints**: *Maximum Length*: `96` | -| `billingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `fingerprint` | `string \| undefined` | Optional | Intended as a Square-assigned identifier, based
on the card number, to identify the card across multiple locations within a
single application.
**Constraints**: *Maximum Length*: `255` | -| `customerId` | `string \| null \| undefined` | Optional | **Required** The ID of a customer created using the Customers API to be associated with the card. | -| `merchantId` | `string \| undefined` | Optional | The ID of the merchant associated with the card. | -| `referenceId` | `string \| null \| undefined` | Optional | An optional user-defined reference ID that associates this card with
another entity in an external system. For example, a customer ID from an
external customer management system.
**Constraints**: *Maximum Length*: `128` | -| `enabled` | `boolean \| undefined` | Optional | Indicates whether or not a card can be used for payments. | -| `cardType` | [`string \| undefined`](../../doc/models/card-type.md) | Optional | Indicates a card's type, such as `CREDIT` or `DEBIT`. | -| `prepaidType` | [`string \| undefined`](../../doc/models/card-prepaid-type.md) | Optional | Indicates a card's prepaid type, such as `NOT_PREPAID` or `PREPAID`. | -| `bin` | `string \| undefined` | Optional | The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API
returns this field.
**Constraints**: *Maximum Length*: `6` | -| `version` | `bigint \| undefined` | Optional | Current version number of the card. Increments with each card update. Requests to update an
existing Card object will be rejected unless the version in the request matches the current
version for the Card. | -| `cardCoBrand` | [`string \| undefined`](../../doc/models/card-co-brand.md) | Optional | Indicates the brand for a co-branded card. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "card_brand": "INTERAC", - "last_4": "last_42", - "exp_month": 240, - "exp_year": 56 -} -``` - diff --git a/doc/models/cash-app-details.md b/doc/models/cash-app-details.md deleted file mode 100644 index 292277e6a..000000000 --- a/doc/models/cash-app-details.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Cash App Details - -Additional details about `WALLET` type payments with the `brand` of `CASH_APP`. - -## Structure - -`CashAppDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `buyerFullName` | `string \| null \| undefined` | Optional | The name of the Cash App account holder.
**Constraints**: *Maximum Length*: `255` | -| `buyerCountryCode` | `string \| null \| undefined` | Optional | The country of the Cash App account holder, in ISO 3166-1-alpha-2 format.

For possible values, see [Country](entity:Country).
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `2` | -| `buyerCashtag` | `string \| undefined` | Optional | $Cashtag of the Cash App account holder.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `21` | - -## Example (as JSON) - -```json -{ - "buyer_full_name": "buyer_full_name0", - "buyer_country_code": "buyer_country_code0", - "buyer_cashtag": "buyer_cashtag2" -} -``` - diff --git a/doc/models/cash-drawer-device.md b/doc/models/cash-drawer-device.md deleted file mode 100644 index f4f4479d4..000000000 --- a/doc/models/cash-drawer-device.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Cash Drawer Device - -## Structure - -`CashDrawerDevice` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The device Square-issued ID | -| `name` | `string \| null \| undefined` | Optional | The device merchant-specified name. | - -## Example (as JSON) - -```json -{ - "id": "id2", - "name": "name2" -} -``` - diff --git a/doc/models/cash-drawer-event-type.md b/doc/models/cash-drawer-event-type.md deleted file mode 100644 index afb4d4e70..000000000 --- a/doc/models/cash-drawer-event-type.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Cash Drawer Event Type - -The types of events on a CashDrawerShift. -Each event type represents an employee action on the actual cash drawer -represented by a CashDrawerShift. - -## Enumeration - -`CashDrawerEventType` - -## Fields - -| Name | Description | -| --- | --- | -| `NO_SALE` | Triggered when a no sale occurs on a cash drawer.
A CashDrawerEvent of this type must have a zero money amount. | -| `CASH_TENDER_PAYMENT` | Triggered when a cash tender payment occurs on a cash drawer.
A CashDrawerEvent of this type can must not have a negative amount. | -| `OTHER_TENDER_PAYMENT` | Triggered when a check, gift card, or other non-cash payment occurs
on a cash drawer.
A CashDrawerEvent of this type must have a zero money amount. | -| `CASH_TENDER_CANCELLED_PAYMENT` | Triggered when a split tender bill is cancelled after cash has been
tendered.
A CASH_TENDER_CANCELLED_PAYMENT should have a corresponding CASH_TENDER_PAYMENT.
A CashDrawerEvent of this type must not have a negative amount. | -| `OTHER_TENDER_CANCELLED_PAYMENT` | Triggered when a split tender bill is cancelled after a non-cash tender
has been tendered. An OTHER_TENDER_CANCELLED_PAYMENT should have a corresponding
OTHER_TENDER_PAYMENT. A CashDrawerEvent of this type must have a zero money
amount. | -| `CASH_TENDER_REFUND` | Triggered when a cash tender refund occurs.
A CashDrawerEvent of this type must not have a negative amount. | -| `OTHER_TENDER_REFUND` | Triggered when an other tender refund occurs.
A CashDrawerEvent of this type must have a zero money amount. | -| `PAID_IN` | Triggered when money unrelated to a payment is added to the cash drawer.
For example, an employee adds coins to the drawer.
A CashDrawerEvent of this type must not have a negative amount. | -| `PAID_OUT` | Triggered when money is removed from the drawer for other reasons
than making change.
For example, an employee pays a delivery person with cash from the cash drawer.
A CashDrawerEvent of this type must not have a negative amount. | - diff --git a/doc/models/cash-drawer-shift-event.md b/doc/models/cash-drawer-shift-event.md deleted file mode 100644 index f4174513d..000000000 --- a/doc/models/cash-drawer-shift-event.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Cash Drawer Shift Event - -## Structure - -`CashDrawerShiftEvent` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The unique ID of the event. | -| `eventType` | [`string \| undefined`](../../doc/models/cash-drawer-event-type.md) | Optional | The types of events on a CashDrawerShift.
Each event type represents an employee action on the actual cash drawer
represented by a CashDrawerShift. | -| `eventMoney` | [`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. | -| `createdAt` | `string \| undefined` | Optional | The event time in RFC 3339 format. | -| `description` | `string \| null \| undefined` | Optional | An optional description of the event, entered by the employee that
created the event. | -| `teamMemberId` | `string \| undefined` | Optional | The ID of the team member that created the event. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "event_type": "OTHER_TENDER_PAYMENT", - "event_money": { - "amount": 148, - "currency": "SDG" - }, - "created_at": "created_at4", - "description": "description6" -} -``` - diff --git a/doc/models/cash-drawer-shift-state.md b/doc/models/cash-drawer-shift-state.md deleted file mode 100644 index 7c9e3dbb0..000000000 --- a/doc/models/cash-drawer-shift-state.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Cash Drawer Shift State - -The current state of a cash drawer shift. - -## Enumeration - -`CashDrawerShiftState` - -## Fields - -| Name | Description | -| --- | --- | -| `OPEN` | An open cash drawer shift. | -| `ENDED` | A cash drawer shift that is ended but has not yet had an employee content audit. | -| `CLOSED` | An ended cash drawer shift that is closed with a completed employee
content audit and recorded result. | - diff --git a/doc/models/cash-drawer-shift-summary.md b/doc/models/cash-drawer-shift-summary.md deleted file mode 100644 index 6be35eebf..000000000 --- a/doc/models/cash-drawer-shift-summary.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Cash Drawer Shift Summary - -The summary of a closed cash drawer shift. -This model contains only the money counted to start a cash drawer shift, counted -at the end of the shift, and the amount that should be in the drawer at shift -end based on summing all cash drawer shift events. - -## Structure - -`CashDrawerShiftSummary` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The shift unique ID. | -| `state` | [`string \| undefined`](../../doc/models/cash-drawer-shift-state.md) | Optional | The current state of a cash drawer shift. | -| `openedAt` | `string \| null \| undefined` | Optional | The shift start time in ISO 8601 format. | -| `endedAt` | `string \| null \| undefined` | Optional | The shift end time in ISO 8601 format. | -| `closedAt` | `string \| null \| undefined` | Optional | The shift close time in ISO 8601 format. | -| `description` | `string \| null \| undefined` | Optional | An employee free-text description of a cash drawer shift. | -| `openedCashMoney` | [`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. | -| `expectedCashMoney` | [`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. | -| `closedCashMoney` | [`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. | -| `createdAt` | `string \| undefined` | Optional | The shift start time in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The shift updated at time in RFC 3339 format. | -| `locationId` | `string \| undefined` | Optional | The ID of the location the cash drawer shift belongs to. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "state": "CLOSED", - "opened_at": "opened_at8", - "ended_at": "ended_at2", - "closed_at": "closed_at2" -} -``` - diff --git a/doc/models/cash-drawer-shift.md b/doc/models/cash-drawer-shift.md deleted file mode 100644 index 759b73331..000000000 --- a/doc/models/cash-drawer-shift.md +++ /dev/null @@ -1,50 +0,0 @@ - -# Cash Drawer Shift - -This model gives the details of a cash drawer shift. -The cash_payment_money, cash_refund_money, cash_paid_in_money, -and cash_paid_out_money fields are all computed by summing their respective -event types. - -## Structure - -`CashDrawerShift` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The shift unique ID. | -| `state` | [`string \| undefined`](../../doc/models/cash-drawer-shift-state.md) | Optional | The current state of a cash drawer shift. | -| `openedAt` | `string \| null \| undefined` | Optional | The time when the shift began, in ISO 8601 format. | -| `endedAt` | `string \| null \| undefined` | Optional | The time when the shift ended, in ISO 8601 format. | -| `closedAt` | `string \| null \| undefined` | Optional | The time when the shift was closed, in ISO 8601 format. | -| `description` | `string \| null \| undefined` | Optional | The free-form text description of a cash drawer by an employee. | -| `openedCashMoney` | [`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. | -| `cashPaymentMoney` | [`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. | -| `cashRefundsMoney` | [`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. | -| `cashPaidInMoney` | [`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. | -| `cashPaidOutMoney` | [`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. | -| `expectedCashMoney` | [`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. | -| `closedCashMoney` | [`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. | -| `device` | [`CashDrawerDevice \| undefined`](../../doc/models/cash-drawer-device.md) | Optional | - | -| `createdAt` | `string \| undefined` | Optional | The shift start time in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The shift updated at time in RFC 3339 format. | -| `locationId` | `string \| undefined` | Optional | The ID of the location the cash drawer shift belongs to. | -| `teamMemberIds` | `string[] \| undefined` | Optional | The IDs of all team members that were logged into Square Point of Sale at any
point while the cash drawer shift was open. | -| `openingTeamMemberId` | `string \| undefined` | Optional | The ID of the team member that started the cash drawer shift. | -| `endingTeamMemberId` | `string \| undefined` | Optional | The ID of the team member that ended the cash drawer shift. | -| `closingTeamMemberId` | `string \| undefined` | Optional | The ID of the team member that closed the cash drawer shift by auditing
the cash drawer contents. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "state": "OPEN", - "opened_at": "opened_at4", - "ended_at": "ended_at8", - "closed_at": "closed_at8" -} -``` - diff --git a/doc/models/cash-payment-details.md b/doc/models/cash-payment-details.md deleted file mode 100644 index 4e387bb63..000000000 --- a/doc/models/cash-payment-details.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Cash Payment Details - -Stores details about a cash payment. Contains only non-confidential information. For more information, see -[Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). - -## Structure - -`CashPaymentDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `buyerSuppliedMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `changeBackMoney` | [`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 -{ - "buyer_supplied_money": { - "amount": 114, - "currency": "XTS" - }, - "change_back_money": { - "amount": 78, - "currency": "XBD" - } -} -``` - diff --git a/doc/models/catalog-availability-period.md b/doc/models/catalog-availability-period.md deleted file mode 100644 index dbbd6ddf4..000000000 --- a/doc/models/catalog-availability-period.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Availability Period - -Represents a time period of availability. - -## Structure - -`CatalogAvailabilityPeriod` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `startLocalTime` | `string \| null \| undefined` | Optional | The start time of an availability period, specified in local time using partial-time
RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.
Note that the seconds value is always :00, but it is appended for conformance to the RFC. | -| `endLocalTime` | `string \| null \| undefined` | Optional | The end time of an availability period, specified in local time using partial-time
RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.
Note that the seconds value is always :00, but it is appended for conformance to the RFC. | -| `dayOfWeek` | [`string \| undefined`](../../doc/models/day-of-week.md) | Optional | Indicates the specific day of the week. | - -## Example (as JSON) - -```json -{ - "start_local_time": "start_local_time6", - "end_local_time": "end_local_time8", - "day_of_week": "WED" -} -``` - diff --git a/doc/models/catalog-category-type.md b/doc/models/catalog-category-type.md deleted file mode 100644 index 6d70fc37d..000000000 --- a/doc/models/catalog-category-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Catalog Category Type - -Indicates the type of a category. - -## Enumeration - -`CatalogCategoryType` - -## Fields - -| Name | Description | -| --- | --- | -| `REGULAR_CATEGORY` | The regular category. | -| `MENU_CATEGORY` | The menu category. | -| `KITCHEN_CATEGORY` | Kitchen categories are used by KDS (Kitchen Display System) to route items to specific clients | - diff --git a/doc/models/catalog-category.md b/doc/models/catalog-category.md deleted file mode 100644 index 783fc2479..000000000 --- a/doc/models/catalog-category.md +++ /dev/null @@ -1,52 +0,0 @@ - -# Catalog Category - -A category to which a `CatalogItem` instance belongs. - -## Structure - -`CatalogCategory` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The category name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
**Constraints**: *Maximum Length*: `255` | -| `imageIds` | `string[] \| null \| undefined` | Optional | The IDs of images associated with this `CatalogCategory` instance.
Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications. | -| `categoryType` | [`string \| undefined`](../../doc/models/catalog-category-type.md) | Optional | Indicates the type of a category. | -| `parentCategory` | [`CatalogObjectCategory \| undefined`](../../doc/models/catalog-object-category.md) | Optional | A category that can be assigned to an item or a parent category that can be assigned
to another category. For example, a clothing category can be assigned to a t-shirt item or
be made as the parent category to the pants category. | -| `isTopLevel` | `boolean \| null \| undefined` | Optional | Indicates whether a category is a top level category, which does not have any parent_category. | -| `channels` | `string[] \| null \| undefined` | Optional | A list of IDs representing channels, such as a Square Online site, where the category can be made visible. | -| `availabilityPeriodIds` | `string[] \| null \| undefined` | Optional | The IDs of the `CatalogAvailabilityPeriod` objects associated with the category. | -| `onlineVisibility` | `boolean \| null \| undefined` | Optional | Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites. | -| `rootCategory` | `string \| undefined` | Optional | The top-level category in a category hierarchy. | -| `ecomSeoData` | [`CatalogEcomSeoData \| undefined`](../../doc/models/catalog-ecom-seo-data.md) | Optional | SEO data for for a seller's Square Online store. | -| `pathToRoot` | [`CategoryPathToRootNode[] \| null \| undefined`](../../doc/models/category-path-to-root-node.md) | Optional | The path from the category to its root category. The first node of the path is the parent of the category
and the last is the root category. The path is empty if the category is a root category. | - -## Example (as JSON) - -```json -{ - "object": { - "category_data": { - "name": "Beverages" - }, - "id": "#Beverages", - "present_at_all_locations": true, - "type": "CATEGORY" - }, - "name": "name2", - "image_ids": [ - "image_ids7", - "image_ids6", - "image_ids5" - ], - "category_type": "REGULAR_CATEGORY", - "parent_category": { - "id": "id4", - "ordinal": 114 - }, - "is_top_level": false -} -``` - diff --git a/doc/models/catalog-custom-attribute-definition-app-visibility.md b/doc/models/catalog-custom-attribute-definition-app-visibility.md deleted file mode 100644 index 1e1bca2d3..000000000 --- a/doc/models/catalog-custom-attribute-definition-app-visibility.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Catalog Custom Attribute Definition App Visibility - -Defines the visibility of a custom attribute to applications other than their -creating application. - -## Enumeration - -`CatalogCustomAttributeDefinitionAppVisibility` - -## Fields - -| Name | Description | -| --- | --- | -| `APP_VISIBILITY_HIDDEN` | Other applications cannot read this custom attribute. | -| `APP_VISIBILITY_READ_ONLY` | Other applications can read this custom attribute definition and
values. | -| `APP_VISIBILITY_READ_WRITE_VALUES` | Other applications can read and write custom attribute values on objects.
They can read but cannot edit the custom attribute definition. | - diff --git a/doc/models/catalog-custom-attribute-definition-number-config.md b/doc/models/catalog-custom-attribute-definition-number-config.md deleted file mode 100644 index f4580169a..000000000 --- a/doc/models/catalog-custom-attribute-definition-number-config.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Catalog Custom Attribute Definition Number Config - -## Structure - -`CatalogCustomAttributeDefinitionNumberConfig` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `precision` | `number \| null \| undefined` | Optional | An integer between 0 and 5 that represents the maximum number of
positions allowed after the decimal in number custom attribute values
For example:

- if the precision is 0, the quantity can be 1, 2, 3, etc.
- if the precision is 1, the quantity can be 0.1, 0.2, etc.
- if the precision is 2, the quantity can be 0.01, 0.12, etc.

Default: 5
**Constraints**: `<= 5` | - -## Example (as JSON) - -```json -{ - "precision": 208 -} -``` - diff --git a/doc/models/catalog-custom-attribute-definition-selection-config-custom-attribute-selection.md b/doc/models/catalog-custom-attribute-definition-selection-config-custom-attribute-selection.md deleted file mode 100644 index f627a6f04..000000000 --- a/doc/models/catalog-custom-attribute-definition-selection-config-custom-attribute-selection.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Catalog Custom Attribute Definition Selection Config Custom Attribute Selection - -A named selection for this `SELECTION`-type custom attribute definition. - -## Structure - -`CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | Unique ID set by Square. | -| `name` | `string` | Required | Selection name, unique within `allowed_selections`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "uid": "uid4", - "name": "name4" -} -``` - diff --git a/doc/models/catalog-custom-attribute-definition-selection-config.md b/doc/models/catalog-custom-attribute-definition-selection-config.md deleted file mode 100644 index ff113e4a4..000000000 --- a/doc/models/catalog-custom-attribute-definition-selection-config.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Catalog Custom Attribute Definition Selection Config - -Configuration associated with `SELECTION`-type custom attribute definitions. - -## Structure - -`CatalogCustomAttributeDefinitionSelectionConfig` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `maxAllowedSelections` | `number \| null \| undefined` | Optional | The maximum number of selections that can be set. The maximum value for this
attribute is 100. The default value is 1. The value can be modified, but changing the value will not
affect existing custom attribute values on objects. Clients need to
handle custom attributes with more selected values than allowed by this limit.
**Constraints**: `<= 100` | -| `allowedSelections` | [`CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[] \| null \| undefined`](../../doc/models/catalog-custom-attribute-definition-selection-config-custom-attribute-selection.md) | Optional | The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100
selections can be defined. Can be modified. | - -## Example (as JSON) - -```json -{ - "max_allowed_selections": 124, - "allowed_selections": [ - { - "uid": "uid0", - "name": "name0" - }, - { - "uid": "uid0", - "name": "name0" - }, - { - "uid": "uid0", - "name": "name0" - } - ] -} -``` - diff --git a/doc/models/catalog-custom-attribute-definition-seller-visibility.md b/doc/models/catalog-custom-attribute-definition-seller-visibility.md deleted file mode 100644 index fb20e292b..000000000 --- a/doc/models/catalog-custom-attribute-definition-seller-visibility.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Catalog Custom Attribute Definition Seller Visibility - -Defines the visibility of a custom attribute to sellers in Square -client applications, Square APIs or in Square UIs (including Square Point -of Sale applications and Square Dashboard). - -## Enumeration - -`CatalogCustomAttributeDefinitionSellerVisibility` - -## Fields - -| Name | Description | -| --- | --- | -| `SELLER_VISIBILITY_HIDDEN` | Sellers cannot read this custom attribute in Square client
applications or Square APIs. | -| `SELLER_VISIBILITY_READ_WRITE_VALUES` | Sellers can read and write this custom attribute value in catalog objects,
but cannot edit the custom attribute definition. | - diff --git a/doc/models/catalog-custom-attribute-definition-string-config.md b/doc/models/catalog-custom-attribute-definition-string-config.md deleted file mode 100644 index f6d4f8a25..000000000 --- a/doc/models/catalog-custom-attribute-definition-string-config.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Catalog Custom Attribute Definition String Config - -Configuration associated with Custom Attribute Definitions of type `STRING`. - -## Structure - -`CatalogCustomAttributeDefinitionStringConfig` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `enforceUniqueness` | `boolean \| null \| undefined` | Optional | If true, each Custom Attribute instance associated with this Custom Attribute
Definition must have a unique value within the seller's catalog. For
example, this may be used for a value like a SKU that should not be
duplicated within a seller's catalog. May not be modified after the
definition has been created. | - -## Example (as JSON) - -```json -{ - "enforce_uniqueness": false -} -``` - diff --git a/doc/models/catalog-custom-attribute-definition-type.md b/doc/models/catalog-custom-attribute-definition-type.md deleted file mode 100644 index 7d5c56bd5..000000000 --- a/doc/models/catalog-custom-attribute-definition-type.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Catalog Custom Attribute Definition Type - -Defines the possible types for a custom attribute. - -## Enumeration - -`CatalogCustomAttributeDefinitionType` - -## Fields - -| Name | Description | -| --- | --- | -| `STRING` | A free-form string containing up to 255 characters. | -| `BOOLEAN` | A `true` or `false` value. | -| `NUMBER` | A decimal string representation of a number. Can support up to 5 digits after the decimal point. | -| `SELECTION` | One or more choices from `allowed_selections`. | - diff --git a/doc/models/catalog-custom-attribute-definition.md b/doc/models/catalog-custom-attribute-definition.md deleted file mode 100644 index 7e44ff5d1..000000000 --- a/doc/models/catalog-custom-attribute-definition.md +++ /dev/null @@ -1,54 +0,0 @@ - -# Catalog Custom Attribute Definition - -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) - -## Structure - -`CatalogCustomAttributeDefinition` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string`](../../doc/models/catalog-custom-attribute-definition-type.md) | Required | Defines the possible types for a custom attribute. | -| `name` | `string` | Required | The name of this definition for API and seller-facing UI purposes.
The name must be unique within the (merchant, application) pair. Required.
May not be empty and may not exceed 255 characters. Can be modified after creation.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `description` | `string \| null \| undefined` | Optional | Seller-oriented description of the meaning of this Custom Attribute,
any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs.
**Constraints**: *Maximum Length*: `255` | -| `sourceApplication` | [`SourceApplication \| undefined`](../../doc/models/source-application.md) | Optional | Represents information about the application used to generate a change. | -| `allowedObjectTypes` | [`string[]`](../../doc/models/catalog-object-type.md) | Required | The set of `CatalogObject` types that this custom atttribute may be applied to.
Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included.
See [CatalogObjectType](#type-catalogobjecttype) for possible values | -| `sellerVisibility` | [`string \| undefined`](../../doc/models/catalog-custom-attribute-definition-seller-visibility.md) | Optional | Defines the visibility of a custom attribute to sellers in Square
client applications, Square APIs or in Square UIs (including Square Point
of Sale applications and Square Dashboard). | -| `appVisibility` | [`string \| undefined`](../../doc/models/catalog-custom-attribute-definition-app-visibility.md) | Optional | Defines the visibility of a custom attribute to applications other than their
creating application. | -| `stringConfig` | [`CatalogCustomAttributeDefinitionStringConfig \| undefined`](../../doc/models/catalog-custom-attribute-definition-string-config.md) | Optional | Configuration associated with Custom Attribute Definitions of type `STRING`. | -| `numberConfig` | [`CatalogCustomAttributeDefinitionNumberConfig \| undefined`](../../doc/models/catalog-custom-attribute-definition-number-config.md) | Optional | - | -| `selectionConfig` | [`CatalogCustomAttributeDefinitionSelectionConfig \| undefined`](../../doc/models/catalog-custom-attribute-definition-selection-config.md) | Optional | Configuration associated with `SELECTION`-type custom attribute definitions. | -| `customAttributeUsageCount` | `number \| undefined` | Optional | The number of custom attributes that reference this
custom attribute definition. Set by the server in response to a ListCatalog
request with `include_counts` set to `true`. If the actual count is greater
than 100, `custom_attribute_usage_count` will be set to `100`. | -| `key` | `string \| null \| undefined` | Optional | The name of the desired custom attribute key that can be used to access
the custom attribute value on catalog objects. Cannot be modified after the
custom attribute definition has been created.
Must be between 1 and 60 characters, and may only contain the characters `[a-zA-Z0-9_-]`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `60`, *Pattern*: `^[a-zA-Z0-9_-]*$` | - -## Example (as JSON) - -```json -{ - "type": "STRING", - "name": "name0", - "description": "description0", - "source_application": { - "product": "BILLING", - "application_id": "application_id8", - "name": "name2" - }, - "allowed_object_types": [ - "CATEGORY", - "IMAGE" - ], - "seller_visibility": "SELLER_VISIBILITY_HIDDEN", - "app_visibility": "APP_VISIBILITY_HIDDEN", - "string_config": { - "enforce_uniqueness": false - } -} -``` - diff --git a/doc/models/catalog-custom-attribute-value.md b/doc/models/catalog-custom-attribute-value.md deleted file mode 100644 index d4c1e3eee..000000000 --- a/doc/models/catalog-custom-attribute-value.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Catalog Custom Attribute Value - -An instance of a custom attribute. Custom attributes can be defined and -added to `ITEM` and `ITEM_VARIATION` type catalog objects. -[Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes). - -## Structure - -`CatalogCustomAttributeValue` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The name of the custom attribute. | -| `stringValue` | `string \| null \| undefined` | Optional | The string value of the custom attribute. Populated if `type` = `STRING`. | -| `customAttributeDefinitionId` | `string \| undefined` | Optional | The id of the [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) this value belongs to. | -| `type` | [`string \| undefined`](../../doc/models/catalog-custom-attribute-definition-type.md) | Optional | Defines the possible types for a custom attribute. | -| `numberValue` | `string \| null \| undefined` | Optional | Populated if `type` = `NUMBER`. Contains a string
representation of a decimal number, using a `.` as the decimal separator. | -| `booleanValue` | `boolean \| null \| undefined` | Optional | A `true` or `false` value. Populated if `type` = `BOOLEAN`. | -| `selectionUidValues` | `string[] \| null \| undefined` | Optional | One or more choices from `allowed_selections`. Populated if `type` = `SELECTION`. | -| `key` | `string \| undefined` | Optional | If the associated `CatalogCustomAttributeDefinition` object is defined by another application, this key is prefixed by the defining application ID.
For example, if the CatalogCustomAttributeDefinition has a key attribute of "cocoa_brand" and the defining application ID is "abcd1234", this key is "abcd1234:cocoa_brand"
when the application making the request is different from the application defining the custom attribute definition. Otherwise, the key is simply "cocoa_brand". | - -## Example (as JSON) - -```json -{ - "name": "name2", - "string_value": "string_value6", - "custom_attribute_definition_id": "custom_attribute_definition_id0", - "type": "NUMBER", - "number_value": "number_value2" -} -``` - diff --git a/doc/models/catalog-discount-modify-tax-basis.md b/doc/models/catalog-discount-modify-tax-basis.md deleted file mode 100644 index 755c9fe22..000000000 --- a/doc/models/catalog-discount-modify-tax-basis.md +++ /dev/null @@ -1,14 +0,0 @@ - -# Catalog Discount Modify Tax Basis - -## Enumeration - -`CatalogDiscountModifyTaxBasis` - -## Fields - -| Name | Description | -| --- | --- | -| `MODIFY_TAX_BASIS` | Application of the discount will modify the tax basis. | -| `DO_NOT_MODIFY_TAX_BASIS` | Application of the discount will not modify the tax basis. | - diff --git a/doc/models/catalog-discount-type.md b/doc/models/catalog-discount-type.md deleted file mode 100644 index 5eae92154..000000000 --- a/doc/models/catalog-discount-type.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Catalog Discount Type - -How to apply a CatalogDiscount to a CatalogItem. - -## Enumeration - -`CatalogDiscountType` - -## Fields - -| Name | Description | -| --- | --- | -| `FIXED_PERCENTAGE` | Apply the discount as a fixed percentage (e.g., 5%) off the item price. | -| `FIXED_AMOUNT` | Apply the discount as a fixed amount (e.g., $1.00) off the item price. | -| `VARIABLE_PERCENTAGE` | Apply the discount as a variable percentage off the item price. The percentage will be specified at the time of sale. | -| `VARIABLE_AMOUNT` | Apply the discount as a variable amount off the item price. The amount will be specified at the time of sale. | - diff --git a/doc/models/catalog-discount.md b/doc/models/catalog-discount.md deleted file mode 100644 index 48557096f..000000000 --- a/doc/models/catalog-discount.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Catalog Discount - -A discount applicable to items. - -## Structure - -`CatalogDiscount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The discount name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
**Constraints**: *Maximum Length*: `255` | -| `discountType` | [`string \| undefined`](../../doc/models/catalog-discount-type.md) | Optional | How to apply a CatalogDiscount to a CatalogItem. | -| `percentage` | `string \| null \| undefined` | Optional | The percentage of the discount as a string representation of a decimal number, using a `.` as the decimal
separator and without a `%` sign. A value of `7.5` corresponds to `7.5%`. Specify a percentage of `0` if `discount_type`
is `VARIABLE_PERCENTAGE`.

Do not use this field for amount-based or variable discounts. | -| `amountMoney` | [`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. | -| `pinRequired` | `boolean \| null \| undefined` | Optional | Indicates whether a mobile staff member needs to enter their PIN to apply the
discount to a payment in the Square Point of Sale app. | -| `labelColor` | `string \| null \| undefined` | Optional | The color of the discount display label in the Square Point of Sale app. This must be a valid hex color code. | -| `modifyTaxBasis` | [`string \| undefined`](../../doc/models/catalog-discount-modify-tax-basis.md) | Optional | - | -| `maximumAmountMoney` | [`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 -{ - "object": { - "discount_data": { - "discount_type": "FIXED_PERCENTAGE", - "label_color": "red", - "name": "Welcome to the Dark(Roast) Side!", - "percentage": "5.4", - "pin_required": false - }, - "id": "#Maythe4th", - "present_at_all_locations": true, - "type": "DISCOUNT" - }, - "name": "name8", - "discount_type": "VARIABLE_PERCENTAGE", - "percentage": "percentage6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "pin_required": false -} -``` - diff --git a/doc/models/catalog-ecom-seo-data.md b/doc/models/catalog-ecom-seo-data.md deleted file mode 100644 index 5e97aabcb..000000000 --- a/doc/models/catalog-ecom-seo-data.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Ecom Seo Data - -SEO data for for a seller's Square Online store. - -## Structure - -`CatalogEcomSeoData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `pageTitle` | `string \| null \| undefined` | Optional | The SEO title used for the Square Online store. | -| `pageDescription` | `string \| null \| undefined` | Optional | The SEO description used for the Square Online store. | -| `permalink` | `string \| null \| undefined` | Optional | The SEO permalink used for the Square Online store. | - -## Example (as JSON) - -```json -{ - "page_title": "page_title6", - "page_description": "page_description2", - "permalink": "permalink0" -} -``` - diff --git a/doc/models/catalog-id-mapping.md b/doc/models/catalog-id-mapping.md deleted file mode 100644 index 7f90ddab5..000000000 --- a/doc/models/catalog-id-mapping.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Catalog Id Mapping - -A mapping between a temporary client-supplied ID and a permanent server-generated ID. - -When calling [UpsertCatalogObject](../../doc/api/catalog.md#upsert-catalog-object) or -[BatchUpsertCatalogObjects](../../doc/api/catalog.md#batch-upsert-catalog-objects) to -create a [CatalogObject](../../doc/models/catalog-object.md) instance, you can supply -a temporary ID for the to-be-created object, especially when the object is to be referenced -elsewhere in the same request body. This temporary ID can be any string unique within -the call, but must be prefixed by "#". - -After the request is submitted and the object created, a permanent server-generated ID is assigned -to the new object. The permanent ID is unique across the Square catalog. - -## Structure - -`CatalogIdMapping` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `clientObjectId` | `string \| null \| undefined` | Optional | The client-supplied temporary `#`-prefixed ID for a new `CatalogObject`. | -| `objectId` | `string \| null \| undefined` | Optional | The permanent ID for the CatalogObject created by the server. | - -## Example (as JSON) - -```json -{ - "client_object_id": "client_object_id8", - "object_id": "object_id0" -} -``` - diff --git a/doc/models/catalog-image.md b/doc/models/catalog-image.md deleted file mode 100644 index 4a2c01b13..000000000 --- a/doc/models/catalog-image.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Catalog Image - -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. - -## Structure - -`CatalogImage` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The internal name to identify this image in calls to the Square API.
This is a searchable attribute for use in applicable query filters
using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects).
It is not unique and should not be shown in a buyer facing context. | -| `url` | `string \| null \| undefined` | Optional | The URL of this image, generated by Square after an image is uploaded
using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint.
To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field. | -| `caption` | `string \| null \| undefined` | Optional | A caption that describes what is shown in the image. Displayed in the
Square Online Store. This is a searchable attribute for use in applicable query filters
using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). | -| `photoStudioOrderId` | `string \| null \| undefined` | Optional | The immutable order ID for this image object created by the Photo Studio service in Square Online Store. | - -## Example (as JSON) - -```json -{ - "name": "name0", - "url": "url4", - "caption": "caption4", - "photo_studio_order_id": "photo_studio_order_id2" -} -``` - diff --git a/doc/models/catalog-info-response-limits.md b/doc/models/catalog-info-response-limits.md deleted file mode 100644 index 8745250e4..000000000 --- a/doc/models/catalog-info-response-limits.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Catalog Info Response Limits - -## Structure - -`CatalogInfoResponseLimits` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `batchUpsertMaxObjectsPerBatch` | `number \| null \| undefined` | Optional | The maximum number of objects that may appear within a single batch in a
`/v2/catalog/batch-upsert` request. | -| `batchUpsertMaxTotalObjects` | `number \| null \| undefined` | Optional | The maximum number of objects that may appear across all batches in a
`/v2/catalog/batch-upsert` request. | -| `batchRetrieveMaxObjectIds` | `number \| null \| undefined` | Optional | The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve`
request. | -| `searchMaxPageLimit` | `number \| null \| undefined` | Optional | The maximum number of results that may be returned in a page of a
`/v2/catalog/search` response. | -| `batchDeleteMaxObjectIds` | `number \| null \| undefined` | Optional | The maximum number of object IDs that may be included in a single
`/v2/catalog/batch-delete` request. | -| `updateItemTaxesMaxItemIds` | `number \| null \| undefined` | Optional | The maximum number of item IDs that may be included in a single
`/v2/catalog/update-item-taxes` request. | -| `updateItemTaxesMaxTaxesToEnable` | `number \| null \| undefined` | Optional | The maximum number of tax IDs to be enabled that may be included in a single
`/v2/catalog/update-item-taxes` request. | -| `updateItemTaxesMaxTaxesToDisable` | `number \| null \| undefined` | Optional | The maximum number of tax IDs to be disabled that may be included in a single
`/v2/catalog/update-item-taxes` request. | -| `updateItemModifierListsMaxItemIds` | `number \| null \| undefined` | Optional | The maximum number of item IDs that may be included in a single
`/v2/catalog/update-item-modifier-lists` request. | -| `updateItemModifierListsMaxModifierListsToEnable` | `number \| null \| undefined` | Optional | The maximum number of modifier list IDs to be enabled that may be included in
a single `/v2/catalog/update-item-modifier-lists` request. | -| `updateItemModifierListsMaxModifierListsToDisable` | `number \| null \| undefined` | Optional | The maximum number of modifier list IDs to be disabled that may be included in
a single `/v2/catalog/update-item-modifier-lists` request. | - -## Example (as JSON) - -```json -{ - "batch_upsert_max_objects_per_batch": 206, - "batch_upsert_max_total_objects": 122, - "batch_retrieve_max_object_ids": 54, - "search_max_page_limit": 144, - "batch_delete_max_object_ids": 40 -} -``` - diff --git a/doc/models/catalog-info-response.md b/doc/models/catalog-info-response.md deleted file mode 100644 index 9d6c906c7..000000000 --- a/doc/models/catalog-info-response.md +++ /dev/null @@ -1,76 +0,0 @@ - -# Catalog Info Response - -## Structure - -`CatalogInfoResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `limits` | [`CatalogInfoResponseLimits \| undefined`](../../doc/models/catalog-info-response-limits.md) | Optional | - | -| `standardUnitDescriptionGroup` | [`StandardUnitDescriptionGroup \| undefined`](../../doc/models/standard-unit-description-group.md) | Optional | Group of standard measurement units. | - -## Example (as JSON) - -```json -{ - "limits": { - "batch_delete_max_object_ids": 200, - "batch_retrieve_max_object_ids": 1000, - "batch_upsert_max_objects_per_batch": 1000, - "batch_upsert_max_total_objects": 10000, - "search_max_page_limit": 1000, - "update_item_modifier_lists_max_item_ids": 1000, - "update_item_modifier_lists_max_modifier_lists_to_disable": 1000, - "update_item_modifier_lists_max_modifier_lists_to_enable": 1000, - "update_item_taxes_max_item_ids": 1000, - "update_item_taxes_max_taxes_to_disable": 1000, - "update_item_taxes_max_taxes_to_enable": 1000 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "standard_unit_description_group": { - "standard_unit_descriptions": [ - { - "unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_MILLILITER", - "weight_unit": "IMPERIAL_STONE" - }, - "name": "name4", - "abbreviation": "abbreviation6" - }, - { - "unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_MILLILITER", - "weight_unit": "IMPERIAL_STONE" - }, - "name": "name4", - "abbreviation": "abbreviation6" - } - ], - "language_code": "language_code6" - } -} -``` - diff --git a/doc/models/catalog-item-food-and-beverage-details-dietary-preference-standard-dietary-preference.md b/doc/models/catalog-item-food-and-beverage-details-dietary-preference-standard-dietary-preference.md deleted file mode 100644 index 5e8f24011..000000000 --- a/doc/models/catalog-item-food-and-beverage-details-dietary-preference-standard-dietary-preference.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Catalog Item Food and Beverage Details Dietary Preference Standard Dietary Preference - -Standard dietary preferences for food and beverage items that are recommended on item creation. - -## Enumeration - -`CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference` - -## Fields - -| Name | -| --- | -| `DAIRY_FREE` | -| `GLUTEN_FREE` | -| `HALAL` | -| `KOSHER` | -| `NUT_FREE` | -| `VEGAN` | -| `VEGETARIAN` | - diff --git a/doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md b/doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md deleted file mode 100644 index 8f40ee6bc..000000000 --- a/doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Catalog Item Food and Beverage Details Dietary Preference Type - -The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. - -## Enumeration - -`CatalogItemFoodAndBeverageDetailsDietaryPreferenceType` - -## Fields - -| Name | Description | -| --- | --- | -| `STANDARD` | A standard value from a pre-determined list. | -| `CUSTOM` | A user-defined custom value. | - diff --git a/doc/models/catalog-item-food-and-beverage-details-dietary-preference.md b/doc/models/catalog-item-food-and-beverage-details-dietary-preference.md deleted file mode 100644 index 7ace4ac57..000000000 --- a/doc/models/catalog-item-food-and-beverage-details-dietary-preference.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Item Food and Beverage Details Dietary Preference - -Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients. - -## Structure - -`CatalogItemFoodAndBeverageDetailsDietaryPreference` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string \| undefined`](../../doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md) | Optional | The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. | -| `standardName` | [`string \| undefined`](../../doc/models/catalog-item-food-and-beverage-details-dietary-preference-standard-dietary-preference.md) | Optional | Standard dietary preferences for food and beverage items that are recommended on item creation. | -| `customName` | `string \| null \| undefined` | Optional | The name of a user-defined custom dietary preference. This should be null if it's a standard dietary preference. | - -## Example (as JSON) - -```json -{ - "type": "STANDARD", - "standard_name": "GLUTEN_FREE", - "custom_name": "custom_name4" -} -``` - diff --git a/doc/models/catalog-item-food-and-beverage-details-ingredient-standard-ingredient.md b/doc/models/catalog-item-food-and-beverage-details-ingredient-standard-ingredient.md deleted file mode 100644 index d5275f455..000000000 --- a/doc/models/catalog-item-food-and-beverage-details-ingredient-standard-ingredient.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Catalog Item Food and Beverage Details Ingredient Standard Ingredient - -Standard ingredients for food and beverage items that are recommended on item creation. - -## Enumeration - -`CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient` - -## Fields - -| Name | -| --- | -| `CELERY` | -| `CRUSTACEANS` | -| `EGGS` | -| `FISH` | -| `GLUTEN` | -| `LUPIN` | -| `MILK` | -| `MOLLUSCS` | -| `MUSTARD` | -| `PEANUTS` | -| `SESAME` | -| `SOY` | -| `SULPHITES` | -| `TREE_NUTS` | - diff --git a/doc/models/catalog-item-food-and-beverage-details-ingredient.md b/doc/models/catalog-item-food-and-beverage-details-ingredient.md deleted file mode 100644 index 731a130a2..000000000 --- a/doc/models/catalog-item-food-and-beverage-details-ingredient.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Item Food and Beverage Details Ingredient - -Describes the ingredient used in a `FOOD_AND_BEV` item. - -## Structure - -`CatalogItemFoodAndBeverageDetailsIngredient` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string \| undefined`](../../doc/models/catalog-item-food-and-beverage-details-dietary-preference-type.md) | Optional | The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. | -| `standardName` | [`string \| undefined`](../../doc/models/catalog-item-food-and-beverage-details-ingredient-standard-ingredient.md) | Optional | Standard ingredients for food and beverage items that are recommended on item creation. | -| `customName` | `string \| null \| undefined` | Optional | The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference. | - -## Example (as JSON) - -```json -{ - "type": "STANDARD", - "standard_name": "GLUTEN", - "custom_name": "custom_name6" -} -``` - diff --git a/doc/models/catalog-item-food-and-beverage-details.md b/doc/models/catalog-item-food-and-beverage-details.md deleted file mode 100644 index acf99806e..000000000 --- a/doc/models/catalog-item-food-and-beverage-details.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Catalog Item Food and Beverage Details - -The food and beverage-specific details of a `FOOD_AND_BEV` item. - -## Structure - -`CatalogItemFoodAndBeverageDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `calorieCount` | `number \| null \| undefined` | Optional | The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items. | -| `dietaryPreferences` | [`CatalogItemFoodAndBeverageDetailsDietaryPreference[] \| null \| undefined`](../../doc/models/catalog-item-food-and-beverage-details-dietary-preference.md) | Optional | The dietary preferences for the `FOOD_AND_BEV` item. | -| `ingredients` | [`CatalogItemFoodAndBeverageDetailsIngredient[] \| null \| undefined`](../../doc/models/catalog-item-food-and-beverage-details-ingredient.md) | Optional | The ingredients for the `FOOD_AND_BEV` type item. | - -## Example (as JSON) - -```json -{ - "calorie_count": 36, - "dietary_preferences": [ - { - "type": "STANDARD", - "standard_name": "VEGETARIAN", - "custom_name": "custom_name8" - } - ], - "ingredients": [ - { - "type": "STANDARD", - "standard_name": "MILK", - "custom_name": "custom_name8" - }, - { - "type": "STANDARD", - "standard_name": "MILK", - "custom_name": "custom_name8" - } - ] -} -``` - diff --git a/doc/models/catalog-item-modifier-list-info.md b/doc/models/catalog-item-modifier-list-info.md deleted file mode 100644 index 462a24bb0..000000000 --- a/doc/models/catalog-item-modifier-list-info.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Catalog Item Modifier List Info - -References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` instance -and specifies supported behaviors of the application. - -## Structure - -`CatalogItemModifierListInfo` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `modifierListId` | `string` | Required | The ID of the `CatalogModifierList` controlled by this `CatalogModifierListInfo`.
**Constraints**: *Minimum Length*: `1` | -| `modifierOverrides` | [`CatalogModifierOverride[] \| null \| undefined`](../../doc/models/catalog-modifier-override.md) | Optional | A set of `CatalogModifierOverride` objects that override whether a given `CatalogModifier` is enabled by default. | -| `minSelectedModifiers` | `number \| null \| undefined` | Optional | If 0 or larger, the smallest number of `CatalogModifier`s that must be selected from this `CatalogModifierList`.
The default value is `-1`.

When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1`
and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of
the `CatalogModifierList` can be selected from the `CatalogModifierList`.

When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1`
and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in
and can be selected from the `CatalogModifierList` | -| `maxSelectedModifiers` | `number \| null \| undefined` | Optional | If 0 or larger, the largest number of `CatalogModifier`s that can be selected from this `CatalogModifierList`.
The default value is `-1`.

When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1`
and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of
the `CatalogModifierList` can be selected from the `CatalogModifierList`.

When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1`
and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in
and can be selected from the `CatalogModifierList` | -| `enabled` | `boolean \| null \| undefined` | Optional | If `true`, enable this `CatalogModifierList`. The default value is `true`. | -| `ordinal` | `number \| null \| undefined` | Optional | The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied
to a `CatalogItem` instance. | - -## Example (as JSON) - -```json -{ - "modifier_list_id": "modifier_list_id6", - "modifier_overrides": [ - { - "modifier_id": "modifier_id8", - "on_by_default": false - }, - { - "modifier_id": "modifier_id8", - "on_by_default": false - } - ], - "min_selected_modifiers": 170, - "max_selected_modifiers": 66, - "enabled": false, - "ordinal": 204 -} -``` - diff --git a/doc/models/catalog-item-option-for-item.md b/doc/models/catalog-item-option-for-item.md deleted file mode 100644 index a811f3dea..000000000 --- a/doc/models/catalog-item-option-for-item.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Catalog Item Option for Item - -An option that can be assigned to an item. -For example, a t-shirt item may offer a color option or a size option. - -## Structure - -`CatalogItemOptionForItem` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemOptionId` | `string \| null \| undefined` | Optional | The unique id of the item option, used to form the dimensions of the item option matrix in a specified order. | - -## Example (as JSON) - -```json -{ - "item_option_id": "item_option_id4" -} -``` - diff --git a/doc/models/catalog-item-option-value-for-item-variation.md b/doc/models/catalog-item-option-value-for-item-variation.md deleted file mode 100644 index 2fcd59641..000000000 --- a/doc/models/catalog-item-option-value-for-item-variation.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Catalog Item Option Value for Item Variation - -A `CatalogItemOptionValue` links an item variation to an item option as -an item option value. For example, a t-shirt item may offer a color option and -a size option. An item option value would represent each variation of t-shirt: -For example, "Color:Red, Size:Small" or "Color:Blue, Size:Medium". - -## Structure - -`CatalogItemOptionValueForItemVariation` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemOptionId` | `string \| null \| undefined` | Optional | The unique id of an item option. | -| `itemOptionValueId` | `string \| null \| undefined` | Optional | The unique id of the selected value for the item option. | - -## Example (as JSON) - -```json -{ - "item_option_id": "item_option_id0", - "item_option_value_id": "item_option_value_id2" -} -``` - diff --git a/doc/models/catalog-item-option-value.md b/doc/models/catalog-item-option-value.md deleted file mode 100644 index be7e281aa..000000000 --- a/doc/models/catalog-item-option-value.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Catalog Item Option Value - -An enumerated value that can link a -`CatalogItemVariation` to an item option as one of -its item option values. - -## Structure - -`CatalogItemOptionValue` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemOptionId` | `string \| null \| undefined` | Optional | Unique ID of the associated item option. | -| `name` | `string \| null \| undefined` | Optional | Name of this item option value. This is a searchable attribute for use in applicable query filters. | -| `description` | `string \| null \| undefined` | Optional | A human-readable description for the option value. This is a searchable attribute for use in applicable query filters. | -| `color` | `string \| null \| undefined` | Optional | The HTML-supported hex color for the item option (e.g., "#ff8d4e85").
Only displayed if `show_colors` is enabled on the parent `ItemOption`. When
left unset, `color` defaults to white ("#ffffff") when `show_colors` is
enabled on the parent `ItemOption`. | -| `ordinal` | `number \| null \| undefined` | Optional | Determines where this option value appears in a list of option values. | - -## Example (as JSON) - -```json -{ - "item_option_id": "item_option_id6", - "name": "name4", - "description": "description4", - "color": "color8", - "ordinal": 198 -} -``` - diff --git a/doc/models/catalog-item-option.md b/doc/models/catalog-item-option.md deleted file mode 100644 index ae0300ccd..000000000 --- a/doc/models/catalog-item-option.md +++ /dev/null @@ -1,104 +0,0 @@ - -# Catalog Item Option - -A group of variations for a `CatalogItem`. - -## Structure - -`CatalogItemOption` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The item option's display name for the seller. Must be unique across
all item options. This is a searchable attribute for use in applicable query filters. | -| `displayName` | `string \| null \| undefined` | Optional | The item option's display name for the customer. This is a searchable attribute for use in applicable query filters. | -| `description` | `string \| null \| undefined` | Optional | The item option's human-readable description. Displayed in the Square
Point of Sale app for the seller and in the Online Store or on receipts for
the buyer. This is a searchable attribute for use in applicable query filters. | -| `showColors` | `boolean \| null \| undefined` | Optional | If true, display colors for entries in `values` when present. | -| `values` | [`CatalogObject[] \| null \| undefined`](../../doc/models/catalog-object.md) | Optional | A list of CatalogObjects containing the
`CatalogItemOptionValue`s for this item. | - -## Example (as JSON) - -```json -{ - "name": "name2", - "display_name": "display_name2", - "description": "description2", - "show_colors": false, - "values": [ - { - "type": "IMAGE", - "id": "id0", - "updated_at": "updated_at6", - "version": 116, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "type": "IMAGE", - "id": "id0", - "updated_at": "updated_at6", - "version": 116, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ] -} -``` - diff --git a/doc/models/catalog-item-product-type.md b/doc/models/catalog-item-product-type.md deleted file mode 100644 index e08694ef8..000000000 --- a/doc/models/catalog-item-product-type.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Catalog Item Product Type - -The type of a CatalogItem. Connect V2 only allows the creation of `REGULAR` or `APPOINTMENTS_SERVICE` items. - -## Enumeration - -`CatalogItemProductType` - -## Fields - -| Name | Description | -| --- | --- | -| `REGULAR` | An ordinary item. | -| `GIFT_CARD` | A Square gift card. | -| `APPOINTMENTS_SERVICE` | A service that can be booked using the Square Appointments app. | -| `FOOD_AND_BEV` | A food or beverage item that can be sold by restaurants and other food venues. | -| `EVENT` | An event which tickets can be sold for, including location, address, and times. | -| `DIGITAL` | A digital item like an ebook or song. | -| `DONATION` | A donation which site visitors can send for any cause. | -| `LEGACY_SQUARE_ONLINE_SERVICE` | A legacy Square Online service that is manually fulfilled. This corresponds to the `Other` item type displayed in the Square Seller Dashboard and Square POS apps. | -| `LEGACY_SQUARE_ONLINE_MEMBERSHIP` | A legacy Square Online membership that is manually fulfilled. This corresponds to the `Membership` item type displayed in the Square Seller Dashboard and Square POS apps. | - diff --git a/doc/models/catalog-item-variation.md b/doc/models/catalog-item-variation.md deleted file mode 100644 index 5fec7e1da..000000000 --- a/doc/models/catalog-item-variation.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Catalog Item Variation - -An item variation, representing a product for sale, in the Catalog object model. Each [item](../../doc/models/catalog-item.md) must have at least one -item variation and can have at most 250 item variations. - -An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked -number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both -stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass -variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be -converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes -the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count -decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. - -## Structure - -`CatalogItemVariation` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemId` | `string \| null \| undefined` | Optional | The ID of the `CatalogItem` associated with this item variation. | -| `name` | `string \| null \| undefined` | Optional | The item variation's name. This is a searchable attribute for use in applicable query filters.

Its value has a maximum length of 255 Unicode code points. However, when the parent [item](entity:CatalogItem)
uses [item options](entity:CatalogItemOption), this attribute is auto-generated, read-only, and can be
longer than 255 Unicode code points. | -| `sku` | `string \| null \| undefined` | Optional | The item variation's SKU, if any. This is a searchable attribute for use in applicable query filters. | -| `upc` | `string \| null \| undefined` | Optional | The universal product code (UPC) of the item variation, if any. This is a searchable attribute for use in applicable query filters.

The value of this attribute should be a number of 12-14 digits long. This restriction is enforced on the Square Seller Dashboard,
Square Point of Sale or Retail Point of Sale apps, where this attribute shows in the GTIN field. If a non-compliant UPC value is assigned
to this attribute using the API, the value is not editable on the Seller Dashboard, Square Point of Sale or Retail Point of Sale apps
unless it is updated to fit the expected format. | -| `ordinal` | `number \| undefined` | Optional | The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal
for each item variation within a parent `CatalogItem` is set according to the item variations's
position. On reads, the value is not guaranteed to be sequential or unique. | -| `pricingType` | [`string \| undefined`](../../doc/models/catalog-pricing-type.md) | Optional | Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. | -| `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. | -| `locationOverrides` | [`ItemVariationLocationOverrides[] \| null \| undefined`](../../doc/models/item-variation-location-overrides.md) | Optional | Per-location price and inventory overrides. | -| `trackInventory` | `boolean \| null \| undefined` | Optional | If `true`, inventory tracking is active for the variation. | -| `inventoryAlertType` | [`string \| undefined`](../../doc/models/inventory-alert-type.md) | Optional | Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. | -| `inventoryAlertThreshold` | `bigint \| null \| undefined` | Optional | If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard.

This value is always an integer. | -| `userData` | `string \| null \| undefined` | Optional | Arbitrary user metadata to associate with the item variation. This attribute value length is of Unicode code points.
**Constraints**: *Maximum Length*: `255` | -| `serviceDuration` | `bigint \| null \| undefined` | Optional | If the `CatalogItem` that owns this item variation is of type
`APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For
example, a 30 minute appointment would have the value `1800000`, which is equal to
30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second). | -| `availableForBooking` | `boolean \| null \| undefined` | Optional | If the `CatalogItem` that owns this item variation is of type
`APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking. | -| `itemOptionValues` | [`CatalogItemOptionValueForItemVariation[] \| null \| undefined`](../../doc/models/catalog-item-option-value-for-item-variation.md) | Optional | List of item option values associated with this item variation. Listed
in the same order as the item options of the parent item. | -| `measurementUnitId` | `string \| null \| undefined` | Optional | ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity
sold of this item variation. If left unset, the item will be sold in
whole quantities. | -| `sellable` | `boolean \| null \| undefined` | Optional | Whether this variation can be sold. The inventory count of a sellable variation indicates
the number of units available for sale. When a variation is both stockable and sellable,
its sellable inventory count can be smaller than or equal to its stockable count. | -| `stockable` | `boolean \| null \| undefined` | Optional | Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE).
When a variation is both stockable and sellable, the inventory count of a stockable variation keeps track of the number of units of this variation in stock
and is not an indicator of the number of units of the variation that can be sold. | -| `imageIds` | `string[] \| null \| undefined` | Optional | The IDs of images associated with this `CatalogItemVariation` instance.
These images will be shown to customers in Square Online Store. | -| `teamMemberIds` | `string[] \| null \| undefined` | Optional | Tokens of employees that can perform the service represented by this variation. Only valid for
variations of type `APPOINTMENTS_SERVICE`. | -| `stockableConversion` | [`CatalogStockConversion \| undefined`](../../doc/models/catalog-stock-conversion.md) | Optional | Represents the rule of conversion between a stockable [CatalogItemVariation](../../doc/models/catalog-item-variation.md)
and a non-stockable sell-by or receive-by `CatalogItemVariation` that
share the same underlying stock. | - -## Example (as JSON) - -```json -{ - "item_id": "item_id4", - "name": "name4", - "sku": "sku0", - "upc": "upc2", - "ordinal": 76 -} -``` - diff --git a/doc/models/catalog-item.md b/doc/models/catalog-item.md deleted file mode 100644 index 5b538f3c5..000000000 --- a/doc/models/catalog-item.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Catalog Item - -A [CatalogObject](../../doc/models/catalog-object.md) instance of the `ITEM` type, also referred to as an item, in the catalog. - -## Structure - -`CatalogItem` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The item's name. This is a searchable attribute for use in applicable query filters, its value must not be empty, and the length is of Unicode code points.
**Constraints**: *Maximum Length*: `512` | -| `description` | `string \| null \| undefined` | Optional | The item's description. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.

Deprecated at 2022-07-20, this field is planned to retire in 6 months. You should migrate to use `description_html` to set the description
of the [CatalogItem](entity:CatalogItem) instance. The `description` and `description_html` field values are kept in sync. If you try to
set the both fields, the `description_html` text value overwrites the `description` value. Updates in one field are also reflected in the other,
except for when you use an early version before Square API 2022-07-20 and `description_html` is set to blank, setting the `description` value to null
does not nullify `description_html`.
**Constraints**: *Maximum Length*: `4096` | -| `abbreviation` | `string \| null \| undefined` | Optional | The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used.
This attribute is searchable, and its value length is of Unicode code points.
**Constraints**: *Maximum Length*: `24` | -| `labelColor` | `string \| null \| undefined` | Optional | The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code. | -| `isTaxable` | `boolean \| null \| undefined` | Optional | Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`. | -| `availableOnline` | `boolean \| null \| undefined` | Optional | If `true`, the item can be added to shipping orders from the merchant's online store. | -| `availableForPickup` | `boolean \| null \| undefined` | Optional | If `true`, the item can be added to pickup orders from the merchant's online store. | -| `availableElectronically` | `boolean \| null \| undefined` | Optional | If `true`, the item can be added to electronically fulfilled orders from the merchant's online store. | -| `categoryId` | `string \| null \| undefined` | Optional | The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead. | -| `taxIds` | `string[] \| null \| undefined` | Optional | A set of IDs indicating the taxes enabled for
this item. When updating an item, any taxes listed here will be added to the item.
Taxes may also be added to or deleted from an item using `UpdateItemTaxes`. | -| `modifierListInfo` | [`CatalogItemModifierListInfo[] \| null \| undefined`](../../doc/models/catalog-item-modifier-list-info.md) | Optional | A set of `CatalogItemModifierListInfo` objects
representing the modifier lists that apply to this item, along with the overrides and min
and max limits that are specific to this item. Modifier lists
may also be added to or deleted from an item using `UpdateItemModifierLists`. | -| `variations` | [`CatalogObject[] \| null \| undefined`](../../doc/models/catalog-object.md) | Optional | A list of [CatalogItemVariation](entity:CatalogItemVariation) objects for this item. An item must have
at least one variation. | -| `productType` | [`string \| undefined`](../../doc/models/catalog-item-product-type.md) | Optional | The type of a CatalogItem. Connect V2 only allows the creation of `REGULAR` or `APPOINTMENTS_SERVICE` items. | -| `skipModifierScreen` | `boolean \| null \| undefined` | Optional | If `false`, the Square Point of Sale app will present the `CatalogItem`'s
details screen immediately, allowing the merchant to choose `CatalogModifier`s
before adding the item to the cart. This is the default behavior.

If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected
modifiers, and merchants can edit modifiers by drilling down onto the item's details.

Third-party clients are encouraged to implement similar behaviors. | -| `itemOptions` | [`CatalogItemOptionForItem[] \| null \| undefined`](../../doc/models/catalog-item-option-for-item.md) | Optional | List of item options IDs for this item. Used to manage and group item
variations in a specified order.

Maximum: 6 item options. | -| `imageIds` | `string[] \| null \| undefined` | Optional | The IDs of images associated with this `CatalogItem` instance.
These images will be shown to customers in Square Online Store.
The first image will show up as the icon for this item in POS. | -| `sortName` | `string \| null \| undefined` | Optional | A name to sort the item by. If this name is unspecified, namely, the `sort_name` field is absent, the regular `name` field is used for sorting.
Its value must not be empty.

It is currently supported for sellers of the Japanese locale only. | -| `categories` | [`CatalogObjectCategory[] \| null \| undefined`](../../doc/models/catalog-object-category.md) | Optional | The list of categories. | -| `descriptionHtml` | `string \| null \| undefined` | Optional | The item's description as expressed in valid HTML elements. The length of this field value, including those of HTML tags,
is of Unicode points. With application query filters, the text values of the HTML elements and attributes are searchable. Invalid or
unsupported HTML elements or attributes are ignored.

Supported HTML elements include:

- `a`: Link. Supports linking to website URLs, email address, and telephone numbers.
- `b`, `strong`: Bold text
- `br`: Line break
- `code`: Computer code
- `div`: Section
- `h1-h6`: Headings
- `i`, `em`: Italics
- `li`: List element
- `ol`: Numbered list
- `p`: Paragraph
- `ul`: Bullet list
- `u`: Underline

Supported HTML attributes include:

- `align`: Alignment of the text content
- `href`: Link destination
- `rel`: Relationship between link's target and source
- `target`: Place to open the linked document
**Constraints**: *Maximum Length*: `65535` | -| `descriptionPlaintext` | `string \| undefined` | Optional | A server-generated plaintext version of the `description_html` field, without formatting tags.
**Constraints**: *Maximum Length*: `65535` | -| `channels` | `string[] \| null \| undefined` | Optional | A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. | -| `isArchived` | `boolean \| null \| undefined` | Optional | Indicates whether this item is archived (`true`) or not (`false`). | -| `ecomSeoData` | [`CatalogEcomSeoData \| undefined`](../../doc/models/catalog-ecom-seo-data.md) | Optional | SEO data for for a seller's Square Online store. | -| `foodAndBeverageDetails` | [`CatalogItemFoodAndBeverageDetails \| undefined`](../../doc/models/catalog-item-food-and-beverage-details.md) | Optional | The food and beverage-specific details of a `FOOD_AND_BEV` item. | -| `reportingCategory` | [`CatalogObjectCategory \| undefined`](../../doc/models/catalog-object-category.md) | Optional | A category that can be assigned to an item or a parent category that can be assigned
to another category. For example, a clothing category can be assigned to a t-shirt item or
be made as the parent category to the pants category. | - -## Example (as JSON) - -```json -{ - "name": "name6", - "description": "description6", - "abbreviation": "abbreviation8", - "label_color": "label_color8", - "is_taxable": false -} -``` - diff --git a/doc/models/catalog-measurement-unit.md b/doc/models/catalog-measurement-unit.md deleted file mode 100644 index 31ab1b14b..000000000 --- a/doc/models/catalog-measurement-unit.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Catalog Measurement Unit - -Represents the unit used to measure a `CatalogItemVariation` and -specifies the precision for decimal quantities. - -## Structure - -`CatalogMeasurementUnit` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `measurementUnit` | [`MeasurementUnit \| undefined`](../../doc/models/measurement-unit.md) | Optional | Represents a unit of measurement to use with a quantity, such as ounces
or inches. Exactly one of the following fields are required: `custom_unit`,
`area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. | -| `precision` | `number \| null \| undefined` | Optional | An integer between 0 and 5 that represents the maximum number of
positions allowed after the decimal in quantities measured with this unit.
For example:

- if the precision is 0, the quantity can be 1, 2, 3, etc.
- if the precision is 1, the quantity can be 0.1, 0.2, etc.
- if the precision is 2, the quantity can be 0.01, 0.12, etc.

Default: 3 | - -## Example (as JSON) - -```json -{ - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 78 -} -``` - diff --git a/doc/models/catalog-modifier-list-modifier-type.md b/doc/models/catalog-modifier-list-modifier-type.md deleted file mode 100644 index eede3572e..000000000 --- a/doc/models/catalog-modifier-list-modifier-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Catalog Modifier List Modifier Type - -Defines the type of `CatalogModifierList`. - -## Enumeration - -`CatalogModifierListModifierType` - -## Fields - -| Name | Description | -| --- | --- | -| `LIST` | The `CatalogModifierList` instance is a non-empty list of non text-based modifiers. | -| `TEXT` | The `CatalogModifierList` instance is a single text-based modifier. | - diff --git a/doc/models/catalog-modifier-list-selection-type.md b/doc/models/catalog-modifier-list-selection-type.md deleted file mode 100644 index 3a4281813..000000000 --- a/doc/models/catalog-modifier-list-selection-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Catalog Modifier List Selection Type - -Indicates whether a CatalogModifierList supports multiple selections. - -## Enumeration - -`CatalogModifierListSelectionType` - -## Fields - -| Name | Description | -| --- | --- | -| `SINGLE` | Indicates that a CatalogModifierList allows only a
single CatalogModifier to be selected. | -| `MULTIPLE` | Indicates that a CatalogModifierList allows multiple
CatalogModifier to be selected. | - diff --git a/doc/models/catalog-modifier-list.md b/doc/models/catalog-modifier-list.md deleted file mode 100644 index aff0496cf..000000000 --- a/doc/models/catalog-modifier-list.md +++ /dev/null @@ -1,93 +0,0 @@ - -# Catalog Modifier List - -For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. -For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied -text string to be selected for the T-shirt at the time of sale. - -For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items -at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. -For example, a "Condiments" modifier list applicable to a "Hot Dog" item -may contain "Ketchup", "Mustard", and "Relish" modifiers. - -A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field -is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item -only once and the `selection_type` field is always set to `SINGLE`. - -## Structure - -`CatalogModifierList` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of
Unicode code points.
**Constraints**: *Maximum Length*: `255` | -| `ordinal` | `number \| null \| undefined` | Optional | The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. | -| `selectionType` | [`string \| undefined`](../../doc/models/catalog-modifier-list-selection-type.md) | Optional | Indicates whether a CatalogModifierList supports multiple selections. | -| `modifiers` | [`CatalogObject[] \| null \| undefined`](../../doc/models/catalog-object.md) | Optional | A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`,
for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list
is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes:

```
{
"id": "{{catalog_modifier_id}}",
"type": "MODIFIER",
"modifier_data": {{a CatalogModifier instance>}}
}
``` | -| `imageIds` | `string[] \| null \| undefined` | Optional | The IDs of images associated with this `CatalogModifierList` instance.
Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications. | -| `modifierType` | [`string \| undefined`](../../doc/models/catalog-modifier-list-modifier-type.md) | Optional | Defines the type of `CatalogModifierList`. | -| `maxLength` | `number \| null \| undefined` | Optional | The maximum length, in Unicode points, of the text string of the text-based modifier as represented by
this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. | -| `textRequired` | `boolean \| null \| undefined` | Optional | Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based modifier
as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. | -| `internalName` | `string \| null \| undefined` | Optional | A note for internal use by the business.

For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!"
is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as
an instruction for the business to follow.

For non text-based modifiers, this `internal_name` attribute can be
used to include SKUs, internal codes, or supplemental descriptions for internal use.
**Constraints**: *Maximum Length*: `512` | - -## Example (as JSON) - -```json -{ - "name": "name4", - "ordinal": 226, - "selection_type": "SINGLE", - "modifiers": [ - { - "type": "TAX", - "id": "id4", - "updated_at": "updated_at0", - "version": 210, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "image_ids": [ - "image_ids9" - ] -} -``` - diff --git a/doc/models/catalog-modifier-override.md b/doc/models/catalog-modifier-override.md deleted file mode 100644 index d996fa7b6..000000000 --- a/doc/models/catalog-modifier-override.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Catalog Modifier Override - -Options to control how to override the default behavior of the specified modifier. - -## Structure - -`CatalogModifierOverride` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `modifierId` | `string` | Required | The ID of the `CatalogModifier` whose default behavior is being overridden.
**Constraints**: *Minimum Length*: `1` | -| `onByDefault` | `boolean \| null \| undefined` | Optional | If `true`, this `CatalogModifier` should be selected by default for this `CatalogItem`. | - -## Example (as JSON) - -```json -{ - "modifier_id": "modifier_id2", - "on_by_default": false -} -``` - diff --git a/doc/models/catalog-modifier.md b/doc/models/catalog-modifier.md deleted file mode 100644 index 703adca29..000000000 --- a/doc/models/catalog-modifier.md +++ /dev/null @@ -1,71 +0,0 @@ - -# Catalog Modifier - -A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. - -## Structure - -`CatalogModifier` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The modifier name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
**Constraints**: *Maximum Length*: `255` | -| `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. | -| `ordinal` | `number \| null \| undefined` | Optional | Determines where this `CatalogModifier` appears in the `CatalogModifierList`. | -| `modifierListId` | `string \| null \| undefined` | Optional | The ID of the `CatalogModifierList` associated with this modifier. | -| `locationOverrides` | [`ModifierLocationOverrides[] \| null \| undefined`](../../doc/models/modifier-location-overrides.md) | Optional | Location-specific price overrides. | -| `imageId` | `string \| null \| undefined` | Optional | The ID of the image associated with this `CatalogModifier` instance.
Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications. | - -## Example (as JSON) - -```json -{ - "object": { - "modifier_data": { - "name": "Almond Milk", - "price_money": { - "amount": 250, - "currency": "USD" - } - }, - "present_at_all_locations": true, - "type": "MODIFIER" - }, - "name": "name6", - "price_money": { - "amount": 202, - "currency": "GTQ" - }, - "ordinal": 70, - "modifier_list_id": "modifier_list_id2", - "location_overrides": [ - { - "location_id": "location_id8", - "price_money": { - "amount": 202, - "currency": "GTQ" - }, - "sold_out": false - }, - { - "location_id": "location_id8", - "price_money": { - "amount": 202, - "currency": "GTQ" - }, - "sold_out": false - }, - { - "location_id": "location_id8", - "price_money": { - "amount": 202, - "currency": "GTQ" - }, - "sold_out": false - } - ] -} -``` - diff --git a/doc/models/catalog-object-batch.md b/doc/models/catalog-object-batch.md deleted file mode 100644 index a474aabd6..000000000 --- a/doc/models/catalog-object-batch.md +++ /dev/null @@ -1,113 +0,0 @@ - -# Catalog Object Batch - -A batch of catalog objects. - -## Structure - -`CatalogObjectBatch` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `objects` | [`CatalogObject[]`](../../doc/models/catalog-object.md) | Required | A list of CatalogObjects belonging to this batch. | - -## Example (as JSON) - -```json -{ - "objects": [ - { - "type": "PRODUCT_SET", - "id": "id6", - "category_data": { - "object": { - "category_data": { - "name": "Beverages" - }, - "id": "#Beverages", - "present_at_all_locations": true, - "type": "CATEGORY" - } - }, - "tax_data": { - "object": { - "id": "#SalesTax", - "present_at_all_locations": true, - "tax_data": { - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "enabled": true, - "fee_applies_to_custom_amounts": true, - "inclusion_type": "ADDITIVE", - "name": "Sales Tax", - "percentage": "5.0" - }, - "type": "TAX" - } - }, - "discount_data": { - "object": { - "discount_data": { - "discount_type": "FIXED_PERCENTAGE", - "label_color": "red", - "name": "Welcome to the Dark(Roast) Side!", - "percentage": "5.4", - "pin_required": false - }, - "id": "#Maythe4th", - "present_at_all_locations": true, - "type": "DISCOUNT" - } - }, - "modifier_data": { - "object": { - "modifier_data": { - "name": "Almond Milk", - "price_money": { - "amount": 250, - "currency": "USD" - } - }, - "present_at_all_locations": true, - "type": "MODIFIER" - } - }, - "updated_at": "updated_at2", - "version": 164, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ] -} -``` - diff --git a/doc/models/catalog-object-category.md b/doc/models/catalog-object-category.md deleted file mode 100644 index 2d338d868..000000000 --- a/doc/models/catalog-object-category.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Object Category - -A category that can be assigned to an item or a parent category that can be assigned -to another category. For example, a clothing category can be assigned to a t-shirt item or -be made as the parent category to the pants category. - -## Structure - -`CatalogObjectCategory` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The ID of the object's category. | -| `ordinal` | `bigint \| null \| undefined` | Optional | The order of the object within the context of the category. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "ordinal": 8 -} -``` - diff --git a/doc/models/catalog-object-reference.md b/doc/models/catalog-object-reference.md deleted file mode 100644 index 80619d870..000000000 --- a/doc/models/catalog-object-reference.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Object Reference - -A reference to a Catalog object at a specific version. In general this is -used as an entry point into a graph of catalog objects, where the objects exist -at a specific version. - -## Structure - -`CatalogObjectReference` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `objectId` | `string \| null \| undefined` | Optional | The ID of the referenced object. | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the object. | - -## Example (as JSON) - -```json -{ - "object_id": "object_id0", - "catalog_version": 84 -} -``` - diff --git a/doc/models/catalog-object-type.md b/doc/models/catalog-object-type.md deleted file mode 100644 index ada605a92..000000000 --- a/doc/models/catalog-object-type.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Catalog Object Type - -Possible types of CatalogObjects returned from the catalog, each -containing type-specific properties in the `*_data` field corresponding to the specified object type. - -## Enumeration - -`CatalogObjectType` - -## Fields - -| Name | Description | -| --- | --- | -| `ITEM` | The `CatalogObject` instance is of the [CatalogItem](../../doc/models/catalog-item.md) type and represents an item. The item-specific data
must be set on the `item_data` field. | -| `IMAGE` | The `CatalogObject` instance is of the [CatalogImage](../../doc/models/catalog-image.md) type and represents an image. The image-specific data
must be set on the `image_data` field. | -| `CATEGORY` | The `CatalogObject` instance is of the [CatalogCategory](../../doc/models/catalog-category.md) type and represents a category. The category-specific data
must be set on the `category_data` field. | -| `ITEM_VARIATION` | The `CatalogObject` instance is of the [CatalogItemVariation](../../doc/models/catalog-item-variation.md) type and represents an item variation, also referred to as variation.
The item variation-specific data must be set on the `item_variation_data` field. | -| `TAX` | The `CatalogObject` instance is of the [CatalogTax](../../doc/models/catalog-tax.md) type and represents a tax. The tax-specific data
must be set on the `tax_data` field. | -| `DISCOUNT` | The `CatalogObject` instance is of the [CatalogDiscount](../../doc/models/catalog-discount.md) type and represents a discount. The discount-specific data
must be set on the `discount_data` field. | -| `MODIFIER_LIST` | The `CatalogObject` instance is of the [CatalogModifierList](../../doc/models/catalog-modifier-list.md) type and represents a modifier list.
The modifier-list-specific data must be set on the `modifier_list_data` field. | -| `MODIFIER` | The `CatalogObject` instance is of the [CatalogModifier](../../doc/models/catalog-modifier.md) type and represents a modifier. The modifier-specific data
must be set on the `modifier_data` field. | -| `PRICING_RULE` | The `CatalogObject` instance is of the [CatalogPricingRule](../../doc/models/catalog-pricing-rule.md) type and represents a pricing rule. The pricing-rule-specific data
must be set on the `pricing_rule_data` field. | -| `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. | -| `QUICK_AMOUNTS_SETTINGS` | The `CatalogObject` instance is of the [CatalogQuickAmountsSettings](../../doc/models/catalog-quick-amounts-settings.md) type and represents settings to configure preset charges for quick payments at each location.
For example, a location may have a list of both AUTO and MANUAL quick amounts that are set to DISABLED.
The quick-amounts-settings-specific data must be set on the `quick_amounts_settings_data` field. | -| `SUBSCRIPTION_PLAN` | 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. | -| `AVAILABILITY_PERIOD` | The `CatalogObject` instance is of the [CatalogAvailabilityPeriod](../../doc/models/catalog-availability-period.md) type and represents an availability period.
The availability period specific data must be stored on the `availability_period_data` field. | - diff --git a/doc/models/catalog-object.md b/doc/models/catalog-object.md deleted file mode 100644 index d3f541cea..000000000 --- a/doc/models/catalog-object.md +++ /dev/null @@ -1,153 +0,0 @@ - -# Catalog Object - -The wrapper object for the catalog entries of a given object type. - -Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. - -For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. - -In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. - -For a more detailed discussion of the Catalog data model, please see the -[Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. - -## Structure - -`CatalogObject` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string`](../../doc/models/catalog-object-type.md) | Required | Possible types of CatalogObjects returned from the catalog, each
containing type-specific properties in the `*_data` field corresponding to the specified object type. | -| `id` | `string` | Required | An identifier to reference this object in the catalog. When a new `CatalogObject`
is inserted, the client should set the id to a temporary identifier starting with
a "`#`" character. Other objects being inserted or updated within the same request
may use this identifier to refer to the new object.

When the server receives the new object, it will supply a unique identifier that
replaces the temporary identifier for all future references.
**Constraints**: *Minimum Length*: `1` | -| `updatedAt` | `string \| undefined` | Optional | Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"`
would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. | -| `version` | `bigint \| undefined` | Optional | The version of the object. When updating an object, the version supplied
must match the version in the database, otherwise the write will be rejected as conflicting. | -| `isDeleted` | `boolean \| null \| undefined` | Optional | If `true`, the object has been deleted from the database. Must be `false` for new objects
being inserted. When deleted, the `updated_at` field will equal the deletion time. | -| `customAttributeValues` | [`Record \| null \| undefined`](../../doc/models/catalog-custom-attribute-value.md) | Optional | A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair
is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute
value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition)
object defined by the application making the request.

If the `CatalogCustomAttributeDefinition` object is
defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by
the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of
`"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"`
if the application making the request is different from the application defining the custom attribute definition.
Otherwise, the key used in the map is simply `"cocoa_brand"`.

Application-defined custom attributes are set at a global (location-independent) level.
Custom attribute values are intended to store additional information about a catalog object
or associations with an entity in another system. Do not use custom attributes
to store any sensitive information (personally identifiable information, card details, etc.). | -| `catalogV1Ids` | [`CatalogV1Id[] \| null \| undefined`](../../doc/models/catalog-v1-id.md) | Optional | The Connect v1 IDs for this object at each location where it is present, where they
differ from the object's Connect V2 ID. The field will only be present for objects that
have been created or modified by legacy APIs. | -| `presentAtAllLocations` | `boolean \| null \| undefined` | Optional | If `true`, this object is present at all locations (including future locations), except where specified in
the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations),
except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. | -| `presentAtLocationIds` | `string[] \| null \| undefined` | Optional | A list of locations where the object is present, even if `present_at_all_locations` is `false`.
This can include locations that are deactivated. | -| `absentAtLocationIds` | `string[] \| null \| undefined` | Optional | A list of locations where the object is not present, even if `present_at_all_locations` is `true`.
This can include locations that are deactivated. | -| `itemData` | [`CatalogItem \| undefined`](../../doc/models/catalog-item.md) | Optional | A [CatalogObject](../../doc/models/catalog-object.md) instance of the `ITEM` type, also referred to as an item, in the catalog. | -| `categoryData` | [`CatalogCategory \| undefined`](../../doc/models/catalog-category.md) | Optional | A category to which a `CatalogItem` instance belongs. | -| `itemVariationData` | [`CatalogItemVariation \| undefined`](../../doc/models/catalog-item-variation.md) | Optional | An item variation, representing a product for sale, in the Catalog object model. Each [item](../../doc/models/catalog-item.md) must have at least one
item variation and can have at most 250 item variations.

An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked
number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both
stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass
variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be
converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes
the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count
decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. | -| `taxData` | [`CatalogTax \| undefined`](../../doc/models/catalog-tax.md) | Optional | A tax applicable to an item. | -| `discountData` | [`CatalogDiscount \| undefined`](../../doc/models/catalog-discount.md) | Optional | A discount applicable to items. | -| `modifierListData` | [`CatalogModifierList \| undefined`](../../doc/models/catalog-modifier-list.md) | Optional | For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`.
For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied
text string to be selected for the T-shirt at the time of sale.

For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items
at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type.
For example, a "Condiments" modifier list applicable to a "Hot Dog" item
may contain "Ketchup", "Mustard", and "Relish" modifiers.

A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field
is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item
only once and the `selection_type` field is always set to `SINGLE`. | -| `modifierData` | [`CatalogModifier \| undefined`](../../doc/models/catalog-modifier.md) | Optional | A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. | -| `timePeriodData` | [`CatalogTimePeriod \| undefined`](../../doc/models/catalog-time-period.md) | Optional | Represents a time period - either a single period or a repeating period. | -| `productSetData` | [`CatalogProductSet \| undefined`](../../doc/models/catalog-product-set.md) | Optional | Represents a collection of catalog objects for the purpose of applying a
`PricingRule`. Including a catalog object will include all of its subtypes.
For example, including a category in a product set will include all of its
items and associated item variations in the product set. Including an item in
a product set will also include its item variations. | -| `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. 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) | -| `quickAmountsSettingsData` | [`CatalogQuickAmountsSettings \| undefined`](../../doc/models/catalog-quick-amounts-settings.md) | Optional | A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts. | -| `subscriptionPlanVariationData` | [`CatalogSubscriptionPlanVariation \| undefined`](../../doc/models/catalog-subscription-plan-variation.md) | Optional | 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). | -| `availabilityPeriodData` | [`CatalogAvailabilityPeriod \| undefined`](../../doc/models/catalog-availability-period.md) | Optional | Represents a time period of availability. | - -## Example (as JSON) - -```json -{ - "type": "TIME_PERIOD", - "id": "id4", - "category_data": { - "object": { - "category_data": { - "name": "Beverages" - }, - "id": "#Beverages", - "present_at_all_locations": true, - "type": "CATEGORY" - } - }, - "tax_data": { - "object": { - "id": "#SalesTax", - "present_at_all_locations": true, - "tax_data": { - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "enabled": true, - "fee_applies_to_custom_amounts": true, - "inclusion_type": "ADDITIVE", - "name": "Sales Tax", - "percentage": "5.0" - }, - "type": "TAX" - } - }, - "discount_data": { - "object": { - "discount_data": { - "discount_type": "FIXED_PERCENTAGE", - "label_color": "red", - "name": "Welcome to the Dark(Roast) Side!", - "percentage": "5.4", - "pin_required": false - }, - "id": "#Maythe4th", - "present_at_all_locations": true, - "type": "DISCOUNT" - } - }, - "modifier_data": { - "object": { - "modifier_data": { - "name": "Almond Milk", - "price_money": { - "amount": 250, - "currency": "USD" - } - }, - "present_at_all_locations": true, - "type": "MODIFIER" - } - }, - "updated_at": "updated_at0", - "version": 186, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] -} -``` - diff --git a/doc/models/catalog-pricing-rule.md b/doc/models/catalog-pricing-rule.md deleted file mode 100644 index aebca6c9f..000000000 --- a/doc/models/catalog-pricing-rule.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Catalog Pricing Rule - -Defines how discounts are automatically applied to a set of items that match the pricing rule -during the active time period. - -## Structure - -`CatalogPricingRule` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | User-defined name for the pricing rule. For example, "Buy one get one
free" or "10% off". | -| `timePeriodIds` | `string[] \| null \| undefined` | Optional | A list of unique IDs for the catalog time periods when
this pricing rule is in effect. If left unset, the pricing rule is always
in effect. | -| `discountId` | `string \| null \| undefined` | Optional | Unique ID for the `CatalogDiscount` to take off
the price of all matched items. | -| `matchProductsId` | `string \| null \| undefined` | Optional | Unique ID for the `CatalogProductSet` that will be matched by this rule. A match rule
matches within the entire cart, and can match multiple times. This field will always be set. | -| `applyProductsId` | `string \| null \| undefined` | Optional | __Deprecated__: Please use the `exclude_products_id` field to apply
an exclude set instead. Exclude sets allow better control over quantity
ranges and offer more flexibility for which matched items receive a discount.

`CatalogProductSet` to apply the pricing to.
An apply rule matches within the subset of the cart that fits the match rules (the match set).
An apply rule can only match once in the match set.
If not supplied, the pricing will be applied to all products in the match set.
Other products retain their base price, or a price generated by other rules. | -| `excludeProductsId` | `string \| null \| undefined` | Optional | `CatalogProductSet` to exclude from the pricing rule.
An exclude rule matches within the subset of the cart that fits the match rules (the match set).
An exclude rule can only match once in the match set.
If not supplied, the pricing will be applied to all products in the match set.
Other products retain their base price, or a price generated by other rules. | -| `validFromDate` | `string \| null \| undefined` | Optional | Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD). | -| `validFromLocalTime` | `string \| null \| undefined` | Optional | Represents the local time the pricing rule should be valid from. Represented in RFC 3339 partial-time format
(HH:MM:SS). Partial seconds will be truncated. | -| `validUntilDate` | `string \| null \| undefined` | Optional | Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD). | -| `validUntilLocalTime` | `string \| null \| undefined` | Optional | Represents the local time the pricing rule should be valid until. Represented in RFC 3339 partial-time format
(HH:MM:SS). Partial seconds will be truncated. | -| `excludeStrategy` | [`string \| undefined`](../../doc/models/exclude-strategy.md) | Optional | Indicates which products matched by a CatalogPricingRule
will be excluded if the pricing rule uses an exclude set. | -| `minimumOrderSubtotalMoney` | [`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. | -| `customerGroupIdsAny` | `string[] \| null \| undefined` | Optional | A list of IDs of customer groups, the members of which are eligible for discounts specified in this pricing rule.
Notice that a group ID is generated by the Customers API.
If this field is not set, the specified discount applies to matched products sold to anyone whether the buyer
has a customer profile created or not. If this `customer_group_ids_any` field is set, the specified discount
applies only to matched products sold to customers belonging to the specified customer groups. | - -## Example (as JSON) - -```json -{ - "name": "name6", - "time_period_ids": [ - "time_period_ids8" - ], - "discount_id": "discount_id4", - "match_products_id": "match_products_id4", - "apply_products_id": "apply_products_id0" -} -``` - diff --git a/doc/models/catalog-pricing-type.md b/doc/models/catalog-pricing-type.md deleted file mode 100644 index f49d45870..000000000 --- a/doc/models/catalog-pricing-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Catalog Pricing Type - -Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. - -## Enumeration - -`CatalogPricingType` - -## Fields - -| Name | Description | -| --- | --- | -| `FIXED_PRICING` | The catalog item variation's price is fixed. | -| `VARIABLE_PRICING` | The catalog item variation's price is entered at the time of sale. | - diff --git a/doc/models/catalog-product-set.md b/doc/models/catalog-product-set.md deleted file mode 100644 index d2e980df5..000000000 --- a/doc/models/catalog-product-set.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Catalog Product Set - -Represents a collection of catalog objects for the purpose of applying a -`PricingRule`. Including a catalog object will include all of its subtypes. -For example, including a category in a product set will include all of its -items and associated item variations in the product set. Including an item in -a product set will also include its item variations. - -## Structure - -`CatalogProductSet` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | User-defined name for the product set. For example, "Clearance Items"
or "Winter Sale Items". | -| `productIdsAny` | `string[] \| null \| undefined` | Optional | Unique IDs for any `CatalogObject` included in this product set. Any
number of these catalog objects can be in an order for a pricing rule to apply.

This can be used with `product_ids_all` in a parent `CatalogProductSet` to
match groups of products for a bulk discount, such as a discount for an
entree and side combo.

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

Max: 500 catalog object IDs. | -| `productIdsAll` | `string[] \| null \| undefined` | Optional | Unique IDs for any `CatalogObject` included in this product set.
All objects in this set must be included in an order for a pricing rule to apply.

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

Max: 500 catalog object IDs. | -| `quantityExact` | `bigint \| null \| undefined` | Optional | If set, there must be exactly this many items from `products_any` or `products_all`
in the cart for the discount to apply.

Cannot be combined with either `quantity_min` or `quantity_max`. | -| `quantityMin` | `bigint \| null \| undefined` | Optional | If set, there must be at least this many items from `products_any` or `products_all`
in a cart for the discount to apply. See `quantity_exact`. Defaults to 0 if
`quantity_exact`, `quantity_min` and `quantity_max` are all unspecified. | -| `quantityMax` | `bigint \| null \| undefined` | Optional | If set, the pricing rule will apply to a maximum of this many items from
`products_any` or `products_all`. | -| `allProducts` | `boolean \| null \| undefined` | Optional | If set to `true`, the product set will include every item in the catalog.
Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. | - -## Example (as JSON) - -```json -{ - "name": "name6", - "product_ids_any": [ - "product_ids_any8" - ], - "product_ids_all": [ - "product_ids_all7" - ], - "quantity_exact": 222, - "quantity_min": 100 -} -``` - diff --git a/doc/models/catalog-query-exact.md b/doc/models/catalog-query-exact.md deleted file mode 100644 index 7c56d3ec6..000000000 --- a/doc/models/catalog-query-exact.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Catalog Query Exact - -The query filter to return the search result by exact match of the specified attribute name and value. - -## Structure - -`CatalogQueryExact` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `attributeName` | `string` | Required | The name of the attribute to be searched. Matching of the attribute name is exact.
**Constraints**: *Minimum Length*: `1` | -| `attributeValue` | `string` | Required | The desired value of the search attribute. Matching of the attribute value is case insensitive and can be partial.
For example, if a specified value of "sma", objects with the named attribute value of "Small", "small" are both matched. | - -## Example (as JSON) - -```json -{ - "attribute_name": "attribute_name4", - "attribute_value": "attribute_value6" -} -``` - diff --git a/doc/models/catalog-query-item-variations-for-item-option-values.md b/doc/models/catalog-query-item-variations-for-item-option-values.md deleted file mode 100644 index c49bba1df..000000000 --- a/doc/models/catalog-query-item-variations-for-item-option-values.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Query Item Variations for Item Option Values - -The query filter to return the item variations containing the specified item option value IDs. - -## Structure - -`CatalogQueryItemVariationsForItemOptionValues` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemOptionValueIds` | `string[] \| null \| undefined` | Optional | A set of `CatalogItemOptionValue` IDs to be used to find associated
`CatalogItemVariation`s. All ItemVariations that contain all of the given
Item Option Values (in any order) will be returned. | - -## Example (as JSON) - -```json -{ - "item_option_value_ids": [ - "item_option_value_ids0", - "item_option_value_ids9", - "item_option_value_ids8" - ] -} -``` - diff --git a/doc/models/catalog-query-items-for-item-options.md b/doc/models/catalog-query-items-for-item-options.md deleted file mode 100644 index dbfc2e41b..000000000 --- a/doc/models/catalog-query-items-for-item-options.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Catalog Query Items for Item Options - -The query filter to return the items containing the specified item option IDs. - -## Structure - -`CatalogQueryItemsForItemOptions` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemOptionIds` | `string[] \| null \| undefined` | Optional | A set of `CatalogItemOption` IDs to be used to find associated
`CatalogItem`s. All Items that contain all of the given Item Options (in any order)
will be returned. | - -## Example (as JSON) - -```json -{ - "item_option_ids": [ - "item_option_ids5", - "item_option_ids6" - ] -} -``` - diff --git a/doc/models/catalog-query-items-for-modifier-list.md b/doc/models/catalog-query-items-for-modifier-list.md deleted file mode 100644 index f9d41fff6..000000000 --- a/doc/models/catalog-query-items-for-modifier-list.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Query Items for Modifier List - -The query filter to return the items containing the specified modifier list IDs. - -## Structure - -`CatalogQueryItemsForModifierList` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `modifierListIds` | `string[]` | Required | A set of `CatalogModifierList` IDs to be used to find associated `CatalogItem`s. | - -## Example (as JSON) - -```json -{ - "modifier_list_ids": [ - "modifier_list_ids8", - "modifier_list_ids9", - "modifier_list_ids0" - ] -} -``` - diff --git a/doc/models/catalog-query-items-for-tax.md b/doc/models/catalog-query-items-for-tax.md deleted file mode 100644 index cb4f5c129..000000000 --- a/doc/models/catalog-query-items-for-tax.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Catalog Query Items for Tax - -The query filter to return the items containing the specified tax IDs. - -## Structure - -`CatalogQueryItemsForTax` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `taxIds` | `string[]` | Required | A set of `CatalogTax` IDs to be used to find associated `CatalogItem`s. | - -## Example (as JSON) - -```json -{ - "tax_ids": [ - "tax_ids9", - "tax_ids8" - ] -} -``` - diff --git a/doc/models/catalog-query-prefix.md b/doc/models/catalog-query-prefix.md deleted file mode 100644 index 33ee710d6..000000000 --- a/doc/models/catalog-query-prefix.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Catalog Query Prefix - -The query filter to return the search result whose named attribute values are prefixed by the specified attribute value. - -## Structure - -`CatalogQueryPrefix` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `attributeName` | `string` | Required | The name of the attribute to be searched.
**Constraints**: *Minimum Length*: `1` | -| `attributePrefix` | `string` | Required | The desired prefix of the search attribute value.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "attribute_name": "attribute_name8", - "attribute_prefix": "attribute_prefix6" -} -``` - diff --git a/doc/models/catalog-query-range.md b/doc/models/catalog-query-range.md deleted file mode 100644 index 99a93c987..000000000 --- a/doc/models/catalog-query-range.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Query Range - -The query filter to return the search result whose named attribute values fall between the specified range. - -## Structure - -`CatalogQueryRange` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `attributeName` | `string` | Required | The name of the attribute to be searched.
**Constraints**: *Minimum Length*: `1` | -| `attributeMinValue` | `bigint \| null \| undefined` | Optional | The desired minimum value for the search attribute (inclusive). | -| `attributeMaxValue` | `bigint \| null \| undefined` | Optional | The desired maximum value for the search attribute (inclusive). | - -## Example (as JSON) - -```json -{ - "attribute_name": "attribute_name0", - "attribute_min_value": 184, - "attribute_max_value": 94 -} -``` - diff --git a/doc/models/catalog-query-set.md b/doc/models/catalog-query-set.md deleted file mode 100644 index bedd86659..000000000 --- a/doc/models/catalog-query-set.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Catalog Query Set - -The query filter to return the search result(s) by exact match of the specified `attribute_name` and any of -the `attribute_values`. - -## Structure - -`CatalogQuerySet` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `attributeName` | `string` | Required | The name of the attribute to be searched. Matching of the attribute name is exact.
**Constraints**: *Minimum Length*: `1` | -| `attributeValues` | `string[]` | Required | The desired values of the search attribute. Matching of the attribute values is exact and case insensitive.
A maximum of 250 values may be searched in a request. | - -## Example (as JSON) - -```json -{ - "attribute_name": "attribute_name0", - "attribute_values": [ - "attribute_values8" - ] -} -``` - diff --git a/doc/models/catalog-query-sorted-attribute.md b/doc/models/catalog-query-sorted-attribute.md deleted file mode 100644 index c1bea9b7e..000000000 --- a/doc/models/catalog-query-sorted-attribute.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Catalog Query Sorted Attribute - -The query expression to specify the key to sort search results. - -## Structure - -`CatalogQuerySortedAttribute` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `attributeName` | `string` | Required | The attribute whose value is used as the sort key.
**Constraints**: *Minimum Length*: `1` | -| `initialAttributeValue` | `string \| null \| undefined` | Optional | The first attribute value to be returned by the query. Ascending sorts will return only
objects with this value or greater, while descending sorts will return only objects with this value
or less. If unset, start at the beginning (for ascending sorts) or end (for descending sorts). | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "attribute_name": "attribute_name2", - "initial_attribute_value": "initial_attribute_value4", - "sort_order": "DESC" -} -``` - diff --git a/doc/models/catalog-query-text.md b/doc/models/catalog-query-text.md deleted file mode 100644 index 9eeab2a0a..000000000 --- a/doc/models/catalog-query-text.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Catalog Query Text - -The query filter to return the search result whose searchable attribute values contain all of the specified keywords or tokens, independent of the token order or case. - -## Structure - -`CatalogQueryText` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `keywords` | `string[]` | Required | A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 alphanumeric characters are ignored. | - -## Example (as JSON) - -```json -{ - "keywords": [ - "keywords1" - ] -} -``` - diff --git a/doc/models/catalog-query.md b/doc/models/catalog-query.md deleted file mode 100644 index a0700403f..000000000 --- a/doc/models/catalog-query.md +++ /dev/null @@ -1,82 +0,0 @@ - -# Catalog Query - -A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint. - -Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects](../../doc/api/catalog.md#search-catalog-objects). -Any combination of the following types may be used together: - -- [exact_query](../../doc/models/catalog-query-exact.md) -- [prefix_query](../../doc/models/catalog-query-prefix.md) -- [range_query](../../doc/models/catalog-query-range.md) -- [sorted_attribute_query](../../doc/models/catalog-query-sorted-attribute.md) -- [text_query](../../doc/models/catalog-query-text.md) - -All other query types cannot be combined with any others. - -When a query filter is based on an attribute, the attribute must be searchable. -Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters. - -Searchable attribute and objects queryable by searchable attributes: - -- `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue` -- `description`: `CatalogItem`, `CatalogItemOptionValue` -- `abbreviation`: `CatalogItem` -- `upc`: `CatalogItemVariation` -- `sku`: `CatalogItemVariation` -- `caption`: `CatalogImage` -- `display_name`: `CatalogItemOption` - -For example, to search for [CatalogItem](../../doc/models/catalog-item.md) objects by searchable attributes, you can use -the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter. - -## Structure - -`CatalogQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sortedAttributeQuery` | [`CatalogQuerySortedAttribute \| undefined`](../../doc/models/catalog-query-sorted-attribute.md) | Optional | The query expression to specify the key to sort search results. | -| `exactQuery` | [`CatalogQueryExact \| undefined`](../../doc/models/catalog-query-exact.md) | Optional | The query filter to return the search result by exact match of the specified attribute name and value. | -| `setQuery` | [`CatalogQuerySet \| undefined`](../../doc/models/catalog-query-set.md) | Optional | The query filter to return the search result(s) by exact match of the specified `attribute_name` and any of
the `attribute_values`. | -| `prefixQuery` | [`CatalogQueryPrefix \| undefined`](../../doc/models/catalog-query-prefix.md) | Optional | The query filter to return the search result whose named attribute values are prefixed by the specified attribute value. | -| `rangeQuery` | [`CatalogQueryRange \| undefined`](../../doc/models/catalog-query-range.md) | Optional | The query filter to return the search result whose named attribute values fall between the specified range. | -| `textQuery` | [`CatalogQueryText \| undefined`](../../doc/models/catalog-query-text.md) | Optional | The query filter to return the search result whose searchable attribute values contain all of the specified keywords or tokens, independent of the token order or case. | -| `itemsForTaxQuery` | [`CatalogQueryItemsForTax \| undefined`](../../doc/models/catalog-query-items-for-tax.md) | Optional | The query filter to return the items containing the specified tax IDs. | -| `itemsForModifierListQuery` | [`CatalogQueryItemsForModifierList \| undefined`](../../doc/models/catalog-query-items-for-modifier-list.md) | Optional | The query filter to return the items containing the specified modifier list IDs. | -| `itemsForItemOptionsQuery` | [`CatalogQueryItemsForItemOptions \| undefined`](../../doc/models/catalog-query-items-for-item-options.md) | Optional | The query filter to return the items containing the specified item option IDs. | -| `itemVariationsForItemOptionValuesQuery` | [`CatalogQueryItemVariationsForItemOptionValues \| undefined`](../../doc/models/catalog-query-item-variations-for-item-option-values.md) | Optional | The query filter to return the item variations containing the specified item option value IDs. | - -## Example (as JSON) - -```json -{ - "sorted_attribute_query": { - "attribute_name": "attribute_name0", - "initial_attribute_value": "initial_attribute_value8", - "sort_order": "DESC" - }, - "exact_query": { - "attribute_name": "attribute_name4", - "attribute_value": "attribute_value6" - }, - "set_query": { - "attribute_name": "attribute_name2", - "attribute_values": [ - "attribute_values6" - ] - }, - "prefix_query": { - "attribute_name": "attribute_name6", - "attribute_prefix": "attribute_prefix8" - }, - "range_query": { - "attribute_name": "attribute_name0", - "attribute_min_value": 208, - "attribute_max_value": 138 - } -} -``` - diff --git a/doc/models/catalog-quick-amount-type.md b/doc/models/catalog-quick-amount-type.md deleted file mode 100644 index 4b35cc8cc..000000000 --- a/doc/models/catalog-quick-amount-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Catalog Quick Amount Type - -Determines the type of a specific Quick Amount. - -## Enumeration - -`CatalogQuickAmountType` - -## Fields - -| Name | Description | -| --- | --- | -| `QUICK_AMOUNT_TYPE_MANUAL` | Quick Amount is created manually by the seller. | -| `QUICK_AMOUNT_TYPE_AUTO` | Quick Amount is generated automatically by machine learning algorithms. | - diff --git a/doc/models/catalog-quick-amount.md b/doc/models/catalog-quick-amount.md deleted file mode 100644 index 88354d13c..000000000 --- a/doc/models/catalog-quick-amount.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Catalog Quick Amount - -Represents a Quick Amount in the Catalog. - -## Structure - -`CatalogQuickAmount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string`](../../doc/models/catalog-quick-amount-type.md) | Required | Determines the type of a specific Quick Amount. | -| `amount` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `score` | `bigint \| null \| undefined` | Optional | Describes the ranking of the Quick Amount provided by machine learning model, in the range [0, 100].
MANUAL type amount will always have score = 100. | -| `ordinal` | `bigint \| null \| undefined` | Optional | The order in which this Quick Amount should be displayed. | - -## Example (as JSON) - -```json -{ - "type": "QUICK_AMOUNT_TYPE_MANUAL", - "amount": { - "amount": 0, - "currency": "LAK" - }, - "score": 12, - "ordinal": 200 -} -``` - diff --git a/doc/models/catalog-quick-amounts-settings-option.md b/doc/models/catalog-quick-amounts-settings-option.md deleted file mode 100644 index 52672a359..000000000 --- a/doc/models/catalog-quick-amounts-settings-option.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Catalog Quick Amounts Settings Option - -Determines a seller's option on Quick Amounts feature. - -## Enumeration - -`CatalogQuickAmountsSettingsOption` - -## Fields - -| Name | Description | -| --- | --- | -| `DISABLED` | Option for seller to disable Quick Amounts. | -| `MANUAL` | Option for seller to choose manually created Quick Amounts. | -| `AUTO` | Option for seller to choose automatically created Quick Amounts. | - diff --git a/doc/models/catalog-quick-amounts-settings.md b/doc/models/catalog-quick-amounts-settings.md deleted file mode 100644 index 128d6b1bc..000000000 --- a/doc/models/catalog-quick-amounts-settings.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Catalog Quick Amounts Settings - -A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts. - -## Structure - -`CatalogQuickAmountsSettings` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `option` | [`string`](../../doc/models/catalog-quick-amounts-settings-option.md) | Required | Determines a seller's option on Quick Amounts feature. | -| `eligibleForAutoAmounts` | `boolean \| null \| undefined` | Optional | Represents location's eligibility for auto amounts
The boolean should be consistent with whether there are AUTO amounts in the `amounts`. | -| `amounts` | [`CatalogQuickAmount[] \| null \| undefined`](../../doc/models/catalog-quick-amount.md) | Optional | Represents a set of Quick Amounts at this location. | - -## Example (as JSON) - -```json -{ - "option": "AUTO", - "eligible_for_auto_amounts": false, - "amounts": [ - { - "type": "QUICK_AMOUNT_TYPE_MANUAL", - "amount": { - "amount": 0, - "currency": "LAK" - }, - "score": 116, - "ordinal": 48 - }, - { - "type": "QUICK_AMOUNT_TYPE_MANUAL", - "amount": { - "amount": 0, - "currency": "LAK" - }, - "score": 116, - "ordinal": 48 - } - ] -} -``` - diff --git a/doc/models/catalog-stock-conversion.md b/doc/models/catalog-stock-conversion.md deleted file mode 100644 index 323476478..000000000 --- a/doc/models/catalog-stock-conversion.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Catalog Stock Conversion - -Represents the rule of conversion between a stockable [CatalogItemVariation](../../doc/models/catalog-item-variation.md) -and a non-stockable sell-by or receive-by `CatalogItemVariation` that -share the same underlying stock. - -## Structure - -`CatalogStockConversion` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `stockableItemVariationId` | `string` | Required | References to the stockable [CatalogItemVariation](entity:CatalogItemVariation)
for this stock conversion. Selling, receiving or recounting the non-stockable `CatalogItemVariation`
defined with a stock conversion results in adjustments of this stockable `CatalogItemVariation`.
This immutable field must reference a stockable `CatalogItemVariation`
that shares the parent [CatalogItem](entity:CatalogItem) of the converted `CatalogItemVariation.`
**Constraints**: *Minimum Length*: `1` | -| `stockableQuantity` | `string` | Required | The quantity of the stockable item variation (as identified by `stockable_item_variation_id`)
equivalent to the non-stockable item variation quantity (as specified in `nonstockable_quantity`)
as defined by this stock conversion. It accepts a decimal number in a string format that can take
up to 10 digits before the decimal point and up to 5 digits after the decimal point.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `16` | -| `nonstockableQuantity` | `string` | Required | The converted equivalent quantity of the non-stockable [CatalogItemVariation](entity:CatalogItemVariation)
in its measurement unit. The `stockable_quantity` value and this `nonstockable_quantity` value together
define the conversion ratio between stockable item variation and the non-stockable item variation.
It accepts a decimal number in a string format that can take up to 10 digits before the decimal point
and up to 5 digits after the decimal point.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `16` | - -## Example (as JSON) - -```json -{ - "stockable_item_variation_id": "stockable_item_variation_id2", - "stockable_quantity": "stockable_quantity0", - "nonstockable_quantity": "nonstockable_quantity2" -} -``` - diff --git a/doc/models/catalog-subscription-plan-variation.md b/doc/models/catalog-subscription-plan-variation.md deleted file mode 100644 index 5417444ab..000000000 --- a/doc/models/catalog-subscription-plan-variation.md +++ /dev/null @@ -1,56 +0,0 @@ - -# 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 \| null \| undefined` | Optional | The id of the subscription plan, if there is one. | -| `monthlyBillingAnchorDate` | `bigint \| null \| undefined` | Optional | The day of the month the billing period starts.
**Constraints**: `>= 1`, `<= 31` | -| `canProrate` | `boolean \| null \| undefined` | Optional | Whether bills for this plan variation can be split for proration. | -| `successorPlanVariationId` | `string \| null \| undefined` | Optional | The ID of a "successor" plan variation to this one. If the field is set, and this object is disabled at all
locations, it indicates that this variation is deprecated and the object identified by the successor ID be used in
its stead. | - -## Example (as JSON) - -```json -{ - "name": "name2", - "phases": [ - { - "uid": "uid0", - "cadence": "QUARTERLY", - "periods": 112, - "recurring_price_money": { - "amount": 66, - "currency": "ZMW" - }, - "ordinal": 78, - "pricing": { - "type": "STATIC", - "discount_ids": [ - "discount_ids5", - "discount_ids6" - ], - "price_money": { - "amount": 202, - "currency": "GTQ" - } - } - } - ], - "subscription_plan_id": "subscription_plan_id0", - "monthly_billing_anchor_date": 38, - "can_prorate": false, - "successor_plan_variation_id": "successor_plan_variation_id2" -} -``` - diff --git a/doc/models/catalog-subscription-plan.md b/doc/models/catalog-subscription-plan.md deleted file mode 100644 index d998307dc..000000000 --- a/doc/models/catalog-subscription-plan.md +++ /dev/null @@ -1,194 +0,0 @@ - -# Catalog Subscription 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 - -`CatalogSubscriptionPlan` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string` | Required | The name of the plan. | -| `phases` | [`SubscriptionPhase[] \| null \| 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[] \| null \| undefined`](../../doc/models/catalog-object.md) | Optional | The list of subscription plan variations available for this product | -| `eligibleItemIds` | `string[] \| null \| undefined` | Optional | The list of IDs of `CatalogItems` that are eligible for subscription by this SubscriptionPlan's variations. | -| `eligibleCategoryIds` | `string[] \| null \| undefined` | Optional | The list of IDs of `CatalogCategory` that are eligible for subscription by this SubscriptionPlan's variations. | -| `allItems` | `boolean \| null \| undefined` | Optional | If true, all items in the merchant's catalog are subscribable by this SubscriptionPlan. | - -## Example (as JSON) - -```json -{ - "name": "name6", - "phases": [ - { - "uid": "uid0", - "cadence": "QUARTERLY", - "periods": 112, - "recurring_price_money": { - "amount": 66, - "currency": "ZMW" - }, - "ordinal": 78, - "pricing": { - "type": "STATIC", - "discount_ids": [ - "discount_ids5", - "discount_ids6" - ], - "price_money": { - "amount": 202, - "currency": "GTQ" - } - } - }, - { - "uid": "uid0", - "cadence": "QUARTERLY", - "periods": 112, - "recurring_price_money": { - "amount": 66, - "currency": "ZMW" - }, - "ordinal": 78, - "pricing": { - "type": "STATIC", - "discount_ids": [ - "discount_ids5", - "discount_ids6" - ], - "price_money": { - "amount": 202, - "currency": "GTQ" - } - } - }, - { - "uid": "uid0", - "cadence": "QUARTERLY", - "periods": 112, - "recurring_price_money": { - "amount": 66, - "currency": "ZMW" - }, - "ordinal": 78, - "pricing": { - "type": "STATIC", - "discount_ids": [ - "discount_ids5", - "discount_ids6" - ], - "price_money": { - "amount": 202, - "currency": "GTQ" - } - } - } - ], - "subscription_plan_variations": [ - { - "type": "MODIFIER", - "id": "id4", - "updated_at": "updated_at0", - "version": 208, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "type": "MODIFIER", - "id": "id4", - "updated_at": "updated_at0", - "version": 208, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "eligible_item_ids": [ - "eligible_item_ids8", - "eligible_item_ids7" - ], - "eligible_category_ids": [ - "eligible_category_ids5", - "eligible_category_ids6", - "eligible_category_ids7" - ], - "all_items": false -} -``` - diff --git a/doc/models/catalog-tax.md b/doc/models/catalog-tax.md deleted file mode 100644 index 56eb0eac3..000000000 --- a/doc/models/catalog-tax.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Catalog Tax - -A tax applicable to an item. - -## Structure - -`CatalogTax` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The tax's name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
**Constraints**: *Maximum Length*: `255` | -| `calculationPhase` | [`string \| undefined`](../../doc/models/tax-calculation-phase.md) | Optional | When to calculate the taxes due on a cart. | -| `inclusionType` | [`string \| undefined`](../../doc/models/tax-inclusion-type.md) | Optional | Whether to the tax amount should be additional to or included in the CatalogItem price. | -| `percentage` | `string \| null \| undefined` | Optional | The percentage of the tax in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign.
A value of `7.5` corresponds to 7.5%. For a location-specific tax rate, contact the tax authority of the location or a tax consultant. | -| `appliesToCustomAmounts` | `boolean \| null \| undefined` | Optional | If `true`, the fee applies to custom amounts entered into the Square Point of Sale
app that are not associated with a particular `CatalogItem`. | -| `enabled` | `boolean \| null \| undefined` | Optional | A Boolean flag to indicate whether the tax is displayed as enabled (`true`) in the Square Point of Sale app or not (`false`). | -| `appliesToProductSetId` | `string \| null \| undefined` | Optional | The ID of a `CatalogProductSet` object. If set, the tax is applicable to all products in the product set. | - -## Example (as JSON) - -```json -{ - "object": { - "id": "#SalesTax", - "present_at_all_locations": true, - "tax_data": { - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "enabled": true, - "fee_applies_to_custom_amounts": true, - "inclusion_type": "ADDITIVE", - "name": "Sales Tax", - "percentage": "5.0" - }, - "type": "TAX" - }, - "name": "name2", - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "inclusion_type": "ADDITIVE", - "percentage": "percentage0", - "applies_to_custom_amounts": false -} -``` - diff --git a/doc/models/catalog-time-period.md b/doc/models/catalog-time-period.md deleted file mode 100644 index 945c426be..000000000 --- a/doc/models/catalog-time-period.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Catalog Time Period - -Represents a time period - either a single period or a repeating period. - -## Structure - -`CatalogTimePeriod` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `event` | `string \| null \| undefined` | Optional | An iCalendar (RFC 5545) [event](https://tools.ietf.org/html/rfc5545#section-3.6.1), which
specifies the name, timing, duration and recurrence of this time period.

Example:

```
DTSTART:20190707T180000
DURATION:P2H
RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR
```

Only `SUMMARY`, `DTSTART`, `DURATION` and `RRULE` fields are supported.
`DTSTART` must be in local (unzoned) time format. Note that while `BEGIN:VEVENT`
and `END:VEVENT` is not required in the request. The response will always
include them. | - -## Example (as JSON) - -```json -{ - "event": "event8" -} -``` - diff --git a/doc/models/catalog-v1-id.md b/doc/models/catalog-v1-id.md deleted file mode 100644 index 614782cc3..000000000 --- a/doc/models/catalog-v1-id.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Catalog V1 Id - -A Square API V1 identifier of an item, including the object ID and its associated location ID. - -## Structure - -`CatalogV1Id` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `catalogV1Id` | `string \| null \| undefined` | Optional | The ID for an object used in the Square API V1, if the object ID differs from the Square API V2 object ID. | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the `Location` this Connect V1 ID is associated with. | - -## Example (as JSON) - -```json -{ - "catalog_v1_id": "catalog_v1_id2", - "location_id": "location_id2" -} -``` - diff --git a/doc/models/category-path-to-root-node.md b/doc/models/category-path-to-root-node.md deleted file mode 100644 index 309cf29b6..000000000 --- a/doc/models/category-path-to-root-node.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Category Path to Root Node - -A node in the path from a retrieved category to its root node. - -## Structure - -`CategoryPathToRootNode` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `categoryId` | `string \| null \| undefined` | Optional | The category's ID. | -| `categoryName` | `string \| null \| undefined` | Optional | The category's name. | - -## Example (as JSON) - -```json -{ - "category_id": "category_id0", - "category_name": "category_name0" -} -``` - diff --git a/doc/models/change-billing-anchor-date-request.md b/doc/models/change-billing-anchor-date-request.md deleted file mode 100644 index dbfa4745e..000000000 --- a/doc/models/change-billing-anchor-date-request.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Change Billing Anchor Date Request - -Defines input parameters in a request to the -[ChangeBillingAnchorDate](../../doc/api/subscriptions.md#change-billing-anchor-date) endpoint. - -## Structure - -`ChangeBillingAnchorDateRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `monthlyBillingAnchorDate` | `number \| null \| undefined` | Optional | The anchor day for the billing cycle.
**Constraints**: `>= 1`, `<= 31` | -| `effectiveDate` | `string \| null \| undefined` | Optional | The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes
place on the subscription.

When this date is unspecified or falls within the current billing cycle, the billing anchor date
is changed immediately. | - -## Example (as JSON) - -```json -{ - "monthly_billing_anchor_date": 1, - "effective_date": "effective_date8" -} -``` - diff --git a/doc/models/change-billing-anchor-date-response.md b/doc/models/change-billing-anchor-date-response.md deleted file mode 100644 index cea478b9f..000000000 --- a/doc/models/change-billing-anchor-date-response.md +++ /dev/null @@ -1,94 +0,0 @@ - -# Change Billing Anchor Date Response - -Defines output parameters in a request to the -[ChangeBillingAnchorDate](../../doc/api/subscriptions.md#change-billing-anchor-date) endpoint. - -## Structure - -`ChangeBillingAnchorDateResponse` - -## Fields - -| 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 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 billing anchor date change for the subscription. | - -## Example (as JSON) - -```json -{ - "actions": [ - { - "effective_date": "2023-11-01", - "id": "f0a1dfdc-675b-3a14-a640-99f7ac1cee83", - "monthly_billing_anchor_date": 1, - "type": "CHANGE_BILLING_ANCHOR_DATE", - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - } - ], - "subscription": { - "created_at": "2023-06-20T21:53:10Z", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "id": "9ba40961-995a-4a3d-8c53-048c40cafc13", - "location_id": "S8GWD5R9QB376", - "monthly_billing_anchor_date": 20, - "phases": [ - { - "order_template_id": "E6oBY5WfQ2eN4pkYZwq4ka6n7KeZY", - "ordinal": 0, - "plan_phase_uid": "C66BKH3ASTDYGJJCEZXQQSS7", - "uid": "98d6f53b-40e1-4714-8827-032fd923be25" - } - ], - "plan_variation_id": "FQ7CDXXWSLUJRPM3GFJSJGZ7", - "price_override_money": { - "amount": 2000, - "currency": "USD" - }, - "source": { - "name": "My Application" - }, - "status": "ACTIVE", - "timezone": "America/Los_Angeles", - "version": 3, - "start_date": "start_date8" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/change-timing.md b/doc/models/change-timing.md deleted file mode 100644 index 1934eb99d..000000000 --- a/doc/models/change-timing.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Change Timing - -Supported timings when a pending change, as an action, takes place to a subscription. - -## Enumeration - -`ChangeTiming` - -## Fields - -| Name | Description | -| --- | --- | -| `IMMEDIATE` | The action occurs immediately. | -| `END_OF_BILLING_CYCLE` | The action occurs at the end of the billing cycle. | - diff --git a/doc/models/charge-request-additional-recipient.md b/doc/models/charge-request-additional-recipient.md deleted file mode 100644 index bf487136d..000000000 --- a/doc/models/charge-request-additional-recipient.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Charge Request Additional Recipient - -Represents an additional recipient (other than the merchant) entitled to a portion of the tender. -Support is currently limited to USD, CAD and GBP currencies - -## Structure - -`ChargeRequestAdditionalRecipient` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Required | The location ID for a recipient (other than the merchant) receiving a portion of the tender.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `50` | -| `description` | `string` | Required | The description of the additional recipient.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `100` | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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 -{ - "location_id": "location_id6", - "description": "description2", - "amount_money": { - "amount": 186, - "currency": "AUD" - } -} -``` - diff --git a/doc/models/charge-request.md b/doc/models/charge-request.md deleted file mode 100644 index 399e01bf3..000000000 --- a/doc/models/charge-request.md +++ /dev/null @@ -1,73 +0,0 @@ - -# Charge Request - -Defines the parameters that can be included in the body of -a request to the [Charge](api-endpoint:Transactions-Charge) endpoint. - -Deprecated - recommend using [CreatePayment](api-endpoint:Payments-CreatePayment) - -## Structure - -`ChargeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A value you specify that uniquely identifies this
transaction among transactions you've created.

If you're unsure whether a particular transaction succeeded,
you can reattempt it with the same idempotency key without
worrying about double-charging the buyer.

See [Idempotency keys](https://developer.squareup.com/docs/working-with-apis/idempotency) for more information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `192` | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `cardNonce` | `string \| null \| undefined` | Optional | A payment token generated from the [Card.tokenize()](https://developer.squareup.com/reference/sdks/web/payments/objects/Card#Card.tokenize) that represents the card
to charge.

The application that provides a payment token to this endpoint must be the
_same application_ that generated the payment token with the Web Payments SDK.
Otherwise, the nonce is invalid.

Do not provide a value for this field if you provide a value for
`customer_card_id`.
**Constraints**: *Maximum Length*: `192` | -| `customerCardId` | `string \| null \| undefined` | Optional | The ID of the customer card on file to charge. Do
not provide a value for this field if you provide a value for `card_nonce`.

If you provide this value, you _must_ also provide a value for
`customer_id`.
**Constraints**: *Maximum Length*: `192` | -| `delayCapture` | `boolean \| null \| undefined` | Optional | If `true`, the request will only perform an Auth on the provided
card. You can then later perform either a Capture (with the
[CaptureTransaction](api-endpoint:Transactions-CaptureTransaction) endpoint) or a Void
(with the [VoidTransaction](api-endpoint:Transactions-VoidTransaction) endpoint).

Default value: `false` | -| `referenceId` | `string \| null \| undefined` | Optional | An optional ID you can associate with the transaction for your own
purposes (such as to associate the transaction with an entity ID in your
own database).

This value cannot exceed 40 characters.
**Constraints**: *Maximum Length*: `40` | -| `note` | `string \| null \| undefined` | Optional | An optional note to associate with the transaction.

This value cannot exceed 60 characters.
**Constraints**: *Maximum Length*: `60` | -| `customerId` | `string \| null \| undefined` | Optional | The ID of the customer to associate this transaction with. This field
is required if you provide a value for `customer_card_id`, and optional
otherwise.
**Constraints**: *Maximum Length*: `50` | -| `billingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `shippingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `buyerEmailAddress` | `string \| null \| undefined` | Optional | The buyer's email address, if available. This value is optional,
but this transaction is ineligible for chargeback protection if it is not
provided. | -| `orderId` | `string \| null \| undefined` | Optional | The ID of the order to associate with this transaction.

If you provide this value, the `amount_money` value of your request must
__exactly match__ the value of the order's `total_money` field.
**Constraints**: *Maximum Length*: `192` | -| `additionalRecipients` | [`ChargeRequestAdditionalRecipient[] \| null \| undefined`](../../doc/models/charge-request-additional-recipient.md) | Optional | The basic primitive of multi-party transaction. The value is optional.
The transaction facilitated by you can be split from here.

If you provide this value, the `amount_money` value in your additional_recipients
must not be more than 90% of the `amount_money` value in the charge request.
The `location_id` must be the valid location of the app owner merchant.

This field requires the `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.

This field is currently not supported in sandbox. | -| `verificationToken` | `string \| null \| undefined` | Optional | A token generated by SqPaymentForm's verifyBuyer() that represents
customer's device info and 3ds challenge result. | - -## Example (as JSON) - -```json -{ - "additional_recipients": [ - { - "amount_money": { - "amount": 20, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1" - } - ], - "amount_money": { - "amount": 200, - "currency": "USD" - }, - "billing_address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "card_nonce": "card_nonce_from_square_123", - "delay_capture": false, - "idempotency_key": "74ae1696-b1e3-4328-af6d-f1e04d947a13", - "note": "some optional note", - "reference_id": "some optional reference id", - "shipping_address": { - "address_line_1": "123 Main St", - "administrative_district_level_1": "CA", - "country": "US", - "locality": "San Francisco", - "postal_code": "94114" - }, - "customer_card_id": "customer_card_id0" -} -``` - diff --git a/doc/models/charge-response.md b/doc/models/charge-response.md deleted file mode 100644 index 52fabd5f2..000000000 --- a/doc/models/charge-response.md +++ /dev/null @@ -1,187 +0,0 @@ - -# Charge Response - -Defines the fields that are included in the response body of -a request to the [Charge](api-endpoint:Transactions-Charge) endpoint. - -One of `errors` or `transaction` is present in a given response (never both). - -## Structure - -`ChargeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `transaction` | [`Transaction \| undefined`](../../doc/models/transaction.md) | Optional | Represents a transaction processed with Square, either with the
Connect API or with Square Point of Sale.

The `tenders` field of this object lists all methods of payment used to pay in
the transaction. | - -## Example (as JSON) - -```json -{ - "transaction": { - "created_at": "2016-03-10T22:57:56Z", - "id": "KnL67ZIwXCPtzOrqj0HrkxMF", - "location_id": "18YC4JDH91E1H", - "product": "EXTERNAL_API", - "reference_id": "some optional reference id", - "tenders": [ - { - "additional_recipients": [ - { - "amount_money": { - "amount": 20, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1", - "receivable_id": "ISu5xwxJ5v0CMJTQq7RvqyMF" - } - ], - "amount_money": { - "amount": 200, - "currency": "USD" - }, - "card_details": { - "card": { - "card_brand": "VISA", - "last_4": "1111" - }, - "entry_method": "KEYED", - "status": "CAPTURED" - }, - "created_at": "2016-03-10T22:57:56Z", - "id": "MtZRYYdDrYNQbOvV7nbuBvMF", - "location_id": "18YC4JDH91E1H", - "note": "some optional note", - "transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF", - "type": "CARD" - } - ], - "refunds": [ - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - }, - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - }, - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/checkout-location-settings-branding-button-shape.md b/doc/models/checkout-location-settings-branding-button-shape.md deleted file mode 100644 index 788cac88e..000000000 --- a/doc/models/checkout-location-settings-branding-button-shape.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Checkout Location Settings Branding Button Shape - -## Enumeration - -`CheckoutLocationSettingsBrandingButtonShape` - -## Fields - -| Name | -| --- | -| `SQUARED` | -| `ROUNDED` | -| `PILL` | - diff --git a/doc/models/checkout-location-settings-branding-header-type.md b/doc/models/checkout-location-settings-branding-header-type.md deleted file mode 100644 index b78204a8f..000000000 --- a/doc/models/checkout-location-settings-branding-header-type.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Checkout Location Settings Branding Header Type - -## Enumeration - -`CheckoutLocationSettingsBrandingHeaderType` - -## Fields - -| Name | -| --- | -| `BUSINESS_NAME` | -| `FRAMED_LOGO` | -| `FULL_WIDTH_LOGO` | - diff --git a/doc/models/checkout-location-settings-branding.md b/doc/models/checkout-location-settings-branding.md deleted file mode 100644 index eb7bacea8..000000000 --- a/doc/models/checkout-location-settings-branding.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Checkout Location Settings Branding - -## Structure - -`CheckoutLocationSettingsBranding` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `headerType` | [`string \| undefined`](../../doc/models/checkout-location-settings-branding-header-type.md) | Optional | - | -| `buttonColor` | `string \| null \| undefined` | Optional | The HTML-supported hex color for the button on the checkout page (for example, "#FFFFFF").
**Constraints**: *Minimum Length*: `7`, *Maximum Length*: `7` | -| `buttonShape` | [`string \| undefined`](../../doc/models/checkout-location-settings-branding-button-shape.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "header_type": "FULL_WIDTH_LOGO", - "button_color": "button_color2", - "button_shape": "ROUNDED" -} -``` - diff --git a/doc/models/checkout-location-settings-coupons.md b/doc/models/checkout-location-settings-coupons.md deleted file mode 100644 index 54c4b9cfd..000000000 --- a/doc/models/checkout-location-settings-coupons.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Checkout Location Settings Coupons - -## Structure - -`CheckoutLocationSettingsCoupons` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `enabled` | `boolean \| null \| undefined` | Optional | Indicates whether coupons are enabled for this location. | - -## Example (as JSON) - -```json -{ - "enabled": false -} -``` - diff --git a/doc/models/checkout-location-settings-policy.md b/doc/models/checkout-location-settings-policy.md deleted file mode 100644 index c19053d0c..000000000 --- a/doc/models/checkout-location-settings-policy.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Checkout Location Settings Policy - -## Structure - -`CheckoutLocationSettingsPolicy` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID to identify the policy when making changes. You must set the UID for policy updates, but it’s optional when setting new policies. | -| `title` | `string \| null \| undefined` | Optional | The title of the policy. This is required when setting the description, though you can update it in a different request.
**Constraints**: *Maximum Length*: `50` | -| `description` | `string \| null \| undefined` | Optional | The description of the policy.
**Constraints**: *Maximum Length*: `4096` | - -## Example (as JSON) - -```json -{ - "uid": "uid0", - "title": "title6", - "description": "description0" -} -``` - diff --git a/doc/models/checkout-location-settings-tipping.md b/doc/models/checkout-location-settings-tipping.md deleted file mode 100644 index e4ca7380f..000000000 --- a/doc/models/checkout-location-settings-tipping.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Checkout Location Settings Tipping - -## Structure - -`CheckoutLocationSettingsTipping` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `percentages` | `number[] \| null \| undefined` | Optional | Set three custom percentage amounts that buyers can select at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more. | -| `smartTippingEnabled` | `boolean \| null \| undefined` | Optional | Enables Smart Tip Amounts. If Smart Tip Amounts is enabled, tipping works as follows:
If a transaction is less than $10, the available tipping options include No Tip, $1, $2, or $3.
If a transaction is $10 or more, the available tipping options include No Tip, 15%, 20%, or 25%.
You can set custom percentage amounts with the `percentages` field. | -| `defaultPercent` | `number \| null \| undefined` | Optional | Set the pre-selected percentage amounts that appear at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more. | -| `smartTips` | [`Money[] \| null \| undefined`](../../doc/models/money.md) | Optional | Show the Smart Tip Amounts for this location. | -| `defaultSmartTip` | [`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 -{ - "percentages": [ - 192, - 193 - ], - "smart_tipping_enabled": false, - "default_percent": 72, - "smart_tips": [ - { - "amount": 152, - "currency": "GEL" - }, - { - "amount": 152, - "currency": "GEL" - }, - { - "amount": 152, - "currency": "GEL" - } - ], - "default_smart_tip": { - "amount": 58, - "currency": "KWD" - } -} -``` - diff --git a/doc/models/checkout-location-settings.md b/doc/models/checkout-location-settings.md deleted file mode 100644 index d5298c903..000000000 --- a/doc/models/checkout-location-settings.md +++ /dev/null @@ -1,67 +0,0 @@ - -# Checkout Location Settings - -## Structure - -`CheckoutLocationSettings` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the location that these settings apply to. | -| `customerNotesEnabled` | `boolean \| null \| undefined` | Optional | Indicates whether customers are allowed to leave notes at checkout. | -| `policies` | [`CheckoutLocationSettingsPolicy[] \| null \| undefined`](../../doc/models/checkout-location-settings-policy.md) | Optional | Policy information is displayed at the bottom of the checkout pages.
You can set a maximum of two policies. | -| `branding` | [`CheckoutLocationSettingsBranding \| undefined`](../../doc/models/checkout-location-settings-branding.md) | Optional | - | -| `tipping` | [`CheckoutLocationSettingsTipping \| undefined`](../../doc/models/checkout-location-settings-tipping.md) | Optional | - | -| `coupons` | [`CheckoutLocationSettingsCoupons \| undefined`](../../doc/models/checkout-location-settings-coupons.md) | Optional | - | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the settings were last updated, in RFC 3339 format.
Examples for January 25th, 2020 6:25:34pm Pacific Standard Time:
UTC: 2020-01-26T02:25:34Z
Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00 | - -## Example (as JSON) - -```json -{ - "location_id": "location_id4", - "customer_notes_enabled": false, - "policies": [ - { - "uid": "uid8", - "title": "title4", - "description": "description8" - }, - { - "uid": "uid8", - "title": "title4", - "description": "description8" - } - ], - "branding": { - "header_type": "FULL_WIDTH_LOGO", - "button_color": "button_color2", - "button_shape": "PILL" - }, - "tipping": { - "percentages": [ - 246, - 247 - ], - "smart_tipping_enabled": false, - "default_percent": 46, - "smart_tips": [ - { - "amount": 152, - "currency": "GEL" - }, - { - "amount": 152, - "currency": "GEL" - } - ], - "default_smart_tip": { - "amount": 58, - "currency": "KWD" - } - } -} -``` - diff --git a/doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay-eligibility-range.md b/doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay-eligibility-range.md deleted file mode 100644 index 97a1a0a75..000000000 --- a/doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay-eligibility-range.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Checkout Merchant Settings Payment Methods Afterpay Clearpay Eligibility Range - -A range of purchase price that qualifies. - -## Structure - -`CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `min` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `max` | [`Money`](../../doc/models/money.md) | Required | 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 -{ - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } -} -``` - diff --git a/doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay.md b/doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay.md deleted file mode 100644 index 1cad1486b..000000000 --- a/doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Checkout Merchant Settings Payment Methods Afterpay Clearpay - -The settings allowed for AfterpayClearpay. - -## Structure - -`CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderEligibilityRange` | [`CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange \| undefined`](../../doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay-eligibility-range.md) | Optional | A range of purchase price that qualifies. | -| `itemEligibilityRange` | [`CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange \| undefined`](../../doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay-eligibility-range.md) | Optional | A range of purchase price that qualifies. | -| `enabled` | `boolean \| undefined` | Optional | Indicates whether the payment method is enabled for the account. | - -## Example (as JSON) - -```json -{ - "order_eligibility_range": { - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } - }, - "item_eligibility_range": { - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } - }, - "enabled": false -} -``` - diff --git a/doc/models/checkout-merchant-settings-payment-methods-payment-method.md b/doc/models/checkout-merchant-settings-payment-methods-payment-method.md deleted file mode 100644 index 1a9f728b9..000000000 --- a/doc/models/checkout-merchant-settings-payment-methods-payment-method.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Checkout Merchant Settings Payment Methods Payment Method - -The settings allowed for a payment method. - -## Structure - -`CheckoutMerchantSettingsPaymentMethodsPaymentMethod` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `enabled` | `boolean \| null \| undefined` | Optional | Indicates whether the payment method is enabled for the account. | - -## Example (as JSON) - -```json -{ - "enabled": false -} -``` - diff --git a/doc/models/checkout-merchant-settings-payment-methods.md b/doc/models/checkout-merchant-settings-payment-methods.md deleted file mode 100644 index 3cf871bac..000000000 --- a/doc/models/checkout-merchant-settings-payment-methods.md +++ /dev/null @@ -1,55 +0,0 @@ - -# Checkout Merchant Settings Payment Methods - -## Structure - -`CheckoutMerchantSettingsPaymentMethods` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `applePay` | [`CheckoutMerchantSettingsPaymentMethodsPaymentMethod \| undefined`](../../doc/models/checkout-merchant-settings-payment-methods-payment-method.md) | Optional | The settings allowed for a payment method. | -| `googlePay` | [`CheckoutMerchantSettingsPaymentMethodsPaymentMethod \| undefined`](../../doc/models/checkout-merchant-settings-payment-methods-payment-method.md) | Optional | The settings allowed for a payment method. | -| `cashApp` | [`CheckoutMerchantSettingsPaymentMethodsPaymentMethod \| undefined`](../../doc/models/checkout-merchant-settings-payment-methods-payment-method.md) | Optional | The settings allowed for a payment method. | -| `afterpayClearpay` | [`CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay \| undefined`](../../doc/models/checkout-merchant-settings-payment-methods-afterpay-clearpay.md) | Optional | The settings allowed for AfterpayClearpay. | - -## Example (as JSON) - -```json -{ - "apple_pay": { - "enabled": false - }, - "google_pay": { - "enabled": false - }, - "cash_app": { - "enabled": false - }, - "afterpay_clearpay": { - "order_eligibility_range": { - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } - }, - "item_eligibility_range": { - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } - }, - "enabled": false - } -} -``` - diff --git a/doc/models/checkout-merchant-settings.md b/doc/models/checkout-merchant-settings.md deleted file mode 100644 index e690dcbc4..000000000 --- a/doc/models/checkout-merchant-settings.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Checkout Merchant Settings - -## Structure - -`CheckoutMerchantSettings` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentMethods` | [`CheckoutMerchantSettingsPaymentMethods \| undefined`](../../doc/models/checkout-merchant-settings-payment-methods.md) | Optional | - | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the settings were last updated, in RFC 3339 format.
Examples for January 25th, 2020 6:25:34pm Pacific Standard Time:
UTC: 2020-01-26T02:25:34Z
Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00 | - -## Example (as JSON) - -```json -{ - "payment_methods": { - "apple_pay": { - "enabled": false - }, - "google_pay": { - "enabled": false - }, - "cash_app": { - "enabled": false - }, - "afterpay_clearpay": { - "order_eligibility_range": { - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } - }, - "item_eligibility_range": { - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } - }, - "enabled": false - } - }, - "updated_at": "updated_at0" -} -``` - diff --git a/doc/models/checkout-options-payment-type.md b/doc/models/checkout-options-payment-type.md deleted file mode 100644 index 3ea1b1cef..000000000 --- a/doc/models/checkout-options-payment-type.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Checkout Options Payment Type - -## Enumeration - -`CheckoutOptionsPaymentType` - -## Fields - -| Name | Description | -| --- | --- | -| `CARD_PRESENT` | Accept credit card or debit card payments via tap, dip or swipe. | -| `MANUAL_CARD_ENTRY` | Launches the manual credit or debit card entry screen for the buyer to complete. | -| `FELICA_ID` | Launches the iD checkout screen for the buyer to complete. | -| `FELICA_QUICPAY` | Launches the QUICPay checkout screen for the buyer to complete. | -| `FELICA_TRANSPORTATION_GROUP` | Launches the Transportation Group checkout screen for the buyer to complete. | -| `FELICA_ALL` | Launches a checkout screen for the buyer on the Square Terminal that
allows them to select a specific FeliCa brand or select the check balance screen. | -| `PAYPAY` | Replaced by `QR_CODE`. | -| `QR_CODE` | Launches Square's QR Code checkout screen for the buyer to complete.
Displays a single code that supports all digital wallets connected to the target
Seller location (e.g. PayPay) | - diff --git a/doc/models/checkout-options.md b/doc/models/checkout-options.md deleted file mode 100644 index 88cee9dc0..000000000 --- a/doc/models/checkout-options.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Checkout Options - -## Structure - -`CheckoutOptions` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `allowTipping` | `boolean \| null \| undefined` | Optional | Indicates whether the payment allows tipping. | -| `customFields` | [`CustomField[] \| null \| undefined`](../../doc/models/custom-field.md) | Optional | The custom fields requesting information from the buyer. | -| `subscriptionPlanId` | `string \| null \| undefined` | Optional | The ID of the subscription plan for the buyer to pay and subscribe.
For more information, see [Subscription Plan Checkout](https://developer.squareup.com/docs/checkout-api/subscription-plan-checkout).
**Constraints**: *Maximum Length*: `255` | -| `redirectUrl` | `string \| null \| undefined` | Optional | The confirmation page URL to redirect the buyer to after Square processes the payment.
**Constraints**: *Maximum Length*: `2048` | -| `merchantSupportEmail` | `string \| null \| undefined` | Optional | The email address that buyers can use to contact the seller.
**Constraints**: *Maximum Length*: `256` | -| `askForShippingAddress` | `boolean \| null \| undefined` | Optional | Indicates whether to include the address fields in the payment form. | -| `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 \| null \| 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 \| null \| 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) - -```json -{ - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id0", - "redirect_url": "redirect_url4", - "merchant_support_email": "merchant_support_email0" -} -``` - diff --git a/doc/models/checkout.md b/doc/models/checkout.md deleted file mode 100644 index aa4e63075..000000000 --- a/doc/models/checkout.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Checkout - -Square Checkout lets merchants accept online payments for supported -payment types using a checkout workflow hosted on squareup.com. - -## Structure - -`Checkout` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | ID generated by Square Checkout when a new checkout is requested. | -| `checkoutPageUrl` | `string \| null \| undefined` | Optional | The URL that the buyer's browser should be redirected to after the
checkout is completed. | -| `askForShippingAddress` | `boolean \| null \| undefined` | Optional | If `true`, Square Checkout will collect shipping information on your
behalf and store that information with the transaction information in your
Square Dashboard.

Default: `false`. | -| `merchantSupportEmail` | `string \| null \| undefined` | Optional | The email address to display on the Square Checkout confirmation page
and confirmation email that the buyer can use to contact the merchant.

If this value is not set, the confirmation page and email will display the
primary email address associated with the merchant's Square account.

Default: none; only exists if explicitly set. | -| `prePopulateBuyerEmail` | `string \| null \| undefined` | Optional | If provided, the buyer's email is pre-populated on the checkout page
as an editable text field.

Default: none; only exists if explicitly set. | -| `prePopulateShippingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `redirectUrl` | `string \| null \| undefined` | Optional | The URL to redirect to after checkout is completed with `checkoutId`,
Square's `orderId`, `transactionId`, and `referenceId` appended as URL
parameters. For example, if the provided redirect_url is
`http://www.example.com/order-complete`, a successful transaction redirects
the customer to:

http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx

If you do not provide a redirect URL, Square Checkout will display an order
confirmation page on your behalf; however Square strongly recommends that
you provide a redirect URL so you can verify the transaction results and
finalize the order through your existing/normal confirmation workflow. | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `createdAt` | `string \| undefined` | Optional | The time when the checkout was created, in RFC 3339 format. | -| `additionalRecipients` | [`AdditionalRecipient[] \| null \| undefined`](../../doc/models/additional-recipient.md) | Optional | Additional recipients (other than the merchant) receiving a portion of this checkout.
For example, fees assessed on the purchase by a third party integration. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "checkout_page_url": "checkout_page_url4", - "ask_for_shipping_address": false, - "merchant_support_email": "merchant_support_email8", - "pre_populate_buyer_email": "pre_populate_buyer_email2" -} -``` - diff --git a/doc/models/clearpay-details.md b/doc/models/clearpay-details.md deleted file mode 100644 index 5f7242740..000000000 --- a/doc/models/clearpay-details.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Clearpay Details - -Additional details about Clearpay payments. - -## Structure - -`ClearpayDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `emailAddress` | `string \| null \| undefined` | Optional | Email address on the buyer's Clearpay account.
**Constraints**: *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "email_address": "email_address6" -} -``` - diff --git a/doc/models/clone-order-request.md b/doc/models/clone-order-request.md deleted file mode 100644 index cd967a3bf..000000000 --- a/doc/models/clone-order-request.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Clone Order Request - -Defines the fields that are included in requests to the -[CloneOrder](../../doc/api/orders.md#clone-order) endpoint. - -## Structure - -`CloneOrderRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Required | The ID of the order to clone. | -| `version` | `number \| undefined` | Optional | An optional order version for concurrency protection.

If a version is provided, it must match the latest stored version of the order to clone.
If a version is not provided, the API clones the latest version. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A value you specify that uniquely identifies this clone request.

If you are unsure whether a particular order was cloned successfully,
you can reattempt the call with the same idempotency key without
worrying about creating duplicate cloned orders.
The originally cloned order is returned.

For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). | - -## Example (as JSON) - -```json -{ - "idempotency_key": "UNIQUE_STRING", - "order_id": "ZAISEM52YcpmcWAzERDOyiWS123", - "version": 3 -} -``` - diff --git a/doc/models/clone-order-response.md b/doc/models/clone-order-response.md deleted file mode 100644 index a1acf1a7f..000000000 --- a/doc/models/clone-order-response.md +++ /dev/null @@ -1,333 +0,0 @@ - -# Clone Order Response - -Defines the fields that are included in the response body of -a request to the [CloneOrder](../../doc/api/orders.md#clone-order) endpoint. - -## Structure - -`CloneOrderResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "order": { - "created_at": "2020-01-17T20:47:53.293Z", - "discounts": [ - { - "applied_money": { - "amount": 30, - "currency": "USD" - }, - "catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7", - "name": "Membership Discount", - "percentage": "0.5", - "scope": "ORDER", - "type": "FIXED_PERCENTAGE", - "uid": "membership-discount" - }, - { - "applied_money": { - "amount": 303, - "currency": "USD" - }, - "name": "Labor Day Sale", - "percentage": "5", - "scope": "ORDER", - "type": "FIXED_PERCENTAGE", - "uid": "labor-day-sale" - }, - { - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "applied_money": { - "amount": 100, - "currency": "USD" - }, - "name": "Sale - $1.00 off", - "scope": "LINE_ITEM", - "type": "FIXED_AMOUNT", - "uid": "one-dollar-off" - } - ], - "id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "line_items": [ - { - "applied_discounts": [ - { - "applied_money": { - "amount": 8, - "currency": "USD" - }, - "discount_uid": "membership-discount", - "uid": "jWdgP1TpHPFBuVrz81mXVC" - }, - { - "applied_money": { - "amount": 79, - "currency": "USD" - }, - "discount_uid": "labor-day-sale", - "uid": "jnZOjjVY57eRcQAVgEwFuC" - } - ], - "applied_taxes": [ - { - "applied_money": { - "amount": 136, - "currency": "USD" - }, - "tax_uid": "state-sales-tax", - "uid": "aKG87ArnDpvMLSZJHxWUl" - } - ], - "base_price_money": { - "amount": 1599, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 1599, - "currency": "USD" - }, - "name": "New York Strip Steak", - "quantity": "1", - "total_discount_money": { - "amount": 87, - "currency": "USD" - }, - "total_money": { - "amount": 1648, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 136, - "currency": "USD" - }, - "uid": "8uSwfzvUImn3IRrvciqlXC", - "variation_total_price_money": { - "amount": 1599, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "applied_discounts": [ - { - "applied_money": { - "amount": 22, - "currency": "USD" - }, - "discount_uid": "membership-discount", - "uid": "nUXvdsIItfKko0dbYtY58C" - }, - { - "applied_money": { - "amount": 224, - "currency": "USD" - }, - "discount_uid": "labor-day-sale", - "uid": "qSdkOOOernlVQqsJ94SPjB" - }, - { - "applied_money": { - "amount": 100, - "currency": "USD" - }, - "discount_uid": "one-dollar-off", - "uid": "y7bVl4njrWAnfDwmz19izB" - } - ], - "applied_taxes": [ - { - "applied_money": { - "amount": 374, - "currency": "USD" - }, - "tax_uid": "state-sales-tax", - "uid": "v1dAgrfUVUPTnVTf9sRPz" - } - ], - "base_price_money": { - "amount": 2200, - "currency": "USD" - }, - "catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB", - "gross_sales_money": { - "amount": 4500, - "currency": "USD" - }, - "modifiers": [ - { - "base_price_money": { - "amount": 50, - "currency": "USD" - }, - "catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ", - "name": "Well", - "total_price_money": { - "amount": 100, - "currency": "USD" - }, - "uid": "Lo3qMMckDluu9Qsb58d4CC" - } - ], - "name": "New York Steak", - "quantity": "2", - "total_discount_money": { - "amount": 346, - "currency": "USD" - }, - "total_money": { - "amount": 4528, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 374, - "currency": "USD" - }, - "uid": "v8ZuEXpOJpb0bazLuvrLDB", - "variation_name": "Larger", - "variation_total_price_money": { - "amount": 4400, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4" - } - ], - "location_id": "057P5VYJ4A5X1", - "net_amounts": { - "discount_money": { - "amount": 433, - "currency": "USD" - }, - "service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "tax_money": { - "amount": 510, - "currency": "USD" - }, - "tip_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 6176, - "currency": "USD" - } - }, - "reference_id": "my-order-001", - "source": { - "name": "My App" - }, - "state": "DRAFT", - "taxes": [ - { - "applied_money": { - "amount": 510, - "currency": "USD" - }, - "name": "State Sales Tax", - "percentage": "9", - "scope": "ORDER", - "type": "ADDITIVE", - "uid": "state-sales-tax" - } - ], - "total_discount_money": { - "amount": 433, - "currency": "USD" - }, - "total_money": { - "amount": 6176, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 510, - "currency": "USD" - }, - "total_tip_money": { - "amount": 0, - "currency": "USD" - }, - "updated_at": "2020-01-17T20:47:53.293Z", - "version": 1, - "customer_id": "customer_id4" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/collected-data.md b/doc/models/collected-data.md deleted file mode 100644 index 7cda133f0..000000000 --- a/doc/models/collected-data.md +++ /dev/null @@ -1,21 +0,0 @@ - -# 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/complete-payment-request.md b/doc/models/complete-payment-request.md deleted file mode 100644 index 14234ddd6..000000000 --- a/doc/models/complete-payment-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Complete Payment Request - -Describes a request to complete (capture) a payment using -[CompletePayment](../../doc/api/payments.md#complete-payment). - -By default, payments are set to `autocomplete` immediately after they are created. -To complete payments manually, set `autocomplete` to `false`. - -## Structure - -`CompletePaymentRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `versionToken` | `string \| null \| undefined` | Optional | Used for optimistic concurrency. This opaque token identifies the current `Payment`
version that the caller expects. If the server has a different version of the Payment,
the update fails and a response with a VERSION_MISMATCH error is returned. | - -## Example (as JSON) - -```json -{ - "version_token": "version_token8" -} -``` - diff --git a/doc/models/complete-payment-response.md b/doc/models/complete-payment-response.md deleted file mode 100644 index 13962cbf3..000000000 --- a/doc/models/complete-payment-response.md +++ /dev/null @@ -1,107 +0,0 @@ - -# Complete Payment Response - -Defines the response returned by[CompletePayment](../../doc/api/payments.md#complete-payment). - -## Structure - -`CompletePaymentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `payment` | [`Payment \| undefined`](../../doc/models/payment.md) | Optional | Represents a payment processed by the Square API. | - -## Example (as JSON) - -```json -{ - "payment": { - "amount_money": { - "amount": 555, - "currency": "USD" - }, - "application_details": { - "application_id": "sq0ids-Pw67AZAlLVB7hsRmwlJPuA", - "square_product": "VIRTUAL_TERMINAL" - }, - "approved_money": { - "amount": 555, - "currency": "USD" - }, - "card_details": { - "auth_result_code": "2Nkw7q", - "avs_status": "AVS_ACCEPTED", - "card": { - "bin": "411111", - "card_brand": "VISA", - "card_type": "DEBIT", - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", - "last_4": "1111", - "prepaid_type": "NOT_PREPAID" - }, - "card_payment_timeline": { - "authorized_at": "2021-10-13T19:34:33.680Z", - "captured_at": "2021-10-13T19:34:34.340Z" - }, - "cvv_status": "CVV_ACCEPTED", - "entry_method": "KEYED", - "statement_description": "SQ *EXAMPLE TEST GOSQ.C", - "status": "CAPTURED" - }, - "created_at": "2021-10-13T19:34:33.524Z", - "delay_action": "CANCEL", - "delay_duration": "PT168H", - "delayed_until": "2021-10-20T19:34:33.524Z", - "employee_id": "TMoK_ogh6rH1o4dV", - "id": "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", - "location_id": "L88917AVBK2S5", - "note": "Test Note", - "order_id": "d7eKah653Z579f3gVtjlxpSlmUcZY", - "processing_fee": [ - { - "amount_money": { - "amount": 34, - "currency": "USD" - }, - "effective_at": "2021-10-13T21:34:35.000Z", - "type": "INITIAL" - } - ], - "receipt_number": "bP9m", - "receipt_url": "https://squareup.com/receipt/preview/bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", - "source_type": "CARD", - "status": "COMPLETED", - "team_member_id": "TMoK_ogh6rH1o4dV", - "total_money": { - "amount": 555, - "currency": "USD" - }, - "updated_at": "2021-10-13T19:34:34.339Z", - "version_token": "56pRkL3slrzet2iQrTp9n0bdJVYTB9YEWdTNjQfZOPV6o", - "tip_money": { - "amount": 190, - "currency": "TWD" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/component-component-type.md b/doc/models/component-component-type.md deleted file mode 100644 index 3619b08ea..000000000 --- a/doc/models/component-component-type.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Component Component Type - -An enum for ComponentType. - -## Enumeration - -`ComponentComponentType` - -## Fields - -| Name | -| --- | -| `APPLICATION` | -| `CARD_READER` | -| `BATTERY` | -| `WIFI` | -| `ETHERNET` | -| `PRINTER` | - diff --git a/doc/models/component.md b/doc/models/component.md deleted file mode 100644 index feabdb13b..000000000 --- a/doc/models/component.md +++ /dev/null @@ -1,54 +0,0 @@ - -# Component - -The wrapper object for the component entries of a given component type. - -## Structure - -`Component` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string`](../../doc/models/component-component-type.md) | Required | An enum for ComponentType. | -| `applicationDetails` | [`DeviceComponentDetailsApplicationDetails \| undefined`](../../doc/models/device-component-details-application-details.md) | Optional | - | -| `cardReaderDetails` | [`DeviceComponentDetailsCardReaderDetails \| undefined`](../../doc/models/device-component-details-card-reader-details.md) | Optional | - | -| `batteryDetails` | [`DeviceComponentDetailsBatteryDetails \| undefined`](../../doc/models/device-component-details-battery-details.md) | Optional | - | -| `wifiDetails` | [`DeviceComponentDetailsWiFiDetails \| undefined`](../../doc/models/device-component-details-wi-fi-details.md) | Optional | - | -| `ethernetDetails` | [`DeviceComponentDetailsEthernetDetails \| undefined`](../../doc/models/device-component-details-ethernet-details.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "type": "BATTERY", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } -} -``` - diff --git a/doc/models/confirmation-decision.md b/doc/models/confirmation-decision.md deleted file mode 100644 index 357eb84f8..000000000 --- a/doc/models/confirmation-decision.md +++ /dev/null @@ -1,21 +0,0 @@ - -# 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 deleted file mode 100644 index 8553d3193..000000000 --- a/doc/models/confirmation-options.md +++ /dev/null @@ -1,31 +0,0 @@ - -# 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 \| null \| 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": "title0", - "body": "body0", - "agree_button_text": "agree_button_text8", - "disagree_button_text": "disagree_button_text8", - "decision": { - "has_agreed": false - } -} -``` - diff --git a/doc/models/coordinates.md b/doc/models/coordinates.md deleted file mode 100644 index a0691f385..000000000 --- a/doc/models/coordinates.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Coordinates - -Latitude and longitude coordinates. - -## Structure - -`Coordinates` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `latitude` | `number \| null \| undefined` | Optional | The latitude of the coordinate expressed in degrees. | -| `longitude` | `number \| null \| undefined` | Optional | The longitude of the coordinate expressed in degrees. | - -## Example (as JSON) - -```json -{ - "latitude": 200.94, - "longitude": 52.86 -} -``` - diff --git a/doc/models/country.md b/doc/models/country.md deleted file mode 100644 index 39422596f..000000000 --- a/doc/models/country.md +++ /dev/null @@ -1,265 +0,0 @@ - -# Country - -Indicates the country associated with another entity, such as a business. -Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). - -## Enumeration - -`Country` - -## Fields - -| Name | Description | -| --- | --- | -| `ZZ` | Unknown | -| `AD` | Andorra | -| `AE` | United Arab Emirates | -| `AF` | Afghanistan | -| `AG` | Antigua and Barbuda | -| `AI` | Anguilla | -| `AL` | Albania | -| `AM` | Armenia | -| `AO` | Angola | -| `AQ` | Antartica | -| `AR` | Argentina | -| `AS` | American Samoa | -| `AT` | Austria | -| `AU` | Australia | -| `AW` | Aruba | -| `AX` | Åland Islands | -| `AZ` | Azerbaijan | -| `BA` | Bosnia and Herzegovina | -| `BB` | Barbados | -| `BD` | Bangladesh | -| `BE` | Belgium | -| `BF` | Burkina Faso | -| `BG` | Bulgaria | -| `BH` | Bahrain | -| `BI` | Burundi | -| `BJ` | Benin | -| `BL` | Saint Barthélemy | -| `BM` | Bermuda | -| `BN` | Brunei | -| `BO` | Bolivia | -| `BQ` | Bonaire | -| `BR` | Brazil | -| `BS` | Bahamas | -| `BT` | Bhutan | -| `BV` | Bouvet Island | -| `BW` | Botswana | -| `BY` | Belarus | -| `BZ` | Belize | -| `CA` | Canada | -| `CC` | Cocos Islands | -| `CD` | Democratic Republic of the Congo | -| `CF` | Central African Republic | -| `CG` | Congo | -| `CH` | Switzerland | -| `CI` | Ivory Coast | -| `CK` | Cook Islands | -| `CL` | Chile | -| `CM` | Cameroon | -| `CN` | China | -| `CO` | Colombia | -| `CR` | Costa Rica | -| `CU` | Cuba | -| `CV` | Cabo Verde | -| `CW` | Curaçao | -| `CX` | Christmas Island | -| `CY` | Cyprus | -| `CZ` | Czechia | -| `DE` | Germany | -| `DJ` | Djibouti | -| `DK` | Denmark | -| `DM` | Dominica | -| `DO` | Dominican Republic | -| `DZ` | Algeria | -| `EC` | Ecuador | -| `EE` | Estonia | -| `EG` | Egypt | -| `EH` | Western Sahara | -| `ER` | Eritrea | -| `ES` | Spain | -| `ET` | Ethiopia | -| `FI` | Finland | -| `FJ` | Fiji | -| `FK` | Falkland Islands | -| `FM` | Federated States of Micronesia | -| `FO` | Faroe Islands | -| `FR` | France | -| `GA` | Gabon | -| `GB` | United Kingdom | -| `GD` | Grenada | -| `GE` | Georgia | -| `GF` | French Guiana | -| `GG` | Guernsey | -| `GH` | Ghana | -| `GI` | Gibraltar | -| `GL` | Greenland | -| `GM` | Gambia | -| `GN` | Guinea | -| `GP` | Guadeloupe | -| `GQ` | Equatorial Guinea | -| `GR` | Greece | -| `GS` | South Georgia and the South Sandwich Islands | -| `GT` | Guatemala | -| `GU` | Guam | -| `GW` | Guinea-Bissau | -| `GY` | Guyana | -| `HK` | Hong Kong | -| `HM` | Heard Island and McDonald Islands | -| `HN` | Honduras | -| `HR` | Croatia | -| `HT` | Haiti | -| `HU` | Hungary | -| `ID` | Indonesia | -| `IE` | Ireland | -| `IL` | Israel | -| `IM` | Isle of Man | -| `IN` | India | -| `IO` | British Indian Ocean Territory | -| `IQ` | Iraq | -| `IR` | Iran | -| `IS` | Iceland | -| `IT` | Italy | -| `JE` | Jersey | -| `JM` | Jamaica | -| `JO` | Jordan | -| `JP` | Japan | -| `KE` | Kenya | -| `KG` | Kyrgyzstan | -| `KH` | Cambodia | -| `KI` | Kiribati | -| `KM` | Comoros | -| `KN` | Saint Kitts and Nevis | -| `KP` | Democratic People's Republic of Korea | -| `KR` | Republic of Korea | -| `KW` | Kuwait | -| `KY` | Cayman Islands | -| `KZ` | Kazakhstan | -| `LA` | Lao People's Democratic Republic | -| `LB` | Lebanon | -| `LC` | Saint Lucia | -| `LI` | Liechtenstein | -| `LK` | Sri Lanka | -| `LR` | Liberia | -| `LS` | Lesotho | -| `LT` | Lithuania | -| `LU` | Luxembourg | -| `LV` | Latvia | -| `LY` | Libya | -| `MA` | Morocco | -| `MC` | Monaco | -| `MD` | Moldova | -| `ME` | Montenegro | -| `MF` | Saint Martin | -| `MG` | Madagascar | -| `MH` | Marshall Islands | -| `MK` | North Macedonia | -| `ML` | Mali | -| `MM` | Myanmar | -| `MN` | Mongolia | -| `MO` | Macao | -| `MP` | Northern Mariana Islands | -| `MQ` | Martinique | -| `MR` | Mauritania | -| `MS` | Montserrat | -| `MT` | Malta | -| `MU` | Mauritius | -| `MV` | Maldives | -| `MW` | Malawi | -| `MX` | Mexico | -| `MY` | Malaysia | -| `MZ` | Mozambique | -| `NA` | Namibia | -| `NC` | New Caledonia | -| `NE` | Niger | -| `NF` | Norfolk Island | -| `NG` | Nigeria | -| `NI` | Nicaragua | -| `NL` | Netherlands | -| `NO` | Norway | -| `NP` | Nepal | -| `NR` | Nauru | -| `NU` | Niue | -| `NZ` | New Zealand | -| `OM` | Oman | -| `PA` | Panama | -| `PE` | Peru | -| `PF` | French Polynesia | -| `PG` | Papua New Guinea | -| `PH` | Philippines | -| `PK` | Pakistan | -| `PL` | Poland | -| `PM` | Saint Pierre and Miquelon | -| `PN` | Pitcairn | -| `PR` | Puerto Rico | -| `PS` | Palestine | -| `PT` | Portugal | -| `PW` | Palau | -| `PY` | Paraguay | -| `QA` | Qatar | -| `RE` | Réunion | -| `RO` | Romania | -| `RS` | Serbia | -| `RU` | Russia | -| `RW` | Rwanda | -| `SA` | Saudi Arabia | -| `SB` | Solomon Islands | -| `SC` | Seychelles | -| `SD` | Sudan | -| `SE` | Sweden | -| `SG` | Singapore | -| `SH` | Saint Helena, Ascension and Tristan da Cunha | -| `SI` | Slovenia | -| `SJ` | Svalbard and Jan Mayen | -| `SK` | Slovakia | -| `SL` | Sierra Leone | -| `SM` | San Marino | -| `SN` | Senegal | -| `SO` | Somalia | -| `SR` | Suriname | -| `SS` | South Sudan | -| `ST` | Sao Tome and Principe | -| `SV` | El Salvador | -| `SX` | Sint Maarten | -| `SY` | Syrian Arab Republic | -| `SZ` | Eswatini | -| `TC` | Turks and Caicos Islands | -| `TD` | Chad | -| `TF` | French Southern Territories | -| `TG` | Togo | -| `TH` | Thailand | -| `TJ` | Tajikistan | -| `TK` | Tokelau | -| `TL` | Timor-Leste | -| `TM` | Turkmenistan | -| `TN` | Tunisia | -| `TO` | Tonga | -| `TR` | Turkey | -| `TT` | Trinidad and Tobago | -| `TV` | Tuvalu | -| `TW` | Taiwan | -| `TZ` | Tanzania | -| `UA` | Ukraine | -| `UG` | Uganda | -| `UM` | United States Minor Outlying Islands | -| `US` | United States of America | -| `UY` | Uruguay | -| `UZ` | Uzbekistan | -| `VA` | Vatican City | -| `VC` | Saint Vincent and the Grenadines | -| `VE` | Venezuela | -| `VG` | British Virgin Islands | -| `VI` | U.S. Virgin Islands | -| `VN` | Vietnam | -| `VU` | Vanuatu | -| `WF` | Wallis and Futuna | -| `WS` | Samoa | -| `YE` | Yemen | -| `YT` | Mayotte | -| `ZA` | South Africa | -| `ZM` | Zambia | -| `ZW` | Zimbabwe | - diff --git a/doc/models/create-booking-custom-attribute-definition-request.md b/doc/models/create-booking-custom-attribute-definition-request.md deleted file mode 100644 index 9d791c6a5..000000000 --- a/doc/models/create-booking-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Create Booking Custom Attribute Definition Request - -Represents a [CreateBookingCustomAttributeDefinition](../../doc/api/booking-custom-attributes.md#create-booking-custom-attribute-definition) request. - -## Structure - -`CreateBookingCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "key": "key2", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name2", - "description": "description8", - "visibility": "VISIBILITY_HIDDEN" - }, - "idempotency_key": "idempotency_key6" -} -``` - diff --git a/doc/models/create-booking-custom-attribute-definition-response.md b/doc/models/create-booking-custom-attribute-definition-response.md deleted file mode 100644 index 5dcc36523..000000000 --- a/doc/models/create-booking-custom-attribute-definition-response.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Create Booking Custom Attribute Definition Response - -Represents a [CreateBookingCustomAttributeDefinition](../../doc/api/booking-custom-attributes.md#create-booking-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`CreateBookingCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-11-16T15:27:30Z", - "description": "The favorite shampoo of the customer.", - "key": "favoriteShampoo", - "name": "Favorite Shampoo", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T15:27:30Z", - "version": 1, - "visibility": "VISIBILITY_HIDDEN" - }, - "errors": [] -} -``` - diff --git a/doc/models/create-booking-request.md b/doc/models/create-booking-request.md deleted file mode 100644 index 1eb1778ed..000000000 --- a/doc/models/create-booking-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Create Booking Request - -## Structure - -`CreateBookingRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | A unique key to make this request an idempotent operation.
**Constraints**: *Maximum Length*: `255` | -| `booking` | [`Booking`](../../doc/models/booking.md) | Required | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "idempotency_key4", - "booking": { - "id": "id4", - "version": 156, - "status": "CANCELLED_BY_SELLER", - "created_at": "created_at2", - "updated_at": "updated_at0" - } -} -``` - diff --git a/doc/models/create-booking-response.md b/doc/models/create-booking-response.md deleted file mode 100644 index 8c1d3ee9c..000000000 --- a/doc/models/create-booking-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Create Booking Response - -## Structure - -`CreateBookingResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `booking` | [`Booking \| undefined`](../../doc/models/booking.md) | Optional | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "booking": { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t" - } - ], - "created_at": "2020-10-28T15:47:41Z", - "customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M", - "customer_note": "", - "id": "zkras0xv0xwswx", - "location_id": "LEQHH0YY8B42M", - "seller_note": "", - "start_at": "2020-11-26T13:00:00Z", - "status": "ACCEPTED", - "updated_at": "2020-10-28T15:47:41Z", - "version": 0 - }, - "errors": [] -} -``` - diff --git a/doc/models/create-break-type-request.md b/doc/models/create-break-type-request.md deleted file mode 100644 index f152e74ef..000000000 --- a/doc/models/create-break-type-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Create Break Type Request - -A request to create a new `BreakType`. - -## Structure - -`CreateBreakTypeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | A unique string value to ensure the idempotency of the operation.
**Constraints**: *Maximum Length*: `128` | -| `breakType` | [`BreakType`](../../doc/models/break-type.md) | Required | A defined break template that sets an expectation for possible `Break`
instances on a `Shift`. | - -## Example (as JSON) - -```json -{ - "break_type": { - "break_name": "Lunch Break", - "expected_duration": "PT30M", - "is_paid": true, - "location_id": "CGJN03P1D08GF", - "id": "id8", - "version": 132, - "created_at": "created_at6", - "updated_at": "updated_at4" - }, - "idempotency_key": "PAD3NG5KSN2GL" -} -``` - diff --git a/doc/models/create-break-type-response.md b/doc/models/create-break-type-response.md deleted file mode 100644 index d533f2773..000000000 --- a/doc/models/create-break-type-response.md +++ /dev/null @@ -1,55 +0,0 @@ - -# Create Break Type Response - -The response to the request to create a `BreakType`. The response contains -the created `BreakType` object and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`CreateBreakTypeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `breakType` | [`BreakType \| undefined`](../../doc/models/break-type.md) | Optional | A defined break template that sets an expectation for possible `Break`
instances on a `Shift`. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "break_type": { - "break_name": "Lunch Break", - "created_at": "2019-02-26T22:42:54Z", - "expected_duration": "PT30M", - "id": "49SSVDJG76WF3", - "is_paid": true, - "location_id": "CGJN03P1D08GF", - "updated_at": "2019-02-26T22:42:54Z", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-card-request.md b/doc/models/create-card-request.md deleted file mode 100644 index c806aef5b..000000000 --- a/doc/models/create-card-request.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Create Card Request - -Creates a card from the source (payment token or payment id). Accessible via -HTTP requests at POST https://connect.squareup.com/v2/cards - -## Structure - -`CreateCardRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this CreateCard request. Keys can be
any valid string and must be unique for every request.

Max: 45 characters

See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
**Constraints**: *Minimum Length*: `1` | -| `sourceId` | `string` | Required | The ID of the source which represents the card information to be stored. This can be a card nonce or a payment id.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `16384` | -| `verificationToken` | `string \| undefined` | Optional | An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
Verification tokens encapsulate customer device information and 3-D Secure
challenge results to indicate that Square has verified the buyer identity.

See the [SCA Overview](https://developer.squareup.com/docs/sca-overview). | -| `card` | [`Card`](../../doc/models/card.md) | Required | Represents the payment details of a card to be used for payments. These
details are determined by the payment token generated by Web Payments SDK. | - -## Example (as JSON) - -```json -{ - "card": { - "billing_address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "cardholder_name": "Amelia Earhart", - "customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8", - "reference_id": "user-id-1", - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "idempotency_key": "4935a656-a929-4792-b97c-8848be85c27c", - "source_id": "cnon:uIbfJXhXETSP197M3GB", - "verification_token": "verification_token4" -} -``` - diff --git a/doc/models/create-card-response.md b/doc/models/create-card-response.md deleted file mode 100644 index 343fabd19..000000000 --- a/doc/models/create-card-response.md +++ /dev/null @@ -1,72 +0,0 @@ - -# Create Card Response - -Defines the fields that are included in the response body of -a request to the [CreateCard](../../doc/api/cards.md#create-card) endpoint. - -Note: if there are errors processing the request, the card field will not be -present. - -## Structure - -`CreateCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors resulting from the request. | -| `card` | [`Card \| undefined`](../../doc/models/card.md) | Optional | Represents the payment details of a card to be used for payments. These
details are determined by the payment token generated by Web Payments SDK. | - -## Example (as JSON) - -```json -{ - "card": { - "billing_address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "bin": "411111", - "card_brand": "VISA", - "card_type": "CREDIT", - "cardholder_name": "Amelia Earhart", - "customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8", - "enabled": true, - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", - "id": "ccof:uIbfJXhXETSP197M3GB", - "last_4": "1111", - "merchant_id": "6SSW7HV8K2ST5", - "prepaid_type": "NOT_PREPAID", - "reference_id": "user-id-1", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-catalog-image-request.md b/doc/models/create-catalog-image-request.md deleted file mode 100644 index 07b1ed2bb..000000000 --- a/doc/models/create-catalog-image-request.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Create Catalog Image Request - -## Structure - -`CreateCatalogImageRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this CreateCatalogImage request.
Keys can be any valid string but must be unique for every CreateCatalogImage request.

See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
**Constraints**: *Minimum Length*: `1` | -| `objectId` | `string \| undefined` | Optional | Unique ID of the `CatalogObject` to attach this `CatalogImage` object to. Leave this
field empty to create unattached images, for example if you are building an integration
where an image can be attached to catalog items at a later time. | -| `image` | [`CatalogObject`](../../doc/models/catalog-object.md) | Required | The wrapper object for the catalog entries of a given object type.

Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.

For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.

In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.

For a more detailed discussion of the Catalog data model, please see the
[Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. | -| `isPrimary` | `boolean \| undefined` | Optional | If this is set to `true`, the image created will be the primary, or first image of the object referenced by `object_id`.
If the `CatalogObject` already has a primary `CatalogImage`, setting this field to `true` will replace the primary image.
If this is set to `false` and you use the Square API version 2021-12-15 or later, the image id will be appended to the list of `image_ids` on the object.

With Square API version 2021-12-15 or later, the default value is `false`. Otherwise, the effective default value is `true`. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "528dea59-7bfb-43c1-bd48-4a6bba7dd61f86", - "image": { - "id": "#TEMP_ID", - "image_data": { - "caption": "A picture of a cup of coffee" - }, - "type": "IMAGE", - "updated_at": "updated_at2", - "version": 100, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - "object_id": "ND6EA5AAJEO5WL3JNNIAQA32", - "is_primary": false -} -``` - diff --git a/doc/models/create-catalog-image-response.md b/doc/models/create-catalog-image-response.md deleted file mode 100644 index 31b9abcb6..000000000 --- a/doc/models/create-catalog-image-response.md +++ /dev/null @@ -1,70 +0,0 @@ - -# Create Catalog Image Response - -## Structure - -`CreateCatalogImageResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `image` | [`CatalogObject \| undefined`](../../doc/models/catalog-object.md) | Optional | The wrapper object for the catalog entries of a given object type.

Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.

For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.

In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.

For a more detailed discussion of the Catalog data model, please see the
[Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. | - -## Example (as JSON) - -```json -{ - "image": { - "id": "KQLFFHA6K6J3YQAQAWDQAL57", - "image_data": { - "caption": "A picture of a cup of coffee", - "url": "https://..." - }, - "type": "IMAGE", - "updated_at": "updated_at2", - "version": 100, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-checkout-request.md b/doc/models/create-checkout-request.md deleted file mode 100644 index 2c7c74fe7..000000000 --- a/doc/models/create-checkout-request.md +++ /dev/null @@ -1,179 +0,0 @@ - -# Create Checkout Request - -Defines the parameters that can be included in the body of -a request to the `CreateCheckout` endpoint. - -## Structure - -`CreateCheckoutRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this checkout among others you have created. It can be
any valid string but must be unique for every order sent to Square Checkout for a given location ID.

The idempotency key is used to avoid processing the same order more than once. If you are
unsure whether a particular checkout was created successfully, you can attempt it again with
the same idempotency key and all the same other parameters without worrying about creating duplicates.

You should use a random number/string generator native to the language
you are working in to generate strings for your idempotency keys.

For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `192` | -| `order` | [`CreateOrderRequest`](../../doc/models/create-order-request.md) | Required | - | -| `askForShippingAddress` | `boolean \| undefined` | Optional | If `true`, Square Checkout collects shipping information on your behalf and stores
that information with the transaction information in the Square Seller Dashboard.

Default: `false`. | -| `merchantSupportEmail` | `string \| undefined` | Optional | The email address to display on the Square Checkout confirmation page
and confirmation email that the buyer can use to contact the seller.

If this value is not set, the confirmation page and email display the
primary email address associated with the seller's Square account.

Default: none; only exists if explicitly set.
**Constraints**: *Maximum Length*: `254` | -| `prePopulateBuyerEmail` | `string \| undefined` | Optional | If provided, the buyer's email is prepopulated on the checkout page
as an editable text field.

Default: none; only exists if explicitly set.
**Constraints**: *Maximum Length*: `254` | -| `prePopulateShippingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `redirectUrl` | `string \| undefined` | Optional | The URL to redirect to after the checkout is completed with `checkoutId`,
`transactionId`, and `referenceId` appended as URL parameters. For example,
if the provided redirect URL is `http://www.example.com/order-complete`, a
successful transaction redirects the customer to:

`http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx`

If you do not provide a redirect URL, Square Checkout displays an order
confirmation page on your behalf; however, it is strongly recommended that
you provide a redirect URL so you can verify the transaction results and
finalize the order through your existing/normal confirmation workflow.

Default: none; only exists if explicitly set.
**Constraints**: *Maximum Length*: `800` | -| `additionalRecipients` | [`ChargeRequestAdditionalRecipient[] \| undefined`](../../doc/models/charge-request-additional-recipient.md) | Optional | The basic primitive of a multi-party transaction. The value is optional.
The transaction facilitated by you can be split from here.

If you provide this value, the `amount_money` value in your `additional_recipients` field
cannot be more than 90% of the `total_money` calculated by Square for your order.
The `location_id` must be a valid seller location where the checkout is occurring.

This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission.

This field is currently not supported in the Square Sandbox. | -| `note` | `string \| undefined` | Optional | An optional note to associate with the `checkout` object.

This value cannot exceed 60 characters.
**Constraints**: *Maximum Length*: `60` | - -## Example (as JSON) - -```json -{ - "additional_recipients": [ - { - "amount_money": { - "amount": 60, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1" - } - ], - "ask_for_shipping_address": true, - "idempotency_key": "86ae1696-b1e3-4328-af6d-f1e04d947ad6", - "merchant_support_email": "merchant+support@website.com", - "order": { - "idempotency_key": "12ae1696-z1e3-4328-af6d-f1e04d947gd4", - "order": { - "customer_id": "customer_id", - "discounts": [ - { - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "scope": "LINE_ITEM", - "type": "FIXED_AMOUNT", - "uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4" - } - ], - "line_items": [ - { - "applied_discounts": [ - { - "discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4" - } - ], - "applied_taxes": [ - { - "tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3" - } - ], - "base_price_money": { - "amount": 1500, - "currency": "USD" - }, - "name": "Printed T Shirt", - "quantity": "2", - "uid": "uid8", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "base_price_money": { - "amount": 2500, - "currency": "USD" - }, - "name": "Slim Jeans", - "quantity": "1", - "uid": "uid8", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "base_price_money": { - "amount": 3500, - "currency": "USD" - }, - "name": "Woven Sweater", - "quantity": "3", - "uid": "uid8", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ], - "location_id": "location_id", - "reference_id": "reference_id", - "taxes": [ - { - "percentage": "7.75", - "scope": "LINE_ITEM", - "type": "INCLUSIVE", - "uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3" - } - ], - "id": "id6", - "source": { - "name": "name4" - } - } - }, - "pre_populate_buyer_email": "example@email.com", - "pre_populate_shipping_address": { - "address_line_1": "1455 Market St.", - "address_line_2": "Suite 600", - "administrative_district_level_1": "CA", - "country": "US", - "first_name": "Jane", - "last_name": "Doe", - "locality": "San Francisco", - "postal_code": "94103", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "redirect_url": "https://merchant.website.com/order-confirm" -} -``` - diff --git a/doc/models/create-checkout-response.md b/doc/models/create-checkout-response.md deleted file mode 100644 index 2a13ffae5..000000000 --- a/doc/models/create-checkout-response.md +++ /dev/null @@ -1,172 +0,0 @@ - -# Create Checkout Response - -Defines the fields that are included in the response body of -a request to the `CreateCheckout` endpoint. - -## Structure - -`CreateCheckoutResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `checkout` | [`Checkout \| undefined`](../../doc/models/checkout.md) | Optional | Square Checkout lets merchants accept online payments for supported
payment types using a checkout workflow hosted on squareup.com. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "checkout": { - "additional_recipients": [ - { - "amount_money": { - "amount": 60, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1" - } - ], - "ask_for_shipping_address": true, - "checkout_page_url": "https://connect.squareup.com/v2/checkout?c=CAISEHGimXh-C3RIT4og1a6u1qw&l=CYTKRM7R7JMV8", - "created_at": "2017-06-16T22:25:35Z", - "id": "CAISEHGimXh-C3RIT4og1a6u1qw", - "merchant_support_email": "merchant+support@website.com", - "order": { - "customer_id": "customer_id", - "discounts": [ - { - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "applied_money": { - "amount": 100, - "currency": "USD" - }, - "scope": "LINE_ITEM", - "type": "FIXED_AMOUNT", - "uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4" - } - ], - "line_items": [ - { - "applied_discounts": [ - { - "applied_money": { - "amount": 100, - "currency": "USD" - }, - "discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4" - } - ], - "applied_taxes": [ - { - "applied_money": { - "amount": 103, - "currency": "USD" - }, - "tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3" - } - ], - "base_price_money": { - "amount": 1500, - "currency": "USD" - }, - "name": "Printed T Shirt", - "quantity": "2", - "total_discount_money": { - "amount": 100, - "currency": "USD" - }, - "total_money": { - "amount": 1503, - "currency": "USD" - }, - "total_tax_money": { - "amount": 103, - "currency": "USD" - } - }, - { - "base_price_money": { - "amount": 2500, - "currency": "USD" - }, - "name": "Slim Jeans", - "quantity": "1", - "total_money": { - "amount": 2500, - "currency": "USD" - } - }, - { - "base_price_money": { - "amount": 3500, - "currency": "USD" - }, - "name": "Woven Sweater", - "quantity": "3", - "total_money": { - "amount": 10500, - "currency": "USD" - } - } - ], - "location_id": "location_id", - "reference_id": "reference_id", - "taxes": [ - { - "percentage": "7.75", - "scope": "LINE_ITEM", - "type": "INCLUSIVE", - "uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3" - } - ], - "total_discount_money": { - "amount": 100, - "currency": "USD" - }, - "total_money": { - "amount": 14503, - "currency": "USD" - }, - "total_tax_money": { - "amount": 103, - "currency": "USD" - } - }, - "pre_populate_buyer_email": "example@email.com", - "pre_populate_shipping_address": { - "address_line_1": "1455 Market St.", - "address_line_2": "Suite 600", - "administrative_district_level_1": "CA", - "country": "US", - "first_name": "Jane", - "last_name": "Doe", - "locality": "San Francisco", - "postal_code": "94103" - }, - "redirect_url": "https://merchant.website.com/order-confirm", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-customer-card-request.md b/doc/models/create-customer-card-request.md deleted file mode 100644 index 4790c2af3..000000000 --- a/doc/models/create-customer-card-request.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Create Customer Card Request - -Defines the fields that are included in the request body of a request -to the `CreateCustomerCard` endpoint. - -## Structure - -`CreateCustomerCardRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cardNonce` | `string` | Required | A card nonce representing the credit card to link to the customer.

Card nonces are generated by the Square payment form when customers enter
their card information. For more information, see
[Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment).

__NOTE:__ Card nonces generated by digital wallets (such as Apple Pay)
cannot be used to create a customer card. | -| `billingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `cardholderName` | `string \| undefined` | Optional | The full name printed on the credit card. | -| `verificationToken` | `string \| undefined` | Optional | An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
Verification tokens encapsulate customer device information and 3-D Secure
challenge results to indicate that Square has verified the buyer identity. | - -## Example (as JSON) - -```json -{ - "billing_address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003", - "address_line_3": "address_line_34", - "sublocality": "sublocality8" - }, - "card_nonce": "YOUR_CARD_NONCE", - "cardholder_name": "Amelia Earhart", - "verification_token": "verification_token0" -} -``` - diff --git a/doc/models/create-customer-card-response.md b/doc/models/create-customer-card-response.md deleted file mode 100644 index f5bfc9d1e..000000000 --- a/doc/models/create-customer-card-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Create Customer Card Response - -Defines the fields that are included in the response body of -a request to the `CreateCustomerCard` endpoint. - -Either `errors` or `card` is present in a given response (never both). - -## Structure - -`CreateCustomerCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `card` | [`Card \| undefined`](../../doc/models/card.md) | Optional | Represents the payment details of a card to be used for payments. These
details are determined by the payment token generated by Web Payments SDK. | - -## Example (as JSON) - -```json -{ - "card": { - "billing_address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "card_brand": "VISA", - "cardholder_name": "Amelia Earhart", - "exp_month": 11, - "exp_year": 2018, - "id": "icard-card_id", - "last_4": "1111" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-customer-custom-attribute-definition-request.md b/doc/models/create-customer-custom-attribute-definition-request.md deleted file mode 100644 index 73aaa8c7a..000000000 --- a/doc/models/create-customer-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Create Customer Custom Attribute Definition Request - -Represents a [CreateCustomerCustomAttributeDefinition](../../doc/api/customer-custom-attributes.md#create-customer-custom-attribute-definition) request. - -## Structure - -`CreateCustomerCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "description": "The favorite movie of the customer.", - "key": "favoritemovie", - "name": "Favorite Movie", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "visibility": "VISIBILITY_HIDDEN" - }, - "idempotency_key": "idempotency_key4" -} -``` - diff --git a/doc/models/create-customer-custom-attribute-definition-response.md b/doc/models/create-customer-custom-attribute-definition-response.md deleted file mode 100644 index 706a1b760..000000000 --- a/doc/models/create-customer-custom-attribute-definition-response.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Create Customer Custom Attribute Definition Response - -Represents a [CreateCustomerCustomAttributeDefinition](../../doc/api/customer-custom-attributes.md#create-customer-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`CreateCustomerCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-04-26T15:27:30Z", - "description": "The favorite movie of the customer.", - "key": "favoritemovie", - "name": "Favorite Movie", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-04-26T15:27:30Z", - "version": 1, - "visibility": "VISIBILITY_HIDDEN" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-customer-group-request.md b/doc/models/create-customer-group-request.md deleted file mode 100644 index 5eda7d66b..000000000 --- a/doc/models/create-customer-group-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Create Customer Group Request - -Defines the body parameters that can be included in a request to the -[CreateCustomerGroup](../../doc/api/customer-groups.md#create-customer-group) endpoint. - -## Structure - -`CreateCustomerGroupRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). | -| `group` | [`CustomerGroup`](../../doc/models/customer-group.md) | Required | Represents a group of customer profiles.

Customer groups can be created, be modified, and have their membership defined using
the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. | - -## Example (as JSON) - -```json -{ - "group": { - "name": "Loyal Customers", - "id": "id8", - "created_at": "created_at4", - "updated_at": "updated_at6" - }, - "idempotency_key": "idempotency_key0" -} -``` - diff --git a/doc/models/create-customer-group-response.md b/doc/models/create-customer-group-response.md deleted file mode 100644 index 9739506e0..000000000 --- a/doc/models/create-customer-group-response.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Create Customer Group Response - -Defines the fields that are included in the response body of -a request to the [CreateCustomerGroup](../../doc/api/customer-groups.md#create-customer-group) endpoint. - -Either `errors` or `group` is present in a given response (never both). - -## Structure - -`CreateCustomerGroupResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `group` | [`CustomerGroup \| undefined`](../../doc/models/customer-group.md) | Optional | Represents a group of customer profiles.

Customer groups can be created, be modified, and have their membership defined using
the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. | - -## Example (as JSON) - -```json -{ - "group": { - "created_at": "2020-04-13T21:54:57.863Z", - "id": "2TAT3CMH4Q0A9M87XJZED0WMR3", - "name": "Loyal Customers", - "updated_at": "2020-04-13T21:54:58Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-customer-request.md b/doc/models/create-customer-request.md deleted file mode 100644 index 8ca467771..000000000 --- a/doc/models/create-customer-request.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Create Customer Request - -Defines the body parameters that can be included in a request to the -`CreateCustomer` endpoint. - -## Structure - -`CreateCustomerRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | The idempotency key for the request. For more information, see
[Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). | -| `givenName` | `string \| undefined` | Optional | The given name (that is, the first name) associated with the customer profile.

The maximum length for this value is 300 characters. | -| `familyName` | `string \| undefined` | Optional | The family name (that is, the last name) associated with the customer profile.

The maximum length for this value is 300 characters. | -| `companyName` | `string \| undefined` | Optional | A business name associated with the customer profile.

The maximum length for this value is 500 characters. | -| `nickname` | `string \| undefined` | Optional | A nickname for the customer profile.

The maximum length for this value is 100 characters. | -| `emailAddress` | `string \| undefined` | Optional | The email address associated with the customer profile.

The maximum length for this value is 254 characters. | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `phoneNumber` | `string \| undefined` | Optional | The phone number associated with the customer profile. The phone number must be valid and can contain
9–16 digits, with an optional `+` prefix and country code. For more information, see
[Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). | -| `referenceId` | `string \| undefined` | Optional | An optional second ID used to associate the customer profile with an
entity in another system.

The maximum length for this value is 100 characters. | -| `note` | `string \| undefined` | Optional | A custom note associated with the customer profile. | -| `birthday` | `string \| undefined` | Optional | The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified. | -| `taxIds` | [`CustomerTaxIds \| undefined`](../../doc/models/customer-tax-ids.md) | Optional | Represents the tax ID associated with a [customer profile](../../doc/models/customer.md). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). | - -## Example (as JSON) - -```json -{ - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "note": "a customer", - "phone_number": "+1-212-555-4240", - "reference_id": "YOUR_REFERENCE_ID", - "idempotency_key": "idempotency_key4", - "company_name": "company_name4", - "nickname": "nickname4" -} -``` - diff --git a/doc/models/create-customer-response.md b/doc/models/create-customer-response.md deleted file mode 100644 index e2127068c..000000000 --- a/doc/models/create-customer-response.md +++ /dev/null @@ -1,68 +0,0 @@ - -# Create Customer Response - -Defines the fields that are included in the response body of -a request to the [CreateCustomer](../../doc/api/customers.md#create-customer) or -[BulkCreateCustomers](../../doc/api/customers.md#bulk-create-customers) endpoint. - -Either `errors` or `customer` is present in a given response (never both). - -## Structure - -`CreateCustomerResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `customer` | [`Customer \| undefined`](../../doc/models/customer.md) | Optional | Represents a Square customer profile in the Customer Directory of a Square seller. | - -## Example (as JSON) - -```json -{ - "customer": { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "created_at": "2016-03-23T20:21:54.859Z", - "creation_source": "THIRD_PARTY", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "note": "a customer", - "phone_number": "+1-212-555-4240", - "preferences": { - "email_unsubscribed": false - }, - "reference_id": "YOUR_REFERENCE_ID", - "updated_at": "2016-03-23T20:21:54.859Z", - "version": 0, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-device-code-request.md b/doc/models/create-device-code-request.md deleted file mode 100644 index af7ce9244..000000000 --- a/doc/models/create-device-code-request.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Create Device Code Request - -## Structure - -`CreateDeviceCodeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this CreateDeviceCode request. Keys can
be any valid string but must be unique for every CreateDeviceCode request.

See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | -| `deviceCode` | [`DeviceCode`](../../doc/models/device-code.md) | Required | - | - -## Example (as JSON) - -```json -{ - "device_code": { - "location_id": "B5E4484SHHNYH", - "name": "Counter 1", - "product_type": "TERMINAL_API", - "id": "id4", - "code": "code2", - "device_id": "device_id0" - }, - "idempotency_key": "01bb00a6-0c86-4770-94ed-f5fca973cd56" -} -``` - diff --git a/doc/models/create-device-code-response.md b/doc/models/create-device-code-response.md deleted file mode 100644 index cf4425137..000000000 --- a/doc/models/create-device-code-response.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Create Device Code Response - -## Structure - -`CreateDeviceCodeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `deviceCode` | [`DeviceCode \| undefined`](../../doc/models/device-code.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "device_code": { - "code": "EBCARJ", - "created_at": "2020-02-06T18:44:33.000Z", - "id": "B3Z6NAMYQSMTM", - "location_id": "B5E4484SHHNYH", - "name": "Counter 1", - "pair_by": "2020-02-06T18:49:33.000Z", - "product_type": "TERMINAL_API", - "status": "UNPAIRED", - "status_changed_at": "2020-02-06T18:44:33.000Z", - "device_id": "device_id0" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-dispute-evidence-file-request.md b/doc/models/create-dispute-evidence-file-request.md deleted file mode 100644 index 6af5fb252..000000000 --- a/doc/models/create-dispute-evidence-file-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Create Dispute Evidence File Request - -Defines the parameters for a `CreateDisputeEvidenceFile` request. - -## Structure - -`CreateDisputeEvidenceFileRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | -| `evidenceType` | [`string \| undefined`](../../doc/models/dispute-evidence-type.md) | Optional | The type of the dispute evidence. | -| `contentType` | `string \| undefined` | Optional | The MIME type of the uploaded file.
The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "idempotency_key8", - "evidence_type": "REBUTTAL_EXPLANATION", - "content_type": "content_type6" -} -``` - diff --git a/doc/models/create-dispute-evidence-file-response.md b/doc/models/create-dispute-evidence-file-response.md deleted file mode 100644 index fa449586d..000000000 --- a/doc/models/create-dispute-evidence-file-response.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Create Dispute Evidence File Response - -Defines the fields in a `CreateDisputeEvidenceFile` response. - -## Structure - -`CreateDisputeEvidenceFileResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `evidence` | [`DisputeEvidence \| undefined`](../../doc/models/dispute-evidence.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "evidence": { - "dispute_id": "bVTprrwk0gygTLZ96VX1oB", - "evidence_file": { - "filename": "customer-interaction.jpg", - "filetype": "image/jpeg" - }, - "id": "TOomLInj6iWmP3N8qfCXrB", - "uploaded_at": "2022-05-18T16:01:10.000Z", - "evidence_id": "evidence_id0", - "evidence_text": "evidence_text6" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-dispute-evidence-text-request.md b/doc/models/create-dispute-evidence-text-request.md deleted file mode 100644 index e6c8823e3..000000000 --- a/doc/models/create-dispute-evidence-text-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Create Dispute Evidence Text Request - -Defines the parameters for a `CreateDisputeEvidenceText` request. - -## Structure - -`CreateDisputeEvidenceTextRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | -| `evidenceType` | [`string \| undefined`](../../doc/models/dispute-evidence-type.md) | Optional | The type of the dispute evidence. | -| `evidenceText` | `string` | Required | The evidence string.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `500` | - -## Example (as JSON) - -```json -{ - "evidence_text": "1Z8888888888888888", - "evidence_type": "TRACKING_NUMBER", - "idempotency_key": "ed3ee3933d946f1514d505d173c82648" -} -``` - diff --git a/doc/models/create-dispute-evidence-text-response.md b/doc/models/create-dispute-evidence-text-response.md deleted file mode 100644 index 4ec3193c9..000000000 --- a/doc/models/create-dispute-evidence-text-response.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Create Dispute Evidence Text Response - -Defines the fields in a `CreateDisputeEvidenceText` response. - -## Structure - -`CreateDisputeEvidenceTextResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `evidence` | [`DisputeEvidence \| undefined`](../../doc/models/dispute-evidence.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "evidence": { - "dispute_id": "bVTprrwk0gygTLZ96VX1oB", - "evidence_text": "The customer purchased the item twice, on April 11 and April 28.", - "evidence_type": "REBUTTAL_EXPLANATION", - "id": "TOomLInj6iWmP3N8qfCXrB", - "uploaded_at": "2022-05-18T16:01:10.000Z", - "evidence_id": "evidence_id0", - "evidence_file": { - "filename": "filename8", - "filetype": "filetype8" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-gift-card-activity-request.md b/doc/models/create-gift-card-activity-request.md deleted file mode 100644 index f85bcc57b..000000000 --- a/doc/models/create-gift-card-activity-request.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Create Gift Card Activity Request - -A request to create a gift card activity. - -## Structure - -`CreateGiftCardActivityRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies the `CreateGiftCardActivity` request.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | -| `giftCardActivity` | [`GiftCardActivity`](../../doc/models/gift-card-activity.md) | Required | Represents an action performed on a [gift card](../../doc/models/gift-card.md) that affects its state or balance.
A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity
includes a `redeem_activity_details` field that contains information about the redemption. | - -## Example (as JSON) - -```json -{ - "gift_card_activity": { - "activate_activity_details": { - "line_item_uid": "eIWl7X0nMuO9Ewbh0ChIx", - "order_id": "jJNGHm4gLI6XkFbwtiSLqK72KkAZY" - }, - "gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20", - "location_id": "81FN9BNFZTKS4", - "type": "ACTIVATE", - "id": "id6", - "created_at": "created_at6", - "gift_card_gan": "gift_card_gan2", - "gift_card_balance_money": { - "amount": 82, - "currency": "IRR" - } - }, - "idempotency_key": "U16kfr-kA70er-q4Rsym-7U7NnY" -} -``` - diff --git a/doc/models/create-gift-card-activity-response.md b/doc/models/create-gift-card-activity-response.md deleted file mode 100644 index 3aef9d1f7..000000000 --- a/doc/models/create-gift-card-activity-response.md +++ /dev/null @@ -1,58 +0,0 @@ - -# Create Gift Card Activity Response - -A response that contains a `GiftCardActivity` that was created. -The response might contain a set of `Error` objects if the request resulted in errors. - -## Structure - -`CreateGiftCardActivityResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCardActivity` | [`GiftCardActivity \| undefined`](../../doc/models/gift-card-activity.md) | Optional | Represents an action performed on a [gift card](../../doc/models/gift-card.md) that affects its state or balance.
A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity
includes a `redeem_activity_details` field that contains information about the redemption. | - -## Example (as JSON) - -```json -{ - "gift_card_activity": { - "activate_activity_details": { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "line_item_uid": "eIWl7X0nMuO9Ewbh0ChIx", - "order_id": "jJNGHm4gLI6XkFbwtiSLqK72KkAZY" - }, - "created_at": "2021-05-20T22:26:54.000Z", - "gift_card_balance_money": { - "amount": 1000, - "currency": "USD" - }, - "gift_card_gan": "7783320002929081", - "gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20", - "id": "gcact_c8f8cbf1f24b448d8ecf39ed03f97864", - "location_id": "81FN9BNFZTKS4", - "type": "ACTIVATE" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-gift-card-request.md b/doc/models/create-gift-card-request.md deleted file mode 100644 index 9f5f0c774..000000000 --- a/doc/models/create-gift-card-request.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Create Gift Card Request - -Represents a [CreateGiftCard](../../doc/api/gift-cards.md#create-gift-card) request. - -## Structure - -`CreateGiftCardRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | -| `locationId` | `string` | Required | The ID of the [location](entity:Location) where the gift card should be registered for
reporting purposes. Gift cards can be redeemed at any of the seller's locations.
**Constraints**: *Minimum Length*: `1` | -| `giftCard` | [`GiftCard`](../../doc/models/gift-card.md) | Required | Represents a Square gift card. | - -## Example (as JSON) - -```json -{ - "gift_card": { - "type": "DIGITAL", - "id": "id0", - "gan_source": "SQUARE", - "state": "ACTIVE", - "balance_money": { - "amount": 146, - "currency": "BBD" - }, - "gan": "gan6" - }, - "idempotency_key": "NC9Tm69EjbjtConu", - "location_id": "81FN9BNFZTKS4" -} -``` - diff --git a/doc/models/create-gift-card-response.md b/doc/models/create-gift-card-response.md deleted file mode 100644 index 919cc2042..000000000 --- a/doc/models/create-gift-card-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Create Gift Card Response - -A response that contains a `GiftCard`. The response might contain a set of `Error` objects if the request -resulted in errors. - -## Structure - -`CreateGiftCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCard` | [`GiftCard \| undefined`](../../doc/models/gift-card.md) | Optional | Represents a Square gift card. | - -## Example (as JSON) - -```json -{ - "gift_card": { - "balance_money": { - "amount": 0, - "currency": "USD" - }, - "created_at": "2021-05-20T22:26:54.000Z", - "gan": "7783320006753271", - "gan_source": "SQUARE", - "id": "gftc:6cbacbb64cf54e2ca9f573d619038059", - "state": "PENDING", - "type": "DIGITAL" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-invoice-attachment-request.md b/doc/models/create-invoice-attachment-request.md deleted file mode 100644 index d3a4dbd41..000000000 --- a/doc/models/create-invoice-attachment-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Create Invoice Attachment Request - -Represents a [CreateInvoiceAttachment](../../doc/api/invoices.md#create-invoice-attachment) request. - -## Structure - -`CreateInvoiceAttachmentRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | A unique string that identifies the `CreateInvoiceAttachment` request.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `128` | -| `description` | `string \| undefined` | Optional | The description of the attachment to display on the invoice.
**Constraints**: *Maximum Length*: `128` | - -## Example (as JSON) - -```json -{ - "description": "Service contract", - "idempotency_key": "ae5e84f9-4742-4fc1-ba12-a3ce3748f1c3" -} -``` - diff --git a/doc/models/create-invoice-attachment-response.md b/doc/models/create-invoice-attachment-response.md deleted file mode 100644 index c7d0cbf56..000000000 --- a/doc/models/create-invoice-attachment-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# Create Invoice Attachment Response - -Represents a [CreateInvoiceAttachment](../../doc/api/invoices.md#create-invoice-attachment) response. - -## Structure - -`CreateInvoiceAttachmentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `attachment` | [`InvoiceAttachment \| undefined`](../../doc/models/invoice-attachment.md) | Optional | Represents a file attached to an [invoice](../../doc/models/invoice.md). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "attachment": { - "description": "Service contract", - "filename": "file.jpg", - "filesize": 102705, - "hash": "273ee02cb6f5f8a3a8ca23604930dd53", - "id": "inva:0-3bB9ZuDHiziThQhuC4fwWt", - "mime_type": "image/jpeg", - "uploaded_at": "2023-02-03T20:28:14Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-invoice-request.md b/doc/models/create-invoice-request.md deleted file mode 100644 index 7f095fde6..000000000 --- a/doc/models/create-invoice-request.md +++ /dev/null @@ -1,83 +0,0 @@ - -# Create Invoice Request - -Describes a `CreateInvoice` request. - -## Structure - -`CreateInvoiceRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | Stores information about an invoice. You use the Invoices API to create and manage
invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). | -| `idempotencyKey` | `string \| undefined` | Optional | A unique string that identifies the `CreateInvoice` request. If you do not
provide `idempotency_key` (or provide an empty string as the value), the endpoint
treats each request as independent.

For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `128` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "ce3748f9-5fc1-4762-aa12-aae5e843f1f4", - "invoice": { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": false - }, - "custom_fields": [ - { - "label": "Event Reference Number", - "placement": "ABOVE_LINE_ITEMS", - "value": "Ref. #1234" - }, - { - "label": "Terms of Service", - "placement": "BELOW_LINE_ITEMS", - "value": "The terms of service are..." - } - ], - "delivery_method": "EMAIL", - "description": "We appreciate your business!", - "invoice_number": "inv-100", - "location_id": "ES0RJRZYEC39A", - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "payment_requests": [ - { - "automatic_payment_source": "NONE", - "due_date": "2030-01-24", - "reminders": [ - { - "message": "Your invoice is due tomorrow", - "relative_scheduled_days": -1 - } - ], - "request_type": "BALANCE", - "tipping_enabled": true - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "given_name": "given_name6", - "family_name": "family_name8", - "email_address": "email_address2", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "sale_or_service_date": "2030-01-24", - "scheduled_at": "2030-01-13T10:00:00Z", - "store_payment_method_enabled": false, - "title": "Event Planning Services", - "id": "id6", - "version": 118 - } -} -``` - diff --git a/doc/models/create-invoice-response.md b/doc/models/create-invoice-response.md deleted file mode 100644 index 460c49bc7..000000000 --- a/doc/models/create-invoice-response.md +++ /dev/null @@ -1,106 +0,0 @@ - -# Create Invoice Response - -The response returned by the `CreateInvoice` request. - -## Structure - -`CreateInvoiceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoice` | [`Invoice \| undefined`](../../doc/models/invoice.md) | Optional | Stores information about an invoice. You use the Invoices API to create and manage
invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "invoice": { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": false - }, - "created_at": "2020-06-18T17:45:13Z", - "custom_fields": [ - { - "label": "Event Reference Number", - "placement": "ABOVE_LINE_ITEMS", - "value": "Ref. #1234" - }, - { - "label": "Terms of Service", - "placement": "BELOW_LINE_ITEMS", - "value": "The terms of service are..." - } - ], - "delivery_method": "EMAIL", - "description": "We appreciate your business!", - "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "invoice_number": "inv-100", - "location_id": "ES0RJRZYEC39A", - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "payment_requests": [ - { - "automatic_payment_source": "NONE", - "computed_amount_money": { - "amount": 10000, - "currency": "USD" - }, - "due_date": "2030-01-24", - "reminders": [ - { - "message": "Your invoice is due tomorrow", - "relative_scheduled_days": -1, - "status": "PENDING", - "uid": "beebd363-e47f-4075-8785-c235aaa7df11" - } - ], - "request_type": "BALANCE", - "tipping_enabled": true, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "sale_or_service_date": "2030-01-24", - "scheduled_at": "2030-01-13T10:00:00Z", - "status": "DRAFT", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "title": "Event Planning Services", - "updated_at": "2020-06-18T17:45:13Z", - "version": 0 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-job-request.md b/doc/models/create-job-request.md deleted file mode 100644 index 663270142..000000000 --- a/doc/models/create-job-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Create Job Request - -Represents a [CreateJob](../../doc/api/team.md#create-job) request. - -## Structure - -`CreateJobRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `job` | [`Job`](../../doc/models/job.md) | Required | Represents a job that can be assigned to [team members](../../doc/models/team-member.md). This object defines the
job's title and tip eligibility. Compensation is defined in a [job assignment](../../doc/models/job-assignment.md)
in a team member's wage setting. | -| `idempotencyKey` | `string` | Required | A unique identifier for the `CreateJob` request. Keys can be any valid string,
but must be unique for each request. For more information, see
[Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "idempotency-key-0", - "job": { - "is_tip_eligible": true, - "title": "Cashier", - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at8" - } -} -``` - diff --git a/doc/models/create-job-response.md b/doc/models/create-job-response.md deleted file mode 100644 index b5905dd9a..000000000 --- a/doc/models/create-job-response.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Create Job Response - -Represents a [CreateJob](../../doc/api/team.md#create-job) response. Either `job` or `errors` -is present in the response. - -## Structure - -`CreateJobResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `job` | [`Job \| undefined`](../../doc/models/job.md) | Optional | Represents a job that can be assigned to [team members](../../doc/models/team-member.md). This object defines the
job's title and tip eligibility. Compensation is defined in a [job assignment](../../doc/models/job-assignment.md)
in a team member's wage setting. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "job": { - "created_at": "2021-06-11T22:55:45Z", - "id": "1yJlHapkseYnNPETIU1B", - "is_tip_eligible": true, - "title": "Cashier", - "updated_at": "2021-06-11T22:55:45Z", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-location-custom-attribute-definition-request.md b/doc/models/create-location-custom-attribute-definition-request.md deleted file mode 100644 index 81c15fee4..000000000 --- a/doc/models/create-location-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Create Location Custom Attribute Definition Request - -Represents a [CreateLocationCustomAttributeDefinition](../../doc/api/location-custom-attributes.md#create-location-custom-attribute-definition) request. - -## Structure - -`CreateLocationCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "description": "Bestselling item at location", - "key": "bestseller", - "name": "Bestseller", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - "idempotency_key": "idempotency_key6" -} -``` - diff --git a/doc/models/create-location-custom-attribute-definition-response.md b/doc/models/create-location-custom-attribute-definition-response.md deleted file mode 100644 index 73b266125..000000000 --- a/doc/models/create-location-custom-attribute-definition-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Create Location Custom Attribute Definition Response - -Represents a [CreateLocationCustomAttributeDefinition](../../doc/api/location-custom-attributes.md#create-location-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`CreateLocationCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-12-02T19:06:36.559Z", - "description": "Bestselling item at location", - "key": "bestseller", - "name": "Bestseller", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-12-02T19:06:36.559Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-location-request.md b/doc/models/create-location-request.md deleted file mode 100644 index 03f581676..000000000 --- a/doc/models/create-location-request.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Create Location Request - -The request object for the [CreateLocation](../../doc/api/locations.md#create-location) endpoint. - -## Structure - -`CreateLocationRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `location` | [`Location \| undefined`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | - -## Example (as JSON) - -```json -{ - "location": { - "address": { - "address_line_1": "1234 Peachtree St. NE", - "administrative_district_level_1": "GA", - "locality": "Atlanta", - "postal_code": "30309", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "description": "Midtown Atlanta store", - "name": "Midtown", - "id": "id4", - "timezone": "timezone6", - "capabilities": [ - "CREDIT_CARD_PROCESSING" - ] - } -} -``` - diff --git a/doc/models/create-location-response.md b/doc/models/create-location-response.md deleted file mode 100644 index ebe760c63..000000000 --- a/doc/models/create-location-response.md +++ /dev/null @@ -1,74 +0,0 @@ - -# Create Location Response - -The response object returned by the [CreateLocation](../../doc/api/locations.md#create-location) endpoint. - -## Structure - -`CreateLocationResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) encountered during the request. | -| `location` | [`Location \| undefined`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | - -## Example (as JSON) - -```json -{ - "location": { - "address": { - "address_line_1": "1234 Peachtree St. NE", - "administrative_district_level_1": "GA", - "locality": "Atlanta", - "postal_code": "30309", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "business_name": "Jet Fuel Coffee", - "capabilities": [ - "CREDIT_CARD_PROCESSING" - ], - "coordinates": { - "latitude": 33.7889, - "longitude": -84.3841 - }, - "country": "US", - "created_at": "2022-02-19T17:58:25Z", - "currency": "USD", - "description": "Midtown Atlanta store", - "id": "3Z4V4WHQK64X9", - "language_code": "en-US", - "mcc": "7299", - "merchant_id": "3MYCJG5GVYQ8Q", - "name": "Midtown", - "status": "ACTIVE", - "timezone": "America/New_York", - "type": "PHYSICAL" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-loyalty-account-request.md b/doc/models/create-loyalty-account-request.md deleted file mode 100644 index 5a783e4f6..000000000 --- a/doc/models/create-loyalty-account-request.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Create Loyalty Account Request - -A request to create a new loyalty account. - -## Structure - -`CreateLoyaltyAccountRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyAccount` | [`LoyaltyAccount`](../../doc/models/loyalty-account.md) | Required | Describes a loyalty account in a [loyalty program](../../doc/models/loyalty-program.md). For more information, see
[Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `CreateLoyaltyAccount` request.
Keys can be any valid string, but must be unique for every request.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "ec78c477-b1c3-4899-a209-a4e71337c996", - "loyalty_account": { - "mapping": { - "phone_number": "+14155551234" - }, - "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "id": "id6", - "balance": 6, - "lifetime_points": 30, - "customer_id": "customer_id4", - "enrolled_at": "enrolled_at6" - } -} -``` - diff --git a/doc/models/create-loyalty-account-response.md b/doc/models/create-loyalty-account-response.md deleted file mode 100644 index e76f9db25..000000000 --- a/doc/models/create-loyalty-account-response.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Create Loyalty Account Response - -A response that includes loyalty account created. - -## Structure - -`CreateLoyaltyAccountResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `loyaltyAccount` | [`LoyaltyAccount \| undefined`](../../doc/models/loyalty-account.md) | Optional | Describes a loyalty account in a [loyalty program](../../doc/models/loyalty-program.md). For more information, see
[Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). | - -## Example (as JSON) - -```json -{ - "loyalty_account": { - "balance": 0, - "created_at": "2020-05-08T21:44:32Z", - "customer_id": "QPTXM8PQNX3Q726ZYHPMNP46XC", - "id": "79b807d2-d786-46a9-933b-918028d7a8c5", - "lifetime_points": 0, - "mapping": { - "created_at": "2020-05-08T21:44:32Z", - "id": "66aaab3f-da99-49ed-8b19-b87f851c844f", - "phone_number": "+14155551234" - }, - "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "updated_at": "2020-05-08T21:44:32Z", - "enrolled_at": "enrolled_at6" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-loyalty-promotion-request.md b/doc/models/create-loyalty-promotion-request.md deleted file mode 100644 index ee716c73c..000000000 --- a/doc/models/create-loyalty-promotion-request.md +++ /dev/null @@ -1,59 +0,0 @@ - -# Create Loyalty Promotion Request - -Represents a [CreateLoyaltyPromotion](../../doc/api/loyalty.md#create-loyalty-promotion) request. - -## Structure - -`CreateLoyaltyPromotionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyPromotion` | [`LoyaltyPromotion`](../../doc/models/loyalty-promotion.md) | Required | Represents a promotion for a [loyalty program](../../doc/models/loyalty-program.md). Loyalty promotions enable buyers
to earn extra points on top of those earned from the base program.

A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. | -| `idempotencyKey` | `string` | Required | A unique identifier for this request, which is used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "ec78c477-b1c3-4899-a209-a4e71337c996", - "loyalty_promotion": { - "available_time": { - "time_periods": [ - "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT" - ], - "start_date": "start_date4", - "end_date": "end_date8" - }, - "incentive": { - "points_multiplier_data": { - "multiplier": "3.0", - "points_multiplier": 134 - }, - "type": "POINTS_MULTIPLIER", - "points_addition_data": { - "points_addition": 218 - } - }, - "minimum_spend_amount_money": { - "amount": 2000, - "currency": "USD" - }, - "name": "Tuesday Happy Hour Promo", - "qualifying_category_ids": [ - "XTQPYLR3IIU9C44VRCB3XD12" - ], - "trigger_limit": { - "interval": "DAY", - "times": 1 - }, - "id": "id4", - "status": "ACTIVE", - "created_at": "created_at2", - "canceled_at": "canceled_at0" - } -} -``` - diff --git a/doc/models/create-loyalty-promotion-response.md b/doc/models/create-loyalty-promotion-response.md deleted file mode 100644 index 069f0e8b0..000000000 --- a/doc/models/create-loyalty-promotion-response.md +++ /dev/null @@ -1,75 +0,0 @@ - -# Create Loyalty Promotion Response - -Represents a [CreateLoyaltyPromotion](../../doc/api/loyalty.md#create-loyalty-promotion) response. -Either `loyalty_promotion` or `errors` is present in the response. - -## Structure - -`CreateLoyaltyPromotionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `loyaltyPromotion` | [`LoyaltyPromotion \| undefined`](../../doc/models/loyalty-promotion.md) | Optional | Represents a promotion for a [loyalty program](../../doc/models/loyalty-program.md). Loyalty promotions enable buyers
to earn extra points on top of those earned from the base program.

A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. | - -## Example (as JSON) - -```json -{ - "loyalty_promotion": { - "available_time": { - "start_date": "2022-08-16", - "time_periods": [ - "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT" - ], - "end_date": "end_date8" - }, - "created_at": "2022-08-16T08:38:54Z", - "id": "loypromo_f0f9b849-725e-378d-b810-511237e07b67", - "incentive": { - "points_multiplier_data": { - "multiplier": "3.000", - "points_multiplier": 3 - }, - "type": "POINTS_MULTIPLIER", - "points_addition_data": { - "points_addition": 218 - } - }, - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "minimum_spend_amount_money": { - "amount": 2000, - "currency": "USD" - }, - "name": "Tuesday Happy Hour Promo", - "qualifying_category_ids": [ - "XTQPYLR3IIU9C44VRCB3XD12" - ], - "status": "ACTIVE", - "trigger_limit": { - "interval": "DAY", - "times": 1 - }, - "updated_at": "2022-08-16T08:38:54Z", - "canceled_at": "canceled_at0" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-loyalty-reward-request.md b/doc/models/create-loyalty-reward-request.md deleted file mode 100644 index 4be49cafc..000000000 --- a/doc/models/create-loyalty-reward-request.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Create Loyalty Reward Request - -A request to create a loyalty reward. - -## Structure - -`CreateLoyaltyRewardRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `reward` | [`LoyaltyReward`](../../doc/models/loyalty-reward.md) | Required | Represents a contract to redeem loyalty points for a [reward tier](../../doc/models/loyalty-program-reward-tier.md) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state.
For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `CreateLoyaltyReward` request.
Keys can be any valid string, but must be unique for every request.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "18c2e5ea-a620-4b1f-ad60-7b167285e451", - "reward": { - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", - "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "id": "id0", - "status": "ISSUED", - "points": 222, - "created_at": "created_at8" - } -} -``` - diff --git a/doc/models/create-loyalty-reward-response.md b/doc/models/create-loyalty-reward-response.md deleted file mode 100644 index 0f2dd0628..000000000 --- a/doc/models/create-loyalty-reward-response.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Create Loyalty Reward Response - -A response that includes the loyalty reward created. - -## Structure - -`CreateLoyaltyRewardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `reward` | [`LoyaltyReward \| undefined`](../../doc/models/loyalty-reward.md) | Optional | Represents a contract to redeem loyalty points for a [reward tier](../../doc/models/loyalty-program-reward-tier.md) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state.
For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). | - -## Example (as JSON) - -```json -{ - "reward": { - "created_at": "2020-05-01T21:49:54Z", - "id": "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", - "points": 10, - "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "status": "ISSUED", - "updated_at": "2020-05-01T21:49:54Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-merchant-custom-attribute-definition-request.md b/doc/models/create-merchant-custom-attribute-definition-request.md deleted file mode 100644 index fdade0677..000000000 --- a/doc/models/create-merchant-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Create Merchant Custom Attribute Definition Request - -Represents a [CreateMerchantCustomAttributeDefinition](../../doc/api/merchant-custom-attributes.md#create-merchant-custom-attribute-definition) request. - -## Structure - -`CreateMerchantCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "description": "This is the other name this merchant goes by.", - "key": "alternative_seller_name", - "name": "Alternative Merchant Name", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "visibility": "VISIBILITY_READ_ONLY" - }, - "idempotency_key": "idempotency_key6" -} -``` - diff --git a/doc/models/create-merchant-custom-attribute-definition-response.md b/doc/models/create-merchant-custom-attribute-definition-response.md deleted file mode 100644 index 6b7da5e5a..000000000 --- a/doc/models/create-merchant-custom-attribute-definition-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Create Merchant Custom Attribute Definition Response - -Represents a [CreateMerchantCustomAttributeDefinition](../../doc/api/merchant-custom-attributes.md#create-merchant-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`CreateMerchantCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2023-05-05T19:06:36.559Z", - "description": "This is the other name this merchant goes by.", - "key": "alternative_seller_name", - "name": "Alternative Merchant Name", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2023-05-05T19:06:36.559Z", - "version": 1, - "visibility": "VISIBILITY_READ_ONLY" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-mobile-authorization-code-request.md b/doc/models/create-mobile-authorization-code-request.md deleted file mode 100644 index 7b858993e..000000000 --- a/doc/models/create-mobile-authorization-code-request.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Create Mobile Authorization Code Request - -Defines the body parameters that can be provided in a request to the -`CreateMobileAuthorizationCode` endpoint. - -## Structure - -`CreateMobileAuthorizationCodeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| undefined` | Optional | The Square location ID that the authorization code should be tied to.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `191` | - -## Example (as JSON) - -```json -{ - "location_id": "YOUR_LOCATION_ID" -} -``` - diff --git a/doc/models/create-mobile-authorization-code-response.md b/doc/models/create-mobile-authorization-code-response.md deleted file mode 100644 index a936fdca4..000000000 --- a/doc/models/create-mobile-authorization-code-response.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Create Mobile Authorization Code Response - -Defines the fields that are included in the response body of -a request to the `CreateMobileAuthorizationCode` endpoint. - -## Structure - -`CreateMobileAuthorizationCodeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `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` | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "authorization_code": "YOUR_MOBILE_AUTHORIZATION_CODE", - "expires_at": "2019-01-10T19:42:08Z", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-order-custom-attribute-definition-request.md b/doc/models/create-order-custom-attribute-definition-request.md deleted file mode 100644 index 71d2b14d2..000000000 --- a/doc/models/create-order-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Create Order Custom Attribute Definition Request - -Represents a create request for an order custom attribute definition. - -## Structure - -`CreateOrderCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "description": "The number of people seated at a table", - "key": "cover-count", - "name": "Cover count", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - "idempotency_key": "IDEMPOTENCY_KEY" -} -``` - diff --git a/doc/models/create-order-custom-attribute-definition-response.md b/doc/models/create-order-custom-attribute-definition-response.md deleted file mode 100644 index e4a12a0a5..000000000 --- a/doc/models/create-order-custom-attribute-definition-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Create Order Custom Attribute Definition Response - -Represents a response from creating an order custom attribute definition. - -## Structure - -`CreateOrderCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-10-06T16:53:23.141Z", - "description": "The number of people seated at a table", - "key": "cover-count", - "name": "Cover count", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-10-06T16:53:23.141Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-order-request.md b/doc/models/create-order-request.md deleted file mode 100644 index 8e6efc441..000000000 --- a/doc/models/create-order-request.md +++ /dev/null @@ -1,121 +0,0 @@ - -# Create Order Request - -## Structure - -`CreateOrderRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `idempotencyKey` | `string \| undefined` | Optional | A value you specify that uniquely identifies this
order among orders you have created.

If you are unsure whether a particular order was created successfully,
you can try it again with the same idempotency key without
worrying about creating duplicate orders.

For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "8193148c-9586-11e6-99f9-28cfe92138cf", - "order": { - "discounts": [ - { - "name": "Labor Day Sale", - "percentage": "5", - "scope": "ORDER", - "uid": "labor-day-sale" - }, - { - "catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7", - "scope": "ORDER", - "uid": "membership-discount" - }, - { - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "name": "Sale - $1.00 off", - "scope": "LINE_ITEM", - "uid": "one-dollar-off" - } - ], - "line_items": [ - { - "base_price_money": { - "amount": 1599, - "currency": "USD" - }, - "name": "New York Strip Steak", - "quantity": "1", - "uid": "uid8", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "applied_discounts": [ - { - "discount_uid": "one-dollar-off" - } - ], - "catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB", - "modifiers": [ - { - "catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ" - } - ], - "quantity": "2", - "uid": "uid8", - "name": "name8", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4" - } - ], - "location_id": "057P5VYJ4A5X1", - "reference_id": "my-order-001", - "taxes": [ - { - "name": "State Sales Tax", - "percentage": "9", - "scope": "ORDER", - "uid": "state-sales-tax" - } - ], - "id": "id6", - "source": { - "name": "name4" - }, - "customer_id": "customer_id4" - } -} -``` - diff --git a/doc/models/create-order-response.md b/doc/models/create-order-response.md deleted file mode 100644 index 5546e5695..000000000 --- a/doc/models/create-order-response.md +++ /dev/null @@ -1,329 +0,0 @@ - -# Create Order Response - -Defines the fields that are included in the response body of -a request to the `CreateOrder` endpoint. - -Either `errors` or `order` is present in a given response, but never both. - -## Structure - -`CreateOrderResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "order": { - "created_at": "2020-01-17T20:47:53.293Z", - "discounts": [ - { - "applied_money": { - "amount": 30, - "currency": "USD" - }, - "catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7", - "name": "Membership Discount", - "percentage": "0.5", - "scope": "ORDER", - "type": "FIXED_PERCENTAGE", - "uid": "membership-discount" - }, - { - "applied_money": { - "amount": 303, - "currency": "USD" - }, - "name": "Labor Day Sale", - "percentage": "5", - "scope": "ORDER", - "type": "FIXED_PERCENTAGE", - "uid": "labor-day-sale" - }, - { - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "applied_money": { - "amount": 100, - "currency": "USD" - }, - "name": "Sale - $1.00 off", - "scope": "LINE_ITEM", - "type": "FIXED_AMOUNT", - "uid": "one-dollar-off" - } - ], - "id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "line_items": [ - { - "applied_discounts": [ - { - "applied_money": { - "amount": 8, - "currency": "USD" - }, - "discount_uid": "membership-discount", - "uid": "jWdgP1TpHPFBuVrz81mXVC" - }, - { - "applied_money": { - "amount": 79, - "currency": "USD" - }, - "discount_uid": "labor-day-sale", - "uid": "jnZOjjVY57eRcQAVgEwFuC" - } - ], - "applied_taxes": [ - { - "applied_money": { - "amount": 136, - "currency": "USD" - }, - "tax_uid": "state-sales-tax", - "uid": "aKG87ArnDpvMLSZJHxWUl" - } - ], - "base_price_money": { - "amount": 1599, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 1599, - "currency": "USD" - }, - "name": "New York Strip Steak", - "quantity": "1", - "total_discount_money": { - "amount": 87, - "currency": "USD" - }, - "total_money": { - "amount": 1648, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 136, - "currency": "USD" - }, - "uid": "8uSwfzvUImn3IRrvciqlXC", - "variation_total_price_money": { - "amount": 1599, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "applied_discounts": [ - { - "applied_money": { - "amount": 22, - "currency": "USD" - }, - "discount_uid": "membership-discount", - "uid": "nUXvdsIItfKko0dbYtY58C" - }, - { - "applied_money": { - "amount": 224, - "currency": "USD" - }, - "discount_uid": "labor-day-sale", - "uid": "qSdkOOOernlVQqsJ94SPjB" - }, - { - "applied_money": { - "amount": 100, - "currency": "USD" - }, - "discount_uid": "one-dollar-off", - "uid": "y7bVl4njrWAnfDwmz19izB" - } - ], - "applied_taxes": [ - { - "applied_money": { - "amount": 374, - "currency": "USD" - }, - "tax_uid": "state-sales-tax", - "uid": "v1dAgrfUVUPTnVTf9sRPz" - } - ], - "base_price_money": { - "amount": 2200, - "currency": "USD" - }, - "catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB", - "gross_sales_money": { - "amount": 4500, - "currency": "USD" - }, - "modifiers": [ - { - "base_price_money": { - "amount": 50, - "currency": "USD" - }, - "catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ", - "name": "Well", - "total_price_money": { - "amount": 100, - "currency": "USD" - }, - "uid": "Lo3qMMckDluu9Qsb58d4CC" - } - ], - "name": "New York Steak", - "quantity": "2", - "total_discount_money": { - "amount": 346, - "currency": "USD" - }, - "total_money": { - "amount": 4528, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 374, - "currency": "USD" - }, - "uid": "v8ZuEXpOJpb0bazLuvrLDB", - "variation_name": "Larger", - "variation_total_price_money": { - "amount": 4400, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4" - } - ], - "location_id": "057P5VYJ4A5X1", - "net_amounts": { - "discount_money": { - "amount": 433, - "currency": "USD" - }, - "service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "tax_money": { - "amount": 510, - "currency": "USD" - }, - "tip_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 6176, - "currency": "USD" - } - }, - "reference_id": "my-order-001", - "source": { - "name": "My App" - }, - "state": "OPEN", - "taxes": [ - { - "applied_money": { - "amount": 510, - "currency": "USD" - }, - "name": "State Sales Tax", - "percentage": "9", - "scope": "ORDER", - "type": "ADDITIVE", - "uid": "state-sales-tax" - } - ], - "total_discount_money": { - "amount": 433, - "currency": "USD" - }, - "total_money": { - "amount": 6176, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 510, - "currency": "USD" - }, - "total_tip_money": { - "amount": 0, - "currency": "USD" - }, - "updated_at": "2020-01-17T20:47:53.293Z", - "version": 1, - "customer_id": "customer_id4" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-payment-link-request.md b/doc/models/create-payment-link-request.md deleted file mode 100644 index 013c10c5a..000000000 --- a/doc/models/create-payment-link-request.md +++ /dev/null @@ -1,83 +0,0 @@ - -# Create Payment Link Request - -## Structure - -`CreatePaymentLinkRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | A unique string that identifies this `CreatePaymentLinkRequest` 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](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Maximum Length*: `192` | -| `description` | `string \| undefined` | Optional | A description of the payment link. You provide this optional description that is useful in your
application context. It is not used anywhere.
**Constraints**: *Maximum Length*: `4096` | -| `quickPay` | [`QuickPay \| undefined`](../../doc/models/quick-pay.md) | Optional | Describes an ad hoc item and price to generate a quick pay checkout link.
For more information,
see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `checkoutOptions` | [`CheckoutOptions \| undefined`](../../doc/models/checkout-options.md) | Optional | - | -| `prePopulatedData` | [`PrePopulatedData \| undefined`](../../doc/models/pre-populated-data.md) | Optional | Describes buyer data to prepopulate in the payment form.
For more information,
see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). | -| `paymentNote` | `string \| undefined` | Optional | A note for the payment. After processing the payment, Square adds this note to the resulting `Payment`.
**Constraints**: *Maximum Length*: `500` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "cd9e25dc-d9f2-4430-aedb-61605070e95f", - "quick_pay": { - "location_id": "A9Y43N9ABXZBP", - "name": "Auto Detailing", - "price_money": { - "amount": 10000, - "currency": "USD" - } - }, - "description": "description6", - "order": { - "id": "id6", - "location_id": "location_id0", - "reference_id": "reference_id4", - "source": { - "name": "name4" - }, - "customer_id": "customer_id4", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] - }, - "checkout_options": { - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id8", - "redirect_url": "redirect_url2", - "merchant_support_email": "merchant_support_email8" - } -} -``` - diff --git a/doc/models/create-payment-link-response.md b/doc/models/create-payment-link-response.md deleted file mode 100644 index 972054083..000000000 --- a/doc/models/create-payment-link-response.md +++ /dev/null @@ -1,266 +0,0 @@ - -# Create Payment Link Response - -## Structure - -`CreatePaymentLinkResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `paymentLink` | [`PaymentLink \| undefined`](../../doc/models/payment-link.md) | Optional | - | -| `relatedResources` | [`PaymentLinkRelatedResources \| undefined`](../../doc/models/payment-link-related-resources.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "payment_link": { - "id": "id2", - "version": 184, - "description": "description2", - "order_id": "order_id6", - "checkout_options": { - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id8", - "redirect_url": "redirect_url2", - "merchant_support_email": "merchant_support_email8" - }, - "pre_populated_data": { - "buyer_email": "buyer_email8", - "buyer_phone_number": "buyer_phone_number0", - "buyer_address": { - "address_line_1": "address_line_12", - "address_line_2": "address_line_22", - "address_line_3": "address_line_38", - "locality": "locality2", - "sublocality": "sublocality2" - } - } - }, - "related_resources": { - "orders": [ - { - "id": "id2", - "location_id": "location_id6", - "reference_id": "reference_id0", - "source": { - "name": "name4" - }, - "customer_id": "customer_id0", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] - } - ], - "subscription_plans": [ - { - "type": "ITEM_OPTION", - "id": "id4", - "updated_at": "updated_at0", - "version": 112, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "type": "ITEM_OPTION", - "id": "id4", - "updated_at": "updated_at0", - "version": 112, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "type": "ITEM_OPTION", - "id": "id4", - "updated_at": "updated_at0", - "version": 112, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ] - } -} -``` - diff --git a/doc/models/create-payment-request.md b/doc/models/create-payment-request.md deleted file mode 100644 index 07db5973c..000000000 --- a/doc/models/create-payment-request.md +++ /dev/null @@ -1,68 +0,0 @@ - -# Create Payment Request - -Describes a request to create a payment using -[CreatePayment](../../doc/api/payments.md#create-payment). - -## Structure - -`CreatePaymentRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sourceId` | `string` | Required | The ID for the source of funds for this payment.
This could be a payment token generated by the Web Payments SDK for any of its
[supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods),
including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment
that the seller received outside of Square, specify either "CASH" or "EXTERNAL".
For more information, see
[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
**Constraints**: *Minimum Length*: `1` | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `CreatePayment` request. Keys can be any valid string
but must be unique for every `CreatePayment` request.

Note: The number of allowed characters might be less than the stated maximum, if multi-byte
characters are used.

For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | -| `amountMoney` | [`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. | -| `tipMoney` | [`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. | -| `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. | -| `delayDuration` | `string \| undefined` | Optional | The duration of time after the payment's creation when Square automatically
either completes or cancels the payment depending on the `delay_action` field value.
For more information, see
[Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).

This parameter should be specified as a time duration, in RFC 3339 format.

Note: This feature is only supported for card payments. This parameter can only be set for a delayed
capture payment (`autocomplete=false`).

Default:

- Card-present payments: "PT36H" (36 hours) from the creation time.
- Card-not-present payments: "P7D" (7 days) from the creation time. | -| `delayAction` | `string \| undefined` | Optional | The action to be applied to the payment when the `delay_duration` has elapsed. The action must be
CANCEL or COMPLETE. For more information, see
[Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).

Default: CANCEL | -| `autocomplete` | `boolean \| undefined` | Optional | If set to `true`, this payment will be completed when possible. If
set to `false`, this payment is held in an approved state until either
explicitly completed (captured) or canceled (voided). For more information, see
[Delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment).

Default: true | -| `orderId` | `string \| undefined` | Optional | Associates a previously created order with this payment. | -| `customerId` | `string \| undefined` | Optional | The [Customer](entity:Customer) ID of the customer associated with the payment.

This is required if the `source_id` refers to a card on file created using the Cards API. | -| `locationId` | `string \| undefined` | Optional | The location ID to associate with the payment. If not specified, the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location) is
used. | -| `teamMemberId` | `string \| undefined` | Optional | An optional [TeamMember](entity:TeamMember) ID to associate with
this payment. | -| `referenceId` | `string \| undefined` | Optional | A user-defined ID to associate with the payment.

You can use this field to associate the payment to an entity in an external system
(for example, you might specify an order ID that is generated by a third-party shopping cart).
**Constraints**: *Maximum Length*: `40` | -| `verificationToken` | `string \| undefined` | Optional | An identifying token generated by [payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer).
Verification tokens encapsulate customer device information and 3-D Secure
challenge results to indicate that Square has verified the buyer identity.

For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview). | -| `acceptPartialAuthorization` | `boolean \| undefined` | Optional | If set to `true` and charging a Square Gift Card, a payment might be returned with
`amount_money` equal to less than what was requested. For example, a request for $20 when charging
a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
payment. This field cannot be `true` when `autocomplete = true`.

For more information, see
[Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card).

Default: false | -| `buyerEmailAddress` | `string \| undefined` | Optional | The buyer's email address.
**Constraints**: *Maximum Length*: `255` | -| `buyerPhoneNumber` | `string \| undefined` | Optional | The buyer's phone number.
Must follow the following format:

1. A leading + symbol (followed by a country code)
2. The phone number can contain spaces and the special characters `(` , `)` , `-` , and `.`.
Alphabetical characters aren't allowed.
3. The phone number must contain between 9 and 16 digits. | -| `billingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `shippingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `note` | `string \| undefined` | Optional | An optional note to be entered by the developer when creating a payment.
**Constraints**: *Maximum Length*: `500` | -| `statementDescriptionIdentifier` | `string \| undefined` | Optional | Optional additional payment information to include on the customer's card statement
as part of the statement description. This can be, for example, an invoice number, ticket number,
or short description that uniquely identifies the purchase.

Note that the `statement_description_identifier` might get truncated on the statement description
to fit the required information including the Square identifier (SQ *) and name of the
seller taking the payment.
**Constraints**: *Maximum Length*: `20` | -| `cashDetails` | [`CashPaymentDetails \| undefined`](../../doc/models/cash-payment-details.md) | Optional | Stores details about a cash payment. Contains only non-confidential information. For more information, see
[Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). | -| `externalDetails` | [`ExternalPaymentDetails \| undefined`](../../doc/models/external-payment-details.md) | Optional | Stores details about an external payment. Contains only non-confidential information.
For more information, see
[Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). | -| `customerDetails` | [`CustomerDetails \| undefined`](../../doc/models/customer-details.md) | Optional | Details about the customer making the payment. | -| `offlinePaymentDetails` | [`OfflinePaymentDetails \| undefined`](../../doc/models/offline-payment-details.md) | Optional | Details specific to offline payments. | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "app_fee_money": { - "amount": 10, - "currency": "USD" - }, - "autocomplete": true, - "customer_id": "W92WH6P11H4Z77CTET0RNTGFW8", - "idempotency_key": "7b0f3ec5-086a-4871-8f13-3c81b3875218", - "location_id": "L88917AVBK2S5", - "note": "Brief description", - "reference_id": "123456", - "source_id": "ccof:GaJGNaZa8x4OgDJn4GB", - "tip_money": { - "amount": 190, - "currency": "TWD" - }, - "delay_duration": "delay_duration6", - "delay_action": "delay_action6" -} -``` - diff --git a/doc/models/create-payment-response.md b/doc/models/create-payment-response.md deleted file mode 100644 index 3f73afcfc..000000000 --- a/doc/models/create-payment-response.md +++ /dev/null @@ -1,114 +0,0 @@ - -# Create Payment Response - -Defines the response returned by [CreatePayment](../../doc/api/payments.md#create-payment). - -If there are errors processing the request, the `payment` field might not be -present, or it might be present with a status of `FAILED`. - -## Structure - -`CreatePaymentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `payment` | [`Payment \| undefined`](../../doc/models/payment.md) | Optional | Represents a payment processed by the Square API. | - -## Example (as JSON) - -```json -{ - "payment": { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "app_fee_money": { - "amount": 10, - "currency": "USD" - }, - "application_details": { - "application_id": "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", - "square_product": "ECOMMERCE_API" - }, - "approved_money": { - "amount": 1000, - "currency": "USD" - }, - "card_details": { - "auth_result_code": "vNEn2f", - "avs_status": "AVS_ACCEPTED", - "card": { - "bin": "411111", - "card_brand": "VISA", - "card_type": "DEBIT", - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", - "last_4": "1111", - "prepaid_type": "NOT_PREPAID" - }, - "card_payment_timeline": { - "authorized_at": "2021-10-13T21:14:29.732Z", - "captured_at": "2021-10-13T21:14:30.504Z" - }, - "cvv_status": "CVV_ACCEPTED", - "entry_method": "ON_FILE", - "statement_description": "SQ *EXAMPLE TEST GOSQ.C", - "status": "CAPTURED" - }, - "created_at": "2021-10-13T21:14:29.577Z", - "customer_id": "W92WH6P11H4Z77CTET0RNTGFW8", - "delay_action": "CANCEL", - "delay_duration": "PT168H", - "delayed_until": "2021-10-20T21:14:29.577Z", - "id": "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", - "location_id": "L88917AVBK2S5", - "note": "Brief Description", - "order_id": "pRsjRTgFWATl7so6DxdKBJa7ssbZY", - "receipt_number": "R2B3", - "receipt_url": "https://squareup.com/receipt/preview/EXAMPLE_RECEIPT_ID", - "reference_id": "123456", - "risk_evaluation": { - "created_at": "2021-10-13T21:14:30.423Z", - "risk_level": "NORMAL" - }, - "source_type": "CARD", - "status": "COMPLETED", - "total_money": { - "amount": 1000, - "currency": "USD" - }, - "updated_at": "2021-10-13T21:14:30.504Z", - "version_token": "TPtNEOBOa6Qq6E3C3IjckSVOM6b3hMbfhjvTxHBQUsB6o", - "tip_money": { - "amount": 190, - "currency": "TWD" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-refund-request.md b/doc/models/create-refund-request.md deleted file mode 100644 index a754edb7e..000000000 --- a/doc/models/create-refund-request.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Create Refund Request - -Defines the body parameters that can be included in -a request to the [CreateRefund](api-endpoint:Transactions-CreateRefund) endpoint. - -Deprecated - recommend using [RefundPayment](api-endpoint:Refunds-RefundPayment) - -## Structure - -`CreateRefundRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A value you specify that uniquely identifies this
refund among refunds you've created for the tender.

If you're unsure whether a particular refund succeeded,
you can reattempt it with the same idempotency key without
worrying about duplicating the refund.

See [Idempotency keys](https://developer.squareup.com/docs/working-with-apis/idempotency) for more information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `192` | -| `tenderId` | `string` | Required | The ID of the tender to refund.

A [`Transaction`](entity:Transaction) has one or more `tenders` (i.e., methods
of payment) associated with it, and you refund each tender separately with
the Connect API.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `192` | -| `reason` | `string \| undefined` | Optional | A description of the reason for the refund.

Default value: `Refund via API`
**Constraints**: *Maximum Length*: `192` | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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 -{ - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "idempotency_key": "86ae1696-b1e3-4328-af6d-f1e04d947ad2", - "reason": "a reason", - "tender_id": "MtZRYYdDrYNQbOvV7nbuBvMF" -} -``` - diff --git a/doc/models/create-refund-response.md b/doc/models/create-refund-response.md deleted file mode 100644 index ad72a75e0..000000000 --- a/doc/models/create-refund-response.md +++ /dev/null @@ -1,68 +0,0 @@ - -# Create Refund Response - -Defines the fields that are included in the response body of -a request to the [CreateRefund](api-endpoint:Transactions-CreateRefund) endpoint. - -One of `errors` or `refund` is present in a given response (never both). - -## Structure - -`CreateRefundResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `refund` | [`Refund \| undefined`](../../doc/models/refund.md) | Optional | Represents a refund processed for a Square transaction. | - -## Example (as JSON) - -```json -{ - "refund": { - "additional_recipients": [ - { - "amount_money": { - "amount": 10, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1", - "receivable_id": "ISu5xwxJ5v0CMJTQq7RvqyMF" - } - ], - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "created_at": "2016-02-12T00:28:18Z", - "id": "b27436d1-7f8e-5610-45c6-417ef71434b4-SW", - "location_id": "18YC4JDH91E1H", - "reason": "some reason", - "status": "PENDING", - "tender_id": "MtZRYYdDrYNQbOvV7nbuBvMF", - "transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-shift-request.md b/doc/models/create-shift-request.md deleted file mode 100644 index bb243c73d..000000000 --- a/doc/models/create-shift-request.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Create Shift Request - -Represents a request to create a `Shift`. - -## Structure - -`CreateShiftRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | A unique string value to ensure the idempotency of the operation.
**Constraints**: *Maximum Length*: `128` | -| `shift` | [`Shift`](../../doc/models/shift.md) | Required | A record of the hourly rate, start, and end times for a single work shift
for an employee. This might include a record of the start and end times for breaks
taken during the shift. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "HIDSNG5KS478L", - "shift": { - "breaks": [ - { - "break_type_id": "REGS1EQR1TPZ5", - "end_at": "2019-01-25T06:16:00-05:00", - "expected_duration": "PT5M", - "is_paid": true, - "name": "Tea Break", - "start_at": "2019-01-25T06:11:00-05:00" - } - ], - "declared_cash_tip_money": { - "amount": 500, - "currency": "USD" - }, - "end_at": "2019-01-25T13:11:00-05:00", - "location_id": "PAA1RJZZKXBFG", - "start_at": "2019-01-25T03:11:00-05:00", - "team_member_id": "ormj0jJJZ5OZIzxrZYJI", - "wage": { - "hourly_rate": { - "amount": 1100, - "currency": "USD" - }, - "tip_eligible": true, - "title": "Barista", - "job_id": "job_id0" - }, - "id": "id4", - "employee_id": "employee_id4", - "timezone": "timezone4" - } -} -``` - diff --git a/doc/models/create-shift-response.md b/doc/models/create-shift-response.md deleted file mode 100644 index 6c3f8b3e6..000000000 --- a/doc/models/create-shift-response.md +++ /dev/null @@ -1,82 +0,0 @@ - -# Create Shift Response - -The response to a request to create a `Shift`. The response contains -the created `Shift` object and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`CreateShiftResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `shift` | [`Shift \| undefined`](../../doc/models/shift.md) | Optional | A record of the hourly rate, start, and end times for a single work shift
for an employee. This might include a record of the start and end times for breaks
taken during the shift. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "shift": { - "breaks": [ - { - "break_type_id": "REGS1EQR1TPZ5", - "end_at": "2019-01-25T06:16:00-05:00", - "expected_duration": "PT5M", - "id": "X7GAQYVVRRG6P", - "is_paid": true, - "name": "Tea Break", - "start_at": "2019-01-25T06:11:00-05:00" - } - ], - "created_at": "2019-02-28T00:39:02Z", - "declared_cash_tip_money": { - "amount": 500, - "currency": "USD" - }, - "employee_id": "ormj0jJJZ5OZIzxrZYJI", - "end_at": "2019-01-25T13:11:00-05:00", - "id": "K0YH4CV5462JB", - "location_id": "PAA1RJZZKXBFG", - "start_at": "2019-01-25T03:11:00-05:00", - "status": "CLOSED", - "team_member_id": "ormj0jJJZ5OZIzxrZYJI", - "timezone": "America/New_York", - "updated_at": "2019-02-28T00:39:02Z", - "version": 1, - "wage": { - "hourly_rate": { - "amount": 1100, - "currency": "USD" - }, - "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", - "tip_eligible": true, - "title": "Barista" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-subscription-request.md b/doc/models/create-subscription-request.md deleted file mode 100644 index 964e50538..000000000 --- a/doc/models/create-subscription-request.md +++ /dev/null @@ -1,53 +0,0 @@ - -# Create Subscription Request - -Defines input parameters in a request to the -[CreateSubscription](../../doc/api/subscriptions.md#create-subscription) endpoint. - -## Structure - -`CreateSubscriptionRequest` - -## Fields - -| 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/build-basics/common-api-patterns/idempotency). | -| `locationId` | `string` | Required | The ID of the location the subscription is associated with.
**Constraints**: *Minimum Length*: `1` | -| `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 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 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. | -| `monthlyBillingAnchorDate` | `number \| undefined` | Optional | The day-of-the-month to change the billing date to.
**Constraints**: `>= 1`, `<= 31` | -| `phases` | [`Phase[] \| undefined`](../../doc/models/phase.md) | Optional | array of phases for this subscription | - -## Example (as JSON) - -```json -{ - "card_id": "ccof:qy5x8hHGYsgLrp4Q4GB", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "idempotency_key": "8193148c-9586-11e6-99f9-28cfe92138cf", - "location_id": "S8GWD5R9QB376", - "phases": [ - { - "order_template_id": "U2NaowWxzXwpsZU697x7ZHOAnCNZY", - "ordinal": 0 - } - ], - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "source": { - "name": "My Application" - }, - "start_date": "2023-06-20", - "timezone": "America/Los_Angeles", - "canceled_date": "canceled_date6", - "tax_percentage": "tax_percentage6" -} -``` - diff --git a/doc/models/create-subscription-response.md b/doc/models/create-subscription-response.md deleted file mode 100644 index c55aebbaa..000000000 --- a/doc/models/create-subscription-response.md +++ /dev/null @@ -1,67 +0,0 @@ - -# Create Subscription Response - -Defines output parameters in a response from the -[CreateSubscription](../../doc/api/subscriptions.md#create-subscription) endpoint. - -## Structure - -`CreateSubscriptionResponse` - -## Fields - -| 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 purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | - -## Example (as JSON) - -```json -{ - "subscription": { - "card_id": "ccof:qy5x8hHGYsgLrp4Q4GB", - "created_at": "2023-06-20T21:53:10Z", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "id": "56214fb2-cc85-47a1-93bc-44f3766bb56f", - "location_id": "S8GWD5R9QB376", - "phases": [ - { - "order_template_id": "U2NaowWxzXwpsZU697x7ZHOAnCNZY", - "ordinal": 0, - "plan_phase_uid": "X2Q2AONPB3RB64Y27S25QCZP", - "uid": "873451e0-745b-4e87-ab0b-c574933fe616" - } - ], - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "source": { - "name": "My Application" - }, - "start_date": "2023-06-20", - "status": "ACTIVE", - "timezone": "America/Los_Angeles", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-team-member-request.md b/doc/models/create-team-member-request.md deleted file mode 100644 index 69a6e738f..000000000 --- a/doc/models/create-team-member-request.md +++ /dev/null @@ -1,63 +0,0 @@ - -# Create Team Member Request - -Represents a create request for a `TeamMember` object. - -## Structure - -`CreateTeamMemberRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | A unique string that identifies this `CreateTeamMember` request.
Keys can be any valid string, but must be unique for every request.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).

The minimum length is 1 and the maximum length is 45. | -| `teamMember` | [`TeamMember \| undefined`](../../doc/models/team-member.md) | Optional | A record representing an individual team member for a business. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "idempotency-key-0", - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "YSGH2WBKG94QZ", - "GA2Y9HSJ8KRYT" - ] - }, - "email_address": "joe_doe@gmail.com", - "family_name": "Doe", - "given_name": "Joe", - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "status": "ACTIVE", - "wage_setting": { - "is_overtime_exempt": true, - "job_assignments": [ - { - "annual_rate": { - "amount": 3000000, - "currency": "USD" - }, - "job_id": "FjS8x95cqHiMenw4f1NAUH4P", - "pay_type": "SALARY", - "weekly_hours": 40 - }, - { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "pay_type": "HOURLY" - } - ] - }, - "id": "id6", - "is_owner": false - } -} -``` - diff --git a/doc/models/create-team-member-response.md b/doc/models/create-team-member-response.md deleted file mode 100644 index a37f9a918..000000000 --- a/doc/models/create-team-member-response.md +++ /dev/null @@ -1,94 +0,0 @@ - -# Create Team Member Response - -Represents a response from a create request containing the created `TeamMember` object or error messages. - -## Structure - -`CreateTeamMemberResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMember` | [`TeamMember \| undefined`](../../doc/models/team-member.md) | Optional | A record representing an individual team member for a business. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "GA2Y9HSJ8KRYT", - "YSGH2WBKG94QZ" - ] - }, - "created_at": "2021-06-11T22:55:45Z", - "email_address": "joe_doe@example.com", - "family_name": "Doe", - "given_name": "Joe", - "id": "1yJlHapkseYnNPETIU1B", - "is_owner": false, - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "status": "ACTIVE", - "updated_at": "2021-06-11T22:55:45Z", - "wage_setting": { - "created_at": "2021-06-11T22:55:45Z", - "is_overtime_exempt": true, - "job_assignments": [ - { - "annual_rate": { - "amount": 3000000, - "currency": "USD" - }, - "hourly_rate": { - "amount": 1443, - "currency": "USD" - }, - "job_id": "FjS8x95cqHiMenw4f1NAUH4P", - "job_title": "Manager", - "pay_type": "SALARY", - "weekly_hours": 40 - }, - { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "job_title": "Cashier", - "pay_type": "HOURLY" - } - ], - "team_member_id": "1yJlHapkseYnNPETIU1B", - "updated_at": "2021-06-11T22:55:45Z", - "version": 1 - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-terminal-action-request.md b/doc/models/create-terminal-action-request.md deleted file mode 100644 index 39e1d1b5a..000000000 --- a/doc/models/create-terminal-action-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Create Terminal Action Request - -## Structure - -`CreateTerminalActionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `CreateAction` request. Keys can be any valid string
but must be unique for every `CreateAction` request.

See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more
information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `64` | -| `action` | [`TerminalAction`](../../doc/models/terminal-action.md) | Required | Represents an action processed by the Square Terminal. | - -## Example (as JSON) - -```json -{ - "action": { - "deadline_duration": "PT5M", - "device_id": "{{DEVICE_ID}}", - "save_card_options": { - "customer_id": "{{CUSTOMER_ID}}", - "reference_id": "user-id-1" - }, - "type": "SAVE_CARD", - "id": "id2", - "status": "status4", - "cancel_reason": "TIMED_OUT" - }, - "idempotency_key": "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e" -} -``` - diff --git a/doc/models/create-terminal-action-response.md b/doc/models/create-terminal-action-response.md deleted file mode 100644 index b1ff95e77..000000000 --- a/doc/models/create-terminal-action-response.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Create Terminal Action Response - -## Structure - -`CreateTerminalActionResponse` - -## 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", - "created_at": "2021-07-28T23:22:07.476Z", - "deadline_duration": "PT5M", - "device_id": "DEVICE_ID", - "id": "termapia:jveJIAkkAjILHkdCE", - "location_id": "LOCATION_ID", - "save_card_options": { - "customer_id": "CUSTOMER_ID", - "reference_id": "user-id-1" - }, - "status": "PENDING", - "type": "SAVE_CARD", - "updated_at": "2021-07-28T23:22:07.476Z", - "cancel_reason": "TIMED_OUT" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-terminal-checkout-request.md b/doc/models/create-terminal-checkout-request.md deleted file mode 100644 index 7c0db0f33..000000000 --- a/doc/models/create-terminal-checkout-request.md +++ /dev/null @@ -1,53 +0,0 @@ - -# Create Terminal Checkout Request - -## Structure - -`CreateTerminalCheckoutRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but
must be unique for every `CreateCheckout` request.

See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `64` | -| `checkout` | [`TerminalCheckout`](../../doc/models/terminal-checkout.md) | Required | Represents a checkout processed by the Square Terminal. | - -## Example (as JSON) - -```json -{ - "checkout": { - "amount_money": { - "amount": 2610, - "currency": "USD" - }, - "device_options": { - "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", - "skip_receipt_screen": false, - "collect_signature": false, - "tip_settings": { - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "show_itemized_cart": false - }, - "note": "A brief note", - "reference_id": "id11572", - "id": "id2", - "order_id": "order_id6", - "payment_options": { - "autocomplete": false, - "delay_duration": "delay_duration2", - "accept_partial_authorization": false, - "delay_action": "CANCEL" - } - }, - "idempotency_key": "28a0c3bc-7839-11ea-bc55-0242ac130003" -} -``` - diff --git a/doc/models/create-terminal-checkout-response.md b/doc/models/create-terminal-checkout-response.md deleted file mode 100644 index e194fb341..000000000 --- a/doc/models/create-terminal-checkout-response.md +++ /dev/null @@ -1,67 +0,0 @@ - -# Create Terminal Checkout Response - -## Structure - -`CreateTerminalCheckoutResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `checkout` | [`TerminalCheckout \| undefined`](../../doc/models/terminal-checkout.md) | Optional | Represents a checkout processed by the Square Terminal. | - -## Example (as JSON) - -```json -{ - "checkout": { - "amount_money": { - "amount": 2610, - "currency": "USD" - }, - "app_id": "APP_ID", - "created_at": "2020-04-06T16:39:32.545Z", - "deadline_duration": "PT5M", - "device_options": { - "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", - "skip_receipt_screen": false, - "tip_settings": { - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "collect_signature": false, - "show_itemized_cart": false - }, - "id": "08YceKh7B3ZqO", - "location_id": "LOCATION_ID", - "note": "A brief note", - "payment_type": "CARD_PRESENT", - "reference_id": "id11572", - "status": "PENDING", - "updated_at": "2020-04-06T16:39:32.545Z", - "order_id": "order_id6", - "payment_options": { - "autocomplete": false, - "delay_duration": "delay_duration2", - "accept_partial_authorization": false, - "delay_action": "CANCEL" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-terminal-refund-request.md b/doc/models/create-terminal-refund-request.md deleted file mode 100644 index 8126be2f9..000000000 --- a/doc/models/create-terminal-refund-request.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Create Terminal Refund Request - -## Structure - -`CreateTerminalRefundRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `CreateRefund` request. Keys can be any valid string but
must be unique for every `CreateRefund` request.

See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `64` | -| `refund` | [`TerminalRefund \| undefined`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "402a640b-b26f-401f-b406-46f839590c04", - "refund": { - "amount_money": { - "amount": 111, - "currency": "CAD" - }, - "device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", - "payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "reason": "Returning items", - "id": "id8", - "refund_id": "refund_id2", - "order_id": "order_id2", - "deadline_duration": "deadline_duration0", - "status": "status0" - } -} -``` - diff --git a/doc/models/create-terminal-refund-response.md b/doc/models/create-terminal-refund-response.md deleted file mode 100644 index 7018aa5c4..000000000 --- a/doc/models/create-terminal-refund-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Create Terminal Refund Response - -## Structure - -`CreateTerminalRefundResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `refund` | [`TerminalRefund \| undefined`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | - -## Example (as JSON) - -```json -{ - "refund": { - "amount_money": { - "amount": 111, - "currency": "CAD" - }, - "app_id": "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", - "card": { - "bin": "411111", - "card_brand": "INTERAC", - "card_type": "CREDIT", - "exp_month": 1, - "exp_year": 2022, - "fingerprint": "sq-1-B1fP9MNNmZgVVaPKRND6oDKYbz25S2cTvg9Mzwg3RMTK1zT1PiGRT-AE3nTA8vSmmw", - "last_4": "1111" - }, - "created_at": "2020-09-29T15:21:46.771Z", - "deadline_duration": "PT5M", - "device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", - "id": "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "location_id": "76C9W6K8CNNQ5", - "order_id": "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", - "payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "reason": "Returning items", - "status": "PENDING", - "updated_at": "2020-09-29T15:21:46.771Z", - "refund_id": "refund_id2" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/create-vendor-request.md b/doc/models/create-vendor-request.md deleted file mode 100644 index a75219ca8..000000000 --- a/doc/models/create-vendor-request.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Create Vendor Request - -Represents an input to a call to [CreateVendor](../../doc/api/vendors.md#create-vendor). - -## Structure - -`CreateVendorRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A client-supplied, universally unique identifier (UUID) to make this [CreateVendor](api-endpoint:Vendors-CreateVendor) call idempotent.

See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
[API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
information.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | -| `vendor` | [`Vendor \| undefined`](../../doc/models/vendor.md) | Optional | Represents a supplier to a seller. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "idempotency_key6", - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } -} -``` - diff --git a/doc/models/create-vendor-response.md b/doc/models/create-vendor-response.md deleted file mode 100644 index 5a715d6aa..000000000 --- a/doc/models/create-vendor-response.md +++ /dev/null @@ -1,50 +0,0 @@ - -# Create Vendor Response - -Represents an output from a call to [CreateVendor](../../doc/api/vendors.md#create-vendor). - -## Structure - -`CreateVendorResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered when the request fails. | -| `vendor` | [`Vendor \| undefined`](../../doc/models/vendor.md) | Optional | Represents a supplier to a seller. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } -} -``` - diff --git a/doc/models/create-webhook-subscription-request.md b/doc/models/create-webhook-subscription-request.md deleted file mode 100644 index 194089d9b..000000000 --- a/doc/models/create-webhook-subscription-request.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Create Webhook Subscription Request - -Creates a [Subscription](../../doc/models/webhook-subscription.md). - -## Structure - -`CreateWebhookSubscriptionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request.
**Constraints**: *Maximum Length*: `45` | -| `subscription` | [`WebhookSubscription`](../../doc/models/webhook-subscription.md) | Required | Represents the details of a webhook subscription, including notification URL,
event types, and signature key. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "63f84c6c-2200-4c99-846c-2670a1311fbf", - "subscription": { - "api_version": "2021-12-15", - "event_types": [ - "payment.created", - "payment.updated" - ], - "name": "Example Webhook Subscription", - "notification_url": "https://example-webhook-url.com", - "id": "id4", - "enabled": false - } -} -``` - diff --git a/doc/models/create-webhook-subscription-response.md b/doc/models/create-webhook-subscription-response.md deleted file mode 100644 index 916d36df5..000000000 --- a/doc/models/create-webhook-subscription-response.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Create Webhook Subscription Response - -Defines the fields that are included in the response body of -a request to the [CreateWebhookSubscription](../../doc/api/webhook-subscriptions.md#create-webhook-subscription) endpoint. - -Note: if there are errors processing the request, the [Subscription](../../doc/models/webhook-subscription.md) will not be -present. - -## Structure - -`CreateWebhookSubscriptionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `subscription` | [`WebhookSubscription \| undefined`](../../doc/models/webhook-subscription.md) | Optional | Represents the details of a webhook subscription, including notification URL,
event types, and signature key. | - -## Example (as JSON) - -```json -{ - "subscription": { - "api_version": "2021-12-15", - "created_at": "2022-01-10 23:29:48 +0000 UTC", - "enabled": true, - "event_types": [ - "payment.created", - "payment.updated" - ], - "id": "wbhk_b35f6b3145074cf9ad513610786c19d5", - "name": "Example Webhook Subscription", - "notification_url": "https://example-webhook-url.com", - "signature_key": "1k9bIJKCeTmSQwyagtNRLg", - "updated_at": "2022-01-10 23:29:48 +0000 UTC" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/currency.md b/doc/models/currency.md deleted file mode 100644 index 3667d5fe5..000000000 --- a/doc/models/currency.md +++ /dev/null @@ -1,198 +0,0 @@ - -# Currency - -Indicates the associated currency for an amount of money. Values correspond -to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). - -## Enumeration - -`Currency` - -## Fields - -| Name | Description | -| --- | --- | -| `UNKNOWN_CURRENCY` | Unknown currency | -| `AED` | United Arab Emirates dirham | -| `AFN` | Afghan afghani | -| `ALL` | Albanian lek | -| `AMD` | Armenian dram | -| `ANG` | Netherlands Antillean guilder | -| `AOA` | Angolan kwanza | -| `ARS` | Argentine peso | -| `AUD` | Australian dollar | -| `AWG` | Aruban florin | -| `AZN` | Azerbaijani manat | -| `BAM` | Bosnia and Herzegovina convertible mark | -| `BBD` | Barbados dollar | -| `BDT` | Bangladeshi taka | -| `BGN` | Bulgarian lev | -| `BHD` | Bahraini dinar | -| `BIF` | Burundian franc | -| `BMD` | Bermudian dollar | -| `BND` | Brunei dollar | -| `BOB` | Boliviano | -| `BOV` | Bolivian Mvdol | -| `BRL` | Brazilian real | -| `BSD` | Bahamian dollar | -| `BTN` | Bhutanese ngultrum | -| `BWP` | Botswana pula | -| `BYR` | Belarusian ruble | -| `BZD` | Belize dollar | -| `CAD` | Canadian dollar | -| `CDF` | Congolese franc | -| `CHE` | WIR Euro | -| `CHF` | Swiss franc | -| `CHW` | WIR Franc | -| `CLF` | Unidad de Fomento | -| `CLP` | Chilean peso | -| `CNY` | Chinese yuan | -| `COP` | Colombian peso | -| `COU` | Unidad de Valor Real | -| `CRC` | Costa Rican colon | -| `CUC` | Cuban convertible peso | -| `CUP` | Cuban peso | -| `CVE` | Cape Verdean escudo | -| `CZK` | Czech koruna | -| `DJF` | Djiboutian franc | -| `DKK` | Danish krone | -| `DOP` | Dominican peso | -| `DZD` | Algerian dinar | -| `EGP` | Egyptian pound | -| `ERN` | Eritrean nakfa | -| `ETB` | Ethiopian birr | -| `EUR` | Euro | -| `FJD` | Fiji dollar | -| `FKP` | Falkland Islands pound | -| `GBP` | Pound sterling | -| `GEL` | Georgian lari | -| `GHS` | Ghanaian cedi | -| `GIP` | Gibraltar pound | -| `GMD` | Gambian dalasi | -| `GNF` | Guinean franc | -| `GTQ` | Guatemalan quetzal | -| `GYD` | Guyanese dollar | -| `HKD` | Hong Kong dollar | -| `HNL` | Honduran lempira | -| `HRK` | Croatian kuna | -| `HTG` | Haitian gourde | -| `HUF` | Hungarian forint | -| `IDR` | Indonesian rupiah | -| `ILS` | Israeli new shekel | -| `INR` | Indian rupee | -| `IQD` | Iraqi dinar | -| `IRR` | Iranian rial | -| `ISK` | Icelandic króna | -| `JMD` | Jamaican dollar | -| `JOD` | Jordanian dinar | -| `JPY` | Japanese yen | -| `KES` | Kenyan shilling | -| `KGS` | Kyrgyzstani som | -| `KHR` | Cambodian riel | -| `KMF` | Comoro franc | -| `KPW` | North Korean won | -| `KRW` | South Korean won | -| `KWD` | Kuwaiti dinar | -| `KYD` | Cayman Islands dollar | -| `KZT` | Kazakhstani tenge | -| `LAK` | Lao kip | -| `LBP` | Lebanese pound | -| `LKR` | Sri Lankan rupee | -| `LRD` | Liberian dollar | -| `LSL` | Lesotho loti | -| `LTL` | Lithuanian litas | -| `LVL` | Latvian lats | -| `LYD` | Libyan dinar | -| `MAD` | Moroccan dirham | -| `MDL` | Moldovan leu | -| `MGA` | Malagasy ariary | -| `MKD` | Macedonian denar | -| `MMK` | Myanmar kyat | -| `MNT` | Mongolian tögrög | -| `MOP` | Macanese pataca | -| `MRO` | Mauritanian ouguiya | -| `MUR` | Mauritian rupee | -| `MVR` | Maldivian rufiyaa | -| `MWK` | Malawian kwacha | -| `MXN` | Mexican peso | -| `MXV` | Mexican Unidad de Inversion | -| `MYR` | Malaysian ringgit | -| `MZN` | Mozambican metical | -| `NAD` | Namibian dollar | -| `NGN` | Nigerian naira | -| `NIO` | Nicaraguan córdoba | -| `NOK` | Norwegian krone | -| `NPR` | Nepalese rupee | -| `NZD` | New Zealand dollar | -| `OMR` | Omani rial | -| `PAB` | Panamanian balboa | -| `PEN` | Peruvian sol | -| `PGK` | Papua New Guinean kina | -| `PHP` | Philippine peso | -| `PKR` | Pakistani rupee | -| `PLN` | Polish złoty | -| `PYG` | Paraguayan guaraní | -| `QAR` | Qatari riyal | -| `RON` | Romanian leu | -| `RSD` | Serbian dinar | -| `RUB` | Russian ruble | -| `RWF` | Rwandan franc | -| `SAR` | Saudi riyal | -| `SBD` | Solomon Islands dollar | -| `SCR` | Seychelles rupee | -| `SDG` | Sudanese pound | -| `SEK` | Swedish krona | -| `SGD` | Singapore dollar | -| `SHP` | Saint Helena pound | -| `SLL` | Sierra Leonean first leone | -| `SLE` | Sierra Leonean second leone | -| `SOS` | Somali shilling | -| `SRD` | Surinamese dollar | -| `SSP` | South Sudanese pound | -| `STD` | São Tomé and Príncipe dobra | -| `SVC` | Salvadoran colón | -| `SYP` | Syrian pound | -| `SZL` | Swazi lilangeni | -| `THB` | Thai baht | -| `TJS` | Tajikstani somoni | -| `TMT` | Turkmenistan manat | -| `TND` | Tunisian dinar | -| `TOP` | Tongan pa'anga | -| `TRY` | Turkish lira | -| `TTD` | Trinidad and Tobago dollar | -| `TWD` | New Taiwan dollar | -| `TZS` | Tanzanian shilling | -| `UAH` | Ukrainian hryvnia | -| `UGX` | Ugandan shilling | -| `USD` | United States dollar | -| `USN` | United States dollar (next day) | -| `USS` | United States dollar (same day) | -| `UYI` | Uruguay Peso en Unidedades Indexadas | -| `UYU` | Uruguyan peso | -| `UZS` | Uzbekistan som | -| `VEF` | Venezuelan bolívar soberano | -| `VND` | Vietnamese đồng | -| `VUV` | Vanuatu vatu | -| `WST` | Samoan tala | -| `XAF` | CFA franc BEAC | -| `XAG` | Silver | -| `XAU` | Gold | -| `XBA` | European Composite Unit | -| `XBB` | European Monetary Unit | -| `XBC` | European Unit of Account 9 | -| `XBD` | European Unit of Account 17 | -| `XCD` | East Caribbean dollar | -| `XDR` | Special drawing rights (International Monetary Fund) | -| `XOF` | CFA franc BCEAO | -| `XPD` | Palladium | -| `XPF` | CFP franc | -| `XPT` | Platinum | -| `XTS` | Code reserved for testing | -| `XXX` | No currency | -| `YER` | Yemeni rial | -| `ZAR` | South African rand | -| `ZMK` | Zambian kwacha | -| `ZMW` | Zambian kwacha | -| `BTC` | Bitcoin | -| `XUS` | USD Coin | - diff --git a/doc/models/custom-attribute-definition-visibility.md b/doc/models/custom-attribute-definition-visibility.md deleted file mode 100644 index 3e51a4af5..000000000 --- a/doc/models/custom-attribute-definition-visibility.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Custom Attribute Definition Visibility - -The level of permission that a seller or other applications requires to -view this custom attribute definition. -The `Visibility` field controls who can read and write the custom attribute values -and custom attribute definition. - -## Enumeration - -`CustomAttributeDefinitionVisibility` - -## Fields - -| Name | Description | -| --- | --- | -| `VISIBILITY_HIDDEN` | The custom attribute definition and values are hidden from the seller (except on export
of all seller data) and other developers. | -| `VISIBILITY_READ_ONLY` | The seller and other developers can read the custom attribute definition and values
on resources. | -| `VISIBILITY_READ_WRITE_VALUES` | The seller and other developers can read the custom attribute definition,
and can read and write values on resources. A custom attribute definition
can only be edited or deleted by the application that created it. | - diff --git a/doc/models/custom-attribute-definition.md b/doc/models/custom-attribute-definition.md deleted file mode 100644 index 2d3f55689..000000000 --- a/doc/models/custom-attribute-definition.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Custom Attribute Definition - -Represents a definition for custom attribute values. A custom attribute definition -specifies the key, visibility, schema, and other properties for a custom attribute. - -## Structure - -`CustomAttributeDefinition` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string \| null \| undefined` | Optional | The identifier
of the custom attribute definition and its corresponding custom attributes. This value
can be a simple key, which is the key that is provided when the custom attribute definition
is created, or a qualified key, if the requesting
application is not the definition owner. The qualified key consists of the application ID
of the custom attribute definition owner
followed by the simple key that was provided when the definition was created. It has the
format application_id:simple key.

The value for a simple key can contain up to 60 alphanumeric characters, periods (.),
underscores (_), and hyphens (-).

This field can not be changed
after the custom attribute definition is created. This field is required when creating
a definition and must be unique per application, seller, and resource type.
**Constraints**: *Minimum Length*: `1`, *Pattern*: `^([a-zA-Z0-9\._-]+:)?[a-zA-Z0-9\._-]{1,60}$` | -| `schema` | `Record \| null \| undefined` | Optional | The JSON schema for the custom attribute definition, which determines the data type of the corresponding custom attributes. For more information,
see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). This field is required when creating a definition. | -| `name` | `string \| null \| undefined` | Optional | The name of the custom attribute definition for API and seller-facing UI purposes. The name must
be unique within the seller and application pair. This field is required if the
`visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
**Constraints**: *Maximum Length*: `255` | -| `description` | `string \| null \| undefined` | Optional | Seller-oriented description of the custom attribute definition, including any constraints
that the seller should observe. May be displayed as a tooltip in Square UIs. This field is
required if the `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
**Constraints**: *Maximum Length*: `255` | -| `visibility` | [`string \| undefined`](../../doc/models/custom-attribute-definition-visibility.md) | Optional | The level of permission that a seller or other applications requires to
view this custom attribute definition.
The `Visibility` field controls who can read and write the custom attribute values
and custom attribute definition. | -| `version` | `number \| undefined` | Optional | Read only. The current version of the custom attribute definition.
The value is incremented each time the custom attribute definition is updated.
When updating a custom attribute definition, you can provide this field
and specify the current version of the custom attribute definition to enable
[optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency).

On writes, this field must be set to the latest version. Stale writes are rejected.

This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads,
see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). | -| `updatedAt` | `string \| undefined` | Optional | The timestamp that indicates when the custom attribute definition was created or most recently updated,
in RFC 3339 format. | -| `createdAt` | `string \| undefined` | Optional | The timestamp that indicates when the custom attribute definition was created, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "key": "key8", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name8", - "description": "description2", - "visibility": "VISIBILITY_READ_WRITE_VALUES" -} -``` - diff --git a/doc/models/custom-attribute-filter.md b/doc/models/custom-attribute-filter.md deleted file mode 100644 index a794d81c1..000000000 --- a/doc/models/custom-attribute-filter.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Custom Attribute Filter - -Supported custom attribute query expressions for calling the -[SearchCatalogItems](../../doc/api/catalog.md#search-catalog-items) -endpoint to search for items or item variations. - -## Structure - -`CustomAttributeFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinitionId` | `string \| null \| undefined` | Optional | A query expression to filter items or item variations by matching their custom attributes'
`custom_attribute_definition_id` property value against the the specified id.
Exactly one of `custom_attribute_definition_id` or `key` must be specified. | -| `key` | `string \| null \| undefined` | Optional | A query expression to filter items or item variations by matching their custom attributes'
`key` property value against the specified key.
Exactly one of `custom_attribute_definition_id` or `key` must be specified. | -| `stringFilter` | `string \| null \| undefined` | Optional | A query expression to filter items or item variations by matching their custom attributes'
`string_value` property value against the specified text.
Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. | -| `numberFilter` | [`Range \| undefined`](../../doc/models/range.md) | Optional | The range of a number value between the specified lower and upper bounds. | -| `selectionUidsFilter` | `string[] \| null \| undefined` | Optional | A query expression to filter items or item variations by matching their custom attributes'
`selection_uid_values` values against the specified selection uids.
Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. | -| `boolFilter` | `boolean \| null \| undefined` | Optional | A query expression to filter items or item variations by matching their custom attributes'
`boolean_value` property values against the specified Boolean expression.
Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition_id": "custom_attribute_definition_id0", - "key": "key2", - "string_filter": "string_filter4", - "number_filter": { - "min": "min8", - "max": "max4" - }, - "selection_uids_filter": [ - "selection_uids_filter0", - "selection_uids_filter9", - "selection_uids_filter8" - ] -} -``` - diff --git a/doc/models/custom-attribute.md b/doc/models/custom-attribute.md deleted file mode 100644 index 49a428aee..000000000 --- a/doc/models/custom-attribute.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Custom Attribute - -A custom attribute value. Each custom attribute value has a corresponding -`CustomAttributeDefinition` object. - -## Structure - -`CustomAttribute` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string \| null \| undefined` | Optional | The identifier
of the custom attribute definition and its corresponding custom attributes. This value
can be a simple key, which is the key that is provided when the custom attribute definition
is created, or a qualified key, if the requesting
application is not the definition owner. The qualified key consists of the application ID
of the custom attribute definition owner
followed by the simple key that was provided when the definition was created. It has the
format application_id:simple key.

The value for a simple key can contain up to 60 alphanumeric characters, periods (.),
underscores (_), and hyphens (-).
**Constraints**: *Minimum Length*: `1`, *Pattern*: `^([a-zA-Z0-9\._-]+:)?[a-zA-Z0-9\._-]{1,60}$` | -| `value` | `unknown \| null \| undefined` | Optional | The value assigned to the custom attribute. It is validated against the custom
attribute definition's schema on write operations. For more information about custom
attribute values,
see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). | -| `version` | `number \| undefined` | Optional | Read only. The current version of the custom attribute. This field is incremented when the custom attribute is changed.
When updating an existing custom attribute value, you can provide this field
and specify the current version of the custom attribute to enable
[optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency).
This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads,
see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). | -| `visibility` | [`string \| undefined`](../../doc/models/custom-attribute-definition-visibility.md) | Optional | The level of permission that a seller or other applications requires to
view this custom attribute definition.
The `Visibility` field controls who can read and write the custom attribute values
and custom attribute definition. | -| `definition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp that indicates when the custom attribute was created or was most recently
updated, in RFC 3339 format. | -| `createdAt` | `string \| undefined` | Optional | The timestamp that indicates when the custom attribute was created, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "key": "key0", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 20, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } -} -``` - diff --git a/doc/models/custom-field.md b/doc/models/custom-field.md deleted file mode 100644 index fde8072e7..000000000 --- a/doc/models/custom-field.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Custom Field - -Describes a custom form field to add to the checkout page to collect more information from buyers during checkout. -For more information, -see [Specify checkout options](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#specify-checkout-options-1). - -## Structure - -`CustomField` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `title` | `string` | Required | The title of the custom field.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `50` | - -## Example (as JSON) - -```json -{ - "title": "title4" -} -``` - diff --git a/doc/models/customer-address-filter.md b/doc/models/customer-address-filter.md deleted file mode 100644 index ed696891f..000000000 --- a/doc/models/customer-address-filter.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Customer Address Filter - -The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue](../../doc/models/customer-custom-attribute-filter-value.md) filter when -searching by an `Address`-type custom attribute. - -## Structure - -`CustomerAddressFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `postalCode` | [`CustomerTextFilter \| undefined`](../../doc/models/customer-text-filter.md) | Optional | A filter to select customers based on exact or fuzzy matching of
customer attributes against a specified query. Depending on the customer attributes,
the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. | -| `country` | [`string \| undefined`](../../doc/models/country.md) | Optional | Indicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | - -## Example (as JSON) - -```json -{ - "postal_code": { - "exact": "exact2", - "fuzzy": "fuzzy2" - }, - "country": "ZM" -} -``` - diff --git a/doc/models/customer-creation-source-filter.md b/doc/models/customer-creation-source-filter.md deleted file mode 100644 index 1a5204fbf..000000000 --- a/doc/models/customer-creation-source-filter.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Customer Creation Source Filter - -The creation source filter. - -If one or more creation sources are set, customer profiles are included in, -or excluded from, the result if they match at least one of the filter criteria. - -## Structure - -`CustomerCreationSourceFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `values` | [`string[] \| null \| undefined`](../../doc/models/customer-creation-source.md) | Optional | The list of creation sources used as filtering criteria.
See [CustomerCreationSource](#type-customercreationsource) for possible values | -| `rule` | [`string \| undefined`](../../doc/models/customer-inclusion-exclusion.md) | Optional | Indicates whether customers should be included in, or excluded from,
the result set when they match the filtering criteria. | - -## Example (as JSON) - -```json -{ - "values": [ - "EGIFTING", - "EMAIL_COLLECTION", - "FEEDBACK" - ], - "rule": "INCLUDE" -} -``` - diff --git a/doc/models/customer-creation-source.md b/doc/models/customer-creation-source.md deleted file mode 100644 index 8a4997f53..000000000 --- a/doc/models/customer-creation-source.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Customer Creation Source - -Indicates the method used to create the customer profile. - -## Enumeration - -`CustomerCreationSource` - -## Fields - -| Name | Description | -| --- | --- | -| `OTHER` | The default creation source. This source is typically used for backward/future
compatibility when the original source of a customer profile is
unrecognized. For example, when older clients do not support newer
source types. | -| `APPOINTMENTS` | The customer profile was created automatically when an appointment
was scheduled. | -| `COUPON` | The customer profile was created automatically when a coupon was issued
using Square Point of Sale. | -| `DELETION_RECOVERY` | The customer profile was restored through Square's deletion recovery
process. | -| `DIRECTORY` | The customer profile was created manually through Square Seller Dashboard or the
Point of Sale application. | -| `EGIFTING` | The customer profile was created automatically when a gift card was
issued using Square Point of Sale. Customer profiles are created for
both the buyer and the recipient of the gift card. | -| `EMAIL_COLLECTION` | The customer profile was created through Square Point of Sale when
signing up for marketing emails during checkout. | -| `FEEDBACK` | The customer profile was created automatically when providing feedback
through a digital receipt. | -| `IMPORT` | The customer profile was created automatically when importing customer
data through Square Seller Dashboard. | -| `INVOICES` | The customer profile was created automatically during an invoice payment. | -| `LOYALTY` | The customer profile was created automatically when customers provide a
phone number for loyalty reward programs during checkout. | -| `MARKETING` | The customer profile was created as the result of a campaign managed
through Square’s Facebook integration. | -| `MERGE` | The customer profile was created as the result of explicitly merging
multiple customer profiles through the Square Seller Dashboard or the Point of
Sale application. | -| `ONLINE_STORE` | The customer profile was created through Square's Online Store solution
(legacy service). | -| `INSTANT_PROFILE` | The customer profile was created automatically as the result of a successful
transaction that did not explicitly link to an existing customer profile. | -| `TERMINAL` | The customer profile was created through Square's Virtual Terminal. | -| `THIRD_PARTY` | The customer profile was created through a Square API call. | -| `THIRD_PARTY_IMPORT` | The customer profile was created by a third-party product and imported
through an official integration. | -| `UNMERGE_RECOVERY` | The customer profile was restored through Square's unmerge recovery
process. | - diff --git a/doc/models/customer-custom-attribute-filter-value.md b/doc/models/customer-custom-attribute-filter-value.md deleted file mode 100644 index 51859c885..000000000 --- a/doc/models/customer-custom-attribute-filter-value.md +++ /dev/null @@ -1,58 +0,0 @@ - -# Customer Custom Attribute Filter Value - -A type-specific filter used in a [custom attribute filter](../../doc/models/customer-custom-attribute-filter.md) to search based on the value -of a customer-related [custom attribute](../../doc/models/custom-attribute.md). - -## Structure - -`CustomerCustomAttributeFilterValue` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `email` | [`CustomerTextFilter \| undefined`](../../doc/models/customer-text-filter.md) | Optional | A filter to select customers based on exact or fuzzy matching of
customer attributes against a specified query. Depending on the customer attributes,
the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. | -| `phone` | [`CustomerTextFilter \| undefined`](../../doc/models/customer-text-filter.md) | Optional | A filter to select customers based on exact or fuzzy matching of
customer attributes against a specified query. Depending on the customer attributes,
the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. | -| `text` | [`CustomerTextFilter \| undefined`](../../doc/models/customer-text-filter.md) | Optional | A filter to select customers based on exact or fuzzy matching of
customer attributes against a specified query. Depending on the customer attributes,
the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. | -| `selection` | [`FilterValue \| undefined`](../../doc/models/filter-value.md) | Optional | A filter to select resources based on an exact field value. For any given
value, the value can only be in one property. Depending on the field, either
all properties can be set or only a subset will be available.

Refer to the documentation of the field. | -| `date` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `number` | [`FloatNumberRange \| undefined`](../../doc/models/float-number-range.md) | Optional | Specifies a decimal number range. | -| `mBoolean` | `boolean \| null \| undefined` | Optional | A filter for a query based on the value of a `Boolean`-type custom attribute. | -| `address` | [`CustomerAddressFilter \| undefined`](../../doc/models/customer-address-filter.md) | Optional | The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue](../../doc/models/customer-custom-attribute-filter-value.md) filter when
searching by an `Address`-type custom attribute. | - -## Example (as JSON) - -```json -{ - "email": { - "exact": "exact6", - "fuzzy": "fuzzy2" - }, - "phone": { - "exact": "exact0", - "fuzzy": "fuzzy6" - }, - "text": { - "exact": "exact0", - "fuzzy": "fuzzy6" - }, - "selection": { - "all": [ - "all1" - ], - "any": [ - "any8", - "any9" - ], - "none": [ - "none3" - ] - }, - "date": { - "start_at": "start_at6", - "end_at": "end_at6" - } -} -``` - diff --git a/doc/models/customer-custom-attribute-filter.md b/doc/models/customer-custom-attribute-filter.md deleted file mode 100644 index b4d968dfb..000000000 --- a/doc/models/customer-custom-attribute-filter.md +++ /dev/null @@ -1,60 +0,0 @@ - -# Customer Custom Attribute Filter - -The custom attribute filter. Use this filter in a set of [custom attribute filters](../../doc/models/customer-custom-attribute-filters.md) to search -based on the value or last updated date of a customer-related [custom attribute](../../doc/models/custom-attribute.md). - -## Structure - -`CustomerCustomAttributeFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `key` | `string` | Required | The `key` of the [custom attribute](entity:CustomAttribute) to filter by. The key is the identifier of the custom attribute
(and the corresponding custom attribute definition) and can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes). | -| `filter` | [`CustomerCustomAttributeFilterValue \| undefined`](../../doc/models/customer-custom-attribute-filter-value.md) | Optional | A type-specific filter used in a [custom attribute filter](../../doc/models/customer-custom-attribute-filter.md) to search based on the value
of a customer-related [custom attribute](../../doc/models/custom-attribute.md). | -| `updatedAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | - -## Example (as JSON) - -```json -{ - "key": "key6", - "filter": { - "email": { - "exact": "exact6", - "fuzzy": "fuzzy2" - }, - "phone": { - "exact": "exact0", - "fuzzy": "fuzzy6" - }, - "text": { - "exact": "exact0", - "fuzzy": "fuzzy6" - }, - "selection": { - "all": [ - "all1" - ], - "any": [ - "any8", - "any9" - ], - "none": [ - "none3" - ] - }, - "date": { - "start_at": "start_at6", - "end_at": "end_at6" - } - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - } -} -``` - diff --git a/doc/models/customer-custom-attribute-filters.md b/doc/models/customer-custom-attribute-filters.md deleted file mode 100644 index 0dfc95656..000000000 --- a/doc/models/customer-custom-attribute-filters.md +++ /dev/null @@ -1,63 +0,0 @@ - -# Customer Custom Attribute Filters - -The custom attribute filters in a set of [customer filters](../../doc/models/customer-filter.md) used in a search query. Use this filter -to search based on [custom attributes](../../doc/models/custom-attribute.md) that are assigned to customer profiles. For more information, see -[Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). - -## Structure - -`CustomerCustomAttributeFilters` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filters` | [`CustomerCustomAttributeFilter[] \| null \| undefined`](../../doc/models/customer-custom-attribute-filter.md) | Optional | The custom attribute filters. Each filter must specify `key` and include the `filter` field with a type-specific filter,
the `updated_at` field, or both. The provided keys must be unique within the list of custom attribute filters. | - -## Example (as JSON) - -```json -{ - "filters": [ - { - "key": "key0", - "filter": { - "email": { - "exact": "exact6", - "fuzzy": "fuzzy2" - }, - "phone": { - "exact": "exact0", - "fuzzy": "fuzzy6" - }, - "text": { - "exact": "exact0", - "fuzzy": "fuzzy6" - }, - "selection": { - "all": [ - "all1" - ], - "any": [ - "any8", - "any9" - ], - "none": [ - "none3" - ] - }, - "date": { - "start_at": "start_at6", - "end_at": "end_at6" - } - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - } - } - ] -} -``` - diff --git a/doc/models/customer-details.md b/doc/models/customer-details.md deleted file mode 100644 index 4e8a07f20..000000000 --- a/doc/models/customer-details.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Customer Details - -Details about the customer making the payment. - -## Structure - -`CustomerDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerInitiated` | `boolean \| null \| undefined` | Optional | Indicates whether the customer initiated the payment. | -| `sellerKeyedIn` | `boolean \| null \| undefined` | Optional | Indicates that the seller keyed in payment details on behalf of the customer.
This is used to flag a payment as Mail Order / Telephone Order (MOTO). | - -## Example (as JSON) - -```json -{ - "customer_initiated": false, - "seller_keyed_in": false -} -``` - diff --git a/doc/models/customer-filter.md b/doc/models/customer-filter.md deleted file mode 100644 index dd0a691b5..000000000 --- a/doc/models/customer-filter.md +++ /dev/null @@ -1,55 +0,0 @@ - -# Customer Filter - -Represents the filtering criteria in a [search query](../../doc/models/customer-query.md) that defines how to filter -customer profiles returned in [SearchCustomers](../../doc/api/customers.md#search-customers) results. - -## Structure - -`CustomerFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `creationSource` | [`CustomerCreationSourceFilter \| undefined`](../../doc/models/customer-creation-source-filter.md) | Optional | The creation source filter.

If one or more creation sources are set, customer profiles are included in,
or excluded from, the result if they match at least one of the filter criteria. | -| `createdAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `updatedAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `emailAddress` | [`CustomerTextFilter \| undefined`](../../doc/models/customer-text-filter.md) | Optional | A filter to select customers based on exact or fuzzy matching of
customer attributes against a specified query. Depending on the customer attributes,
the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. | -| `phoneNumber` | [`CustomerTextFilter \| undefined`](../../doc/models/customer-text-filter.md) | Optional | A filter to select customers based on exact or fuzzy matching of
customer attributes against a specified query. Depending on the customer attributes,
the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. | -| `referenceId` | [`CustomerTextFilter \| undefined`](../../doc/models/customer-text-filter.md) | Optional | A filter to select customers based on exact or fuzzy matching of
customer attributes against a specified query. Depending on the customer attributes,
the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. | -| `groupIds` | [`FilterValue \| undefined`](../../doc/models/filter-value.md) | Optional | A filter to select resources based on an exact field value. For any given
value, the value can only be in one property. Depending on the field, either
all properties can be set or only a subset will be available.

Refer to the documentation of the field. | -| `customAttribute` | [`CustomerCustomAttributeFilters \| undefined`](../../doc/models/customer-custom-attribute-filters.md) | Optional | The custom attribute filters in a set of [customer filters](../../doc/models/customer-filter.md) used in a search query. Use this filter
to search based on [custom attributes](../../doc/models/custom-attribute.md) that are assigned to customer profiles. For more information, see
[Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). | -| `segmentIds` | [`FilterValue \| undefined`](../../doc/models/filter-value.md) | Optional | A filter to select resources based on an exact field value. For any given
value, the value can only be in one property. Depending on the field, either
all properties can be set or only a subset will be available.

Refer to the documentation of the field. | - -## Example (as JSON) - -```json -{ - "creation_source": { - "values": [ - "THIRD_PARTY_IMPORT", - "THIRD_PARTY", - "TERMINAL" - ], - "rule": "INCLUDE" - }, - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "email_address": { - "exact": "exact2", - "fuzzy": "fuzzy8" - }, - "phone_number": { - "exact": "exact2", - "fuzzy": "fuzzy8" - } -} -``` - diff --git a/doc/models/customer-group.md b/doc/models/customer-group.md deleted file mode 100644 index af164cc14..000000000 --- a/doc/models/customer-group.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Customer Group - -Represents a group of customer profiles. - -Customer groups can be created, be modified, and have their membership defined using -the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. - -## Structure - -`CustomerGroup` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique Square-generated ID for the customer group.
**Constraints**: *Maximum Length*: `255` | -| `name` | `string` | Required | The name of the customer group. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the customer group was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the customer group was last updated, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "name": "name0", - "created_at": "created_at8", - "updated_at": "updated_at6" -} -``` - diff --git a/doc/models/customer-inclusion-exclusion.md b/doc/models/customer-inclusion-exclusion.md deleted file mode 100644 index 037c202ce..000000000 --- a/doc/models/customer-inclusion-exclusion.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Customer Inclusion Exclusion - -Indicates whether customers should be included in, or excluded from, -the result set when they match the filtering criteria. - -## Enumeration - -`CustomerInclusionExclusion` - -## Fields - -| Name | Description | -| --- | --- | -| `INCLUDE` | Customers should be included in the result set when they match the
filtering criteria. | -| `EXCLUDE` | Customers should be excluded from the result set when they match
the filtering criteria. | - diff --git a/doc/models/customer-preferences.md b/doc/models/customer-preferences.md deleted file mode 100644 index 6ba15e690..000000000 --- a/doc/models/customer-preferences.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Customer Preferences - -Represents communication preferences for the customer profile. - -## Structure - -`CustomerPreferences` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `emailUnsubscribed` | `boolean \| null \| undefined` | Optional | Indicates whether the customer has unsubscribed from marketing campaign emails. A value of `true` means that the customer chose to opt out of email marketing from the current Square seller or from all Square sellers. This value is read-only from the Customers API. | - -## Example (as JSON) - -```json -{ - "email_unsubscribed": false -} -``` - diff --git a/doc/models/customer-query.md b/doc/models/customer-query.md deleted file mode 100644 index 34ba40730..000000000 --- a/doc/models/customer-query.md +++ /dev/null @@ -1,53 +0,0 @@ - -# Customer Query - -Represents filtering and sorting criteria for a [SearchCustomers](../../doc/api/customers.md#search-customers) request. - -## Structure - -`CustomerQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`CustomerFilter \| undefined`](../../doc/models/customer-filter.md) | Optional | Represents the filtering criteria in a [search query](../../doc/models/customer-query.md) that defines how to filter
customer profiles returned in [SearchCustomers](../../doc/api/customers.md#search-customers) results. | -| `sort` | [`CustomerSort \| undefined`](../../doc/models/customer-sort.md) | Optional | Represents the sorting criteria in a [search query](../../doc/models/customer-query.md) that defines how to sort
customer profiles returned in [SearchCustomers](../../doc/api/customers.md#search-customers) results. | - -## Example (as JSON) - -```json -{ - "filter": { - "creation_source": { - "values": [ - "THIRD_PARTY_IMPORT", - "THIRD_PARTY", - "TERMINAL" - ], - "rule": "INCLUDE" - }, - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "email_address": { - "exact": "exact2", - "fuzzy": "fuzzy8" - }, - "phone_number": { - "exact": "exact2", - "fuzzy": "fuzzy8" - } - }, - "sort": { - "field": "DEFAULT", - "order": "DESC" - } -} -``` - diff --git a/doc/models/customer-segment.md b/doc/models/customer-segment.md deleted file mode 100644 index ddfa75168..000000000 --- a/doc/models/customer-segment.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Customer Segment - -Represents a group of customer profiles that match one or more predefined filter criteria. - -Segments (also known as Smart Groups) are defined and created within the Customer Directory in the -Square Seller Dashboard or Point of Sale. - -## Structure - -`CustomerSegment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique Square-generated ID for the segment.
**Constraints**: *Maximum Length*: `255` | -| `name` | `string` | Required | The name of the segment. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the segment was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the segment was last updated, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "name": "name0", - "created_at": "created_at8", - "updated_at": "updated_at6" -} -``` - diff --git a/doc/models/customer-sort-field.md b/doc/models/customer-sort-field.md deleted file mode 100644 index 7052f404d..000000000 --- a/doc/models/customer-sort-field.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Customer Sort Field - -Specifies customer attributes as the sort key to customer profiles returned from a search. - -## Enumeration - -`CustomerSortField` - -## Fields - -| Name | Description | -| --- | --- | -| `DEFAULT` | Use the default sort key. By default, customers are sorted
alphanumerically by concatenating their `given_name` and `family_name`. If
neither name field is set, string comparison is performed using one of the
remaining fields in the following order: `company_name`, `email`,
`phone_number`. | -| `CREATED_AT` | Use the creation date attribute (`created_at`) of customer profiles as the sort key. | - diff --git a/doc/models/customer-sort.md b/doc/models/customer-sort.md deleted file mode 100644 index 4139db24e..000000000 --- a/doc/models/customer-sort.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Customer Sort - -Represents the sorting criteria in a [search query](../../doc/models/customer-query.md) that defines how to sort -customer profiles returned in [SearchCustomers](../../doc/api/customers.md#search-customers) results. - -## Structure - -`CustomerSort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `field` | [`string \| undefined`](../../doc/models/customer-sort-field.md) | Optional | Specifies customer attributes as the sort key to customer profiles returned from a search. | -| `order` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "field": "DEFAULT", - "order": "DESC" -} -``` - diff --git a/doc/models/customer-tax-ids.md b/doc/models/customer-tax-ids.md deleted file mode 100644 index 2bc2c2544..000000000 --- a/doc/models/customer-tax-ids.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Customer Tax Ids - -Represents the tax ID associated with a [customer profile](../../doc/models/customer.md). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. -For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). - -## Structure - -`CustomerTaxIds` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `euVat` | `string \| null \| undefined` | Optional | The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only.
**Constraints**: *Maximum Length*: `20` | - -## Example (as JSON) - -```json -{ - "eu_vat": "eu_vat6" -} -``` - diff --git a/doc/models/customer-text-filter.md b/doc/models/customer-text-filter.md deleted file mode 100644 index 007c22a41..000000000 --- a/doc/models/customer-text-filter.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Customer Text Filter - -A filter to select customers based on exact or fuzzy matching of -customer attributes against a specified query. Depending on the customer attributes, -the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - -## Structure - -`CustomerTextFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `exact` | `string \| null \| undefined` | Optional | Use the exact filter to select customers whose attributes match exactly the specified query. | -| `fuzzy` | `string \| null \| undefined` | Optional | Use the fuzzy filter to select customers whose attributes match the specified query
in a fuzzy manner. When the fuzzy option is used, search queries are tokenized, and then
each query token must be matched somewhere in the searched attribute. For single token queries,
this is effectively the same behavior as a partial match operation. | - -## Example (as JSON) - -```json -{ - "exact": "exact4", - "fuzzy": "fuzzy0" -} -``` - diff --git a/doc/models/customer.md b/doc/models/customer.md deleted file mode 100644 index a85e6ea1f..000000000 --- a/doc/models/customer.md +++ /dev/null @@ -1,54 +0,0 @@ - -# Customer - -Represents a Square customer profile in the Customer Directory of a Square seller. - -## Structure - -`Customer` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique Square-assigned ID for the customer profile.

If you need this ID for an API request, use the ID returned when you created the customer profile or call the [SearchCustomers](api-endpoint:Customers-SearchCustomers)
or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the customer profile was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the customer profile was last updated, in RFC 3339 format. | -| `cards` | [`Card[] \| null \| undefined`](../../doc/models/card.md) | Optional | Payment details of the credit, debit, and gift cards stored on file for the customer profile.

DEPRECATED at version 2021-06-16 and will be RETIRED at version 2024-12-18. Replaced by calling [ListCards](api-endpoint:Cards-ListCards) (for credit and debit cards on file)
or [ListGiftCards](api-endpoint:GiftCards-ListGiftCards) (for gift cards on file) and including the `customer_id` query parameter.
For more information, see [Migration notes](https://developer.squareup.com/docs/customers-api/what-it-does#migrate-customer-cards). | -| `givenName` | `string \| null \| undefined` | Optional | The given name (that is, the first name) associated with the customer profile. | -| `familyName` | `string \| null \| undefined` | Optional | The family name (that is, the last name) associated with the customer profile. | -| `nickname` | `string \| null \| undefined` | Optional | A nickname for the customer profile. | -| `companyName` | `string \| null \| undefined` | Optional | A business name associated with the customer profile. | -| `emailAddress` | `string \| null \| undefined` | Optional | The email address associated with the customer profile. | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number associated with the customer profile. | -| `birthday` | `string \| null \| undefined` | Optional | The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-21`
represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year). | -| `referenceId` | `string \| null \| undefined` | Optional | An optional second ID used to associate the customer profile with an
entity in another system. | -| `note` | `string \| null \| undefined` | Optional | A custom note associated with the customer profile. | -| `preferences` | [`CustomerPreferences \| undefined`](../../doc/models/customer-preferences.md) | Optional | Represents communication preferences for the customer profile. | -| `creationSource` | [`string \| undefined`](../../doc/models/customer-creation-source.md) | Optional | Indicates the method used to create the customer profile. | -| `groupIds` | `string[] \| null \| undefined` | Optional | The IDs of [customer groups](entity:CustomerGroup) the customer belongs to. | -| `segmentIds` | `string[] \| null \| undefined` | Optional | The IDs of [customer segments](entity:CustomerSegment) the customer belongs to. | -| `version` | `bigint \| undefined` | Optional | The Square-assigned version number of the customer profile. The version number is incremented each time an update is committed to the customer profile, except for changes to customer segment membership and cards on file. | -| `taxIds` | [`CustomerTaxIds \| undefined`](../../doc/models/customer-tax-ids.md) | Optional | Represents the tax ID associated with a [customer profile](../../doc/models/customer.md). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). | - -## Example (as JSON) - -```json -{ - "id": "id8", - "created_at": "created_at6", - "updated_at": "updated_at6", - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ], - "given_name": "given_name0" -} -``` - diff --git a/doc/models/data-collection-options-input-type.md b/doc/models/data-collection-options-input-type.md deleted file mode 100644 index 083724f8c..000000000 --- a/doc/models/data-collection-options-input-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# 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 deleted file mode 100644 index dd683b10b..000000000 --- a/doc/models/data-collection-options.md +++ /dev/null @@ -1,29 +0,0 @@ - -# 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": "body4", - "input_type": "EMAIL", - "collected_data": { - "input_text": "input_text0" - } -} -``` - diff --git a/doc/models/date-range.md b/doc/models/date-range.md deleted file mode 100644 index 23a59f4b5..000000000 --- a/doc/models/date-range.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Date Range - -A range defined by two dates. Used for filtering a query for Connect v2 -objects that have date properties. - -## Structure - -`DateRange` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `startDate` | `string \| null \| undefined` | Optional | A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601
extended format for calendar dates.
The beginning of a date range (inclusive). | -| `endDate` | `string \| null \| undefined` | Optional | A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601
extended format for calendar dates.
The end of a date range (inclusive). | - -## Example (as JSON) - -```json -{ - "start_date": "start_date0", - "end_date": "end_date6" -} -``` - diff --git a/doc/models/day-of-week.md b/doc/models/day-of-week.md deleted file mode 100644 index 2ce16311e..000000000 --- a/doc/models/day-of-week.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Day of Week - -Indicates the specific day of the week. - -## Enumeration - -`DayOfWeek` - -## Fields - -| Name | Description | -| --- | --- | -| `SUN` | Sunday | -| `MON` | Monday | -| `TUE` | Tuesday | -| `WED` | Wednesday | -| `THU` | Thursday | -| `FRI` | Friday | -| `SAT` | Saturday | - diff --git a/doc/models/delete-booking-custom-attribute-definition-response.md b/doc/models/delete-booking-custom-attribute-definition-response.md deleted file mode 100644 index 87968c598..000000000 --- a/doc/models/delete-booking-custom-attribute-definition-response.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Delete Booking Custom Attribute Definition Response - -Represents a [DeleteBookingCustomAttributeDefinition](../../doc/api/booking-custom-attributes.md#delete-booking-custom-attribute-definition) response -containing error messages when errors occurred during the request. The successful response does not contain any payload. - -## Structure - -`DeleteBookingCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [] -} -``` - diff --git a/doc/models/delete-booking-custom-attribute-response.md b/doc/models/delete-booking-custom-attribute-response.md deleted file mode 100644 index 011bf4ec1..000000000 --- a/doc/models/delete-booking-custom-attribute-response.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Delete Booking Custom Attribute Response - -Represents a [DeleteBookingCustomAttribute](../../doc/api/booking-custom-attributes.md#delete-booking-custom-attribute) response. -Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. - -## Structure - -`DeleteBookingCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [] -} -``` - diff --git a/doc/models/delete-break-type-response.md b/doc/models/delete-break-type-response.md deleted file mode 100644 index dcc745f8c..000000000 --- a/doc/models/delete-break-type-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Delete Break Type Response - -The response to a request to delete a `BreakType`. The response might contain a set -of `Error` objects if the request resulted in errors. - -## Structure - -`DeleteBreakTypeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-catalog-object-response.md b/doc/models/delete-catalog-object-response.md deleted file mode 100644 index fcfa42190..000000000 --- a/doc/models/delete-catalog-object-response.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Delete Catalog Object Response - -## Structure - -`DeleteCatalogObjectResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `deletedObjectIds` | `string[] \| undefined` | Optional | The IDs of all catalog objects deleted by this request.
Multiple IDs may be returned when associated objects are also deleted, for example
a catalog item variation will be deleted (and its ID included in this field)
when its parent catalog item is deleted. | -| `deletedAt` | `string \| undefined` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
of this deletion in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. | - -## Example (as JSON) - -```json -{ - "deleted_at": "2016-11-16T22:25:24.878Z", - "deleted_object_ids": [ - "7SB3ZQYJ5GDMVFL7JK46JCHT", - "KQLFFHA6K6J3YQAQAWDQAL57" - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-customer-card-response.md b/doc/models/delete-customer-card-response.md deleted file mode 100644 index 60711c324..000000000 --- a/doc/models/delete-customer-card-response.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Delete Customer Card Response - -Defines the fields that are included in the response body of -a request to the `DeleteCustomerCard` endpoint. - -## Structure - -`DeleteCustomerCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-customer-custom-attribute-definition-response.md b/doc/models/delete-customer-custom-attribute-definition-response.md deleted file mode 100644 index fde7bb47a..000000000 --- a/doc/models/delete-customer-custom-attribute-definition-response.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Delete Customer Custom Attribute Definition Response - -Represents a response from a delete request containing error messages if there are any. - -## Structure - -`DeleteCustomerCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-customer-custom-attribute-response.md b/doc/models/delete-customer-custom-attribute-response.md deleted file mode 100644 index d88094899..000000000 --- a/doc/models/delete-customer-custom-attribute-response.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Delete Customer Custom Attribute Response - -Represents a [DeleteCustomerCustomAttribute](../../doc/api/customer-custom-attributes.md#delete-customer-custom-attribute) response. -Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. - -## Structure - -`DeleteCustomerCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-customer-group-response.md b/doc/models/delete-customer-group-response.md deleted file mode 100644 index 4b46d95c9..000000000 --- a/doc/models/delete-customer-group-response.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Delete Customer Group Response - -Defines the fields that are included in the response body of -a request to the [DeleteCustomerGroup](../../doc/api/customer-groups.md#delete-customer-group) endpoint. - -## Structure - -`DeleteCustomerGroupResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-customer-request.md b/doc/models/delete-customer-request.md deleted file mode 100644 index 4649ccd31..000000000 --- a/doc/models/delete-customer-request.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Delete Customer Request - -Defines the fields that are included in a request to the `DeleteCustomer` -endpoint. - -## Structure - -`DeleteCustomerRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `bigint \| undefined` | Optional | The current version of the customer profile.

As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). | - -## Example (as JSON) - -```json -{ - "version": 222 -} -``` - diff --git a/doc/models/delete-customer-response.md b/doc/models/delete-customer-response.md deleted file mode 100644 index 22ee9fcc7..000000000 --- a/doc/models/delete-customer-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Delete Customer Response - -Defines the fields that are included in the response body of -a request to the `DeleteCustomer` endpoint. - -## Structure - -`DeleteCustomerResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-dispute-evidence-response.md b/doc/models/delete-dispute-evidence-response.md deleted file mode 100644 index aed3c07c2..000000000 --- a/doc/models/delete-dispute-evidence-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Delete Dispute Evidence Response - -Defines the fields in a `DeleteDisputeEvidence` response. - -## Structure - -`DeleteDisputeEvidenceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-invoice-attachment-response.md b/doc/models/delete-invoice-attachment-response.md deleted file mode 100644 index 0e244b900..000000000 --- a/doc/models/delete-invoice-attachment-response.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Delete Invoice Attachment Response - -Represents a [DeleteInvoiceAttachment](../../doc/api/invoices.md#delete-invoice-attachment) response. - -## Structure - -`DeleteInvoiceAttachmentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-invoice-request.md b/doc/models/delete-invoice-request.md deleted file mode 100644 index e3d2c22e5..000000000 --- a/doc/models/delete-invoice-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Delete Invoice Request - -Describes a `DeleteInvoice` request. - -## Structure - -`DeleteInvoiceRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number \| undefined` | Optional | The version of the [invoice](entity:Invoice) to delete.
If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or
[ListInvoices](api-endpoint:Invoices-ListInvoices). | - -## Example (as JSON) - -```json -{ - "version": 26 -} -``` - diff --git a/doc/models/delete-invoice-response.md b/doc/models/delete-invoice-response.md deleted file mode 100644 index ddae17e14..000000000 --- a/doc/models/delete-invoice-response.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Delete Invoice Response - -Describes a `DeleteInvoice` response. - -## Structure - -`DeleteInvoiceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-location-custom-attribute-definition-response.md b/doc/models/delete-location-custom-attribute-definition-response.md deleted file mode 100644 index fd7a36cbb..000000000 --- a/doc/models/delete-location-custom-attribute-definition-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Delete Location Custom Attribute Definition Response - -Represents a response from a delete request containing error messages if there are any. - -## Structure - -`DeleteLocationCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-location-custom-attribute-response.md b/doc/models/delete-location-custom-attribute-response.md deleted file mode 100644 index 0decffcea..000000000 --- a/doc/models/delete-location-custom-attribute-response.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Delete Location Custom Attribute Response - -Represents a [DeleteLocationCustomAttribute](../../doc/api/location-custom-attributes.md#delete-location-custom-attribute) response. -Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. - -## Structure - -`DeleteLocationCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-loyalty-reward-response.md b/doc/models/delete-loyalty-reward-response.md deleted file mode 100644 index 5bddf0fb3..000000000 --- a/doc/models/delete-loyalty-reward-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Delete Loyalty Reward Response - -A response returned by the API call. - -## Structure - -`DeleteLoyaltyRewardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-merchant-custom-attribute-definition-response.md b/doc/models/delete-merchant-custom-attribute-definition-response.md deleted file mode 100644 index dece480de..000000000 --- a/doc/models/delete-merchant-custom-attribute-definition-response.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Delete Merchant Custom Attribute Definition Response - -Represents a response from a delete request containing error messages if there are any. - -## Structure - -`DeleteMerchantCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-merchant-custom-attribute-response.md b/doc/models/delete-merchant-custom-attribute-response.md deleted file mode 100644 index 1aec4e683..000000000 --- a/doc/models/delete-merchant-custom-attribute-response.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Delete Merchant Custom Attribute Response - -Represents a [DeleteMerchantCustomAttribute](../../doc/api/merchant-custom-attributes.md#delete-merchant-custom-attribute) response. -Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. - -## Structure - -`DeleteMerchantCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-order-custom-attribute-definition-response.md b/doc/models/delete-order-custom-attribute-definition-response.md deleted file mode 100644 index c7e39e5e1..000000000 --- a/doc/models/delete-order-custom-attribute-definition-response.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Delete Order Custom Attribute Definition Response - -Represents a response from deleting an order custom attribute definition. - -## Structure - -`DeleteOrderCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-order-custom-attribute-response.md b/doc/models/delete-order-custom-attribute-response.md deleted file mode 100644 index 0d2f6b78e..000000000 --- a/doc/models/delete-order-custom-attribute-response.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Delete Order Custom Attribute Response - -Represents a response from deleting an order custom attribute. - -## Structure - -`DeleteOrderCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-payment-link-response.md b/doc/models/delete-payment-link-response.md deleted file mode 100644 index 5aaf2c858..000000000 --- a/doc/models/delete-payment-link-response.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Delete Payment Link Response - -## Structure - -`DeletePaymentLinkResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | - | -| `id` | `string \| undefined` | Optional | The ID of the link that is deleted. | -| `cancelledOrderId` | `string \| undefined` | Optional | The ID of the order that is canceled. When a payment link is deleted, Square updates the
the `state` (of the order that the checkout link created) to CANCELED. | - -## Example (as JSON) - -```json -{ - "cancelled_order_id": "asx8LgZ6MRzD0fObfkJ6obBmSh4F", - "id": "MQASNYL6QB6DFCJ3", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-shift-response.md b/doc/models/delete-shift-response.md deleted file mode 100644 index 526c8d3b0..000000000 --- a/doc/models/delete-shift-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Delete Shift Response - -The response to a request to delete a `Shift`. The response might contain a set of -`Error` objects if the request resulted in errors. - -## Structure - -`DeleteShiftResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-snippet-response.md b/doc/models/delete-snippet-response.md deleted file mode 100644 index a29ed939e..000000000 --- a/doc/models/delete-snippet-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Delete Snippet Response - -Represents a `DeleteSnippet` response. - -## Structure - -`DeleteSnippetResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-subscription-action-response.md b/doc/models/delete-subscription-action-response.md deleted file mode 100644 index 75a13b0a6..000000000 --- a/doc/models/delete-subscription-action-response.md +++ /dev/null @@ -1,62 +0,0 @@ - -# Delete Subscription Action Response - -Defines output parameters in a response of the [DeleteSubscriptionAction](../../doc/api/subscriptions.md#delete-subscription-action) -endpoint. - -## Structure - -`DeleteSubscriptionActionResponse` - -## Fields - -| 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 purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | - -## Example (as JSON) - -```json -{ - "subscription": { - "card_id": "ccof:IkWfpLj4tNHMyFii3GB", - "charged_through_date": "2023-11-20", - "created_at": "2022-07-27T21:53:10Z", - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "id": "8151fc89-da15-4eb9-a685-1a70883cebfc", - "invoice_ids": [ - "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA" - ], - "location_id": "S8GWD5R9QB376", - "paid_until_date": "2024-08-01", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "price_override_money": { - "amount": 25000, - "currency": "USD" - }, - "source": { - "name": "My Application" - }, - "start_date": "2022-07-27", - "status": "ACTIVE", - "timezone": "America/Los_Angeles" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/delete-webhook-subscription-response.md b/doc/models/delete-webhook-subscription-response.md deleted file mode 100644 index bd21a6455..000000000 --- a/doc/models/delete-webhook-subscription-response.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Delete Webhook Subscription Response - -Defines the fields that are included in the response body of -a request to the [DeleteWebhookSubscription](../../doc/api/webhook-subscriptions.md#delete-webhook-subscription) endpoint. - -## Structure - -`DeleteWebhookSubscriptionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/deprecated-create-dispute-evidence-file-request.md b/doc/models/deprecated-create-dispute-evidence-file-request.md deleted file mode 100644 index fc2dd1f57..000000000 --- a/doc/models/deprecated-create-dispute-evidence-file-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Deprecated Create Dispute Evidence File Request - -Defines the parameters for a `DeprecatedCreateDisputeEvidenceFile` request. - -## Structure - -`DeprecatedCreateDisputeEvidenceFileRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | The Unique ID. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | -| `evidenceType` | [`string \| undefined`](../../doc/models/dispute-evidence-type.md) | Optional | The type of the dispute evidence. | -| `contentType` | `string \| null \| undefined` | Optional | The MIME type of the uploaded file.
The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "idempotency_key4", - "evidence_type": "ONLINE_OR_APP_ACCESS_LOG", - "content_type": "content_type2" -} -``` - diff --git a/doc/models/deprecated-create-dispute-evidence-file-response.md b/doc/models/deprecated-create-dispute-evidence-file-response.md deleted file mode 100644 index 059d22ea5..000000000 --- a/doc/models/deprecated-create-dispute-evidence-file-response.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Deprecated Create Dispute Evidence File Response - -Defines the fields in a `DeprecatedCreateDisputeEvidenceFile` response. - -## Structure - -`DeprecatedCreateDisputeEvidenceFileResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `evidence` | [`DisputeEvidence \| undefined`](../../doc/models/dispute-evidence.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "evidence": { - "dispute_id": "bVTprrwk0gygTLZ96VX1oB", - "evidence_file": { - "filename": "evidence.tiff", - "filetype": "image/tiff" - }, - "evidence_id": "TOomLInj6iWmP3N8qfCXrB", - "evidence_type": "GENERIC_EVIDENCE", - "uploaded_at": "2018-10-18T16:01:10.000Z", - "id": "id2", - "evidence_text": "evidence_text6" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/deprecated-create-dispute-evidence-text-request.md b/doc/models/deprecated-create-dispute-evidence-text-request.md deleted file mode 100644 index 70a3a4815..000000000 --- a/doc/models/deprecated-create-dispute-evidence-text-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Deprecated Create Dispute Evidence Text Request - -Defines the parameters for a `DeprecatedCreateDisputeEvidenceText` request. - -## Structure - -`DeprecatedCreateDisputeEvidenceTextRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | The Unique ID. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | -| `evidenceType` | [`string \| undefined`](../../doc/models/dispute-evidence-type.md) | Optional | The type of the dispute evidence. | -| `evidenceText` | `string` | Required | The evidence string.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `500` | - -## Example (as JSON) - -```json -{ - "evidence_text": "1Z8888888888888888", - "evidence_type": "TRACKING_NUMBER", - "idempotency_key": "ed3ee3933d946f1514d505d173c82648" -} -``` - diff --git a/doc/models/deprecated-create-dispute-evidence-text-response.md b/doc/models/deprecated-create-dispute-evidence-text-response.md deleted file mode 100644 index 118b34219..000000000 --- a/doc/models/deprecated-create-dispute-evidence-text-response.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Deprecated Create Dispute Evidence Text Response - -Defines the fields in a `DeprecatedCreateDisputeEvidenceText` response. - -## Structure - -`DeprecatedCreateDisputeEvidenceTextResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `evidence` | [`DisputeEvidence \| undefined`](../../doc/models/dispute-evidence.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "evidence": { - "dispute_id": "bVTprrwk0gygTLZ96VX1oB", - "evidence_text": "The customer purchased the item twice, on April 11 and April 28.", - "evidence_type": "REBUTTAL_EXPLANATION", - "id": "TOomLInj6iWmP3N8qfCXrB", - "uploaded_at": "2022-05-18T16:01:10.000Z", - "evidence_id": "evidence_id0", - "evidence_file": { - "filename": "filename8", - "filetype": "filetype8" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/destination-details-card-refund-details.md b/doc/models/destination-details-card-refund-details.md deleted file mode 100644 index de52a9142..000000000 --- a/doc/models/destination-details-card-refund-details.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Destination Details Card Refund Details - -## Structure - -`DestinationDetailsCardRefundDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `card` | [`Card \| undefined`](../../doc/models/card.md) | Optional | Represents the payment details of a card to be used for payments. These
details are determined by the payment token generated by Web Payments SDK. | -| `entryMethod` | `string \| null \| undefined` | Optional | The method used to enter the card's details for the refund. The method can be
`KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
**Constraints**: *Maximum Length*: `50` | -| `authResultCode` | `string \| null \| undefined` | Optional | The authorization code provided by the issuer when a refund is approved.
**Constraints**: *Maximum Length*: `10` | - -## Example (as JSON) - -```json -{ - "card": { - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "entry_method": "entry_method4", - "auth_result_code": "auth_result_code6" -} -``` - diff --git a/doc/models/destination-details-cash-refund-details.md b/doc/models/destination-details-cash-refund-details.md deleted file mode 100644 index 3d0899025..000000000 --- a/doc/models/destination-details-cash-refund-details.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Destination Details Cash Refund Details - -Stores details about a cash refund. Contains only non-confidential information. - -## Structure - -`DestinationDetailsCashRefundDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sellerSuppliedMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `changeBackMoney` | [`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 -{ - "seller_supplied_money": { - "amount": 36, - "currency": "MKD" - }, - "change_back_money": { - "amount": 78, - "currency": "XBD" - } -} -``` - diff --git a/doc/models/destination-details-external-refund-details.md b/doc/models/destination-details-external-refund-details.md deleted file mode 100644 index 88a80610d..000000000 --- a/doc/models/destination-details-external-refund-details.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Destination Details External Refund Details - -Stores details about an external refund. Contains only non-confidential information. - -## Structure - -`DestinationDetailsExternalRefundDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | `string` | Required | The type of external refund the seller paid to the buyer. It can be one of the
following:

- CHECK - Refunded using a physical check.
- BANK_TRANSFER - Refunded using external bank transfer.
- OTHER\_GIFT\_CARD - Refunded using a non-Square gift card.
- CRYPTO - Refunded using a crypto currency.
- SQUARE_CASH - Refunded using Square Cash App.
- SOCIAL - Refunded using peer-to-peer payment applications.
- EXTERNAL - A third-party application gathered this refund outside of Square.
- EMONEY - Refunded using an E-money provider.
- CARD - A credit or debit card that Square does not support.
- STORED_BALANCE - Use for house accounts, store credit, and so forth.
- FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals
- OTHER - A type not listed here.
**Constraints**: *Maximum Length*: `50` | -| `source` | `string` | Required | A description of the external refund source. For example,
"Food Delivery Service".
**Constraints**: *Maximum Length*: `255` | -| `sourceId` | `string \| null \| undefined` | Optional | An ID to associate the refund to its originating source.
**Constraints**: *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "type": "type4", - "source": "source2", - "source_id": "source_id0" -} -``` - diff --git a/doc/models/destination-details.md b/doc/models/destination-details.md deleted file mode 100644 index 5bf5ed97f..000000000 --- a/doc/models/destination-details.md +++ /dev/null @@ -1,50 +0,0 @@ - -# Destination Details - -Details about a refund's destination. - -## Structure - -`DestinationDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cardDetails` | [`DestinationDetailsCardRefundDetails \| undefined`](../../doc/models/destination-details-card-refund-details.md) | Optional | - | -| `cashDetails` | [`DestinationDetailsCashRefundDetails \| undefined`](../../doc/models/destination-details-cash-refund-details.md) | Optional | Stores details about a cash refund. Contains only non-confidential information. | -| `externalDetails` | [`DestinationDetailsExternalRefundDetails \| undefined`](../../doc/models/destination-details-external-refund-details.md) | Optional | Stores details about an external refund. Contains only non-confidential information. | - -## Example (as JSON) - -```json -{ - "card_details": { - "card": { - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "entry_method": "entry_method8", - "auth_result_code": "auth_result_code0" - }, - "cash_details": { - "seller_supplied_money": { - "amount": 36, - "currency": "MKD" - }, - "change_back_money": { - "amount": 78, - "currency": "XBD" - } - }, - "external_details": { - "type": "type6", - "source": "source0", - "source_id": "source_id8" - } -} -``` - diff --git a/doc/models/destination-type.md b/doc/models/destination-type.md deleted file mode 100644 index f1d7bddd1..000000000 --- a/doc/models/destination-type.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Destination Type - -List of possible destinations against which a payout can be made. - -## Enumeration - -`DestinationType` - -## Fields - -| Name | Description | -| --- | --- | -| `BANK_ACCOUNT` | An external bank account outside of Square. | -| `CARD` | An external card outside of Square used for the transfer. | -| `SQUARE_BALANCE` | | -| `SQUARE_STORED_BALANCE` | Square Checking or Savings account (US), Square Card (CA) | - diff --git a/doc/models/destination.md b/doc/models/destination.md deleted file mode 100644 index e4916e3ea..000000000 --- a/doc/models/destination.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Destination - -Information about the destination against which the payout was made. - -## Structure - -`Destination` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string \| undefined`](../../doc/models/destination-type.md) | Optional | List of possible destinations against which a payout can be made. | -| `id` | `string \| undefined` | Optional | Square issued unique ID (also known as the instrument ID) associated with this destination. | - -## Example (as JSON) - -```json -{ - "type": "SQUARE_BALANCE", - "id": "id6" -} -``` - diff --git a/doc/models/device-attributes-device-type.md b/doc/models/device-attributes-device-type.md deleted file mode 100644 index 19c965a27..000000000 --- a/doc/models/device-attributes-device-type.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Device Attributes Device Type - -An enum identifier of the device type. - -## Enumeration - -`DeviceAttributesDeviceType` - -## Fields - -| Name | -| --- | -| `TERMINAL` | - diff --git a/doc/models/device-attributes.md b/doc/models/device-attributes.md deleted file mode 100644 index bf98cd298..000000000 --- a/doc/models/device-attributes.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Device Attributes - -## Structure - -`DeviceAttributes` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | `string` | Required, Constant | An enum identifier of the device type.
**Default**: `'TERMINAL'` | -| `manufacturer` | `string` | Required | The maker of the device. | -| `model` | `string \| null \| undefined` | Optional | The specific model of the device. | -| `name` | `string \| null \| undefined` | Optional | A seller-specified name for the device. | -| `manufacturersId` | `string \| null \| undefined` | Optional | The manufacturer-supplied identifier for the device (where available). In many cases,
this identifier will be a serial number. | -| `updatedAt` | `string \| undefined` | Optional | The RFC 3339-formatted value of the most recent update to the device information.
(Could represent any field update on the device.) | -| `version` | `string \| undefined` | Optional | The current version of software installed on the device. | -| `merchantToken` | `string \| null \| undefined` | Optional | The merchant_token identifying the merchant controlling the device. | - -## Example (as JSON) - -```json -{ - "type": "TERMINAL", - "manufacturer": "manufacturer0", - "model": "model4", - "name": "name6", - "manufacturers_id": "manufacturers_id2", - "updated_at": "updated_at2", - "version": "version2" -} -``` - diff --git a/doc/models/device-checkout-options.md b/doc/models/device-checkout-options.md deleted file mode 100644 index 90db14233..000000000 --- a/doc/models/device-checkout-options.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Device Checkout Options - -## Structure - -`DeviceCheckoutOptions` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `deviceId` | `string` | Required | The unique ID of the device intended for this `TerminalCheckout`.
A list of `DeviceCode` objects can be retrieved from the /v2/devices/codes endpoint.
Match a `DeviceCode.device_id` value with `device_id` to get the associated device code. | -| `skipReceiptScreen` | `boolean \| null \| undefined` | Optional | Instructs the device to skip the receipt screen. Defaults to false. | -| `collectSignature` | `boolean \| null \| undefined` | Optional | Indicates that signature collection is desired during checkout. Defaults to false. | -| `tipSettings` | [`TipSettings \| undefined`](../../doc/models/tip-settings.md) | Optional | - | -| `showItemizedCart` | `boolean \| null \| undefined` | Optional | Show the itemization screen prior to taking a payment. This field is only meaningful when the
checkout includes an order ID. Defaults to true. | - -## Example (as JSON) - -```json -{ - "device_id": "device_id4", - "skip_receipt_screen": false, - "collect_signature": false, - "tip_settings": { - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "show_itemized_cart": false -} -``` - diff --git a/doc/models/device-code-status.md b/doc/models/device-code-status.md deleted file mode 100644 index 84f9da02f..000000000 --- a/doc/models/device-code-status.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Device Code Status - -DeviceCode.Status enum. - -## Enumeration - -`DeviceCodeStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `UNKNOWN` | The status cannot be determined or does not exist. | -| `UNPAIRED` | The device code is just created and unpaired. | -| `PAIRED` | The device code has been signed in and paired to a device. | -| `EXPIRED` | The device code was unpaired and expired before it was paired. | - diff --git a/doc/models/device-code.md b/doc/models/device-code.md deleted file mode 100644 index 0962891e8..000000000 --- a/doc/models/device-code.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Device Code - -## Structure - -`DeviceCode` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The unique id for this device code. | -| `name` | `string \| null \| undefined` | Optional | An optional user-defined name for the device code.
**Constraints**: *Maximum Length*: `128` | -| `code` | `string \| undefined` | Optional | The unique code that can be used to login. | -| `deviceId` | `string \| undefined` | Optional | The unique id of the device that used this code. Populated when the device is paired up. | -| `productType` | `string` | Required, Constant | **Default**: `'TERMINAL_API'` | -| `locationId` | `string \| null \| undefined` | Optional | The location assigned to this code.
**Constraints**: *Maximum Length*: `50` | -| `status` | [`string \| undefined`](../../doc/models/device-code-status.md) | Optional | DeviceCode.Status enum. | -| `pairBy` | `string \| undefined` | Optional | When this DeviceCode will expire and no longer login. Timestamp in RFC 3339 format. | -| `createdAt` | `string \| undefined` | Optional | When this DeviceCode was created. Timestamp in RFC 3339 format. | -| `statusChangedAt` | `string \| undefined` | Optional | When this DeviceCode's status was last changed. Timestamp in RFC 3339 format. | -| `pairedAt` | `string \| undefined` | Optional | When this DeviceCode was paired. Timestamp in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "product_type": "TERMINAL_API", - "id": "id4", - "name": "name4", - "code": "code2", - "device_id": "device_id0", - "location_id": "location_id8" -} -``` - diff --git a/doc/models/device-component-details-application-details.md b/doc/models/device-component-details-application-details.md deleted file mode 100644 index c4b355e0d..000000000 --- a/doc/models/device-component-details-application-details.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Device Component Details Application Details - -## Structure - -`DeviceComponentDetailsApplicationDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `applicationType` | [`string \| undefined`](../../doc/models/application-type.md) | Optional | - | -| `version` | `string \| undefined` | Optional | The version of the application. | -| `sessionLocation` | `string \| null \| undefined` | Optional | The location_id of the session for the application. | -| `deviceCodeId` | `string \| null \| undefined` | Optional | The id of the device code that was used to log in to the device. | - -## Example (as JSON) - -```json -{ - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" -} -``` - diff --git a/doc/models/device-component-details-battery-details.md b/doc/models/device-component-details-battery-details.md deleted file mode 100644 index 3a36412b9..000000000 --- a/doc/models/device-component-details-battery-details.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Device Component Details Battery Details - -## Structure - -`DeviceComponentDetailsBatteryDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `visiblePercent` | `number \| null \| undefined` | Optional | The battery charge percentage as displayed on the device. | -| `externalPower` | [`string \| undefined`](../../doc/models/device-component-details-external-power.md) | Optional | An enum for ExternalPower. | - -## Example (as JSON) - -```json -{ - "visible_percent": 48, - "external_power": "AVAILABLE_CHARGING" -} -``` - diff --git a/doc/models/device-component-details-card-reader-details.md b/doc/models/device-component-details-card-reader-details.md deleted file mode 100644 index 738504723..000000000 --- a/doc/models/device-component-details-card-reader-details.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Device Component Details Card Reader Details - -## Structure - -`DeviceComponentDetailsCardReaderDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `string \| undefined` | Optional | The version of the card reader. | - -## Example (as JSON) - -```json -{ - "version": "version8" -} -``` - diff --git a/doc/models/device-component-details-ethernet-details.md b/doc/models/device-component-details-ethernet-details.md deleted file mode 100644 index 145854a10..000000000 --- a/doc/models/device-component-details-ethernet-details.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Device Component Details Ethernet Details - -## Structure - -`DeviceComponentDetailsEthernetDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `active` | `boolean \| null \| undefined` | Optional | A boolean to represent whether the Ethernet interface is currently active. | -| `ipAddressV4` | `string \| null \| undefined` | Optional | The string representation of the device’s IPv4 address. | - -## Example (as JSON) - -```json -{ - "active": false, - "ip_address_v4": "ip_address_v46" -} -``` - diff --git a/doc/models/device-component-details-external-power.md b/doc/models/device-component-details-external-power.md deleted file mode 100644 index 713c92ae7..000000000 --- a/doc/models/device-component-details-external-power.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Device Component Details External Power - -An enum for ExternalPower. - -## Enumeration - -`DeviceComponentDetailsExternalPower` - -## Fields - -| Name | Description | -| --- | --- | -| `AVAILABLE_CHARGING` | Plugged in and charging. | -| `AVAILABLE_NOT_IN_USE` | Fully charged. | -| `UNAVAILABLE` | On battery power. | -| `AVAILABLE_INSUFFICIENT` | Not providing enough power for the device. | - diff --git a/doc/models/device-component-details-measurement.md b/doc/models/device-component-details-measurement.md deleted file mode 100644 index 506fc64f9..000000000 --- a/doc/models/device-component-details-measurement.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Device Component Details Measurement - -A value qualified by unit of measure. - -## Structure - -`DeviceComponentDetailsMeasurement` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `value` | `number \| null \| undefined` | Optional | - | - -## Example (as JSON) - -```json -{ - "value": 132 -} -``` - diff --git a/doc/models/device-component-details-network-interface-details.md b/doc/models/device-component-details-network-interface-details.md deleted file mode 100644 index 931ceb7bd..000000000 --- a/doc/models/device-component-details-network-interface-details.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Device Component Details Network Interface Details - -## Structure - -`DeviceComponentDetailsNetworkInterfaceDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `ipAddressV4` | `string \| null \| undefined` | Optional | The string representation of the device’s IPv4 address. | - -## Example (as JSON) - -```json -{ - "ip_address_v4": "ip_address_v46" -} -``` - diff --git a/doc/models/device-component-details-wi-fi-details.md b/doc/models/device-component-details-wi-fi-details.md deleted file mode 100644 index 2dfc0e48e..000000000 --- a/doc/models/device-component-details-wi-fi-details.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Device Component Details Wi Fi Details - -## Structure - -`DeviceComponentDetailsWiFiDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `active` | `boolean \| null \| undefined` | Optional | A boolean to represent whether the WiFI interface is currently active. | -| `ssid` | `string \| null \| undefined` | Optional | The name of the connected WIFI network. | -| `ipAddressV4` | `string \| null \| undefined` | Optional | The string representation of the device’s IPv4 address. | -| `secureConnection` | `string \| null \| undefined` | Optional | The security protocol for a secure connection (e.g. WPA2). None provided if the connection
is unsecured. | -| `signalStrength` | [`DeviceComponentDetailsMeasurement \| undefined`](../../doc/models/device-component-details-measurement.md) | Optional | A value qualified by unit of measure. | - -## Example (as JSON) - -```json -{ - "active": false, - "ssid": "ssid6", - "ip_address_v4": "ip_address_v40", - "secure_connection": "secure_connection6", - "signal_strength": { - "value": 222 - } -} -``` - diff --git a/doc/models/device-details.md b/doc/models/device-details.md deleted file mode 100644 index 214bfce34..000000000 --- a/doc/models/device-details.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Device Details - -Details about the device that took the payment. - -## Structure - -`DeviceDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `deviceId` | `string \| null \| undefined` | Optional | The Square-issued ID of the device.
**Constraints**: *Maximum Length*: `255` | -| `deviceInstallationId` | `string \| null \| undefined` | Optional | The Square-issued installation ID for the device.
**Constraints**: *Maximum Length*: `255` | -| `deviceName` | `string \| null \| undefined` | Optional | The name of the device set by the seller.
**Constraints**: *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "device_id": "device_id0", - "device_installation_id": "device_installation_id2", - "device_name": "device_name2" -} -``` - diff --git a/doc/models/device-metadata.md b/doc/models/device-metadata.md deleted file mode 100644 index 16e6088a1..000000000 --- a/doc/models/device-metadata.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Device Metadata - -## Structure - -`DeviceMetadata` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `batteryPercentage` | `string \| null \| undefined` | Optional | The Terminal’s remaining battery percentage, between 1-100. | -| `chargingState` | `string \| null \| undefined` | Optional | The current charging state of the Terminal.
Options: `CHARGING`, `NOT_CHARGING` | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the Square seller business location associated with the Terminal. | -| `merchantId` | `string \| null \| undefined` | Optional | The ID of the Square merchant account that is currently signed-in to the Terminal. | -| `networkConnectionType` | `string \| null \| undefined` | Optional | The Terminal’s current network connection type.
Options: `WIFI`, `ETHERNET` | -| `paymentRegion` | `string \| null \| undefined` | Optional | The country in which the Terminal is authorized to take payments. | -| `serialNumber` | `string \| null \| undefined` | Optional | The unique identifier assigned to the Terminal, which can be found on the lower back
of the device. | -| `osVersion` | `string \| null \| undefined` | Optional | The current version of the Terminal’s operating system. | -| `appVersion` | `string \| null \| undefined` | Optional | The current version of the application running on the Terminal. | -| `wifiNetworkName` | `string \| null \| undefined` | Optional | The name of the Wi-Fi network to which the Terminal is connected. | -| `wifiNetworkStrength` | `string \| null \| undefined` | Optional | The signal strength of the Wi-FI network connection.
Options: `POOR`, `FAIR`, `GOOD`, `EXCELLENT` | -| `ipAddress` | `string \| null \| undefined` | Optional | The IP address of the Terminal. | - -## Example (as JSON) - -```json -{ - "battery_percentage": "battery_percentage4", - "charging_state": "charging_state6", - "location_id": "location_id2", - "merchant_id": "merchant_id8", - "network_connection_type": "network_connection_type8" -} -``` - diff --git a/doc/models/device-status-category.md b/doc/models/device-status-category.md deleted file mode 100644 index 96ca1c676..000000000 --- a/doc/models/device-status-category.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Device Status Category - -## Enumeration - -`DeviceStatusCategory` - -## Fields - -| Name | -| --- | -| `AVAILABLE` | -| `NEEDS_ATTENTION` | -| `OFFLINE` | - diff --git a/doc/models/device-status.md b/doc/models/device-status.md deleted file mode 100644 index da420284f..000000000 --- a/doc/models/device-status.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Device Status - -## Structure - -`DeviceStatus` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `category` | [`string \| undefined`](../../doc/models/device-status-category.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "category": "NEEDS_ATTENTION" -} -``` - diff --git a/doc/models/device.md b/doc/models/device.md deleted file mode 100644 index 9fd32ae75..000000000 --- a/doc/models/device.md +++ /dev/null @@ -1,125 +0,0 @@ - -# Device - -## Structure - -`Device` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A synthetic identifier for the device. The identifier includes a standardized prefix and
is otherwise an opaque id generated from key device fields. | -| `attributes` | [`DeviceAttributes`](../../doc/models/device-attributes.md) | Required | - | -| `components` | [`Component[] \| null \| undefined`](../../doc/models/component.md) | Optional | A list of components applicable to the device. | -| `status` | [`DeviceStatus \| undefined`](../../doc/models/device-status.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "attributes": { - "type": "TERMINAL", - "manufacturer": "manufacturer2", - "model": "model2", - "name": "name4", - "manufacturers_id": "manufacturers_id0", - "updated_at": "updated_at0", - "version": "version0" - }, - "id": "id0", - "components": [ - { - "type": "BATTERY", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "type": "BATTERY", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "type": "BATTERY", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - } - ], - "status": { - "category": "AVAILABLE" - } -} -``` - diff --git a/doc/models/digital-wallet-details.md b/doc/models/digital-wallet-details.md deleted file mode 100644 index 25d0fd8a5..000000000 --- a/doc/models/digital-wallet-details.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Digital Wallet Details - -Additional details about `WALLET` type payments. Contains only non-confidential information. - -## Structure - -`DigitalWalletDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `status` | `string \| null \| undefined` | Optional | The status of the `WALLET` payment. The status can be `AUTHORIZED`, `CAPTURED`, `VOIDED`, or
`FAILED`.
**Constraints**: *Maximum Length*: `50` | -| `brand` | `string \| null \| undefined` | Optional | The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`,
`RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY` or `UNKNOWN`.
**Constraints**: *Maximum Length*: `50` | -| `cashAppDetails` | [`CashAppDetails \| undefined`](../../doc/models/cash-app-details.md) | Optional | Additional details about `WALLET` type payments with the `brand` of `CASH_APP`. | - -## Example (as JSON) - -```json -{ - "status": "status4", - "brand": "brand8", - "cash_app_details": { - "buyer_full_name": "buyer_full_name2", - "buyer_country_code": "buyer_country_code8", - "buyer_cashtag": "buyer_cashtag4" - } -} -``` - diff --git a/doc/models/disable-card-response.md b/doc/models/disable-card-response.md deleted file mode 100644 index a74d0a81b..000000000 --- a/doc/models/disable-card-response.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Disable Card Response - -Defines the fields that are included in the response body of -a request to the [DisableCard](../../doc/api/cards.md#disable-card) endpoint. - -Note: if there are errors processing the request, the card field will not be -present. - -## Structure - -`DisableCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `card` | [`Card \| undefined`](../../doc/models/card.md) | Optional | Represents the payment details of a card to be used for payments. These
details are determined by the payment token generated by Web Payments SDK. | - -## Example (as JSON) - -```json -{ - "card": { - "billing_address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "bin": "411111", - "card_brand": "VISA", - "card_type": "CREDIT", - "cardholder_name": "Amelia Earhart", - "customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8", - "enabled": false, - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", - "id": "ccof:uIbfJXhXETSP197M3GB", - "last_4": "1111", - "merchant_id": "6SSW7HV8K2ST5", - "prepaid_type": "NOT_PREPAID", - "reference_id": "user-id-1", - "version": 2 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/disable-events-response.md b/doc/models/disable-events-response.md deleted file mode 100644 index f7d962a6e..000000000 --- a/doc/models/disable-events-response.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Disable Events Response - -Defines the fields that are included in the response body of -a request to the [DisableEvents](../../doc/api/events.md#disable-events) endpoint. - -Note: if there are errors processing the request, the events field will not be -present. - -## Structure - -`DisableEventsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/dismiss-terminal-action-response.md b/doc/models/dismiss-terminal-action-response.md deleted file mode 100644 index 67a95fe08..000000000 --- a/doc/models/dismiss-terminal-action-response.md +++ /dev/null @@ -1,63 +0,0 @@ - -# 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": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/dismiss-terminal-checkout-response.md b/doc/models/dismiss-terminal-checkout-response.md deleted file mode 100644 index c853f39ab..000000000 --- a/doc/models/dismiss-terminal-checkout-response.md +++ /dev/null @@ -1,76 +0,0 @@ - -# Dismiss Terminal Checkout Response - -## Structure - -`DismissTerminalCheckoutResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `checkout` | [`TerminalCheckout \| undefined`](../../doc/models/terminal-checkout.md) | Optional | Represents a checkout processed by the Square Terminal. | - -## Example (as JSON) - -```json -{ - "checkout": { - "amount_money": { - "amount": 2610, - "currency": "USD" - }, - "app_id": "APP_ID", - "created_at": "2023-11-29T14:59:50.682Z", - "deadline_duration": "PT5M", - "device_options": { - "collect_signature": true, - "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", - "loyalty_settings": { - "loyalty_screen_max_display_duration": "PT60S", - "show_card_linked_reward_redemption_screen": false, - "show_loyalty_screen": false, - "show_non_qualifying_loyalty_screen": false - }, - "skip_receipt_screen": false, - "tip_settings": { - "allow_tipping": true, - "custom_tip_field": false, - "separate_tip_screen": true, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "show_itemized_cart": false - }, - "id": "LmZEKbo3SBfqO", - "location_id": "LOCATION_ID", - "payment_ids": [ - "D7vLJqMkvSoAlX4yyFzUitOy4EPZY" - ], - "payment_options": { - "autocomplete": true, - "delay_duration": "delay_duration2", - "accept_partial_authorization": false, - "delay_action": "CANCEL" - }, - "payment_type": "CARD_PRESENT", - "status": "COMPLETED", - "updated_at": "2023-11-29T15:00:18.936Z", - "reference_id": "reference_id0", - "note": "note8", - "order_id": "order_id6" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/dismiss-terminal-refund-response.md b/doc/models/dismiss-terminal-refund-response.md deleted file mode 100644 index db6f6c6c1..000000000 --- a/doc/models/dismiss-terminal-refund-response.md +++ /dev/null @@ -1,92 +0,0 @@ - -# Dismiss Terminal Refund Response - -## Structure - -`DismissTerminalRefundResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `refund` | [`TerminalRefund \| undefined`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | - -## Example (as JSON) - -```json -{ - "refund": { - "amount_money": { - "amount": 111, - "currency": "CAD" - }, - "app_id": "APP_ID", - "card": { - "bin": "411111", - "card_brand": "VISA", - "card_type": "DEBIT", - "exp_month": 12, - "exp_year": 2024, - "fingerprint": "sq-1-ElNeDpZZqUBNDI7yNghyKO-o0yLXASp4qQDGIPtxnFvTTWoqdfdP6TV8gLsSxoztXA", - "last_4": "1111", - "prepaid_type": "NOT_PREPAID" - }, - "card_details": { - "auth_result_code": "RNy6Lf", - "avs_status": "AVS_ACCEPTED", - "card": { - "bin": "411111", - "card_brand": "VISA", - "card_type": "DEBIT", - "exp_month": 12, - "exp_year": 2024, - "fingerprint": "sq-1-ElNeDpZZqUBNDI7yNghyKO-o0yLXASp3qQDGIPtxnFvTTWoqdfdP6TV9gLsSxoztXA", - "last_4": "1111", - "prepaid_type": "NOT_PREPAID" - }, - "card_payment_timeline": { - "authorized_at": "2023-11-30T16:15:06.645Z", - "captured_at": "2023-11-30T16:15:13.272Z" - }, - "cvv_status": "CVV_ACCEPTED", - "device_details": { - "device_credential": { - "name": "Terminal API Device created on Nov 2, 2023", - "token": "9BFDXEYKB7H8Y" - }, - "device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", - "device_installation_id": "0ef67d8e-61a3-4418-a0be-c143bfe6108d" - }, - "entry_method": "SWIPED", - "statement_description": "SQ TREATS", - "status": "CAPTURED" - }, - "created_at": "2023-11-30T16:16:39.299Z", - "deadline_duration": "PT5M", - "device_id": "47776348fd8b32b9", - "id": "vjkNb2HD-xq5kiWWiJ7RhwrQnkxIn2N0l1nPZY", - "order_id": "s8OMhQcpEp1b61YywlccSHWqUaQZY", - "payment_id": "xq5kiWWiJ7RhwrQnkxIn2N0l1nPZY", - "reason": "Returning item", - "status": "IN_PROGRESS", - "updated_at": "2023-11-30T16:16:57.863Z", - "refund_id": "refund_id2" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/dispute-evidence-file.md b/doc/models/dispute-evidence-file.md deleted file mode 100644 index 8033157f6..000000000 --- a/doc/models/dispute-evidence-file.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Dispute Evidence File - -A file to be uploaded as dispute evidence. - -## Structure - -`DisputeEvidenceFile` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filename` | `string \| null \| undefined` | Optional | The file name including the file extension. For example: "receipt.tiff".
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `filetype` | `string \| null \| undefined` | Optional | Dispute evidence files must be application/pdf, image/heic, image/heif, image/jpeg, image/png, or image/tiff formats.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | - -## Example (as JSON) - -```json -{ - "filename": "filename0", - "filetype": "filetype0" -} -``` - diff --git a/doc/models/dispute-evidence-type.md b/doc/models/dispute-evidence-type.md deleted file mode 100644 index 9808a2a3c..000000000 --- a/doc/models/dispute-evidence-type.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Dispute Evidence Type - -The type of the dispute evidence. - -## Enumeration - -`DisputeEvidenceType` - -## Fields - -| Name | Description | -| --- | --- | -| `GENERIC_EVIDENCE` | Square assumes this evidence type if you do not provide a type when uploading evidence.

Use when uploading evidence as a file or string. | -| `ONLINE_OR_APP_ACCESS_LOG` | Server or activity logs that show proof of the cardholder’s identity and that the
cardholder successfully ordered and received the goods (digitally or otherwise).
Example evidence includes IP addresses, corresponding timestamps/dates, cardholder’s name and email
address linked to a cardholder profile held by the seller, proof the same device and card (used
in dispute) were previously used in prior undisputed transaction, and any related detailed activity.

Use when uploading evidence as a file or string. | -| `AUTHORIZATION_DOCUMENTATION` | Evidence that the cardholder did provide authorization for the charge.
Example evidence includes a signed credit card authorization.

Use when uploading evidence as a file. | -| `CANCELLATION_OR_REFUND_DOCUMENTATION` | Evidence that the cardholder acknowledged your refund or cancellation policy.
Example evidence includes a signature or checkbox showing the cardholder’s acknowledgement of your
refund or cancellation policy.

Use when uploading evidence as a file or string. | -| `CARDHOLDER_COMMUNICATION` | Evidence that shows relevant communication with the cardholder.
Example evidence includes emails or texts that show the cardholder received goods/services or
demonstrate cardholder satisfaction.

Use when uploading evidence as a file. | -| `CARDHOLDER_INFORMATION` | Evidence that validates the customer's identity.
Example evidence includes personally identifiable details such as name, email address, purchaser IP
address, and a copy of the cardholder ID.

Use when uploading evidence as a file or string. | -| `PURCHASE_ACKNOWLEDGEMENT` | Evidence that shows proof of the sale/transaction.
Example evidence includes an invoice, contract, or other item showing the customer’s acknowledgement
of the purchase and your terms.

Use when uploading evidence as a file or string. | -| `DUPLICATE_CHARGE_DOCUMENTATION` | Evidence that shows the charges in question are valid and distinct from one another.
Example evidence includes receipts, shipping labels, and invoices along with their distinct payment IDs.

Use when uploading evidence as a file. | -| `PRODUCT_OR_SERVICE_DESCRIPTION` | A description of the product or service sold.

Use when uploading evidence as a file or string. | -| `RECEIPT` | A receipt or message sent to the cardholder detailing the charge.
Note: You do not need to upload the Square receipt; Square submits the receipt on your behalf.

Use when uploading evidence as a file or string. | -| `SERVICE_RECEIVED_DOCUMENTATION` | Evidence that the service was provided to the cardholder or the expected date that services will be rendered.
Example evidence includes a signed delivery form, work order, expected delivery date, or other written agreements.

Use when uploading evidence as a file or string. | -| `PROOF_OF_DELIVERY_DOCUMENTATION` | Evidence that shows the product was provided to the cardholder or the expected date of delivery.
Example evidence includes a signed delivery form or written agreement acknowledging receipt of the goods or services.

Use when uploading evidence as a file or string. | -| `RELATED_TRANSACTION_DOCUMENTATION` | Evidence that shows the cardholder previously processed transactions on the same card and did not dispute them.
Note: Square automatically provides up to five distinct Square receipts for related transactions, when available.

Use when uploading evidence as a file or string. | -| `REBUTTAL_EXPLANATION` | An explanation of why the cardholder’s claim is invalid.
Example evidence includes an explanation of why each distinct charge is a legitimate purchase, why the cardholder’s claim
for credit owed due to their attempt to cancel, return, or refund is invalid per your stated policy and cardholder
agreement, or an explanation of how the cardholder did not attempt to remedy the issue with you first to receive credit.

Use when uploading evidence as a file or string. | -| `TRACKING_NUMBER` | The tracking number for the order provided by the shipping carrier. If you have multiple numbers, they need to be
submitted individually as separate pieces of evidence.

Use when uploading evidence as a string. | - diff --git a/doc/models/dispute-evidence.md b/doc/models/dispute-evidence.md deleted file mode 100644 index 09d97f22f..000000000 --- a/doc/models/dispute-evidence.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Dispute Evidence - -## Structure - -`DisputeEvidence` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `evidenceId` | `string \| null \| undefined` | Optional | The Square-generated ID of the evidence.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `id` | `string \| undefined` | Optional | The Square-generated ID of the evidence.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `disputeId` | `string \| null \| undefined` | Optional | The ID of the dispute the evidence is associated with.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `evidenceFile` | [`DisputeEvidenceFile \| undefined`](../../doc/models/dispute-evidence-file.md) | Optional | A file to be uploaded as dispute evidence. | -| `evidenceText` | `string \| null \| undefined` | Optional | Raw text
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `500` | -| `uploadedAt` | `string \| null \| undefined` | Optional | The time when the evidence was uploaded, in RFC 3339 format.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `evidenceType` | [`string \| undefined`](../../doc/models/dispute-evidence-type.md) | Optional | The type of the dispute evidence. | - -## Example (as JSON) - -```json -{ - "evidence_id": "evidence_id0", - "id": "id2", - "dispute_id": "dispute_id4", - "evidence_file": { - "filename": "filename8", - "filetype": "filetype8" - }, - "evidence_text": "evidence_text6" -} -``` - diff --git a/doc/models/dispute-reason.md b/doc/models/dispute-reason.md deleted file mode 100644 index b348da050..000000000 --- a/doc/models/dispute-reason.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Dispute Reason - -The list of possible reasons why a cardholder might initiate a -dispute with their bank. - -## Enumeration - -`DisputeReason` - -## Fields - -| Name | Description | -| --- | --- | -| `AMOUNT_DIFFERS` | The cardholder claims that they were charged the wrong amount for the purchase.
To challenge this dispute, provide specific and concrete evidence that the cardholder agreed
to the amount charged. | -| `CANCELLED` | The cardholder claims that they attempted to return the goods or cancel the service.
To challenge this dispute, provide specific and concrete evidence to prove that the cardholder
is not due a refund and that the cardholder acknowledged your cancellation policy. | -| `DUPLICATE` | The cardholder claims that they were charged twice for the same purchase.
To challenge this dispute, provide specific and concrete evidence that shows both charges are
legitimate and independent of one another. | -| `NO_KNOWLEDGE` | The cardholder claims that they did not make this purchase nor authorized the charge.
To challenge this dispute, provide specific and concrete evidence that proves that the cardholder
identity was verified at the time of purchase and that the purchase was authorized. | -| `NOT_AS_DESCRIBED` | The cardholder claims the product or service was provided, but the quality of the deliverable
did not align with the expectations of the cardholder based on the description.
To challenge this dispute, provide specific and concrete evidence that shows the cardholder is in
possession of the product as described or received the service as described and agreed on. | -| `NOT_RECEIVED` | The cardholder claims the product or service was not received by the cardholder within the
stated time frame.
To challenge this dispute, provide specific and concrete evidence to prove that the cardholder is
in possession of or received the product or service sold. | -| `PAID_BY_OTHER_MEANS` | The cardholder claims that they previously paid for this purchase.
To challenge this dispute, provide specific and concrete evidence that shows both charges are
legitimate and independent of one another or proof that you already provided a credit for the charge. | -| `CUSTOMER_REQUESTS_CREDIT` | The cardholder claims that the purchase was canceled or returned, but they have not yet received
the credit.
To challenge this dispute, provide specific and concrete evidence to prove that the cardholder is not
due a refund and that they acknowledged your cancellation and/or refund policy. | -| `EMV_LIABILITY_SHIFT` | A chip-enabled card was not processed through a compliant chip-card reader (for example, it was swiped
instead of dipped into a chip-card reader).
You cannot challenge this dispute because the payment did not comply with EMV security requirements.
For more information, see [What Is EMV?](https://squareup.com/emv) | - diff --git a/doc/models/dispute-state.md b/doc/models/dispute-state.md deleted file mode 100644 index d629040d0..000000000 --- a/doc/models/dispute-state.md +++ /dev/null @@ -1,22 +0,0 @@ - -# Dispute State - -The list of possible dispute states. - -## Enumeration - -`DisputeState` - -## Fields - -| Name | Description | -| --- | --- | -| `INQUIRY_EVIDENCE_REQUIRED` | The initial state of an inquiry with evidence required | -| `INQUIRY_PROCESSING` | Inquiry evidence has been submitted and the bank is processing the inquiry | -| `INQUIRY_CLOSED` | The inquiry is complete | -| `EVIDENCE_REQUIRED` | The initial state of a dispute with evidence required | -| `PROCESSING` | Dispute evidence has been submitted and the bank is processing the dispute | -| `WON` | The bank has completed processing the dispute and the seller has won | -| `LOST` | The bank has completed processing the dispute and the seller has lost | -| `ACCEPTED` | The seller has accepted the dispute | - diff --git a/doc/models/dispute.md b/doc/models/dispute.md deleted file mode 100644 index 4d30bc6ea..000000000 --- a/doc/models/dispute.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Dispute - -Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. - -## Structure - -`Dispute` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `disputeId` | `string \| null \| undefined` | Optional | The unique ID for this `Dispute`, generated by Square.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `id` | `string \| undefined` | Optional | The unique ID for this `Dispute`, generated by Square.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `amountMoney` | [`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. | -| `reason` | [`string \| undefined`](../../doc/models/dispute-reason.md) | Optional | The list of possible reasons why a cardholder might initiate a
dispute with their bank. | -| `state` | [`string \| undefined`](../../doc/models/dispute-state.md) | Optional | The list of possible dispute states. | -| `dueAt` | `string \| null \| undefined` | Optional | The deadline by which the seller must respond to the dispute, in [RFC 3339 format](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `disputedPayment` | [`DisputedPayment \| undefined`](../../doc/models/disputed-payment.md) | Optional | The payment the cardholder disputed. | -| `evidenceIds` | `string[] \| null \| undefined` | Optional | The IDs of the evidence associated with the dispute. | -| `cardBrand` | [`string \| undefined`](../../doc/models/card-brand.md) | Optional | Indicates a card's brand, such as `VISA` or `MASTERCARD`. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the dispute was created, in RFC 3339 format.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the dispute was last updated, in RFC 3339 format.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `brandDisputeId` | `string \| null \| undefined` | Optional | The ID of the dispute in the card brand system, generated by the card brand.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `reportedDate` | `string \| null \| undefined` | Optional | The timestamp when the dispute was reported, in RFC 3339 format.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `reportedAt` | `string \| null \| undefined` | Optional | The timestamp when the dispute was reported, in RFC 3339 format.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | -| `version` | `number \| undefined` | Optional | The current version of the `Dispute`. | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the location where the dispute originated.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | - -## Example (as JSON) - -```json -{ - "dispute_id": "dispute_id2", - "id": "id0", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "reason": "NOT_AS_DESCRIBED", - "state": "LOST" -} -``` - diff --git a/doc/models/disputed-payment.md b/doc/models/disputed-payment.md deleted file mode 100644 index 00f8cef54..000000000 --- a/doc/models/disputed-payment.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Disputed Payment - -The payment the cardholder disputed. - -## Structure - -`DisputedPayment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | Square-generated unique ID of the payment being disputed.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id8" -} -``` - diff --git a/doc/models/ecom-visibility.md b/doc/models/ecom-visibility.md deleted file mode 100644 index 17f245730..000000000 --- a/doc/models/ecom-visibility.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Ecom Visibility - -Determines item visibility in Ecom (Online Store) and Online Checkout. - -## Enumeration - -`EcomVisibility` - -## Fields - -| Name | Description | -| --- | --- | -| `UNINDEXED` | Item is not synced with Ecom (Weebly). This is the default state | -| `UNAVAILABLE` | Item is synced but is unavailable within Ecom (Weebly) and Online Checkout | -| `HIDDEN` | Option for seller to choose manually created Quick Amounts. | -| `VISIBLE` | Item is synced but available within Ecom (Weebly) and Online Checkout but is hidden from Ecom Store. | - diff --git a/doc/models/employee-status.md b/doc/models/employee-status.md deleted file mode 100644 index c56cca143..000000000 --- a/doc/models/employee-status.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Employee Status - -The status of the Employee being retrieved. - -DEPRECATED at version 2020-08-26. Replaced by [TeamMemberStatus](entity:TeamMemberStatus). - -## Enumeration - -`EmployeeStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `ACTIVE` | Specifies that the employee is in the Active state. | -| `INACTIVE` | Specifies that the employee is in the Inactive state. | - diff --git a/doc/models/employee-wage.md b/doc/models/employee-wage.md deleted file mode 100644 index c9371b340..000000000 --- a/doc/models/employee-wage.md +++ /dev/null @@ -1,32 +0,0 @@ - -# 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](entity:TeamMemberWage). - -## Structure - -`EmployeeWage` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The UUID for this object. | -| `employeeId` | `string \| null \| undefined` | Optional | The `Employee` that this wage is assigned to. | -| `title` | `string \| null \| 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. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "employee_id": "employee_id0", - "title": "title6", - "hourly_rate": { - "amount": 172, - "currency": "LAK" - } -} -``` - diff --git a/doc/models/employee.md b/doc/models/employee.md deleted file mode 100644 index 7d1338ab1..000000000 --- a/doc/models/employee.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Employee - -An employee object that is used by the external API. - -DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember). - -## Structure - -`Employee` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | UUID for this object. | -| `firstName` | `string \| null \| undefined` | Optional | The employee's first name. | -| `lastName` | `string \| null \| undefined` | Optional | The employee's last name. | -| `email` | `string \| null \| undefined` | Optional | The employee's email address | -| `phoneNumber` | `string \| null \| undefined` | Optional | The employee's phone number in E.164 format, i.e. "+12125554250" | -| `locationIds` | `string[] \| null \| undefined` | Optional | A list of location IDs where this employee has access to. | -| `status` | [`string \| undefined`](../../doc/models/employee-status.md) | Optional | The status of the Employee being retrieved.

DEPRECATED at version 2020-08-26. Replaced by [TeamMemberStatus](entity:TeamMemberStatus). | -| `isOwner` | `boolean \| null \| undefined` | Optional | Whether this employee is the owner of the merchant. Each merchant
has one owner employee, and that employee has full authority over
the account. | -| `createdAt` | `string \| undefined` | Optional | A read-only timestamp in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | A read-only timestamp in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "first_name": "first_name6", - "last_name": "last_name4", - "email": "email0", - "phone_number": "phone_number6" -} -``` - diff --git a/doc/models/enable-events-response.md b/doc/models/enable-events-response.md deleted file mode 100644 index 807c5425c..000000000 --- a/doc/models/enable-events-response.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Enable Events Response - -Defines the fields that are included in the response body of -a request to the [EnableEvents](../../doc/api/events.md#enable-events) endpoint. - -Note: if there are errors processing the request, the events field will not be -present. - -## Structure - -`EnableEventsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/error-category.md b/doc/models/error-category.md deleted file mode 100644 index 2fb6f113c..000000000 --- a/doc/models/error-category.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Error Category - -Indicates which high-level category of error has occurred during a -request to the Connect API. - -## Enumeration - -`ErrorCategory` - -## Fields - -| Name | Description | -| --- | --- | -| `API_ERROR` | An error occurred with the Connect API itself. | -| `AUTHENTICATION_ERROR` | An authentication error occurred. Most commonly, the request had
a missing, malformed, or otherwise invalid `Authorization` header. | -| `INVALID_REQUEST_ERROR` | The request was invalid. Most commonly, a required parameter was
missing, or a provided parameter had an invalid value. | -| `RATE_LIMIT_ERROR` | Your application reached the Square API rate limit. You might receive this error if your application sends a high number of requests
to Square APIs in a short period of time.

Your application should monitor responses for `429 RATE_LIMITED` errors and use a retry mechanism with an [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff)
schedule to resend the requests at an increasingly slower rate. It is also a good practice to use a randomized delay (jitter) in your retry schedule. | -| `PAYMENT_METHOD_ERROR` | An error occurred while processing a payment method. Most commonly,
the details of the payment method were invalid (such as a card's CVV
or expiration date). | -| `REFUND_ERROR` | An error occurred while attempting to process a refund. | -| `MERCHANT_SUBSCRIPTION_ERROR` | An error occurred when checking a merchant subscription status | -| `EXTERNAL_VENDOR_ERROR` | An error that is returned from an external vendor's API | - diff --git a/doc/models/error-code.md b/doc/models/error-code.md deleted file mode 100644 index 328849313..000000000 --- a/doc/models/error-code.md +++ /dev/null @@ -1,165 +0,0 @@ - -# Error Code - -Indicates the specific error that occurred during a request to a -Square API. - -## Enumeration - -`ErrorCode` - -## Fields - -| Name | Description | -| --- | --- | -| `INTERNAL_SERVER_ERROR` | A general server error occurred. | -| `UNAUTHORIZED` | A general authorization error occurred. | -| `ACCESS_TOKEN_EXPIRED` | The provided access token has expired. | -| `ACCESS_TOKEN_REVOKED` | The provided access token has been revoked. | -| `CLIENT_DISABLED` | The provided client has been disabled. | -| `FORBIDDEN` | A general access error occurred. | -| `INSUFFICIENT_SCOPES` | The provided access token does not have permission
to execute the requested action. | -| `APPLICATION_DISABLED` | The calling application was disabled. | -| `V1_APPLICATION` | The calling application was created prior to
2016-03-30 and is not compatible with v2 Square API calls. | -| `V1_ACCESS_TOKEN` | The calling application is using an access token
created prior to 2016-03-30 and is not compatible with v2 Square API
calls. | -| `CARD_PROCESSING_NOT_ENABLED` | The location provided in the API call is not
enabled for credit card processing. | -| `MERCHANT_SUBSCRIPTION_NOT_FOUND` | A required subscription was not found for the merchant | -| `BAD_REQUEST` | A general error occurred with the request. | -| `MISSING_REQUIRED_PARAMETER` | The request is missing a required path, query, or
body parameter. | -| `INCORRECT_TYPE` | The value provided in the request is the wrong
type. For example, a string instead of an integer. | -| `INVALID_TIME` | Formatting for the provided time value is
incorrect. | -| `INVALID_TIME_RANGE` | The time range provided in the request is invalid.
For example, the end time is before the start time. | -| `INVALID_VALUE` | The provided value is invalid. For example,
including `%` in a phone number. | -| `INVALID_CURSOR` | The pagination cursor included in the request is
invalid. | -| `UNKNOWN_QUERY_PARAMETER` | The query parameters provided is invalid for the
requested endpoint. | -| `CONFLICTING_PARAMETERS` | One or more of the request parameters conflict with
each other. | -| `EXPECTED_JSON_BODY` | The request body is not a JSON object. | -| `INVALID_SORT_ORDER` | The provided sort order is not a valid key.
Currently, sort order must be `ASC` or `DESC`. | -| `VALUE_REGEX_MISMATCH` | The provided value does not match an expected
regular expression. | -| `VALUE_TOO_SHORT` | The provided string value is shorter than the
minimum length allowed. | -| `VALUE_TOO_LONG` | The provided string value is longer than the
maximum length allowed. | -| `VALUE_TOO_LOW` | The provided value is less than the supported
minimum. | -| `VALUE_TOO_HIGH` | The provided value is greater than the supported
maximum. | -| `VALUE_EMPTY` | The provided value has a default (empty) value
such as a blank string. | -| `ARRAY_LENGTH_TOO_LONG` | The provided array has too many elements. | -| `ARRAY_LENGTH_TOO_SHORT` | The provided array has too few elements. | -| `ARRAY_EMPTY` | The provided array is empty. | -| `EXPECTED_BOOLEAN` | The endpoint expected the provided value to be a
boolean. | -| `EXPECTED_INTEGER` | The endpoint expected the provided value to be an
integer. | -| `EXPECTED_FLOAT` | The endpoint expected the provided value to be a
float. | -| `EXPECTED_STRING` | The endpoint expected the provided value to be a
string. | -| `EXPECTED_OBJECT` | The endpoint expected the provided value to be a
JSON object. | -| `EXPECTED_ARRAY` | The endpoint expected the provided value to be an
array or list. | -| `EXPECTED_MAP` | The endpoint expected the provided value to be a
map or associative array. | -| `EXPECTED_BASE64_ENCODED_BYTE_ARRAY` | The endpoint expected the provided value to be an
array encoded in base64. | -| `INVALID_ARRAY_VALUE` | One or more objects in the array does not match the
array type. | -| `INVALID_ENUM_VALUE` | The provided static string is not valid for the
field. | -| `INVALID_CONTENT_TYPE` | Invalid content type header. | -| `INVALID_FORM_VALUE` | Only relevant for applications created prior to
2016-03-30. Indicates there was an error while parsing form values. | -| `CUSTOMER_NOT_FOUND` | The provided customer id can't be found in the merchant's customers list. | -| `ONE_INSTRUMENT_EXPECTED` | A general error occurred. | -| `NO_FIELDS_SET` | A general error occurred. | -| `TOO_MANY_MAP_ENTRIES` | Too many entries in the map field. | -| `MAP_KEY_LENGTH_TOO_SHORT` | The length of one of the provided keys in the map is too short. | -| `MAP_KEY_LENGTH_TOO_LONG` | The length of one of the provided keys in the map is too long. | -| `CUSTOMER_MISSING_NAME` | The provided customer does not have a recorded name. | -| `CUSTOMER_MISSING_EMAIL` | The provided customer does not have a recorded email. | -| `INVALID_PAUSE_LENGTH` | The subscription cannot be paused longer than the duration of the current phase. | -| `INVALID_DATE` | The subscription cannot be paused/resumed on the given date. | -| `UNSUPPORTED_COUNTRY` | The API request references an unsupported country. | -| `UNSUPPORTED_CURRENCY` | The API request references an unsupported currency. | -| `APPLE_TTP_PIN_TOKEN` | The payment was declined by the card issuer during an Apple Tap to Pay (TTP)
transaction with a request for the card's PIN. This code will be returned alongside
`CARD_DECLINED_VERIFICATION_REQUIRED` as a supplemental error, and will include an
issuer-provided token in the `details` field that is needed to initiate the PIN
collection flow on the iOS device. | -| `CARD_EXPIRED` | The card issuer declined the request because the card is expired. | -| `INVALID_EXPIRATION` | The expiration date for the payment card is invalid. For example,
it indicates a date in the past. | -| `INVALID_EXPIRATION_YEAR` | The expiration year for the payment card is invalid. For example,
it indicates a year in the past or contains invalid characters. | -| `INVALID_EXPIRATION_DATE` | The expiration date for the payment card is invalid. For example,
it contains invalid characters. | -| `UNSUPPORTED_CARD_BRAND` | The credit card provided is not from a supported issuer. | -| `UNSUPPORTED_ENTRY_METHOD` | The entry method for the credit card (swipe, dip, tap) is not supported. | -| `INVALID_ENCRYPTED_CARD` | The encrypted card information is invalid. | -| `INVALID_CARD` | The credit card cannot be validated based on the provided details. | -| `PAYMENT_AMOUNT_MISMATCH` | The payment was declined because there was a payment amount mismatch.
The money amount Square was expecting does not match the amount provided. | -| `GENERIC_DECLINE` | Square received a decline without any additional information.
If the payment information seems correct, the buyer can contact their
issuer to ask for more information. | -| `CVV_FAILURE` | The card issuer declined the request because the CVV value is invalid. | -| `ADDRESS_VERIFICATION_FAILURE` | The card issuer declined the request because the postal code is invalid. | -| `INVALID_ACCOUNT` | The issuer was not able to locate the account on record. | -| `CURRENCY_MISMATCH` | The currency associated with the payment is not valid for the provided
funding source. For example, a gift card funded in USD cannot be used to process
payments in GBP. | -| `INSUFFICIENT_FUNDS` | The funding source has insufficient funds to cover the payment. | -| `INSUFFICIENT_PERMISSIONS` | The Square account does not have the permissions to accept
this payment. For example, Square may limit which merchants are
allowed to receive gift card payments. | -| `CARDHOLDER_INSUFFICIENT_PERMISSIONS` | The card issuer has declined the transaction due to restrictions on where the card can be used.
For example, a gift card is limited to a single merchant. | -| `INVALID_LOCATION` | The Square account cannot take payments in the specified region.
A Square account can take payments only from the region where the account was created. | -| `TRANSACTION_LIMIT` | The card issuer has determined the payment amount is either too high or too low.
The API returns the error code mostly for credit cards (for example, the card reached
the credit limit). However, sometimes the issuer bank can indicate the error for debit
or prepaid cards (for example, card has insufficient funds). | -| `VOICE_FAILURE` | The card issuer declined the request because the issuer requires voice authorization from the cardholder. The seller should ask the customer to contact the card issuing bank to authorize the payment. | -| `PAN_FAILURE` | The specified card number is invalid. For example, it is of
incorrect length or is incorrectly formatted. | -| `EXPIRATION_FAILURE` | The card expiration date is either invalid or indicates that the
card is expired. | -| `CARD_NOT_SUPPORTED` | The card is not supported either in the geographic region or by
the [merchant category code](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) (MCC). | -| `INVALID_PIN` | The card issuer declined the request because the PIN is invalid. | -| `MISSING_PIN` | The payment is missing a required PIN. | -| `MISSING_ACCOUNT_TYPE` | The payment is missing a required ACCOUNT_TYPE parameter. | -| `INVALID_POSTAL_CODE` | The postal code is incorrectly formatted. | -| `INVALID_FEES` | The app_fee_money on a payment is too high. | -| `MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED` | The card must be swiped, tapped, or dipped. Payments attempted by manually entering the card number are declined. | -| `PAYMENT_LIMIT_EXCEEDED` | Square declined the request because the payment amount exceeded the processing limit for this merchant. | -| `GIFT_CARD_AVAILABLE_AMOUNT` | When a Gift Card is a payment source, you can allow taking a partial payment
by adding the `accept_partial_authorization` parameter in the request.
However, taking such a partial payment does not work if your request also includes
`tip_money`, `app_fee_money`, or both. Square declines such payments and returns
the `GIFT_CARD_AVAILABLE_AMOUNT` error.
For more information, see
[CreatePayment errors (additional information)](https://developer.squareup.com/docs/payments-api/error-codes#createpayment-errors-additional-information). | -| `ACCOUNT_UNUSABLE` | The account provided cannot carry out transactions. | -| `BUYER_REFUSED_PAYMENT` | Bank account rejected or was not authorized for the payment. | -| `DELAYED_TRANSACTION_EXPIRED` | The application tried to update a delayed-capture payment that has expired. | -| `DELAYED_TRANSACTION_CANCELED` | The application tried to cancel a delayed-capture payment that was already cancelled. | -| `DELAYED_TRANSACTION_CAPTURED` | The application tried to capture a delayed-capture payment that was already captured. | -| `DELAYED_TRANSACTION_FAILED` | The application tried to update a delayed-capture payment that failed. | -| `CARD_TOKEN_EXPIRED` | The provided card token (nonce) has expired. | -| `CARD_TOKEN_USED` | The provided card token (nonce) was already used to process the payment or refund. | -| `AMOUNT_TOO_HIGH` | The requested payment amount is too high for the provided payment source. | -| `UNSUPPORTED_INSTRUMENT_TYPE` | The API request references an unsupported instrument type. | -| `REFUND_AMOUNT_INVALID` | The requested refund amount exceeds the amount available to refund. | -| `REFUND_ALREADY_PENDING` | The payment already has a pending refund. | -| `PAYMENT_NOT_REFUNDABLE` | The payment is not refundable. For example, the payment is too old to be refunded. | -| `PAYMENT_NOT_REFUNDABLE_DUE_TO_DISPUTE` | The payment is not refundable because it has been disputed. | -| `REFUND_DECLINED` | Request failed - The card issuer declined the refund. | -| `INSUFFICIENT_PERMISSIONS_FOR_REFUND` | The Square account does not have the permissions to process this refund. | -| `INVALID_CARD_DATA` | Generic error - the provided card data is invalid. | -| `SOURCE_USED` | The provided source id was already used to create a card. | -| `SOURCE_EXPIRED` | The provided source id has expired. | -| `UNSUPPORTED_LOYALTY_REWARD_TIER` | The referenced loyalty program reward tier is not supported.
This could happen if the reward tier created in a first party
application is incompatible with the Loyalty API. | -| `LOCATION_MISMATCH` | Generic error - the given location does not matching what is expected. | -| `IDEMPOTENCY_KEY_REUSED` | The provided idempotency key has already been used. | -| `UNEXPECTED_VALUE` | General error - the value provided was unexpected. | -| `SANDBOX_NOT_SUPPORTED` | The API request is not supported in sandbox. | -| `INVALID_EMAIL_ADDRESS` | The provided email address is invalid. | -| `INVALID_PHONE_NUMBER` | The provided phone number is invalid. | -| `CHECKOUT_EXPIRED` | The provided checkout URL has expired. | -| `BAD_CERTIFICATE` | Bad certificate. | -| `INVALID_SQUARE_VERSION_FORMAT` | The provided Square-Version is incorrectly formatted. | -| `API_VERSION_INCOMPATIBLE` | The provided Square-Version is incompatible with the requested action. | -| `CARD_PRESENCE_REQUIRED` | The transaction requires that a card be present. | -| `UNSUPPORTED_SOURCE_TYPE` | The API request references an unsupported source type. | -| `CARD_MISMATCH` | The provided card does not match what is expected. | -| `PLAID_ERROR` | Generic plaid error | -| `PLAID_ERROR_ITEM_LOGIN_REQUIRED` | Plaid error - ITEM_LOGIN_REQUIRED | -| `PLAID_ERROR_RATE_LIMIT` | Plaid error - RATE_LIMIT | -| `CARD_DECLINED` | The card was declined. | -| `VERIFY_CVV_FAILURE` | The CVV could not be verified. | -| `VERIFY_AVS_FAILURE` | The AVS could not be verified. | -| `CARD_DECLINED_CALL_ISSUER` | The payment card was declined with a request
for the card holder to call the issuer. | -| `CARD_DECLINED_VERIFICATION_REQUIRED` | The payment card was declined with a request
for additional verification. | -| `BAD_EXPIRATION` | The card expiration date is either missing or
incorrectly formatted. | -| `CHIP_INSERTION_REQUIRED` | The card issuer requires that the card be read
using a chip reader. | -| `ALLOWABLE_PIN_TRIES_EXCEEDED` | The card has exhausted its available pin entry
retries set by the card issuer. Resolving the error typically requires the
card holder to contact the card issuer. | -| `RESERVATION_DECLINED` | The card issuer declined the refund. | -| `UNKNOWN_BODY_PARAMETER` | The body parameter is not recognized by the requested endpoint. | -| `NOT_FOUND` | Not Found - a general error occurred. | -| `APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND` | Square could not find the associated Apple Pay certificate. | -| `METHOD_NOT_ALLOWED` | Method Not Allowed - a general error occurred. | -| `NOT_ACCEPTABLE` | Not Acceptable - a general error occurred. | -| `REQUEST_TIMEOUT` | Request Timeout - a general error occurred. | -| `CONFLICT` | Conflict - a general error occurred. | -| `GONE` | The target resource is no longer available and this
condition is likely to be permanent. | -| `REQUEST_ENTITY_TOO_LARGE` | Request Entity Too Large - a general error occurred. | -| `UNSUPPORTED_MEDIA_TYPE` | Unsupported Media Type - a general error occurred. | -| `UNPROCESSABLE_ENTITY` | Unprocessable Entity - a general error occurred. | -| `RATE_LIMITED` | Rate Limited - a general error occurred. | -| `NOT_IMPLEMENTED` | Not Implemented - a general error occurred. | -| `BAD_GATEWAY` | Bad Gateway - a general error occurred. | -| `SERVICE_UNAVAILABLE` | Service Unavailable - a general error occurred. | -| `TEMPORARY_ERROR` | A temporary internal error occurred. You can safely retry your call
using the same idempotency key. | -| `GATEWAY_TIMEOUT` | Gateway Timeout - a general error occurred. | - diff --git a/doc/models/error.md b/doc/models/error.md deleted file mode 100644 index 6bf4c9550..000000000 --- a/doc/models/error.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Error - -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. - -## Structure - -`Error` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `category` | [`string`](../../doc/models/error-category.md) | Required | Indicates which high-level category of error has occurred during a
request to the Connect API. | -| `code` | [`string`](../../doc/models/error-code.md) | Required | Indicates the specific error that occurred during a request to a
Square API. | -| `detail` | `string \| undefined` | Optional | A human-readable description of the error for debugging purposes. | -| `field` | `string \| undefined` | Optional | The name of the field provided in the original request (if any) that
the error pertains to. | - -## Example (as JSON) - -```json -{ - "category": "API_ERROR", - "code": "INVALID_PAUSE_LENGTH", - "detail": "detail0", - "field": "field8" -} -``` - diff --git a/doc/models/event-data.md b/doc/models/event-data.md deleted file mode 100644 index ac00fcfec..000000000 --- a/doc/models/event-data.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Event Data - -## Structure - -`EventData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | `string \| null \| undefined` | Optional | The name of the affected object’s type. | -| `id` | `string \| undefined` | Optional | The ID of the affected object. | -| `deleted` | `boolean \| null \| undefined` | Optional | This is true if the affected object has been deleted; otherwise, it's absent. | -| `object` | `Record \| null \| undefined` | Optional | An object containing fields and values relevant to the event. It is absent if the affected object has been deleted. | - -## Example (as JSON) - -```json -{ - "type": "type2", - "id": "id8", - "deleted": false, - "object": { - "key1": "val1", - "key2": "val2" - } -} -``` - diff --git a/doc/models/event-metadata.md b/doc/models/event-metadata.md deleted file mode 100644 index 9f3be7faa..000000000 --- a/doc/models/event-metadata.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Event Metadata - -Contains metadata about a particular [Event](../../doc/models/event.md). - -## Structure - -`EventMetadata` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `eventId` | `string \| null \| undefined` | Optional | A unique ID for the event. | -| `apiVersion` | `string \| null \| undefined` | Optional | The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created. | - -## Example (as JSON) - -```json -{ - "event_id": "event_id0", - "api_version": "api_version6" -} -``` - diff --git a/doc/models/event-type-metadata.md b/doc/models/event-type-metadata.md deleted file mode 100644 index 0bb841207..000000000 --- a/doc/models/event-type-metadata.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Event Type Metadata - -Contains the metadata of a webhook event type. - -## Structure - -`EventTypeMetadata` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `eventType` | `string \| undefined` | Optional | The event type. | -| `apiVersionIntroduced` | `string \| undefined` | Optional | The API version at which the event type was introduced. | -| `releaseStatus` | `string \| undefined` | Optional | The release status of the event type. | - -## Example (as JSON) - -```json -{ - "event_type": "event_type0", - "api_version_introduced": "api_version_introduced0", - "release_status": "release_status4" -} -``` - diff --git a/doc/models/event.md b/doc/models/event.md deleted file mode 100644 index ef55c60f8..000000000 --- a/doc/models/event.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Event - -## Structure - -`Event` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantId` | `string \| null \| undefined` | Optional | The ID of the target merchant associated with the event. | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the target location associated with the event. | -| `type` | `string \| null \| undefined` | Optional | The type of event this represents. | -| `eventId` | `string \| null \| undefined` | Optional | A unique ID for the event. | -| `createdAt` | `string \| undefined` | Optional | Timestamp of when the event was created, in RFC 3339 format. | -| `data` | [`EventData \| undefined`](../../doc/models/event-data.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "merchant_id": "merchant_id2", - "location_id": "location_id6", - "type": "type8", - "event_id": "event_id8", - "created_at": "created_at0" -} -``` - diff --git a/doc/models/exclude-strategy.md b/doc/models/exclude-strategy.md deleted file mode 100644 index a86dcc1ad..000000000 --- a/doc/models/exclude-strategy.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Exclude Strategy - -Indicates which products matched by a CatalogPricingRule -will be excluded if the pricing rule uses an exclude set. - -## Enumeration - -`ExcludeStrategy` - -## Fields - -| Name | Description | -| --- | --- | -| `LEAST_EXPENSIVE` | The least expensive matched products are excluded from the pricing. If
the pricing rule is set to exclude one product and multiple products in the
match set qualify as least expensive, then one will be excluded at random.

Excluding the least expensive product gives the best discount value to the buyer. | -| `MOST_EXPENSIVE` | The most expensive matched product is excluded from the pricing rule.
If multiple products have the same price and all qualify as least expensive,
one will be excluded at random.

This guarantees that the most expensive product is purchased at full price. | - diff --git a/doc/models/external-payment-details.md b/doc/models/external-payment-details.md deleted file mode 100644 index fb9dcd410..000000000 --- a/doc/models/external-payment-details.md +++ /dev/null @@ -1,34 +0,0 @@ - -# External Payment Details - -Stores details about an external payment. Contains only non-confidential information. -For more information, see -[Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). - -## Structure - -`ExternalPaymentDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | `string` | Required | The type of external payment the seller received. It can be one of the following:

- CHECK - Paid using a physical check.
- BANK_TRANSFER - Paid using external bank transfer.
- OTHER\_GIFT\_CARD - Paid using a non-Square gift card.
- CRYPTO - Paid using a crypto currency.
- SQUARE_CASH - Paid using Square Cash App.
- SOCIAL - Paid using peer-to-peer payment applications.
- EXTERNAL - A third-party application gathered this payment outside of Square.
- EMONEY - Paid using an E-money provider.
- CARD - A credit or debit card that Square does not support.
- STORED_BALANCE - Use for house accounts, store credit, and so forth.
- FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals
- OTHER - A type not listed here.
**Constraints**: *Maximum Length*: `50` | -| `source` | `string` | Required | A description of the external payment source. For example,
"Food Delivery Service".
**Constraints**: *Maximum Length*: `255` | -| `sourceId` | `string \| null \| undefined` | Optional | An ID to associate the payment to its originating source.
**Constraints**: *Maximum Length*: `255` | -| `sourceFeeMoney` | [`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": "type8", - "source": "source8", - "source_id": "source_id6", - "source_fee_money": { - "amount": 130, - "currency": "NIO" - } -} -``` - diff --git a/doc/models/filter-value.md b/doc/models/filter-value.md deleted file mode 100644 index 0c4088fd8..000000000 --- a/doc/models/filter-value.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Filter Value - -A filter to select resources based on an exact field value. For any given -value, the value can only be in one property. Depending on the field, either -all properties can be set or only a subset will be available. - -Refer to the documentation of the field. - -## Structure - -`FilterValue` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `all` | `string[] \| null \| undefined` | Optional | A list of terms that must be present on the field of the resource. | -| `any` | `string[] \| null \| undefined` | Optional | A list of terms where at least one of them must be present on the
field of the resource. | -| `none` | `string[] \| null \| undefined` | Optional | A list of terms that must not be present on the field the resource | - -## Example (as JSON) - -```json -{ - "all": [ - "all9", - "all0", - "all1" - ], - "any": [ - "any8", - "any9", - "any0" - ], - "none": [ - "none3", - "none4" - ] -} -``` - diff --git a/doc/models/float-number-range.md b/doc/models/float-number-range.md deleted file mode 100644 index ef7823bd9..000000000 --- a/doc/models/float-number-range.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Float Number Range - -Specifies a decimal number range. - -## Structure - -`FloatNumberRange` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `startAt` | `string \| null \| undefined` | Optional | A decimal value indicating where the range starts. | -| `endAt` | `string \| null \| undefined` | Optional | A decimal value indicating where the range ends. | - -## Example (as JSON) - -```json -{ - "start_at": "start_at0", - "end_at": "end_at2" -} -``` - diff --git a/doc/models/fulfillment-delivery-details-order-fulfillment-delivery-details-schedule-type.md b/doc/models/fulfillment-delivery-details-order-fulfillment-delivery-details-schedule-type.md deleted file mode 100644 index 0b4d55d60..000000000 --- a/doc/models/fulfillment-delivery-details-order-fulfillment-delivery-details-schedule-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Fulfillment Delivery Details Order Fulfillment Delivery Details Schedule Type - -The schedule type of the delivery fulfillment. - -## Enumeration - -`FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType` - -## Fields - -| Name | Description | -| --- | --- | -| `SCHEDULED` | Indicates the fulfillment to deliver at a scheduled deliver time. | -| `ASAP` | Indicates that the fulfillment to deliver as soon as possible and should be prepared
immediately. | - diff --git a/doc/models/fulfillment-delivery-details.md b/doc/models/fulfillment-delivery-details.md deleted file mode 100644 index 6757fb09e..000000000 --- a/doc/models/fulfillment-delivery-details.md +++ /dev/null @@ -1,61 +0,0 @@ - -# Fulfillment Delivery Details - -Describes delivery details of an order fulfillment. - -## Structure - -`FulfillmentDeliveryDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipient` | [`FulfillmentRecipient \| undefined`](../../doc/models/fulfillment-recipient.md) | Optional | Information about the fulfillment recipient. | -| `scheduleType` | [`string \| undefined`](../../doc/models/fulfillment-delivery-details-order-fulfillment-delivery-details-schedule-type.md) | Optional | The schedule type of the delivery fulfillment. | -| `placedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was placed.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").

Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". | -| `deliverAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
that represents the start of the delivery period.
When the fulfillment `schedule_type` is `ASAP`, the field is automatically
set to the current time plus the `prep_time_duration`.
Otherwise, the application can set this field while the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the
terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`).

The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `prepTimeDuration` | `string \| null \| undefined` | Optional | The duration of time it takes to prepare and deliver this fulfillment.
The duration must be in RFC 3339 format (for example, "P1W3D"). | -| `deliveryWindowDuration` | `string \| null \| undefined` | Optional | The time period after `deliver_at` in which to deliver the order.
Applications can set this field when the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state
such as `COMPLETED`, `CANCELED`, and `FAILED`).

The duration must be in RFC 3339 format (for example, "P1W3D"). | -| `note` | `string \| null \| undefined` | Optional | Provides additional instructions about the delivery fulfillment.
It is displayed in the Square Point of Sale application and set by the API.
**Constraints**: *Maximum Length*: `550` | -| `completedAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicates when the seller completed the fulfillment.
This field is automatically set when fulfillment `state` changes to `COMPLETED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `inProgressAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicates when the seller started processing the fulfillment.
This field is automatically set when the fulfillment `state` changes to `RESERVED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `rejectedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was rejected. This field is
automatically set when the fulfillment `state` changes to `FAILED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `readyAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the seller marked the fulfillment as ready for
courier pickup. This field is automatically set when the fulfillment `state` changes
to PREPARED.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `deliveredAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was delivered to the recipient.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `canceledAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was canceled. This field is automatically
set when the fulfillment `state` changes to `CANCELED`.

The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `cancelReason` | `string \| null \| undefined` | Optional | The delivery cancellation reason. Max length: 100 characters.
**Constraints**: *Maximum Length*: `100` | -| `courierPickupAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when an order can be picked up by the courier for delivery.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `courierPickupWindowDuration` | `string \| null \| undefined` | Optional | The time period after `courier_pickup_at` in which the courier should pick up the order.
The duration must be in RFC 3339 format (for example, "P1W3D"). | -| `isNoContactDelivery` | `boolean \| null \| undefined` | Optional | Whether the delivery is preferred to be no contact. | -| `dropoffNotes` | `string \| null \| undefined` | Optional | A note to provide additional instructions about how to deliver the order.
**Constraints**: *Maximum Length*: `550` | -| `courierProviderName` | `string \| null \| undefined` | Optional | The name of the courier provider.
**Constraints**: *Maximum Length*: `255` | -| `courierSupportPhoneNumber` | `string \| null \| undefined` | Optional | The support phone number of the courier.
**Constraints**: *Maximum Length*: `17` | -| `squareDeliveryId` | `string \| null \| undefined` | Optional | The identifier for the delivery created by Square.
**Constraints**: *Maximum Length*: `50` | -| `externalDeliveryId` | `string \| null \| undefined` | Optional | The identifier for the delivery created by the third-party courier service.
**Constraints**: *Maximum Length*: `50` | -| `managedDelivery` | `boolean \| null \| undefined` | Optional | The flag to indicate the delivery is managed by a third party (ie DoorDash), which means
we may not receive all recipient information for PII purposes. | - -## Example (as JSON) - -```json -{ - "recipient": { - "customer_id": "customer_id6", - "display_name": "display_name8", - "email_address": "email_address4", - "phone_number": "phone_number4", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "schedule_type": "SCHEDULED", - "placed_at": "placed_at6", - "deliver_at": "deliver_at2", - "prep_time_duration": "prep_time_duration6" -} -``` - diff --git a/doc/models/fulfillment-fulfillment-entry.md b/doc/models/fulfillment-fulfillment-entry.md deleted file mode 100644 index e238c865d..000000000 --- a/doc/models/fulfillment-fulfillment-entry.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Fulfillment Fulfillment Entry - -Links an order line item to a fulfillment. Each entry must reference -a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to -fulfill. - -## Structure - -`FulfillmentFulfillmentEntry` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the fulfillment entry only within this order.
**Constraints**: *Maximum Length*: `60` | -| `lineItemUid` | `string` | Required | The `uid` from the order line item.
**Constraints**: *Minimum Length*: `1` | -| `quantity` | `string` | Required | The quantity of the line item being fulfilled, formatted as a decimal number.
For example, `"3"`.

Fulfillments for line items with a `quantity_unit` can have non-integer quantities.
For example, `"1.70000"`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `12` | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this fulfillment entry. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | - -## Example (as JSON) - -```json -{ - "uid": "uid0", - "line_item_uid": "line_item_uid0", - "quantity": "quantity6", - "metadata": { - "key0": "metadata3", - "key1": "metadata4" - } -} -``` - diff --git a/doc/models/fulfillment-fulfillment-line-item-application.md b/doc/models/fulfillment-fulfillment-line-item-application.md deleted file mode 100644 index 1e4dd975d..000000000 --- a/doc/models/fulfillment-fulfillment-line-item-application.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Fulfillment Fulfillment Line Item Application - -The `line_item_application` describes what order line items this fulfillment applies -to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. - -## Enumeration - -`FulfillmentFulfillmentLineItemApplication` - -## Fields - -| Name | Description | -| --- | --- | -| `ALL` | If `ALL`, `entries` must be unset. | -| `ENTRY_LIST` | If `ENTRY_LIST`, supply a list of `entries`. | - diff --git a/doc/models/fulfillment-pickup-details-curbside-pickup-details.md b/doc/models/fulfillment-pickup-details-curbside-pickup-details.md deleted file mode 100644 index c30fb62ae..000000000 --- a/doc/models/fulfillment-pickup-details-curbside-pickup-details.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Fulfillment Pickup Details Curbside Pickup Details - -Specific details for curbside pickup. - -## Structure - -`FulfillmentPickupDetailsCurbsidePickupDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `curbsideDetails` | `string \| null \| undefined` | Optional | Specific details for curbside pickup, such as parking number and vehicle model.
**Constraints**: *Maximum Length*: `250` | -| `buyerArrivedAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | - -## Example (as JSON) - -```json -{ - "curbside_details": "curbside_details0", - "buyer_arrived_at": "buyer_arrived_at6" -} -``` - diff --git a/doc/models/fulfillment-pickup-details-schedule-type.md b/doc/models/fulfillment-pickup-details-schedule-type.md deleted file mode 100644 index 6879ccc4e..000000000 --- a/doc/models/fulfillment-pickup-details-schedule-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Fulfillment Pickup Details Schedule Type - -The schedule type of the pickup fulfillment. - -## Enumeration - -`FulfillmentPickupDetailsScheduleType` - -## Fields - -| Name | Description | -| --- | --- | -| `SCHEDULED` | Indicates that the fulfillment will be picked up at a scheduled pickup time. | -| `ASAP` | Indicates that the fulfillment will be picked up as soon as possible and
should be prepared immediately. | - diff --git a/doc/models/fulfillment-pickup-details.md b/doc/models/fulfillment-pickup-details.md deleted file mode 100644 index cac5cb977..000000000 --- a/doc/models/fulfillment-pickup-details.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Fulfillment Pickup Details - -Contains details necessary to fulfill a pickup order. - -## Structure - -`FulfillmentPickupDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipient` | [`FulfillmentRecipient \| undefined`](../../doc/models/fulfillment-recipient.md) | Optional | Information about the fulfillment recipient. | -| `expiresAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment expires if it is not marked in progress. The timestamp must be
in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set
up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order
are automatically completed. | -| `autoCompleteDuration` | `string \| null \| undefined` | Optional | The duration of time after which an in progress pickup fulfillment is automatically moved
to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D").

If not set, this pickup fulfillment remains in progress until it is canceled or completed. | -| `scheduleType` | [`string \| undefined`](../../doc/models/fulfillment-pickup-details-schedule-type.md) | Optional | The schedule type of the pickup fulfillment. | -| `pickupAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g.,
"2016-09-04T23:59:33.123Z".

For fulfillments with the schedule type `ASAP`, this is automatically set
to the current time plus the expected duration to prepare the fulfillment. | -| `pickupWindowDuration` | `string \| null \| undefined` | Optional | The window of time in which the order should be picked up after the `pickup_at` timestamp.
Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an
informational guideline for merchants. | -| `prepTimeDuration` | `string \| null \| undefined` | Optional | The duration of time it takes to prepare this fulfillment.
The duration must be in RFC 3339 format (for example, "P1W3D"). | -| `note` | `string \| null \| undefined` | Optional | A note to provide additional instructions about the pickup
fulfillment displayed in the Square Point of Sale application and set by the API.
**Constraints**: *Maximum Length*: `500` | -| `placedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `acceptedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `rejectedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `readyAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `expiredAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment expired. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `pickedUpAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `canceledAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `cancelReason` | `string \| null \| undefined` | Optional | A description of why the pickup was canceled. The maximum length: 100 characters.
**Constraints**: *Maximum Length*: `100` | -| `isCurbsidePickup` | `boolean \| null \| undefined` | Optional | If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. | -| `curbsidePickupDetails` | [`FulfillmentPickupDetailsCurbsidePickupDetails \| undefined`](../../doc/models/fulfillment-pickup-details-curbside-pickup-details.md) | Optional | Specific details for curbside pickup. | - -## Example (as JSON) - -```json -{ - "recipient": { - "customer_id": "customer_id6", - "display_name": "display_name8", - "email_address": "email_address4", - "phone_number": "phone_number4", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "expires_at": "expires_at0", - "auto_complete_duration": "auto_complete_duration0", - "schedule_type": "SCHEDULED", - "pickup_at": "pickup_at8" -} -``` - diff --git a/doc/models/fulfillment-recipient.md b/doc/models/fulfillment-recipient.md deleted file mode 100644 index 44a765d8a..000000000 --- a/doc/models/fulfillment-recipient.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Fulfillment Recipient - -Information about the fulfillment recipient. - -## Structure - -`FulfillmentRecipient` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string \| null \| undefined` | Optional | The ID of the customer associated with the fulfillment.

If `customer_id` is provided, the fulfillment recipient's `display_name`,
`email_address`, and `phone_number` are automatically populated from the
targeted customer profile. If these fields are set in the request, the request
values override the information from the customer profile. If the
targeted customer profile does not contain the necessary information and
these fields are left unset, the request results in an error.
**Constraints**: *Maximum Length*: `191` | -| `displayName` | `string \| null \| undefined` | Optional | The display name of the fulfillment recipient. This field is required.

If provided, the display name overrides the corresponding customer profile value
indicated by `customer_id`.
**Constraints**: *Maximum Length*: `255` | -| `emailAddress` | `string \| null \| undefined` | Optional | The email address of the fulfillment recipient.

If provided, the email address overrides the corresponding customer profile value
indicated by `customer_id`.
**Constraints**: *Maximum Length*: `255` | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number of the fulfillment recipient. This field is required.

If provided, the phone number overrides the corresponding customer profile value
indicated by `customer_id`.
**Constraints**: *Maximum Length*: `17` | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | - -## Example (as JSON) - -```json -{ - "customer_id": "customer_id2", - "display_name": "display_name4", - "email_address": "email_address2", - "phone_number": "phone_number2", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } -} -``` - diff --git a/doc/models/fulfillment-shipment-details.md b/doc/models/fulfillment-shipment-details.md deleted file mode 100644 index 3e6dc6521..000000000 --- a/doc/models/fulfillment-shipment-details.md +++ /dev/null @@ -1,53 +0,0 @@ - -# Fulfillment Shipment Details - -Contains the details necessary to fulfill a shipment order. - -## Structure - -`FulfillmentShipmentDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipient` | [`FulfillmentRecipient \| undefined`](../../doc/models/fulfillment-recipient.md) | Optional | Information about the fulfillment recipient. | -| `carrier` | `string \| null \| undefined` | Optional | The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS).
**Constraints**: *Maximum Length*: `50` | -| `shippingNote` | `string \| null \| undefined` | Optional | A note with additional information for the shipping carrier.
**Constraints**: *Maximum Length*: `500` | -| `shippingType` | `string \| null \| undefined` | Optional | A description of the type of shipping product purchased from the carrier
(such as First Class, Priority, or Express).
**Constraints**: *Maximum Length*: `50` | -| `trackingNumber` | `string \| null \| undefined` | Optional | The reference number provided by the carrier to track the shipment's progress.
**Constraints**: *Maximum Length*: `100` | -| `trackingUrl` | `string \| null \| undefined` | Optional | A link to the tracking webpage on the carrier's website.
**Constraints**: *Maximum Length*: `2000` | -| `placedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the shipment was requested. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `inProgressAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation
of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `packagedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the
fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `expectedShippedAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the shipment is expected to be delivered to the shipping carrier.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `shippedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that
the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `canceledAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating the shipment was canceled.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `cancelReason` | `string \| null \| undefined` | Optional | A description of why the shipment was canceled.
**Constraints**: *Maximum Length*: `100` | -| `failedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `failureReason` | `string \| null \| undefined` | Optional | A description of why the shipment failed to be completed.
**Constraints**: *Maximum Length*: `100` | - -## Example (as JSON) - -```json -{ - "recipient": { - "customer_id": "customer_id6", - "display_name": "display_name8", - "email_address": "email_address4", - "phone_number": "phone_number4", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "carrier": "carrier6", - "shipping_note": "shipping_note0", - "shipping_type": "shipping_type2", - "tracking_number": "tracking_number2" -} -``` - diff --git a/doc/models/fulfillment-state.md b/doc/models/fulfillment-state.md deleted file mode 100644 index 7d4cc072f..000000000 --- a/doc/models/fulfillment-state.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Fulfillment State - -The current state of this fulfillment. - -## Enumeration - -`FulfillmentState` - -## Fields - -| Name | Description | -| --- | --- | -| `PROPOSED` | Indicates that the fulfillment has been proposed. | -| `RESERVED` | Indicates that the fulfillment has been reserved. | -| `PREPARED` | Indicates that the fulfillment has been prepared. | -| `COMPLETED` | Indicates that the fulfillment was successfully completed. | -| `CANCELED` | Indicates that the fulfillment was canceled. | -| `FAILED` | Indicates that the fulfillment failed to be completed, but was not explicitly
canceled. | - diff --git a/doc/models/fulfillment-type.md b/doc/models/fulfillment-type.md deleted file mode 100644 index cada76fdd..000000000 --- a/doc/models/fulfillment-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Fulfillment Type - -The type of fulfillment. - -## Enumeration - -`FulfillmentType` - -## Fields - -| Name | Description | -| --- | --- | -| `PICKUP` | A recipient to pick up the fulfillment from a physical [location](../../doc/models/location.md). | -| `SHIPMENT` | A shipping carrier to ship the fulfillment. | -| `DELIVERY` | A courier to deliver the fulfillment. | - diff --git a/doc/models/fulfillment.md b/doc/models/fulfillment.md deleted file mode 100644 index 71e649cd0..000000000 --- a/doc/models/fulfillment.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Fulfillment - -Contains details about how to fulfill this order. -Orders can only be created with at most one fulfillment using the API. -However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. - -## Structure - -`Fulfillment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the fulfillment only within this order.
**Constraints**: *Maximum Length*: `60` | -| `type` | [`string \| undefined`](../../doc/models/fulfillment-type.md) | Optional | The type of fulfillment. | -| `state` | [`string \| undefined`](../../doc/models/fulfillment-state.md) | Optional | The current state of this fulfillment. | -| `lineItemApplication` | [`string \| undefined`](../../doc/models/fulfillment-fulfillment-line-item-application.md) | Optional | The `line_item_application` describes what order line items this fulfillment applies
to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. | -| `entries` | [`FulfillmentFulfillmentEntry[] \| undefined`](../../doc/models/fulfillment-fulfillment-entry.md) | Optional | A list of entries pertaining to the fulfillment of an order. Each entry must reference
a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to
fulfill.

Multiple entries can reference the same line item `uid`, as long as the total quantity among
all fulfillment entries referencing a single line item does not exceed the quantity of the
order's line item itself.

An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`,
`CANCELED`, or `FAILED`. Fulfillments can be created and completed independently
before order completion. | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this fulfillment. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | -| `pickupDetails` | [`FulfillmentPickupDetails \| undefined`](../../doc/models/fulfillment-pickup-details.md) | Optional | Contains details necessary to fulfill a pickup order. | -| `shipmentDetails` | [`FulfillmentShipmentDetails \| undefined`](../../doc/models/fulfillment-shipment-details.md) | Optional | Contains the details necessary to fulfill a shipment order. | -| `deliveryDetails` | [`FulfillmentDeliveryDetails \| undefined`](../../doc/models/fulfillment-delivery-details.md) | Optional | Describes delivery details of an order fulfillment. | - -## Example (as JSON) - -```json -{ - "uid": "uid0", - "type": "DELIVERY", - "state": "CANCELED", - "line_item_application": "ALL", - "entries": [ - { - "uid": "uid0", - "line_item_uid": "line_item_uid0", - "quantity": "quantity6", - "metadata": { - "key0": "metadata3", - "key1": "metadata4", - "key2": "metadata5" - } - } - ] -} -``` - diff --git a/doc/models/get-bank-account-by-v1-id-response.md b/doc/models/get-bank-account-by-v1-id-response.md deleted file mode 100644 index 4c1c09aad..000000000 --- a/doc/models/get-bank-account-by-v1-id-response.md +++ /dev/null @@ -1,62 +0,0 @@ - -# Get Bank Account by V1 Id Response - -Response object returned by GetBankAccountByV1Id. - -## Structure - -`GetBankAccountByV1IdResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `bankAccount` | [`BankAccount \| undefined`](../../doc/models/bank-account.md) | Optional | Represents a bank account. For more information about
linking a bank account to a Square account, see
[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). | - -## Example (as JSON) - -```json -{ - "bank_account": { - "account_number_suffix": "971", - "account_type": "CHECKING", - "bank_name": "Bank Name", - "country": "US", - "creditable": false, - "currency": "USD", - "debitable": false, - "holder_name": "Jane Doe", - "id": "w3yRgCGYQnwmdl0R3GB", - "location_id": "S8GWD5example", - "primary_bank_identification_number": "112200303", - "status": "VERIFICATION_IN_PROGRESS", - "version": 5, - "secondary_bank_identification_number": "secondary_bank_identification_number4", - "debit_mandate_reference_id": "debit_mandate_reference_id0", - "reference_id": "reference_id2", - "fingerprint": "fingerprint0" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-bank-account-response.md b/doc/models/get-bank-account-response.md deleted file mode 100644 index 81d91a19d..000000000 --- a/doc/models/get-bank-account-response.md +++ /dev/null @@ -1,50 +0,0 @@ - -# Get Bank Account Response - -Response object returned by `GetBankAccount`. - -## Structure - -`GetBankAccountResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `bankAccount` | [`BankAccount \| undefined`](../../doc/models/bank-account.md) | Optional | Represents a bank account. For more information about
linking a bank account to a Square account, see
[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). | - -## Example (as JSON) - -```json -{ - "bank_account": { - "account_number_suffix": "971", - "account_type": "CHECKING", - "bank_name": "Bank Name", - "country": "US", - "creditable": false, - "currency": "USD", - "debitable": false, - "holder_name": "Jane Doe", - "id": "w3yRgCGYQnwmdl0R3GB", - "location_id": "S8GWD5example", - "primary_bank_identification_number": "112200303", - "status": "VERIFICATION_IN_PROGRESS", - "version": 5, - "secondary_bank_identification_number": "secondary_bank_identification_number4", - "debit_mandate_reference_id": "debit_mandate_reference_id0", - "reference_id": "reference_id2", - "fingerprint": "fingerprint0" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-break-type-response.md b/doc/models/get-break-type-response.md deleted file mode 100644 index c66405396..000000000 --- a/doc/models/get-break-type-response.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Get Break Type Response - -The response to a request to get a `BreakType`. The response contains -the requested `BreakType` objects and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`GetBreakTypeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `breakType` | [`BreakType \| undefined`](../../doc/models/break-type.md) | Optional | A defined break template that sets an expectation for possible `Break`
instances on a `Shift`. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "break_type": { - "break_name": "Lunch Break", - "created_at": "2019-02-21T17:50:00Z", - "expected_duration": "PT30M", - "id": "lA0mj_RSOprNPwMUXdYp", - "is_paid": true, - "location_id": "059SB0E0WCNWS", - "updated_at": "2019-02-21T17:50:00Z", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-device-code-response.md b/doc/models/get-device-code-response.md deleted file mode 100644 index 54fbba453..000000000 --- a/doc/models/get-device-code-response.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Get Device Code Response - -## Structure - -`GetDeviceCodeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `deviceCode` | [`DeviceCode \| undefined`](../../doc/models/device-code.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "device_code": { - "code": "EBCARJ", - "created_at": "2020-02-06T18:44:33.000Z", - "device_id": "907CS13101300122", - "id": "B3Z6NAMYQSMTM", - "location_id": "B5E4484SHHNYH", - "name": "Counter 1", - "pair_by": "2020-02-06T18:49:33.000Z", - "product_type": "TERMINAL_API", - "status": "PAIRED", - "status_changed_at": "2020-02-06T18:47:28.000Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-device-response.md b/doc/models/get-device-response.md deleted file mode 100644 index fb04916ba..000000000 --- a/doc/models/get-device-response.md +++ /dev/null @@ -1,191 +0,0 @@ - -# Get Device Response - -## Structure - -`GetDeviceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `device` | [`Device \| undefined`](../../doc/models/device.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "device": { - "attributes": { - "manufacturer": "Square", - "manufacturers_id": "995CS397A6475287", - "merchant_token": "MLCHXZCBWFGDW", - "model": "T2", - "name": "Square Terminal 995", - "type": "TERMINAL", - "updated_at": "2023-09-29T13:12:22.365049321Z", - "version": "5.41.0085" - }, - "components": [ - { - "application_details": { - "application_type": "TERMINAL_API", - "session_location": "LMN2K7S3RTOU3", - "version": "6.25", - "device_code_id": "device_code_id2" - }, - "type": "APPLICATION", - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "card_reader_details": { - "version": "3.53.70" - }, - "type": "CARD_READER", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "battery_details": { - "external_power": "AVAILABLE_CHARGING", - "visible_percent": 5 - }, - "type": "BATTERY", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "type": "WIFI", - "wifi_details": { - "active": true, - "ip_address_v4": "10.0.0.7", - "secure_connection": "WPA/WPA2 PSK", - "signal_strength": { - "value": 2 - }, - "ssid": "Staff Network" - }, - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "ethernet_details": { - "active": false - }, - "type": "ETHERNET", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - } - } - ], - "id": "device:995CS397A6475287", - "status": { - "category": "AVAILABLE" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-employee-wage-response.md b/doc/models/get-employee-wage-response.md deleted file mode 100644 index d6a6ba7a4..000000000 --- a/doc/models/get-employee-wage-response.md +++ /dev/null @@ -1,54 +0,0 @@ - -# Get Employee Wage Response - -A response to a request to get an `EmployeeWage`. The response contains -the requested `EmployeeWage` objects and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`GetEmployeeWageResponse` - -## Fields - -| 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](entity:TeamMemberWage). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "employee_wage": { - "employee_id": "33fJchumvVdJwxV0H6L9", - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "id": "pXS3qCv7BERPnEGedM4S8mhm", - "title": "Manager" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-invoice-response.md b/doc/models/get-invoice-response.md deleted file mode 100644 index 0d961740e..000000000 --- a/doc/models/get-invoice-response.md +++ /dev/null @@ -1,106 +0,0 @@ - -# Get Invoice Response - -Describes a `GetInvoice` response. - -## Structure - -`GetInvoiceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoice` | [`Invoice \| undefined`](../../doc/models/invoice.md) | Optional | Stores information about an invoice. You use the Invoices API to create and manage
invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "invoice": { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": false - }, - "created_at": "2020-06-18T17:45:13Z", - "custom_fields": [ - { - "label": "Event Reference Number", - "placement": "ABOVE_LINE_ITEMS", - "value": "Ref. #1234" - }, - { - "label": "Terms of Service", - "placement": "BELOW_LINE_ITEMS", - "value": "The terms of service are..." - } - ], - "delivery_method": "EMAIL", - "description": "We appreciate your business!", - "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "invoice_number": "inv-100", - "location_id": "ES0RJRZYEC39A", - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "payment_requests": [ - { - "automatic_payment_source": "NONE", - "computed_amount_money": { - "amount": 10000, - "currency": "USD" - }, - "due_date": "2030-01-24", - "reminders": [ - { - "message": "Your invoice is due tomorrow", - "relative_scheduled_days": -1, - "status": "PENDING", - "uid": "beebd363-e47f-4075-8785-c235aaa7df11" - } - ], - "request_type": "BALANCE", - "tipping_enabled": true, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "sale_or_service_date": "2030-01-24", - "scheduled_at": "2030-01-13T10:00:00Z", - "status": "DRAFT", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "title": "Event Planning Services", - "updated_at": "2020-06-18T17:45:13Z", - "version": 0 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-payment-refund-response.md b/doc/models/get-payment-refund-response.md deleted file mode 100644 index 1c89c5559..000000000 --- a/doc/models/get-payment-refund-response.md +++ /dev/null @@ -1,100 +0,0 @@ - -# Get Payment Refund Response - -Defines the response returned by [GetRefund](../../doc/api/refunds.md#get-payment-refund). - -Note: If there are errors processing the request, the refund field might not be -present or it might be present in a FAILED state. - -## Structure - -`GetPaymentRefundResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `refund` | [`PaymentRefund \| undefined`](../../doc/models/payment-refund.md) | Optional | Represents a refund of a payment made using Square. Contains information about
the original payment and the amount of money refunded. | - -## Example (as JSON) - -```json -{ - "refund": { - "amount_money": { - "amount": 555, - "currency": "USD" - }, - "created_at": "2021-10-13T19:59:05.073Z", - "id": "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY_69MmgHubkLqx9wGhnmenRUHOaKitE6llfZuxcWYjGxd", - "location_id": "L88917AVBK2S5", - "order_id": "9ltv0bx5PuvGXUYHYHxYSKEqC3IZY", - "payment_id": "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", - "processing_fee": [ - { - "amount_money": { - "amount": -34, - "currency": "USD" - }, - "effective_at": "2021-10-13T21:34:35.000Z", - "type": "INITIAL" - } - ], - "reason": "Example Refund", - "status": "COMPLETED", - "updated_at": "2021-10-13T20:00:02.442Z", - "unlinked": false, - "destination_type": "destination_type2", - "destination_details": { - "card_details": { - "card": { - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "entry_method": "entry_method8", - "auth_result_code": "auth_result_code0" - }, - "cash_details": { - "seller_supplied_money": { - "amount": 36, - "currency": "MKD" - }, - "change_back_money": { - "amount": 78, - "currency": "XBD" - } - }, - "external_details": { - "type": "type6", - "source": "source0", - "source_id": "source_id8" - } - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-payment-response.md b/doc/models/get-payment-response.md deleted file mode 100644 index 030e80ea3..000000000 --- a/doc/models/get-payment-response.md +++ /dev/null @@ -1,101 +0,0 @@ - -# Get Payment Response - -Defines the response returned by [GetPayment](../../doc/api/payments.md#get-payment). - -## Structure - -`GetPaymentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `payment` | [`Payment \| undefined`](../../doc/models/payment.md) | Optional | Represents a payment processed by the Square API. | - -## Example (as JSON) - -```json -{ - "payment": { - "amount_money": { - "amount": 555, - "currency": "USD" - }, - "application_details": { - "application_id": "sq0ids-Pw67AZAlLVB7hsRmwlJPuA", - "square_product": "VIRTUAL_TERMINAL" - }, - "approved_money": { - "amount": 555, - "currency": "USD" - }, - "card_details": { - "auth_result_code": "2Nkw7q", - "avs_status": "AVS_ACCEPTED", - "card": { - "bin": "411111", - "card_brand": "VISA", - "card_type": "DEBIT", - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", - "last_4": "1111", - "prepaid_type": "NOT_PREPAID" - }, - "card_payment_timeline": { - "authorized_at": "2021-10-13T19:34:33.680Z", - "captured_at": "2021-10-13T19:34:34.340Z" - }, - "cvv_status": "CVV_ACCEPTED", - "entry_method": "KEYED", - "statement_description": "SQ *EXAMPLE TEST GOSQ.C", - "status": "CAPTURED" - }, - "created_at": "2021-10-13T19:34:33.524Z", - "delay_action": "CANCEL", - "delay_duration": "PT168H", - "delayed_until": "2021-10-20T19:34:33.524Z", - "employee_id": "TMoK_ogh6rH1o4dV", - "id": "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", - "location_id": "L88917AVBK2S5", - "note": "Test Note", - "order_id": "d7eKah653Z579f3gVtjlxpSlmUcZY", - "processing_fee": [ - { - "amount_money": { - "amount": 34, - "currency": "USD" - }, - "effective_at": "2021-10-13T21:34:35.000Z", - "type": "INITIAL" - } - ], - "receipt_number": "bP9m", - "receipt_url": "https://squareup.com/receipt/preview/bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", - "source_type": "CARD", - "status": "COMPLETED", - "team_member_id": "TMoK_ogh6rH1o4dV", - "total_money": { - "amount": 555, - "currency": "USD" - }, - "updated_at": "2021-10-13T19:34:34.339Z", - "version_token": "56pRkL3slrzet2iQrTp9n0bdJVYTB9YEWdTNjQfZOPV6o", - "tip_money": { - "amount": 190, - "currency": "TWD" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-payout-response.md b/doc/models/get-payout-response.md deleted file mode 100644 index e412961b6..000000000 --- a/doc/models/get-payout-response.md +++ /dev/null @@ -1,54 +0,0 @@ - -# Get Payout Response - -## Structure - -`GetPayoutResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `payout` | [`Payout \| undefined`](../../doc/models/payout.md) | Optional | An accounting of the amount owed the seller and record of the actual transfer to their
external bank account or to the Square balance. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "payout": { - "amount_money": { - "amount": -103, - "currency_code": "USD", - "currency": "AUD" - }, - "arrival_date": "2022-03-24", - "created_at": "2022-03-24T03:07:09Z", - "destination": { - "id": "bact:ZPp3oedR3AeEUNd3z7", - "type": "BANK_ACCOUNT" - }, - "id": "po_f3c0fb38-a5ce-427d-b858-52b925b72e45", - "location_id": "L88917AVBK2S5", - "status": "PAID", - "type": "BATCH", - "updated_at": "2022-03-24T03:07:09Z", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-shift-response.md b/doc/models/get-shift-response.md deleted file mode 100644 index eeafeb1d4..000000000 --- a/doc/models/get-shift-response.md +++ /dev/null @@ -1,82 +0,0 @@ - -# Get Shift Response - -A response to a request to get a `Shift`. The response contains -the requested `Shift` object and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`GetShiftResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `shift` | [`Shift \| undefined`](../../doc/models/shift.md) | Optional | A record of the hourly rate, start, and end times for a single work shift
for an employee. This might include a record of the start and end times for breaks
taken during the shift. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "shift": { - "breaks": [ - { - "break_type_id": "92EPDRQKJ5088", - "end_at": "2019-02-23T20:00:00-05:00", - "expected_duration": "PT1H", - "id": "M9BBKEPQAQD2T", - "is_paid": true, - "name": "Lunch Break", - "start_at": "2019-02-23T19:00:00-05:00" - } - ], - "created_at": "2019-02-27T00:12:12Z", - "declared_cash_tip_money": { - "amount": 500, - "currency": "USD" - }, - "employee_id": "D71KRMQof6cXGUW0aAv7", - "end_at": "2019-02-23T21:00:00-05:00", - "id": "T35HMQSN89SV4", - "location_id": "PAA1RJZZKXBFG", - "start_at": "2019-02-23T18:00:00-05:00", - "status": "CLOSED", - "team_member_id": "D71KRMQof6cXGUW0aAv7", - "timezone": "America/New_York", - "updated_at": "2019-02-27T00:12:12Z", - "version": 1, - "wage": { - "hourly_rate": { - "amount": 1457, - "currency": "USD" - }, - "job_id": "N4YKVLzFj3oGtNocqoYHYpW3", - "tip_eligible": true, - "title": "Cashier" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-team-member-wage-response.md b/doc/models/get-team-member-wage-response.md deleted file mode 100644 index a3b9e9a7d..000000000 --- a/doc/models/get-team-member-wage-response.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Get Team Member Wage Response - -A response to a request to get a `TeamMemberWage`. The response contains -the requested `TeamMemberWage` objects and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`GetTeamMemberWageResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberWage` | [`TeamMemberWage \| undefined`](../../doc/models/team-member-wage.md) | Optional | The hourly wage rate that a team member earns on a `Shift` for doing the job
specified by the `title` property of this object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "team_member_wage": { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "id": "pXS3qCv7BERPnEGedM4S8mhm", - "job_id": "jxJNN6eCJsLrhg5UFJrDWDGE", - "team_member_id": "33fJchumvVdJwxV0H6L9", - "tip_eligible": false, - "title": "Manager" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-terminal-action-response.md b/doc/models/get-terminal-action-response.md deleted file mode 100644 index 12d2ad324..000000000 --- a/doc/models/get-terminal-action-response.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Get Terminal Action Response - -## Structure - -`GetTerminalActionResponse` - -## 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", - "created_at": "2021-07-28T23:22:07.476Z", - "deadline_duration": "PT5M", - "device_id": "DEVICE_ID", - "id": "termapia:jveJIAkkAjILHkdCE", - "location_id": "LOCATION_ID", - "save_card_options": { - "customer_id": "CUSTOMER_ID", - "reference_id": "user-id-1" - }, - "status": "IN_PROGRESS", - "type": "SAVE_CARD", - "updated_at": "2021-07-28T23:22:08.301Z", - "cancel_reason": "TIMED_OUT" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-terminal-checkout-response.md b/doc/models/get-terminal-checkout-response.md deleted file mode 100644 index 2768adf96..000000000 --- a/doc/models/get-terminal-checkout-response.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Get Terminal Checkout Response - -## Structure - -`GetTerminalCheckoutResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `checkout` | [`TerminalCheckout \| undefined`](../../doc/models/terminal-checkout.md) | Optional | Represents a checkout processed by the Square Terminal. | - -## Example (as JSON) - -```json -{ - "checkout": { - "amount_money": { - "amount": 2610, - "currency": "USD" - }, - "app_id": "APP_ID", - "created_at": "2020-04-06T16:39:32.545Z", - "deadline_duration": "PT5M", - "device_options": { - "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", - "skip_receipt_screen": false, - "tip_settings": { - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "collect_signature": false, - "show_itemized_cart": false - }, - "id": "08YceKh7B3ZqO", - "location_id": "LOCATION_ID", - "note": "A brief note", - "reference_id": "id11572", - "status": "IN_PROGRESS", - "updated_at": "2020-04-06T16:39:323.001Z", - "order_id": "order_id6", - "payment_options": { - "autocomplete": false, - "delay_duration": "delay_duration2", - "accept_partial_authorization": false, - "delay_action": "CANCEL" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/get-terminal-refund-response.md b/doc/models/get-terminal-refund-response.md deleted file mode 100644 index 97a307ada..000000000 --- a/doc/models/get-terminal-refund-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Get Terminal Refund Response - -## Structure - -`GetTerminalRefundResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `refund` | [`TerminalRefund \| undefined`](../../doc/models/terminal-refund.md) | Optional | Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. | - -## Example (as JSON) - -```json -{ - "refund": { - "amount_money": { - "amount": 111, - "currency": "CAD" - }, - "app_id": "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", - "card": { - "bin": "411111", - "card_brand": "INTERAC", - "card_type": "CREDIT", - "exp_month": 1, - "exp_year": 2022, - "fingerprint": "sq-1-B1fP9MNNmZgVVaPKRND6oDKYbz25S2cTvg9Mzwg3RMTK1zT1PiGRT-AE3nTA8vSmmw", - "last_4": "1111" - }, - "created_at": "2020-09-29T15:21:46.771Z", - "deadline_duration": "PT5M", - "device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", - "id": "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "location_id": "76C9W6K8CNNQ5", - "order_id": "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", - "payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "reason": "Returning item", - "refund_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb", - "status": "COMPLETED", - "updated_at": "2020-09-29T15:21:48.675Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/gift-card-activity-activate.md b/doc/models/gift-card-activity-activate.md deleted file mode 100644 index 7ea711e83..000000000 --- a/doc/models/gift-card-activity-activate.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Gift Card Activity Activate - -Represents details about an `ACTIVATE` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityActivate` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`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. | -| `orderId` | `string \| null \| undefined` | Optional | The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item.

Applications that use the Square Orders API to process orders must specify the order ID
[CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. | -| `lineItemUid` | `string \| null \| undefined` | Optional | The UID of the `GIFT_CARD` line item in the order that represents the gift card purchase.

Applications that use the Square Orders API to process orders must specify the line item UID
in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. | -| `referenceId` | `string \| null \| undefined` | Optional | A client-specified ID that associates the gift card activity with an entity in another system.

Applications that use a custom order processing system can use this field to track information
related to an order or payment. | -| `buyerPaymentInstrumentIds` | `string[] \| null \| undefined` | Optional | The payment instrument IDs used to process the gift card purchase, such as a credit card ID
or bank account ID.

Applications that use a custom order processing system must specify payment instrument IDs in
the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
Square uses this information to perform compliance checks.

For applications that use the Square Orders API to process payments, Square has the necessary
instrument IDs to perform compliance checks.

Each buyer payment instrument ID can contain a maximum of 255 characters. | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "order_id": "order_id2", - "line_item_uid": "line_item_uid4", - "reference_id": "reference_id8", - "buyer_payment_instrument_ids": [ - "buyer_payment_instrument_ids0" - ] -} -``` - diff --git a/doc/models/gift-card-activity-adjust-decrement-reason.md b/doc/models/gift-card-activity-adjust-decrement-reason.md deleted file mode 100644 index 6af176038..000000000 --- a/doc/models/gift-card-activity-adjust-decrement-reason.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Gift Card Activity Adjust Decrement Reason - -Indicates the reason for deducting money from a [gift card](../../doc/models/gift-card.md). - -## Enumeration - -`GiftCardActivityAdjustDecrementReason` - -## Fields - -| Name | Description | -| --- | --- | -| `SUSPICIOUS_ACTIVITY` | The balance was decreased because the seller detected suspicious or fraudulent activity
on the gift card. | -| `BALANCE_ACCIDENTALLY_INCREASED` | The balance was decreased to reverse an unintentional balance increase. | -| `SUPPORT_ISSUE` | The balance was decreased to accommodate support issues. | -| `PURCHASE_WAS_REFUNDED` | The balance was decreased because the order used to purchase or reload the
gift card was refunded. | - diff --git a/doc/models/gift-card-activity-adjust-decrement.md b/doc/models/gift-card-activity-adjust-decrement.md deleted file mode 100644 index e354bb6b7..000000000 --- a/doc/models/gift-card-activity-adjust-decrement.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Gift Card Activity Adjust Decrement - -Represents details about an `ADJUST_DECREMENT` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityAdjustDecrement` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `reason` | [`string`](../../doc/models/gift-card-activity-adjust-decrement-reason.md) | Required | Indicates the reason for deducting money from a [gift card](../../doc/models/gift-card.md). | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "reason": "SUPPORT_ISSUE" -} -``` - diff --git a/doc/models/gift-card-activity-adjust-increment-reason.md b/doc/models/gift-card-activity-adjust-increment-reason.md deleted file mode 100644 index c7bebb4d2..000000000 --- a/doc/models/gift-card-activity-adjust-increment-reason.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Gift Card Activity Adjust Increment Reason - -Indicates the reason for adding money to a [gift card](../../doc/models/gift-card.md). - -## Enumeration - -`GiftCardActivityAdjustIncrementReason` - -## Fields - -| Name | Description | -| --- | --- | -| `COMPLIMENTARY` | The seller gifted a complimentary gift card balance increase. | -| `SUPPORT_ISSUE` | The seller increased the gift card balance
to accommodate support issues. | -| `TRANSACTION_VOIDED` | The transaction is voided. | - diff --git a/doc/models/gift-card-activity-adjust-increment.md b/doc/models/gift-card-activity-adjust-increment.md deleted file mode 100644 index 2eade3074..000000000 --- a/doc/models/gift-card-activity-adjust-increment.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Gift Card Activity Adjust Increment - -Represents details about an `ADJUST_INCREMENT` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityAdjustIncrement` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `reason` | [`string`](../../doc/models/gift-card-activity-adjust-increment-reason.md) | Required | Indicates the reason for adding money to a [gift card](../../doc/models/gift-card.md). | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "reason": "COMPLIMENTARY" -} -``` - diff --git a/doc/models/gift-card-activity-block-reason.md b/doc/models/gift-card-activity-block-reason.md deleted file mode 100644 index 6bf54c740..000000000 --- a/doc/models/gift-card-activity-block-reason.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Gift Card Activity Block Reason - -Indicates the reason for blocking a [gift card](../../doc/models/gift-card.md). - -## Enumeration - -`GiftCardActivityBlockReason` - -## Fields - -| Name | Description | -| --- | --- | -| `CHARGEBACK_BLOCK` | The gift card is blocked because the buyer initiated a chargeback on the gift card purchase. | - diff --git a/doc/models/gift-card-activity-block.md b/doc/models/gift-card-activity-block.md deleted file mode 100644 index 107514f94..000000000 --- a/doc/models/gift-card-activity-block.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Gift Card Activity Block - -Represents details about a `BLOCK` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityBlock` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `reason` | `string` | Required, Constant | Indicates the reason for blocking a [gift card](../../doc/models/gift-card.md).
**Default**: `'CHARGEBACK_BLOCK'` | - -## Example (as JSON) - -```json -{ - "reason": "CHARGEBACK_BLOCK" -} -``` - diff --git a/doc/models/gift-card-activity-clear-balance-reason.md b/doc/models/gift-card-activity-clear-balance-reason.md deleted file mode 100644 index 64a284914..000000000 --- a/doc/models/gift-card-activity-clear-balance-reason.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Gift Card Activity Clear Balance Reason - -Indicates the reason for clearing the balance of a [gift card](../../doc/models/gift-card.md). - -## Enumeration - -`GiftCardActivityClearBalanceReason` - -## Fields - -| Name | Description | -| --- | --- | -| `SUSPICIOUS_ACTIVITY` | The seller suspects suspicious activity. | -| `REUSE_GIFTCARD` | The seller cleared the balance to reuse the gift card. | -| `UNKNOWN_REASON` | The gift card balance was cleared for an unknown reason.

This reason is read-only and cannot be used to create a `CLEAR_BALANCE` activity using the Gift Card Activities API. | - diff --git a/doc/models/gift-card-activity-clear-balance.md b/doc/models/gift-card-activity-clear-balance.md deleted file mode 100644 index 236458c57..000000000 --- a/doc/models/gift-card-activity-clear-balance.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Gift Card Activity Clear Balance - -Represents details about a `CLEAR_BALANCE` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityClearBalance` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `reason` | [`string`](../../doc/models/gift-card-activity-clear-balance-reason.md) | Required | Indicates the reason for clearing the balance of a [gift card](../../doc/models/gift-card.md). | - -## Example (as JSON) - -```json -{ - "reason": "SUSPICIOUS_ACTIVITY" -} -``` - diff --git a/doc/models/gift-card-activity-deactivate-reason.md b/doc/models/gift-card-activity-deactivate-reason.md deleted file mode 100644 index 9cc8fd8d0..000000000 --- a/doc/models/gift-card-activity-deactivate-reason.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Gift Card Activity Deactivate Reason - -Indicates the reason for deactivating a [gift card](../../doc/models/gift-card.md). - -## Enumeration - -`GiftCardActivityDeactivateReason` - -## Fields - -| Name | Description | -| --- | --- | -| `SUSPICIOUS_ACTIVITY` | The seller suspects suspicious activity. | -| `UNKNOWN_REASON` | The gift card was deactivated for an unknown reason.

This reason is read-only and cannot be used to create a `DEACTIVATE` activity using the Gift Card Activities API. | -| `CHARGEBACK_DEACTIVATE` | A chargeback on the gift card purchase (or the gift card load) was ruled in favor of the buyer.

This reason is read-only and cannot be used to create a `DEACTIVATE` activity using the Gift Card Activities API. | - diff --git a/doc/models/gift-card-activity-deactivate.md b/doc/models/gift-card-activity-deactivate.md deleted file mode 100644 index 80cc26759..000000000 --- a/doc/models/gift-card-activity-deactivate.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Gift Card Activity Deactivate - -Represents details about a `DEACTIVATE` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityDeactivate` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `reason` | [`string`](../../doc/models/gift-card-activity-deactivate-reason.md) | Required | Indicates the reason for deactivating a [gift card](../../doc/models/gift-card.md). | - -## Example (as JSON) - -```json -{ - "reason": "CHARGEBACK_DEACTIVATE" -} -``` - diff --git a/doc/models/gift-card-activity-import-reversal.md b/doc/models/gift-card-activity-import-reversal.md deleted file mode 100644 index 8faf4d6d0..000000000 --- a/doc/models/gift-card-activity-import-reversal.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Gift Card Activity Import Reversal - -Represents details about an `IMPORT_REVERSAL` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityImportReversal` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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 -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - } -} -``` - diff --git a/doc/models/gift-card-activity-import.md b/doc/models/gift-card-activity-import.md deleted file mode 100644 index 64bb071a1..000000000 --- a/doc/models/gift-card-activity-import.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Gift Card Activity Import - -Represents details about an `IMPORT` [gift card activity type](../../doc/models/gift-card-activity-type.md). -This activity type is used when Square imports a third-party gift card, in which case the -`gan_source` of the gift card is set to `OTHER`. - -## Structure - -`GiftCardActivityImport` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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 -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - } -} -``` - diff --git a/doc/models/gift-card-activity-load.md b/doc/models/gift-card-activity-load.md deleted file mode 100644 index 9fd32883d..000000000 --- a/doc/models/gift-card-activity-load.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Gift Card Activity Load - -Represents details about a `LOAD` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityLoad` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`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. | -| `orderId` | `string \| null \| undefined` | Optional | The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item.

Applications that use the Square Orders API to process orders must specify the order ID in the
[CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. | -| `lineItemUid` | `string \| null \| undefined` | Optional | The UID of the `GIFT_CARD` line item in the order that represents the additional funds for the gift card.

Applications that use the Square Orders API to process orders must specify the line item UID
in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. | -| `referenceId` | `string \| null \| undefined` | Optional | A client-specified ID that associates the gift card activity with an entity in another system.

Applications that use a custom order processing system can use this field to track information related to
an order or payment. | -| `buyerPaymentInstrumentIds` | `string[] \| null \| undefined` | Optional | The payment instrument IDs used to process the order for the additional funds, such as a credit card ID
or bank account ID.

Applications that use a custom order processing system must specify payment instrument IDs in
the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request.
Square uses this information to perform compliance checks.

For applications that use the Square Orders API to process payments, Square has the necessary
instrument IDs to perform compliance checks.

Each buyer payment instrument ID can contain a maximum of 255 characters. | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "order_id": "order_id2", - "line_item_uid": "line_item_uid8", - "reference_id": "reference_id6", - "buyer_payment_instrument_ids": [ - "buyer_payment_instrument_ids4", - "buyer_payment_instrument_ids5" - ] -} -``` - diff --git a/doc/models/gift-card-activity-redeem-status.md b/doc/models/gift-card-activity-redeem-status.md deleted file mode 100644 index ea411fbed..000000000 --- a/doc/models/gift-card-activity-redeem-status.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Gift Card Activity Redeem Status - -Indicates the status of a [gift card](../../doc/models/gift-card.md) redemption. This status is relevant only for -redemptions made from Square products (such as Square Point of Sale) because Square products use a -two-state process. Gift cards redeemed using the Gift Card Activities API always have a `COMPLETED` status. - -## Enumeration - -`GiftCardActivityRedeemStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `PENDING` | The gift card redemption is pending. `PENDING` is a temporary status that applies when a
gift card is redeemed from Square Point of Sale or another Square product. A `PENDING` status is updated to
`COMPLETED` if the payment is captured or `CANCELED` if the authorization is voided. | -| `COMPLETED` | The gift card redemption is completed. | -| `CANCELED` | The gift card redemption is canceled. A redemption is canceled if the authorization
on the gift card is voided. | - diff --git a/doc/models/gift-card-activity-redeem.md b/doc/models/gift-card-activity-redeem.md deleted file mode 100644 index 5e3ddcc8e..000000000 --- a/doc/models/gift-card-activity-redeem.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Gift Card Activity Redeem - -Represents details about a `REDEEM` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityRedeem` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `paymentId` | `string \| undefined` | Optional | The ID of the payment that represents the gift card redemption. Square populates this field
if the payment was processed by Square. | -| `referenceId` | `string \| null \| undefined` | Optional | A client-specified ID that associates the gift card activity with an entity in another system.

Applications that use a custom payment processing system can use this field to track information
related to an order or payment. | -| `status` | [`string \| undefined`](../../doc/models/gift-card-activity-redeem-status.md) | Optional | Indicates the status of a [gift card](../../doc/models/gift-card.md) redemption. This status is relevant only for
redemptions made from Square products (such as Square Point of Sale) because Square products use a
two-state process. Gift cards redeemed using the Gift Card Activities API always have a `COMPLETED` status. | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "payment_id": "payment_id4", - "reference_id": "reference_id2", - "status": "COMPLETED" -} -``` - diff --git a/doc/models/gift-card-activity-refund.md b/doc/models/gift-card-activity-refund.md deleted file mode 100644 index b65f53218..000000000 --- a/doc/models/gift-card-activity-refund.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Gift Card Activity Refund - -Represents details about a `REFUND` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityRefund` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `redeemActivityId` | `string \| null \| undefined` | Optional | The ID of the refunded `REDEEM` gift card activity. Square populates this field if the
`payment_id` in the corresponding [RefundPayment](api-endpoint:Refunds-RefundPayment) request
represents a gift card redemption.

For applications that use a custom payment processing system, this field is required when creating
a `REFUND` activity. The provided `REDEEM` activity ID must be linked to the same gift card. | -| `amountMoney` | [`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. | -| `referenceId` | `string \| null \| undefined` | Optional | A client-specified ID that associates the gift card activity with an entity in another system. | -| `paymentId` | `string \| undefined` | Optional | The ID of the refunded payment. Square populates this field if the refund is for a
payment processed by Square. This field matches the `payment_id` in the corresponding
[RefundPayment](api-endpoint:Refunds-RefundPayment) request. | - -## Example (as JSON) - -```json -{ - "redeem_activity_id": "redeem_activity_id4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "reference_id": "reference_id8", - "payment_id": "payment_id4" -} -``` - diff --git a/doc/models/gift-card-activity-transfer-balance-from.md b/doc/models/gift-card-activity-transfer-balance-from.md deleted file mode 100644 index 7efef2e6c..000000000 --- a/doc/models/gift-card-activity-transfer-balance-from.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Gift Card Activity Transfer Balance From - -Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityTransferBalanceFrom` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `transferToGiftCardId` | `string` | Required | The ID of the gift card to which the specified amount was transferred. | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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 -{ - "transfer_to_gift_card_id": "transfer_to_gift_card_id0", - "amount_money": { - "amount": 186, - "currency": "AUD" - } -} -``` - diff --git a/doc/models/gift-card-activity-transfer-balance-to.md b/doc/models/gift-card-activity-transfer-balance-to.md deleted file mode 100644 index e8de2695a..000000000 --- a/doc/models/gift-card-activity-transfer-balance-to.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Gift Card Activity Transfer Balance To - -Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityTransferBalanceTo` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `transferFromGiftCardId` | `string` | Required | The ID of the gift card from which the specified amount was transferred. | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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 -{ - "transfer_from_gift_card_id": "transfer_from_gift_card_id6", - "amount_money": { - "amount": 186, - "currency": "AUD" - } -} -``` - diff --git a/doc/models/gift-card-activity-type.md b/doc/models/gift-card-activity-type.md deleted file mode 100644 index 53df15bc2..000000000 --- a/doc/models/gift-card-activity-type.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Gift Card Activity Type - -Indicates the type of [gift card activity](../../doc/models/gift-card-activity.md). - -## Enumeration - -`GiftCardActivityType` - -## Fields - -| Name | Description | -| --- | --- | -| `ACTIVATE` | Activated a gift card with a balance. When a gift card is activated, Square changes
the gift card state from `PENDING` to `ACTIVE`. A gift card must be in the `ACTIVE` state
to be used for other balance-changing activities. | -| `LOAD` | Loaded a gift card with additional funds. | -| `REDEEM` | Redeemed a gift card for a purchase. | -| `CLEAR_BALANCE` | Set the balance of a gift card to zero. | -| `DEACTIVATE` | Permanently blocked a gift card from balance-changing activities. | -| `ADJUST_INCREMENT` | Added money to a gift card outside of a typical `ACTIVATE`, `LOAD`, or `REFUND` activity flow. | -| `ADJUST_DECREMENT` | Deducted money from a gift card outside of a typical `REDEEM` activity flow. | -| `REFUND` | Added money to a gift card from a refunded transaction. A `REFUND` activity might be linked to
a Square payment, depending on how the payment and refund are processed. For example:

- A payment processed by Square can be refunded to a `PENDING` or `ACTIVE` gift card using the Square
Seller Dashboard, Square Point of Sale, or Refunds API.
- A payment processed using a custom processing system can be refunded to the same gift card. | -| `UNLINKED_ACTIVITY_REFUND` | Added money to a gift card from a refunded transaction that was processed using a custom payment
processing system and not linked to the gift card. | -| `IMPORT` | Imported a third-party gift card with a balance. `IMPORT` activities are managed
by Square and cannot be created using the Gift Card Activities API. | -| `BLOCK` | Temporarily blocked a gift card from balance-changing activities. `BLOCK` activities
are managed by Square and cannot be created using the Gift Card Activities API. | -| `UNBLOCK` | Unblocked a gift card, which enables it to resume balance-changing activities. `UNBLOCK`
activities are managed by Square and cannot be created using the Gift Card Activities API. | -| `IMPORT_REVERSAL` | Reversed the import of a third-party gift card, which sets the gift card state to
`PENDING` and clears the balance. `IMPORT_REVERSAL` activities are managed by Square and
cannot be created using the Gift Card Activities API. | -| `TRANSFER_BALANCE_FROM` | Deducted money from a gift card as the result of a transfer to the balance of another gift card.
`TRANSFER_BALANCE_FROM` activities are managed by Square and cannot be created using the Gift Card Activities API. | -| `TRANSFER_BALANCE_TO` | Added money to a gift card as the result of a transfer from the balance of another gift card.
`TRANSFER_BALANCE_TO` activities are managed by Square and cannot be created using the Gift Card Activities API. | - diff --git a/doc/models/gift-card-activity-unblock-reason.md b/doc/models/gift-card-activity-unblock-reason.md deleted file mode 100644 index 11ccbda8b..000000000 --- a/doc/models/gift-card-activity-unblock-reason.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Gift Card Activity Unblock Reason - -Indicates the reason for unblocking a [gift card](../../doc/models/gift-card.md). - -## Enumeration - -`GiftCardActivityUnblockReason` - -## Fields - -| Name | Description | -| --- | --- | -| `CHARGEBACK_UNBLOCK` | The gift card is unblocked because a chargeback was ruled in favor of the seller. | - diff --git a/doc/models/gift-card-activity-unblock.md b/doc/models/gift-card-activity-unblock.md deleted file mode 100644 index c2e830af5..000000000 --- a/doc/models/gift-card-activity-unblock.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Gift Card Activity Unblock - -Represents details about an `UNBLOCK` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityUnblock` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `reason` | `string` | Required, Constant | Indicates the reason for unblocking a [gift card](../../doc/models/gift-card.md).
**Default**: `'CHARGEBACK_UNBLOCK'` | - -## Example (as JSON) - -```json -{ - "reason": "CHARGEBACK_UNBLOCK" -} -``` - diff --git a/doc/models/gift-card-activity-unlinked-activity-refund.md b/doc/models/gift-card-activity-unlinked-activity-refund.md deleted file mode 100644 index 1fcfb1a43..000000000 --- a/doc/models/gift-card-activity-unlinked-activity-refund.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Gift Card Activity Unlinked Activity Refund - -Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type](../../doc/models/gift-card-activity-type.md). - -## Structure - -`GiftCardActivityUnlinkedActivityRefund` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `referenceId` | `string \| null \| undefined` | Optional | A client-specified ID that associates the gift card activity with an entity in another system. | -| `paymentId` | `string \| undefined` | Optional | The ID of the refunded payment. This field is not used starting in Square version 2022-06-16. | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "reference_id": "reference_id8", - "payment_id": "payment_id0" -} -``` - diff --git a/doc/models/gift-card-activity.md b/doc/models/gift-card-activity.md deleted file mode 100644 index feaeec7eb..000000000 --- a/doc/models/gift-card-activity.md +++ /dev/null @@ -1,55 +0,0 @@ - -# Gift Card Activity - -Represents an action performed on a [gift card](../../doc/models/gift-card.md) that affects its state or balance. -A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity -includes a `redeem_activity_details` field that contains information about the redemption. - -## Structure - -`GiftCardActivity` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the gift card activity. | -| `type` | [`string`](../../doc/models/gift-card-activity-type.md) | Required | Indicates the type of [gift card activity](../../doc/models/gift-card-activity.md). | -| `locationId` | `string` | Required | The ID of the [business location](entity:Location) where the activity occurred. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the gift card activity was created, in RFC 3339 format. | -| `giftCardId` | `string \| null \| undefined` | Optional | The gift card ID. When creating a gift card activity, `gift_card_id` is not required if
`gift_card_gan` is specified. | -| `giftCardGan` | `string \| null \| undefined` | Optional | The gift card account number (GAN). When creating a gift card activity, `gift_card_gan`
is not required if `gift_card_id` is specified. | -| `giftCardBalanceMoney` | [`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. | -| `loadActivityDetails` | [`GiftCardActivityLoad \| undefined`](../../doc/models/gift-card-activity-load.md) | Optional | Represents details about a `LOAD` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `activateActivityDetails` | [`GiftCardActivityActivate \| undefined`](../../doc/models/gift-card-activity-activate.md) | Optional | Represents details about an `ACTIVATE` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `redeemActivityDetails` | [`GiftCardActivityRedeem \| undefined`](../../doc/models/gift-card-activity-redeem.md) | Optional | Represents details about a `REDEEM` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `clearBalanceActivityDetails` | [`GiftCardActivityClearBalance \| undefined`](../../doc/models/gift-card-activity-clear-balance.md) | Optional | Represents details about a `CLEAR_BALANCE` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `deactivateActivityDetails` | [`GiftCardActivityDeactivate \| undefined`](../../doc/models/gift-card-activity-deactivate.md) | Optional | Represents details about a `DEACTIVATE` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `adjustIncrementActivityDetails` | [`GiftCardActivityAdjustIncrement \| undefined`](../../doc/models/gift-card-activity-adjust-increment.md) | Optional | Represents details about an `ADJUST_INCREMENT` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `adjustDecrementActivityDetails` | [`GiftCardActivityAdjustDecrement \| undefined`](../../doc/models/gift-card-activity-adjust-decrement.md) | Optional | Represents details about an `ADJUST_DECREMENT` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `refundActivityDetails` | [`GiftCardActivityRefund \| undefined`](../../doc/models/gift-card-activity-refund.md) | Optional | Represents details about a `REFUND` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `unlinkedActivityRefundActivityDetails` | [`GiftCardActivityUnlinkedActivityRefund \| undefined`](../../doc/models/gift-card-activity-unlinked-activity-refund.md) | Optional | Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `importActivityDetails` | [`GiftCardActivityImport \| undefined`](../../doc/models/gift-card-activity-import.md) | Optional | Represents details about an `IMPORT` [gift card activity type](../../doc/models/gift-card-activity-type.md).
This activity type is used when Square imports a third-party gift card, in which case the
`gan_source` of the gift card is set to `OTHER`. | -| `blockActivityDetails` | [`GiftCardActivityBlock \| undefined`](../../doc/models/gift-card-activity-block.md) | Optional | Represents details about a `BLOCK` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `unblockActivityDetails` | [`GiftCardActivityUnblock \| undefined`](../../doc/models/gift-card-activity-unblock.md) | Optional | Represents details about an `UNBLOCK` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `importReversalActivityDetails` | [`GiftCardActivityImportReversal \| undefined`](../../doc/models/gift-card-activity-import-reversal.md) | Optional | Represents details about an `IMPORT_REVERSAL` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `transferBalanceToActivityDetails` | [`GiftCardActivityTransferBalanceTo \| undefined`](../../doc/models/gift-card-activity-transfer-balance-to.md) | Optional | Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](../../doc/models/gift-card-activity-type.md). | -| `transferBalanceFromActivityDetails` | [`GiftCardActivityTransferBalanceFrom \| undefined`](../../doc/models/gift-card-activity-transfer-balance-from.md) | Optional | Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](../../doc/models/gift-card-activity-type.md). | - -## Example (as JSON) - -```json -{ - "id": "id8", - "type": "REDEEM", - "location_id": "location_id2", - "created_at": "created_at6", - "gift_card_id": "gift_card_id6", - "gift_card_gan": "gift_card_gan4", - "gift_card_balance_money": { - "amount": 82, - "currency": "IRR" - } -} -``` - diff --git a/doc/models/gift-card-gan-source.md b/doc/models/gift-card-gan-source.md deleted file mode 100644 index f58aa0936..000000000 --- a/doc/models/gift-card-gan-source.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Gift Card GAN Source - -Indicates the source that generated the gift card -account number (GAN). - -## Enumeration - -`GiftCardGANSource` - -## Fields - -| Name | Description | -| --- | --- | -| `SQUARE` | The GAN is generated by Square. | -| `OTHER` | The GAN is provided by a non-Square system. For more information, see
[Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans) or
[Third-party gift cards](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#third-party-gift-cards). | - diff --git a/doc/models/gift-card-status.md b/doc/models/gift-card-status.md deleted file mode 100644 index 7a364e5ae..000000000 --- a/doc/models/gift-card-status.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Gift Card Status - -Indicates the gift card state. - -## Enumeration - -`GiftCardStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `ACTIVE` | The gift card is active and can be used as a payment source. | -| `DEACTIVATED` | Any activity that changes the gift card balance is permanently forbidden. | -| `BLOCKED` | Any activity that changes the gift card balance is temporarily forbidden. | -| `PENDING` | The gift card is pending activation.
This is the initial state when a gift card is created. Typically, you'll call
[CreateGiftCardActivity](../../doc/api/gift-card-activities.md#create-gift-card-activity) to create an
`ACTIVATE` activity that activates the gift card with an initial balance before first use. | - diff --git a/doc/models/gift-card-type.md b/doc/models/gift-card-type.md deleted file mode 100644 index fff0b7b80..000000000 --- a/doc/models/gift-card-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Gift Card Type - -Indicates the gift card type. - -## Enumeration - -`GiftCardType` - -## Fields - -| Name | Description | -| --- | --- | -| `PHYSICAL` | A plastic gift card. | -| `DIGITAL` | A digital gift card. | - diff --git a/doc/models/gift-card.md b/doc/models/gift-card.md deleted file mode 100644 index 581f33fee..000000000 --- a/doc/models/gift-card.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Gift Card - -Represents a Square gift card. - -## Structure - -`GiftCard` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the gift card. | -| `type` | [`string`](../../doc/models/gift-card-type.md) | Required | Indicates the gift card type. | -| `ganSource` | [`string \| undefined`](../../doc/models/gift-card-gan-source.md) | Optional | Indicates the source that generated the gift card
account number (GAN). | -| `state` | [`string \| undefined`](../../doc/models/gift-card-status.md) | Optional | Indicates the gift card state. | -| `balanceMoney` | [`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. | -| `gan` | `string \| null \| undefined` | Optional | The gift card account number (GAN). Buyers can use the GAN to make purchases or check
the gift card balance. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the gift card was created, in RFC 3339 format.
In the case of a digital gift card, it is the time when you create a card
(using the Square Point of Sale application, Seller Dashboard, or Gift Cards API).
In the case of a plastic gift card, it is the time when Square associates the card with the
seller at the time of activation. | -| `customerIds` | `string[] \| undefined` | Optional | The IDs of the [customer profiles](entity:Customer) to whom this gift card is linked. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "type": "PHYSICAL", - "gan_source": "SQUARE", - "state": "ACTIVE", - "balance_money": { - "amount": 146, - "currency": "BBD" - }, - "gan": "gan6" -} -``` - diff --git a/doc/models/inventory-adjustment-group.md b/doc/models/inventory-adjustment-group.md deleted file mode 100644 index 817ea15ee..000000000 --- a/doc/models/inventory-adjustment-group.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Inventory Adjustment Group - -## Structure - -`InventoryAdjustmentGroup` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique ID generated by Square for the
`InventoryAdjustmentGroup`.
**Constraints**: *Maximum Length*: `100` | -| `rootAdjustmentId` | `string \| undefined` | Optional | The inventory adjustment of the composed variation.
**Constraints**: *Maximum Length*: `100` | -| `fromState` | [`string \| undefined`](../../doc/models/inventory-state.md) | Optional | Indicates the state of a tracked item quantity in the lifecycle of goods. | -| `toState` | [`string \| undefined`](../../doc/models/inventory-state.md) | Optional | Indicates the state of a tracked item quantity in the lifecycle of goods. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "root_adjustment_id": "root_adjustment_id4", - "from_state": "WASTE", - "to_state": "RESERVED_FOR_SALE" -} -``` - diff --git a/doc/models/inventory-adjustment.md b/doc/models/inventory-adjustment.md deleted file mode 100644 index 1ae9b88f5..000000000 --- a/doc/models/inventory-adjustment.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Inventory Adjustment - -Represents a change in state or quantity of product inventory at a -particular time and location. - -## Structure - -`InventoryAdjustment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique ID generated by Square for the
`InventoryAdjustment`.
**Constraints**: *Maximum Length*: `100` | -| `referenceId` | `string \| null \| undefined` | Optional | An optional ID provided by the application to tie the
`InventoryAdjustment` to an external
system.
**Constraints**: *Maximum Length*: `255` | -| `fromState` | [`string \| undefined`](../../doc/models/inventory-state.md) | Optional | Indicates the state of a tracked item quantity in the lifecycle of goods. | -| `toState` | [`string \| undefined`](../../doc/models/inventory-state.md) | Optional | Indicates the state of a tracked item quantity in the lifecycle of goods. | -| `locationId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Location](entity:Location) where the related
quantity of items is being tracked.
**Constraints**: *Maximum Length*: `100` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The Square-generated ID of the
[CatalogObject](entity:CatalogObject) being tracked.
**Constraints**: *Maximum Length*: `100` | -| `catalogObjectType` | `string \| null \| undefined` | Optional | The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.

The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
**Constraints**: *Maximum Length*: `14` | -| `quantity` | `string \| null \| undefined` | Optional | The number of items affected by the adjustment as a decimal string.
Can support up to 5 digits after the decimal point.
**Constraints**: *Maximum Length*: `26` | -| `totalPriceMoney` | [`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. | -| `occurredAt` | `string \| null \| undefined` | Optional | A client-generated RFC 3339-formatted timestamp that indicates when
the inventory adjustment took place. For inventory adjustment updates, the `occurred_at`
timestamp cannot be older than 24 hours or in the future relative to the
time of the request.
**Constraints**: *Maximum Length*: `34` | -| `createdAt` | `string \| undefined` | Optional | An RFC 3339-formatted timestamp that indicates when the inventory adjustment is received.
**Constraints**: *Maximum Length*: `34` | -| `source` | [`SourceApplication \| undefined`](../../doc/models/source-application.md) | Optional | Represents information about the application used to generate a change. | -| `employeeId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Employee](entity:Employee) responsible for the
inventory adjustment.
**Constraints**: *Maximum Length*: `100` | -| `teamMemberId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
inventory adjustment.
**Constraints**: *Maximum Length*: `100` | -| `transactionId` | `string \| undefined` | Optional | The Square-generated ID of the [Transaction](entity:Transaction) that
caused the adjustment. Only relevant for payment-related state
transitions.
**Constraints**: *Maximum Length*: `255` | -| `refundId` | `string \| undefined` | Optional | The Square-generated ID of the [Refund](entity:Refund) that
caused the adjustment. Only relevant for refund-related state
transitions.
**Constraints**: *Maximum Length*: `255` | -| `purchaseOrderId` | `string \| undefined` | Optional | The Square-generated ID of the purchase order that caused the
adjustment. Only relevant for state transitions from the Square for Retail
app.
**Constraints**: *Maximum Length*: `100` | -| `goodsReceiptId` | `string \| undefined` | Optional | The Square-generated ID of the goods receipt that caused the
adjustment. Only relevant for state transitions from the Square for Retail
app.
**Constraints**: *Maximum Length*: `100` | -| `adjustmentGroup` | [`InventoryAdjustmentGroup \| undefined`](../../doc/models/inventory-adjustment-group.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "id": "id6", - "reference_id": "reference_id6", - "from_state": "WASTE", - "to_state": "RESERVED_FOR_SALE", - "location_id": "location_id0" -} -``` - diff --git a/doc/models/inventory-alert-type.md b/doc/models/inventory-alert-type.md deleted file mode 100644 index 0d9e9d474..000000000 --- a/doc/models/inventory-alert-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Inventory Alert Type - -Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. - -## Enumeration - -`InventoryAlertType` - -## Fields - -| Name | Description | -| --- | --- | -| `NONE` | The variation does not display an alert. | -| `LOW_QUANTITY` | The variation generates an alert when its quantity is low. | - diff --git a/doc/models/inventory-change-type.md b/doc/models/inventory-change-type.md deleted file mode 100644 index bc4f17b52..000000000 --- a/doc/models/inventory-change-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Inventory Change Type - -Indicates how the inventory change was applied to a tracked product quantity. - -## Enumeration - -`InventoryChangeType` - -## Fields - -| Name | Description | -| --- | --- | -| `PHYSICAL_COUNT` | The change occurred as part of a physical count update. | -| `ADJUSTMENT` | The change occurred as part of the normal lifecycle of goods
(e.g., as an inventory adjustment). | -| `TRANSFER` | The change occurred as part of an inventory transfer. | - diff --git a/doc/models/inventory-change.md b/doc/models/inventory-change.md deleted file mode 100644 index 6d0bad1e7..000000000 --- a/doc/models/inventory-change.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Inventory Change - -Represents a single physical count, inventory, adjustment, or transfer -that is part of the history of inventory changes for a particular -[CatalogObject](../../doc/models/catalog-object.md) instance. - -## Structure - -`InventoryChange` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string \| undefined`](../../doc/models/inventory-change-type.md) | Optional | Indicates how the inventory change was applied to a tracked product quantity. | -| `physicalCount` | [`InventoryPhysicalCount \| undefined`](../../doc/models/inventory-physical-count.md) | Optional | Represents the quantity of an item variation that is physically present
at a specific location, verified by a seller or a seller's employee. For example,
a physical count might come from an employee counting the item variations on
hand or from syncing with an external system. | -| `adjustment` | [`InventoryAdjustment \| undefined`](../../doc/models/inventory-adjustment.md) | Optional | Represents a change in state or quantity of product inventory at a
particular time and location. | -| `transfer` | [`InventoryTransfer \| undefined`](../../doc/models/inventory-transfer.md) | Optional | Represents the transfer of a quantity of product inventory at a
particular time from one location to another. | -| `measurementUnit` | [`CatalogMeasurementUnit \| undefined`](../../doc/models/catalog-measurement-unit.md) | Optional | Represents the unit used to measure a `CatalogItemVariation` and
specifies the precision for decimal quantities. | -| `measurementUnitId` | `string \| undefined` | Optional | The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. | - -## Example (as JSON) - -```json -{ - "type": "ADJUSTMENT", - "physical_count": { - "id": "id2", - "reference_id": "reference_id0", - "catalog_object_id": "catalog_object_id6", - "catalog_object_type": "catalog_object_type6", - "state": "SUPPORTED_BY_NEWER_VERSION" - }, - "adjustment": { - "id": "id4", - "reference_id": "reference_id2", - "from_state": "IN_TRANSIT_TO", - "to_state": "SOLD", - "location_id": "location_id8" - }, - "transfer": { - "id": "id8", - "reference_id": "reference_id6", - "state": "RESERVED_FOR_SALE", - "from_location_id": "from_location_id0", - "to_location_id": "to_location_id0" - }, - "measurement_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 184 - } -} -``` - diff --git a/doc/models/inventory-count.md b/doc/models/inventory-count.md deleted file mode 100644 index 95fdda729..000000000 --- a/doc/models/inventory-count.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Inventory Count - -Represents Square-estimated quantity of items in a particular state at a -particular seller location based on the known history of physical counts and -inventory adjustments. - -## Structure - -`InventoryCount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The Square-generated ID of the
[CatalogObject](entity:CatalogObject) being tracked.
**Constraints**: *Maximum Length*: `100` | -| `catalogObjectType` | `string \| null \| undefined` | Optional | The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.

The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
**Constraints**: *Maximum Length*: `14` | -| `state` | [`string \| undefined`](../../doc/models/inventory-state.md) | Optional | Indicates the state of a tracked item quantity in the lifecycle of goods. | -| `locationId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Location](entity:Location) where the related
quantity of items is being tracked.
**Constraints**: *Maximum Length*: `100` | -| `quantity` | `string \| null \| undefined` | Optional | The number of items affected by the estimated count as a decimal string.
Can support up to 5 digits after the decimal point.
**Constraints**: *Maximum Length*: `26` | -| `calculatedAt` | `string \| undefined` | Optional | An RFC 3339-formatted timestamp that indicates when the most recent physical count or adjustment affecting
the estimated count is received.
**Constraints**: *Maximum Length*: `34` | -| `isEstimated` | `boolean \| undefined` | Optional | Whether the inventory count is for composed variation (TRUE) or not (FALSE). If true, the inventory count will not be present in the response of
any of these endpoints: [BatchChangeInventory](../../doc/api/inventory.md#batch-change-inventory),
[BatchRetrieveInventoryChanges](../../doc/api/inventory.md#batch-retrieve-inventory-changes),
[BatchRetrieveInventoryCounts](../../doc/api/inventory.md#batch-retrieve-inventory-counts), and
[RetrieveInventoryChanges](../../doc/api/inventory.md#retrieve-inventory-changes). | - -## Example (as JSON) - -```json -{ - "catalog_object_id": "catalog_object_id4", - "catalog_object_type": "catalog_object_type4", - "state": "SOLD", - "location_id": "location_id6", - "quantity": "quantity8" -} -``` - diff --git a/doc/models/inventory-physical-count.md b/doc/models/inventory-physical-count.md deleted file mode 100644 index 65c5abbad..000000000 --- a/doc/models/inventory-physical-count.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Inventory Physical Count - -Represents the quantity of an item variation that is physically present -at a specific location, verified by a seller or a seller's employee. For example, -a physical count might come from an employee counting the item variations on -hand or from syncing with an external system. - -## Structure - -`InventoryPhysicalCount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique Square-generated ID for the
[InventoryPhysicalCount](entity:InventoryPhysicalCount).
**Constraints**: *Maximum Length*: `100` | -| `referenceId` | `string \| null \| undefined` | Optional | An optional ID provided by the application to tie the
[InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external
system.
**Constraints**: *Maximum Length*: `255` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The Square-generated ID of the
[CatalogObject](entity:CatalogObject) being tracked.
**Constraints**: *Maximum Length*: `100` | -| `catalogObjectType` | `string \| null \| undefined` | Optional | The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.

The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
**Constraints**: *Maximum Length*: `14` | -| `state` | [`string \| undefined`](../../doc/models/inventory-state.md) | Optional | Indicates the state of a tracked item quantity in the lifecycle of goods. | -| `locationId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Location](entity:Location) where the related
quantity of items is being tracked.
**Constraints**: *Maximum Length*: `100` | -| `quantity` | `string \| null \| undefined` | Optional | The number of items affected by the physical count as a decimal string.
The number can support up to 5 digits after the decimal point.
**Constraints**: *Maximum Length*: `26` | -| `source` | [`SourceApplication \| undefined`](../../doc/models/source-application.md) | Optional | Represents information about the application used to generate a change. | -| `employeeId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Employee](entity:Employee) responsible for the
physical count.
**Constraints**: *Maximum Length*: `100` | -| `teamMemberId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
physical count.
**Constraints**: *Maximum Length*: `100` | -| `occurredAt` | `string \| null \| undefined` | Optional | A client-generated RFC 3339-formatted timestamp that indicates when
the physical count was examined. For physical count updates, the `occurred_at`
timestamp cannot be older than 24 hours or in the future relative to the
time of the request.
**Constraints**: *Maximum Length*: `34` | -| `createdAt` | `string \| undefined` | Optional | An RFC 3339-formatted timestamp that indicates when the physical count is received.
**Constraints**: *Maximum Length*: `34` | - -## Example (as JSON) - -```json -{ - "id": "id0", - "reference_id": "reference_id8", - "catalog_object_id": "catalog_object_id4", - "catalog_object_type": "catalog_object_type4", - "state": "COMPOSED" -} -``` - diff --git a/doc/models/inventory-state.md b/doc/models/inventory-state.md deleted file mode 100644 index a50a22082..000000000 --- a/doc/models/inventory-state.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Inventory State - -Indicates the state of a tracked item quantity in the lifecycle of goods. - -## Enumeration - -`InventoryState` - -## Fields - -| Name | Description | -| --- | --- | -| `CUSTOM` | The related quantity of items are in a custom state. **READ-ONLY**:
the Inventory API cannot move quantities to or from this state. | -| `IN_STOCK` | The related quantity of items are on hand and available for sale. | -| `SOLD` | The related quantity of items were sold as part of an itemized
transaction. Quantities in the `SOLD` state are no longer tracked. | -| `RETURNED_BY_CUSTOMER` | The related quantity of items were returned through the Square Point
of Sale application, but are not yet available for sale. **READ-ONLY**:
the Inventory API cannot move quantities to or from this state. | -| `RESERVED_FOR_SALE` | The related quantity of items are on hand, but not currently
available for sale. **READ-ONLY**: the Inventory API cannot move
quantities to or from this state. | -| `SOLD_ONLINE` | The related quantity of items were sold online. **READ-ONLY**: the
Inventory API cannot move quantities to or from this state. | -| `ORDERED_FROM_VENDOR` | The related quantity of items were ordered from a vendor but not yet
received. **READ-ONLY**: the Inventory API cannot move quantities to or
from this state. | -| `RECEIVED_FROM_VENDOR` | The related quantity of items were received from a vendor but are
not yet available for sale. **READ-ONLY**: the Inventory API cannot move
quantities to or from this state. | -| `IN_TRANSIT_TO` | Replaced by `IN_TRANSIT` to represent quantities
of items that are in transit between locations. | -| `NONE` | A placeholder indicating that the related quantity of items are not
currently tracked in Square. Transferring quantities from the `NONE` state
to a tracked state (e.g., `IN_STOCK`) introduces stock into the system. | -| `WASTE` | The related quantity of items are lost or damaged and cannot be
sold. | -| `UNLINKED_RETURN` | The related quantity of items were returned but not linked to a
previous transaction. Unlinked returns are not tracked in Square.
Transferring a quantity from `UNLINKED_RETURN` to a tracked state (e.g.,
`IN_STOCK`) introduces new stock into the system. | -| `COMPOSED` | The related quantity of items that are part of a composition consisting one or more components. | -| `DECOMPOSED` | The related quantity of items that are part of a component. | -| `SUPPORTED_BY_NEWER_VERSION` | This state is not supported by this version of the Square API. We recommend that you upgrade the client to use the appropriate version of the Square API supporting this state. | -| `IN_TRANSIT` | The related quantity of items are in transit between locations. **READ-ONLY:** the Inventory API cannot currently be used to move quantities to or from this inventory state. | - diff --git a/doc/models/inventory-transfer.md b/doc/models/inventory-transfer.md deleted file mode 100644 index 5e4b3e4a5..000000000 --- a/doc/models/inventory-transfer.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Inventory Transfer - -Represents the transfer of a quantity of product inventory at a -particular time from one location to another. - -## Structure - -`InventoryTransfer` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique ID generated by Square for the
`InventoryTransfer`.
**Constraints**: *Maximum Length*: `100` | -| `referenceId` | `string \| null \| undefined` | Optional | An optional ID provided by the application to tie the
`InventoryTransfer` to an external system.
**Constraints**: *Maximum Length*: `255` | -| `state` | [`string \| undefined`](../../doc/models/inventory-state.md) | Optional | Indicates the state of a tracked item quantity in the lifecycle of goods. | -| `fromLocationId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Location](entity:Location) where the related
quantity of items was tracked before the transfer.
**Constraints**: *Maximum Length*: `100` | -| `toLocationId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Location](entity:Location) where the related
quantity of items was tracked after the transfer.
**Constraints**: *Maximum Length*: `100` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The Square-generated ID of the
[CatalogObject](entity:CatalogObject) being tracked.
**Constraints**: *Maximum Length*: `100` | -| `catalogObjectType` | `string \| null \| undefined` | Optional | The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.

The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
**Constraints**: *Maximum Length*: `14` | -| `quantity` | `string \| null \| undefined` | Optional | The number of items affected by the transfer as a decimal string.
Can support up to 5 digits after the decimal point.
**Constraints**: *Maximum Length*: `26` | -| `occurredAt` | `string \| null \| undefined` | Optional | A client-generated RFC 3339-formatted timestamp that indicates when
the transfer took place. For write actions, the `occurred_at` timestamp
cannot be older than 24 hours or in the future relative to the time of the
request.
**Constraints**: *Maximum Length*: `34` | -| `createdAt` | `string \| undefined` | Optional | An RFC 3339-formatted timestamp that indicates when Square
received the transfer request.
**Constraints**: *Maximum Length*: `34` | -| `source` | [`SourceApplication \| undefined`](../../doc/models/source-application.md) | Optional | Represents information about the application used to generate a change. | -| `employeeId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Employee](entity:Employee) responsible for the
inventory transfer.
**Constraints**: *Maximum Length*: `100` | -| `teamMemberId` | `string \| null \| undefined` | Optional | The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
inventory transfer.
**Constraints**: *Maximum Length*: `100` | - -## Example (as JSON) - -```json -{ - "id": "id8", - "reference_id": "reference_id4", - "state": "ORDERED_FROM_VENDOR", - "from_location_id": "from_location_id0", - "to_location_id": "to_location_id0" -} -``` - diff --git a/doc/models/invoice-accepted-payment-methods.md b/doc/models/invoice-accepted-payment-methods.md deleted file mode 100644 index 19a4550d8..000000000 --- a/doc/models/invoice-accepted-payment-methods.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Invoice Accepted Payment Methods - -The payment methods that customers can use to pay an [invoice](../../doc/models/invoice.md) on the Square-hosted invoice payment page. - -## Structure - -`InvoiceAcceptedPaymentMethods` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `card` | `boolean \| null \| undefined` | Optional | Indicates whether credit card or debit card payments are accepted. The default value is `false`. | -| `squareGiftCard` | `boolean \| null \| undefined` | Optional | Indicates whether Square gift card payments are accepted. The default value is `false`. | -| `bankAccount` | `boolean \| null \| undefined` | Optional | Indicates whether ACH bank transfer payments are accepted. The default value is `false`. | -| `buyNowPayLater` | `boolean \| null \| undefined` | Optional | Indicates whether Afterpay (also known as Clearpay) payments are accepted. The default value is `false`.

This option is allowed only for invoices that have a single payment request of the `BALANCE` type. This payment method is
supported if the seller account accepts Afterpay payments and the seller location is in a country where Afterpay
invoice payments are supported. As a best practice, consider enabling an additional payment method when allowing
`buy_now_pay_later` payments. For more information, including detailed requirements and processing limits, see
[Buy Now Pay Later payments with Afterpay](https://developer.squareup.com/docs/invoices-api/overview#buy-now-pay-later). | -| `cashAppPay` | `boolean \| null \| undefined` | Optional | Indicates whether Cash App payments are accepted. The default value is `false`.

This payment method is supported only for seller [locations](entity:Location) in the United States. | - -## Example (as JSON) - -```json -{ - "card": false, - "square_gift_card": false, - "bank_account": false, - "buy_now_pay_later": false, - "cash_app_pay": false -} -``` - diff --git a/doc/models/invoice-attachment.md b/doc/models/invoice-attachment.md deleted file mode 100644 index 35462e614..000000000 --- a/doc/models/invoice-attachment.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Invoice Attachment - -Represents a file attached to an [invoice](../../doc/models/invoice.md). - -## Structure - -`InvoiceAttachment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the attachment. | -| `filename` | `string \| undefined` | Optional | The file name of the attachment, which is displayed on the invoice. | -| `description` | `string \| undefined` | Optional | The description of the attachment, which is displayed on the invoice.
This field maps to the seller-defined **Message** field. | -| `filesize` | `number \| undefined` | Optional | The file size of the attachment in bytes. | -| `hash` | `string \| undefined` | Optional | The MD5 hash that was generated from the file contents. | -| `mimeType` | `string \| undefined` | Optional | The mime type of the attachment.
The following mime types are supported:
image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. | -| `uploadedAt` | `string \| undefined` | Optional | The timestamp when the attachment was uploaded, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "filename": "filename6", - "description": "description6", - "filesize": 164, - "hash": "hash0" -} -``` - diff --git a/doc/models/invoice-automatic-payment-source.md b/doc/models/invoice-automatic-payment-source.md deleted file mode 100644 index 5f6f256db..000000000 --- a/doc/models/invoice-automatic-payment-source.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Invoice Automatic Payment Source - -Indicates the automatic payment method for an [invoice payment request](../../doc/models/invoice-payment-request.md). - -## Enumeration - -`InvoiceAutomaticPaymentSource` - -## Fields - -| Name | Description | -| --- | --- | -| `NONE` | An automatic payment is not configured for the payment request. | -| `CARD_ON_FILE` | Use a card on file as the automatic payment method. On the due date, Square charges the card
for the amount of the payment request.

For `CARD_ON_FILE` payments, the invoice delivery method must be `EMAIL` and `card_id` must be
specified for the payment request before the invoice can be published. | -| `BANK_ON_FILE` | Use a bank account on file as the automatic payment method. On the due date, Square charges the bank
account for the amount of the payment request if the buyer has approved the payment. The buyer receives a
request to approve the payment when the invoice is sent or the invoice is updated.

This payment method applies only to invoices that sellers create in the Seller Dashboard or other
Square product. The bank account is provided by the customer during the payment flow.

You cannot set `BANK_ON_FILE` as a payment method using the Invoices API, but you can change a `BANK_ON_FILE`
payment method to `NONE` or `CARD_ON_FILE`. For `BANK_ON_FILE` payments, the invoice delivery method must be `EMAIL`. | - diff --git a/doc/models/invoice-custom-field-placement.md b/doc/models/invoice-custom-field-placement.md deleted file mode 100644 index 4d4ceb92f..000000000 --- a/doc/models/invoice-custom-field-placement.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Invoice Custom Field Placement - -Indicates where to render a custom field on the Square-hosted invoice page and in emailed or PDF -copies of the invoice. - -## Enumeration - -`InvoiceCustomFieldPlacement` - -## Fields - -| Name | Description | -| --- | --- | -| `ABOVE_LINE_ITEMS` | Render the custom field above the invoice line items. | -| `BELOW_LINE_ITEMS` | Render the custom field below the invoice line items. | - diff --git a/doc/models/invoice-custom-field.md b/doc/models/invoice-custom-field.md deleted file mode 100644 index 254a89780..000000000 --- a/doc/models/invoice-custom-field.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Invoice Custom Field - -An additional seller-defined and customer-facing field to include on the invoice. For more information, -see [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). - -Adding custom fields to an invoice requires an -[Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). - -## Structure - -`InvoiceCustomField` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `label` | `string \| null \| undefined` | Optional | The label or title of the custom field. This field is required for a custom field.
**Constraints**: *Maximum Length*: `30` | -| `value` | `string \| null \| undefined` | Optional | The text of the custom field. If omitted, only the label is rendered.
**Constraints**: *Maximum Length*: `2000` | -| `placement` | [`string \| undefined`](../../doc/models/invoice-custom-field-placement.md) | Optional | Indicates where to render a custom field on the Square-hosted invoice page and in emailed or PDF
copies of the invoice. | - -## Example (as JSON) - -```json -{ - "label": "label6", - "value": "value8", - "placement": "ABOVE_LINE_ITEMS" -} -``` - diff --git a/doc/models/invoice-delivery-method.md b/doc/models/invoice-delivery-method.md deleted file mode 100644 index 80ade49a6..000000000 --- a/doc/models/invoice-delivery-method.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Invoice Delivery Method - -Indicates how Square delivers the [invoice](../../doc/models/invoice.md) to the customer. - -## Enumeration - -`InvoiceDeliveryMethod` - -## Fields - -| Name | Description | -| --- | --- | -| `EMAIL` | Directs Square to send invoices, reminders, and receipts to the customer using email. | -| `SHARE_MANUALLY` | Directs Square to take no action on the invoice. In this case, the seller
or application developer follows up with the customer for payment. For example,
a seller might collect a payment in the Seller Dashboard or Point of Sale (POS) application.
The seller might also share the URL of the Square-hosted invoice page (`public_url`) with the customer to request payment. | -| `SMS` | Directs Square to send invoices and receipts to the customer using SMS (text message).

You cannot set `SMS` as a delivery method using the Invoices API, but you can change an `SMS` delivery method to `EMAIL` or `SHARE_MANUALLY`. | - diff --git a/doc/models/invoice-filter.md b/doc/models/invoice-filter.md deleted file mode 100644 index 605299b0c..000000000 --- a/doc/models/invoice-filter.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Invoice Filter - -Describes query filters to apply. - -## Structure - -`InvoiceFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationIds` | `string[]` | Required | Limits the search to the specified locations. A location is required.
In the current implementation, only one location can be specified. | -| `customerIds` | `string[] \| null \| undefined` | Optional | Limits the search to the specified customers, within the specified locations.
Specifying a customer is optional. In the current implementation,
a maximum of one customer can be specified. | - -## Example (as JSON) - -```json -{ - "location_ids": [ - "location_ids0", - "location_ids1", - "location_ids2" - ], - "customer_ids": [ - "customer_ids3", - "customer_ids2" - ] -} -``` - diff --git a/doc/models/invoice-payment-reminder-status.md b/doc/models/invoice-payment-reminder-status.md deleted file mode 100644 index cc78753c4..000000000 --- a/doc/models/invoice-payment-reminder-status.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Invoice Payment Reminder Status - -The status of a payment request reminder. - -## Enumeration - -`InvoicePaymentReminderStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `PENDING` | The reminder will be sent on the `relative_scheduled_date` (if the invoice is published). | -| `NOT_APPLICABLE` | The reminder is not applicable and is not sent. The following are examples
of when reminders are not applicable and are not sent:

- You schedule a reminder to be sent before the invoice is published.
- The invoice is configured with multiple payment requests and a payment request reminder
is configured to be sent after the next payment request `due_date`.
- Two reminders (for different payment requests) are configured to be sent on the
same date. Therefore, only one reminder is sent.
- You configure a reminder to be sent on the date that the invoice is scheduled to be sent.
- The payment request is already paid.
- The invoice status is `CANCELED` or `FAILED`. | -| `SENT` | The reminder is sent. | - diff --git a/doc/models/invoice-payment-reminder.md b/doc/models/invoice-payment-reminder.md deleted file mode 100644 index 50c2c0d38..000000000 --- a/doc/models/invoice-payment-reminder.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Invoice Payment Reminder - -Describes a payment request reminder (automatic notification) that Square sends -to the customer. You configure a reminder relative to the payment request -`due_date`. - -## Structure - -`InvoicePaymentReminder` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| undefined` | Optional | A Square-assigned ID that uniquely identifies the reminder within the
`InvoicePaymentRequest`. | -| `relativeScheduledDays` | `number \| null \| undefined` | Optional | The number of days before (a negative number) or after (a positive number)
the payment request `due_date` when the reminder is sent. For example, -3 indicates that
the reminder should be sent 3 days before the payment request `due_date`.
**Constraints**: `>= -32767`, `<= 32767` | -| `message` | `string \| null \| undefined` | Optional | The reminder message.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `1000` | -| `status` | [`string \| undefined`](../../doc/models/invoice-payment-reminder-status.md) | Optional | The status of a payment request reminder. | -| `sentAt` | `string \| undefined` | Optional | If sent, the timestamp when the reminder was sent, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "uid": "uid6", - "relative_scheduled_days": 198, - "message": "message4", - "status": "SENT", - "sent_at": "sent_at6" -} -``` - diff --git a/doc/models/invoice-payment-request.md b/doc/models/invoice-payment-request.md deleted file mode 100644 index 5f88d0e93..000000000 --- a/doc/models/invoice-payment-request.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Invoice Payment Request - -Represents a payment request for an [invoice](../../doc/models/invoice.md). Invoices can specify a maximum -of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information, -see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). - -Adding `INSTALLMENT` payment requests to an invoice requires an -[Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). - -## Structure - -`InvoicePaymentRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | The Square-generated ID of the payment request in an [invoice](entity:Invoice).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `requestMethod` | [`string \| undefined`](../../doc/models/invoice-request-method.md) | Optional | Specifies the action for Square to take for processing the invoice. For example,
email the invoice, charge a customer's card on file, or do nothing. DEPRECATED at
version 2021-01-21. The corresponding `request_method` field is replaced by the
`Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. | -| `requestType` | [`string \| undefined`](../../doc/models/invoice-request-type.md) | Optional | Indicates the type of the payment request. For more information, see
[Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). | -| `dueDate` | `string \| null \| undefined` | Optional | The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format. This field
is required to create a payment request. If an `automatic_payment_source` is defined for the request, Square
charges the payment source on this date.

After this date, the invoice becomes overdue. For example, a payment `due_date` of 2021-03-09 with a `timezone`
of America/Los\_Angeles becomes overdue at midnight on March 9 in America/Los\_Angeles (which equals a UTC
timestamp of 2021-03-10T08:00:00Z). | -| `fixedAmountRequestedMoney` | [`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. | -| `percentageRequested` | `string \| null \| undefined` | Optional | Specifies the amount for the payment request in percentage:

- When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total amount.
- When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's total less
the deposit, if requested. The sum of the `percentage_requested` in all installment
payment requests must be equal to 100.

You cannot specify this when the payment `request_type` is `BALANCE` or when the
payment request specifies the `fixed_amount_requested_money` field. | -| `tippingEnabled` | `boolean \| null \| undefined` | Optional | If set to true, the Square-hosted invoice page (the `public_url` field of the invoice)
provides a place for the customer to pay a tip.

This field is allowed only on the final payment request
and the payment `request_type` must be `BALANCE` or `INSTALLMENT`. | -| `automaticPaymentSource` | [`string \| undefined`](../../doc/models/invoice-automatic-payment-source.md) | Optional | Indicates the automatic payment method for an [invoice payment request](../../doc/models/invoice-payment-request.md). | -| `cardId` | `string \| null \| undefined` | Optional | The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer,
call [ListCards](api-endpoint:Cards-ListCards) and include the `customer_id` of the invoice recipient.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `reminders` | [`InvoicePaymentReminder[] \| null \| undefined`](../../doc/models/invoice-payment-reminder.md) | Optional | A list of one or more reminders to send for the payment request. | -| `computedAmountMoney` | [`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. | -| `totalCompletedAmountMoney` | [`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. | -| `roundingAdjustmentIncludedMoney` | [`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 -{ - "uid": "uid0", - "request_method": "SHARE_MANUALLY", - "request_type": "DEPOSIT", - "due_date": "due_date8", - "fixed_amount_requested_money": { - "amount": 162, - "currency": "JOD" - } -} -``` - diff --git a/doc/models/invoice-query.md b/doc/models/invoice-query.md deleted file mode 100644 index e1daf637e..000000000 --- a/doc/models/invoice-query.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Invoice Query - -Describes query criteria for searching invoices. - -## Structure - -`InvoiceQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`InvoiceFilter`](../../doc/models/invoice-filter.md) | Required | Describes query filters to apply. | -| `sort` | [`InvoiceSort \| undefined`](../../doc/models/invoice-sort.md) | Optional | Identifies the sort field and sort order. | - -## Example (as JSON) - -```json -{ - "filter": { - "location_ids": [ - "location_ids4" - ], - "customer_ids": [ - "customer_ids3", - "customer_ids2" - ] - }, - "sort": { - "field": "field2", - "order": "DESC" - } -} -``` - diff --git a/doc/models/invoice-recipient-tax-ids.md b/doc/models/invoice-recipient-tax-ids.md deleted file mode 100644 index 70e7cd280..000000000 --- a/doc/models/invoice-recipient-tax-ids.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Invoice Recipient Tax Ids - -Represents the tax IDs for an invoice recipient. The country of the seller account determines -whether the corresponding `tax_ids` field is available for the customer. For more information, -see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). - -## Structure - -`InvoiceRecipientTaxIds` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `euVat` | `string \| undefined` | Optional | The EU VAT identification number for the invoice recipient. For example, `IE3426675K`. | - -## Example (as JSON) - -```json -{ - "eu_vat": "eu_vat8" -} -``` - diff --git a/doc/models/invoice-recipient.md b/doc/models/invoice-recipient.md deleted file mode 100644 index a9d5c2f25..000000000 --- a/doc/models/invoice-recipient.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Invoice Recipient - -Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice -and that Square uses to deliver the invoice. - -When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates -the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published. -Square updates the customer ID in response to a merge operation, but does not update other fields. - -## Structure - -`InvoiceRecipient` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string \| null \| undefined` | Optional | The ID of the customer. This is the customer profile ID that
you provide when creating a draft invoice.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `givenName` | `string \| undefined` | Optional | The recipient's given (that is, first) name. | -| `familyName` | `string \| undefined` | Optional | The recipient's family (that is, last) name. | -| `emailAddress` | `string \| undefined` | Optional | The recipient's email address. | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `phoneNumber` | `string \| undefined` | Optional | The recipient's phone number. | -| `companyName` | `string \| undefined` | Optional | The name of the recipient's company. | -| `taxIds` | [`InvoiceRecipientTaxIds \| undefined`](../../doc/models/invoice-recipient-tax-ids.md) | Optional | Represents the tax IDs for an invoice recipient. The country of the seller account determines
whether the corresponding `tax_ids` field is available for the customer. For more information,
see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). | - -## Example (as JSON) - -```json -{ - "customer_id": "customer_id8", - "given_name": "given_name2", - "family_name": "family_name4", - "email_address": "email_address8", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } -} -``` - diff --git a/doc/models/invoice-request-method.md b/doc/models/invoice-request-method.md deleted file mode 100644 index 412d716b0..000000000 --- a/doc/models/invoice-request-method.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Invoice Request Method - -Specifies the action for Square to take for processing the invoice. For example, -email the invoice, charge a customer's card on file, or do nothing. DEPRECATED at -version 2021-01-21. The corresponding `request_method` field is replaced by the -`Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. - -## Enumeration - -`InvoiceRequestMethod` - -## Fields - -| Name | Description | -| --- | --- | -| `EMAIL` | Directs Square to send invoices, reminders, and receipts to the customer using email.
Square sends the invoice after it is published (either immediately or at the `scheduled_at`
time, if specified in the [invoice](entity:Invoice)). | -| `CHARGE_CARD_ON_FILE` | Directs Square to charge the card on file on the `due_date` specified in the payment request
and to use email to send invoices, reminders, and receipts. | -| `SHARE_MANUALLY` | Directs Square to take no specific action on the invoice. In this case, the seller
(or the application developer) follows up with the customer for payment. For example,
a seller might collect a payment in the Seller Dashboard or use the Point of Sale (POS) application.
The seller might also share the URL of the Square-hosted invoice page (`public_url`) with the customer requesting payment. | -| `CHARGE_BANK_ON_FILE` | Directs Square to charge the customer's bank account on file and to use email to send invoices, reminders, and receipts.
The customer must approve the payment.

The bank on file payment method applies only to invoices that sellers create in the Seller Dashboard or other
Square product. The bank account is provided by the customer during the payment flow. You
cannot set `CHARGE_BANK_ON_FILE` as a request method using the Invoices API. | -| `SMS` | Directs Square to send invoices and receipts to the customer using SMS (text message). Square sends the invoice
after it is published (either immediately or at the `scheduled_at` time, if specified in the [invoice](entity:Invoice)).

You cannot set `SMS` as a request method using the Invoices API. | -| `SMS_CHARGE_CARD_ON_FILE` | Directs Square to charge the card on file on the `due_date` specified in the payment request and to
use SMS (text message) to send invoices and receipts.

You cannot set `SMS_CHARGE_CARD_ON_FILE` as a request method using the Invoices API. | -| `SMS_CHARGE_BANK_ON_FILE` | Directs Square to charge the customer's bank account on file and to use SMS (text message) to send invoices and receipts.
The customer must approve the payment.

The bank on file payment method applies only to invoices that sellers create in the Seller Dashboard
or other Square product. The bank account is provided by the customer during the payment flow.
You cannot set `SMS_CHARGE_BANK_ON_FILE` as a request method using the Invoices API. | - diff --git a/doc/models/invoice-request-type.md b/doc/models/invoice-request-type.md deleted file mode 100644 index 2f9a9e886..000000000 --- a/doc/models/invoice-request-type.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Invoice Request Type - -Indicates the type of the payment request. For more information, see -[Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). - -## Enumeration - -`InvoiceRequestType` - -## Fields - -| Name | Description | -| --- | --- | -| `BALANCE` | A request for a balance payment. The balance amount is computed as follows:

- If the invoice specifies only a balance payment request, the balance amount is the
total amount of the associated order.
- If the invoice also specifies a deposit request, the balance amount is the amount
remaining after the deposit.

`INSTALLMENT` and `BALANCE` payment requests are not allowed in the same invoice. | -| `DEPOSIT` | A request for a deposit payment. You have the option of specifying
an exact amount or a percentage of the total order amount. If you request a deposit,
it must be due before any other payment requests. | -| `INSTALLMENT` | A request for an installment payment. Installments allow buyers to pay the invoice over time. Installments can optionally be combined with a deposit.

Adding `INSTALLMENT` payment requests to an invoice requires an
[Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). | - diff --git a/doc/models/invoice-sort-field.md b/doc/models/invoice-sort-field.md deleted file mode 100644 index 6e3bbf54a..000000000 --- a/doc/models/invoice-sort-field.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Invoice Sort Field - -The field to use for sorting. - -## Enumeration - -`InvoiceSortField` - -## Fields - -| Name | Description | -| --- | --- | -| `INVOICE_SORT_DATE` | The field works as follows:

- If the invoice is a draft, it uses the invoice `created_at` date.
- If the invoice is scheduled for publication, it uses the `scheduled_at` date.
- If the invoice is published, it uses the invoice publication date. | - diff --git a/doc/models/invoice-sort.md b/doc/models/invoice-sort.md deleted file mode 100644 index 0ed4b96f4..000000000 --- a/doc/models/invoice-sort.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Invoice Sort - -Identifies the sort field and sort order. - -## Structure - -`InvoiceSort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `field` | `string` | Required, Constant | The field to use for sorting.
**Default**: `'INVOICE_SORT_DATE'` | -| `order` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "field": "INVOICE_SORT_DATE", - "order": "DESC" -} -``` - diff --git a/doc/models/invoice-status.md b/doc/models/invoice-status.md deleted file mode 100644 index ec13bb977..000000000 --- a/doc/models/invoice-status.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Invoice Status - -Indicates the status of an invoice. - -## Enumeration - -`InvoiceStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `DRAFT` | The invoice is a draft. You must publish a draft invoice before Square can process it.
A draft invoice has no `public_url`, so it is not available to customers. | -| `UNPAID` | The invoice is published but not yet paid. | -| `SCHEDULED` | The invoice is scheduled to be processed. On the scheduled date,
Square sends the invoice, initiates an automatic payment, or takes no action, depending on
the delivery method and payment request settings. Square also sets the invoice status to the
appropriate state: `UNPAID`, `PAID`, `PARTIALLY_PAID`, or `PAYMENT_PENDING`. | -| `PARTIALLY_PAID` | A partial payment is received for the invoice. | -| `PAID` | The customer paid the invoice in full. | -| `PARTIALLY_REFUNDED` | The invoice is paid (or partially paid) and some but not all the amount paid is
refunded. | -| `REFUNDED` | The full amount that the customer paid for the invoice is refunded. | -| `CANCELED` | The invoice is canceled. Square no longer requests payments from the customer.
The `public_url` page remains and is accessible, but it displays the invoice
as canceled and does not accept payment. | -| `FAILED` | Square canceled the invoice due to suspicious activity. | -| `PAYMENT_PENDING` | A payment on the invoice was initiated but has not yet been processed.

When in this state, invoices cannot be updated and other payments cannot be initiated. | - diff --git a/doc/models/invoice.md b/doc/models/invoice.md deleted file mode 100644 index 1e7686af8..000000000 --- a/doc/models/invoice.md +++ /dev/null @@ -1,63 +0,0 @@ - -# Invoice - -Stores information about an invoice. You use the Invoices API to create and manage -invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - -## Structure - -`Invoice` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the invoice. | -| `version` | `number \| undefined` | Optional | The Square-assigned version number, which is incremented each time an update is committed to the invoice. | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the location that this invoice is associated with.

If specified in a `CreateInvoice` request, the value must match the `location_id` of the associated order.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `orderId` | `string \| null \| undefined` | Optional | The ID of the [order](entity:Order) for which the invoice is created.
This field is required when creating an invoice, and the order must be in the `OPEN` state.

To view the line items and other information for the associated order, call the
[RetrieveOrder](api-endpoint:Orders-RetrieveOrder) endpoint using the order ID.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `primaryRecipient` | [`InvoiceRecipient \| undefined`](../../doc/models/invoice-recipient.md) | Optional | Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice
and that Square uses to deliver the invoice.

When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates
the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published.
Square updates the customer ID in response to a merge operation, but does not update other fields. | -| `paymentRequests` | [`InvoicePaymentRequest[] \| null \| undefined`](../../doc/models/invoice-payment-request.md) | Optional | The payment schedule for the invoice, represented by one or more payment requests that
define payment settings, such as amount due and due date. An invoice supports the following payment request combinations:

- One balance
- One deposit with one balance
- 2–12 installments
- One deposit with 2–12 installments

This field is required when creating an invoice. It must contain at least one payment request.
All payment requests for the invoice must equal the total order amount. For more information, see
[Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests).

Adding `INSTALLMENT` payment requests to an invoice requires an
[Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). | -| `deliveryMethod` | [`string \| undefined`](../../doc/models/invoice-delivery-method.md) | Optional | Indicates how Square delivers the [invoice](../../doc/models/invoice.md) to the customer. | -| `invoiceNumber` | `string \| null \| undefined` | Optional | A user-friendly invoice number that is displayed on the invoice. The value is unique within a location.
If not provided when creating an invoice, Square assigns a value.
It increments from 1 and is padded with zeros making it 7 characters long
(for example, 0000001 and 0000002).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `191` | -| `title` | `string \| null \| undefined` | Optional | The title of the invoice, which is displayed on the invoice.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `description` | `string \| null \| undefined` | Optional | The description of the invoice, which is displayed on the invoice.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `65536` | -| `scheduledAt` | `string \| null \| undefined` | Optional | The timestamp when the invoice is scheduled for processing, in RFC 3339 format.
After the invoice is published, Square processes the invoice on the specified date,
according to the delivery method and payment request settings.

If the field is not set, Square processes the invoice immediately after it is published. | -| `publicUrl` | `string \| undefined` | Optional | The URL of the Square-hosted invoice page.
After you publish the invoice using the `PublishInvoice` endpoint, Square hosts the invoice
page and returns the page URL in the response. | -| `nextPaymentAmountMoney` | [`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. | -| `status` | [`string \| undefined`](../../doc/models/invoice-status.md) | Optional | Indicates the status of an invoice. | -| `timezone` | `string \| undefined` | Optional | The time zone used to interpret calendar dates on the invoice, such as `due_date`.
When an invoice is created, this field is set to the `timezone` specified for the seller
location. The value cannot be changed.

For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los\_Angeles
becomes overdue at midnight on March 9 in America/Los\_Angeles (which equals a UTC timestamp
of 2021-03-10T08:00:00Z). | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the invoice was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the invoice was last updated, in RFC 3339 format. | -| `acceptedPaymentMethods` | [`InvoiceAcceptedPaymentMethods \| undefined`](../../doc/models/invoice-accepted-payment-methods.md) | Optional | The payment methods that customers can use to pay an [invoice](../../doc/models/invoice.md) on the Square-hosted invoice payment page. | -| `customFields` | [`InvoiceCustomField[] \| null \| undefined`](../../doc/models/invoice-custom-field.md) | Optional | Additional seller-defined fields that are displayed on the invoice. For more information, see
[Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields).

Adding custom fields to an invoice requires an
[Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).

Max: 2 custom fields | -| `subscriptionId` | `string \| undefined` | Optional | The ID of the [subscription](entity:Subscription) associated with the invoice.
This field is present only on subscription billing invoices. | -| `saleOrServiceDate` | `string \| null \| undefined` | Optional | The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format.
This field can be used to specify a past or future date which is displayed on the invoice. | -| `paymentConditions` | `string \| null \| undefined` | Optional | **France only.** The payment terms and conditions that are displayed on the invoice. For more information,
see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions).

For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and
"Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `2000` | -| `storePaymentMethodEnabled` | `boolean \| null \| undefined` | Optional | Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a
bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on file__ checkbox on the
invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`. | -| `attachments` | [`InvoiceAttachment[] \| undefined`](../../doc/models/invoice-attachment.md) | Optional | Metadata about the attachments on the invoice. Invoice attachments are managed using the
[CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "version": 224, - "location_id": "location_id4", - "order_id": "order_id4", - "primary_recipient": { - "customer_id": "customer_id2", - "given_name": "given_name6", - "family_name": "family_name8", - "email_address": "email_address2", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } -} -``` - diff --git a/doc/models/item-variation-location-overrides.md b/doc/models/item-variation-location-overrides.md deleted file mode 100644 index 44a05020f..000000000 --- a/doc/models/item-variation-location-overrides.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Item Variation Location Overrides - -Price and inventory alerting overrides for a `CatalogItemVariation` at a specific `Location`. - -## Structure - -`ItemVariationLocationOverrides` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the `Location`. This can include locations that are deactivated. | -| `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. | -| `pricingType` | [`string \| undefined`](../../doc/models/catalog-pricing-type.md) | Optional | Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. | -| `trackInventory` | `boolean \| null \| undefined` | Optional | If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`. | -| `inventoryAlertType` | [`string \| undefined`](../../doc/models/inventory-alert-type.md) | Optional | Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. | -| `inventoryAlertThreshold` | `bigint \| null \| undefined` | Optional | If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard.

This value is always an integer. | -| `soldOut` | `boolean \| undefined` | Optional | Indicates whether the overridden item variation is sold out at the specified location.

When inventory tracking is enabled on the item variation either globally or at the specified location,
the item variation is automatically marked as sold out when its inventory count reaches zero. The seller
can manually set the item variation as sold out even when the inventory count is greater than zero.
Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is set,
applications should treat its inventory count as zero when this attribute value is `true`. | -| `soldOutValidUntil` | `string \| undefined` | Optional | The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation
becomes available again at the specified location. Attempts by an application to set this attribute are ignored.
When the current time is later than this attribute value, the affected item variation is no longer sold out. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id6", - "price_money": { - "amount": 202, - "currency": "GTQ" - }, - "pricing_type": "FIXED_PRICING", - "track_inventory": false, - "inventory_alert_type": "NONE" -} -``` - diff --git a/doc/models/job-assignment-pay-type.md b/doc/models/job-assignment-pay-type.md deleted file mode 100644 index f093e47e5..000000000 --- a/doc/models/job-assignment-pay-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Job Assignment Pay Type - -Enumerates the possible pay types that a job can be assigned. - -## Enumeration - -`JobAssignmentPayType` - -## Fields - -| Name | Description | -| --- | --- | -| `NONE` | The job does not have a defined pay type. | -| `HOURLY` | The job pays an hourly rate. | -| `SALARY` | The job pays an annual salary. | - diff --git a/doc/models/job-assignment.md b/doc/models/job-assignment.md deleted file mode 100644 index 81ef7bfc3..000000000 --- a/doc/models/job-assignment.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Job Assignment - -Represents a job assigned to a [team member](../../doc/models/team-member.md), including the compensation the team -member earns for the job. Job assignments are listed in the team member's [wage setting](../../doc/models/wage-setting.md). - -## Structure - -`JobAssignment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `jobTitle` | `string \| null \| undefined` | Optional | The title of the job. | -| `payType` | [`string`](../../doc/models/job-assignment-pay-type.md) | Required | Enumerates the possible pay types that a job can be assigned. | -| `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. | -| `annualRate` | [`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. | -| `weeklyHours` | `number \| null \| undefined` | Optional | The planned hours per week for the job. Set if the job `PayType` is `SALARY`. | -| `jobId` | `string \| null \| undefined` | Optional | The ID of the [job](../../doc/models/job.md). | - -## Example (as JSON) - -```json -{ - "job_title": "job_title6", - "pay_type": "NONE", - "hourly_rate": { - "amount": 172, - "currency": "LAK" - }, - "annual_rate": { - "amount": 232, - "currency": "NIO" - }, - "weekly_hours": 120, - "job_id": "job_id8" -} -``` - diff --git a/doc/models/job.md b/doc/models/job.md deleted file mode 100644 index 2fb338726..000000000 --- a/doc/models/job.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Job - -Represents a job that can be assigned to [team members](../../doc/models/team-member.md). This object defines the -job's title and tip eligibility. Compensation is defined in a [job assignment](../../doc/models/job-assignment.md) -in a team member's wage setting. - -## Structure - -`Job` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | **Read only** The unique Square-assigned ID of the job. If you need a job ID for an API request,
call [ListJobs](api-endpoint:Team-ListJobs) or use the ID returned when you created the job.
You can also get job IDs from a team member's wage setting. | -| `title` | `string \| null \| undefined` | Optional | The title of the job.
**Constraints**: *Maximum Length*: `150` | -| `isTipEligible` | `boolean \| null \| undefined` | Optional | Indicates whether team members can earn tips for the job. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the job was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the job was last updated, in RFC 3339 format. | -| `version` | `number \| undefined` | Optional | **Read only** The current version of the job. Include this field in `UpdateJob` requests to enable
[optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency)
control and avoid overwrites from concurrent requests. Requests fail if the provided version doesn't
match the server version at the time of the request. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "title": "title2", - "is_tip_eligible": false, - "created_at": "created_at4", - "updated_at": "updated_at2" -} -``` - diff --git a/doc/models/link-customer-to-gift-card-request.md b/doc/models/link-customer-to-gift-card-request.md deleted file mode 100644 index 2ee612b80..000000000 --- a/doc/models/link-customer-to-gift-card-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Link Customer to Gift Card Request - -A request to link a customer to a gift card. - -## Structure - -`LinkCustomerToGiftCardRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Required | The ID of the customer to link to the gift card.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `191` | - -## Example (as JSON) - -```json -{ - "customer_id": "GKY0FZ3V717AH8Q2D821PNT2ZW" -} -``` - diff --git a/doc/models/link-customer-to-gift-card-response.md b/doc/models/link-customer-to-gift-card-response.md deleted file mode 100644 index b956ec790..000000000 --- a/doc/models/link-customer-to-gift-card-response.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Link Customer to Gift Card Response - -A response that contains the linked `GiftCard` object. If the request resulted in errors, -the response contains a set of `Error` objects. - -## Structure - -`LinkCustomerToGiftCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCard` | [`GiftCard \| undefined`](../../doc/models/gift-card.md) | Optional | Represents a Square gift card. | - -## Example (as JSON) - -```json -{ - "gift_card": { - "balance_money": { - "amount": 2500, - "currency": "USD" - }, - "created_at": "2021-03-25T05:13:01Z", - "customer_ids": [ - "GKY0FZ3V717AH8Q2D821PNT2ZW" - ], - "gan": "7783320005440920", - "gan_source": "SQUARE", - "id": "gftc:71ea002277a34f8a945e284b04822edb", - "state": "ACTIVE", - "type": "DIGITAL" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-bank-accounts-request.md b/doc/models/list-bank-accounts-request.md deleted file mode 100644 index adf510a31..000000000 --- a/doc/models/list-bank-accounts-request.md +++ /dev/null @@ -1,28 +0,0 @@ - -# List Bank Accounts Request - -Request object for fetching all `BankAccount` -objects linked to a account. - -## Structure - -`ListBankAccountsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | The pagination cursor returned by a previous call to this endpoint.
Use it in the next `ListBankAccounts` request to retrieve the next set
of results.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | -| `limit` | `number \| null \| undefined` | Optional | Upper limit on the number of bank accounts to return in the response.
Currently, 1000 is the largest supported limit. You can specify a limit
of up to 1000 bank accounts. This is also the default limit. | -| `locationId` | `string \| null \| undefined` | Optional | Location ID. You can specify this optional filter
to retrieve only the linked bank accounts belonging to a specific location. | - -## Example (as JSON) - -```json -{ - "cursor": "cursor8", - "limit": 182, - "location_id": "location_id2" -} -``` - diff --git a/doc/models/list-bank-accounts-response.md b/doc/models/list-bank-accounts-response.md deleted file mode 100644 index 3cc1682ba..000000000 --- a/doc/models/list-bank-accounts-response.md +++ /dev/null @@ -1,73 +0,0 @@ - -# List Bank Accounts Response - -Response object returned by ListBankAccounts. - -## Structure - -`ListBankAccountsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `bankAccounts` | [`BankAccount[] \| undefined`](../../doc/models/bank-account.md) | Optional | List of BankAccounts associated with this account. | -| `cursor` | `string \| undefined` | Optional | When a response is truncated, it includes a cursor that you can
use in a subsequent request to fetch next set of bank accounts.
If empty, this is the final response.

For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | - -## Example (as JSON) - -```json -{ - "bank_accounts": [ - { - "account_number_suffix": "971", - "account_type": "CHECKING", - "bank_name": "Bank Name", - "country": "US", - "creditable": false, - "currency": "USD", - "debitable": false, - "holder_name": "Jane Doe", - "id": "ao6iaQ9vhDiaQD7n3GB", - "location_id": "S8GWD5example", - "primary_bank_identification_number": "112200303", - "status": "VERIFICATION_IN_PROGRESS", - "version": 5, - "secondary_bank_identification_number": "secondary_bank_identification_number0", - "debit_mandate_reference_id": "debit_mandate_reference_id4", - "reference_id": "reference_id8", - "fingerprint": "fingerprint6" - }, - { - "account_number_suffix": "972", - "account_type": "CHECKING", - "bank_name": "Bank Name", - "country": "US", - "creditable": false, - "currency": "USD", - "debitable": false, - "holder_name": "Jane Doe", - "id": "4x7WXuaxrkQkVlka3GB", - "location_id": "S8GWD5example", - "primary_bank_identification_number": "112200303", - "status": "VERIFICATION_IN_PROGRESS", - "version": 5, - "secondary_bank_identification_number": "secondary_bank_identification_number0", - "debit_mandate_reference_id": "debit_mandate_reference_id4", - "reference_id": "reference_id8", - "fingerprint": "fingerprint6" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor2" -} -``` - diff --git a/doc/models/list-booking-custom-attribute-definitions-request.md b/doc/models/list-booking-custom-attribute-definitions-request.md deleted file mode 100644 index c939b9125..000000000 --- a/doc/models/list-booking-custom-attribute-definitions-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# List Booking Custom Attribute Definitions Request - -Represents a [ListBookingCustomAttributeDefinitions](../../doc/api/booking-custom-attributes.md#list-booking-custom-attribute-definitions) request. - -## Structure - -`ListBookingCustomAttributeDefinitionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "limit": 98, - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-booking-custom-attribute-definitions-response.md b/doc/models/list-booking-custom-attribute-definitions-response.md deleted file mode 100644 index 5237ec7b9..000000000 --- a/doc/models/list-booking-custom-attribute-definitions-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# List Booking Custom Attribute Definitions Response - -Represents a [ListBookingCustomAttributeDefinitions](../../doc/api/booking-custom-attributes.md#list-booking-custom-attribute-definitions) response. -Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. -If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. - -## Structure - -`ListBookingCustomAttributeDefinitionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinitions` | [`CustomAttributeDefinition[] \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | The retrieved custom attribute definitions. If no custom attribute definitions are found,
Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to provide in your next call to this endpoint to retrieve the next page of
results for your original request. This field is present only if the request succeeded and
additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "YEk4UPbUEsu8MUV0xouO5hCiFcD9T5ztB6UWEJq5vZnqBFmoBEi0j1j6HWYTFGMRre4p7T5wAQBj3Th1NX3XgBFcQVEVsIxUQ2NsbwjRitfoEZDml9uxxQXepowyRvCuSThHPbJSn7M7wInl3x8XypQF9ahVVQXegJ0CxEKc0SBH", - "custom_attribute_definitions": [ - { - "created_at": "2022-11-16T15:27:30Z", - "description": "Update the description as desired.", - "key": "favoriteShampoo", - "name": "Favorite shampoo", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T15:39:38Z", - "version": 3, - "visibility": "VISIBILITY_READ_ONLY" - }, - { - "created_at": "2022-11-16T15:49:05Z", - "description": "Number of people in the party for dine-in", - "key": "partySize", - "name": "Party size", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T15:49:05Z", - "version": 1, - "visibility": "VISIBILITY_HIDDEN" - } - ], - "errors": [] -} -``` - diff --git a/doc/models/list-booking-custom-attributes-request.md b/doc/models/list-booking-custom-attributes-request.md deleted file mode 100644 index 787757e68..000000000 --- a/doc/models/list-booking-custom-attributes-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Booking Custom Attributes Request - -Represents a [ListBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#list-booking-custom-attributes) request. - -## Structure - -`ListBookingCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | - -## Example (as JSON) - -```json -{ - "limit": 254, - "cursor": "cursor8", - "with_definitions": false -} -``` - diff --git a/doc/models/list-booking-custom-attributes-response.md b/doc/models/list-booking-custom-attributes-response.md deleted file mode 100644 index 4f02a78c0..000000000 --- a/doc/models/list-booking-custom-attributes-response.md +++ /dev/null @@ -1,81 +0,0 @@ - -# List Booking Custom Attributes Response - -Represents a [ListBookingCustomAttributes](../../doc/api/booking-custom-attributes.md#list-booking-custom-attributes) response. -Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional -results are available, the `cursor` field is also present along with `custom_attributes`. - -## Structure - -`ListBookingCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributes` | [`CustomAttribute[] \| undefined`](../../doc/models/custom-attribute.md) | Optional | The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
the custom attribute definition is returned in the `definition` field of each custom attribute.

If no custom attributes are found, Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to use in your next call to this endpoint to retrieve the next page of results
for your original request. This field is present only if the request succeeded and additional
results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attributes": [ - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - } - ], - "cursor": "cursor0", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-bookings-request.md b/doc/models/list-bookings-request.md deleted file mode 100644 index a2e3b144f..000000000 --- a/doc/models/list-bookings-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# List Bookings Request - -## Structure - -`ListBookingsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results per page to return in a paged response.
**Constraints**: `>= 1`, `<= 10000` | -| `cursor` | `string \| null \| undefined` | Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results.
**Constraints**: *Maximum Length*: `65536` | -| `customerId` | `string \| null \| undefined` | Optional | The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all customers are retrieved.
**Constraints**: *Maximum Length*: `192` | -| `teamMemberId` | `string \| null \| undefined` | Optional | The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved.
**Constraints**: *Maximum Length*: `32` | -| `locationId` | `string \| null \| undefined` | Optional | The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved.
**Constraints**: *Maximum Length*: `32` | -| `startAtMin` | `string \| null \| undefined` | Optional | The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used. | -| `startAtMax` | `string \| null \| undefined` | Optional | The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days after `start_at_min` is used. | - -## Example (as JSON) - -```json -{ - "limit": 34, - "cursor": "cursor4", - "customer_id": "customer_id0", - "team_member_id": "team_member_id2", - "location_id": "location_id6" -} -``` - diff --git a/doc/models/list-bookings-response.md b/doc/models/list-bookings-response.md deleted file mode 100644 index 887430b12..000000000 --- a/doc/models/list-bookings-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# List Bookings Response - -## Structure - -`ListBookingsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookings` | [`Booking[] \| undefined`](../../doc/models/booking.md) | Optional | The list of targeted bookings. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set.
**Constraints**: *Maximum Length*: `65536` | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "bookings": [ - { - "id": "id4", - "version": 218, - "status": "ACCEPTED", - "created_at": "created_at2", - "updated_at": "updated_at0" - } - ], - "cursor": "cursor6", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-break-types-request.md b/doc/models/list-break-types-request.md deleted file mode 100644 index f14e782f6..000000000 --- a/doc/models/list-break-types-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Break Types Request - -A request for a filtered set of `BreakType` objects. - -## Structure - -`ListBreakTypesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| null \| undefined` | Optional | Filter the returned `BreakType` results to only those that are associated with the
specified location. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of `BreakType` results to return per page. The number can range between 1
and 200. The default is 200.
**Constraints**: `>= 1`, `<= 200` | -| `cursor` | `string \| null \| undefined` | Optional | A pointer to the next page of `BreakType` results to fetch. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id6", - "limit": 244, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/list-break-types-response.md b/doc/models/list-break-types-response.md deleted file mode 100644 index 76761436e..000000000 --- a/doc/models/list-break-types-response.md +++ /dev/null @@ -1,63 +0,0 @@ - -# List Break Types Response - -The response to a request for a set of `BreakType` objects. The response contains -the requested `BreakType` objects and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`ListBreakTypesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `breakTypes` | [`BreakType[] \| undefined`](../../doc/models/break-type.md) | Optional | A page of `BreakType` results. | -| `cursor` | `string \| undefined` | Optional | The value supplied in the subsequent request to fetch the next page
of `BreakType` results. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "break_types": [ - { - "break_name": "Coffee Break", - "created_at": "2019-01-22T20:47:37Z", - "expected_duration": "PT5M", - "id": "REGS1EQR1TPZ5", - "is_paid": false, - "location_id": "PAA1RJZZKXBFG", - "updated_at": "2019-01-22T20:47:37Z", - "version": 1 - }, - { - "break_name": "Lunch Break", - "created_at": "2019-01-25T19:26:30Z", - "expected_duration": "PT1H", - "id": "92EPDRQKJ5088", - "is_paid": true, - "location_id": "PAA1RJZZKXBFG", - "updated_at": "2019-01-25T19:26:30Z", - "version": 3 - } - ], - "cursor": "2fofTniCgT0yIPAq26kmk0YyFQJZfbWkh73OOnlTHmTAx13NgED", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-cards-request.md b/doc/models/list-cards-request.md deleted file mode 100644 index 09ca4b60d..000000000 --- a/doc/models/list-cards-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# List Cards Request - -Retrieves details for a specific Card. Accessible via -HTTP requests at GET https://connect.squareup.com/v2/cards - -## Structure - -`ListCardsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information.
**Constraints**: *Maximum Length*: `256` | -| `customerId` | `string \| null \| undefined` | Optional | Limit results to cards associated with the customer supplied.
By default, all cards owned by the merchant are returned. | -| `includeDisabled` | `boolean \| null \| undefined` | Optional | Includes disabled cards.
By default, all enabled cards owned by the merchant are returned. | -| `referenceId` | `string \| null \| undefined` | Optional | Limit results to cards associated with the reference_id supplied. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "cursor": "cursor6", - "customer_id": "customer_id8", - "include_disabled": false, - "reference_id": "reference_id8", - "sort_order": "DESC" -} -``` - diff --git a/doc/models/list-cards-response.md b/doc/models/list-cards-response.md deleted file mode 100644 index 91da1745f..000000000 --- a/doc/models/list-cards-response.md +++ /dev/null @@ -1,64 +0,0 @@ - -# List Cards Response - -Defines the fields that are included in the response body of -a request to the [ListCards](../../doc/api/cards.md#list-cards) endpoint. - -Note: if there are errors processing the request, the card field will not be -present. - -## Structure - -`ListCardsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `cards` | [`Card[] \| undefined`](../../doc/models/card.md) | Optional | The requested list of `Card`s. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty,
this is the final response.

See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "cards": [ - { - "billing_address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "bin": "411111", - "card_brand": "VISA", - "card_type": "CREDIT", - "cardholder_name": "Amelia Earhart", - "customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8", - "enabled": true, - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", - "id": "ccof:uIbfJXhXETSP197M3GB", - "last_4": "1111", - "merchant_id": "6SSW7HV8K2ST5", - "prepaid_type": "NOT_PREPAID", - "reference_id": "user-id-1", - "version": 1 - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-cash-drawer-shift-events-request.md b/doc/models/list-cash-drawer-shift-events-request.md deleted file mode 100644 index 0e99af8c4..000000000 --- a/doc/models/list-cash-drawer-shift-events-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# List Cash Drawer Shift Events Request - -## Structure - -`ListCashDrawerShiftEventsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Required | The ID of the location to list cash drawer shifts for.
**Constraints**: *Minimum Length*: `1` | -| `limit` | `number \| null \| undefined` | Optional | Number of resources to be returned in a page of results (200 by
default, 1000 max).
**Constraints**: `<= 1000` | -| `cursor` | `string \| null \| undefined` | Optional | Opaque cursor for fetching the next page of results. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id8", - "limit": 24, - "cursor": "cursor2" -} -``` - diff --git a/doc/models/list-cash-drawer-shift-events-response.md b/doc/models/list-cash-drawer-shift-events-response.md deleted file mode 100644 index a7c2b0b96..000000000 --- a/doc/models/list-cash-drawer-shift-events-response.md +++ /dev/null @@ -1,99 +0,0 @@ - -# List Cash Drawer Shift Events Response - -## Structure - -`ListCashDrawerShiftEventsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Optional | Opaque cursor for fetching the next page. Cursor is not present in
the last page of results. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `cashDrawerShiftEvents` | [`CashDrawerShiftEvent[] \| undefined`](../../doc/models/cash-drawer-shift-event.md) | Optional | All of the events (payments, refunds, etc.) for a cash drawer during
the shift. | - -## Example (as JSON) - -```json -{ - "cash_drawer_shift_events": [ - { - "created_at": "2019-11-22T00:43:02.000Z", - "description": "", - "event_money": { - "amount": 100, - "currency": "USD" - }, - "event_type": "CASH_TENDER_PAYMENT", - "id": "9F07DB01-D85A-4B77-88C3-D5C64CEB5155", - "team_member_id": "" - }, - { - "created_at": "2019-11-22T00:43:12.000Z", - "description": "", - "event_money": { - "amount": 250, - "currency": "USD" - }, - "event_type": "CASH_TENDER_PAYMENT", - "id": "B2854CEA-A781-49B3-8F31-C64558231F48", - "team_member_id": "" - }, - { - "created_at": "2019-11-22T00:43:23.000Z", - "description": "", - "event_money": { - "amount": 250, - "currency": "USD" - }, - "event_type": "CASH_TENDER_CANCELLED_PAYMENT", - "id": "B5FB7F72-95CD-44A3-974D-26C41064D042", - "team_member_id": "" - }, - { - "created_at": "2019-11-22T00:43:46.000Z", - "description": "", - "event_money": { - "amount": 100, - "currency": "USD" - }, - "event_type": "CASH_TENDER_REFUND", - "id": "0B425480-8504-40B4-A867-37B23543931B", - "team_member_id": "" - }, - { - "created_at": "2019-11-22T00:44:18.000Z", - "description": "Transfer from another drawer", - "event_money": { - "amount": 10000, - "currency": "USD" - }, - "event_type": "PAID_IN", - "id": "8C66E60E-FDCF-4EEF-A98D-3B14B7ED5CBE", - "team_member_id": "" - }, - { - "created_at": "2019-11-22T00:44:29.000Z", - "description": "Transfer out to another drawer", - "event_money": { - "amount": 10000, - "currency": "USD" - }, - "event_type": "PAID_OUT", - "id": "D5ACA7FE-C64D-4ADA-8BC8-82118A2DAE4F", - "team_member_id": "" - } - ], - "cursor": "cursor8", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-cash-drawer-shifts-request.md b/doc/models/list-cash-drawer-shifts-request.md deleted file mode 100644 index 003caa4a4..000000000 --- a/doc/models/list-cash-drawer-shifts-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# List Cash Drawer Shifts Request - -## Structure - -`ListCashDrawerShiftsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Required | The ID of the location to query for a list of cash drawer shifts.
**Constraints**: *Minimum Length*: `1` | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `beginTime` | `string \| null \| undefined` | Optional | The inclusive start time of the query on opened_at, in ISO 8601 format. | -| `endTime` | `string \| null \| undefined` | Optional | The exclusive end date of the query on opened_at, in ISO 8601 format. | -| `limit` | `number \| null \| undefined` | Optional | Number of cash drawer shift events in a page of results (200 by
default, 1000 max).
**Constraints**: `<= 1000` | -| `cursor` | `string \| null \| undefined` | Optional | Opaque cursor for fetching the next page of results. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id6", - "sort_order": "DESC", - "begin_time": "begin_time0", - "end_time": "end_time4", - "limit": 154, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/list-cash-drawer-shifts-response.md b/doc/models/list-cash-drawer-shifts-response.md deleted file mode 100644 index 559527ef8..000000000 --- a/doc/models/list-cash-drawer-shifts-response.md +++ /dev/null @@ -1,59 +0,0 @@ - -# List Cash Drawer Shifts Response - -## Structure - -`ListCashDrawerShiftsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Optional | Opaque cursor for fetching the next page of results. Cursor is not
present in the last page of results. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `cashDrawerShifts` | [`CashDrawerShiftSummary[] \| undefined`](../../doc/models/cash-drawer-shift-summary.md) | Optional | A collection of CashDrawerShiftSummary objects for shifts that match
the query. | - -## Example (as JSON) - -```json -{ - "cash_drawer_shifts": [ - { - "closed_at": "2019-11-22T00:44:49.000Z", - "closed_cash_money": { - "amount": 9970, - "currency": "USD" - }, - "description": "Misplaced some change", - "ended_at": "2019-11-22T00:44:49.000Z", - "expected_cash_money": { - "amount": 10000, - "currency": "USD" - }, - "id": "DCC99978-09A6-4926-849F-300BE9C5793A", - "opened_at": "2019-11-22T00:42:54.000Z", - "opened_cash_money": { - "amount": 10000, - "currency": "USD" - }, - "state": "CLOSED" - } - ], - "cursor": "cursor6", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-catalog-request.md b/doc/models/list-catalog-request.md deleted file mode 100644 index 0689e6646..000000000 --- a/doc/models/list-catalog-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# List Catalog Request - -## Structure - -`ListCatalogRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | The pagination cursor returned in the previous response. Leave unset for an initial request.
The page size is currently set to be 100.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `types` | `string \| null \| undefined` | Optional | An optional case-insensitive, comma-separated list of object types to retrieve.

The valid values are defined in the [CatalogObjectType](entity:CatalogObjectType) enum, for example,
`ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,
`MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc.

If this is unspecified, the operation returns objects of all the top level types at the version
of the Square API used to make the request. Object types that are nested onto other object types
are not included in the defaults.

At the current API version the default object types are:
ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST,
PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,
SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The specific version of the catalog objects to be included in the response.
This allows you to retrieve historical versions of objects. The specified version value is matched against
the [CatalogObject](../../doc/models/catalog-object.md)s' `version` attribute. If not included, results will be from the
current version of the catalog. | - -## Example (as JSON) - -```json -{ - "cursor": "cursor2", - "types": "types0", - "catalog_version": 254 -} -``` - diff --git a/doc/models/list-catalog-response.md b/doc/models/list-catalog-response.md deleted file mode 100644 index c0b8ce1ae..000000000 --- a/doc/models/list-catalog-response.md +++ /dev/null @@ -1,119 +0,0 @@ - -# List Catalog Response - -## Structure - -`ListCatalogResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If unset, this is the final response.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `objects` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | The CatalogObjects returned. | - -## Example (as JSON) - -```json -{ - "objects": [ - { - "category_data": { - "name": "Beverages" - }, - "id": "5ZYQZZ2IECPVJ2IJ5KQPRDC3", - "is_deleted": false, - "present_at_all_locations": true, - "type": "CATEGORY", - "updated_at": "2017-02-21T14:50:26.495Z", - "version": 1487688626495, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "id": "L5R47DGBZOOVKCAFIXC56AEN", - "is_deleted": false, - "present_at_all_locations": true, - "tax_data": { - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "enabled": true, - "inclusion_type": "ADDITIVE", - "name": "Sales Tax", - "percentage": "5.0" - }, - "type": "TAX", - "updated_at": "2017-02-21T14:50:26.495Z", - "version": 1487688626495, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-customer-custom-attribute-definitions-request.md b/doc/models/list-customer-custom-attribute-definitions-request.md deleted file mode 100644 index 0ee6b61f1..000000000 --- a/doc/models/list-customer-custom-attribute-definitions-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# List Customer Custom Attribute Definitions Request - -Represents a [ListCustomerCustomAttributeDefinitions](../../doc/api/customer-custom-attributes.md#list-customer-custom-attribute-definitions) request. - -## Structure - -`ListCustomerCustomAttributeDefinitionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "limit": 198, - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-customer-custom-attribute-definitions-response.md b/doc/models/list-customer-custom-attribute-definitions-response.md deleted file mode 100644 index 451437f2a..000000000 --- a/doc/models/list-customer-custom-attribute-definitions-response.md +++ /dev/null @@ -1,69 +0,0 @@ - -# List Customer Custom Attribute Definitions Response - -Represents a [ListCustomerCustomAttributeDefinitions](../../doc/api/customer-custom-attributes.md#list-customer-custom-attribute-definitions) response. -Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. -If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. - -## Structure - -`ListCustomerCustomAttributeDefinitionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinitions` | [`CustomAttributeDefinition[] \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | The retrieved custom attribute definitions. If no custom attribute definitions are found,
Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to provide in your next call to this endpoint to retrieve the next page of
results for your original request. This field is present only if the request succeeded and
additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "YEk4UPbUEsu8MUV0xouO5hCiFcD9T5ztB6UWEJq5vZnqBFmoBEi0j1j6HWYTFGMRre4p7T5wAQBj3Th1NX3XgBFcQVEVsIxUQ2NsbwjRitfoEZDml9uxxQXepowyRvCuSThHPbJSn7M7wInl3x8XypQF9ahVVQXegJ0CxEKc0SBH", - "custom_attribute_definitions": [ - { - "created_at": "2022-04-26T15:27:30Z", - "description": "Update the description as desired.", - "key": "favoritemovie", - "name": "Favorite Movie", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-04-26T15:39:38Z", - "version": 3, - "visibility": "VISIBILITY_READ_ONLY" - }, - { - "created_at": "2022-04-26T15:49:05Z", - "description": "Customer owns movie.", - "key": "ownsmovie", - "name": "Owns Movie", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-04-26T15:49:05Z", - "version": 1, - "visibility": "VISIBILITY_HIDDEN" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-customer-custom-attributes-request.md b/doc/models/list-customer-custom-attributes-request.md deleted file mode 100644 index 3dcc11651..000000000 --- a/doc/models/list-customer-custom-attributes-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Customer Custom Attributes Request - -Represents a [ListCustomerCustomAttributes](../../doc/api/customer-custom-attributes.md#list-customer-custom-attributes) request. - -## Structure - -`ListCustomerCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | - -## Example (as JSON) - -```json -{ - "limit": 224, - "cursor": "cursor6", - "with_definitions": false -} -``` - diff --git a/doc/models/list-customer-custom-attributes-response.md b/doc/models/list-customer-custom-attributes-response.md deleted file mode 100644 index c41e7eb1f..000000000 --- a/doc/models/list-customer-custom-attributes-response.md +++ /dev/null @@ -1,106 +0,0 @@ - -# List Customer Custom Attributes Response - -Represents a [ListCustomerCustomAttributes](../../doc/api/customer-custom-attributes.md#list-customer-custom-attributes) response. -Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional -results are available, the `cursor` field is also present along with `custom_attributes`. - -## Structure - -`ListCustomerCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributes` | [`CustomAttribute[] \| undefined`](../../doc/models/custom-attribute.md) | Optional | The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
the custom attribute definition is returned in the `definition` field of each custom attribute.

If no custom attributes are found, Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to use in your next call to this endpoint to retrieve the next page of results
for your original request. This field is present only if the request succeeded and additional
results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attributes": [ - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - } - ], - "cursor": "cursor4", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-customer-groups-request.md b/doc/models/list-customer-groups-request.md deleted file mode 100644 index 1a7fded26..000000000 --- a/doc/models/list-customer-groups-request.md +++ /dev/null @@ -1,26 +0,0 @@ - -# List Customer Groups Request - -Defines the query parameters that can be included in a request to the -[ListCustomerGroups](../../doc/api/customer-groups.md#list-customer-groups) endpoint. - -## Structure - -`ListCustomerGroupsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 50` | - -## Example (as JSON) - -```json -{ - "cursor": "cursor4", - "limit": 104 -} -``` - diff --git a/doc/models/list-customer-groups-response.md b/doc/models/list-customer-groups-response.md deleted file mode 100644 index 6783b6b87..000000000 --- a/doc/models/list-customer-groups-response.md +++ /dev/null @@ -1,62 +0,0 @@ - -# List Customer Groups Response - -Defines the fields that are included in the response body of -a request to the [ListCustomerGroups](../../doc/api/customer-groups.md#list-customer-groups) endpoint. - -Either `errors` or `groups` is present in a given response (never both). - -## Structure - -`ListCustomerGroupsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `groups` | [`CustomerGroup[] \| undefined`](../../doc/models/customer-group.md) | Optional | A list of customer groups belonging to the current seller. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. This value is present only if the request
succeeded and additional results are available.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "groups": [ - { - "created_at": "2020-04-13T21:54:57.863Z", - "id": "2TAT3CMH4Q0A9M87XJZED0WMR3", - "name": "Loyal Customers", - "updated_at": "2020-04-13T21:54:58Z" - }, - { - "created_at": "2020-04-13T21:55:18.795Z", - "id": "4XMEHESXJBNE9S9JAKZD2FGB14", - "name": "Super Loyal Customers", - "updated_at": "2020-04-13T21:55:19Z" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor0" -} -``` - diff --git a/doc/models/list-customer-segments-request.md b/doc/models/list-customer-segments-request.md deleted file mode 100644 index ff4af005b..000000000 --- a/doc/models/list-customer-segments-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# List Customer Segments Request - -Defines the valid parameters for requests to the `ListCustomerSegments` endpoint. - -## Structure - -`ListCustomerSegmentsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by previous calls to `ListCustomerSegments`.
This cursor is used to retrieve the next set of query results.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 50` | - -## Example (as JSON) - -```json -{ - "cursor": "cursor4", - "limit": 4 -} -``` - diff --git a/doc/models/list-customer-segments-response.md b/doc/models/list-customer-segments-response.md deleted file mode 100644 index 7ab56799c..000000000 --- a/doc/models/list-customer-segments-response.md +++ /dev/null @@ -1,73 +0,0 @@ - -# List Customer Segments Response - -Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint. - -Either `errors` or `segments` is present in a given response (never both). - -## Structure - -`ListCustomerSegmentsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `segments` | [`CustomerSegment[] \| undefined`](../../doc/models/customer-segment.md) | Optional | The list of customer segments belonging to the associated Square account. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor to be used in subsequent calls to `ListCustomerSegments`
to retrieve the next set of query results. The cursor is only present if the request succeeded and
additional results are available.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "segments": [ - { - "created_at": "2020-01-09T19:33:24.469Z", - "id": "GMNXRZVEXNQDF.CHURN_RISK", - "name": "Lapsed", - "updated_at": "2020-04-13T21:47:04Z" - }, - { - "created_at": "2020-01-09T19:33:24.486Z", - "id": "GMNXRZVEXNQDF.LOYAL", - "name": "Regulars", - "updated_at": "2020-04-13T21:47:04Z" - }, - { - "created_at": "2020-01-09T19:33:21.813Z", - "id": "GMNXRZVEXNQDF.REACHABLE", - "name": "Reachable", - "updated_at": "2020-04-13T21:47:04Z" - }, - { - "created_at": "2020-01-09T19:33:25Z", - "id": "gv2:KF92J19VXN5FK30GX2E8HSGQ20", - "name": "Instant Profile", - "updated_at": "2020-04-13T23:01:03Z" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor2" -} -``` - diff --git a/doc/models/list-customers-request.md b/doc/models/list-customers-request.md deleted file mode 100644 index edd96fe2f..000000000 --- a/doc/models/list-customers-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# List Customers Request - -Defines the query parameters that can be included in a request to the -`ListCustomers` endpoint. - -## Structure - -`ListCustomersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `sortField` | [`string \| undefined`](../../doc/models/customer-sort-field.md) | Optional | Specifies customer attributes as the sort key to customer profiles returned from a search. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `count` | `boolean \| null \| undefined` | Optional | Indicates whether to return the total count of customers in the `count` field of the response.

The default value is `false`. | - -## Example (as JSON) - -```json -{ - "cursor": "cursor6", - "limit": 96, - "sort_field": "DEFAULT", - "sort_order": "DESC", - "count": false -} -``` - diff --git a/doc/models/list-customers-response.md b/doc/models/list-customers-response.md deleted file mode 100644 index b47582d7f..000000000 --- a/doc/models/list-customers-response.md +++ /dev/null @@ -1,98 +0,0 @@ - -# List Customers Response - -Defines the fields that are included in the response body of -a request to the `ListCustomers` endpoint. - -Either `errors` or `customers` is present in a given response (never both). - -## Structure - -`ListCustomersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `customers` | [`Customer[] \| undefined`](../../doc/models/customer.md) | Optional | The customer profiles associated with the Square account or an empty object (`{}`) if none are found.
Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or
`phone_number`) are included in the response. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor to retrieve the next set of results for the
original query. A cursor is only present if the request succeeded and additional results
are available.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `count` | `bigint \| undefined` | Optional | The total count of customers associated with the Square account. Only customer profiles with public information
(`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is present
only if `count` is set to `true` in the request. | - -## Example (as JSON) - -```json -{ - "customers": [ - { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "created_at": "2016-03-23T20:21:54.859Z", - "creation_source": "THIRD_PARTY", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "group_ids": [ - "545AXB44B4XXWMVQ4W8SBT3HHF" - ], - "id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "note": "a customer", - "phone_number": "+1-212-555-4240", - "preferences": { - "email_unsubscribed": false - }, - "reference_id": "YOUR_REFERENCE_ID", - "segment_ids": [ - "1KB9JE5EGJXCW.REACHABLE" - ], - "updated_at": "2016-03-23T20:21:55Z", - "version": 1, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - }, - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor6", - "count": 184 -} -``` - diff --git a/doc/models/list-device-codes-request.md b/doc/models/list-device-codes-request.md deleted file mode 100644 index 4cf20d721..000000000 --- a/doc/models/list-device-codes-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# List Device Codes Request - -## Structure - -`ListDeviceCodesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | -| `locationId` | `string \| null \| undefined` | Optional | If specified, only returns DeviceCodes of the specified location.
Returns DeviceCodes of all locations if empty. | -| `productType` | [`string \| undefined`](../../doc/models/product-type.md) | Optional | - | -| `status` | [`string[] \| null \| undefined`](../../doc/models/device-code-status.md) | Optional | If specified, returns DeviceCodes with the specified statuses.
Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty.
See [DeviceCodeStatus](#type-devicecodestatus) for possible values | - -## Example (as JSON) - -```json -{ - "cursor": "cursor6", - "location_id": "location_id4", - "product_type": "TERMINAL_API", - "status": [ - "UNKNOWN", - "UNPAIRED", - "PAIRED" - ] -} -``` - diff --git a/doc/models/list-device-codes-response.md b/doc/models/list-device-codes-response.md deleted file mode 100644 index 2ea67ea70..000000000 --- a/doc/models/list-device-codes-response.md +++ /dev/null @@ -1,69 +0,0 @@ - -# List Device Codes Response - -## Structure - -`ListDeviceCodesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `deviceCodes` | [`DeviceCode[] \| undefined`](../../doc/models/device-code.md) | Optional | The queried DeviceCode. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. This value is present only if the request
succeeded and additional results are available.

See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "device_codes": [ - { - "code": "EBCARJ", - "created_at": "2020-02-06T18:44:33.000Z", - "device_id": "907CS13101300122", - "id": "B3Z6NAMYQSMTM", - "location_id": "B5E4484SHHNYH", - "name": "Counter 1", - "pair_by": "2020-02-06T18:49:33.000Z", - "product_type": "TERMINAL_API", - "status": "PAIRED", - "status_changed_at": "2020-02-06T18:47:28.000Z" - }, - { - "code": "GVXNYN", - "created_at": "2020-02-07T19:55:04.000Z", - "id": "YKGMJMYK8H4PQ", - "location_id": "A6SYFRSV4WAFW", - "name": "Unused device code", - "pair_by": "2020-02-07T20:00:04.000Z", - "product_type": "TERMINAL_API", - "status": "UNPAIRED", - "status_changed_at": "2020-02-07T19:55:04.000Z", - "device_id": "device_id4" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-devices-request.md b/doc/models/list-devices-request.md deleted file mode 100644 index 52237ee53..000000000 --- a/doc/models/list-devices-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Devices Request - -## Structure - -`ListDevicesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `limit` | `number \| null \| undefined` | Optional | The number of results to return in a single page.
**Constraints**: `>= 1`, `<= 100` | -| `locationId` | `string \| null \| undefined` | Optional | If present, only returns devices at the target location. | - -## Example (as JSON) - -```json -{ - "cursor": "cursor0", - "sort_order": "DESC", - "limit": 164, - "location_id": "location_id0" -} -``` - diff --git a/doc/models/list-devices-response.md b/doc/models/list-devices-response.md deleted file mode 100644 index a2bfd8aa2..000000000 --- a/doc/models/list-devices-response.md +++ /dev/null @@ -1,368 +0,0 @@ - -# List Devices Response - -## Structure - -`ListDevicesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors that occurred during the request. | -| `devices` | [`Device[] \| undefined`](../../doc/models/device.md) | Optional | The requested list of `Device` objects. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty,
this is the final response.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "cursor": "GcXjlV2iaizH7R0fMT6wUDbw6l4otigjzx8XOOspUKHo9EPLRByM", - "devices": [ - { - "attributes": { - "manufacturer": "Square", - "manufacturers_id": "995CS397A6475287", - "merchant_token": "MLCHNZCBWFDZB", - "model": "T2", - "name": "Square Terminal 995", - "type": "TERMINAL", - "updated_at": "2023-09-29T13:04:56.335762883Z", - "version": "5.41.0085" - }, - "components": [ - { - "application_details": { - "application_type": "TERMINAL_API", - "session_location": "LMN2K7S3RTOU3", - "version": "6.25", - "device_code_id": "device_code_id2" - }, - "type": "APPLICATION", - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "card_reader_details": { - "version": "3.53.70" - }, - "type": "CARD_READER", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "battery_details": { - "external_power": "AVAILABLE_CHARGING", - "visible_percent": 5 - }, - "type": "BATTERY", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "type": "WIFI", - "wifi_details": { - "active": true, - "ip_address_v4": "10.0.0.7", - "secure_connection": "WPA/WPA2 PSK", - "signal_strength": { - "value": 2 - }, - "ssid": "Staff Network" - }, - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "ethernet_details": { - "active": false - }, - "type": "ETHERNET", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - } - } - ], - "id": "device:995CS397A6475287", - "status": { - "category": "AVAILABLE" - } - }, - { - "attributes": { - "manufacturer": "Square", - "manufacturers_id": "995CS234B5493559", - "merchant_token": "MLCHXZCBWFGDW", - "model": "T2", - "name": "Square Terminal 995", - "type": "TERMINAL", - "updated_at": "2023-09-29T12:39:56.335742073Z", - "version": "5.41.0085" - }, - "components": [ - { - "application_details": { - "application_type": "TERMINAL_API", - "session_location": "LMN2K7S3RTOU3", - "version": "6.25" - }, - "type": "APPLICATION", - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "card_reader_details": { - "version": "3.53.70" - }, - "type": "CARD_READER", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "battery_details": { - "external_power": "AVAILABLE_CHARGING", - "visible_percent": 24 - }, - "type": "BATTERY", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "type": "WIFI", - "wifi_details": { - "active": true, - "ip_address_v4": "10.0.0.7", - "secure_connection": "WPA/WPA2 PSK", - "signal_strength": { - "value": 2 - }, - "ssid": "Staff Network" - }, - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "ethernet_details": { - "active": false, - "ip_address_v4": "ip_address_v42" - } - }, - { - "ethernet_details": { - "active": false - }, - "type": "ETHERNET", - "application_details": { - "application_type": "TERMINAL_API", - "version": "version4", - "session_location": "session_location0", - "device_code_id": "device_code_id2" - }, - "card_reader_details": { - "version": "version0" - }, - "battery_details": { - "visible_percent": 108, - "external_power": "AVAILABLE_CHARGING" - }, - "wifi_details": { - "active": false, - "ssid": "ssid8", - "ip_address_v4": "ip_address_v42", - "secure_connection": "secure_connection8", - "signal_strength": { - "value": 222 - } - } - } - ], - "id": "device:995CS234B5493559", - "status": { - "category": "NEEDS_ATTENTION" - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-dispute-evidence-request.md b/doc/models/list-dispute-evidence-request.md deleted file mode 100644 index 41a392185..000000000 --- a/doc/models/list-dispute-evidence-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# List Dispute Evidence Request - -Defines the parameters for a `ListDisputeEvidence` request. - -## Structure - -`ListDisputeEvidenceRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-dispute-evidence-response.md b/doc/models/list-dispute-evidence-response.md deleted file mode 100644 index 43d20f5e8..000000000 --- a/doc/models/list-dispute-evidence-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# List Dispute Evidence Response - -Defines the fields in a `ListDisputeEvidence` response. - -## Structure - -`ListDisputeEvidenceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `evidence` | [`DisputeEvidence[] \| undefined`](../../doc/models/dispute-evidence.md) | Optional | The list of evidence previously uploaded to the specified dispute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request.
If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "evidence": [ - { - "evidence_id": "evidence_id0", - "id": "id2", - "dispute_id": "dispute_id4", - "evidence_file": { - "filename": "filename8", - "filetype": "filetype8" - }, - "evidence_text": "evidence_text6" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-disputes-request.md b/doc/models/list-disputes-request.md deleted file mode 100644 index e0918112a..000000000 --- a/doc/models/list-disputes-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# List Disputes Request - -Defines the request parameters for the `ListDisputes` endpoint. - -## Structure - -`ListDisputesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `states` | [`string[] \| null \| undefined`](../../doc/models/dispute-state.md) | Optional | The dispute states used to filter the result. If not specified, the endpoint returns all disputes.
See [DisputeState](#type-disputestate) for possible values | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the location for which to return a list of disputes.
If not specified, the endpoint returns disputes associated with all locations.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | - -## Example (as JSON) - -```json -{ - "cursor": "cursor2", - "states": [ - "INQUIRY_EVIDENCE_REQUIRED", - "INQUIRY_PROCESSING", - "INQUIRY_CLOSED" - ], - "location_id": "location_id8" -} -``` - diff --git a/doc/models/list-disputes-response.md b/doc/models/list-disputes-response.md deleted file mode 100644 index c153ee3a2..000000000 --- a/doc/models/list-disputes-response.md +++ /dev/null @@ -1,77 +0,0 @@ - -# List Disputes Response - -Defines fields in a `ListDisputes` response. - -## Structure - -`ListDisputesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `disputes` | [`Dispute[] \| undefined`](../../doc/models/dispute.md) | Optional | The list of disputes. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request.
If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "cursor": "G1aSTRm48CLjJsg6Sg3hQN1b1OMaoVuG", - "disputes": [ - { - "amount_money": { - "amount": 2500, - "currency": "USD" - }, - "brand_dispute_id": "100000809947", - "card_brand": "VISA", - "created_at": "2022-06-29T18:45:22.265Z", - "disputed_payment": { - "payment_id": "zhyh1ch64kRBrrlfVhwjCEjZWzNZY" - }, - "due_at": "2022-07-13T00:00:00.000Z", - "id": "XDgyFu7yo1E2S5lQGGpYn", - "location_id": "L1HN3ZMQK64X9", - "reason": "NO_KNOWLEDGE", - "reported_at": "2022-06-29T00:00:00.000Z", - "state": "ACCEPTED", - "updated_at": "2022-07-07T19:14:42.650Z", - "version": 2, - "dispute_id": "dispute_id4" - }, - { - "amount_money": { - "amount": 2209, - "currency": "USD" - }, - "brand_dispute_id": "r5Of6YaGT7AdeRaVoAGCJw", - "card_brand": "VISA", - "created_at": "2022-04-29T18:45:22.265Z", - "disputed_payment": { - "payment_id": "zhyh1ch64kRBrrlfVhwjCEjZWzNZY" - }, - "due_at": "2022-05-13T00:00:00.000Z", - "id": "jLGg7aXC7lvKPr9PISt0T", - "location_id": "18YC4JDH91E1H", - "reason": "NOT_AS_DESCRIBED", - "reported_at": "2022-04-29T00:00:00.000Z", - "state": "EVIDENCE_REQUIRED", - "updated_at": "2022-04-29T18:45:22.265Z", - "version": 1, - "dispute_id": "dispute_id4" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-employee-wages-request.md b/doc/models/list-employee-wages-request.md deleted file mode 100644 index ca7642f3c..000000000 --- a/doc/models/list-employee-wages-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Employee Wages Request - -A request for a set of `EmployeeWage` objects. - -## Structure - -`ListEmployeeWagesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `employeeId` | `string \| null \| undefined` | Optional | Filter the returned wages to only those that are associated with the specified employee. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of `EmployeeWage` results to return per page. The number can range between
1 and 200. The default is 200.
**Constraints**: `>= 1`, `<= 200` | -| `cursor` | `string \| null \| undefined` | Optional | A pointer to the next page of `EmployeeWage` results to fetch. | - -## Example (as JSON) - -```json -{ - "employee_id": "employee_id2", - "limit": 58, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/list-employee-wages-response.md b/doc/models/list-employee-wages-response.md deleted file mode 100644 index 4a9cf474c..000000000 --- a/doc/models/list-employee-wages-response.md +++ /dev/null @@ -1,72 +0,0 @@ - -# List Employee Wages Response - -The response to a request for a set of `EmployeeWage` objects. The response contains -a set of `EmployeeWage` objects. - -## Structure - -`ListEmployeeWagesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `employeeWages` | [`EmployeeWage[] \| undefined`](../../doc/models/employee-wage.md) | Optional | A page of `EmployeeWage` results. | -| `cursor` | `string \| undefined` | Optional | The value supplied in the subsequent request to fetch the next page
of `EmployeeWage` results. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "2fofTniCgT0yIPAq26kmk0YyFQJZfbWkh73OOnlTHmTAx13NgED", - "employee_wages": [ - { - "employee_id": "33fJchumvVdJwxV0H6L9", - "hourly_rate": { - "amount": 3250, - "currency": "USD" - }, - "id": "pXS3qCv7BERPnEGedM4S8mhm", - "title": "Manager" - }, - { - "employee_id": "33fJchumvVdJwxV0H6L9", - "hourly_rate": { - "amount": 2600, - "currency": "USD" - }, - "id": "rZduCkzYDUVL3ovh1sQgbue6", - "title": "Cook" - }, - { - "employee_id": "33fJchumvVdJwxV0H6L9", - "hourly_rate": { - "amount": 1600, - "currency": "USD" - }, - "id": "FxLbs5KpPUHa8wyt5ctjubDX", - "title": "Barista" - }, - { - "employee_id": "33fJchumvVdJwxV0H6L9", - "hourly_rate": { - "amount": 1700, - "currency": "USD" - }, - "id": "vD1wCgijMDR3cX5TPnu7VXto", - "title": "Cashier" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-employees-request.md b/doc/models/list-employees-request.md deleted file mode 100644 index 6439901ef..000000000 --- a/doc/models/list-employees-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Employees Request - -## Structure - -`ListEmployeesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| null \| undefined` | Optional | - | -| `status` | [`string \| undefined`](../../doc/models/employee-status.md) | Optional | The status of the Employee being retrieved.

DEPRECATED at version 2020-08-26. Replaced by [TeamMemberStatus](entity:TeamMemberStatus). | -| `limit` | `number \| null \| undefined` | Optional | The number of employees to be returned on each page. | -| `cursor` | `string \| null \| undefined` | Optional | The token required to retrieve the specified page of results. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id4", - "status": "ACTIVE", - "limit": 18, - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-employees-response.md b/doc/models/list-employees-response.md deleted file mode 100644 index 4df6d431f..000000000 --- a/doc/models/list-employees-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# List Employees Response - -## Structure - -`ListEmployeesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `employees` | [`Employee[] \| undefined`](../../doc/models/employee.md) | Optional | - | -| `cursor` | `string \| undefined` | Optional | The token to be used to retrieve the next page of results. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "employees": [ - { - "id": "id4", - "first_name": "first_name4", - "last_name": "last_name2", - "email": "email2", - "phone_number": "phone_number8" - } - ], - "cursor": "cursor8", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-event-types-request.md b/doc/models/list-event-types-request.md deleted file mode 100644 index 435dd32a4..000000000 --- a/doc/models/list-event-types-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# List Event Types Request - -Lists all event types that can be subscribed to. - -## Structure - -`ListEventTypesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `apiVersion` | `string \| null \| undefined` | Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. | - -## Example (as JSON) - -```json -{ - "api_version": "api_version0" -} -``` - diff --git a/doc/models/list-event-types-response.md b/doc/models/list-event-types-response.md deleted file mode 100644 index 7ab035e51..000000000 --- a/doc/models/list-event-types-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# List Event Types Response - -Defines the fields that are included in the response body of -a request to the [ListEventTypes](../../doc/api/events.md#list-event-types) endpoint. - -Note: if there are errors processing the request, the event types field will not be -present. - -## Structure - -`ListEventTypesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `eventTypes` | `string[] \| undefined` | Optional | The list of event types. | -| `metadata` | [`EventTypeMetadata[] \| undefined`](../../doc/models/event-type-metadata.md) | Optional | Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). | - -## Example (as JSON) - -```json -{ - "event_types": [ - "inventory.count.updated" - ], - "metadata": [ - { - "api_version_introduced": "2018-07-12", - "event_type": "inventory.count.updated", - "release_status": "PUBLIC" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-gift-card-activities-request.md b/doc/models/list-gift-card-activities-request.md deleted file mode 100644 index f9d24ab7e..000000000 --- a/doc/models/list-gift-card-activities-request.md +++ /dev/null @@ -1,35 +0,0 @@ - -# List Gift Card Activities Request - -Returns a list of gift card activities. You can optionally specify a filter to retrieve a -subset of activites. - -## Structure - -`ListGiftCardActivitiesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `giftCardId` | `string \| null \| undefined` | Optional | If a gift card ID is provided, the endpoint returns activities related
to the specified gift card. Otherwise, the endpoint returns all gift card activities for
the seller.
**Constraints**: *Maximum Length*: `50` | -| `type` | `string \| null \| undefined` | Optional | If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type.
Otherwise, the endpoint returns all types of gift card activities. | -| `locationId` | `string \| null \| undefined` | Optional | If a location ID is provided, the endpoint returns gift card activities for the specified location.
Otherwise, the endpoint returns gift card activities for all locations. | -| `beginTime` | `string \| null \| undefined` | Optional | The timestamp for the beginning of the reporting period, in RFC 3339 format.
This start time is inclusive. The default value is the current time minus one year. | -| `endTime` | `string \| null \| undefined` | Optional | The timestamp for the end of the reporting period, in RFC 3339 format.
This end time is inclusive. The default value is the current time. | -| `limit` | `number \| null \| undefined` | Optional | If a limit is provided, the endpoint returns the specified number
of results (or fewer) per page. The maximum value is 100. The default value is 50.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `sortOrder` | `string \| null \| undefined` | Optional | The order in which the endpoint returns the activities, based on `created_at`.

- `ASC` - Oldest to newest.
- `DESC` - Newest to oldest (default). | - -## Example (as JSON) - -```json -{ - "gift_card_id": "gift_card_id6", - "type": "type8", - "location_id": "location_id2", - "begin_time": "begin_time6", - "end_time": "end_time0" -} -``` - diff --git a/doc/models/list-gift-card-activities-response.md b/doc/models/list-gift-card-activities-response.md deleted file mode 100644 index a93240812..000000000 --- a/doc/models/list-gift-card-activities-response.md +++ /dev/null @@ -1,76 +0,0 @@ - -# List Gift Card Activities Response - -A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors, -the response contains a set of `Error` objects. - -## Structure - -`ListGiftCardActivitiesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCardActivities` | [`GiftCardActivity[] \| undefined`](../../doc/models/gift-card-activity.md) | Optional | The requested gift card activities or an empty object if none are found. | -| `cursor` | `string \| undefined` | Optional | When a response is truncated, it includes a cursor that you can use in a
subsequent request to retrieve the next set of activities. If a cursor is not present, this is
the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | - -## Example (as JSON) - -```json -{ - "gift_card_activities": [ - { - "created_at": "2021-06-02T22:26:38.000Z", - "gift_card_balance_money": { - "amount": 700, - "currency": "USD" - }, - "gift_card_gan": "7783320002929081", - "gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20", - "id": "gcact_897698f894b44b3db46c6147e26a0e19", - "location_id": "81FN9BNFZTKS4", - "payment_id": "dEv2eksNPy6GqdYiLe4ZBNk6HqXZY", - "redeem_activity_details": { - "amount_money": { - "amount": 300, - "currency": "USD" - } - }, - "status": "COMPLETED", - "type": "REDEEM" - }, - { - "activate_activity_details": { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "line_item_uid": "eIWl7X0nMuO9Ewbh0ChIx", - "order_id": "jJNGHm4gLI6XkFbwtiSLqK72KkAZY" - }, - "created_at": "2021-05-20T22:26:54.000Z", - "gift_card_balance_money": { - "amount": 1000, - "currency": "USD" - }, - "gift_card_gan": "7783320002929081", - "gift_card_id": "gftc:6d55a72470d940c6ba09c0ab8ad08d20", - "id": "gcact_b968ebfc7d46437b945be7b9e09123b4", - "location_id": "81FN9BNFZTKS4", - "type": "ACTIVATE" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor2" -} -``` - diff --git a/doc/models/list-gift-cards-request.md b/doc/models/list-gift-cards-request.md deleted file mode 100644 index 9537e409f..000000000 --- a/doc/models/list-gift-cards-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# List Gift Cards Request - -A request to list gift cards. You can optionally specify a filter to retrieve a subset of -gift cards. - -## Structure - -`ListGiftCardsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | `string \| null \| undefined` | Optional | If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type.
Otherwise, the endpoint returns gift cards of all types. | -| `state` | `string \| null \| undefined` | Optional | If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state.
Otherwise, the endpoint returns the gift cards of all states. | -| `limit` | `number \| null \| undefined` | Optional | If a limit is provided, the endpoint returns only the specified number of results per page.
The maximum value is 200. The default value is 30.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
**Constraints**: `>= 1`, `<= 200` | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `customerId` | `string \| null \| undefined` | Optional | If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer.
**Constraints**: *Maximum Length*: `191` | - -## Example (as JSON) - -```json -{ - "type": "type0", - "state": "state6", - "limit": 162, - "cursor": "cursor4", - "customer_id": "customer_id8" -} -``` - diff --git a/doc/models/list-gift-cards-response.md b/doc/models/list-gift-cards-response.md deleted file mode 100644 index 0f935aa7a..000000000 --- a/doc/models/list-gift-cards-response.md +++ /dev/null @@ -1,72 +0,0 @@ - -# List Gift Cards Response - -A response that contains a list of `GiftCard` objects. If the request resulted in errors, -the response contains a set of `Error` objects. - -## Structure - -`ListGiftCardsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCards` | [`GiftCard[] \| undefined`](../../doc/models/gift-card.md) | Optional | The requested gift cards or an empty object if none are found. | -| `cursor` | `string \| undefined` | Optional | When a response is truncated, it includes a cursor that you can use in a
subsequent request to retrieve the next set of gift cards. If a cursor is not present, this is
the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | - -## Example (as JSON) - -```json -{ - "cursor": "JbFmyvUpaNKsfC1hoLSA4WlqkgkZXTWeKuStajR5BkP7OE0ETAbeWSi6U6u7sH", - "gift_cards": [ - { - "balance_money": { - "amount": 3900, - "currency": "USD" - }, - "created_at": "2021-06-09T22:26:54.000Z", - "gan": "7783320008524605", - "gan_source": "SQUARE", - "id": "gftc:00113070ba5745f0b2377c1b9570cb03", - "state": "ACTIVE", - "type": "DIGITAL" - }, - { - "balance_money": { - "amount": 2000, - "currency": "USD" - }, - "created_at": "2021-05-20T22:26:54.000Z", - "gan": "7783320002692465", - "gan_source": "SQUARE", - "id": "gftc:00128a12725b41e58e0de1d20497a9dd", - "state": "ACTIVE", - "type": "DIGITAL" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-invoices-request.md b/doc/models/list-invoices-request.md deleted file mode 100644 index d1578eeb0..000000000 --- a/doc/models/list-invoices-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Invoices Request - -Describes a `ListInvoice` request. - -## Structure - -`ListInvoicesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Required | The ID of the location for which to list invoices.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of invoices to return (200 is the maximum `limit`).
If not provided, the server uses a default limit of 100 invoices. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id2", - "cursor": "cursor8", - "limit": 152 -} -``` - diff --git a/doc/models/list-invoices-response.md b/doc/models/list-invoices-response.md deleted file mode 100644 index 42b1e965c..000000000 --- a/doc/models/list-invoices-response.md +++ /dev/null @@ -1,196 +0,0 @@ - -# List Invoices Response - -Describes a `ListInvoice` response. - -## Structure - -`ListInvoicesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoices` | [`Invoice[] \| undefined`](../../doc/models/invoice.md) | Optional | The invoices retrieved. | -| `cursor` | `string \| undefined` | Optional | When a response is truncated, it includes a cursor that you can use in a
subsequent request to retrieve the next set of invoices. If empty, this is the final
response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "ChoIDhIWVm54ZVRhLXhySFBOejBBM2xJb2daUQoFCI4IGAE", - "invoices": [ - { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": false - }, - "attachments": [ - { - "description": "Service contract", - "filename": "file.jpg", - "filesize": 102705, - "hash": "273ee02cb6f5f8a3a8ca23604930dd53", - "id": "inva:0-3bB9ZuDHiziThQhuC4fwWt", - "mime_type": "image/jpeg", - "uploaded_at": "2030-01-13T21:24:10Z" - } - ], - "created_at": "2030-01-13T17:45:13Z", - "custom_fields": [ - { - "label": "Event Reference Number", - "placement": "ABOVE_LINE_ITEMS", - "value": "Ref. #1234" - }, - { - "label": "Terms of Service", - "placement": "BELOW_LINE_ITEMS", - "value": "The terms of service are..." - } - ], - "delivery_method": "EMAIL", - "description": "We appreciate your business!", - "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "invoice_number": "inv-100", - "location_id": "ES0RJRZYEC39A", - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "payment_requests": [ - { - "automatic_payment_source": "NONE", - "computed_amount_money": { - "amount": 10000, - "currency": "USD" - }, - "due_date": "2030-01-24", - "reminders": [ - { - "message": "Your invoice is due tomorrow", - "relative_scheduled_days": -1, - "status": "PENDING", - "uid": "beebd363-e47f-4075-8785-c235aaa7df11" - } - ], - "request_type": "BALANCE", - "tipping_enabled": true, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "sale_or_service_date": "2030-01-24", - "scheduled_at": "2030-01-13T10:00:00Z", - "status": "DRAFT", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "title": "Event Planning Services", - "updated_at": "2030-01-13T21:24:10Z", - "version": 1 - }, - { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": true - }, - "created_at": "2021-01-23T15:29:12Z", - "delivery_method": "EMAIL", - "id": "inv:0-ChC366qAfskpGrBI_1bozs9mEA3", - "invoice_number": "inv-455", - "location_id": "ES0RJRZYEC39A", - "next_payment_amount_money": { - "amount": 3000, - "currency": "USD" - }, - "order_id": "a65jnS8NXbfprvGJzY9F4fQTuaB", - "payment_requests": [ - { - "automatic_payment_source": "CARD_ON_FILE", - "card_id": "ccof:IkWfpLj4tNHMyFii3GB", - "computed_amount_money": { - "amount": 1000, - "currency": "USD" - }, - "due_date": "2021-01-23", - "percentage_requested": "25", - "request_type": "DEPOSIT", - "tipping_enabled": false, - "total_completed_amount_money": { - "amount": 1000, - "currency": "USD" - }, - "uid": "66c3bdfd-5090-4ff9-a8a0-c1e1a2ffa176" - }, - { - "automatic_payment_source": "CARD_ON_FILE", - "card_id": "ccof:IkWfpLj4tNHMyFii3GB", - "computed_amount_money": { - "amount": 3000, - "currency": "USD" - }, - "due_date": "2021-06-15", - "request_type": "BALANCE", - "tipping_enabled": false, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "120c5e18-4f80-4f6b-b159-774cb9bf8f99" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "public_url": "https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ", - "sale_or_service_date": "2030-01-24", - "status": "PARTIALLY_PAID", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "updated_at": "2021-01-23T15:29:56Z", - "version": 3 - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-jobs-request.md b/doc/models/list-jobs-request.md deleted file mode 100644 index a273a7fb0..000000000 --- a/doc/models/list-jobs-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# List Jobs Request - -Represents a [ListJobs](../../doc/api/team.md#list-jobs) request. - -## Structure - -`ListJobsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | The pagination cursor returned by the previous call to this endpoint. Provide this
cursor to retrieve the next page of results for your original request. For more information,
see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "cursor": "cursor4" -} -``` - diff --git a/doc/models/list-jobs-response.md b/doc/models/list-jobs-response.md deleted file mode 100644 index 528544f02..000000000 --- a/doc/models/list-jobs-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# List Jobs Response - -Represents a [ListJobs](../../doc/api/team.md#list-jobs) response. Either `jobs` or `errors` -is present in the response. If additional results are available, the `cursor` field is also present. - -## Structure - -`ListJobsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `jobs` | [`Job[] \| undefined`](../../doc/models/job.md) | Optional | The retrieved jobs. A single paged response contains up to 100 jobs. | -| `cursor` | `string \| undefined` | Optional | An opaque cursor used to retrieve the next page of results. This field is present only
if the request succeeded and additional results are available. For more information, see
[Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "jobs": [ - { - "created_at": "2021-06-11T22:55:45Z", - "id": "VDNpRv8da51NU8qZFC5zDWpF", - "is_tip_eligible": true, - "title": "Cashier", - "updated_at": "2021-06-11T22:55:45Z", - "version": 2 - }, - { - "created_at": "2021-06-11T22:55:45Z", - "id": "FjS8x95cqHiMenw4f1NAUH4P", - "is_tip_eligible": false, - "title": "Chef", - "updated_at": "2021-06-11T22:55:45Z", - "version": 1 - } - ], - "cursor": "cursor6", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-location-booking-profiles-request.md b/doc/models/list-location-booking-profiles-request.md deleted file mode 100644 index bd95105b8..000000000 --- a/doc/models/list-location-booking-profiles-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# List Location Booking Profiles Request - -## Structure - -`ListLocationBookingProfilesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a paged response.
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results.
**Constraints**: *Maximum Length*: `65536` | - -## Example (as JSON) - -```json -{ - "limit": 134, - "cursor": "cursor2" -} -``` - diff --git a/doc/models/list-location-booking-profiles-response.md b/doc/models/list-location-booking-profiles-response.md deleted file mode 100644 index cba044844..000000000 --- a/doc/models/list-location-booking-profiles-response.md +++ /dev/null @@ -1,36 +0,0 @@ - -# List Location Booking Profiles Response - -## Structure - -`ListLocationBookingProfilesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationBookingProfiles` | [`LocationBookingProfile[] \| undefined`](../../doc/models/location-booking-profile.md) | Optional | The list of a seller's location booking profiles. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [], - "location_booking_profiles": [ - { - "booking_site_url": "https://squareup.com/book/LY6WNBPVM6VGV/testbusiness", - "location_id": "LY6WNBPVM6VGV", - "online_booking_enabled": true - }, - { - "location_id": "PYTRNBPVMJUPV", - "online_booking_enabled": false, - "booking_site_url": "booking_site_url2" - } - ], - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-location-custom-attribute-definitions-request.md b/doc/models/list-location-custom-attribute-definitions-request.md deleted file mode 100644 index cb6e2f9f6..000000000 --- a/doc/models/list-location-custom-attribute-definitions-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Location Custom Attribute Definitions Request - -Represents a [ListLocationCustomAttributeDefinitions](../../doc/api/location-custom-attributes.md#list-location-custom-attribute-definitions) request. - -## Structure - -`ListLocationCustomAttributeDefinitionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Optional | Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "visibility_filter": "ALL", - "limit": 242, - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-location-custom-attribute-definitions-response.md b/doc/models/list-location-custom-attribute-definitions-response.md deleted file mode 100644 index 951d9394c..000000000 --- a/doc/models/list-location-custom-attribute-definitions-response.md +++ /dev/null @@ -1,63 +0,0 @@ - -# List Location Custom Attribute Definitions Response - -Represents a [ListLocationCustomAttributeDefinitions](../../doc/api/location-custom-attributes.md#list-location-custom-attribute-definitions) response. -Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. -If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. - -## Structure - -`ListLocationCustomAttributeDefinitionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinitions` | [`CustomAttributeDefinition[] \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | The retrieved custom attribute definitions. If no custom attribute definitions are found,
Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to provide in your next call to this endpoint to retrieve the next page of
results for your original request. This field is present only if the request succeeded and
additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "ImfNzWVSiAYyiAR4gEcxDJ75KZAOSjX8H2BVHUTR0ofCtp4SdYvrUKbwYY2aCH2WqZ2FsfAuylEVUlTfaINg3ecIlFpP9Y5Ie66w9NSg9nqdI5fCJ6qdH2s0za5m2plFonsjIuFaoN89j78ROUwuSOzD6mFZPcJHhJ0CxEKc0SBH", - "custom_attribute_definitions": [ - { - "created_at": "2022-12-02T19:50:21.832Z", - "description": "Location's phone number", - "key": "phone-number", - "name": "phone number", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-12-02T19:50:21.832Z", - "version": 1, - "visibility": "VISIBILITY_READ_ONLY" - }, - { - "created_at": "2022-12-02T19:06:36.559Z", - "description": "Bestselling item at location", - "key": "bestseller", - "name": "Bestseller", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-12-03T10:17:52.341Z", - "version": 4, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-location-custom-attributes-request.md b/doc/models/list-location-custom-attributes-request.md deleted file mode 100644 index b4800219d..000000000 --- a/doc/models/list-location-custom-attributes-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# List Location Custom Attributes Request - -Represents a [ListLocationCustomAttributes](../../doc/api/location-custom-attributes.md#list-location-custom-attributes) request. - -## Structure - -`ListLocationCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Optional | Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | - -## Example (as JSON) - -```json -{ - "visibility_filter": "ALL", - "limit": 172, - "cursor": "cursor6", - "with_definitions": false -} -``` - diff --git a/doc/models/list-location-custom-attributes-response.md b/doc/models/list-location-custom-attributes-response.md deleted file mode 100644 index 0736780e8..000000000 --- a/doc/models/list-location-custom-attributes-response.md +++ /dev/null @@ -1,81 +0,0 @@ - -# List Location Custom Attributes Response - -Represents a [ListLocationCustomAttributes](../../doc/api/location-custom-attributes.md#list-location-custom-attributes) response. -Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional -results are available, the `cursor` field is also present along with `custom_attributes`. - -## Structure - -`ListLocationCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributes` | [`CustomAttribute[] \| undefined`](../../doc/models/custom-attribute.md) | Optional | The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
the custom attribute definition is returned in the `definition` field of each custom attribute.
If no custom attributes are found, Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to use in your next call to this endpoint to retrieve the next page of results
for your original request. This field is present only if the request succeeded and additional
results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attributes": [ - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - } - ], - "cursor": "cursor0", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-locations-response.md b/doc/models/list-locations-response.md deleted file mode 100644 index b34ef3b7e..000000000 --- a/doc/models/list-locations-response.md +++ /dev/null @@ -1,99 +0,0 @@ - -# List Locations Response - -Defines the fields that are included in the response body of a request -to the [ListLocations](../../doc/api/locations.md#list-locations) endpoint. - -Either `errors` or `locations` is present in a given response (never both). - -## Structure - -`ListLocationsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `locations` | [`Location[] \| undefined`](../../doc/models/location.md) | Optional | The business locations. | - -## Example (as JSON) - -```json -{ - "locations": [ - { - "address": { - "address_line_1": "123 Main St", - "administrative_district_level_1": "CA", - "country": "US", - "locality": "San Francisco", - "postal_code": "94114", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "business_name": "Jet Fuel Coffee", - "capabilities": [ - "CREDIT_CARD_PROCESSING" - ], - "country": "US", - "created_at": "2016-09-19T17:33:12Z", - "currency": "USD", - "id": "18YC4JDH91E1H", - "language_code": "en-US", - "merchant_id": "3MYCJG5GVYQ8Q", - "name": "Grant Park", - "phone_number": "+1 650-354-7217", - "status": "ACTIVE", - "timezone": "America/Los_Angeles" - }, - { - "address": { - "address_line_1": "1234 Peachtree St. NE", - "administrative_district_level_1": "GA", - "locality": "Atlanta", - "postal_code": "30309", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "business_name": "Jet Fuel Coffee", - "capabilities": [ - "CREDIT_CARD_PROCESSING" - ], - "coordinates": { - "latitude": 33.7889, - "longitude": -84.3841 - }, - "country": "US", - "created_at": "2022-02-19T17:58:25Z", - "currency": "USD", - "description": "Midtown Atlanta store", - "id": "3Z4V4WHQK64X9", - "language_code": "en-US", - "mcc": "7299", - "merchant_id": "3MYCJG5GVYQ8Q", - "name": "Midtown", - "status": "ACTIVE", - "timezone": "America/New_York", - "type": "PHYSICAL" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-loyalty-programs-response.md b/doc/models/list-loyalty-programs-response.md deleted file mode 100644 index fd658f2c2..000000000 --- a/doc/models/list-loyalty-programs-response.md +++ /dev/null @@ -1,110 +0,0 @@ - -# List Loyalty Programs Response - -A response that contains all loyalty programs. - -## Structure - -`ListLoyaltyProgramsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `programs` | [`LoyaltyProgram[] \| undefined`](../../doc/models/loyalty-program.md) | Optional | A list of `LoyaltyProgram` for the merchant. | - -## Example (as JSON) - -```json -{ - "programs": [ - { - "accrual_rules": [ - { - "accrual_type": "SPEND", - "points": 1, - "spend_data": { - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "excluded_category_ids": [ - "7ZERJKO5PVYXCVUHV2JCZ2UG", - "FQKAOJE5C4FIMF5A2URMLW6V" - ], - "excluded_item_variation_ids": [ - "CBZXBUVVTYUBZGQO44RHMR6B", - "EDILT24Z2NISEXDKGY6HP7XV" - ], - "tax_mode": "BEFORE_TAX" - } - } - ], - "created_at": "2020-04-20T16:55:11Z", - "id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "location_ids": [ - "P034NEENMD09F" - ], - "reward_tiers": [ - { - "created_at": "2020-04-20T16:55:11Z", - "definition": { - "discount_type": "FIXED_PERCENTAGE", - "percentage_discount": "10", - "scope": "ORDER", - "catalog_object_ids": [ - "catalog_object_ids6" - ], - "fixed_discount_money": { - "amount": 36, - "currency": "SLL" - }, - "max_discount_money": { - "amount": 84, - "currency": "BOB" - } - }, - "id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "name": "10% off entire sale", - "points": 10, - "pricing_rule_reference": { - "catalog_version": 1605486402527, - "object_id": "74C4JSHESNLTB2A7ITO5HO6F" - } - } - ], - "status": "ACTIVE", - "terminology": { - "one": "Point", - "other": "Points" - }, - "updated_at": "2020-05-01T02:00:02Z", - "expiration_policy": { - "expiration_duration": "expiration_duration0" - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-loyalty-promotions-request.md b/doc/models/list-loyalty-promotions-request.md deleted file mode 100644 index bdaa37bfd..000000000 --- a/doc/models/list-loyalty-promotions-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Loyalty Promotions Request - -Represents a [ListLoyaltyPromotions](../../doc/api/loyalty.md#list-loyalty-promotions) request. - -## Structure - -`ListLoyaltyPromotionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `status` | [`string \| undefined`](../../doc/models/loyalty-promotion-status.md) | Optional | Indicates the status of a [loyalty promotion](../../doc/models/loyalty-promotion.md). | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response.
The minimum value is 1 and the maximum value is 30. The default value is 30.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 30` | - -## Example (as JSON) - -```json -{ - "status": "CANCELED", - "cursor": "cursor2", - "limit": 58 -} -``` - diff --git a/doc/models/list-loyalty-promotions-response.md b/doc/models/list-loyalty-promotions-response.md deleted file mode 100644 index 429b197ae..000000000 --- a/doc/models/list-loyalty-promotions-response.md +++ /dev/null @@ -1,124 +0,0 @@ - -# List Loyalty Promotions Response - -Represents a [ListLoyaltyPromotions](../../doc/api/loyalty.md#list-loyalty-promotions) response. -One of `loyalty_promotions`, an empty object, or `errors` is present in the response. -If additional results are available, the `cursor` field is also present along with `loyalty_promotions`. - -## Structure - -`ListLoyaltyPromotionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `loyaltyPromotions` | [`LoyaltyPromotion[] \| undefined`](../../doc/models/loyalty-promotion.md) | Optional | The retrieved loyalty promotions. | -| `cursor` | `string \| undefined` | Optional | The cursor to use in your next call to this endpoint to retrieve the next page of results
for your original request. This field is present only if the request succeeded and additional
results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "loyalty_promotions": [ - { - "available_time": { - "start_date": "2022-08-16", - "time_periods": [ - "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT" - ], - "end_date": "end_date8" - }, - "created_at": "2022-08-16T08:38:54Z", - "id": "loypromo_f0f9b849-725e-378d-b810-511237e07b67", - "incentive": { - "points_multiplier_data": { - "multiplier": "3.000", - "points_multiplier": 3 - }, - "type": "POINTS_MULTIPLIER", - "points_addition_data": { - "points_addition": 218 - } - }, - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "name": "Tuesday Happy Hour Promo", - "qualifying_item_variation_ids": [ - "CJ3RYL56ITAKMD4VRCM7XERS", - "AT3RYLR3TUA9C34VRCB7X5RR" - ], - "status": "ACTIVE", - "trigger_limit": { - "interval": "DAY", - "times": 1 - }, - "updated_at": "2022-08-16T08:38:54Z", - "canceled_at": "canceled_at0" - }, - { - "available_time": { - "end_date": "2022-08-01", - "start_date": "2022-07-01", - "time_periods": [ - "BEGIN:VEVENT\nDTSTART:20220704T090000\nDURATION:PT8H\nRRULE:FREQ=WEEKLY;UNTIL=20220801T000000;BYDAY=MO\nEND:VEVENT", - "BEGIN:VEVENT\nDTSTART:20220705T090000\nDURATION:PT8H\nRRULE:FREQ=WEEKLY;UNTIL=20220801T000000;BYDAY=TU\nEND:VEVENT", - "BEGIN:VEVENT\nDTSTART:20220706T090000\nDURATION:PT8H\nRRULE:FREQ=WEEKLY;UNTIL=20220801T000000;BYDAY=WE\nEND:VEVENT", - "BEGIN:VEVENT\nDTSTART:20220707T090000\nDURATION:PT8H\nRRULE:FREQ=WEEKLY;UNTIL=20220801T000000;BYDAY=TH\nEND:VEVENT", - "BEGIN:VEVENT\nDTSTART:20220701T090000\nDURATION:PT8H\nRRULE:FREQ=WEEKLY;UNTIL=20220801T000000;BYDAY=FR\nEND:VEVENT" - ] - }, - "created_at": "2022-06-27T15:37:38Z", - "id": "loypromo_e696f057-2286-35ff-8108-132241328106", - "incentive": { - "points_multiplier_data": { - "multiplier": "2.000", - "points_multiplier": 2 - }, - "type": "POINTS_MULTIPLIER", - "points_addition_data": { - "points_addition": 218 - } - }, - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "minimum_spend_amount_money": { - "amount": 2000, - "currency": "USD" - }, - "name": "July Special", - "qualifying_category_ids": [ - "XTQPYLR3IIU9C44VRCB3XD12" - ], - "status": "ENDED", - "trigger_limit": { - "interval": "ALL_TIME", - "times": 5 - }, - "updated_at": "2022-06-27T15:37:38Z", - "canceled_at": "canceled_at0" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-merchant-custom-attribute-definitions-request.md b/doc/models/list-merchant-custom-attribute-definitions-request.md deleted file mode 100644 index 5e694fcd6..000000000 --- a/doc/models/list-merchant-custom-attribute-definitions-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Merchant Custom Attribute Definitions Request - -Represents a [ListMerchantCustomAttributeDefinitions](../../doc/api/merchant-custom-attributes.md#list-merchant-custom-attribute-definitions) request. - -## Structure - -`ListMerchantCustomAttributeDefinitionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Optional | Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "visibility_filter": "ALL", - "limit": 48, - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-merchant-custom-attribute-definitions-response.md b/doc/models/list-merchant-custom-attribute-definitions-response.md deleted file mode 100644 index 5e1687800..000000000 --- a/doc/models/list-merchant-custom-attribute-definitions-response.md +++ /dev/null @@ -1,69 +0,0 @@ - -# List Merchant Custom Attribute Definitions Response - -Represents a [ListMerchantCustomAttributeDefinitions](../../doc/api/merchant-custom-attributes.md#list-merchant-custom-attribute-definitions) response. -Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. -If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. - -## Structure - -`ListMerchantCustomAttributeDefinitionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinitions` | [`CustomAttributeDefinition[] \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | The retrieved custom attribute definitions. If no custom attribute definitions are found,
Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to provide in your next call to this endpoint to retrieve the next page of
results for your original request. This field is present only if the request succeeded and
additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "ImfNzWVSiAYyiAR4gEcxDJ75KZAOSjX8H2BVHUTR0ofCtp4SdYvrUKbwYY2aCH2WqZ2FsfAuylEVUlTfaINg3ecIlFpP9Y5Ie66w9NSg9nqdI5fCJ6qdH2s0za5m2plFonsjIuFaoN89j78ROUwuSOzD6mFZPcJHhJ0CxEKc0SBH", - "custom_attribute_definitions": [ - { - "created_at": "2023-05-05T16:50:21.832Z", - "description": "Whether the merchant has seen the tutorial screen for using the app.", - "key": "has_seen_tutorial", - "name": "NAME", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2023-05-05T16:50:21.832Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - { - "created_at": "2023-05-05T19:06:36.559Z", - "description": "This is the other name this merchant goes by.", - "key": "alternative_seller_name", - "name": "Alternative Merchant Name", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2023-05-05T10:17:52.341Z", - "version": 4, - "visibility": "VISIBILITY_READ_ONLY" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-merchant-custom-attributes-request.md b/doc/models/list-merchant-custom-attributes-request.md deleted file mode 100644 index f7f0580a4..000000000 --- a/doc/models/list-merchant-custom-attributes-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# List Merchant Custom Attributes Request - -Represents a [ListMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#list-merchant-custom-attributes) request. - -## Structure - -`ListMerchantCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Optional | Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request. For more
information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `withDefinitions` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom
attribute, information about the data type, or other definition details. The default value is `false`. | - -## Example (as JSON) - -```json -{ - "visibility_filter": "READ_WRITE", - "limit": 132, - "cursor": "cursor6", - "with_definitions": false -} -``` - diff --git a/doc/models/list-merchant-custom-attributes-response.md b/doc/models/list-merchant-custom-attributes-response.md deleted file mode 100644 index b4c31bfc7..000000000 --- a/doc/models/list-merchant-custom-attributes-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# List Merchant Custom Attributes Response - -Represents a [ListMerchantCustomAttributes](../../doc/api/merchant-custom-attributes.md#list-merchant-custom-attributes) response. -Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional -results are available, the `cursor` field is also present along with `custom_attributes`. - -## Structure - -`ListMerchantCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributes` | [`CustomAttribute[] \| undefined`](../../doc/models/custom-attribute.md) | Optional | The retrieved custom attributes. If `with_definitions` was set to `true` in the request,
the custom attribute definition is returned in the `definition` field of each custom attribute.
If no custom attributes are found, Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to use in your next call to this endpoint to retrieve the next page of results
for your original request. This field is present only if the request succeeded and additional
results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attributes": [ - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - } - ], - "cursor": "cursor6", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-merchants-request.md b/doc/models/list-merchants-request.md deleted file mode 100644 index ef2ea6df7..000000000 --- a/doc/models/list-merchants-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# List Merchants Request - -Request object for the [ListMerchant](../../doc/api/merchants.md#list-merchants) endpoint. - -## Structure - -`ListMerchantsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `number \| null \| undefined` | Optional | The cursor generated by the previous response. | - -## Example (as JSON) - -```json -{ - "cursor": 106 -} -``` - diff --git a/doc/models/list-merchants-response.md b/doc/models/list-merchants-response.md deleted file mode 100644 index 9c4331948..000000000 --- a/doc/models/list-merchants-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# List Merchants Response - -The response object returned by the [ListMerchant](../../doc/api/merchants.md#list-merchants) endpoint. - -## Structure - -`ListMerchantsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `merchant` | [`Merchant[] \| undefined`](../../doc/models/merchant.md) | Optional | The requested `Merchant` entities. | -| `cursor` | `number \| undefined` | Optional | If the response is truncated, the cursor to use in next request to fetch next set of objects. | - -## Example (as JSON) - -```json -{ - "merchant": [ - { - "business_name": "Apple A Day", - "country": "US", - "created_at": "2021-12-10T19:25:52.484Z", - "currency": "USD", - "id": "DM7VKY8Q63GNP", - "language_code": "en-US", - "main_location_id": "9A65CGC72ZQG1", - "status": "ACTIVE" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": 124 -} -``` - diff --git a/doc/models/list-order-custom-attribute-definitions-request.md b/doc/models/list-order-custom-attribute-definitions-request.md deleted file mode 100644 index c4bdfa1b9..000000000 --- a/doc/models/list-order-custom-attribute-definitions-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Order Custom Attribute Definitions Request - -Represents a list request for order custom attribute definitions. - -## Structure - -`ListOrderCustomAttributeDefinitionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Optional | Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
**Constraints**: *Minimum Length*: `1` | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
**Constraints**: `>= 1`, `<= 100` | - -## Example (as JSON) - -```json -{ - "visibility_filter": "READ_WRITE", - "cursor": "cursor2", - "limit": 6 -} -``` - diff --git a/doc/models/list-order-custom-attribute-definitions-response.md b/doc/models/list-order-custom-attribute-definitions-response.md deleted file mode 100644 index 8656cd386..000000000 --- a/doc/models/list-order-custom-attribute-definitions-response.md +++ /dev/null @@ -1,80 +0,0 @@ - -# List Order Custom Attribute Definitions Response - -Represents a response from listing order custom attribute definitions. - -## Structure - -`ListOrderCustomAttributeDefinitionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinitions` | [`CustomAttributeDefinition[]`](../../doc/models/custom-attribute-definition.md) | Required | The retrieved custom attribute definitions. If no custom attribute definitions are found, Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request.
This field is present only if the request succeeded and additional results are available.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
**Constraints**: *Minimum Length*: `1` | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definitions": [ - { - "created_at": "2022-11-16T18:03:44.051Z", - "description": "The number of people seated at a table", - "key": "cover-count", - "name": "Cover count", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T18:03:44.051Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - { - "created_at": "2022-11-16T18:04:32.059Z", - "description": "The identifier for a particular seat", - "key": "seat-number", - "name": "Seat number", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T18:04:32.059Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - { - "created_at": "2022-11-16T18:04:21.912Z", - "description": "The identifier for a particular table", - "key": "table-number", - "name": "Table number", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T18:04:21.912Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - } - ], - "cursor": "cursor4", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-order-custom-attributes-request.md b/doc/models/list-order-custom-attributes-request.md deleted file mode 100644 index 307d8ac4e..000000000 --- a/doc/models/list-order-custom-attributes-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# List Order Custom Attributes Request - -Represents a list request for order custom attributes. - -## Structure - -`ListOrderCustomAttributesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `visibilityFilter` | [`string \| undefined`](../../doc/models/visibility-filter.md) | Optional | Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. | -| `cursor` | `string \| null \| undefined` | Optional | The cursor returned in the paged response from the previous call to this endpoint.
Provide this cursor to retrieve the next page of results for your original request.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
**Constraints**: *Minimum Length*: `1` | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a single paged response. This limit is advisory.
The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.
The default value is 20.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `withDefinitions` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
information about the data type, or other definition details. The default value is `false`. | - -## Example (as JSON) - -```json -{ - "visibility_filter": "READ", - "cursor": "cursor2", - "limit": 158, - "with_definitions": false -} -``` - diff --git a/doc/models/list-order-custom-attributes-response.md b/doc/models/list-order-custom-attributes-response.md deleted file mode 100644 index c2dc2f018..000000000 --- a/doc/models/list-order-custom-attributes-response.md +++ /dev/null @@ -1,79 +0,0 @@ - -# List Order Custom Attributes Response - -Represents a response from listing order custom attributes. - -## Structure - -`ListOrderCustomAttributesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributes` | [`CustomAttribute[] \| undefined`](../../doc/models/custom-attribute.md) | Optional | The retrieved custom attributes. If no custom attribute are found, Square returns an empty object (`{}`). | -| `cursor` | `string \| undefined` | Optional | The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request.
This field is present only if the request succeeded and additional results are available.
For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination).
**Constraints**: *Minimum Length*: `1` | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attributes": [ - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - { - "key": "key8", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 180, - "visibility": "VISIBILITY_HIDDEN", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - } - ], - "cursor": "cursor4", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-payment-links-request.md b/doc/models/list-payment-links-request.md deleted file mode 100644 index 79e5ffbf0..000000000 --- a/doc/models/list-payment-links-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# List Payment Links Request - -## Structure - -`ListPaymentLinksRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
If a cursor is not provided, the endpoint returns the first page of the results.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `number \| null \| undefined` | Optional | A limit on the number of results to return per page. The limit is advisory and
the implementation might return more or less results. If the supplied limit is negative, zero, or
greater than the maximum limit of 1000, it is ignored.

Default value: `100` | - -## Example (as JSON) - -```json -{ - "cursor": "cursor6", - "limit": 182 -} -``` - diff --git a/doc/models/list-payment-links-response.md b/doc/models/list-payment-links-response.md deleted file mode 100644 index d83506920..000000000 --- a/doc/models/list-payment-links-response.md +++ /dev/null @@ -1,102 +0,0 @@ - -# List Payment Links Response - -## Structure - -`ListPaymentLinksResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | -| `paymentLinks` | [`PaymentLink[] \| undefined`](../../doc/models/payment-link.md) | Optional | The list of payment links. | -| `cursor` | `string \| undefined` | Optional | When a response is truncated, it includes a cursor that you can use in a subsequent request
to retrieve the next set of gift cards. If a cursor is not present, this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "cursor": "MTY1NQ==", - "payment_links": [ - { - "checkout_options": { - "ask_for_shipping_address": true, - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id8", - "redirect_url": "redirect_url2", - "merchant_support_email": "merchant_support_email8" - }, - "created_at": "2022-04-26T00:15:15Z", - "id": "TN4BWEDJ9AI5MBIV", - "order_id": "Qqc6yppGvxVwc46Cch4zHTaJqc4F", - "payment_note": "test", - "updated_at": "2022-04-26T00:18:24Z", - "url": "https://square.link/u/EXAMPLE", - "version": 2, - "description": "description2", - "pre_populated_data": { - "buyer_email": "buyer_email8", - "buyer_phone_number": "buyer_phone_number0", - "buyer_address": { - "address_line_1": "address_line_12", - "address_line_2": "address_line_22", - "address_line_3": "address_line_38", - "locality": "locality2", - "sublocality": "sublocality2" - } - } - }, - { - "created_at": "2022-04-11T23:14:59Z", - "description": "", - "id": "RY5UNCUMPJN5XKCT", - "order_id": "EmBmGt3zJD15QeO1dxzBTxMxtwfZY", - "url": "https://square.link/u/EXAMPLE", - "version": 1, - "checkout_options": { - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id8", - "redirect_url": "redirect_url2", - "merchant_support_email": "merchant_support_email8" - }, - "pre_populated_data": { - "buyer_email": "buyer_email8", - "buyer_phone_number": "buyer_phone_number0", - "buyer_address": { - "address_line_1": "address_line_12", - "address_line_2": "address_line_22", - "address_line_3": "address_line_38", - "locality": "locality2", - "sublocality": "sublocality2" - } - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-payment-refunds-request.md b/doc/models/list-payment-refunds-request.md deleted file mode 100644 index 975ffce11..000000000 --- a/doc/models/list-payment-refunds-request.md +++ /dev/null @@ -1,37 +0,0 @@ - -# List Payment Refunds Request - -Describes a request to list refunds using -[ListPaymentRefunds](../../doc/api/refunds.md#list-payment-refunds). - -The maximum results per page is 100. - -## Structure - -`ListPaymentRefundsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `beginTime` | `string \| null \| undefined` | Optional | Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
format. The range is determined using the `created_at` field for each `PaymentRefund`.

Default: The current time minus one year. | -| `endTime` | `string \| null \| undefined` | Optional | Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
format. The range is determined using the `created_at` field for each `PaymentRefund`.

Default: The current time. | -| `sortOrder` | `string \| null \| undefined` | Optional | The order in which results are listed by `PaymentRefund.created_at`:

- `ASC` - Oldest to newest.
- `DESC` - Newest to oldest (default). | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `locationId` | `string \| null \| undefined` | Optional | Limit results to the location supplied. By default, results are returned
for all locations associated with the seller. | -| `status` | `string \| null \| undefined` | Optional | If provided, only refunds with the given status are returned.
For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).

Default: If omitted, refunds are returned regardless of their status. | -| `sourceType` | `string \| null \| undefined` | Optional | If provided, only returns refunds whose payments have the indicated source type.
Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
For information about these payment source types, see
[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).

Default: If omitted, refunds are returned regardless of the source type. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to be returned in a single page.

It is possible to receive fewer results than the specified limit on a given page.

If the supplied value is greater than 100, no more than 100 results are returned.

Default: 100 | - -## Example (as JSON) - -```json -{ - "begin_time": "begin_time8", - "end_time": "end_time2", - "sort_order": "sort_order0", - "cursor": "cursor4", - "location_id": "location_id4" -} -``` - diff --git a/doc/models/list-payment-refunds-response.md b/doc/models/list-payment-refunds-response.md deleted file mode 100644 index bb1ba1eab..000000000 --- a/doc/models/list-payment-refunds-response.md +++ /dev/null @@ -1,97 +0,0 @@ - -# List Payment Refunds Response - -Defines the response returned by [ListPaymentRefunds](../../doc/api/refunds.md#list-payment-refunds). - -Either `errors` or `refunds` is present in a given response (never both). - -## Structure - -`ListPaymentRefundsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `refunds` | [`PaymentRefund[] \| undefined`](../../doc/models/payment-refund.md) | Optional | The list of requested refunds. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty,
this is the final response.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "cursor": "5evquW1YswHoT4EoyUhzMmTsCnsSXBU9U0WJ4FU4623nrMQcocH0RGU6Up1YkwfiMcF59ood58EBTEGgzMTGHQJpocic7ExOL0NtrTXCeWcv0UJIJNk8eXb", - "refunds": [ - { - "amount_money": { - "amount": 555, - "currency": "USD" - }, - "created_at": "2021-10-13T19:59:05.342Z", - "id": "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY_69MmgHubkLqx9wGhnmenRUHOaKitE6llfZuxcWYjGxd", - "location_id": "L88917AVBK2S5", - "order_id": "9ltv0bx5PuvGXUYHYHxYSKEqC3IZY", - "payment_id": "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", - "processing_fee": [ - { - "amount_money": { - "amount": -34, - "currency": "USD" - }, - "effective_at": "2021-10-13T21:34:35.000Z", - "type": "INITIAL" - } - ], - "reason": "Example Refund", - "status": "COMPLETED", - "updated_at": "2021-10-13T20:00:03.497Z", - "unlinked": false, - "destination_type": "destination_type2", - "destination_details": { - "card_details": { - "card": { - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "entry_method": "entry_method8", - "auth_result_code": "auth_result_code0" - }, - "cash_details": { - "seller_supplied_money": { - "amount": 36, - "currency": "MKD" - }, - "change_back_money": { - "amount": 78, - "currency": "XBD" - } - }, - "external_details": { - "type": "type6", - "source": "source0", - "source_id": "source_id8" - } - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-payments-request.md b/doc/models/list-payments-request.md deleted file mode 100644 index 720a3d399..000000000 --- a/doc/models/list-payments-request.md +++ /dev/null @@ -1,44 +0,0 @@ - -# List Payments Request - -Describes a request to list payments using -[ListPayments](../../doc/api/payments.md#list-payments). - -The maximum results per page is 100. - -## Structure - -`ListPaymentsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `beginTime` | `string \| null \| undefined` | Optional | Indicates the start of the time range to retrieve payments for, in RFC 3339 format.
The range is determined using the `created_at` field for each Payment.
Inclusive. Default: The current time minus one year. | -| `endTime` | `string \| null \| undefined` | Optional | Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
range is determined using the `created_at` field for each Payment.

Default: The current time. | -| `sortOrder` | `string \| null \| undefined` | Optional | The order in which results are listed by `ListPaymentsRequest.sort_field`:

- `ASC` - Oldest to newest.
- `DESC` - Newest to oldest (default). | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `locationId` | `string \| null \| undefined` | Optional | Limit results to the location supplied. By default, results are returned
for the default (main) location associated with the seller. | -| `total` | `bigint \| null \| undefined` | Optional | The exact amount in the `total_money` for a payment. | -| `last4` | `string \| null \| undefined` | Optional | The last four digits of a payment card. | -| `cardBrand` | `string \| null \| undefined` | Optional | The brand of the payment card (for example, VISA). | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.

The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.

Default: `100` | -| `isOfflinePayment` | `boolean \| null \| undefined` | Optional | Whether the payment was taken offline or not. | -| `offlineBeginTime` | `string \| null \| undefined` | Optional | Indicates the start of the time range for which to retrieve offline payments, in RFC 3339
format for timestamps. The range is determined using the
`offline_payment_details.client_created_at` field for each Payment. If set, payments without a
value set in `offline_payment_details.client_created_at` will not be returned.

Default: The current time. | -| `offlineEndTime` | `string \| null \| undefined` | Optional | Indicates the end of the time range for which to retrieve offline payments, in RFC 3339
format for timestamps. The range is determined using the
`offline_payment_details.client_created_at` field for each Payment. If set, payments without a
value set in `offline_payment_details.client_created_at` will not be returned.

Default: The current time. | -| `updatedAtBeginTime` | `string \| null \| undefined` | Optional | Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The
range is determined using the `updated_at` field for each Payment. | -| `updatedAtEndTime` | `string \| null \| undefined` | Optional | Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
range is determined using the `updated_at` field for each Payment. | -| `sortField` | [`string \| undefined`](../../doc/models/payment-sort-field.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "begin_time": "begin_time0", - "end_time": "end_time4", - "sort_order": "sort_order2", - "cursor": "cursor4", - "location_id": "location_id6" -} -``` - diff --git a/doc/models/list-payments-response.md b/doc/models/list-payments-response.md deleted file mode 100644 index f2097cb55..000000000 --- a/doc/models/list-payments-response.md +++ /dev/null @@ -1,105 +0,0 @@ - -# List Payments Response - -Defines the response returned by [ListPayments](../../doc/api/payments.md#list-payments). - -## Structure - -`ListPaymentsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `payments` | [`Payment[] \| undefined`](../../doc/models/payment.md) | Optional | The requested list of payments. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty,
this is the final response.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "payments": [ - { - "amount_money": { - "amount": 555, - "currency": "USD" - }, - "application_details": { - "application_id": "sq0ids-Pw67AZAlLVB7hsRmwlJPuA", - "square_product": "VIRTUAL_TERMINAL" - }, - "approved_money": { - "amount": 555, - "currency": "USD" - }, - "card_details": { - "auth_result_code": "2Nkw7q", - "avs_status": "AVS_ACCEPTED", - "card": { - "bin": "411111", - "card_brand": "VISA", - "card_type": "DEBIT", - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", - "last_4": "1111", - "prepaid_type": "NOT_PREPAID" - }, - "card_payment_timeline": { - "authorized_at": "2021-10-13T19:34:33.680Z", - "captured_at": "2021-10-13T19:34:34.340Z" - }, - "cvv_status": "CVV_ACCEPTED", - "entry_method": "KEYED", - "statement_description": "SQ *EXAMPLE TEST GOSQ.C", - "status": "CAPTURED" - }, - "created_at": "2021-10-13T19:34:33.524Z", - "delay_action": "CANCEL", - "delay_duration": "PT168H", - "delayed_until": "2021-10-20T19:34:33.524Z", - "employee_id": "TMoK_ogh6rH1o4dV", - "id": "bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", - "location_id": "L88917AVBK2S5", - "note": "Test Note", - "order_id": "d7eKah653Z579f3gVtjlxpSlmUcZY", - "processing_fee": [ - { - "amount_money": { - "amount": 34, - "currency": "USD" - }, - "effective_at": "2021-10-13T21:34:35.000Z", - "type": "INITIAL" - } - ], - "receipt_number": "bP9m", - "receipt_url": "https://squareup.com/receipt/preview/bP9mAsEMYPUGjjGNaNO5ZDVyLhSZY", - "source_type": "CARD", - "status": "COMPLETED", - "team_member_id": "TMoK_ogh6rH1o4dV", - "total_money": { - "amount": 555, - "currency": "USD" - }, - "updated_at": "2021-10-13T19:34:37.261Z", - "version_token": "vguW2km0KpVCdAXZcNTZ438qg5LlVPTP4HO5OpiHNfa6o", - "tip_money": { - "amount": 190, - "currency": "TWD" - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor0" -} -``` - diff --git a/doc/models/list-payout-entries-request.md b/doc/models/list-payout-entries-request.md deleted file mode 100644 index 87441789d..000000000 --- a/doc/models/list-payout-entries-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# List Payout Entries Request - -## Structure - -`ListPayoutEntriesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
If request parameters change between requests, subsequent results may contain duplicates or missing records. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.
Default: `100` | - -## Example (as JSON) - -```json -{ - "sort_order": "DESC", - "cursor": "cursor2", - "limit": 194 -} -``` - diff --git a/doc/models/list-payout-entries-response.md b/doc/models/list-payout-entries-response.md deleted file mode 100644 index f09ce2932..000000000 --- a/doc/models/list-payout-entries-response.md +++ /dev/null @@ -1,84 +0,0 @@ - -# List Payout Entries Response - -The response to retrieve payout records entries. - -## Structure - -`ListPayoutEntriesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `payoutEntries` | [`PayoutEntry[] \| undefined`](../../doc/models/payout-entry.md) | Optional | The requested list of payout entries, ordered with the given or default sort order. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty, this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "TbfI80z98Xc2LdApCyZ2NvCYLpkPurYLR16GRIttpMJ55mrSIMzHgtkcRQdT0mOnTtfHO", - "payout_entries": [ - { - "effective_at": "2021-12-14T23:31:49Z", - "fee_amount_money": { - "amount": -2, - "currency_code": "USD", - "currency": "CHF" - }, - "gross_amount_money": { - "amount": -50, - "currency_code": "USD", - "currency": "MNT" - }, - "id": "poe_ZQWcw41d0SGJS6IWd4cSi8mKHk", - "net_amount_money": { - "amount": -48, - "currency_code": "USD", - "currency": "XPT" - }, - "payout_id": "po_4d28e6c4-7dd5-4de4-8ec9-a059277646a6", - "type": "REFUND", - "type_refund_details": { - "payment_id": "HVdG62HeMlti8YYf94oxrN", - "refund_id": "HVdG62HeMlti8YYf94oxrN_dR8Nztxg7umf94oxrN12Ji5r2KW14FAY" - } - }, - { - "effective_at": "2021-12-14T23:31:49Z", - "fee_amount_money": { - "amount": 19, - "currency_code": "USD", - "currency": "CHF" - }, - "gross_amount_money": { - "amount": 100, - "currency_code": "USD", - "currency": "MNT" - }, - "id": "poe_EibbY9Ob1d0SGJS6IWd4cSiSi6wkaPk", - "net_amount_money": { - "amount": 81, - "currency_code": "USD", - "currency": "XPT" - }, - "payout_id": "po_4d28e6c4-7dd5-4de4-8ec9-a059277646a6", - "type": "CHARGE", - "type_charge_details": { - "payment_id": "HVdG62H5K3291d0SGJS6IWd4cSi8YY" - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-payouts-request.md b/doc/models/list-payouts-request.md deleted file mode 100644 index 24a4e1c20..000000000 --- a/doc/models/list-payouts-request.md +++ /dev/null @@ -1,33 +0,0 @@ - -# List Payouts Request - -A request to retrieve payout records. - -## Structure - -`ListPayoutsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the location for which to list the payouts.
By default, payouts are returned for the default (main) location associated with the seller.
**Constraints**: *Maximum Length*: `255` | -| `status` | [`string \| undefined`](../../doc/models/payout-status.md) | Optional | Payout status types | -| `beginTime` | `string \| null \| undefined` | Optional | The timestamp for the beginning of the payout creation time, in RFC 3339 format.
Inclusive. Default: The current time minus one year. | -| `endTime` | `string \| null \| undefined` | Optional | The timestamp for the end of the payout creation time, in RFC 3339 format.
Default: The current time. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
If request parameters change between requests, subsequent results may contain duplicates or missing records. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value. If the provided value is
greater than 100, it is ignored and the default value is used instead.
Default: `100` | - -## Example (as JSON) - -```json -{ - "location_id": "location_id4", - "status": "SENT", - "begin_time": "begin_time2", - "end_time": "end_time2", - "sort_order": "DESC" -} -``` - diff --git a/doc/models/list-payouts-response.md b/doc/models/list-payouts-response.md deleted file mode 100644 index a6ef97a35..000000000 --- a/doc/models/list-payouts-response.md +++ /dev/null @@ -1,97 +0,0 @@ - -# List Payouts Response - -The response to retrieve payout records entries. - -## Structure - -`ListPayoutsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `payouts` | [`Payout[] \| undefined`](../../doc/models/payout.md) | Optional | The requested list of payouts. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty, this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "EMPCyStibo64hS8wLayZPp3oedR3AeEUNd3z7u6zphi72LQZFIEMbkKVvot9eefpU", - "payouts": [ - { - "amount_money": { - "amount": 6259, - "currency_code": "USD", - "currency": "AUD" - }, - "arrival_date": "2022-03-29", - "created_at": "2022-03-29T16:12:31Z", - "destination": { - "id": "ccof:ZPp3oedR3AeEUNd3z7", - "type": "CARD" - }, - "end_to_end_id": "L2100000005", - "id": "po_b345d2c7-90b3-4f0b-a2aa-df1def7f8afc", - "location_id": "L88917AVBK2S5", - "payout_fee": [ - { - "amount_money": { - "amount": 95, - "currency_code": "USD" - }, - "effective_at": "2022-03-29T16:12:31Z", - "type": "TRANSFER_FEE" - } - ], - "status": "PAID", - "type": "BATCH", - "updated_at": "2022-03-30T01:07:22.875Z", - "version": 2 - }, - { - "amount_money": { - "amount": -103, - "currency_code": "USD", - "currency": "AUD" - }, - "arrival_date": "2022-03-24", - "created_at": "2022-03-24T03:07:09Z", - "destination": { - "id": "bact:ZPp3oedR3AeEUNd3z7", - "type": "BANK_ACCOUNT" - }, - "end_to_end_id": "L2100000006", - "id": "po_f3c0fb38-a5ce-427d-b858-52b925b72e45", - "location_id": "L88917AVBK2S5", - "status": "PAID", - "type": "BATCH", - "updated_at": "2022-03-24T03:07:09Z", - "version": 1 - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-refunds-request.md b/doc/models/list-refunds-request.md deleted file mode 100644 index 06d726db9..000000000 --- a/doc/models/list-refunds-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# List Refunds Request - -Defines the query parameters that can be included in -a request to the [ListRefunds](api-endpoint:Transactions-ListRefunds) endpoint. - -Deprecated - recommend using [SearchOrders](api-endpoint:Orders-SearchOrders) - -## Structure - -`ListRefundsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `beginTime` | `string \| null \| undefined` | Optional | The beginning of the requested reporting period, in RFC 3339 format.

See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.

Default value: The current time minus one year. | -| `endTime` | `string \| null \| undefined` | Optional | The end of the requested reporting period, in RFC 3339 format.

See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.

Default value: The current time. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "begin_time": "begin_time6", - "end_time": "end_time0", - "sort_order": "DESC", - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-refunds-response.md b/doc/models/list-refunds-response.md deleted file mode 100644 index 2dfdf5ded..000000000 --- a/doc/models/list-refunds-response.md +++ /dev/null @@ -1,66 +0,0 @@ - -# List Refunds Response - -Defines the fields that are included in the response body of -a request to the [ListRefunds](api-endpoint:Transactions-ListRefunds) endpoint. - -One of `errors` or `refunds` is present in a given response (never both). - -## Structure - -`ListRefundsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `refunds` | [`Refund[] \| undefined`](../../doc/models/refund.md) | Optional | An array of refunds that match your query. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor for retrieving the next set of results,
if any remain. Provide this value as the `cursor` parameter in a subsequent
request to this endpoint.

See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "refunds": [ - { - "additional_recipients": [ - { - "amount_money": { - "amount": 10, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1", - "receivable_id": "receivable_id6" - } - ], - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "created_at": "2016-01-20T00:28:18Z", - "id": "b27436d1-7f8e-5610-45c6-417ef71434b4-SW", - "location_id": "18YC4JDH91E1H", - "reason": "some reason", - "status": "APPROVED", - "tender_id": "MtZRYYdDrYNQbOvV7nbuBvMF", - "transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-sites-response.md b/doc/models/list-sites-response.md deleted file mode 100644 index 07cd72ce4..000000000 --- a/doc/models/list-sites-response.md +++ /dev/null @@ -1,49 +0,0 @@ - -# List Sites Response - -Represents a `ListSites` response. The response can include either `sites` or `errors`. - -## Structure - -`ListSitesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `sites` | [`Site[] \| undefined`](../../doc/models/site.md) | Optional | The sites that belong to the seller. | - -## Example (as JSON) - -```json -{ - "sites": [ - { - "created_at": "2020-10-28T13:22:51.000000Z", - "domain": "mysite2.square.site", - "id": "site_278075276488921835", - "is_published": false, - "site_title": "My Second Site", - "updated_at": "2020-10-28T13:22:51.000000Z" - }, - { - "created_at": "2020-06-18T17:45:13.000000Z", - "domain": "mysite1.square.site", - "id": "site_102725345836253849", - "is_published": true, - "site_title": "My First Site", - "updated_at": "2020-11-23T02:19:10.000000Z" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-subscription-events-request.md b/doc/models/list-subscription-events-request.md deleted file mode 100644 index 34e7f4d8e..000000000 --- a/doc/models/list-subscription-events-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Subscription Events Request - -Defines input parameters in a request to the -[ListSubscriptionEvents](../../doc/api/subscriptions.md#list-subscription-events) -endpoint. - -## Structure - -`ListSubscriptionEventsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| 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 \| null \| undefined` | Optional | The upper limit on the number of subscription events to return
in a paged response.
**Constraints**: `>= 1` | - -## Example (as JSON) - -```json -{ - "cursor": "cursor8", - "limit": 182 -} -``` - diff --git a/doc/models/list-subscription-events-response.md b/doc/models/list-subscription-events-response.md deleted file mode 100644 index 4b0d5a1a3..000000000 --- a/doc/models/list-subscription-events-response.md +++ /dev/null @@ -1,169 +0,0 @@ - -# List Subscription Events Response - -Defines output parameters in a response from the -[ListSubscriptionEvents](../../doc/api/subscriptions.md#list-subscription-events). - -## Structure - -`ListSubscriptionEventsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `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/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "subscription_events": [ - { - "effective_date": "2020-04-24", - "id": "06809161-3867-4598-8269-8aea5be4f9de", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "START_SUBSCRIPTION", - "monthly_billing_anchor_date": 16, - "info": { - "detail": "detail6", - "code": "CUSTOMER_DELETED" - }, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - }, - { - "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_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "DEACTIVATE_SUBSCRIPTION", - "monthly_billing_anchor_date": 16, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - }, - { - "effective_date": "2022-05-01", - "id": "b426fc85-6859-450b-b0d0-fe3a5d1b565f", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "RESUME_SUBSCRIPTION", - "monthly_billing_anchor_date": 16, - "info": { - "detail": "detail6", - "code": "CUSTOMER_DELETED" - }, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - }, - { - "effective_date": "2022-09-01", - "id": "09f14de1-2f53-4dae-9091-49aa53f83d01", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "PAUSE_SUBSCRIPTION", - "monthly_billing_anchor_date": 16, - "info": { - "detail": "detail6", - "code": "CUSTOMER_DELETED" - }, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - }, - { - "effective_date": "2022-12-01", - "id": "f28a73ac-1a1b-4b0f-8eeb-709a72945776", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "RESUME_SUBSCRIPTION", - "monthly_billing_anchor_date": 16, - "info": { - "detail": "detail6", - "code": "CUSTOMER_DELETED" - }, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - }, - { - "effective_date": "2023-04-01", - "id": "1eee8790-472d-4efe-8c69-8ad84e9cefe0", - "plan_variation_id": "02CD53CFA4d1498AFAD42", - "subscription_event_type": "PLAN_CHANGE", - "monthly_billing_anchor_date": 16, - "info": { - "detail": "detail6", - "code": "CUSTOMER_DELETED" - }, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - }, - { - "effective_date": "2023-06-21", - "id": "a0c08083-5db0-4800-85c7-d398de4fbb6e", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "STOP_SUBSCRIPTION", - "monthly_billing_anchor_date": 16, - "info": { - "detail": "detail6", - "code": "CUSTOMER_DELETED" - }, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor4" -} -``` - diff --git a/doc/models/list-team-member-booking-profiles-request.md b/doc/models/list-team-member-booking-profiles-request.md deleted file mode 100644 index 92dc20090..000000000 --- a/doc/models/list-team-member-booking-profiles-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Team Member Booking Profiles Request - -## Structure - -`ListTeamMemberBookingProfilesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `bookableOnly` | `boolean \| null \| undefined` | Optional | Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`). | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to return in a paged response.
**Constraints**: `>= 1`, `<= 100` | -| `cursor` | `string \| null \| undefined` | Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results.
**Constraints**: *Maximum Length*: `65536` | -| `locationId` | `string \| null \| undefined` | Optional | Indicates whether to include only team members enabled at the given location in the returned result.
**Constraints**: *Maximum Length*: `32` | - -## Example (as JSON) - -```json -{ - "bookable_only": false, - "limit": 112, - "cursor": "cursor2", - "location_id": "location_id8" -} -``` - diff --git a/doc/models/list-team-member-booking-profiles-response.md b/doc/models/list-team-member-booking-profiles-response.md deleted file mode 100644 index 365ac2319..000000000 --- a/doc/models/list-team-member-booking-profiles-response.md +++ /dev/null @@ -1,40 +0,0 @@ - -# List Team Member Booking Profiles Response - -## Structure - -`ListTeamMemberBookingProfilesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberBookingProfiles` | [`TeamMemberBookingProfile[] \| undefined`](../../doc/models/team-member-booking-profile.md) | Optional | The list of team member booking profiles. The results are returned in the ascending order of the time
when the team member booking profiles were last updated. Multiple booking profiles updated at the same time
are further sorted in the ascending order of their IDs. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set.
**Constraints**: *Maximum Length*: `65536` | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [], - "team_member_booking_profiles": [ - { - "display_name": "Sandbox Seller", - "is_bookable": true, - "team_member_id": "TMXUrsBWWcHTt79t", - "description": "description4", - "profile_image_url": "profile_image_url2" - }, - { - "display_name": "Sandbox Staff", - "is_bookable": true, - "team_member_id": "TMaJcbiRqPIGZuS9", - "description": "description4", - "profile_image_url": "profile_image_url2" - } - ], - "cursor": "cursor0" -} -``` - diff --git a/doc/models/list-team-member-wages-request.md b/doc/models/list-team-member-wages-request.md deleted file mode 100644 index 6791f9bbb..000000000 --- a/doc/models/list-team-member-wages-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# List Team Member Wages Request - -A request for a set of `TeamMemberWage` objects. - -## Structure - -`ListTeamMemberWagesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string \| null \| undefined` | Optional | Filter the returned wages to only those that are associated with the
specified team member. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of `TeamMemberWage` results to return per page. The number can range between
1 and 200. The default is 200.
**Constraints**: `>= 1`, `<= 200` | -| `cursor` | `string \| null \| undefined` | Optional | A pointer to the next page of `EmployeeWage` results to fetch. | - -## Example (as JSON) - -```json -{ - "team_member_id": "team_member_id2", - "limit": 210, - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-team-member-wages-response.md b/doc/models/list-team-member-wages-response.md deleted file mode 100644 index e93d4f787..000000000 --- a/doc/models/list-team-member-wages-response.md +++ /dev/null @@ -1,86 +0,0 @@ - -# List Team Member Wages Response - -The response to a request for a set of `TeamMemberWage` objects. The response contains -a set of `TeamMemberWage` objects. - -## Structure - -`ListTeamMemberWagesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberWages` | [`TeamMemberWage[] \| undefined`](../../doc/models/team-member-wage.md) | Optional | A page of `TeamMemberWage` results. | -| `cursor` | `string \| undefined` | Optional | The value supplied in the subsequent request to fetch the next page
of `TeamMemberWage` results. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "2fofTniCgT0yIPAq26kmk0YyFQJZfbWkh73OOnlTHmTAx13NgED", - "team_member_wages": [ - { - "hourly_rate": { - "amount": 3250, - "currency": "USD" - }, - "id": "pXS3qCv7BERPnEGedM4S8mhm", - "job_id": "jxJNN6eCJsLrhg5UFJrDWDGE", - "team_member_id": "33fJchumvVdJwxV0H6L9", - "tip_eligible": false, - "title": "Manager" - }, - { - "hourly_rate": { - "amount": 2600, - "currency": "USD" - }, - "id": "rZduCkzYDUVL3ovh1sQgbue6", - "job_id": "gcbz15vKGnMKmaWJJ152kjim", - "team_member_id": "33fJchumvVdJwxV0H6L9", - "tip_eligible": true, - "title": "Cook" - }, - { - "hourly_rate": { - "amount": 1600, - "currency": "USD" - }, - "id": "FxLbs5KpPUHa8wyt5ctjubDX", - "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", - "team_member_id": "33fJchumvVdJwxV0H6L9", - "tip_eligible": true, - "title": "Barista" - }, - { - "hourly_rate": { - "amount": 1700, - "currency": "USD" - }, - "id": "vD1wCgijMDR3cX5TPnu7VXto", - "job_id": "N4YKVLzFj3oGtNocqoYHYpW3", - "team_member_id": "33fJchumvVdJwxV0H6L9", - "tip_eligible": true, - "title": "Cashier" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-transactions-request.md b/doc/models/list-transactions-request.md deleted file mode 100644 index 1fcd75981..000000000 --- a/doc/models/list-transactions-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# List Transactions Request - -Defines the query parameters that can be included in -a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. - -Deprecated - recommend using [SearchOrders](api-endpoint:Orders-SearchOrders) - -## Structure - -`ListTransactionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `beginTime` | `string \| null \| undefined` | Optional | The beginning of the requested reporting period, in RFC 3339 format.

See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.

Default value: The current time minus one year. | -| `endTime` | `string \| null \| undefined` | Optional | The end of the requested reporting period, in RFC 3339 format.

See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.

Default value: The current time. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "begin_time": "begin_time6", - "end_time": "end_time0", - "sort_order": "DESC", - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-transactions-response.md b/doc/models/list-transactions-response.md deleted file mode 100644 index a0f98e7ad..000000000 --- a/doc/models/list-transactions-response.md +++ /dev/null @@ -1,111 +0,0 @@ - -# List Transactions Response - -Defines the fields that are included in the response body of -a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. - -One of `errors` or `transactions` is present in a given response (never both). - -## Structure - -`ListTransactionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `transactions` | [`Transaction[] \| undefined`](../../doc/models/transaction.md) | Optional | An array of transactions that match your query. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor for retrieving the next set of results,
if any remain. Provide this value as the `cursor` parameter in a subsequent
request to this endpoint.

See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "transactions": [ - { - "created_at": "2016-01-20T22:57:56Z", - "id": "KnL67ZIwXCPtzOrqj0HrkxMF", - "location_id": "18YC4JDH91E1H", - "product": "EXTERNAL_API", - "reference_id": "some optional reference id", - "refunds": [ - { - "additional_recipients": [ - { - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1", - "receivable_id": "receivable_id6" - } - ], - "amount_money": { - "amount": 5000, - "currency": "USD" - }, - "created_at": "2016-01-20T22:59:20Z", - "id": "7a5RcVI0CxbOcJ2wMOkE", - "location_id": "18YC4JDH91E1H", - "processing_fee_money": { - "amount": 138, - "currency": "USD" - }, - "reason": "some reason why", - "status": "APPROVED", - "tender_id": "MtZRYYdDrYNQbOvV7nbuBvMF", - "transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF" - } - ], - "tenders": [ - { - "additional_recipients": [ - { - "amount_money": { - "amount": 20, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1" - } - ], - "amount_money": { - "amount": 5000, - "currency": "USD" - }, - "card_details": { - "card": { - "card_brand": "VISA", - "last_4": "1111" - }, - "entry_method": "KEYED", - "status": "CAPTURED" - }, - "created_at": "2016-01-20T22:57:56Z", - "id": "MtZRYYdDrYNQbOvV7nbuBvMF", - "location_id": "18YC4JDH91E1H", - "note": "some optional note", - "processing_fee_money": { - "amount": 138, - "currency": "USD" - }, - "transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF", - "type": "CARD" - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor8" -} -``` - diff --git a/doc/models/list-webhook-event-types-request.md b/doc/models/list-webhook-event-types-request.md deleted file mode 100644 index f72e868c5..000000000 --- a/doc/models/list-webhook-event-types-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# List Webhook Event Types Request - -Lists all webhook event types that can be subscribed to. - -## Structure - -`ListWebhookEventTypesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `apiVersion` | `string \| null \| undefined` | Optional | The API version for which to list event types. Setting this field overrides the default version used by the application. | - -## Example (as JSON) - -```json -{ - "api_version": "api_version0" -} -``` - diff --git a/doc/models/list-webhook-event-types-response.md b/doc/models/list-webhook-event-types-response.md deleted file mode 100644 index 78ecbf3f3..000000000 --- a/doc/models/list-webhook-event-types-response.md +++ /dev/null @@ -1,46 +0,0 @@ - -# List Webhook Event Types Response - -Defines the fields that are included in the response body of -a request to the [ListWebhookEventTypes](../../doc/api/webhook-subscriptions.md#list-webhook-event-types) endpoint. - -Note: if there are errors processing the request, the event types field will not be -present. - -## Structure - -`ListWebhookEventTypesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `eventTypes` | `string[] \| undefined` | Optional | The list of event types. | -| `metadata` | [`EventTypeMetadata[] \| undefined`](../../doc/models/event-type-metadata.md) | Optional | Contains the metadata of a webhook event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). | - -## Example (as JSON) - -```json -{ - "event_types": [ - "inventory.count.updated" - ], - "metadata": [ - { - "api_version_introduced": "2018-07-12", - "event_type": "inventory.count.updated", - "release_status": "PUBLIC" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/list-webhook-subscriptions-request.md b/doc/models/list-webhook-subscriptions-request.md deleted file mode 100644 index 9b9fa225e..000000000 --- a/doc/models/list-webhook-subscriptions-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# List Webhook Subscriptions Request - -Lists all [Subscription](../../doc/models/webhook-subscription.md)s owned by your application. - -## Structure - -`ListWebhookSubscriptionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: *Maximum Length*: `256` | -| `includeDisabled` | `boolean \| null \| undefined` | Optional | Includes disabled [Subscription](entity:WebhookSubscription)s.
By default, all enabled [Subscription](entity:WebhookSubscription)s are returned. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of results to be returned in a single page.
It is possible to receive fewer results than the specified limit on a given page.
The default value of 100 is also the maximum allowed value.

Default: 100
**Constraints**: `>= 1`, `<= 100` | - -## Example (as JSON) - -```json -{ - "cursor": "cursor2", - "include_disabled": false, - "sort_order": "DESC", - "limit": 190 -} -``` - diff --git a/doc/models/list-webhook-subscriptions-response.md b/doc/models/list-webhook-subscriptions-response.md deleted file mode 100644 index ae758ffe2..000000000 --- a/doc/models/list-webhook-subscriptions-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# List Webhook Subscriptions Response - -Defines the fields that are included in the response body of -a request to the [ListWebhookSubscriptions](../../doc/api/webhook-subscriptions.md#list-webhook-subscriptions) endpoint. - -Note: if there are errors processing the request, the subscriptions field will not be -present. - -## Structure - -`ListWebhookSubscriptionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `subscriptions` | [`WebhookSubscription[] \| undefined`](../../doc/models/webhook-subscription.md) | Optional | The requested list of [Subscription](entity:WebhookSubscription)s. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty,
this is the final response.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "subscriptions": [ - { - "api_version": "2021-12-15", - "created_at": "2022-01-10 23:29:48 +0000 UTC", - "enabled": true, - "event_types": [ - "payment.created", - "payment.updated" - ], - "id": "wbhk_b35f6b3145074cf9ad513610786c19d5", - "name": "Example Webhook Subscription", - "notification_url": "https://example-webhook-url.com", - "updated_at": "2022-01-10 23:29:48 +0000 UTC" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor6" -} -``` - diff --git a/doc/models/list-workweek-configs-request.md b/doc/models/list-workweek-configs-request.md deleted file mode 100644 index cccf02937..000000000 --- a/doc/models/list-workweek-configs-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# List Workweek Configs Request - -A request for a set of `WorkweekConfig` objects. - -## Structure - -`ListWorkweekConfigsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of `WorkweekConfigs` results to return per page. | -| `cursor` | `string \| null \| undefined` | Optional | A pointer to the next page of `WorkweekConfig` results to fetch. | - -## Example (as JSON) - -```json -{ - "limit": 98, - "cursor": "cursor0" -} -``` - diff --git a/doc/models/list-workweek-configs-response.md b/doc/models/list-workweek-configs-response.md deleted file mode 100644 index 3ff668a1f..000000000 --- a/doc/models/list-workweek-configs-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# List Workweek Configs Response - -The response to a request for a set of `WorkweekConfig` objects. The response contains -the requested `WorkweekConfig` objects and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`ListWorkweekConfigsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `workweekConfigs` | [`WorkweekConfig[] \| undefined`](../../doc/models/workweek-config.md) | Optional | A page of `WorkweekConfig` results. | -| `cursor` | `string \| undefined` | Optional | The value supplied in the subsequent request to fetch the next page of
`WorkweekConfig` results. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "2fofTniCgT0yIPAq26kmk0YyFQJZfbWkh73OOnlTHmTAx13NgED", - "workweek_configs": [ - { - "created_at": "2016-02-04T00:58:24Z", - "id": "FY4VCAQN700GM", - "start_of_day_local_time": "10:00", - "start_of_week": "MON", - "updated_at": "2019-02-28T01:04:35Z", - "version": 11 - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/location-booking-profile.md b/doc/models/location-booking-profile.md deleted file mode 100644 index 6e37dd338..000000000 --- a/doc/models/location-booking-profile.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Location Booking Profile - -The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. - -## Structure - -`LocationBookingProfile` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the [location](entity:Location). | -| `bookingSiteUrl` | `string \| null \| undefined` | Optional | Url for the online booking site for this location. | -| `onlineBookingEnabled` | `boolean \| null \| undefined` | Optional | Indicates whether the location is enabled for online booking. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id8", - "booking_site_url": "booking_site_url4", - "online_booking_enabled": false -} -``` - diff --git a/doc/models/location-capability.md b/doc/models/location-capability.md deleted file mode 100644 index bed5e30e7..000000000 --- a/doc/models/location-capability.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Location Capability - -The capabilities a location might have. - -## Enumeration - -`LocationCapability` - -## Fields - -| Name | Description | -| --- | --- | -| `CREDIT_CARD_PROCESSING` | The capability to process credit card transactions with Square. | -| `AUTOMATIC_TRANSFERS` | The capability to receive automatic transfers from Square. | -| `UNLINKED_REFUNDS` | The capability to process unlinked refunds with Square. | - diff --git a/doc/models/location-status.md b/doc/models/location-status.md deleted file mode 100644 index 3edf1db75..000000000 --- a/doc/models/location-status.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Location Status - -A location's status. - -## Enumeration - -`LocationStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `ACTIVE` | A location that is active for business. | -| `INACTIVE` | A location that is not active for business. Inactive locations provide historical
information. Hide inactive locations unless the user has requested to see them. | - diff --git a/doc/models/location-type.md b/doc/models/location-type.md deleted file mode 100644 index 5aaf34afb..000000000 --- a/doc/models/location-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Location Type - -A location's type. - -## Enumeration - -`LocationType` - -## Fields - -| Name | Description | -| --- | --- | -| `PHYSICAL` | A place of business with a physical location. | -| `MOBILE` | A place of business that is mobile, such as a food truck or online store. | - diff --git a/doc/models/location.md b/doc/models/location.md deleted file mode 100644 index 6475f6eb3..000000000 --- a/doc/models/location.md +++ /dev/null @@ -1,61 +0,0 @@ - -# Location - -Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). - -## Structure - -`Location` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A short generated string of letters and numbers that uniquely identifies this location instance.
**Constraints**: *Maximum Length*: `32` | -| `name` | `string \| null \| undefined` | Optional | The name of the location.
This information appears in the Seller Dashboard as the nickname.
A location name must be unique within a seller account.
**Constraints**: *Maximum Length*: `255` | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `timezone` | `string \| null \| undefined` | Optional | The [IANA time zone](https://www.iana.org/time-zones) identifier for
the time zone of the location. For example, `America/Los_Angeles`.
**Constraints**: *Maximum Length*: `30` | -| `capabilities` | [`string[] \| undefined`](../../doc/models/location-capability.md) | Optional | The Square features that are enabled for the location.
See [LocationCapability](entity:LocationCapability) for possible values.
See [LocationCapability](#type-locationcapability) for possible values | -| `status` | [`string \| undefined`](../../doc/models/location-status.md) | Optional | A location's status. | -| `createdAt` | `string \| undefined` | Optional | The time when the location was created, in RFC 3339 format.
For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates).
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `25` | -| `merchantId` | `string \| undefined` | Optional | The ID of the merchant that owns the location.
**Constraints**: *Maximum Length*: `32` | -| `country` | [`string \| undefined`](../../doc/models/country.md) | Optional | Indicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | -| `languageCode` | `string \| null \| undefined` | Optional | The language associated with the location, in
[BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A).
For more information, see [Language Preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences).
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `5` | -| `currency` | [`string \| undefined`](../../doc/models/currency.md) | Optional | Indicates the associated currency for an amount of money. Values correspond
to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number of the location. For example, `+1 855-700-6000`.
**Constraints**: *Maximum Length*: `17` | -| `businessName` | `string \| null \| undefined` | Optional | The name of the location's overall business. This name is present on receipts and other customer-facing branding, and can be changed no more than three times in a twelve-month period.
**Constraints**: *Maximum Length*: `255` | -| `type` | [`string \| undefined`](../../doc/models/location-type.md) | Optional | A location's type. | -| `websiteUrl` | `string \| null \| undefined` | Optional | The website URL of the location. For example, `https://squareup.com`.
**Constraints**: *Maximum Length*: `255` | -| `businessHours` | [`BusinessHours \| undefined`](../../doc/models/business-hours.md) | Optional | The hours of operation for a location. | -| `businessEmail` | `string \| null \| undefined` | Optional | The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator.
**Constraints**: *Maximum Length*: `255` | -| `description` | `string \| null \| undefined` | Optional | The description of the location. For example, `Main Street location`.
**Constraints**: *Maximum Length*: `1024` | -| `twitterUsername` | `string \| null \| undefined` | Optional | The Twitter username of the location without the '@' symbol. For example, `Square`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `15` | -| `instagramUsername` | `string \| null \| undefined` | Optional | The Instagram username of the location without the '@' symbol. For example, `square`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `30` | -| `facebookUrl` | `string \| null \| undefined` | Optional | The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`.
**Constraints**: *Maximum Length*: `255` | -| `coordinates` | [`Coordinates \| undefined`](../../doc/models/coordinates.md) | Optional | Latitude and longitude coordinates. | -| `logoUrl` | `string \| undefined` | Optional | The URL of the logo image for the location. When configured in the Seller
Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels.
**Constraints**: *Maximum Length*: `255` | -| `posBackgroundUrl` | `string \| undefined` | Optional | The URL of the Point of Sale background image for the location.
**Constraints**: *Maximum Length*: `255` | -| `mcc` | `string \| null \| undefined` | Optional | A four-digit number that describes the kind of goods or services sold at the location.
The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245.
For example, `5045`, for a location that sells computer goods and software.
**Constraints**: *Minimum Length*: `4`, *Maximum Length*: `4` | -| `fullFormatLogoUrl` | `string \| undefined` | Optional | The URL of a full-format logo image for the location. When configured in the Seller
Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller.
This image can be wider than it is tall and should be at least 1280x648 pixels. | -| `taxIds` | [`TaxIds \| undefined`](../../doc/models/tax-ids.md) | Optional | Identifiers for the location used by various governments for tax purposes. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "name": "name4", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - }, - "timezone": "timezone4", - "capabilities": [ - "CREDIT_CARD_PROCESSING" - ] -} -``` - diff --git a/doc/models/loyalty-account-expiring-point-deadline.md b/doc/models/loyalty-account-expiring-point-deadline.md deleted file mode 100644 index d5da193cb..000000000 --- a/doc/models/loyalty-account-expiring-point-deadline.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Loyalty Account Expiring Point Deadline - -Represents a set of points for a loyalty account that are scheduled to expire on a specific date. - -## Structure - -`LoyaltyAccountExpiringPointDeadline` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `points` | `number` | Required | The number of points scheduled to expire at the `expires_at` timestamp. | -| `expiresAt` | `string` | Required | The timestamp of when the points are scheduled to expire, in RFC 3339 format.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "points": 104, - "expires_at": "expires_at6" -} -``` - diff --git a/doc/models/loyalty-account-mapping-type.md b/doc/models/loyalty-account-mapping-type.md deleted file mode 100644 index 1367bd913..000000000 --- a/doc/models/loyalty-account-mapping-type.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Loyalty Account Mapping Type - -The type of mapping. - -## Enumeration - -`LoyaltyAccountMappingType` - -## Fields - -| Name | Description | -| --- | --- | -| `PHONE` | The loyalty account is mapped by phone. | - diff --git a/doc/models/loyalty-account-mapping.md b/doc/models/loyalty-account-mapping.md deleted file mode 100644 index 97a9f5315..000000000 --- a/doc/models/loyalty-account-mapping.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Loyalty Account Mapping - -Represents the mapping that associates a loyalty account with a buyer. - -Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see -[Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview). - -## Structure - -`LoyaltyAccountMapping` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the mapping.
**Constraints**: *Maximum Length*: `36` | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the mapping was created, in RFC 3339 format. | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number of the buyer, in E.164 format. For example, "+14155551111". | - -## Example (as JSON) - -```json -{ - "id": "id2", - "created_at": "created_at0", - "phone_number": "phone_number0" -} -``` - diff --git a/doc/models/loyalty-account.md b/doc/models/loyalty-account.md deleted file mode 100644 index 04a347607..000000000 --- a/doc/models/loyalty-account.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Loyalty Account - -Describes a loyalty account in a [loyalty program](../../doc/models/loyalty-program.md). For more information, see -[Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). - -## Structure - -`LoyaltyAccount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the loyalty account.
**Constraints**: *Maximum Length*: `36` | -| `programId` | `string` | Required | The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram) to which the account belongs.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `balance` | `number \| undefined` | Optional | The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field.

Your application should be able to handle loyalty accounts that have a negative point balance (`balance` is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange. | -| `lifetimePoints` | `number \| undefined` | Optional | The total points accrued during the lifetime of the account. | -| `customerId` | `string \| null \| undefined` | Optional | The Square-assigned ID of the [customer](entity:Customer) that is associated with the account. | -| `enrolledAt` | `string \| null \| undefined` | Optional | The timestamp when the buyer joined the loyalty program, in RFC 3339 format. This field is used to display the **Enrolled On** or **Member Since** date in first-party Square products.

If this field is not set in a `CreateLoyaltyAccount` request, Square populates it after the buyer's first action on their account
(when `AccumulateLoyaltyPoints` or `CreateLoyaltyReward` is called). In first-party flows, Square populates the field when the buyer agrees to the terms of service in Square Point of Sale.

This field is typically specified in a `CreateLoyaltyAccount` request when creating a loyalty account for a buyer who already interacted with their account.
For example, you would set this field when migrating accounts from an external system. The timestamp in the request can represent a current or previous date and time, but it cannot be set for the future. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the loyalty account was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the loyalty account was last updated, in RFC 3339 format. | -| `mapping` | [`LoyaltyAccountMapping \| undefined`](../../doc/models/loyalty-account-mapping.md) | Optional | Represents the mapping that associates a loyalty account with a buyer.

Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see
[Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview). | -| `expiringPointDeadlines` | [`LoyaltyAccountExpiringPointDeadline[] \| null \| undefined`](../../doc/models/loyalty-account-expiring-point-deadline.md) | Optional | The schedule for when points expire in the loyalty account balance. This field is present only if the account has points that are scheduled to expire.

The total number of points in this field equals the number of points in the `balance` field. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "program_id": "program_id6", - "balance": 52, - "lifetime_points": 76, - "customer_id": "customer_id2", - "enrolled_at": "enrolled_at4" -} -``` - diff --git a/doc/models/loyalty-event-accumulate-points.md b/doc/models/loyalty-event-accumulate-points.md deleted file mode 100644 index aac0b1acb..000000000 --- a/doc/models/loyalty-event-accumulate-points.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Loyalty Event Accumulate Points - -Provides metadata when the event `type` is `ACCUMULATE_POINTS`. - -## Structure - -`LoyaltyEventAccumulatePoints` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyProgramId` | `string \| undefined` | Optional | The ID of the [loyalty program](entity:LoyaltyProgram).
**Constraints**: *Maximum Length*: `36` | -| `points` | `number \| null \| undefined` | Optional | The number of points accumulated by the event.
**Constraints**: `>= 1` | -| `orderId` | `string \| null \| undefined` | Optional | The ID of the [order](entity:Order) for which the buyer accumulated the points.
This field is returned only if the Orders API is used to process orders. | - -## Example (as JSON) - -```json -{ - "loyalty_program_id": "loyalty_program_id0", - "points": 104, - "order_id": "order_id4" -} -``` - diff --git a/doc/models/loyalty-event-accumulate-promotion-points.md b/doc/models/loyalty-event-accumulate-promotion-points.md deleted file mode 100644 index 6db43e359..000000000 --- a/doc/models/loyalty-event-accumulate-promotion-points.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Loyalty Event Accumulate Promotion Points - -Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. - -## Structure - -`LoyaltyEventAccumulatePromotionPoints` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyProgramId` | `string \| undefined` | Optional | The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
**Constraints**: *Maximum Length*: `36` | -| `loyaltyPromotionId` | `string \| undefined` | Optional | The Square-assigned ID of the [loyalty promotion](entity:LoyaltyPromotion).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `points` | `number` | Required | The number of points earned by the event. | -| `orderId` | `string` | Required | The ID of the [order](entity:Order) for which the buyer earned the promotion points.
Only applications that use the Orders API to process orders can trigger this event.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "loyalty_program_id": "loyalty_program_id0", - "loyalty_promotion_id": "loyalty_promotion_id8", - "points": 98, - "order_id": "order_id4" -} -``` - diff --git a/doc/models/loyalty-event-adjust-points.md b/doc/models/loyalty-event-adjust-points.md deleted file mode 100644 index db809f4a7..000000000 --- a/doc/models/loyalty-event-adjust-points.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Loyalty Event Adjust Points - -Provides metadata when the event `type` is `ADJUST_POINTS`. - -## Structure - -`LoyaltyEventAdjustPoints` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyProgramId` | `string \| undefined` | Optional | The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
**Constraints**: *Maximum Length*: `36` | -| `points` | `number` | Required | The number of points added or removed. | -| `reason` | `string \| null \| undefined` | Optional | The reason for the adjustment of points. | - -## Example (as JSON) - -```json -{ - "loyalty_program_id": "loyalty_program_id4", - "points": 98, - "reason": "reason0" -} -``` - diff --git a/doc/models/loyalty-event-create-reward.md b/doc/models/loyalty-event-create-reward.md deleted file mode 100644 index 286bf2162..000000000 --- a/doc/models/loyalty-event-create-reward.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Loyalty Event Create Reward - -Provides metadata when the event `type` is `CREATE_REWARD`. - -## Structure - -`LoyaltyEventCreateReward` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyProgramId` | `string` | Required | The ID of the [loyalty program](entity:LoyaltyProgram).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `rewardId` | `string \| undefined` | Optional | The Square-assigned ID of the created [loyalty reward](entity:LoyaltyReward).
This field is returned only if the event source is `LOYALTY_API`.
**Constraints**: *Maximum Length*: `36` | -| `points` | `number` | Required | The loyalty points used to create the reward. | - -## Example (as JSON) - -```json -{ - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 198 -} -``` - diff --git a/doc/models/loyalty-event-date-time-filter.md b/doc/models/loyalty-event-date-time-filter.md deleted file mode 100644 index 57dc6e391..000000000 --- a/doc/models/loyalty-event-date-time-filter.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Loyalty Event Date Time Filter - -Filter events by date time range. - -## Structure - -`LoyaltyEventDateTimeFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `createdAt` | [`TimeRange`](../../doc/models/time-range.md) | Required | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | - -## Example (as JSON) - -```json -{ - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } -} -``` - diff --git a/doc/models/loyalty-event-delete-reward.md b/doc/models/loyalty-event-delete-reward.md deleted file mode 100644 index d8d42b4ac..000000000 --- a/doc/models/loyalty-event-delete-reward.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Loyalty Event Delete Reward - -Provides metadata when the event `type` is `DELETE_REWARD`. - -## Structure - -`LoyaltyEventDeleteReward` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyProgramId` | `string` | Required | The ID of the [loyalty program](entity:LoyaltyProgram).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `rewardId` | `string \| undefined` | Optional | The ID of the deleted [loyalty reward](entity:LoyaltyReward).
This field is returned only if the event source is `LOYALTY_API`.
**Constraints**: *Maximum Length*: `36` | -| `points` | `number` | Required | The number of points returned to the loyalty account. | - -## Example (as JSON) - -```json -{ - "loyalty_program_id": "loyalty_program_id2", - "reward_id": "reward_id6", - "points": 84 -} -``` - diff --git a/doc/models/loyalty-event-expire-points.md b/doc/models/loyalty-event-expire-points.md deleted file mode 100644 index 0f4ee4ac9..000000000 --- a/doc/models/loyalty-event-expire-points.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Loyalty Event Expire Points - -Provides metadata when the event `type` is `EXPIRE_POINTS`. - -## Structure - -`LoyaltyEventExpirePoints` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyProgramId` | `string` | Required | The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `points` | `number` | Required | The number of points expired. | - -## Example (as JSON) - -```json -{ - "loyalty_program_id": "loyalty_program_id8", - "points": 84 -} -``` - diff --git a/doc/models/loyalty-event-filter.md b/doc/models/loyalty-event-filter.md deleted file mode 100644 index 47874b7c4..000000000 --- a/doc/models/loyalty-event-filter.md +++ /dev/null @@ -1,53 +0,0 @@ - -# Loyalty Event Filter - -The filtering criteria. If the request specifies multiple filters, -the endpoint uses a logical AND to evaluate them. - -## Structure - -`LoyaltyEventFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyAccountFilter` | [`LoyaltyEventLoyaltyAccountFilter \| undefined`](../../doc/models/loyalty-event-loyalty-account-filter.md) | Optional | Filter events by loyalty account. | -| `typeFilter` | [`LoyaltyEventTypeFilter \| undefined`](../../doc/models/loyalty-event-type-filter.md) | Optional | Filter events by event type. | -| `dateTimeFilter` | [`LoyaltyEventDateTimeFilter \| undefined`](../../doc/models/loyalty-event-date-time-filter.md) | Optional | Filter events by date time range. | -| `locationFilter` | [`LoyaltyEventLocationFilter \| undefined`](../../doc/models/loyalty-event-location-filter.md) | Optional | Filter events by location. | -| `orderFilter` | [`LoyaltyEventOrderFilter \| undefined`](../../doc/models/loyalty-event-order-filter.md) | Optional | Filter events by the order associated with the event. | - -## Example (as JSON) - -```json -{ - "loyalty_account_filter": { - "loyalty_account_id": "loyalty_account_id8" - }, - "type_filter": { - "types": [ - "ACCUMULATE_PROMOTION_POINTS", - "ACCUMULATE_POINTS", - "CREATE_REWARD" - ] - }, - "date_time_filter": { - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "location_filter": { - "location_ids": [ - "location_ids0", - "location_ids1", - "location_ids2" - ] - }, - "order_filter": { - "order_id": "order_id2" - } -} -``` - diff --git a/doc/models/loyalty-event-location-filter.md b/doc/models/loyalty-event-location-filter.md deleted file mode 100644 index 5d1c449be..000000000 --- a/doc/models/loyalty-event-location-filter.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Loyalty Event Location Filter - -Filter events by location. - -## Structure - -`LoyaltyEventLocationFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationIds` | `string[]` | Required | The [location](entity:Location) IDs for loyalty events to query.
If multiple values are specified, the endpoint uses
a logical OR to combine them. | - -## Example (as JSON) - -```json -{ - "location_ids": [ - "location_ids6", - "location_ids7", - "location_ids8" - ] -} -``` - diff --git a/doc/models/loyalty-event-loyalty-account-filter.md b/doc/models/loyalty-event-loyalty-account-filter.md deleted file mode 100644 index 5a607409b..000000000 --- a/doc/models/loyalty-event-loyalty-account-filter.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Loyalty Event Loyalty Account Filter - -Filter events by loyalty account. - -## Structure - -`LoyaltyEventLoyaltyAccountFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyAccountId` | `string` | Required | The ID of the [loyalty account](entity:LoyaltyAccount) associated with loyalty events.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "loyalty_account_id": "loyalty_account_id2" -} -``` - diff --git a/doc/models/loyalty-event-order-filter.md b/doc/models/loyalty-event-order-filter.md deleted file mode 100644 index beec80714..000000000 --- a/doc/models/loyalty-event-order-filter.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Loyalty Event Order Filter - -Filter events by the order associated with the event. - -## Structure - -`LoyaltyEventOrderFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string` | Required | The ID of the [order](entity:Order) associated with the event.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "order_id": "order_id4" -} -``` - diff --git a/doc/models/loyalty-event-other.md b/doc/models/loyalty-event-other.md deleted file mode 100644 index ab553d0e2..000000000 --- a/doc/models/loyalty-event-other.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Loyalty Event Other - -Provides metadata when the event `type` is `OTHER`. - -## Structure - -`LoyaltyEventOther` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyProgramId` | `string` | Required | The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `points` | `number` | Required | The number of points added or removed. | - -## Example (as JSON) - -```json -{ - "loyalty_program_id": "loyalty_program_id4", - "points": 94 -} -``` - diff --git a/doc/models/loyalty-event-query.md b/doc/models/loyalty-event-query.md deleted file mode 100644 index b6acffb4a..000000000 --- a/doc/models/loyalty-event-query.md +++ /dev/null @@ -1,50 +0,0 @@ - -# Loyalty Event Query - -Represents a query used to search for loyalty events. - -## Structure - -`LoyaltyEventQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`LoyaltyEventFilter \| undefined`](../../doc/models/loyalty-event-filter.md) | Optional | The filtering criteria. If the request specifies multiple filters,
the endpoint uses a logical AND to evaluate them. | - -## Example (as JSON) - -```json -{ - "filter": { - "loyalty_account_filter": { - "loyalty_account_id": "loyalty_account_id8" - }, - "type_filter": { - "types": [ - "ACCUMULATE_PROMOTION_POINTS", - "ACCUMULATE_POINTS", - "CREATE_REWARD" - ] - }, - "date_time_filter": { - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "location_filter": { - "location_ids": [ - "location_ids0", - "location_ids1", - "location_ids2" - ] - }, - "order_filter": { - "order_id": "order_id2" - } - } -} -``` - diff --git a/doc/models/loyalty-event-redeem-reward.md b/doc/models/loyalty-event-redeem-reward.md deleted file mode 100644 index 214fcdaa1..000000000 --- a/doc/models/loyalty-event-redeem-reward.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Loyalty Event Redeem Reward - -Provides metadata when the event `type` is `REDEEM_REWARD`. - -## Structure - -`LoyaltyEventRedeemReward` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyProgramId` | `string` | Required | The ID of the [loyalty program](entity:LoyaltyProgram).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `rewardId` | `string \| undefined` | Optional | The ID of the redeemed [loyalty reward](entity:LoyaltyReward).
This field is returned only if the event source is `LOYALTY_API`.
**Constraints**: *Maximum Length*: `36` | -| `orderId` | `string \| undefined` | Optional | The ID of the [order](entity:Order) that redeemed the reward.
This field is returned only if the Orders API is used to process orders. | - -## Example (as JSON) - -```json -{ - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "order_id": "order_id8" -} -``` - diff --git a/doc/models/loyalty-event-source.md b/doc/models/loyalty-event-source.md deleted file mode 100644 index 4cfa3d592..000000000 --- a/doc/models/loyalty-event-source.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Loyalty Event Source - -Defines whether the event was generated by the Square Point of Sale. - -## Enumeration - -`LoyaltyEventSource` - -## Fields - -| Name | Description | -| --- | --- | -| `SQUARE` | The event is generated by the Square Point of Sale (POS). | -| `LOYALTY_API` | The event is generated by something other than the Square Point of Sale that used the Loyalty API. | - diff --git a/doc/models/loyalty-event-type-filter.md b/doc/models/loyalty-event-type-filter.md deleted file mode 100644 index dbd9ceca9..000000000 --- a/doc/models/loyalty-event-type-filter.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Loyalty Event Type Filter - -Filter events by event type. - -## Structure - -`LoyaltyEventTypeFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `types` | [`string[]`](../../doc/models/loyalty-event-type.md) | Required | The loyalty event types used to filter the result.
If multiple values are specified, the endpoint uses a
logical OR to combine them.
See [LoyaltyEventType](#type-loyaltyeventtype) for possible values | - -## Example (as JSON) - -```json -{ - "types": [ - "EXPIRE_POINTS", - "OTHER", - "ACCUMULATE_PROMOTION_POINTS" - ] -} -``` - diff --git a/doc/models/loyalty-event-type.md b/doc/models/loyalty-event-type.md deleted file mode 100644 index 71364f4fc..000000000 --- a/doc/models/loyalty-event-type.md +++ /dev/null @@ -1,22 +0,0 @@ - -# Loyalty Event Type - -The type of the loyalty event. - -## Enumeration - -`LoyaltyEventType` - -## Fields - -| Name | Description | -| --- | --- | -| `ACCUMULATE_POINTS` | Points are added to a loyalty account for a purchase that
qualified for points based on an [accrual rule](../../doc/models/loyalty-program-accrual-rule.md). | -| `CREATE_REWARD` | A [loyalty reward](../../doc/models/loyalty-reward.md) is created. | -| `REDEEM_REWARD` | A loyalty reward is redeemed. | -| `DELETE_REWARD` | A loyalty reward is deleted. | -| `ADJUST_POINTS` | Loyalty points are manually adjusted. | -| `EXPIRE_POINTS` | Loyalty points are expired according to the
expiration policy of the loyalty program. | -| `OTHER` | Some other loyalty event occurred. | -| `ACCUMULATE_PROMOTION_POINTS` | Points are added to a loyalty account for a purchase that
qualified for a [loyalty promotion](../../doc/models/loyalty-promotion.md). | - diff --git a/doc/models/loyalty-event.md b/doc/models/loyalty-event.md deleted file mode 100644 index 2674799b1..000000000 --- a/doc/models/loyalty-event.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Loyalty Event - -Provides information about a loyalty event. -For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). - -## Structure - -`LoyaltyEvent` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Required | The Square-assigned ID of the loyalty event.
**Constraints**: *Minimum Length*: `1` | -| `type` | [`string`](../../doc/models/loyalty-event-type.md) | Required | The type of the loyalty event. | -| `createdAt` | `string` | Required | The timestamp when the event was created, in RFC 3339 format.
**Constraints**: *Minimum Length*: `1` | -| `accumulatePoints` | [`LoyaltyEventAccumulatePoints \| undefined`](../../doc/models/loyalty-event-accumulate-points.md) | Optional | Provides metadata when the event `type` is `ACCUMULATE_POINTS`. | -| `createReward` | [`LoyaltyEventCreateReward \| undefined`](../../doc/models/loyalty-event-create-reward.md) | Optional | Provides metadata when the event `type` is `CREATE_REWARD`. | -| `redeemReward` | [`LoyaltyEventRedeemReward \| undefined`](../../doc/models/loyalty-event-redeem-reward.md) | Optional | Provides metadata when the event `type` is `REDEEM_REWARD`. | -| `deleteReward` | [`LoyaltyEventDeleteReward \| undefined`](../../doc/models/loyalty-event-delete-reward.md) | Optional | Provides metadata when the event `type` is `DELETE_REWARD`. | -| `adjustPoints` | [`LoyaltyEventAdjustPoints \| undefined`](../../doc/models/loyalty-event-adjust-points.md) | Optional | Provides metadata when the event `type` is `ADJUST_POINTS`. | -| `loyaltyAccountId` | `string` | Required | The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `locationId` | `string \| undefined` | Optional | The ID of the [location](entity:Location) where the event occurred. | -| `source` | [`string`](../../doc/models/loyalty-event-source.md) | Required | Defines whether the event was generated by the Square Point of Sale. | -| `expirePoints` | [`LoyaltyEventExpirePoints \| undefined`](../../doc/models/loyalty-event-expire-points.md) | Optional | Provides metadata when the event `type` is `EXPIRE_POINTS`. | -| `otherEvent` | [`LoyaltyEventOther \| undefined`](../../doc/models/loyalty-event-other.md) | Optional | Provides metadata when the event `type` is `OTHER`. | -| `accumulatePromotionPoints` | [`LoyaltyEventAccumulatePromotionPoints \| undefined`](../../doc/models/loyalty-event-accumulate-promotion-points.md) | Optional | Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "type": "ACCUMULATE_POINTS", - "created_at": "created_at2", - "accumulate_points": { - "loyalty_program_id": "loyalty_program_id8", - "points": 118, - "order_id": "order_id8" - }, - "create_reward": { - "loyalty_program_id": "loyalty_program_id2", - "reward_id": "reward_id6", - "points": 90 - }, - "redeem_reward": { - "loyalty_program_id": "loyalty_program_id8", - "reward_id": "reward_id2", - "order_id": "order_id8" - }, - "delete_reward": { - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 104 - }, - "adjust_points": { - "loyalty_program_id": "loyalty_program_id2", - "points": 96, - "reason": "reason2" - }, - "loyalty_account_id": "loyalty_account_id0", - "source": "SQUARE" -} -``` - diff --git a/doc/models/loyalty-program-accrual-rule-category-data.md b/doc/models/loyalty-program-accrual-rule-category-data.md deleted file mode 100644 index 887def4c2..000000000 --- a/doc/models/loyalty-program-accrual-rule-category-data.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Loyalty Program Accrual Rule Category Data - -Represents additional data for rules with the `CATEGORY` accrual type. - -## Structure - -`LoyaltyProgramAccrualRuleCategoryData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `categoryId` | `string` | Required | The ID of the `CATEGORY` [catalog object](entity:CatalogObject) that buyers can purchase to earn
points.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "category_id": "category_id6" -} -``` - diff --git a/doc/models/loyalty-program-accrual-rule-item-variation-data.md b/doc/models/loyalty-program-accrual-rule-item-variation-data.md deleted file mode 100644 index c4010a2ec..000000000 --- a/doc/models/loyalty-program-accrual-rule-item-variation-data.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Loyalty Program Accrual Rule Item Variation Data - -Represents additional data for rules with the `ITEM_VARIATION` accrual type. - -## Structure - -`LoyaltyProgramAccrualRuleItemVariationData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemVariationId` | `string` | Required | The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to earn
points.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "item_variation_id": "item_variation_id6" -} -``` - diff --git a/doc/models/loyalty-program-accrual-rule-spend-data.md b/doc/models/loyalty-program-accrual-rule-spend-data.md deleted file mode 100644 index c3308290c..000000000 --- a/doc/models/loyalty-program-accrual-rule-spend-data.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Loyalty Program Accrual Rule Spend Data - -Represents additional data for rules with the `SPEND` accrual type. - -## Structure - -`LoyaltyProgramAccrualRuleSpendData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `excludedCategoryIds` | `string[] \| null \| undefined` | Optional | The IDs of any `CATEGORY` catalog objects that are excluded from points accrual.

You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects)
endpoint to retrieve information about the excluded categories. | -| `excludedItemVariationIds` | `string[] \| null \| undefined` | Optional | The IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual.

You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects)
endpoint to retrieve information about the excluded item variations. | -| `taxMode` | [`string`](../../doc/models/loyalty-program-accrual-rule-tax-mode.md) | Required | Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual.
This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "excluded_category_ids": [ - "excluded_category_ids4" - ], - "excluded_item_variation_ids": [ - "excluded_item_variation_ids7", - "excluded_item_variation_ids6" - ], - "tax_mode": "BEFORE_TAX" -} -``` - diff --git a/doc/models/loyalty-program-accrual-rule-tax-mode.md b/doc/models/loyalty-program-accrual-rule-tax-mode.md deleted file mode 100644 index 6a4d1016a..000000000 --- a/doc/models/loyalty-program-accrual-rule-tax-mode.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Loyalty Program Accrual Rule Tax Mode - -Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual. -This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. - -## Enumeration - -`LoyaltyProgramAccrualRuleTaxMode` - -## Fields - -| Name | Description | -| --- | --- | -| `BEFORE_TAX` | Exclude taxes from the purchase amount used for loyalty points accrual. | -| `AFTER_TAX` | Include taxes in the purchase amount used for loyalty points accrual. | - diff --git a/doc/models/loyalty-program-accrual-rule-type.md b/doc/models/loyalty-program-accrual-rule-type.md deleted file mode 100644 index cf8384ee3..000000000 --- a/doc/models/loyalty-program-accrual-rule-type.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Loyalty Program Accrual Rule Type - -The type of the accrual rule that defines how buyers can earn points. - -## Enumeration - -`LoyaltyProgramAccrualRuleType` - -## Fields - -| Name | Description | -| --- | --- | -| `VISIT` | A visit-based accrual rule. A buyer earns points for each visit.
You can specify the minimum purchase required. | -| `SPEND` | A spend-based accrual rule. A buyer earns points based on the amount
spent. | -| `ITEM_VARIATION` | An accrual rule based on an item variation. For example, accrue
points for purchasing a coffee. | -| `CATEGORY` | An accrual rule based on an item category. For example, accrue points
for purchasing any item in the "hot drink" category: coffee, tea, or hot cocoa. | - diff --git a/doc/models/loyalty-program-accrual-rule-visit-data.md b/doc/models/loyalty-program-accrual-rule-visit-data.md deleted file mode 100644 index b7c7ffe71..000000000 --- a/doc/models/loyalty-program-accrual-rule-visit-data.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Loyalty Program Accrual Rule Visit Data - -Represents additional data for rules with the `VISIT` accrual type. - -## Structure - -`LoyaltyProgramAccrualRuleVisitData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `minimumAmountMoney` | [`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. | -| `taxMode` | [`string`](../../doc/models/loyalty-program-accrual-rule-tax-mode.md) | Required | Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual.
This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. | - -## Example (as JSON) - -```json -{ - "minimum_amount_money": { - "amount": 146, - "currency": "GHS" - }, - "tax_mode": "BEFORE_TAX" -} -``` - diff --git a/doc/models/loyalty-program-accrual-rule.md b/doc/models/loyalty-program-accrual-rule.md deleted file mode 100644 index 691bb3e10..000000000 --- a/doc/models/loyalty-program-accrual-rule.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Loyalty Program Accrual Rule - -Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program](../../doc/models/loyalty-program.md). - -## Structure - -`LoyaltyProgramAccrualRule` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `accrualType` | [`string`](../../doc/models/loyalty-program-accrual-rule-type.md) | Required | The type of the accrual rule that defines how buyers can earn points. | -| `points` | `number \| null \| undefined` | Optional | The number of points that
buyers earn based on the `accrual_type`.
**Constraints**: `>= 1` | -| `visitData` | [`LoyaltyProgramAccrualRuleVisitData \| undefined`](../../doc/models/loyalty-program-accrual-rule-visit-data.md) | Optional | Represents additional data for rules with the `VISIT` accrual type. | -| `spendData` | [`LoyaltyProgramAccrualRuleSpendData \| undefined`](../../doc/models/loyalty-program-accrual-rule-spend-data.md) | Optional | Represents additional data for rules with the `SPEND` accrual type. | -| `itemVariationData` | [`LoyaltyProgramAccrualRuleItemVariationData \| undefined`](../../doc/models/loyalty-program-accrual-rule-item-variation-data.md) | Optional | Represents additional data for rules with the `ITEM_VARIATION` accrual type. | -| `categoryData` | [`LoyaltyProgramAccrualRuleCategoryData \| undefined`](../../doc/models/loyalty-program-accrual-rule-category-data.md) | Optional | Represents additional data for rules with the `CATEGORY` accrual type. | - -## Example (as JSON) - -```json -{ - "accrual_type": "VISIT", - "points": 86, - "visit_data": { - "minimum_amount_money": { - "amount": 146, - "currency": "GHS" - }, - "tax_mode": "BEFORE_TAX" - }, - "spend_data": { - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "excluded_category_ids": [ - "excluded_category_ids4" - ], - "excluded_item_variation_ids": [ - "excluded_item_variation_ids3", - "excluded_item_variation_ids4" - ], - "tax_mode": "BEFORE_TAX" - }, - "item_variation_data": { - "item_variation_id": "item_variation_id0" - }, - "category_data": { - "category_id": "category_id4" - } -} -``` - diff --git a/doc/models/loyalty-program-expiration-policy.md b/doc/models/loyalty-program-expiration-policy.md deleted file mode 100644 index 24f222cf4..000000000 --- a/doc/models/loyalty-program-expiration-policy.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Loyalty Program Expiration Policy - -Describes when the loyalty program expires. - -## Structure - -`LoyaltyProgramExpirationPolicy` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `expirationDuration` | `string` | Required | The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value of `P12M` represents a duration of 12 months.
Points are valid through the last day of the month in which they are scheduled to expire. For example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "expiration_duration": "expiration_duration2" -} -``` - diff --git a/doc/models/loyalty-program-reward-definition-scope.md b/doc/models/loyalty-program-reward-definition-scope.md deleted file mode 100644 index bb3997094..000000000 --- a/doc/models/loyalty-program-reward-definition-scope.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Loyalty Program Reward Definition Scope - -Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. Discount details -are now defined using a catalog pricing rule and other catalog objects. For more information, see -[Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). - -## Enumeration - -`LoyaltyProgramRewardDefinitionScope` - -## Fields - -| Name | Description | -| --- | --- | -| `ORDER` | The discount applies to the entire order. | -| `ITEM_VARIATION` | The discount applies only to specific item variations. | -| `CATEGORY` | The discount applies only to items in the given categories. | - diff --git a/doc/models/loyalty-program-reward-definition-type.md b/doc/models/loyalty-program-reward-definition-type.md deleted file mode 100644 index 03302579d..000000000 --- a/doc/models/loyalty-program-reward-definition-type.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Loyalty Program Reward Definition Type - -The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. Discount details -are now defined using a catalog pricing rule and other catalog objects. For more information, see -[Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). - -## Enumeration - -`LoyaltyProgramRewardDefinitionType` - -## Fields - -| Name | Description | -| --- | --- | -| `FIXED_AMOUNT` | The fixed amount discounted. | -| `FIXED_PERCENTAGE` | The fixed percentage discounted. | - diff --git a/doc/models/loyalty-program-reward-definition.md b/doc/models/loyalty-program-reward-definition.md deleted file mode 100644 index 4542b301f..000000000 --- a/doc/models/loyalty-program-reward-definition.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Loyalty Program Reward Definition - -Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details -are now defined using a catalog pricing rule and other catalog objects. For more information, see -[Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). - -## Structure - -`LoyaltyProgramRewardDefinition` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `scope` | [`string`](../../doc/models/loyalty-program-reward-definition-scope.md) | Required | Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. Discount details
are now defined using a catalog pricing rule and other catalog objects. For more information, see
[Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). | -| `discountType` | [`string`](../../doc/models/loyalty-program-reward-definition-type.md) | Required | The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. Discount details
are now defined using a catalog pricing rule and other catalog objects. For more information, see
[Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). | -| `percentageDiscount` | `string \| undefined` | Optional | The fixed percentage of the discount. Present if `discount_type` is `FIXED_PERCENTAGE`.
For example, a 7.25% off discount will be represented as "7.25". DEPRECATED at version 2020-12-16. You can find this
information in the `discount_data.percentage` field of the `DISCOUNT` catalog object referenced by the pricing rule. | -| `catalogObjectIds` | `string[] \| undefined` | Optional | The list of catalog objects to which this reward can be applied. They are either all item-variation ids or category ids, depending on the `type` field.
DEPRECATED at version 2020-12-16. You can find this information in the `product_set_data.product_ids_any` field
of the `PRODUCT_SET` catalog object referenced by the pricing rule. | -| `fixedDiscountMoney` | [`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. | -| `maxDiscountMoney` | [`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 -{ - "scope": "ORDER", - "discount_type": "FIXED_AMOUNT", - "percentage_discount": "percentage_discount0", - "catalog_object_ids": [ - "catalog_object_ids8" - ], - "fixed_discount_money": { - "amount": 36, - "currency": "SLL" - }, - "max_discount_money": { - "amount": 84, - "currency": "BOB" - } -} -``` - diff --git a/doc/models/loyalty-program-reward-tier.md b/doc/models/loyalty-program-reward-tier.md deleted file mode 100644 index 6c76066c1..000000000 --- a/doc/models/loyalty-program-reward-tier.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Loyalty Program Reward Tier - -Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers. - -## Structure - -`LoyaltyProgramRewardTier` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the reward tier.
**Constraints**: *Maximum Length*: `36` | -| `points` | `number` | Required | The points exchanged for the reward tier.
**Constraints**: `>= 1` | -| `name` | `string \| undefined` | Optional | The name of the reward tier. | -| `definition` | [`LoyaltyProgramRewardDefinition \| undefined`](../../doc/models/loyalty-program-reward-definition.md) | Optional | Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details
are now defined using a catalog pricing rule and other catalog objects. For more information, see
[Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the reward tier was created, in RFC 3339 format. | -| `pricingRuleReference` | [`CatalogObjectReference`](../../doc/models/catalog-object-reference.md) | Required | A reference to a Catalog object at a specific version. In general this is
used as an entry point into a graph of catalog objects, where the objects exist
at a specific version. | - -## Example (as JSON) - -```json -{ - "id": "id2", - "points": 94, - "name": "name2", - "definition": { - "scope": "ORDER", - "discount_type": "FIXED_AMOUNT", - "percentage_discount": "percentage_discount2", - "catalog_object_ids": [ - "catalog_object_ids6" - ], - "fixed_discount_money": { - "amount": 36, - "currency": "SLL" - }, - "max_discount_money": { - "amount": 84, - "currency": "BOB" - } - }, - "created_at": "created_at0", - "pricing_rule_reference": { - "object_id": "object_id0", - "catalog_version": 218 - } -} -``` - diff --git a/doc/models/loyalty-program-status.md b/doc/models/loyalty-program-status.md deleted file mode 100644 index ef1a3ed7f..000000000 --- a/doc/models/loyalty-program-status.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Loyalty Program Status - -Indicates whether the program is currently active. - -## Enumeration - -`LoyaltyProgramStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `INACTIVE` | The loyalty program does not have an active subscription.
Loyalty API requests fail. | -| `ACTIVE` | The program is fully functional. The program has an active subscription. | - diff --git a/doc/models/loyalty-program-terminology.md b/doc/models/loyalty-program-terminology.md deleted file mode 100644 index 7c7d8d0f0..000000000 --- a/doc/models/loyalty-program-terminology.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Loyalty Program Terminology - -Represents the naming used for loyalty points. - -## Structure - -`LoyaltyProgramTerminology` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `one` | `string` | Required | A singular unit for a point (for example, 1 point is called 1 star).
**Constraints**: *Minimum Length*: `1` | -| `other` | `string` | Required | A plural unit for point (for example, 10 points is called 10 stars).
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "one": "one4", - "other": "other0" -} -``` - diff --git a/doc/models/loyalty-program.md b/doc/models/loyalty-program.md deleted file mode 100644 index 70d85ee82..000000000 --- a/doc/models/loyalty-program.md +++ /dev/null @@ -1,95 +0,0 @@ - -# Loyalty Program - -Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards. -Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. -For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). - -## Structure - -`LoyaltyProgram` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the loyalty program. Updates to
the loyalty program do not modify the identifier.
**Constraints**: *Maximum Length*: `36` | -| `status` | [`string \| undefined`](../../doc/models/loyalty-program-status.md) | Optional | Indicates whether the program is currently active. | -| `rewardTiers` | [`LoyaltyProgramRewardTier[] \| null \| undefined`](../../doc/models/loyalty-program-reward-tier.md) | Optional | The list of rewards for buyers, sorted by ascending points. | -| `expirationPolicy` | [`LoyaltyProgramExpirationPolicy \| undefined`](../../doc/models/loyalty-program-expiration-policy.md) | Optional | Describes when the loyalty program expires. | -| `terminology` | [`LoyaltyProgramTerminology \| undefined`](../../doc/models/loyalty-program-terminology.md) | Optional | Represents the naming used for loyalty points. | -| `locationIds` | `string[] \| null \| undefined` | Optional | The [locations](entity:Location) at which the program is active. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the program was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the reward was last updated, in RFC 3339 format. | -| `accrualRules` | [`LoyaltyProgramAccrualRule[] \| null \| undefined`](../../doc/models/loyalty-program-accrual-rule.md) | Optional | Defines how buyers can earn loyalty points from the base loyalty program.
To check for associated [loyalty promotions](entity:LoyaltyPromotion) that enable
buyers to earn extra points, call [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions). | - -## Example (as JSON) - -```json -{ - "id": "id2", - "status": "INACTIVE", - "reward_tiers": [ - { - "id": "id8", - "points": 250, - "name": "name8", - "definition": { - "scope": "ORDER", - "discount_type": "FIXED_AMOUNT", - "percentage_discount": "percentage_discount2", - "catalog_object_ids": [ - "catalog_object_ids6" - ], - "fixed_discount_money": { - "amount": 36, - "currency": "SLL" - }, - "max_discount_money": { - "amount": 84, - "currency": "BOB" - } - }, - "created_at": "created_at6", - "pricing_rule_reference": { - "object_id": "object_id0", - "catalog_version": 218 - } - }, - { - "id": "id8", - "points": 250, - "name": "name8", - "definition": { - "scope": "ORDER", - "discount_type": "FIXED_AMOUNT", - "percentage_discount": "percentage_discount2", - "catalog_object_ids": [ - "catalog_object_ids6" - ], - "fixed_discount_money": { - "amount": 36, - "currency": "SLL" - }, - "max_discount_money": { - "amount": 84, - "currency": "BOB" - } - }, - "created_at": "created_at6", - "pricing_rule_reference": { - "object_id": "object_id0", - "catalog_version": 218 - } - } - ], - "expiration_policy": { - "expiration_duration": "expiration_duration0" - }, - "terminology": { - "one": "one0", - "other": "other6" - } -} -``` - diff --git a/doc/models/loyalty-promotion-available-time-data.md b/doc/models/loyalty-promotion-available-time-data.md deleted file mode 100644 index 69d690ed2..000000000 --- a/doc/models/loyalty-promotion-available-time-data.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Loyalty Promotion Available Time Data - -Represents scheduling information that determines when purchases can qualify to earn points -from a [loyalty promotion](../../doc/models/loyalty-promotion.md). - -## Structure - -`LoyaltyPromotionAvailableTimeData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `startDate` | `string \| undefined` | Optional | The date that the promotion starts, in `YYYY-MM-DD` format. Square populates this field
based on the provided `time_periods`. | -| `endDate` | `string \| undefined` | Optional | The date that the promotion ends, in `YYYY-MM-DD` format. Square populates this field
based on the provided `time_periods`. If an end date is not specified, an `ACTIVE` promotion
remains available until it is canceled. | -| `timePeriods` | `string[]` | Required | A list of [iCalendar (RFC 5545) events](https://tools.ietf.org/html/rfc5545#section-3.6.1)
(`VEVENT`). Each event represents an available time period per day or days of the week.
A day can have a maximum of one available time period.

Only `DTSTART`, `DURATION`, and `RRULE` are supported. `DTSTART` and `DURATION` are required and
timestamps must be in local (unzoned) time format. Include `RRULE` to specify recurring promotions,
an end date (using the `UNTIL` keyword), or both. For more information, see
[Available time](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#available-time).

Note that `BEGIN:VEVENT` and `END:VEVENT` are optional in a `CreateLoyaltyPromotion` request
but are always included in the response. | - -## Example (as JSON) - -```json -{ - "start_date": "start_date4", - "end_date": "end_date0", - "time_periods": [ - "time_periods7", - "time_periods8", - "time_periods9" - ] -} -``` - diff --git a/doc/models/loyalty-promotion-incentive-points-addition-data.md b/doc/models/loyalty-promotion-incentive-points-addition-data.md deleted file mode 100644 index 18e5d4888..000000000 --- a/doc/models/loyalty-promotion-incentive-points-addition-data.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Loyalty Promotion Incentive Points Addition Data - -Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive](../../doc/models/loyalty-promotion-incentive.md). - -## Structure - -`LoyaltyPromotionIncentivePointsAdditionData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `pointsAddition` | `number` | Required | The number of additional points to earn each time the promotion is triggered. For example,
suppose a purchase qualifies for 5 points from the base loyalty program. If the purchase also
qualifies for a `POINTS_ADDITION` promotion incentive with a `points_addition` of 3, the buyer
earns a total of 8 points (5 program points + 3 promotion points = 8 points).
**Constraints**: `>= 1` | - -## Example (as JSON) - -```json -{ - "points_addition": 88 -} -``` - diff --git a/doc/models/loyalty-promotion-incentive-points-multiplier-data.md b/doc/models/loyalty-promotion-incentive-points-multiplier-data.md deleted file mode 100644 index ce27146d6..000000000 --- a/doc/models/loyalty-promotion-incentive-points-multiplier-data.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Loyalty Promotion Incentive Points Multiplier Data - -Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive](../../doc/models/loyalty-promotion-incentive.md). - -## Structure - -`LoyaltyPromotionIncentivePointsMultiplierData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `pointsMultiplier` | `number \| null \| undefined` | Optional | The multiplier used to calculate the number of points earned each time the promotion
is triggered. For example, suppose a purchase qualifies for 5 points from the base loyalty program.
If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a `points_multiplier`
of 3, the buyer earns a total of 15 points (5 program points x 3 promotion multiplier = 15 points).

DEPRECATED at version 2023-08-16. Replaced by the `multiplier` field.

One of the following is required when specifying a points multiplier:

- (Recommended) The `multiplier` field.
- This deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier`
with the equivalent value.
**Constraints**: `>= 2`, `<= 10` | -| `multiplier` | `string \| null \| undefined` | Optional | The multiplier used to calculate the number of points earned each time the promotion is triggered,
specified as a string representation of a decimal. Square supports multipliers up to 10x, with three
point precision for decimal multipliers. For example, suppose a purchase qualifies for 4 points from the
base loyalty program. If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a
`multiplier` of "1.5", the buyer earns a total of 6 points (4 program points x 1.5 promotion multiplier = 6 points).
Fractional points are dropped.

One of the following is required when specifying a points multiplier:

- (Recommended) This `multiplier` field.
- The deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier`
with the equivalent value.
**Constraints**: *Maximum Length*: `5` | - -## Example (as JSON) - -```json -{ - "points_multiplier": 116, - "multiplier": "multiplier2" -} -``` - diff --git a/doc/models/loyalty-promotion-incentive-type.md b/doc/models/loyalty-promotion-incentive-type.md deleted file mode 100644 index 4797dfee0..000000000 --- a/doc/models/loyalty-promotion-incentive-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Loyalty Promotion Incentive Type - -Indicates the type of points incentive for a [loyalty promotion](../../doc/models/loyalty-promotion.md), -which is used to determine how buyers can earn points from the promotion. - -## Enumeration - -`LoyaltyPromotionIncentiveType` - -## Fields - -| Name | Description | -| --- | --- | -| `POINTS_MULTIPLIER` | Multiply the number of points earned from the base loyalty program.
For example, "Earn double points." | -| `POINTS_ADDITION` | Add a specified number of points to those earned from the base loyalty program.
For example, "Earn 10 additional points." | - diff --git a/doc/models/loyalty-promotion-incentive.md b/doc/models/loyalty-promotion-incentive.md deleted file mode 100644 index d97f1b5a2..000000000 --- a/doc/models/loyalty-promotion-incentive.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Loyalty Promotion Incentive - -Represents how points for a [loyalty promotion](../../doc/models/loyalty-promotion.md) are calculated, -either by multiplying the points earned from the base program or by adding a specified number -of points to the points earned from the base program. - -## Structure - -`LoyaltyPromotionIncentive` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `type` | [`string`](../../doc/models/loyalty-promotion-incentive-type.md) | Required | Indicates the type of points incentive for a [loyalty promotion](../../doc/models/loyalty-promotion.md),
which is used to determine how buyers can earn points from the promotion. | -| `pointsMultiplierData` | [`LoyaltyPromotionIncentivePointsMultiplierData \| undefined`](../../doc/models/loyalty-promotion-incentive-points-multiplier-data.md) | Optional | Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive](../../doc/models/loyalty-promotion-incentive.md). | -| `pointsAdditionData` | [`LoyaltyPromotionIncentivePointsAdditionData \| undefined`](../../doc/models/loyalty-promotion-incentive-points-addition-data.md) | Optional | Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive](../../doc/models/loyalty-promotion-incentive.md). | - -## Example (as JSON) - -```json -{ - "type": "POINTS_MULTIPLIER", - "points_multiplier_data": { - "points_multiplier": 134, - "multiplier": "multiplier4" - }, - "points_addition_data": { - "points_addition": 218 - } -} -``` - diff --git a/doc/models/loyalty-promotion-status.md b/doc/models/loyalty-promotion-status.md deleted file mode 100644 index 393c90c76..000000000 --- a/doc/models/loyalty-promotion-status.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Loyalty Promotion Status - -Indicates the status of a [loyalty promotion](../../doc/models/loyalty-promotion.md). - -## Enumeration - -`LoyaltyPromotionStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `ACTIVE` | The loyalty promotion is currently active. Buyers can earn points for purchases
that meet the promotion conditions, such as the promotion's `available_time`. | -| `ENDED` | The loyalty promotion has ended because the specified `end_date` was reached.
`ENDED` is a terminal status. | -| `CANCELED` | The loyalty promotion was canceled. `CANCELED` is a terminal status. | -| `SCHEDULED` | The loyalty promotion is scheduled to start in the future. Square changes the
promotion status to `ACTIVE` when the `start_date` is reached. | - diff --git a/doc/models/loyalty-promotion-trigger-limit-interval.md b/doc/models/loyalty-promotion-trigger-limit-interval.md deleted file mode 100644 index 3be1d8130..000000000 --- a/doc/models/loyalty-promotion-trigger-limit-interval.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Loyalty Promotion Trigger Limit Interval - -Indicates the time period that the [trigger limit](../../doc/models/loyalty-promotion-trigger-limit.md) applies to, -which is used to determine the number of times a buyer can earn points for a [loyalty promotion](../../doc/models/loyalty-promotion.md). - -## Enumeration - -`LoyaltyPromotionTriggerLimitInterval` - -## Fields - -| Name | Description | -| --- | --- | -| `ALL_TIME` | The limit applies to the entire time that the promotion is active. For example, if `times`
is set to 1 and `time_period` is set to `ALL_TIME`, a buyer can earn promotion points a maximum
of one time during the promotion. | -| `DAY` | The limit applies per day, according to the `available_time` schedule specified for the promotion.
For example, if the `times` field of the trigger limit is set to 1, a buyer can trigger the promotion
a maximum of once per day. | - diff --git a/doc/models/loyalty-promotion-trigger-limit.md b/doc/models/loyalty-promotion-trigger-limit.md deleted file mode 100644 index 44902e02c..000000000 --- a/doc/models/loyalty-promotion-trigger-limit.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Loyalty Promotion Trigger Limit - -Represents the number of times a buyer can earn points during a [loyalty promotion](../../doc/models/loyalty-promotion.md). -If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during -the time that the promotion is available. - -A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. - -## Structure - -`LoyaltyPromotionTriggerLimit` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `times` | `number` | Required | The maximum number of times a buyer can trigger the promotion during the specified `interval`.
**Constraints**: `>= 1`, `<= 30` | -| `interval` | [`string \| undefined`](../../doc/models/loyalty-promotion-trigger-limit-interval.md) | Optional | Indicates the time period that the [trigger limit](../../doc/models/loyalty-promotion-trigger-limit.md) applies to,
which is used to determine the number of times a buyer can earn points for a [loyalty promotion](../../doc/models/loyalty-promotion.md). | - -## Example (as JSON) - -```json -{ - "times": 32, - "interval": "ALL_TIME" -} -``` - diff --git a/doc/models/loyalty-promotion.md b/doc/models/loyalty-promotion.md deleted file mode 100644 index efda9267e..000000000 --- a/doc/models/loyalty-promotion.md +++ /dev/null @@ -1,63 +0,0 @@ - -# Loyalty Promotion - -Represents a promotion for a [loyalty program](../../doc/models/loyalty-program.md). Loyalty promotions enable buyers -to earn extra points on top of those earned from the base program. - -A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. - -## Structure - -`LoyaltyPromotion` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the promotion.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `name` | `string` | Required | The name of the promotion.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `70` | -| `incentive` | [`LoyaltyPromotionIncentive`](../../doc/models/loyalty-promotion-incentive.md) | Required | Represents how points for a [loyalty promotion](../../doc/models/loyalty-promotion.md) are calculated,
either by multiplying the points earned from the base program or by adding a specified number
of points to the points earned from the base program. | -| `availableTime` | [`LoyaltyPromotionAvailableTimeData`](../../doc/models/loyalty-promotion-available-time-data.md) | Required | Represents scheduling information that determines when purchases can qualify to earn points
from a [loyalty promotion](../../doc/models/loyalty-promotion.md). | -| `triggerLimit` | [`LoyaltyPromotionTriggerLimit \| undefined`](../../doc/models/loyalty-promotion-trigger-limit.md) | Optional | Represents the number of times a buyer can earn points during a [loyalty promotion](../../doc/models/loyalty-promotion.md).
If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during
the time that the promotion is available.

A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. | -| `status` | [`string \| undefined`](../../doc/models/loyalty-promotion-status.md) | Optional | Indicates the status of a [loyalty promotion](../../doc/models/loyalty-promotion.md). | -| `createdAt` | `string \| undefined` | Optional | The timestamp of when the promotion was created, in RFC 3339 format. | -| `canceledAt` | `string \| undefined` | Optional | The timestamp of when the promotion was canceled, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the promotion was last updated, in RFC 3339 format. | -| `loyaltyProgramId` | `string \| undefined` | Optional | The ID of the [loyalty program](entity:LoyaltyProgram) associated with the promotion. | -| `minimumSpendAmountMoney` | [`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. | -| `qualifyingItemVariationIds` | `string[] \| null \| undefined` | Optional | The IDs of any qualifying `ITEM_VARIATION` [catalog objects](entity:CatalogObject). If specified,
the purchase must include at least one of these items to qualify for the promotion.

This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule.
With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded.

You can specify `qualifying_item_variation_ids` or `qualifying_category_ids` for a given promotion, but not both. | -| `qualifyingCategoryIds` | `string[] \| null \| undefined` | Optional | The IDs of any qualifying `CATEGORY` [catalog objects](entity:CatalogObject). If specified,
the purchase must include at least one item from one of these categories to qualify for the promotion.

This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule.
With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded.

You can specify `qualifying_category_ids` or `qualifying_item_variation_ids` for a promotion, but not both. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "name": "name4", - "incentive": { - "type": "POINTS_MULTIPLIER", - "points_multiplier_data": { - "points_multiplier": 134, - "multiplier": "multiplier4" - }, - "points_addition_data": { - "points_addition": 218 - } - }, - "available_time": { - "start_date": "start_date4", - "end_date": "end_date8", - "time_periods": [ - "time_periods9" - ] - }, - "trigger_limit": { - "times": 26, - "interval": "ALL_TIME" - }, - "status": "ACTIVE", - "created_at": "created_at8", - "canceled_at": "canceled_at0" -} -``` - diff --git a/doc/models/loyalty-reward-status.md b/doc/models/loyalty-reward-status.md deleted file mode 100644 index 26be27d31..000000000 --- a/doc/models/loyalty-reward-status.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Loyalty Reward Status - -The status of the loyalty reward. - -## Enumeration - -`LoyaltyRewardStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `ISSUED` | The reward is issued. | -| `REDEEMED` | The reward is redeemed. | -| `DELETED` | The reward is deleted. | - diff --git a/doc/models/loyalty-reward.md b/doc/models/loyalty-reward.md deleted file mode 100644 index f5aa89c36..000000000 --- a/doc/models/loyalty-reward.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Loyalty Reward - -Represents a contract to redeem loyalty points for a [reward tier](../../doc/models/loyalty-program-reward-tier.md) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. -For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). - -## Structure - -`LoyaltyReward` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the loyalty reward.
**Constraints**: *Maximum Length*: `36` | -| `status` | [`string \| undefined`](../../doc/models/loyalty-reward-status.md) | Optional | The status of the loyalty reward. | -| `loyaltyAccountId` | `string` | Required | The Square-assigned ID of the [loyalty account](entity:LoyaltyAccount) to which the reward belongs.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `rewardTierId` | `string` | Required | The Square-assigned ID of the [reward tier](entity:LoyaltyProgramRewardTier) used to create the reward.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `points` | `number \| undefined` | Optional | The number of loyalty points used for the reward.
**Constraints**: `>= 1` | -| `orderId` | `string \| null \| undefined` | Optional | The Square-assigned ID of the [order](entity:Order) to which the reward is attached. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the reward was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the reward was last updated, in RFC 3339 format. | -| `redeemedAt` | `string \| undefined` | Optional | The timestamp when the reward was redeemed, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "status": "DELETED", - "loyalty_account_id": "loyalty_account_id4", - "reward_tier_id": "reward_tier_id2", - "points": 114, - "order_id": "order_id0", - "created_at": "created_at4" -} -``` - diff --git a/doc/models/measurement-unit-area.md b/doc/models/measurement-unit-area.md deleted file mode 100644 index c11489141..000000000 --- a/doc/models/measurement-unit-area.md +++ /dev/null @@ -1,22 +0,0 @@ - -# Measurement Unit Area - -Unit of area used to measure a quantity. - -## Enumeration - -`MeasurementUnitArea` - -## Fields - -| Name | Description | -| --- | --- | -| `IMPERIAL_ACRE` | The area is measured in acres. | -| `IMPERIAL_SQUARE_INCH` | The area is measured in square inches. | -| `IMPERIAL_SQUARE_FOOT` | The area is measured in square feet. | -| `IMPERIAL_SQUARE_YARD` | The area is measured in square yards. | -| `IMPERIAL_SQUARE_MILE` | The area is measured in square miles. | -| `METRIC_SQUARE_CENTIMETER` | The area is measured in square centimeters. | -| `METRIC_SQUARE_METER` | The area is measured in square meters. | -| `METRIC_SQUARE_KILOMETER` | The area is measured in square kilometers. | - diff --git a/doc/models/measurement-unit-custom.md b/doc/models/measurement-unit-custom.md deleted file mode 100644 index 736170e51..000000000 --- a/doc/models/measurement-unit-custom.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Measurement Unit Custom - -The information needed to define a custom unit, provided by the seller. - -## Structure - -`MeasurementUnitCustom` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string` | Required | The name of the custom unit, for example "bushel". | -| `abbreviation` | `string` | Required | The abbreviation of the custom unit, such as "bsh" (bushel). This appears
in the cart for the Point of Sale app, and in reports. | - -## Example (as JSON) - -```json -{ - "name": "name8", - "abbreviation": "abbreviation0" -} -``` - diff --git a/doc/models/measurement-unit-generic.md b/doc/models/measurement-unit-generic.md deleted file mode 100644 index 0206fe95f..000000000 --- a/doc/models/measurement-unit-generic.md +++ /dev/null @@ -1,13 +0,0 @@ - -# Measurement Unit Generic - -## Enumeration - -`MeasurementUnitGeneric` - -## Fields - -| Name | Description | -| --- | --- | -| `UNIT` | The generic unit. | - diff --git a/doc/models/measurement-unit-length.md b/doc/models/measurement-unit-length.md deleted file mode 100644 index 82dfc078f..000000000 --- a/doc/models/measurement-unit-length.md +++ /dev/null @@ -1,22 +0,0 @@ - -# Measurement Unit Length - -The unit of length used to measure a quantity. - -## Enumeration - -`MeasurementUnitLength` - -## Fields - -| Name | Description | -| --- | --- | -| `IMPERIAL_INCH` | The length is measured in inches. | -| `IMPERIAL_FOOT` | The length is measured in feet. | -| `IMPERIAL_YARD` | The length is measured in yards. | -| `IMPERIAL_MILE` | The length is measured in miles. | -| `METRIC_MILLIMETER` | The length is measured in millimeters. | -| `METRIC_CENTIMETER` | The length is measured in centimeters. | -| `METRIC_METER` | The length is measured in meters. | -| `METRIC_KILOMETER` | The length is measured in kilometers. | - diff --git a/doc/models/measurement-unit-time.md b/doc/models/measurement-unit-time.md deleted file mode 100644 index 43b8c4ce9..000000000 --- a/doc/models/measurement-unit-time.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Measurement Unit Time - -Unit of time used to measure a quantity (a duration). - -## Enumeration - -`MeasurementUnitTime` - -## Fields - -| Name | Description | -| --- | --- | -| `GENERIC_MILLISECOND` | The time is measured in milliseconds. | -| `GENERIC_SECOND` | The time is measured in seconds. | -| `GENERIC_MINUTE` | The time is measured in minutes. | -| `GENERIC_HOUR` | The time is measured in hours. | -| `GENERIC_DAY` | The time is measured in days. | - diff --git a/doc/models/measurement-unit-unit-type.md b/doc/models/measurement-unit-unit-type.md deleted file mode 100644 index bcf03f399..000000000 --- a/doc/models/measurement-unit-unit-type.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Measurement Unit Unit Type - -Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. - -## Enumeration - -`MeasurementUnitUnitType` - -## Fields - -| Name | Description | -| --- | --- | -| `TYPE_CUSTOM` | The unit details are contained in the custom_unit field. | -| `TYPE_AREA` | The unit details are contained in the area_unit field. | -| `TYPE_LENGTH` | The unit details are contained in the length_unit field. | -| `TYPE_VOLUME` | The unit details are contained in the volume_unit field. | -| `TYPE_WEIGHT` | The unit details are contained in the weight_unit field. | -| `TYPE_GENERIC` | The unit details are contained in the generic_unit field. | - diff --git a/doc/models/measurement-unit-volume.md b/doc/models/measurement-unit-volume.md deleted file mode 100644 index 822a52168..000000000 --- a/doc/models/measurement-unit-volume.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Measurement Unit Volume - -The unit of volume used to measure a quantity. - -## Enumeration - -`MeasurementUnitVolume` - -## Fields - -| Name | Description | -| --- | --- | -| `GENERIC_FLUID_OUNCE` | The volume is measured in ounces. | -| `GENERIC_SHOT` | The volume is measured in shots. | -| `GENERIC_CUP` | The volume is measured in cups. | -| `GENERIC_PINT` | The volume is measured in pints. | -| `GENERIC_QUART` | The volume is measured in quarts. | -| `GENERIC_GALLON` | The volume is measured in gallons. | -| `IMPERIAL_CUBIC_INCH` | The volume is measured in cubic inches. | -| `IMPERIAL_CUBIC_FOOT` | The volume is measured in cubic feet. | -| `IMPERIAL_CUBIC_YARD` | The volume is measured in cubic yards. | -| `METRIC_MILLILITER` | The volume is measured in metric milliliters. | -| `METRIC_LITER` | The volume is measured in metric liters. | - diff --git a/doc/models/measurement-unit-weight.md b/doc/models/measurement-unit-weight.md deleted file mode 100644 index 1b81d26e3..000000000 --- a/doc/models/measurement-unit-weight.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Measurement Unit Weight - -Unit of weight used to measure a quantity. - -## Enumeration - -`MeasurementUnitWeight` - -## Fields - -| Name | Description | -| --- | --- | -| `IMPERIAL_WEIGHT_OUNCE` | The weight is measured in ounces. | -| `IMPERIAL_POUND` | The weight is measured in pounds. | -| `IMPERIAL_STONE` | The weight is measured in stones. | -| `METRIC_MILLIGRAM` | The weight is measured in milligrams. | -| `METRIC_GRAM` | The weight is measured in grams. | -| `METRIC_KILOGRAM` | The weight is measured in kilograms. | - diff --git a/doc/models/measurement-unit.md b/doc/models/measurement-unit.md deleted file mode 100644 index e529d41ce..000000000 --- a/doc/models/measurement-unit.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Measurement Unit - -Represents a unit of measurement to use with a quantity, such as ounces -or inches. Exactly one of the following fields are required: `custom_unit`, -`area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. - -## Structure - -`MeasurementUnit` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customUnit` | [`MeasurementUnitCustom \| undefined`](../../doc/models/measurement-unit-custom.md) | Optional | The information needed to define a custom unit, provided by the seller. | -| `areaUnit` | [`string \| undefined`](../../doc/models/measurement-unit-area.md) | Optional | Unit of area used to measure a quantity. | -| `lengthUnit` | [`string \| undefined`](../../doc/models/measurement-unit-length.md) | Optional | The unit of length used to measure a quantity. | -| `volumeUnit` | [`string \| undefined`](../../doc/models/measurement-unit-volume.md) | Optional | The unit of volume used to measure a quantity. | -| `weightUnit` | [`string \| undefined`](../../doc/models/measurement-unit-weight.md) | Optional | Unit of weight used to measure a quantity. | -| `genericUnit` | [`string \| undefined`](../../doc/models/measurement-unit-generic.md) | Optional | - | -| `timeUnit` | [`string \| undefined`](../../doc/models/measurement-unit-time.md) | Optional | Unit of time used to measure a quantity (a duration). | -| `type` | [`string \| undefined`](../../doc/models/measurement-unit-unit-type.md) | Optional | Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. | - -## Example (as JSON) - -```json -{ - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_SQUARE_MILE", - "length_unit": "METRIC_MILLIMETER", - "volume_unit": "IMPERIAL_CUBIC_INCH", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" -} -``` - diff --git a/doc/models/merchant-status.md b/doc/models/merchant-status.md deleted file mode 100644 index 9e3e199d1..000000000 --- a/doc/models/merchant-status.md +++ /dev/null @@ -1,14 +0,0 @@ - -# Merchant Status - -## Enumeration - -`MerchantStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `ACTIVE` | A fully operational merchant account. The merchant can interact with Square products and APIs. | -| `INACTIVE` | A functionally limited merchant account. The merchant can only have limited interaction
via Square APIs. The merchant cannot log in or access the seller dashboard. | - diff --git a/doc/models/merchant.md b/doc/models/merchant.md deleted file mode 100644 index b13f6f8d5..000000000 --- a/doc/models/merchant.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Merchant - -Represents a business that sells with Square. - -## Structure - -`Merchant` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-issued ID of the merchant. | -| `businessName` | `string \| null \| undefined` | Optional | The name of the merchant's overall business. | -| `country` | [`string`](../../doc/models/country.md) | Required | Indicates the country associated with another entity, such as a business.
Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | -| `languageCode` | `string \| null \| undefined` | Optional | The code indicating the [language preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences) of the merchant, in [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). For example, `en-US` or `fr-CA`. | -| `currency` | [`string \| undefined`](../../doc/models/currency.md) | Optional | Indicates the associated currency for an amount of money. Values correspond
to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). | -| `status` | [`string \| undefined`](../../doc/models/merchant-status.md) | Optional | - | -| `mainLocationId` | `string \| null \| undefined` | Optional | The ID of the [main `Location`](https://developer.squareup.com/docs/locations-api#about-the-main-location) for this merchant. | -| `createdAt` | `string \| undefined` | Optional | The time when the merchant was created, in RFC 3339 format.
For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). | - -## Example (as JSON) - -```json -{ - "id": "id2", - "business_name": "business_name6", - "country": "HM", - "language_code": "language_code0", - "currency": "BTC", - "status": "ACTIVE" -} -``` - diff --git a/doc/models/modifier-location-overrides.md b/doc/models/modifier-location-overrides.md deleted file mode 100644 index f60099834..000000000 --- a/doc/models/modifier-location-overrides.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Modifier Location Overrides - -Location-specific overrides for specified properties of a `CatalogModifier` object. - -## Structure - -`ModifierLocationOverrides` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the `Location` object representing the location. This can include a deactivated location. | -| `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. | -| `soldOut` | `boolean \| undefined` | Optional | Indicates whether the modifier is sold out at the specified location or not. As an example, for cheese (modifier) burger (item), when the modifier is sold out, it is the cheese, but not the burger, that is sold out.
The seller can manually set this sold out status. Attempts by an application to set this attribute are ignored. | - -## Example (as JSON) - -```json -{ - "location_id": "location_id2", - "price_money": { - "amount": 202, - "currency": "GTQ" - }, - "sold_out": false -} -``` - diff --git a/doc/models/money.md b/doc/models/money.md deleted file mode 100644 index be5e68336..000000000 --- a/doc/models/money.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Money - -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. - -## Structure - -`Money` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amount` | `bigint \| null \| undefined` | Optional | The amount of money, in the smallest denomination of the currency
indicated by `currency`. For example, when `currency` is `USD`, `amount` is
in cents. Monetary amounts can be positive or negative. See the specific
field description to determine the meaning of the sign in a particular case. | -| `currency` | [`string \| undefined`](../../doc/models/currency.md) | Optional | Indicates the associated currency for an amount of money. Values correspond
to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). | - -## Example (as JSON) - -```json -{ - "amount": 36, - "currency": "AZN" -} -``` - diff --git a/doc/models/obtain-token-request.md b/doc/models/obtain-token-request.md deleted file mode 100644 index 3e16ab9d1..000000000 --- a/doc/models/obtain-token-request.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Obtain Token Request - -## Structure - -`ObtainTokenRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `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 \| null \| 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 \| null \| 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 \| null \| 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 \| null \| 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 \| null \| 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[] \| null \| 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 \| null \| 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 \| null \| 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) - -```json -{ - "client_id": "APPLICATION_ID", - "client_secret": "APPLICATION_SECRET", - "code": "CODE_FROM_AUTHORIZE", - "grant_type": "authorization_code", - "redirect_uri": "redirect_uri6", - "refresh_token": "refresh_token8", - "migration_token": "migration_token6" -} -``` - diff --git a/doc/models/obtain-token-response.md b/doc/models/obtain-token-response.md deleted file mode 100644 index 2864ff206..000000000 --- a/doc/models/obtain-token-response.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Obtain Token Response - -## Structure - -`ObtainTokenResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `accessToken` | `string \| undefined` | Optional | A valid OAuth access token.
Provide the access token in a header with every request to Connect API
endpoints. For more information, see [OAuth API: Walkthrough](https://developer.squareup.com/docs/oauth-api/walkthrough).
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | -| `tokenType` | `string \| undefined` | Optional | This value is always _bearer_.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `10` | -| `expiresAt` | `string \| undefined` | Optional | The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `48` | -| `merchantId` | `string \| undefined` | Optional | The ID of the authorizing merchant's business.
**Constraints**: *Minimum Length*: `8`, *Maximum Length*: `191` | -| `subscriptionId` | `string \| undefined` | Optional | __LEGACY FIELD__. The ID of a subscription plan the merchant signed up
for. The ID is only present if the merchant signed up for a subscription plan during authorization. | -| `planId` | `string \| undefined` | Optional | __LEGACY FIELD__. The ID of the subscription plan the merchant signed
up for. The ID is only present if the merchant signed up for a subscription plan during
authorization. | -| `idToken` | `string \| undefined` | Optional | The OpenID token belonging to this person. This token is only present if the
OPENID scope is included in the authorization request. | -| `refreshToken` | `string \| undefined` | Optional | A refresh token.
For more information, see [Refresh, Revoke, and Limit the Scope of OAuth Tokens](https://developer.squareup.com/docs/oauth-api/refresh-revoke-limit-scope).
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | -| `shortLived` | `boolean \| undefined` | Optional | A Boolean indicating that the access token is a short-lived access token.
The short-lived access token returned in the response expires in 24 hours. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `refreshTokenExpiresAt` | `string \| undefined` | Optional | The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `48` | - -## Example (as JSON) - -```json -{ - "access_token": "ACCESS_TOKEN", - "expires_at": "2006-01-02T15:04:05Z", - "merchant_id": "MERCHANT_ID", - "refresh_token": "REFRESH_TOKEN", - "token_type": "bearer", - "subscription_id": "subscription_id8" -} -``` - diff --git a/doc/models/offline-payment-details.md b/doc/models/offline-payment-details.md deleted file mode 100644 index 962a5bac6..000000000 --- a/doc/models/offline-payment-details.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Offline Payment Details - -Details specific to offline payments. - -## Structure - -`OfflinePaymentDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `clientCreatedAt` | `string \| undefined` | Optional | The client-side timestamp of when the offline payment was created, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | - -## Example (as JSON) - -```json -{ - "client_created_at": "client_created_at6" -} -``` - diff --git a/doc/models/order-created-object.md b/doc/models/order-created-object.md deleted file mode 100644 index 54dabf253..000000000 --- a/doc/models/order-created-object.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Order Created Object - -## Structure - -`OrderCreatedObject` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderCreated` | [`OrderCreated \| undefined`](../../doc/models/order-created.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "order_created": { - "order_id": "order_id8", - "version": 170, - "location_id": "location_id8", - "state": "CANCELED", - "created_at": "created_at2" - } -} -``` - diff --git a/doc/models/order-created.md b/doc/models/order-created.md deleted file mode 100644 index 93c2388d2..000000000 --- a/doc/models/order-created.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Order Created - -## Structure - -`OrderCreated` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string \| null \| undefined` | Optional | The order's unique ID. | -| `version` | `number \| undefined` | Optional | The version number, which is incremented each time an update is committed to the order.
Orders that were not created through the API do not include a version number and
therefore cannot be updated.

[Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the seller location that this order is associated with. | -| `state` | [`string \| undefined`](../../doc/models/order-state.md) | Optional | The state of the order. | -| `createdAt` | `string \| undefined` | Optional | The timestamp for when the order was created, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "order_id": "order_id8", - "version": 86, - "location_id": "location_id8", - "state": "CANCELED", - "created_at": "created_at2" -} -``` - diff --git a/doc/models/order-entry.md b/doc/models/order-entry.md deleted file mode 100644 index 985cf2e31..000000000 --- a/doc/models/order-entry.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Order Entry - -A lightweight description of an [order](../../doc/models/order.md) that is returned when -`returned_entries` is `true` on a [SearchOrdersRequest](../../doc/api/orders.md#search-orders). - -## Structure - -`OrderEntry` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string \| null \| undefined` | Optional | The ID of the order. | -| `version` | `number \| undefined` | Optional | The version number, which is incremented each time an update is committed to the order.
Orders that were not created through the API do not include a version number and
therefore cannot be updated.

[Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) | -| `locationId` | `string \| null \| undefined` | Optional | The location ID the order belongs to. | - -## Example (as JSON) - -```json -{ - "order_id": "order_id0", - "version": 72, - "location_id": "location_id0" -} -``` - diff --git a/doc/models/order-fulfillment-delivery-details-schedule-type.md b/doc/models/order-fulfillment-delivery-details-schedule-type.md deleted file mode 100644 index 31e92720a..000000000 --- a/doc/models/order-fulfillment-delivery-details-schedule-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Order Fulfillment Delivery Details Schedule Type - -The schedule type of the delivery fulfillment. - -## Enumeration - -`OrderFulfillmentDeliveryDetailsScheduleType` - -## Fields - -| Name | Description | -| --- | --- | -| `SCHEDULED` | Indicates the fulfillment to deliver at a scheduled deliver time. | -| `ASAP` | Indicates that the fulfillment to deliver as soon as possible and should be prepared
immediately. | - diff --git a/doc/models/order-fulfillment-delivery-details.md b/doc/models/order-fulfillment-delivery-details.md deleted file mode 100644 index c490c58cd..000000000 --- a/doc/models/order-fulfillment-delivery-details.md +++ /dev/null @@ -1,61 +0,0 @@ - -# Order Fulfillment Delivery Details - -Describes delivery details of an order fulfillment. - -## Structure - -`OrderFulfillmentDeliveryDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipient` | [`OrderFulfillmentRecipient \| undefined`](../../doc/models/order-fulfillment-recipient.md) | Optional | Information about the fulfillment recipient. | -| `scheduleType` | [`string \| undefined`](../../doc/models/order-fulfillment-delivery-details-schedule-type.md) | Optional | The schedule type of the delivery fulfillment. | -| `placedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was placed.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". | -| `deliverAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
that represents the start of the delivery period.
When the fulfillment `schedule_type` is `ASAP`, the field is automatically
set to the current time plus the `prep_time_duration`.
Otherwise, the application can set this field while the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the
terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`).

The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `prepTimeDuration` | `string \| null \| undefined` | Optional | The duration of time it takes to prepare and deliver this fulfillment.
The duration must be in RFC 3339 format (for example, "P1W3D"). | -| `deliveryWindowDuration` | `string \| null \| undefined` | Optional | The time period after `deliver_at` in which to deliver the order.
Applications can set this field when the fulfillment `state` is
`PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state
such as `COMPLETED`, `CANCELED`, and `FAILED`).
The duration must be in RFC 3339 format (for example, "P1W3D"). | -| `note` | `string \| null \| undefined` | Optional | Provides additional instructions about the delivery fulfillment.
It is displayed in the Square Point of Sale application and set by the API.
**Constraints**: *Maximum Length*: `550` | -| `completedAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicates when the seller completed the fulfillment.
This field is automatically set when fulfillment `state` changes to `COMPLETED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `inProgressAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicates when the seller started processing the fulfillment.
This field is automatically set when the fulfillment `state` changes to `RESERVED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `rejectedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was rejected. This field is
automatically set when the fulfillment `state` changes to `FAILED`.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `readyAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the seller marked the fulfillment as ready for
courier pickup. This field is automatically set when the fulfillment `state` changes
to PREPARED.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `deliveredAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was delivered to the recipient.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `canceledAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was canceled. This field is automatically
set when the fulfillment `state` changes to `CANCELED`.

The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `cancelReason` | `string \| null \| undefined` | Optional | The delivery cancellation reason. Max length: 100 characters.
**Constraints**: *Maximum Length*: `100` | -| `courierPickupAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when an order can be picked up by the courier for delivery.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `courierPickupWindowDuration` | `string \| null \| undefined` | Optional | The time period after `courier_pickup_at` in which the courier should pick up the order.
The duration must be in RFC 3339 format (for example, "P1W3D"). | -| `isNoContactDelivery` | `boolean \| null \| undefined` | Optional | Whether the delivery is preferred to be no contact. | -| `dropoffNotes` | `string \| null \| undefined` | Optional | A note to provide additional instructions about how to deliver the order.
**Constraints**: *Maximum Length*: `550` | -| `courierProviderName` | `string \| null \| undefined` | Optional | The name of the courier provider.
**Constraints**: *Maximum Length*: `255` | -| `courierSupportPhoneNumber` | `string \| null \| undefined` | Optional | The support phone number of the courier.
**Constraints**: *Maximum Length*: `17` | -| `squareDeliveryId` | `string \| null \| undefined` | Optional | The identifier for the delivery created by Square.
**Constraints**: *Maximum Length*: `50` | -| `externalDeliveryId` | `string \| null \| undefined` | Optional | The identifier for the delivery created by the third-party courier service.
**Constraints**: *Maximum Length*: `50` | -| `managedDelivery` | `boolean \| null \| undefined` | Optional | The flag to indicate the delivery is managed by a third party (ie DoorDash), which means
we may not receive all recipient information for PII purposes. | - -## Example (as JSON) - -```json -{ - "recipient": { - "customer_id": "customer_id6", - "display_name": "display_name8", - "email_address": "email_address4", - "phone_number": "phone_number4", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "schedule_type": "SCHEDULED", - "placed_at": "placed_at6", - "deliver_at": "deliver_at2", - "prep_time_duration": "prep_time_duration6" -} -``` - diff --git a/doc/models/order-fulfillment-fulfillment-entry.md b/doc/models/order-fulfillment-fulfillment-entry.md deleted file mode 100644 index 0a9672821..000000000 --- a/doc/models/order-fulfillment-fulfillment-entry.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Order Fulfillment Fulfillment Entry - -Links an order line item to a fulfillment. Each entry must reference -a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to -fulfill. - -## Structure - -`OrderFulfillmentFulfillmentEntry` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the fulfillment entry only within this order.
**Constraints**: *Maximum Length*: `60` | -| `lineItemUid` | `string` | Required | The `uid` from the order line item.
**Constraints**: *Minimum Length*: `1` | -| `quantity` | `string` | Required | The quantity of the line item being fulfilled, formatted as a decimal number.
For example, `"3"`.
Fulfillments for line items with a `quantity_unit` can have non-integer quantities.
For example, `"1.70000"`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `12` | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this fulfillment entry. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).
Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.
Values have a maximum length of 255 characters.
An application can have up to 10 entries per metadata field.
Entries written by applications are private and can only be read or modified by the same
application.
For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | - -## Example (as JSON) - -```json -{ - "uid": "uid6", - "line_item_uid": "line_item_uid6", - "quantity": "quantity2", - "metadata": { - "key0": "metadata7", - "key1": "metadata8", - "key2": "metadata9" - } -} -``` - diff --git a/doc/models/order-fulfillment-fulfillment-line-item-application.md b/doc/models/order-fulfillment-fulfillment-line-item-application.md deleted file mode 100644 index 41268cb5c..000000000 --- a/doc/models/order-fulfillment-fulfillment-line-item-application.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Order Fulfillment Fulfillment Line Item Application - -The `line_item_application` describes what order line items this fulfillment applies -to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. - -## Enumeration - -`OrderFulfillmentFulfillmentLineItemApplication` - -## Fields - -| Name | Description | -| --- | --- | -| `ALL` | If `ALL`, `entries` must be unset. | -| `ENTRY_LIST` | If `ENTRY_LIST`, supply a list of `entries`. | - diff --git a/doc/models/order-fulfillment-pickup-details-curbside-pickup-details.md b/doc/models/order-fulfillment-pickup-details-curbside-pickup-details.md deleted file mode 100644 index c85e09d79..000000000 --- a/doc/models/order-fulfillment-pickup-details-curbside-pickup-details.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Order Fulfillment Pickup Details Curbside Pickup Details - -Specific details for curbside pickup. - -## Structure - -`OrderFulfillmentPickupDetailsCurbsidePickupDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `curbsideDetails` | `string \| null \| undefined` | Optional | Specific details for curbside pickup, such as parking number and vehicle model.
**Constraints**: *Maximum Length*: `250` | -| `buyerArrivedAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | - -## Example (as JSON) - -```json -{ - "curbside_details": "curbside_details8", - "buyer_arrived_at": "buyer_arrived_at4" -} -``` - diff --git a/doc/models/order-fulfillment-pickup-details-schedule-type.md b/doc/models/order-fulfillment-pickup-details-schedule-type.md deleted file mode 100644 index 6e774d4ab..000000000 --- a/doc/models/order-fulfillment-pickup-details-schedule-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Order Fulfillment Pickup Details Schedule Type - -The schedule type of the pickup fulfillment. - -## Enumeration - -`OrderFulfillmentPickupDetailsScheduleType` - -## Fields - -| Name | Description | -| --- | --- | -| `SCHEDULED` | Indicates that the fulfillment will be picked up at a scheduled pickup time. | -| `ASAP` | Indicates that the fulfillment will be picked up as soon as possible and
should be prepared immediately. | - diff --git a/doc/models/order-fulfillment-pickup-details.md b/doc/models/order-fulfillment-pickup-details.md deleted file mode 100644 index 004b92583..000000000 --- a/doc/models/order-fulfillment-pickup-details.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Order Fulfillment Pickup Details - -Contains details necessary to fulfill a pickup order. - -## Structure - -`OrderFulfillmentPickupDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipient` | [`OrderFulfillmentRecipient \| undefined`](../../doc/models/order-fulfillment-recipient.md) | Optional | Information about the fulfillment recipient. | -| `expiresAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment expires if it is not marked in progress. The timestamp must be
in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set
up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order
are automatically completed. | -| `autoCompleteDuration` | `string \| null \| undefined` | Optional | The duration of time after which an in progress pickup fulfillment is automatically moved
to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D").

If not set, this pickup fulfillment remains in progress until it is canceled or completed. | -| `scheduleType` | [`string \| undefined`](../../doc/models/order-fulfillment-pickup-details-schedule-type.md) | Optional | The schedule type of the pickup fulfillment. | -| `pickupAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g.,
"2016-09-04T23:59:33.123Z".
For fulfillments with the schedule type `ASAP`, this is automatically set
to the current time plus the expected duration to prepare the fulfillment. | -| `pickupWindowDuration` | `string \| null \| undefined` | Optional | The window of time in which the order should be picked up after the `pickup_at` timestamp.
Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an
informational guideline for merchants. | -| `prepTimeDuration` | `string \| null \| undefined` | Optional | The duration of time it takes to prepare this fulfillment.
The duration must be in RFC 3339 format (for example, "P1W3D"). | -| `note` | `string \| null \| undefined` | Optional | A note to provide additional instructions about the pickup
fulfillment displayed in the Square Point of Sale application and set by the API.
**Constraints**: *Maximum Length*: `500` | -| `placedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `acceptedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `rejectedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `readyAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `expiredAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment expired. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `pickedUpAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `canceledAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `cancelReason` | `string \| null \| undefined` | Optional | A description of why the pickup was canceled. The maximum length: 100 characters.
**Constraints**: *Maximum Length*: `100` | -| `isCurbsidePickup` | `boolean \| null \| undefined` | Optional | If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. | -| `curbsidePickupDetails` | [`OrderFulfillmentPickupDetailsCurbsidePickupDetails \| undefined`](../../doc/models/order-fulfillment-pickup-details-curbside-pickup-details.md) | Optional | Specific details for curbside pickup. | - -## Example (as JSON) - -```json -{ - "recipient": { - "customer_id": "customer_id6", - "display_name": "display_name8", - "email_address": "email_address4", - "phone_number": "phone_number4", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "expires_at": "expires_at0", - "auto_complete_duration": "auto_complete_duration0", - "schedule_type": "SCHEDULED", - "pickup_at": "pickup_at8" -} -``` - diff --git a/doc/models/order-fulfillment-recipient.md b/doc/models/order-fulfillment-recipient.md deleted file mode 100644 index 217e1184e..000000000 --- a/doc/models/order-fulfillment-recipient.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Order Fulfillment Recipient - -Information about the fulfillment recipient. - -## Structure - -`OrderFulfillmentRecipient` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string \| null \| undefined` | Optional | The ID of the customer associated with the fulfillment.
If `customer_id` is provided, the fulfillment recipient's `display_name`,
`email_address`, and `phone_number` are automatically populated from the
targeted customer profile. If these fields are set in the request, the request
values override the information from the customer profile. If the
targeted customer profile does not contain the necessary information and
these fields are left unset, the request results in an error.
**Constraints**: *Maximum Length*: `191` | -| `displayName` | `string \| null \| undefined` | Optional | The display name of the fulfillment recipient. This field is required.
If provided, the display name overrides the corresponding customer profile value
indicated by `customer_id`.
**Constraints**: *Maximum Length*: `255` | -| `emailAddress` | `string \| null \| undefined` | Optional | The email address of the fulfillment recipient.
If provided, the email address overrides the corresponding customer profile value
indicated by `customer_id`.
**Constraints**: *Maximum Length*: `255` | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number of the fulfillment recipient. This field is required.
If provided, the phone number overrides the corresponding customer profile value
indicated by `customer_id`.
**Constraints**: *Maximum Length*: `17` | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | - -## Example (as JSON) - -```json -{ - "customer_id": "customer_id0", - "display_name": "display_name2", - "email_address": "email_address0", - "phone_number": "phone_number0", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } -} -``` - diff --git a/doc/models/order-fulfillment-shipment-details.md b/doc/models/order-fulfillment-shipment-details.md deleted file mode 100644 index 7dd36e45b..000000000 --- a/doc/models/order-fulfillment-shipment-details.md +++ /dev/null @@ -1,53 +0,0 @@ - -# Order Fulfillment Shipment Details - -Contains the details necessary to fulfill a shipment order. - -## Structure - -`OrderFulfillmentShipmentDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `recipient` | [`OrderFulfillmentRecipient \| undefined`](../../doc/models/order-fulfillment-recipient.md) | Optional | Information about the fulfillment recipient. | -| `carrier` | `string \| null \| undefined` | Optional | The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS).
**Constraints**: *Maximum Length*: `50` | -| `shippingNote` | `string \| null \| undefined` | Optional | A note with additional information for the shipping carrier.
**Constraints**: *Maximum Length*: `500` | -| `shippingType` | `string \| null \| undefined` | Optional | A description of the type of shipping product purchased from the carrier
(such as First Class, Priority, or Express).
**Constraints**: *Maximum Length*: `50` | -| `trackingNumber` | `string \| null \| undefined` | Optional | The reference number provided by the carrier to track the shipment's progress.
**Constraints**: *Maximum Length*: `100` | -| `trackingUrl` | `string \| null \| undefined` | Optional | A link to the tracking webpage on the carrier's website.
**Constraints**: *Maximum Length*: `2000` | -| `placedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the shipment was requested. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `inProgressAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation
of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `packagedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the
fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `expectedShippedAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the shipment is expected to be delivered to the shipping carrier.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `shippedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that
the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `canceledAt` | `string \| null \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating the shipment was canceled.
The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `cancelReason` | `string \| null \| undefined` | Optional | A description of why the shipment was canceled.
**Constraints**: *Maximum Length*: `100` | -| `failedAt` | `string \| undefined` | Optional | The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format
(for example, "2016-09-04T23:59:33.123Z"). | -| `failureReason` | `string \| null \| undefined` | Optional | A description of why the shipment failed to be completed.
**Constraints**: *Maximum Length*: `100` | - -## Example (as JSON) - -```json -{ - "recipient": { - "customer_id": "customer_id6", - "display_name": "display_name8", - "email_address": "email_address4", - "phone_number": "phone_number4", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "carrier": "carrier4", - "shipping_note": "shipping_note8", - "shipping_type": "shipping_type4", - "tracking_number": "tracking_number0" -} -``` - diff --git a/doc/models/order-fulfillment-state.md b/doc/models/order-fulfillment-state.md deleted file mode 100644 index 0885e8213..000000000 --- a/doc/models/order-fulfillment-state.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Order Fulfillment State - -The current state of this fulfillment. - -## Enumeration - -`OrderFulfillmentState` - -## Fields - -| Name | Description | -| --- | --- | -| `PROPOSED` | Indicates that the fulfillment has been proposed. | -| `RESERVED` | Indicates that the fulfillment has been reserved. | -| `PREPARED` | Indicates that the fulfillment has been prepared. | -| `COMPLETED` | Indicates that the fulfillment was successfully completed. | -| `CANCELED` | Indicates that the fulfillment was canceled. | -| `FAILED` | Indicates that the fulfillment failed to be completed, but was not explicitly
canceled. | - diff --git a/doc/models/order-fulfillment-type.md b/doc/models/order-fulfillment-type.md deleted file mode 100644 index 7370fba83..000000000 --- a/doc/models/order-fulfillment-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Order Fulfillment Type - -The type of fulfillment. - -## Enumeration - -`OrderFulfillmentType` - -## Fields - -| Name | Description | -| --- | --- | -| `PICKUP` | A recipient to pick up the fulfillment from a physical [location](../../doc/models/location.md). | -| `SHIPMENT` | A shipping carrier to ship the fulfillment. | -| `DELIVERY` | A courier to deliver the fulfillment. | - diff --git a/doc/models/order-fulfillment-updated-object.md b/doc/models/order-fulfillment-updated-object.md deleted file mode 100644 index 147ccd1d9..000000000 --- a/doc/models/order-fulfillment-updated-object.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Order Fulfillment Updated Object - -## Structure - -`OrderFulfillmentUpdatedObject` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderFulfillmentUpdated` | [`OrderFulfillmentUpdated \| undefined`](../../doc/models/order-fulfillment-updated.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "order_fulfillment_updated": { - "order_id": "order_id8", - "version": 174, - "location_id": "location_id8", - "state": "CANCELED", - "created_at": "created_at2" - } -} -``` - diff --git a/doc/models/order-fulfillment-updated-update.md b/doc/models/order-fulfillment-updated-update.md deleted file mode 100644 index badaeeefb..000000000 --- a/doc/models/order-fulfillment-updated-update.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Order Fulfillment Updated Update - -Information about fulfillment updates. - -## Structure - -`OrderFulfillmentUpdatedUpdate` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `fulfillmentUid` | `string \| null \| undefined` | Optional | A unique ID that identifies the fulfillment only within this order. | -| `oldState` | [`string \| undefined`](../../doc/models/fulfillment-state.md) | Optional | The current state of this fulfillment. | -| `newState` | [`string \| undefined`](../../doc/models/fulfillment-state.md) | Optional | The current state of this fulfillment. | - -## Example (as JSON) - -```json -{ - "fulfillment_uid": "fulfillment_uid6", - "old_state": "CANCELED", - "new_state": "PREPARED" -} -``` - diff --git a/doc/models/order-fulfillment-updated.md b/doc/models/order-fulfillment-updated.md deleted file mode 100644 index 136c4b2ac..000000000 --- a/doc/models/order-fulfillment-updated.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Order Fulfillment Updated - -## Structure - -`OrderFulfillmentUpdated` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string \| null \| undefined` | Optional | The order's unique ID. | -| `version` | `number \| undefined` | Optional | The version number, which is incremented each time an update is committed to the order.
Orders that were not created through the API do not include a version number and
therefore cannot be updated.

[Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the seller location that this order is associated with. | -| `state` | [`string \| undefined`](../../doc/models/order-state.md) | Optional | The state of the order. | -| `createdAt` | `string \| undefined` | Optional | The timestamp for when the order was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp for when the order was last updated, in RFC 3339 format. | -| `fulfillmentUpdate` | [`OrderFulfillmentUpdatedUpdate[] \| null \| undefined`](../../doc/models/order-fulfillment-updated-update.md) | Optional | The fulfillments that were updated with this version change. | - -## Example (as JSON) - -```json -{ - "order_id": "order_id0", - "version": 8, - "location_id": "location_id0", - "state": "OPEN", - "created_at": "created_at4" -} -``` - diff --git a/doc/models/order-fulfillment.md b/doc/models/order-fulfillment.md deleted file mode 100644 index 833339546..000000000 --- a/doc/models/order-fulfillment.md +++ /dev/null @@ -1,68 +0,0 @@ - -# Order Fulfillment - -Contains details about how to fulfill this order. -Orders can only be created with at most one fulfillment using the API. -However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. - -## Structure - -`OrderFulfillment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the fulfillment only within this order.
**Constraints**: *Maximum Length*: `60` | -| `type` | [`string \| undefined`](../../doc/models/order-fulfillment-type.md) | Optional | The type of fulfillment. | -| `state` | [`string \| undefined`](../../doc/models/order-fulfillment-state.md) | Optional | The current state of this fulfillment. | -| `lineItemApplication` | [`string \| undefined`](../../doc/models/order-fulfillment-fulfillment-line-item-application.md) | Optional | The `line_item_application` describes what order line items this fulfillment applies
to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. | -| `entries` | [`OrderFulfillmentFulfillmentEntry[] \| undefined`](../../doc/models/order-fulfillment-fulfillment-entry.md) | Optional | A list of entries pertaining to the fulfillment of an order. Each entry must reference
a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to
fulfill.
Multiple entries can reference the same line item `uid`, as long as the total quantity among
all fulfillment entries referencing a single line item does not exceed the quantity of the
order's line item itself.
An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`,
`CANCELED`, or `FAILED`. Fulfillments can be created and completed independently
before order completion. | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this fulfillment. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).
Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.
Values have a maximum length of 255 characters.
An application can have up to 10 entries per metadata field.
Entries written by applications are private and can only be read or modified by the same
application.
For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | -| `pickupDetails` | [`OrderFulfillmentPickupDetails \| undefined`](../../doc/models/order-fulfillment-pickup-details.md) | Optional | Contains details necessary to fulfill a pickup order. | -| `shipmentDetails` | [`OrderFulfillmentShipmentDetails \| undefined`](../../doc/models/order-fulfillment-shipment-details.md) | Optional | Contains the details necessary to fulfill a shipment order. | -| `deliveryDetails` | [`OrderFulfillmentDeliveryDetails \| undefined`](../../doc/models/order-fulfillment-delivery-details.md) | Optional | Describes delivery details of an order fulfillment. | - -## Example (as JSON) - -```json -{ - "uid": "uid8", - "type": "PICKUP", - "state": "PROPOSED", - "line_item_application": "ALL", - "entries": [ - { - "uid": "uid0", - "line_item_uid": "line_item_uid0", - "quantity": "quantity6", - "metadata": { - "key0": "metadata3", - "key1": "metadata4", - "key2": "metadata5" - } - }, - { - "uid": "uid0", - "line_item_uid": "line_item_uid0", - "quantity": "quantity6", - "metadata": { - "key0": "metadata3", - "key1": "metadata4", - "key2": "metadata5" - } - }, - { - "uid": "uid0", - "line_item_uid": "line_item_uid0", - "quantity": "quantity6", - "metadata": { - "key0": "metadata3", - "key1": "metadata4", - "key2": "metadata5" - } - } - ] -} -``` - diff --git a/doc/models/order-line-item-applied-discount.md b/doc/models/order-line-item-applied-discount.md deleted file mode 100644 index 5e68490cb..000000000 --- a/doc/models/order-line-item-applied-discount.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Order Line Item Applied Discount - -Represents an applied portion of a discount to a line item in an order. - -Order scoped discounts have automatically applied discounts present for each line item. -Line-item scoped discounts must have applied discounts added manually for any applicable line -items. The corresponding applied money is automatically computed based on participating -line items. - -## Structure - -`OrderLineItemAppliedDiscount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the applied discount only within this order.
**Constraints**: *Maximum Length*: `60` | -| `discountUid` | `string` | Required | The `uid` of the discount that the applied discount represents. It must
reference a discount present in the `order.discounts` field.

This field is immutable. To change which discounts apply to a line item,
you must delete the discount and re-add it as a new `OrderLineItemAppliedDiscount`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `60` | -| `appliedMoney` | [`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 -{ - "uid": "uid2", - "discount_uid": "discount_uid2", - "applied_money": { - "amount": 196, - "currency": "AMD" - } -} -``` - diff --git a/doc/models/order-line-item-applied-service-charge.md b/doc/models/order-line-item-applied-service-charge.md deleted file mode 100644 index 5afc60a51..000000000 --- a/doc/models/order-line-item-applied-service-charge.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Order Line Item Applied Service Charge - -## Structure - -`OrderLineItemAppliedServiceCharge` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the applied service charge only within this order.
**Constraints**: *Maximum Length*: `60` | -| `serviceChargeUid` | `string` | Required | The `uid` of the service charge that the applied service charge represents. It must
reference a service charge present in the `order.service_charges` field.

This field is immutable. To change which service charges apply to a line item,
delete and add a new `OrderLineItemAppliedServiceCharge`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `60` | -| `appliedMoney` | [`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 -{ - "uid": "uid8", - "service_charge_uid": "service_charge_uid8", - "applied_money": { - "amount": 196, - "currency": "AMD" - } -} -``` - diff --git a/doc/models/order-line-item-applied-tax.md b/doc/models/order-line-item-applied-tax.md deleted file mode 100644 index 0f5767667..000000000 --- a/doc/models/order-line-item-applied-tax.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Order Line Item Applied Tax - -Represents an applied portion of a tax to a line item in an order. - -Order-scoped taxes automatically include the applied taxes in each line item. -Line item taxes must be referenced from any applicable line items. -The corresponding applied money is automatically computed, based on the -set of participating line items. - -## Structure - -`OrderLineItemAppliedTax` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the applied tax only within this order.
**Constraints**: *Maximum Length*: `60` | -| `taxUid` | `string` | Required | The `uid` of the tax for which this applied tax represents. It must reference
a tax present in the `order.taxes` field.

This field is immutable. To change which taxes apply to a line item, delete and add a new
`OrderLineItemAppliedTax`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `60` | -| `appliedMoney` | [`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 -{ - "uid": "uid8", - "tax_uid": "tax_uid6", - "applied_money": { - "amount": 196, - "currency": "AMD" - } -} -``` - diff --git a/doc/models/order-line-item-discount-scope.md b/doc/models/order-line-item-discount-scope.md deleted file mode 100644 index ccb5bb8a8..000000000 --- a/doc/models/order-line-item-discount-scope.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Order Line Item Discount Scope - -Indicates whether this is a line-item or order-level discount. - -## Enumeration - -`OrderLineItemDiscountScope` - -## Fields - -| Name | Description | -| --- | --- | -| `OTHER_DISCOUNT_SCOPE` | Used for reporting only.
The original transaction discount scope is currently not supported by the API. | -| `LINE_ITEM` | The discount should be applied to only line items specified by
`OrderLineItemAppliedDiscount` reference records. | -| `ORDER` | The discount should be applied to the entire order. | - diff --git a/doc/models/order-line-item-discount-type.md b/doc/models/order-line-item-discount-type.md deleted file mode 100644 index 99dc297fe..000000000 --- a/doc/models/order-line-item-discount-type.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Order Line Item Discount Type - -Indicates how the discount is applied to the associated line item or order. - -## Enumeration - -`OrderLineItemDiscountType` - -## Fields - -| Name | Description | -| --- | --- | -| `UNKNOWN_DISCOUNT` | Used for reporting only.
The original transaction discount type is currently not supported by the API. | -| `FIXED_PERCENTAGE` | Apply the discount as a fixed percentage (such as 5%) off the item price. | -| `FIXED_AMOUNT` | Apply the discount as a fixed monetary value (such as $1.00) off the item price. | -| `VARIABLE_PERCENTAGE` | Apply the discount as a variable percentage based on the item
price.

The specific discount percentage of a `VARIABLE_PERCENTAGE` discount
is assigned at the time of the purchase. | -| `VARIABLE_AMOUNT` | Apply the discount as a variable amount based on the item price.

The specific discount amount of a `VARIABLE_AMOUNT` discount
is assigned at the time of the purchase. | - diff --git a/doc/models/order-line-item-discount.md b/doc/models/order-line-item-discount.md deleted file mode 100644 index bc9bff611..000000000 --- a/doc/models/order-line-item-discount.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Order Line Item Discount - -Represents a discount that applies to one or more line items in an -order. - -Fixed-amount, order-scoped discounts are distributed across all non-zero line item totals. -The amount distributed to each line item is relative to the -amount contributed by the item to the order subtotal. - -## Structure - -`OrderLineItemDiscount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the discount only within this order.
**Constraints**: *Maximum Length*: `60` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount).
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this discount references. | -| `name` | `string \| null \| undefined` | Optional | The discount's name.
**Constraints**: *Maximum Length*: `255` | -| `type` | [`string \| undefined`](../../doc/models/order-line-item-discount-type.md) | Optional | Indicates how the discount is applied to the associated line item or order. | -| `percentage` | `string \| null \| undefined` | Optional | The percentage of the discount, as a string representation of a decimal number.
A value of `7.25` corresponds to a percentage of 7.25%.

`percentage` is not set for amount-based discounts.
**Constraints**: *Maximum Length*: `10` | -| `amountMoney` | [`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. | -| `appliedMoney` | [`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. | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this discount. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | -| `scope` | [`string \| undefined`](../../doc/models/order-line-item-discount-scope.md) | Optional | Indicates whether this is a line-item or order-level discount. | -| `rewardIds` | `string[] \| undefined` | Optional | The reward IDs corresponding to this discount. The application and
specification of discounts that have `reward_ids` are completely controlled by the backing
criteria corresponding to the reward tiers of the rewards that are added to the order
through the Loyalty API. To manually unapply discounts that are the result of added rewards,
the rewards must be removed from the order through the Loyalty API. | -| `pricingRuleId` | `string \| undefined` | Optional | The object ID of a [pricing rule](entity:CatalogPricingRule) to be applied
automatically to this discount. The specification and application of the discounts, to
which a `pricing_rule_id` is assigned, are completely controlled by the corresponding
pricing rule. | - -## Example (as JSON) - -```json -{ - "uid": "uid4", - "catalog_object_id": "catalog_object_id8", - "catalog_version": 54, - "name": "name4", - "type": "FIXED_PERCENTAGE" -} -``` - diff --git a/doc/models/order-line-item-item-type.md b/doc/models/order-line-item-item-type.md deleted file mode 100644 index 70c09fb02..000000000 --- a/doc/models/order-line-item-item-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Order Line Item Item Type - -Represents the line item type. - -## Enumeration - -`OrderLineItemItemType` - -## Fields - -| Name | Description | -| --- | --- | -| `ITEM` | Indicates that the line item is an itemized sale. | -| `CUSTOM_AMOUNT` | Indicates that the line item is a non-itemized sale. | -| `GIFT_CARD` | Indicates that the line item is a gift card sale. Gift cards sold through
the Orders API are sold in an unactivated state and can be activated through the
Gift Cards API using the line item `uid`. | - diff --git a/doc/models/order-line-item-modifier.md b/doc/models/order-line-item-modifier.md deleted file mode 100644 index 6e99a4e16..000000000 --- a/doc/models/order-line-item-modifier.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Order Line Item Modifier - -A [CatalogModifier](../../doc/models/catalog-modifier.md). - -## Structure - -`OrderLineItemModifier` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the modifier only within this order.
**Constraints**: *Maximum Length*: `60` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID referencing [CatalogModifier](entity:CatalogModifier).
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this modifier references. | -| `name` | `string \| null \| undefined` | Optional | The name of the item modifier.
**Constraints**: *Maximum Length*: `255` | -| `quantity` | `string \| null \| undefined` | Optional | The quantity of the line item modifier. The modifier quantity can be 0 or more.
For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders
this item, the restaurant records the purchase by creating an `Order` object with a line item
for a burger. The line item includes a line item modifier: the name is cheese and the quantity
is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses
the extra cheese option, the modifier quantity increases to 2. If the buyer does not want
any cheese, the modifier quantity is set to 0. | -| `basePriceMoney` | [`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. | -| `totalPriceMoney` | [`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. | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this order. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | - -## Example (as JSON) - -```json -{ - "uid": "uid2", - "catalog_object_id": "catalog_object_id6", - "catalog_version": 134, - "name": "name2", - "quantity": "quantity8" -} -``` - diff --git a/doc/models/order-line-item-pricing-blocklists-blocked-discount.md b/doc/models/order-line-item-pricing-blocklists-blocked-discount.md deleted file mode 100644 index 32c08d84d..000000000 --- a/doc/models/order-line-item-pricing-blocklists-blocked-discount.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Order Line Item Pricing Blocklists Blocked Discount - -A discount to block from applying to a line item. The discount must be -identified by either `discount_uid` or `discount_catalog_object_id`, but not both. - -## Structure - -`OrderLineItemPricingBlocklistsBlockedDiscount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID of the `BlockedDiscount` within the order.
**Constraints**: *Maximum Length*: `60` | -| `discountUid` | `string \| null \| undefined` | Optional | The `uid` of the discount that should be blocked. Use this field to block
ad hoc discounts. For catalog discounts, use the `discount_catalog_object_id` field.
**Constraints**: *Maximum Length*: `60` | -| `discountCatalogObjectId` | `string \| null \| undefined` | Optional | The `catalog_object_id` of the discount that should be blocked.
Use this field to block catalog discounts. For ad hoc discounts, use the
`discount_uid` field.
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "uid": "uid6", - "discount_uid": "discount_uid8", - "discount_catalog_object_id": "discount_catalog_object_id8" -} -``` - diff --git a/doc/models/order-line-item-pricing-blocklists-blocked-tax.md b/doc/models/order-line-item-pricing-blocklists-blocked-tax.md deleted file mode 100644 index 191c6cd71..000000000 --- a/doc/models/order-line-item-pricing-blocklists-blocked-tax.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Order Line Item Pricing Blocklists Blocked Tax - -A tax to block from applying to a line item. The tax must be -identified by either `tax_uid` or `tax_catalog_object_id`, but not both. - -## Structure - -`OrderLineItemPricingBlocklistsBlockedTax` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID of the `BlockedTax` within the order.
**Constraints**: *Maximum Length*: `60` | -| `taxUid` | `string \| null \| undefined` | Optional | The `uid` of the tax that should be blocked. Use this field to block
ad hoc taxes. For catalog, taxes use the `tax_catalog_object_id` field.
**Constraints**: *Maximum Length*: `60` | -| `taxCatalogObjectId` | `string \| null \| undefined` | Optional | The `catalog_object_id` of the tax that should be blocked.
Use this field to block catalog taxes. For ad hoc taxes, use the
`tax_uid` field.
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "uid": "uid8", - "tax_uid": "tax_uid4", - "tax_catalog_object_id": "tax_catalog_object_id2" -} -``` - diff --git a/doc/models/order-line-item-pricing-blocklists.md b/doc/models/order-line-item-pricing-blocklists.md deleted file mode 100644 index 2a5dae4e1..000000000 --- a/doc/models/order-line-item-pricing-blocklists.md +++ /dev/null @@ -1,54 +0,0 @@ - -# Order Line Item Pricing Blocklists - -Describes pricing adjustments that are blocked from automatic -application to a line item. For more information, see -[Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). - -## Structure - -`OrderLineItemPricingBlocklists` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `blockedDiscounts` | [`OrderLineItemPricingBlocklistsBlockedDiscount[] \| null \| undefined`](../../doc/models/order-line-item-pricing-blocklists-blocked-discount.md) | Optional | A list of discounts blocked from applying to the line item.
Discounts can be blocked by the `discount_uid` (for ad hoc discounts) or
the `discount_catalog_object_id` (for catalog discounts). | -| `blockedTaxes` | [`OrderLineItemPricingBlocklistsBlockedTax[] \| null \| undefined`](../../doc/models/order-line-item-pricing-blocklists-blocked-tax.md) | Optional | A list of taxes blocked from applying to the line item.
Taxes can be blocked by the `tax_uid` (for ad hoc taxes) or
the `tax_catalog_object_id` (for catalog taxes). | - -## Example (as JSON) - -```json -{ - "blocked_discounts": [ - { - "uid": "uid0", - "discount_uid": "discount_uid6", - "discount_catalog_object_id": "discount_catalog_object_id2" - }, - { - "uid": "uid0", - "discount_uid": "discount_uid6", - "discount_catalog_object_id": "discount_catalog_object_id2" - }, - { - "uid": "uid0", - "discount_uid": "discount_uid6", - "discount_catalog_object_id": "discount_catalog_object_id2" - } - ], - "blocked_taxes": [ - { - "uid": "uid4", - "tax_uid": "tax_uid0", - "tax_catalog_object_id": "tax_catalog_object_id8" - }, - { - "uid": "uid4", - "tax_uid": "tax_uid0", - "tax_catalog_object_id": "tax_catalog_object_id8" - } - ] -} -``` - diff --git a/doc/models/order-line-item-tax-scope.md b/doc/models/order-line-item-tax-scope.md deleted file mode 100644 index 3a27c8fde..000000000 --- a/doc/models/order-line-item-tax-scope.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Order Line Item Tax Scope - -Indicates whether this is a line-item or order-level tax. - -## Enumeration - -`OrderLineItemTaxScope` - -## Fields - -| Name | Description | -| --- | --- | -| `OTHER_TAX_SCOPE` | Used for reporting only.
The original transaction tax scope is currently not supported by the API. | -| `LINE_ITEM` | The tax should be applied only to line items specified by
the `OrderLineItemAppliedTax` reference records. | -| `ORDER` | The tax should be applied to the entire order. | - diff --git a/doc/models/order-line-item-tax-type.md b/doc/models/order-line-item-tax-type.md deleted file mode 100644 index 780dfa36e..000000000 --- a/doc/models/order-line-item-tax-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Order Line Item Tax Type - -Indicates how the tax is applied to the associated line item or order. - -## Enumeration - -`OrderLineItemTaxType` - -## Fields - -| Name | Description | -| --- | --- | -| `UNKNOWN_TAX` | Used for reporting only.
The original transaction tax type is currently not supported by the API. | -| `ADDITIVE` | The tax is an additive tax. The tax amount is added on top of the price.
For example, an item with a cost of 1.00 USD and a 10% additive tax has a total
cost to the buyer of 1.10 USD. | -| `INCLUSIVE` | The tax is an inclusive tax. Inclusive taxes are already included
in the line item price or order total. For example, an item with a cost of
1.00 USD and a 10% inclusive tax has a pretax cost of 0.91 USD
(91 cents) and a 0.09 (9 cents) tax for a total cost of 1.00 USD to
the buyer. | - diff --git a/doc/models/order-line-item-tax.md b/doc/models/order-line-item-tax.md deleted file mode 100644 index cabd6afa2..000000000 --- a/doc/models/order-line-item-tax.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Order Line Item Tax - -Represents a tax that applies to one or more line item in the order. - -Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals. -The amount distributed to each line item is relative to the amount the item -contributes to the order subtotal. - -## Structure - -`OrderLineItemTax` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the tax only within this order.
**Constraints**: *Maximum Length*: `60` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID referencing [CatalogTax](entity:CatalogTax).
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this tax references. | -| `name` | `string \| null \| undefined` | Optional | The tax's name.
**Constraints**: *Maximum Length*: `255` | -| `type` | [`string \| undefined`](../../doc/models/order-line-item-tax-type.md) | Optional | Indicates how the tax is applied to the associated line item or order. | -| `percentage` | `string \| null \| undefined` | Optional | The percentage of the tax, as a string representation of a decimal
number. For example, a value of `"7.25"` corresponds to a percentage of
7.25%.
**Constraints**: *Maximum Length*: `10` | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this tax. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | -| `appliedMoney` | [`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. | -| `scope` | [`string \| undefined`](../../doc/models/order-line-item-tax-scope.md) | Optional | Indicates whether this is a line-item or order-level tax. | -| `autoApplied` | `boolean \| undefined` | Optional | Determines whether the tax was automatically applied to the order based on
the catalog configuration. For an example, see
[Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes). | - -## Example (as JSON) - -```json -{ - "uid": "uid4", - "catalog_object_id": "catalog_object_id2", - "catalog_version": 190, - "name": "name4", - "type": "ADDITIVE" -} -``` - diff --git a/doc/models/order-line-item.md b/doc/models/order-line-item.md deleted file mode 100644 index 6a0039828..000000000 --- a/doc/models/order-line-item.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Order Line Item - -Represents a line item in an order. Each line item describes a different -product to purchase, with its own quantity and price details. - -## Structure - -`OrderLineItem` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the line item only within this order.
**Constraints**: *Maximum Length*: `60` | -| `name` | `string \| null \| undefined` | Optional | The name of the line item.
**Constraints**: *Maximum Length*: `512` | -| `quantity` | `string` | Required | The count, or measurement, of a line item being purchased:

If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an item count. For example: `3` apples.

If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` denotes a measurement. For example: `2.25` pounds of broccoli.

For more information, see [Specify item quantity and measurement unit](https://developer.squareup.com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit).

Line items with a quantity of `0` are automatically removed
when paying for or otherwise completing the order.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `12` | -| `quantityUnit` | [`OrderQuantityUnit \| undefined`](../../doc/models/order-quantity-unit.md) | Optional | Contains the measurement unit for a quantity and a precision that
specifies the number of digits after the decimal point for decimal quantities. | -| `note` | `string \| null \| undefined` | Optional | An optional note associated with the line item.
**Constraints**: *Maximum Length*: `2000` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this line item.
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this line item references. | -| `variationName` | `string \| null \| undefined` | Optional | The name of the variation applied to this line item.
**Constraints**: *Maximum Length*: `400` | -| `itemType` | [`string \| undefined`](../../doc/models/order-line-item-item-type.md) | Optional | Represents the line item type. | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this line item. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | -| `modifiers` | [`OrderLineItemModifier[] \| null \| undefined`](../../doc/models/order-line-item-modifier.md) | Optional | The [CatalogModifier](entity:CatalogModifier)s applied to this line item. | -| `appliedTaxes` | [`OrderLineItemAppliedTax[] \| null \| undefined`](../../doc/models/order-line-item-applied-tax.md) | Optional | The list of references to taxes applied to this line item. Each
`OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a
top-level `OrderLineItemTax` applied to the line item. On reads, the
amount applied is populated.

An `OrderLineItemAppliedTax` is automatically created on every line
item for all `ORDER` scoped taxes added to the order. `OrderLineItemAppliedTax`
records for `LINE_ITEM` scoped taxes must be added in requests for the tax
to apply to any line items.

To change the amount of a tax, modify the referenced top-level tax. | -| `appliedDiscounts` | [`OrderLineItemAppliedDiscount[] \| null \| undefined`](../../doc/models/order-line-item-applied-discount.md) | Optional | The list of references to discounts applied to this line item. Each
`OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level
`OrderLineItemDiscounts` applied to the line item. On reads, the amount
applied is populated.

An `OrderLineItemAppliedDiscount` is automatically created on every line item for all
`ORDER` scoped discounts that are added to the order. `OrderLineItemAppliedDiscount` records
for `LINE_ITEM` scoped discounts must be added in requests for the discount to apply to any
line items.

To change the amount of a discount, modify the referenced top-level discount. | -| `appliedServiceCharges` | [`OrderLineItemAppliedServiceCharge[] \| null \| undefined`](../../doc/models/order-line-item-applied-service-charge.md) | Optional | The list of references to service charges applied to this line item. Each
`OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a
top-level `OrderServiceCharge` applied to the line item. On reads, the amount applied is
populated.

To change the amount of a service charge, modify the referenced top-level service charge. | -| `basePriceMoney` | [`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. | -| `variationTotalPriceMoney` | [`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. | -| `grossSalesMoney` | [`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. | -| `totalTaxMoney` | [`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. | -| `totalDiscountMoney` | [`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. | -| `totalMoney` | [`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. | -| `pricingBlocklists` | [`OrderLineItemPricingBlocklists \| undefined`](../../doc/models/order-line-item-pricing-blocklists.md) | Optional | Describes pricing adjustments that are blocked from automatic
application to a line item. For more information, see
[Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). | -| `totalServiceChargeMoney` | [`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 -{ - "uid": "uid4", - "name": "name4", - "quantity": "quantity0", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note0", - "catalog_object_id": "catalog_object_id8" -} -``` - diff --git a/doc/models/order-money-amounts.md b/doc/models/order-money-amounts.md deleted file mode 100644 index b37cfaf33..000000000 --- a/doc/models/order-money-amounts.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Order Money Amounts - -A collection of various money amounts. - -## Structure - -`OrderMoneyAmounts` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `totalMoney` | [`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. | -| `taxMoney` | [`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. | -| `discountMoney` | [`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. | -| `tipMoney` | [`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. | -| `serviceChargeMoney` | [`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 -{ - "total_money": { - "amount": 250, - "currency": "UAH" - }, - "tax_money": { - "amount": 58, - "currency": "IRR" - }, - "discount_money": { - "amount": 92, - "currency": "PAB" - }, - "tip_money": { - "amount": 190, - "currency": "TWD" - }, - "service_charge_money": { - "amount": 160, - "currency": "XCD" - } -} -``` - diff --git a/doc/models/order-pricing-options.md b/doc/models/order-pricing-options.md deleted file mode 100644 index 8a68c2636..000000000 --- a/doc/models/order-pricing-options.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Order Pricing Options - -Pricing options for an order. The options affect how the order's price is calculated. -They can be used, for example, to apply automatic price adjustments that are based on preconfigured -[pricing rules](../../doc/models/catalog-pricing-rule.md). - -## Structure - -`OrderPricingOptions` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `autoApplyDiscounts` | `boolean \| null \| undefined` | Optional | The option to determine whether pricing rule-based
discounts are automatically applied to an order. | -| `autoApplyTaxes` | `boolean \| null \| undefined` | Optional | The option to determine whether rule-based taxes are automatically
applied to an order when the criteria of the corresponding rules are met. | - -## Example (as JSON) - -```json -{ - "auto_apply_discounts": false, - "auto_apply_taxes": false -} -``` - diff --git a/doc/models/order-quantity-unit.md b/doc/models/order-quantity-unit.md deleted file mode 100644 index 13d68158e..000000000 --- a/doc/models/order-quantity-unit.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Order Quantity Unit - -Contains the measurement unit for a quantity and a precision that -specifies the number of digits after the decimal point for decimal quantities. - -## Structure - -`OrderQuantityUnit` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `measurementUnit` | [`MeasurementUnit \| undefined`](../../doc/models/measurement-unit.md) | Optional | Represents a unit of measurement to use with a quantity, such as ounces
or inches. Exactly one of the following fields are required: `custom_unit`,
`area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. | -| `precision` | `number \| null \| undefined` | Optional | For non-integer quantities, represents the number of digits after the decimal point that are
recorded for this quantity.

For example, a precision of 1 allows quantities such as `"1.0"` and `"1.1"`, but not `"1.01"`.

Min: 0. Max: 5. | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID referencing the
[CatalogMeasurementUnit](entity:CatalogMeasurementUnit).

This field is set when this is a catalog-backed measurement unit. | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this measurement unit references.

This field is set when this is a catalog-backed measurement unit. | - -## Example (as JSON) - -```json -{ - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 144, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 78 -} -``` - diff --git a/doc/models/order-return-discount.md b/doc/models/order-return-discount.md deleted file mode 100644 index 202f52bbb..000000000 --- a/doc/models/order-return-discount.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Order Return Discount - -Represents a discount being returned that applies to one or more return line items in an -order. - -Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals. -The amount distributed to each return line item is relative to that item’s contribution to the -order subtotal. - -## Structure - -`OrderReturnDiscount` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the returned discount only within this order.
**Constraints**: *Maximum Length*: `60` | -| `sourceDiscountUid` | `string \| null \| undefined` | Optional | The discount `uid` from the order that contains the original application of this discount.
**Constraints**: *Maximum Length*: `60` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount).
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this discount references. | -| `name` | `string \| null \| undefined` | Optional | The discount's name.
**Constraints**: *Maximum Length*: `255` | -| `type` | [`string \| undefined`](../../doc/models/order-line-item-discount-type.md) | Optional | Indicates how the discount is applied to the associated line item or order. | -| `percentage` | `string \| null \| undefined` | Optional | The percentage of the tax, as a string representation of a decimal number.
A value of `"7.25"` corresponds to a percentage of 7.25%.

`percentage` is not set for amount-based discounts.
**Constraints**: *Maximum Length*: `10` | -| `amountMoney` | [`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. | -| `appliedMoney` | [`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. | -| `scope` | [`string \| undefined`](../../doc/models/order-line-item-discount-scope.md) | Optional | Indicates whether this is a line-item or order-level discount. | - -## Example (as JSON) - -```json -{ - "uid": "uid2", - "source_discount_uid": "source_discount_uid2", - "catalog_object_id": "catalog_object_id4", - "catalog_version": 188, - "name": "name2" -} -``` - diff --git a/doc/models/order-return-line-item-modifier.md b/doc/models/order-return-line-item-modifier.md deleted file mode 100644 index e7450e8d7..000000000 --- a/doc/models/order-return-line-item-modifier.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Order Return Line Item Modifier - -A line item modifier being returned. - -## Structure - -`OrderReturnLineItemModifier` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the return modifier only within this order.
**Constraints**: *Maximum Length*: `60` | -| `sourceModifierUid` | `string \| null \| undefined` | Optional | The modifier `uid` from the order's line item that contains the
original sale of this line item modifier.
**Constraints**: *Maximum Length*: `60` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID referencing [CatalogModifier](entity:CatalogModifier).
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this line item modifier references. | -| `name` | `string \| null \| undefined` | Optional | The name of the item modifier.
**Constraints**: *Maximum Length*: `255` | -| `basePriceMoney` | [`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. | -| `totalPriceMoney` | [`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. | -| `quantity` | `string \| null \| undefined` | Optional | The quantity of the line item modifier. The modifier quantity can be 0 or more.
For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders
this item, the restaurant records the purchase by creating an `Order` object with a line item
for a burger. The line item includes a line item modifier: the name is cheese and the quantity
is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses
the extra cheese option, the modifier quantity increases to 2. If the buyer does not want
any cheese, the modifier quantity is set to 0. | - -## Example (as JSON) - -```json -{ - "uid": "uid4", - "source_modifier_uid": "source_modifier_uid8", - "catalog_object_id": "catalog_object_id8", - "catalog_version": 46, - "name": "name4" -} -``` - diff --git a/doc/models/order-return-line-item.md b/doc/models/order-return-line-item.md deleted file mode 100644 index 42df14ae0..000000000 --- a/doc/models/order-return-line-item.md +++ /dev/null @@ -1,62 +0,0 @@ - -# Order Return Line Item - -The line item being returned in an order. - -## Structure - -`OrderReturnLineItem` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID for this return line-item entry.
**Constraints**: *Maximum Length*: `60` | -| `sourceLineItemUid` | `string \| null \| undefined` | Optional | The `uid` of the line item in the original sale order.
**Constraints**: *Maximum Length*: `60` | -| `name` | `string \| null \| undefined` | Optional | The name of the line item.
**Constraints**: *Maximum Length*: `512` | -| `quantity` | `string` | Required | The quantity returned, formatted as a decimal number.
For example, `"3"`.

Line items with a `quantity_unit` can have non-integer quantities.
For example, `"1.70000"`.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `12` | -| `quantityUnit` | [`OrderQuantityUnit \| undefined`](../../doc/models/order-quantity-unit.md) | Optional | Contains the measurement unit for a quantity and a precision that
specifies the number of digits after the decimal point for decimal quantities. | -| `note` | `string \| null \| undefined` | Optional | The note of the return line item.
**Constraints**: *Maximum Length*: `2000` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this return line item.
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this line item references. | -| `variationName` | `string \| null \| undefined` | Optional | The name of the variation applied to this return line item.
**Constraints**: *Maximum Length*: `400` | -| `itemType` | [`string \| undefined`](../../doc/models/order-line-item-item-type.md) | Optional | Represents the line item type. | -| `returnModifiers` | [`OrderReturnLineItemModifier[] \| null \| undefined`](../../doc/models/order-return-line-item-modifier.md) | Optional | The [CatalogModifier](entity:CatalogModifier)s applied to this line item. | -| `appliedTaxes` | [`OrderLineItemAppliedTax[] \| null \| undefined`](../../doc/models/order-line-item-applied-tax.md) | Optional | The list of references to `OrderReturnTax` entities applied to the return line item. Each
`OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level
`OrderReturnTax` applied to the return line item. On reads, the applied amount
is populated. | -| `appliedDiscounts` | [`OrderLineItemAppliedDiscount[] \| null \| undefined`](../../doc/models/order-line-item-applied-discount.md) | Optional | The list of references to `OrderReturnDiscount` entities applied to the return line item. Each
`OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level
`OrderReturnDiscount` applied to the return line item. On reads, the applied amount
is populated. | -| `basePriceMoney` | [`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. | -| `variationTotalPriceMoney` | [`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. | -| `grossReturnMoney` | [`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. | -| `totalTaxMoney` | [`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. | -| `totalDiscountMoney` | [`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. | -| `totalMoney` | [`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. | -| `appliedServiceCharges` | [`OrderLineItemAppliedServiceCharge[] \| null \| undefined`](../../doc/models/order-line-item-applied-service-charge.md) | Optional | The list of references to `OrderReturnServiceCharge` entities applied to the return
line item. Each `OrderLineItemAppliedServiceCharge` has a `service_charge_uid` that
references the `uid` of a top-level `OrderReturnServiceCharge` applied to the return line
item. On reads, the applied amount is populated. | -| `totalServiceChargeMoney` | [`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 -{ - "uid": "uid2", - "source_line_item_uid": "source_line_item_uid0", - "name": "name2", - "quantity": "quantity8", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note8" -} -``` - diff --git a/doc/models/order-return-service-charge.md b/doc/models/order-return-service-charge.md deleted file mode 100644 index 6b48a2060..000000000 --- a/doc/models/order-return-service-charge.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Order Return Service Charge - -Represents the service charge applied to the original order. - -## Structure - -`OrderReturnServiceCharge` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the return service charge only within this order.
**Constraints**: *Maximum Length*: `60` | -| `sourceServiceChargeUid` | `string \| null \| undefined` | Optional | The service charge `uid` from the order containing the original
service charge. `source_service_charge_uid` is `null` for
unlinked returns.
**Constraints**: *Maximum Length*: `60` | -| `name` | `string \| null \| undefined` | Optional | The name of the service charge.
**Constraints**: *Maximum Length*: `255` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID of the associated [OrderServiceCharge](entity:OrderServiceCharge).
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this service charge references. | -| `percentage` | `string \| null \| undefined` | Optional | The percentage of the service charge, as a string representation of
a decimal number. For example, a value of `"7.25"` corresponds to a
percentage of 7.25%.

Either `percentage` or `amount_money` should be set, but not both.
**Constraints**: *Maximum Length*: `10` | -| `amountMoney` | [`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. | -| `appliedMoney` | [`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. | -| `totalMoney` | [`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. | -| `totalTaxMoney` | [`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. | -| `calculationPhase` | [`string \| undefined`](../../doc/models/order-service-charge-calculation-phase.md) | Optional | Represents a phase in the process of calculating order totals.
Service charges are applied after the indicated phase.

[Read more about how order totals are calculated.](https://developer.squareup.com/docs/orders-api/how-it-works#how-totals-are-calculated) | -| `taxable` | `boolean \| null \| undefined` | Optional | Indicates whether the surcharge can be taxed. Service charges
calculated in the `TOTAL_PHASE` cannot be marked as taxable. | -| `appliedTaxes` | [`OrderLineItemAppliedTax[] \| null \| undefined`](../../doc/models/order-line-item-applied-tax.md) | Optional | The list of references to `OrderReturnTax` entities applied to the
`OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid`
that references the `uid` of a top-level `OrderReturnTax` that is being
applied to the `OrderReturnServiceCharge`. On reads, the applied amount is
populated. | -| `treatmentType` | [`string \| undefined`](../../doc/models/order-service-charge-treatment-type.md) | Optional | Indicates whether the service charge will be treated as a value-holding line item or
apportioned toward a line item. | -| `scope` | [`string \| undefined`](../../doc/models/order-service-charge-scope.md) | Optional | Indicates whether this is a line-item or order-level apportioned
service charge. | - -## Example (as JSON) - -```json -{ - "uid": "uid0", - "source_service_charge_uid": "source_service_charge_uid6", - "name": "name0", - "catalog_object_id": "catalog_object_id4", - "catalog_version": 18 -} -``` - diff --git a/doc/models/order-return-tax.md b/doc/models/order-return-tax.md deleted file mode 100644 index 0d88ccc2f..000000000 --- a/doc/models/order-return-tax.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Order Return Tax - -Represents a tax being returned that applies to one or more return line items in an order. - -Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals. -The amount distributed to each return line item is relative to that item’s contribution to the -order subtotal. - -## Structure - -`OrderReturnTax` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the returned tax only within this order.
**Constraints**: *Maximum Length*: `60` | -| `sourceTaxUid` | `string \| null \| undefined` | Optional | The tax `uid` from the order that contains the original tax charge.
**Constraints**: *Maximum Length*: `60` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID referencing [CatalogTax](entity:CatalogTax).
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this tax references. | -| `name` | `string \| null \| undefined` | Optional | The tax's name.
**Constraints**: *Maximum Length*: `255` | -| `type` | [`string \| undefined`](../../doc/models/order-line-item-tax-type.md) | Optional | Indicates how the tax is applied to the associated line item or order. | -| `percentage` | `string \| null \| undefined` | Optional | The percentage of the tax, as a string representation of a decimal number.
For example, a value of `"7.25"` corresponds to a percentage of 7.25%.
**Constraints**: *Maximum Length*: `10` | -| `appliedMoney` | [`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. | -| `scope` | [`string \| undefined`](../../doc/models/order-line-item-tax-scope.md) | Optional | Indicates whether this is a line-item or order-level tax. | - -## Example (as JSON) - -```json -{ - "uid": "uid4", - "source_tax_uid": "source_tax_uid2", - "catalog_object_id": "catalog_object_id8", - "catalog_version": 124, - "name": "name4" -} -``` - diff --git a/doc/models/order-return-tip.md b/doc/models/order-return-tip.md deleted file mode 100644 index a40d5b151..000000000 --- a/doc/models/order-return-tip.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Order Return Tip - -A tip being returned. - -## Structure - -`OrderReturnTip` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the tip only within this order.
**Constraints**: *Maximum Length*: `60` | -| `appliedMoney` | [`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. | -| `sourceTenderUid` | `string \| null \| undefined` | Optional | The tender `uid` from the order that contains the original application of this tip.
**Constraints**: *Maximum Length*: `192` | -| `sourceTenderId` | `string \| null \| undefined` | Optional | The tender `id` from the order that contains the original application of this tip.
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "uid": "uid4", - "applied_money": { - "amount": 196, - "currency": "AMD" - }, - "source_tender_uid": "source_tender_uid6", - "source_tender_id": "source_tender_id0" -} -``` - diff --git a/doc/models/order-return.md b/doc/models/order-return.md deleted file mode 100644 index bad1ee16c..000000000 --- a/doc/models/order-return.md +++ /dev/null @@ -1,95 +0,0 @@ - -# Order Return - -The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order. - -## Structure - -`OrderReturn` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the return only within this order.
**Constraints**: *Maximum Length*: `60` | -| `sourceOrderId` | `string \| null \| undefined` | Optional | An order that contains the original sale of these return line items. This is unset
for unlinked returns. | -| `returnLineItems` | [`OrderReturnLineItem[] \| null \| undefined`](../../doc/models/order-return-line-item.md) | Optional | A collection of line items that are being returned. | -| `returnServiceCharges` | [`OrderReturnServiceCharge[] \| null \| undefined`](../../doc/models/order-return-service-charge.md) | Optional | A collection of service charges that are being returned. | -| `returnTaxes` | [`OrderReturnTax[] \| undefined`](../../doc/models/order-return-tax.md) | Optional | A collection of references to taxes being returned for an order, including the total
applied tax amount to be returned. The taxes must reference a top-level tax ID from the source
order. | -| `returnDiscounts` | [`OrderReturnDiscount[] \| undefined`](../../doc/models/order-return-discount.md) | Optional | A collection of references to discounts being returned for an order, including the total
applied discount amount to be returned. The discounts must reference a top-level discount ID
from the source order. | -| `returnTips` | [`OrderReturnTip[] \| null \| undefined`](../../doc/models/order-return-tip.md) | Optional | A collection of references to tips being returned for an order. | -| `roundingAdjustment` | [`OrderRoundingAdjustment \| undefined`](../../doc/models/order-rounding-adjustment.md) | Optional | A rounding adjustment of the money being returned. Commonly used to apply cash rounding
when the minimum unit of the account is smaller than the lowest physical denomination of the currency. | -| `returnAmounts` | [`OrderMoneyAmounts \| undefined`](../../doc/models/order-money-amounts.md) | Optional | A collection of various money amounts. | - -## Example (as JSON) - -```json -{ - "uid": "uid2", - "source_order_id": "source_order_id0", - "return_line_items": [ - { - "uid": "uid0", - "source_line_item_uid": "source_line_item_uid2", - "name": "name0", - "quantity": "quantity6", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4" - } - ], - "return_service_charges": [ - { - "uid": "uid6", - "source_service_charge_uid": "source_service_charge_uid0", - "name": "name6", - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - { - "uid": "uid6", - "source_service_charge_uid": "source_service_charge_uid0", - "name": "name6", - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - } - ], - "return_taxes": [ - { - "uid": "uid2", - "source_tax_uid": "source_tax_uid0", - "catalog_object_id": "catalog_object_id4", - "catalog_version": 106, - "name": "name2" - }, - { - "uid": "uid2", - "source_tax_uid": "source_tax_uid0", - "catalog_object_id": "catalog_object_id4", - "catalog_version": 106, - "name": "name2" - }, - { - "uid": "uid2", - "source_tax_uid": "source_tax_uid0", - "catalog_object_id": "catalog_object_id4", - "catalog_version": 106, - "name": "name2" - } - ] -} -``` - diff --git a/doc/models/order-reward.md b/doc/models/order-reward.md deleted file mode 100644 index 42d5b5b78..000000000 --- a/doc/models/order-reward.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Order Reward - -Represents a reward that can be applied to an order if the necessary -reward tier criteria are met. Rewards are created through the Loyalty API. - -## Structure - -`OrderReward` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Required | The identifier of the reward.
**Constraints**: *Minimum Length*: `1` | -| `rewardTierId` | `string` | Required | The identifier of the reward tier corresponding to this reward.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "id": "id0", - "reward_tier_id": "reward_tier_id6" -} -``` - diff --git a/doc/models/order-rounding-adjustment.md b/doc/models/order-rounding-adjustment.md deleted file mode 100644 index 60bee7237..000000000 --- a/doc/models/order-rounding-adjustment.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Order Rounding Adjustment - -A rounding adjustment of the money being returned. Commonly used to apply cash rounding -when the minimum unit of the account is smaller than the lowest physical denomination of the currency. - -## Structure - -`OrderRoundingAdjustment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the rounding adjustment only within this order.
**Constraints**: *Maximum Length*: `60` | -| `name` | `string \| null \| undefined` | Optional | The name of the rounding adjustment from the original sale order. | -| `amountMoney` | [`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 -{ - "uid": "uid0", - "name": "name0", - "amount_money": { - "amount": 186, - "currency": "AUD" - } -} -``` - diff --git a/doc/models/order-service-charge-calculation-phase.md b/doc/models/order-service-charge-calculation-phase.md deleted file mode 100644 index f1a054a91..000000000 --- a/doc/models/order-service-charge-calculation-phase.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Order Service Charge Calculation Phase - -Represents a phase in the process of calculating order totals. -Service charges are applied after the indicated phase. - -[Read more about how order totals are calculated.](https://developer.squareup.com/docs/orders-api/how-it-works#how-totals-are-calculated) - -## Enumeration - -`OrderServiceChargeCalculationPhase` - -## Fields - -| Name | Description | -| --- | --- | -| `SUBTOTAL_PHASE` | The service charge is applied after discounts, but before
taxes. | -| `TOTAL_PHASE` | The service charge is applied after all discounts and taxes
are applied. | -| `APPORTIONED_PERCENTAGE_PHASE` | The service charge is calculated as a compounding adjustment
after any discounts, but before amount based apportioned service charges
and any tax considerations. | -| `APPORTIONED_AMOUNT_PHASE` | The service charge is calculated as a compounding adjustment
after any discounts and percentage based apportioned service charges,
but before any tax considerations. | - diff --git a/doc/models/order-service-charge-scope.md b/doc/models/order-service-charge-scope.md deleted file mode 100644 index 646680f47..000000000 --- a/doc/models/order-service-charge-scope.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Order Service Charge Scope - -Indicates whether this is a line-item or order-level apportioned -service charge. - -## Enumeration - -`OrderServiceChargeScope` - -## Fields - -| Name | Description | -| --- | --- | -| `OTHER_SERVICE_CHARGE_SCOPE` | Used for reporting only.
The original transaction service charge scope is currently not supported by the API. | -| `LINE_ITEM` | The service charge should be applied to only line items specified by
`OrderLineItemAppliedServiceCharge` reference records. | -| `ORDER` | The service charge should be applied to the entire order. | - diff --git a/doc/models/order-service-charge-treatment-type.md b/doc/models/order-service-charge-treatment-type.md deleted file mode 100644 index f54d58b58..000000000 --- a/doc/models/order-service-charge-treatment-type.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Order Service Charge Treatment Type - -Indicates whether the service charge will be treated as a value-holding line item or -apportioned toward a line item. - -## Enumeration - -`OrderServiceChargeTreatmentType` - -## Fields - -| Name | -| --- | -| `LINE_ITEM_TREATMENT` | -| `APPORTIONED_TREATMENT` | - diff --git a/doc/models/order-service-charge-type.md b/doc/models/order-service-charge-type.md deleted file mode 100644 index 5c9f9159f..000000000 --- a/doc/models/order-service-charge-type.md +++ /dev/null @@ -1,14 +0,0 @@ - -# Order Service Charge Type - -## Enumeration - -`OrderServiceChargeType` - -## Fields - -| Name | -| --- | -| `AUTO_GRATUITY` | -| `CUSTOM` | - diff --git a/doc/models/order-service-charge.md b/doc/models/order-service-charge.md deleted file mode 100644 index ff791ce4f..000000000 --- a/doc/models/order-service-charge.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Order Service Charge - -Represents a service charge applied to an order. - -## Structure - -`OrderServiceCharge` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | A unique ID that identifies the service charge only within this order.
**Constraints**: *Maximum Length*: `60` | -| `name` | `string \| null \| undefined` | Optional | The name of the service charge.
**Constraints**: *Maximum Length*: `512` | -| `catalogObjectId` | `string \| null \| undefined` | Optional | The catalog object ID referencing the service charge [CatalogObject](entity:CatalogObject).
**Constraints**: *Maximum Length*: `192` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | The version of the catalog object that this service charge references. | -| `percentage` | `string \| null \| undefined` | Optional | The service charge percentage as a string representation of a
decimal number. For example, `"7.25"` indicates a service charge of 7.25%.

Exactly 1 of `percentage` or `amount_money` should be set.
**Constraints**: *Maximum Length*: `10` | -| `amountMoney` | [`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. | -| `appliedMoney` | [`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. | -| `totalMoney` | [`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. | -| `totalTaxMoney` | [`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. | -| `calculationPhase` | [`string \| undefined`](../../doc/models/order-service-charge-calculation-phase.md) | Optional | Represents a phase in the process of calculating order totals.
Service charges are applied after the indicated phase.

[Read more about how order totals are calculated.](https://developer.squareup.com/docs/orders-api/how-it-works#how-totals-are-calculated) | -| `taxable` | `boolean \| null \| undefined` | Optional | Indicates whether the service charge can be taxed. If set to `true`,
order-level taxes automatically apply to the service charge. Note that
service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable. | -| `appliedTaxes` | [`OrderLineItemAppliedTax[] \| null \| undefined`](../../doc/models/order-line-item-applied-tax.md) | Optional | The list of references to the taxes applied to this service charge. Each
`OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level
`OrderLineItemTax` that is being applied to this service charge. On reads, the amount applied
is populated.

An `OrderLineItemAppliedTax` is automatically created on every taxable service charge
for all `ORDER` scoped taxes that are added to the order. `OrderLineItemAppliedTax` records
for `LINE_ITEM` scoped taxes must be added in requests for the tax to apply to any taxable
service charge. Taxable service charges have the `taxable` field set to `true` and calculated
in the `SUBTOTAL_PHASE`.

To change the amount of a tax, modify the referenced top-level tax. | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this service charge. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | -| `type` | [`string \| undefined`](../../doc/models/order-service-charge-type.md) | Optional | - | -| `treatmentType` | [`string \| undefined`](../../doc/models/order-service-charge-treatment-type.md) | Optional | Indicates whether the service charge will be treated as a value-holding line item or
apportioned toward a line item. | -| `scope` | [`string \| undefined`](../../doc/models/order-service-charge-scope.md) | Optional | Indicates whether this is a line-item or order-level apportioned
service charge. | - -## Example (as JSON) - -```json -{ - "uid": "uid2", - "name": "name2", - "catalog_object_id": "catalog_object_id6", - "catalog_version": 104, - "percentage": "percentage0" -} -``` - diff --git a/doc/models/order-source.md b/doc/models/order-source.md deleted file mode 100644 index 1327450db..000000000 --- a/doc/models/order-source.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Order Source - -Represents the origination details of an order. - -## Structure - -`OrderSource` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The name used to identify the place (physical or digital) that an order originates.
If unset, the name defaults to the name of the application that created the order. | - -## Example (as JSON) - -```json -{ - "name": "name2" -} -``` - diff --git a/doc/models/order-state.md b/doc/models/order-state.md deleted file mode 100644 index 9cc35bf04..000000000 --- a/doc/models/order-state.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Order State - -The state of the order. - -## Enumeration - -`OrderState` - -## Fields - -| Name | Description | -| --- | --- | -| `OPEN` | Indicates that the order is open. Open orders can be updated. | -| `COMPLETED` | Indicates that the order is completed. Completed orders are fully paid. This is a terminal state. | -| `CANCELED` | Indicates that the order is canceled. Canceled orders are not paid. This is a terminal state. | -| `DRAFT` | Indicates that the order is in a draft state. Draft orders can be updated,
but cannot be paid or fulfilled.
For more information, see [Create Orders](https://developer.squareup.com/docs/orders-api/create-orders). | - diff --git a/doc/models/order-updated-object.md b/doc/models/order-updated-object.md deleted file mode 100644 index 6bf44653c..000000000 --- a/doc/models/order-updated-object.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Order Updated Object - -## Structure - -`OrderUpdatedObject` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderUpdated` | [`OrderUpdated \| undefined`](../../doc/models/order-updated.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "order_updated": { - "order_id": "order_id6", - "version": 176, - "location_id": "location_id4", - "state": "OPEN", - "created_at": "created_at2" - } -} -``` - diff --git a/doc/models/order-updated.md b/doc/models/order-updated.md deleted file mode 100644 index 57faf7486..000000000 --- a/doc/models/order-updated.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Order Updated - -## Structure - -`OrderUpdated` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderId` | `string \| null \| undefined` | Optional | The order's unique ID. | -| `version` | `number \| undefined` | Optional | The version number, which is incremented each time an update is committed to the order.
Orders that were not created through the API do not include a version number and
therefore cannot be updated.

[Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the seller location that this order is associated with. | -| `state` | [`string \| undefined`](../../doc/models/order-state.md) | Optional | The state of the order. | -| `createdAt` | `string \| undefined` | Optional | The timestamp for when the order was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp for when the order was last updated, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "order_id": "order_id2", - "version": 162, - "location_id": "location_id2", - "state": "CANCELED", - "created_at": "created_at6" -} -``` - diff --git a/doc/models/order.md b/doc/models/order.md deleted file mode 100644 index 55f28a2c8..000000000 --- a/doc/models/order.md +++ /dev/null @@ -1,88 +0,0 @@ - -# Order - -Contains all information related to a single order to process with Square, -including line items that specify the products to purchase. `Order` objects also -include information about any associated tenders, refunds, and returns. - -All Connect V2 Transactions have all been converted to Orders including all associated -itemization data. - -## Structure - -`Order` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The order's unique ID. | -| `locationId` | `string` | Required | The ID of the seller location that this order is associated with.
**Constraints**: *Minimum Length*: `1` | -| `referenceId` | `string \| null \| undefined` | Optional | A client-specified ID to associate an entity in another system
with this order.
**Constraints**: *Maximum Length*: `40` | -| `source` | [`OrderSource \| undefined`](../../doc/models/order-source.md) | Optional | Represents the origination details of an order. | -| `customerId` | `string \| null \| undefined` | Optional | The ID of the [customer](../../doc/models/customer.md) associated with the order.

You should specify a `customer_id` on the order (or the payment) to ensure that transactions
are reliably linked to customers. Omitting this field might result in the creation of new
[instant profiles](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles).
**Constraints**: *Maximum Length*: `191` | -| `lineItems` | [`OrderLineItem[] \| null \| undefined`](../../doc/models/order-line-item.md) | Optional | The line items included in the order. | -| `taxes` | [`OrderLineItemTax[] \| null \| undefined`](../../doc/models/order-line-item-tax.md) | Optional | The list of all taxes associated with the order.

Taxes can be scoped to either `ORDER` or `LINE_ITEM`. For taxes with `LINE_ITEM` scope, an
`OrderLineItemAppliedTax` must be added to each line item that the tax applies to. For taxes
with `ORDER` scope, the server generates an `OrderLineItemAppliedTax` for every line item.

On reads, each tax in the list includes the total amount of that tax applied to the order.

__IMPORTANT__: If `LINE_ITEM` scope is set on any taxes in this field, using the deprecated
`line_items.taxes` field results in an error. Use `line_items.applied_taxes`
instead. | -| `discounts` | [`OrderLineItemDiscount[] \| null \| undefined`](../../doc/models/order-line-item-discount.md) | Optional | The list of all discounts associated with the order.

Discounts can be scoped to either `ORDER` or `LINE_ITEM`. For discounts scoped to `LINE_ITEM`,
an `OrderLineItemAppliedDiscount` must be added to each line item that the discount applies to.
For discounts with `ORDER` scope, the server generates an `OrderLineItemAppliedDiscount`
for every line item.

__IMPORTANT__: If `LINE_ITEM` scope is set on any discounts in this field, using the deprecated
`line_items.discounts` field results in an error. Use `line_items.applied_discounts`
instead. | -| `serviceCharges` | [`OrderServiceCharge[] \| null \| undefined`](../../doc/models/order-service-charge.md) | Optional | A list of service charges applied to the order. | -| `fulfillments` | [`Fulfillment[] \| null \| undefined`](../../doc/models/fulfillment.md) | Optional | Details about order fulfillment.

Orders can only be created with at most one fulfillment. However, orders returned
by the API might contain multiple fulfillments. | -| `returns` | [`OrderReturn[] \| undefined`](../../doc/models/order-return.md) | Optional | A collection of items from sale orders being returned in this one. Normally part of an
itemized return or exchange. There is exactly one `Return` object per sale `Order` being
referenced. | -| `returnAmounts` | [`OrderMoneyAmounts \| undefined`](../../doc/models/order-money-amounts.md) | Optional | A collection of various money amounts. | -| `netAmounts` | [`OrderMoneyAmounts \| undefined`](../../doc/models/order-money-amounts.md) | Optional | A collection of various money amounts. | -| `roundingAdjustment` | [`OrderRoundingAdjustment \| undefined`](../../doc/models/order-rounding-adjustment.md) | Optional | A rounding adjustment of the money being returned. Commonly used to apply cash rounding
when the minimum unit of the account is smaller than the lowest physical denomination of the currency. | -| `tenders` | [`Tender[] \| undefined`](../../doc/models/tender.md) | Optional | The tenders that were used to pay for the order. | -| `refunds` | [`Refund[] \| undefined`](../../doc/models/refund.md) | Optional | The refunds that are part of this order. | -| `metadata` | `Record \| null \| undefined` | Optional | Application-defined data attached to this order. Metadata fields are intended
to store descriptive references or associations with an entity in another system or store brief
information about the object. Square does not process this field; it only stores and returns it
in relevant API calls. Do not use metadata to store any sensitive information (such as personally
identifiable information or card details).

Keys written by applications must be 60 characters or less and must be in the character set
`[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed
with a namespace, separated from the key with a ':' character.

Values have a maximum length of 255 characters.

An application can have up to 10 entries per metadata field.

Entries written by applications are private and can only be read or modified by the same
application.

For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). | -| `createdAt` | `string \| undefined` | Optional | The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `updatedAt` | `string \| undefined` | Optional | The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). | -| `closedAt` | `string \| undefined` | Optional | The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z"). | -| `state` | [`string \| undefined`](../../doc/models/order-state.md) | Optional | The state of the order. | -| `version` | `number \| undefined` | Optional | The version number, which is incremented each time an update is committed to the order.
Orders not created through the API do not include a version number and
therefore cannot be updated.

[Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders). | -| `totalMoney` | [`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. | -| `totalTaxMoney` | [`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. | -| `totalDiscountMoney` | [`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. | -| `totalTipMoney` | [`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. | -| `totalServiceChargeMoney` | [`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. | -| `ticketName` | `string \| null \| undefined` | Optional | A short-term identifier for the order (such as a customer first name,
table number, or auto-generated order number that resets daily).
**Constraints**: *Maximum Length*: `30` | -| `pricingOptions` | [`OrderPricingOptions \| undefined`](../../doc/models/order-pricing-options.md) | Optional | Pricing options for an order. The options affect how the order's price is calculated.
They can be used, for example, to apply automatic price adjustments that are based on preconfigured
[pricing rules](../../doc/models/catalog-pricing-rule.md). | -| `rewards` | [`OrderReward[] \| undefined`](../../doc/models/order-reward.md) | Optional | A set-like list of Rewards that have been added to the Order. | -| `netAmountDueMoney` | [`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 -{ - "id": "id2", - "location_id": "location_id6", - "reference_id": "reference_id0", - "source": { - "name": "name4" - }, - "customer_id": "customer_id0", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] -} -``` - diff --git a/doc/models/pagination-cursor.md b/doc/models/pagination-cursor.md deleted file mode 100644 index 21df01345..000000000 --- a/doc/models/pagination-cursor.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Pagination Cursor - -Used *internally* to encapsulate pagination details. The resulting proto will be base62 encoded -in order to produce a cursor that can be used externally. - -## Structure - -`PaginationCursor` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderValue` | `string \| null \| undefined` | Optional | The ID of the last resource in the current page. The page can be in an ascending or
descending order | - -## Example (as JSON) - -```json -{ - "order_value": "order_value4" -} -``` - diff --git a/doc/models/pause-subscription-request.md b/doc/models/pause-subscription-request.md deleted file mode 100644 index 42eaf4d28..000000000 --- a/doc/models/pause-subscription-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Pause Subscription Request - -Defines input parameters in a request to the -[PauseSubscription](../../doc/api/subscriptions.md#pause-subscription) endpoint. - -## Structure - -`PauseSubscriptionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `pauseEffectiveDate` | `string \| null \| undefined` | Optional | The `YYYY-MM-DD`-formatted date when the scheduled `PAUSE` action takes place on the subscription.

When this date is unspecified or falls within the current billing cycle, the subscription is paused
on the starting date of the next billing cycle. | -| `pauseCycleDuration` | `bigint \| null \| undefined` | Optional | The number of billing cycles the subscription will be paused before it is reactivated.

When this is set, a `RESUME` action is also scheduled to take place on the subscription at
the end of the specified pause cycle duration. In this case, neither `resume_effective_date`
nor `resume_change_timing` may be specified. | -| `resumeEffectiveDate` | `string \| null \| undefined` | Optional | The date when the subscription is reactivated by a scheduled `RESUME` action.
This date must be at least one billing cycle ahead of `pause_effective_date`. | -| `resumeChangeTiming` | [`string \| undefined`](../../doc/models/change-timing.md) | Optional | Supported timings when a pending change, as an action, takes place to a subscription. | -| `pauseReason` | `string \| null \| undefined` | Optional | The user-provided reason to pause the subscription.
**Constraints**: *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "pause_effective_date": "pause_effective_date2", - "pause_cycle_duration": 98, - "resume_effective_date": "resume_effective_date0", - "resume_change_timing": "IMMEDIATE", - "pause_reason": "pause_reason6" -} -``` - diff --git a/doc/models/pause-subscription-response.md b/doc/models/pause-subscription-response.md deleted file mode 100644 index 0e86208a6..000000000 --- a/doc/models/pause-subscription-response.md +++ /dev/null @@ -1,84 +0,0 @@ - -# Pause Subscription Response - -Defines output parameters in a response from the -[PauseSubscription](../../doc/api/subscriptions.md#pause-subscription) endpoint. - -## Structure - -`PauseSubscriptionResponse` - -## Fields - -| 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 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) - -```json -{ - "actions": [ - { - "effective_date": "2023-11-17", - "id": "99b2439e-63f7-3ad5-95f7-ab2447a80673", - "type": "PAUSE", - "monthly_billing_anchor_date": 186, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - } - ], - "subscription": { - "card_id": "ccof:qy5x8hHGYsgLrp4Q4GB", - "created_at": "2023-06-20T21:53:10Z", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "id": "56214fb2-cc85-47a1-93bc-44f3766bb56f", - "location_id": "S8GWD5R9QB376", - "phases": [ - { - "order_template_id": "U2NaowWxzXwpsZU697x7ZHOAnCNZY", - "ordinal": 0, - "plan_phase_uid": "X2Q2AONPB3RB64Y27S25QCZP", - "uid": "873451e0-745b-4e87-ab0b-c574933fe616" - } - ], - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "source": { - "name": "My Application" - }, - "start_date": "2023-06-20", - "status": "ACTIVE", - "timezone": "America/Los_Angeles", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/pay-order-request.md b/doc/models/pay-order-request.md deleted file mode 100644 index 491e5ed72..000000000 --- a/doc/models/pay-order-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Pay Order Request - -Defines the fields that are included in requests to the -[PayOrder](../../doc/api/orders.md#pay-order) endpoint. - -## Structure - -`PayOrderRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A value you specify that uniquely identifies this request among requests you have sent. If
you are unsure whether a particular payment request was completed successfully, you can reattempt
it with the same idempotency key without worrying about duplicate payments.

For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `192` | -| `orderVersion` | `number \| null \| undefined` | Optional | The version of the order being paid. If not supplied, the latest version will be paid. | -| `paymentIds` | `string[] \| null \| undefined` | Optional | The IDs of the [payments](entity:Payment) to collect.
The payment total must match the order total. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "c043a359-7ad9-4136-82a9-c3f1d66dcbff", - "payment_ids": [ - "EnZdNAlWCmfh6Mt5FMNST1o7taB", - "0LRiVlbXVwe8ozu4KbZxd12mvaB" - ], - "order_version": 102 -} -``` - diff --git a/doc/models/pay-order-response.md b/doc/models/pay-order-response.md deleted file mode 100644 index 6c6cac2cc..000000000 --- a/doc/models/pay-order-response.md +++ /dev/null @@ -1,226 +0,0 @@ - -# Pay Order Response - -Defines the fields that are included in the response body of a request to the -[PayOrder](../../doc/api/orders.md#pay-order) endpoint. - -## Structure - -`PayOrderResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | - -## Example (as JSON) - -```json -{ - "order": { - "closed_at": "2019-08-06T02:47:37.140Z", - "created_at": "2019-08-06T02:47:35.693Z", - "id": "lgwOlEityYPJtcuvKTVKT1pA986YY", - "line_items": [ - { - "base_price_money": { - "amount": 500, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 500, - "currency": "USD" - }, - "name": "Item 1", - "quantity": "1", - "total_discount_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 500, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "QW6kofLHJK7JEKMjlSVP5C", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "base_price_money": { - "amount": 750, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 1500, - "currency": "USD" - }, - "name": "Item 2", - "quantity": "2", - "total_discount_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 1500, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "zhw8MNfRGdFQMI2WE1UBJD", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ], - "location_id": "P3CCK6HSNDAS7", - "net_amounts": { - "discount_money": { - "amount": 0, - "currency": "USD" - }, - "service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "tax_money": { - "amount": 0, - "currency": "USD" - }, - "tip_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 2000, - "currency": "USD" - } - }, - "source": { - "name": "Source Name" - }, - "state": "COMPLETED", - "tenders": [ - { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "card_details": { - "card": { - "card_brand": "VISA", - "exp_month": 2, - "exp_year": 2022, - "fingerprint": "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ", - "last_4": "1111" - }, - "entry_method": "KEYED", - "status": "CAPTURED" - }, - "created_at": "2019-08-06T02:47:36.293Z", - "id": "EnZdNAlWCmfh6Mt5FMNST1o7taB", - "location_id": "P3CCK6HSNDAS7", - "payment_id": "EnZdNAlWCmfh6Mt5FMNST1o7taB", - "transaction_id": "lgwOlEityYPJtcuvKTVKT1pA986YY", - "type": "CARD" - }, - { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "card_details": { - "card": { - "card_brand": "VISA", - "exp_month": 2, - "exp_year": 2022, - "fingerprint": "sq-1-n_BL15KP87ClDa4-h2nXOI0fp5VnxNH6hfhzqhptTfAgxgLuGFcg6jIPngDz4IkkTQ", - "last_4": "1111" - }, - "entry_method": "KEYED", - "status": "CAPTURED" - }, - "created_at": "2019-08-06T02:47:36.809Z", - "id": "0LRiVlbXVwe8ozu4KbZxd12mvaB", - "location_id": "P3CCK6HSNDAS7", - "payment_id": "0LRiVlbXVwe8ozu4KbZxd12mvaB", - "transaction_id": "lgwOlEityYPJtcuvKTVKT1pA986YY", - "type": "CARD" - } - ], - "total_discount_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 2000, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "updated_at": "2019-08-06T02:47:37.140Z", - "version": 4, - "reference_id": "reference_id4", - "customer_id": "customer_id4" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/payment-balance-activity-app-fee-refund-detail.md b/doc/models/payment-balance-activity-app-fee-refund-detail.md deleted file mode 100644 index 945613e7a..000000000 --- a/doc/models/payment-balance-activity-app-fee-refund-detail.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Payment Balance Activity App Fee Refund Detail - -## Structure - -`PaymentBalanceActivityAppFeeRefundDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `refundId` | `string \| null \| undefined` | Optional | The ID of the refund associated with this activity. | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the location of the merchant associated with the payment refund activity | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id4", - "refund_id": "refund_id8", - "location_id": "location_id8" -} -``` - diff --git a/doc/models/payment-balance-activity-app-fee-revenue-detail.md b/doc/models/payment-balance-activity-app-fee-revenue-detail.md deleted file mode 100644 index 07dfa95a6..000000000 --- a/doc/models/payment-balance-activity-app-fee-revenue-detail.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Payment Balance Activity App Fee Revenue Detail - -## Structure - -`PaymentBalanceActivityAppFeeRevenueDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the location of the merchant associated with the payment activity | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id0", - "location_id": "location_id4" -} -``` - diff --git a/doc/models/payment-balance-activity-automatic-savings-detail.md b/doc/models/payment-balance-activity-automatic-savings-detail.md deleted file mode 100644 index 8aeb8d573..000000000 --- a/doc/models/payment-balance-activity-automatic-savings-detail.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Payment Balance Activity Automatic Savings Detail - -## Structure - -`PaymentBalanceActivityAutomaticSavingsDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `payoutId` | `string \| null \| undefined` | Optional | The ID of the payout associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id4", - "payout_id": "payout_id0" -} -``` - diff --git a/doc/models/payment-balance-activity-automatic-savings-reversed-detail.md b/doc/models/payment-balance-activity-automatic-savings-reversed-detail.md deleted file mode 100644 index 82a0a9471..000000000 --- a/doc/models/payment-balance-activity-automatic-savings-reversed-detail.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Payment Balance Activity Automatic Savings Reversed Detail - -## Structure - -`PaymentBalanceActivityAutomaticSavingsReversedDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `payoutId` | `string \| null \| undefined` | Optional | The ID of the payout associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6", - "payout_id": "payout_id2" -} -``` - diff --git a/doc/models/payment-balance-activity-charge-detail.md b/doc/models/payment-balance-activity-charge-detail.md deleted file mode 100644 index 95c2fceb4..000000000 --- a/doc/models/payment-balance-activity-charge-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Charge Detail - -## Structure - -`PaymentBalanceActivityChargeDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id2" -} -``` - diff --git a/doc/models/payment-balance-activity-deposit-fee-detail.md b/doc/models/payment-balance-activity-deposit-fee-detail.md deleted file mode 100644 index 6012f8b12..000000000 --- a/doc/models/payment-balance-activity-deposit-fee-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Deposit Fee Detail - -## Structure - -`PaymentBalanceActivityDepositFeeDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `payoutId` | `string \| null \| undefined` | Optional | The ID of the payout that triggered this deposit fee activity. | - -## Example (as JSON) - -```json -{ - "payout_id": "payout_id2" -} -``` - diff --git a/doc/models/payment-balance-activity-deposit-fee-reversed-detail.md b/doc/models/payment-balance-activity-deposit-fee-reversed-detail.md deleted file mode 100644 index 9957bd972..000000000 --- a/doc/models/payment-balance-activity-deposit-fee-reversed-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Deposit Fee Reversed Detail - -## Structure - -`PaymentBalanceActivityDepositFeeReversedDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `payoutId` | `string \| null \| undefined` | Optional | The ID of the payout that triggered this deposit fee activity. | - -## Example (as JSON) - -```json -{ - "payout_id": "payout_id6" -} -``` - diff --git a/doc/models/payment-balance-activity-dispute-detail.md b/doc/models/payment-balance-activity-dispute-detail.md deleted file mode 100644 index 3ecbac92b..000000000 --- a/doc/models/payment-balance-activity-dispute-detail.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Payment Balance Activity Dispute Detail - -## Structure - -`PaymentBalanceActivityDisputeDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `disputeId` | `string \| null \| undefined` | Optional | The ID of the dispute associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id2", - "dispute_id": "dispute_id4" -} -``` - diff --git a/doc/models/payment-balance-activity-fee-detail.md b/doc/models/payment-balance-activity-fee-detail.md deleted file mode 100644 index 7a1d1a32d..000000000 --- a/doc/models/payment-balance-activity-fee-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Fee Detail - -## Structure - -`PaymentBalanceActivityFeeDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity
This will only be populated when a principal LedgerEntryToken is also populated.
If the fee is independent (there is no principal LedgerEntryToken) then this will likely not
be populated. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id2" -} -``` - diff --git a/doc/models/payment-balance-activity-free-processing-detail.md b/doc/models/payment-balance-activity-free-processing-detail.md deleted file mode 100644 index 25c6e276e..000000000 --- a/doc/models/payment-balance-activity-free-processing-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Free Processing Detail - -## Structure - -`PaymentBalanceActivityFreeProcessingDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id8" -} -``` - diff --git a/doc/models/payment-balance-activity-hold-adjustment-detail.md b/doc/models/payment-balance-activity-hold-adjustment-detail.md deleted file mode 100644 index 4f34a3446..000000000 --- a/doc/models/payment-balance-activity-hold-adjustment-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Hold Adjustment Detail - -## Structure - -`PaymentBalanceActivityHoldAdjustmentDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6" -} -``` - diff --git a/doc/models/payment-balance-activity-open-dispute-detail.md b/doc/models/payment-balance-activity-open-dispute-detail.md deleted file mode 100644 index 365fb6da7..000000000 --- a/doc/models/payment-balance-activity-open-dispute-detail.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Payment Balance Activity Open Dispute Detail - -## Structure - -`PaymentBalanceActivityOpenDisputeDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `disputeId` | `string \| null \| undefined` | Optional | The ID of the dispute associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6", - "dispute_id": "dispute_id8" -} -``` - diff --git a/doc/models/payment-balance-activity-other-adjustment-detail.md b/doc/models/payment-balance-activity-other-adjustment-detail.md deleted file mode 100644 index bab5cd90b..000000000 --- a/doc/models/payment-balance-activity-other-adjustment-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Other Adjustment Detail - -## Structure - -`PaymentBalanceActivityOtherAdjustmentDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id4" -} -``` - diff --git a/doc/models/payment-balance-activity-other-detail.md b/doc/models/payment-balance-activity-other-detail.md deleted file mode 100644 index 780ccde44..000000000 --- a/doc/models/payment-balance-activity-other-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Other Detail - -## Structure - -`PaymentBalanceActivityOtherDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id4" -} -``` - diff --git a/doc/models/payment-balance-activity-refund-detail.md b/doc/models/payment-balance-activity-refund-detail.md deleted file mode 100644 index 313751470..000000000 --- a/doc/models/payment-balance-activity-refund-detail.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Payment Balance Activity Refund Detail - -## Structure - -`PaymentBalanceActivityRefundDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `refundId` | `string \| null \| undefined` | Optional | The ID of the refund associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6", - "refund_id": "refund_id0" -} -``` - diff --git a/doc/models/payment-balance-activity-release-adjustment-detail.md b/doc/models/payment-balance-activity-release-adjustment-detail.md deleted file mode 100644 index eed1ef79e..000000000 --- a/doc/models/payment-balance-activity-release-adjustment-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Release Adjustment Detail - -## Structure - -`PaymentBalanceActivityReleaseAdjustmentDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id0" -} -``` - diff --git a/doc/models/payment-balance-activity-reserve-hold-detail.md b/doc/models/payment-balance-activity-reserve-hold-detail.md deleted file mode 100644 index 63bb82632..000000000 --- a/doc/models/payment-balance-activity-reserve-hold-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Reserve Hold Detail - -## Structure - -`PaymentBalanceActivityReserveHoldDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id8" -} -``` - diff --git a/doc/models/payment-balance-activity-reserve-release-detail.md b/doc/models/payment-balance-activity-reserve-release-detail.md deleted file mode 100644 index 2efd90567..000000000 --- a/doc/models/payment-balance-activity-reserve-release-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Reserve Release Detail - -## Structure - -`PaymentBalanceActivityReserveReleaseDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6" -} -``` - diff --git a/doc/models/payment-balance-activity-square-capital-payment-detail.md b/doc/models/payment-balance-activity-square-capital-payment-detail.md deleted file mode 100644 index b7fb83b8c..000000000 --- a/doc/models/payment-balance-activity-square-capital-payment-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Square Capital Payment Detail - -## Structure - -`PaymentBalanceActivitySquareCapitalPaymentDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6" -} -``` - diff --git a/doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md b/doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md deleted file mode 100644 index d873bed5a..000000000 --- a/doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Square Capital Reversed Payment Detail - -## Structure - -`PaymentBalanceActivitySquareCapitalReversedPaymentDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id8" -} -``` - diff --git a/doc/models/payment-balance-activity-square-payroll-transfer-detail.md b/doc/models/payment-balance-activity-square-payroll-transfer-detail.md deleted file mode 100644 index 32a1a7dc9..000000000 --- a/doc/models/payment-balance-activity-square-payroll-transfer-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Square Payroll Transfer Detail - -## Structure - -`PaymentBalanceActivitySquarePayrollTransferDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id0" -} -``` - diff --git a/doc/models/payment-balance-activity-square-payroll-transfer-reversed-detail.md b/doc/models/payment-balance-activity-square-payroll-transfer-reversed-detail.md deleted file mode 100644 index 18bb6d83b..000000000 --- a/doc/models/payment-balance-activity-square-payroll-transfer-reversed-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Square Payroll Transfer Reversed Detail - -## Structure - -`PaymentBalanceActivitySquarePayrollTransferReversedDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6" -} -``` - diff --git a/doc/models/payment-balance-activity-tax-on-fee-detail.md b/doc/models/payment-balance-activity-tax-on-fee-detail.md deleted file mode 100644 index f081b232c..000000000 --- a/doc/models/payment-balance-activity-tax-on-fee-detail.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Payment Balance Activity Tax on Fee Detail - -## Structure - -`PaymentBalanceActivityTaxOnFeeDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `taxRateDescription` | `string \| null \| undefined` | Optional | The description of the tax rate being applied. For example: "GST", "HST". | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id0", - "tax_rate_description": "tax_rate_description8" -} -``` - diff --git a/doc/models/payment-balance-activity-third-party-fee-detail.md b/doc/models/payment-balance-activity-third-party-fee-detail.md deleted file mode 100644 index e148d00dc..000000000 --- a/doc/models/payment-balance-activity-third-party-fee-detail.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Payment Balance Activity Third Party Fee Detail - -## Structure - -`PaymentBalanceActivityThirdPartyFeeDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id8" -} -``` - diff --git a/doc/models/payment-balance-activity-third-party-fee-refund-detail.md b/doc/models/payment-balance-activity-third-party-fee-refund-detail.md deleted file mode 100644 index 21e137e80..000000000 --- a/doc/models/payment-balance-activity-third-party-fee-refund-detail.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Payment Balance Activity Third Party Fee Refund Detail - -## Structure - -`PaymentBalanceActivityThirdPartyFeeRefundDetail` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this activity. | -| `refundId` | `string \| null \| undefined` | Optional | The public refund id associated with this activity. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6", - "refund_id": "refund_id0" -} -``` - diff --git a/doc/models/payment-link-related-resources.md b/doc/models/payment-link-related-resources.md deleted file mode 100644 index b7103d3b5..000000000 --- a/doc/models/payment-link-related-resources.md +++ /dev/null @@ -1,223 +0,0 @@ - -# Payment Link Related Resources - -## Structure - -`PaymentLinkRelatedResources` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orders` | [`Order[] \| null \| undefined`](../../doc/models/order.md) | Optional | The order associated with the payment link. | -| `subscriptionPlans` | [`CatalogObject[] \| null \| undefined`](../../doc/models/catalog-object.md) | Optional | The subscription plan associated with the payment link. | - -## Example (as JSON) - -```json -{ - "orders": [ - { - "id": "id2", - "location_id": "location_id6", - "reference_id": "reference_id0", - "source": { - "name": "name4" - }, - "customer_id": "customer_id0", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] - }, - { - "id": "id2", - "location_id": "location_id6", - "reference_id": "reference_id0", - "source": { - "name": "name4" - }, - "customer_id": "customer_id0", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] - } - ], - "subscription_plans": [ - { - "type": "ITEM_OPTION", - "id": "id4", - "updated_at": "updated_at0", - "version": 112, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "type": "ITEM_OPTION", - "id": "id4", - "updated_at": "updated_at0", - "version": 112, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ] -} -``` - diff --git a/doc/models/payment-link.md b/doc/models/payment-link.md deleted file mode 100644 index 84dcfe16e..000000000 --- a/doc/models/payment-link.md +++ /dev/null @@ -1,59 +0,0 @@ - -# Payment Link - -## Structure - -`PaymentLink` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the payment link. | -| `version` | `number` | Required | The Square-assigned version number, which is incremented each time an update is committed to the payment link.
**Constraints**: `<= 65535` | -| `description` | `string \| null \| undefined` | Optional | The optional description of the `payment_link` object.
It is primarily for use by your application and is not used anywhere.
**Constraints**: *Maximum Length*: `4096` | -| `orderId` | `string \| undefined` | Optional | The ID of the order associated with the payment link.
**Constraints**: *Maximum Length*: `192` | -| `checkoutOptions` | [`CheckoutOptions \| undefined`](../../doc/models/checkout-options.md) | Optional | - | -| `prePopulatedData` | [`PrePopulatedData \| undefined`](../../doc/models/pre-populated-data.md) | Optional | Describes buyer data to prepopulate in the payment form.
For more information,
see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). | -| `url` | `string \| undefined` | Optional | The shortened URL of the payment link.
**Constraints**: *Maximum Length*: `255` | -| `longUrl` | `string \| undefined` | Optional | The long URL of the payment link.
**Constraints**: *Maximum Length*: `255` | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the payment link was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the payment link was last updated, in RFC 3339 format. | -| `paymentNote` | `string \| null \| undefined` | Optional | An optional note. After Square processes the payment, this note is added to the
resulting `Payment`.
**Constraints**: *Maximum Length*: `500` | - -## Example (as JSON) - -```json -{ - "id": "id2", - "version": 64, - "description": "description8", - "order_id": "order_id4", - "checkout_options": { - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id8", - "redirect_url": "redirect_url2", - "merchant_support_email": "merchant_support_email8" - }, - "pre_populated_data": { - "buyer_email": "buyer_email8", - "buyer_phone_number": "buyer_phone_number0", - "buyer_address": { - "address_line_1": "address_line_12", - "address_line_2": "address_line_22", - "address_line_3": "address_line_38", - "locality": "locality2", - "sublocality": "sublocality2" - } - } -} -``` - diff --git a/doc/models/payment-options-delay-action.md b/doc/models/payment-options-delay-action.md deleted file mode 100644 index 447fa0c11..000000000 --- a/doc/models/payment-options-delay-action.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Payment Options Delay Action - -Describes the action to be applied to a delayed capture payment when the delay_duration -has elapsed. - -## Enumeration - -`PaymentOptionsDelayAction` - -## Fields - -| Name | Description | -| --- | --- | -| `CANCEL` | Indicates that the payment should be automatically canceled when the delay duration
elapses. | -| `COMPLETE` | Indicates that the payment should be automatically completed when the delay duration
elapses. | - diff --git a/doc/models/payment-options.md b/doc/models/payment-options.md deleted file mode 100644 index 816f2f825..000000000 --- a/doc/models/payment-options.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Payment Options - -## Structure - -`PaymentOptions` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `autocomplete` | `boolean \| null \| undefined` | Optional | Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically
`COMPLETED` or left in an `APPROVED` state for later modification. | -| `delayDuration` | `string \| null \| undefined` | Optional | The duration of time after the payment's creation when Square automatically cancels the
payment. This automatic cancellation applies only to payments that do not reach a terminal state
(COMPLETED or CANCELED) before the `delay_duration` time period.

This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value
of 1 minute.

Note: This feature is only supported for card payments. This parameter can only be set for a delayed
capture payment (`autocomplete=false`).
Default:

- Card-present payments: "PT36H" (36 hours) from the creation time.
- Card-not-present payments: "P7D" (7 days) from the creation time. | -| `acceptPartialAuthorization` | `boolean \| null \| undefined` | Optional | If set to `true` and charging a Square Gift Card, a payment might be returned with
`amount_money` equal to less than what was requested. For example, a request for $20 when charging
a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose
to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card
payment.

This field cannot be `true` when `autocomplete = true`.
This field cannot be `true` when an `order_id` isn't specified.

For more information, see
[Take Partial Payments](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/partial-payments-with-gift-cards).

Default: false | -| `delayAction` | [`string \| undefined`](../../doc/models/payment-options-delay-action.md) | Optional | Describes the action to be applied to a delayed capture payment when the delay_duration
has elapsed. | - -## Example (as JSON) - -```json -{ - "autocomplete": false, - "delay_duration": "delay_duration8", - "accept_partial_authorization": false, - "delay_action": "CANCEL" -} -``` - diff --git a/doc/models/payment-refund.md b/doc/models/payment-refund.md deleted file mode 100644 index 8be0d8b46..000000000 --- a/doc/models/payment-refund.md +++ /dev/null @@ -1,75 +0,0 @@ - -# Payment Refund - -Represents a refund of a payment made using Square. Contains information about -the original payment and the amount of money refunded. - -## Structure - -`PaymentRefund` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Required | The unique ID for this refund, generated by Square.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `status` | `string \| null \| undefined` | Optional | The refund's status:

- `PENDING` - Awaiting approval.
- `COMPLETED` - Successfully completed.
- `REJECTED` - The refund was rejected.
- `FAILED` - An error occurred.
**Constraints**: *Maximum Length*: `50` | -| `locationId` | `string \| null \| undefined` | Optional | The location ID associated with the payment this refund is attached to.
**Constraints**: *Maximum Length*: `50` | -| `unlinked` | `boolean \| undefined` | Optional | Flag indicating whether or not the refund is linked to an existing payment in Square. | -| `destinationType` | `string \| null \| undefined` | Optional | The destination type for this refund.

Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`,
`EXTERNAL`, and `SQUARE_ACCOUNT`.
**Constraints**: *Maximum Length*: `50` | -| `destinationDetails` | [`DestinationDetails \| undefined`](../../doc/models/destination-details.md) | Optional | Details about a refund's destination. | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `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. | -| `processingFee` | [`ProcessingFee[] \| null \| undefined`](../../doc/models/processing-fee.md) | Optional | Processing fees and fee adjustments assessed by Square for this refund. | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the payment associated with this refund.
**Constraints**: *Maximum Length*: `192` | -| `orderId` | `string \| null \| undefined` | Optional | The ID of the order associated with the refund.
**Constraints**: *Maximum Length*: `192` | -| `reason` | `string \| null \| undefined` | Optional | The reason for the refund.
**Constraints**: *Maximum Length*: `192` | -| `createdAt` | `string \| undefined` | Optional | The timestamp of when the refund was created, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | -| `updatedAt` | `string \| undefined` | Optional | The timestamp of when the refund was last updated, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | -| `teamMemberId` | `string \| undefined` | Optional | An optional ID of the team member associated with taking the payment.
**Constraints**: *Maximum Length*: `192` | -| `terminalRefundId` | `string \| undefined` | Optional | An optional ID for a Terminal refund. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "status": "status6", - "location_id": "location_id8", - "unlinked": false, - "destination_type": "destination_type8", - "destination_details": { - "card_details": { - "card": { - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "entry_method": "entry_method8", - "auth_result_code": "auth_result_code0" - }, - "cash_details": { - "seller_supplied_money": { - "amount": 36, - "currency": "MKD" - }, - "change_back_money": { - "amount": 78, - "currency": "XBD" - } - }, - "external_details": { - "type": "type6", - "source": "source0", - "source_id": "source_id8" - } - }, - "amount_money": { - "amount": 186, - "currency": "AUD" - } -} -``` - diff --git a/doc/models/payment-sort-field.md b/doc/models/payment-sort-field.md deleted file mode 100644 index 4fe5d19e2..000000000 --- a/doc/models/payment-sort-field.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Payment Sort Field - -## Enumeration - -`PaymentSortField` - -## Fields - -| Name | -| --- | -| `CREATED_AT` | -| `OFFLINE_CREATED_AT` | -| `UPDATED_AT` | - diff --git a/doc/models/payment.md b/doc/models/payment.md deleted file mode 100644 index ba40bcec2..000000000 --- a/doc/models/payment.md +++ /dev/null @@ -1,76 +0,0 @@ - -# Payment - -Represents a payment processed by the Square API. - -## Structure - -`Payment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique ID for the payment.
**Constraints**: *Maximum Length*: `192` | -| `createdAt` | `string \| undefined` | Optional | The timestamp of when the payment was created, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | -| `updatedAt` | `string \| undefined` | Optional | The timestamp of when the payment was last updated, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | -| `amountMoney` | [`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. | -| `tipMoney` | [`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. | -| `totalMoney` | [`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. | -| `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. | -| `approvedMoney` | [`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. | -| `processingFee` | [`ProcessingFee[] \| undefined`](../../doc/models/processing-fee.md) | Optional | The processing fees and fee adjustments assessed by Square for this payment. | -| `refundedMoney` | [`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. | -| `status` | `string \| undefined` | Optional | Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED.
**Constraints**: *Maximum Length*: `50` | -| `delayDuration` | `string \| undefined` | Optional | The duration of time after the payment's creation when Square automatically applies the
`delay_action` to the payment. This automatic `delay_action` applies only to payments that
do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the `delay_duration`
time period.

This field is specified as a time duration, in RFC 3339 format.

Notes:
This feature is only supported for card payments.

Default:

- Card-present payments: "PT36H" (36 hours) from the creation time.
- Card-not-present payments: "P7D" (7 days) from the creation time. | -| `delayAction` | `string \| null \| undefined` | Optional | The action to be applied to the payment when the `delay_duration` has elapsed.

Current values include `CANCEL` and `COMPLETE`. | -| `delayedUntil` | `string \| undefined` | Optional | The read-only timestamp of when the `delay_action` is automatically applied,
in RFC 3339 format.

Note that this field is calculated by summing the payment's `delay_duration` and `created_at`
fields. The `created_at` field is generated by Square and might not exactly match the
time on your local machine. | -| `sourceType` | `string \| undefined` | Optional | The source type for this payment.

Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `SQUARE_ACCOUNT`,
`CASH` and `EXTERNAL`. For information about these payment source types,
see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
**Constraints**: *Maximum Length*: `50` | -| `cardDetails` | [`CardPaymentDetails \| undefined`](../../doc/models/card-payment-details.md) | Optional | Reflects the current status of a card payment. Contains only non-confidential information. | -| `cashDetails` | [`CashPaymentDetails \| undefined`](../../doc/models/cash-payment-details.md) | Optional | Stores details about a cash payment. Contains only non-confidential information. For more information, see
[Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). | -| `bankAccountDetails` | [`BankAccountPaymentDetails \| undefined`](../../doc/models/bank-account-payment-details.md) | Optional | Additional details about BANK_ACCOUNT type payments. | -| `externalDetails` | [`ExternalPaymentDetails \| undefined`](../../doc/models/external-payment-details.md) | Optional | Stores details about an external payment. Contains only non-confidential information.
For more information, see
[Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). | -| `walletDetails` | [`DigitalWalletDetails \| undefined`](../../doc/models/digital-wallet-details.md) | Optional | Additional details about `WALLET` type payments. Contains only non-confidential information. | -| `buyNowPayLaterDetails` | [`BuyNowPayLaterDetails \| undefined`](../../doc/models/buy-now-pay-later-details.md) | Optional | Additional details about a Buy Now Pay Later payment type. | -| `squareAccountDetails` | [`SquareAccountDetails \| undefined`](../../doc/models/square-account-details.md) | Optional | Additional details about Square Account payments. | -| `locationId` | `string \| undefined` | Optional | The ID of the location associated with the payment.
**Constraints**: *Maximum Length*: `50` | -| `orderId` | `string \| undefined` | Optional | The ID of the order associated with the payment.
**Constraints**: *Maximum Length*: `192` | -| `referenceId` | `string \| undefined` | Optional | An optional ID that associates the payment with an entity in
another system.
**Constraints**: *Maximum Length*: `40` | -| `customerId` | `string \| undefined` | Optional | The ID of the customer associated with the payment. If the ID is
not provided in the `CreatePayment` request that was used to create the `Payment`,
Square may use information in the request
(such as the billing and shipping address, email address, and payment source)
to identify a matching customer profile in the Customer Directory.
If found, the profile ID is used. If a profile is not found, the
API attempts to create an
[instant profile](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles).
If the API cannot create an
instant profile (either because the seller has disabled it or the
seller's region prevents creating it), this field remains unset. Note that
this process is asynchronous and it may take some time before a
customer ID is added to the payment.
**Constraints**: *Maximum Length*: `191` | -| `employeeId` | `string \| undefined` | Optional | __Deprecated__: Use `Payment.team_member_id` instead.

An optional ID of the employee associated with taking the payment.
**Constraints**: *Maximum Length*: `192` | -| `teamMemberId` | `string \| null \| undefined` | Optional | An optional ID of the [TeamMember](entity:TeamMember) associated with taking the payment.
**Constraints**: *Maximum Length*: `192` | -| `refundIds` | `string[] \| undefined` | Optional | A list of `refund_id`s identifying refunds for the payment. | -| `riskEvaluation` | [`RiskEvaluation \| undefined`](../../doc/models/risk-evaluation.md) | Optional | Represents fraud risk information for the associated payment.

When you take a payment through Square's Payments API (using the `CreatePayment`
endpoint), Square evaluates it and assigns a risk level to the payment. Sellers
can use this information to determine the course of action (for example,
provide the goods/services or refund the payment). | -| `terminalCheckoutId` | `string \| undefined` | Optional | An optional ID for a Terminal checkout that is associated with the payment. | -| `buyerEmailAddress` | `string \| undefined` | Optional | The buyer's email address.
**Constraints**: *Maximum Length*: `255` | -| `billingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `shippingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `note` | `string \| undefined` | Optional | An optional note to include when creating a payment.
**Constraints**: *Maximum Length*: `500` | -| `statementDescriptionIdentifier` | `string \| undefined` | Optional | Additional payment information that gets added to the customer's card statement
as part of the statement description.

Note that the `statement_description_identifier` might get truncated on the statement description
to fit the required information including the Square identifier (SQ *) and the name of the
seller taking the payment. | -| `capabilities` | `string[] \| undefined` | Optional | Actions that can be performed on this payment:

- `EDIT_AMOUNT_UP` - The payment amount can be edited up.
- `EDIT_AMOUNT_DOWN` - The payment amount can be edited down.
- `EDIT_TIP_AMOUNT_UP` - The tip amount can be edited up.
- `EDIT_TIP_AMOUNT_DOWN` - The tip amount can be edited down.
- `EDIT_DELAY_ACTION` - The delay_action can be edited. | -| `receiptNumber` | `string \| undefined` | Optional | The payment's receipt number.
The field is missing if a payment is canceled.
**Constraints**: *Maximum Length*: `4` | -| `receiptUrl` | `string \| undefined` | Optional | The URL for the payment's receipt.
The field is only populated for COMPLETED payments.
**Constraints**: *Maximum Length*: `255` | -| `deviceDetails` | [`DeviceDetails \| undefined`](../../doc/models/device-details.md) | Optional | Details about the device that took the payment. | -| `applicationDetails` | [`ApplicationDetails \| undefined`](../../doc/models/application-details.md) | Optional | Details about the application that took the payment. | -| `isOfflinePayment` | `boolean \| undefined` | Optional | Whether or not this payment was taken offline. | -| `offlinePaymentDetails` | [`OfflinePaymentDetails \| undefined`](../../doc/models/offline-payment-details.md) | Optional | Details specific to offline payments. | -| `versionToken` | `string \| null \| undefined` | Optional | Used for optimistic concurrency. This opaque token identifies a specific version of the
`Payment` object. | - -## Example (as JSON) - -```json -{ - "id": "id8", - "created_at": "created_at6", - "updated_at": "updated_at4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "tip_money": { - "amount": 190, - "currency": "TWD" - } -} -``` - diff --git a/doc/models/payout-entry.md b/doc/models/payout-entry.md deleted file mode 100644 index 1b4595b33..000000000 --- a/doc/models/payout-entry.md +++ /dev/null @@ -1,70 +0,0 @@ - -# Payout Entry - -One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity. -The total amount of the payout will equal the sum of the payout entries for a batch payout - -## Structure - -`PayoutEntry` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Required | A unique ID for the payout entry.
**Constraints**: *Minimum Length*: `1` | -| `payoutId` | `string` | Required | The ID of the payout entries’ associated payout.
**Constraints**: *Minimum Length*: `1` | -| `effectiveAt` | `string \| null \| undefined` | Optional | The timestamp of when the payout entry affected the balance, in RFC 3339 format. | -| `type` | [`string \| undefined`](../../doc/models/activity-type.md) | Optional | - | -| `grossAmountMoney` | [`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. | -| `feeAmountMoney` | [`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. | -| `netAmountMoney` | [`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. | -| `typeAppFeeRevenueDetails` | [`PaymentBalanceActivityAppFeeRevenueDetail \| undefined`](../../doc/models/payment-balance-activity-app-fee-revenue-detail.md) | Optional | - | -| `typeAppFeeRefundDetails` | [`PaymentBalanceActivityAppFeeRefundDetail \| undefined`](../../doc/models/payment-balance-activity-app-fee-refund-detail.md) | Optional | - | -| `typeAutomaticSavingsDetails` | [`PaymentBalanceActivityAutomaticSavingsDetail \| undefined`](../../doc/models/payment-balance-activity-automatic-savings-detail.md) | Optional | - | -| `typeAutomaticSavingsReversedDetails` | [`PaymentBalanceActivityAutomaticSavingsReversedDetail \| undefined`](../../doc/models/payment-balance-activity-automatic-savings-reversed-detail.md) | Optional | - | -| `typeChargeDetails` | [`PaymentBalanceActivityChargeDetail \| undefined`](../../doc/models/payment-balance-activity-charge-detail.md) | Optional | - | -| `typeDepositFeeDetails` | [`PaymentBalanceActivityDepositFeeDetail \| undefined`](../../doc/models/payment-balance-activity-deposit-fee-detail.md) | Optional | - | -| `typeDepositFeeReversedDetails` | [`PaymentBalanceActivityDepositFeeReversedDetail \| undefined`](../../doc/models/payment-balance-activity-deposit-fee-reversed-detail.md) | Optional | - | -| `typeDisputeDetails` | [`PaymentBalanceActivityDisputeDetail \| undefined`](../../doc/models/payment-balance-activity-dispute-detail.md) | Optional | - | -| `typeFeeDetails` | [`PaymentBalanceActivityFeeDetail \| undefined`](../../doc/models/payment-balance-activity-fee-detail.md) | Optional | - | -| `typeFreeProcessingDetails` | [`PaymentBalanceActivityFreeProcessingDetail \| undefined`](../../doc/models/payment-balance-activity-free-processing-detail.md) | Optional | - | -| `typeHoldAdjustmentDetails` | [`PaymentBalanceActivityHoldAdjustmentDetail \| undefined`](../../doc/models/payment-balance-activity-hold-adjustment-detail.md) | Optional | - | -| `typeOpenDisputeDetails` | [`PaymentBalanceActivityOpenDisputeDetail \| undefined`](../../doc/models/payment-balance-activity-open-dispute-detail.md) | Optional | - | -| `typeOtherDetails` | [`PaymentBalanceActivityOtherDetail \| undefined`](../../doc/models/payment-balance-activity-other-detail.md) | Optional | - | -| `typeOtherAdjustmentDetails` | [`PaymentBalanceActivityOtherAdjustmentDetail \| undefined`](../../doc/models/payment-balance-activity-other-adjustment-detail.md) | Optional | - | -| `typeRefundDetails` | [`PaymentBalanceActivityRefundDetail \| undefined`](../../doc/models/payment-balance-activity-refund-detail.md) | Optional | - | -| `typeReleaseAdjustmentDetails` | [`PaymentBalanceActivityReleaseAdjustmentDetail \| undefined`](../../doc/models/payment-balance-activity-release-adjustment-detail.md) | Optional | - | -| `typeReserveHoldDetails` | [`PaymentBalanceActivityReserveHoldDetail \| undefined`](../../doc/models/payment-balance-activity-reserve-hold-detail.md) | Optional | - | -| `typeReserveReleaseDetails` | [`PaymentBalanceActivityReserveReleaseDetail \| undefined`](../../doc/models/payment-balance-activity-reserve-release-detail.md) | Optional | - | -| `typeSquareCapitalPaymentDetails` | [`PaymentBalanceActivitySquareCapitalPaymentDetail \| undefined`](../../doc/models/payment-balance-activity-square-capital-payment-detail.md) | Optional | - | -| `typeSquareCapitalReversedPaymentDetails` | [`PaymentBalanceActivitySquareCapitalReversedPaymentDetail \| undefined`](../../doc/models/payment-balance-activity-square-capital-reversed-payment-detail.md) | Optional | - | -| `typeTaxOnFeeDetails` | [`PaymentBalanceActivityTaxOnFeeDetail \| undefined`](../../doc/models/payment-balance-activity-tax-on-fee-detail.md) | Optional | - | -| `typeThirdPartyFeeDetails` | [`PaymentBalanceActivityThirdPartyFeeDetail \| undefined`](../../doc/models/payment-balance-activity-third-party-fee-detail.md) | Optional | - | -| `typeThirdPartyFeeRefundDetails` | [`PaymentBalanceActivityThirdPartyFeeRefundDetail \| undefined`](../../doc/models/payment-balance-activity-third-party-fee-refund-detail.md) | Optional | - | -| `typeSquarePayrollTransferDetails` | [`PaymentBalanceActivitySquarePayrollTransferDetail \| undefined`](../../doc/models/payment-balance-activity-square-payroll-transfer-detail.md) | Optional | - | -| `typeSquarePayrollTransferReversedDetails` | [`PaymentBalanceActivitySquarePayrollTransferReversedDetail \| undefined`](../../doc/models/payment-balance-activity-square-payroll-transfer-reversed-detail.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "id": "id8", - "payout_id": "payout_id4", - "effective_at": "effective_at8", - "type": "AUTOMATIC_SAVINGS_REVERSED", - "gross_amount_money": { - "amount": 186, - "currency": "MNT" - }, - "fee_amount_money": { - "amount": 126, - "currency": "CHF" - }, - "net_amount_money": { - "amount": 6, - "currency": "XPT" - } -} -``` - diff --git a/doc/models/payout-fee-type.md b/doc/models/payout-fee-type.md deleted file mode 100644 index afc863d6c..000000000 --- a/doc/models/payout-fee-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Payout Fee Type - -Represents the type of payout fee that can incur as part of a payout. - -## Enumeration - -`PayoutFeeType` - -## Fields - -| Name | Description | -| --- | --- | -| `TRANSFER_FEE` | Fee type associated with transfers. | -| `TAX_ON_TRANSFER_FEE` | Taxes associated with the transfer fee. | - diff --git a/doc/models/payout-fee.md b/doc/models/payout-fee.md deleted file mode 100644 index 0a1d6649a..000000000 --- a/doc/models/payout-fee.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Payout Fee - -Represents a payout fee that can incur as part of a payout. - -## Structure - -`PayoutFee` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amountMoney` | [`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. | -| `effectiveAt` | `string \| null \| undefined` | Optional | The timestamp of when the fee takes effect, in RFC 3339 format. | -| `type` | [`string \| undefined`](../../doc/models/payout-fee-type.md) | Optional | Represents the type of payout fee that can incur as part of a payout. | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "effective_at": "effective_at0", - "type": "TRANSFER_FEE" -} -``` - diff --git a/doc/models/payout-status.md b/doc/models/payout-status.md deleted file mode 100644 index c46bf5af0..000000000 --- a/doc/models/payout-status.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Payout Status - -Payout status types - -## Enumeration - -`PayoutStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `SENT` | Indicates that the payout was successfully sent to the banking destination. | -| `FAILED` | Indicates that the payout was rejected by the banking destination. | -| `PAID` | Indicates that the payout has successfully completed. | - diff --git a/doc/models/payout-type.md b/doc/models/payout-type.md deleted file mode 100644 index 88d9aff02..000000000 --- a/doc/models/payout-type.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Payout Type - -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. - -## Enumeration - -`PayoutType` - -## Fields - -| Name | Description | -| --- | --- | -| `BATCH` | Payouts that include a list of payout entries that can be considered settled. | -| `SIMPLE` | Payouts that do not have any payout entries associated with them and will
show up as one of the payout entries in a future BATCH payout. | - diff --git a/doc/models/payout.md b/doc/models/payout.md deleted file mode 100644 index b8a038333..000000000 --- a/doc/models/payout.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Payout - -An accounting of the amount owed the seller and record of the actual transfer to their -external bank account or to the Square balance. - -## Structure - -`Payout` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Required | A unique ID for the payout.
**Constraints**: *Minimum Length*: `1` | -| `status` | [`string \| undefined`](../../doc/models/payout-status.md) | Optional | Payout status types | -| `locationId` | `string` | Required | The ID of the location associated with the payout.
**Constraints**: *Minimum Length*: `1` | -| `createdAt` | `string \| undefined` | Optional | The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp of when the payout was last updated, in RFC 3339 format. | -| `amountMoney` | [`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. | -| `destination` | [`Destination \| undefined`](../../doc/models/destination.md) | Optional | Information about the destination against which the payout was made. | -| `version` | `number \| undefined` | Optional | The version number, which is incremented each time an update is made to this payout record.
The version number helps developers receive event notifications or feeds out of order. | -| `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[] \| null \| 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 \| null \| 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 \| null \| 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) - -```json -{ - "id": "id4", - "status": "SENT", - "location_id": "location_id8", - "created_at": "created_at2", - "updated_at": "updated_at0", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "destination": { - "type": "BANK_ACCOUNT", - "id": "id4" - } -} -``` - diff --git a/doc/models/phase-input.md b/doc/models/phase-input.md deleted file mode 100644 index 61d548564..000000000 --- a/doc/models/phase-input.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Phase Input - -Represents the arguments used to construct a new phase. - -## Structure - -`PhaseInput` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `ordinal` | `bigint` | Required | index of phase in total subscription plan | -| `orderTemplateId` | `string \| null \| undefined` | Optional | id of order to be used in billing | - -## Example (as JSON) - -```json -{ - "ordinal": 234, - "order_template_id": "order_template_id4" -} -``` - diff --git a/doc/models/phase.md b/doc/models/phase.md deleted file mode 100644 index de445effb..000000000 --- a/doc/models/phase.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Phase - -Represents a phase, which can override subscription phases as defined by plan_id - -## Structure - -`Phase` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | id of subscription phase | -| `ordinal` | `bigint \| null \| undefined` | Optional | index of phase in total subscription plan | -| `orderTemplateId` | `string \| null \| undefined` | Optional | id of order to be used in billing | -| `planPhaseUid` | `string \| null \| undefined` | Optional | the uid from the plan's phase in catalog | - -## Example (as JSON) - -```json -{ - "uid": "uid4", - "ordinal": 12, - "order_template_id": "order_template_id6", - "plan_phase_uid": "plan_phase_uid0" -} -``` - diff --git a/doc/models/pre-populated-data.md b/doc/models/pre-populated-data.md deleted file mode 100644 index 4e67c827d..000000000 --- a/doc/models/pre-populated-data.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Pre Populated Data - -Describes buyer data to prepopulate in the payment form. -For more information, -see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). - -## Structure - -`PrePopulatedData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `buyerEmail` | `string \| null \| undefined` | Optional | The buyer email to prepopulate in the payment form.
**Constraints**: *Maximum Length*: `256` | -| `buyerPhoneNumber` | `string \| null \| undefined` | Optional | The buyer phone number to prepopulate in the payment form.
**Constraints**: *Maximum Length*: `17` | -| `buyerAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | - -## Example (as JSON) - -```json -{ - "buyer_email": "buyer_email8", - "buyer_phone_number": "buyer_phone_number0", - "buyer_address": { - "address_line_1": "address_line_12", - "address_line_2": "address_line_22", - "address_line_3": "address_line_38", - "locality": "locality2", - "sublocality": "sublocality2" - } -} -``` - diff --git a/doc/models/processing-fee.md b/doc/models/processing-fee.md deleted file mode 100644 index 2d8d8b0e5..000000000 --- a/doc/models/processing-fee.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Processing Fee - -Represents the Square processing fee. - -## Structure - -`ProcessingFee` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `effectiveAt` | `string \| null \| undefined` | Optional | The timestamp of when the fee takes effect, in RFC 3339 format. | -| `type` | `string \| null \| undefined` | Optional | The type of fee assessed or adjusted. The fee type can be `INITIAL` or `ADJUSTMENT`. | -| `amountMoney` | [`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 -{ - "effective_at": "effective_at2", - "type": "type8", - "amount_money": { - "amount": 186, - "currency": "AUD" - } -} -``` - diff --git a/doc/models/product-type.md b/doc/models/product-type.md deleted file mode 100644 index 650994b23..000000000 --- a/doc/models/product-type.md +++ /dev/null @@ -1,13 +0,0 @@ - -# Product Type - -## Enumeration - -`ProductType` - -## Fields - -| Name | -| --- | -| `TERMINAL_API` | - diff --git a/doc/models/product.md b/doc/models/product.md deleted file mode 100644 index 699d85d8e..000000000 --- a/doc/models/product.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Product - -Indicates the Square product used to generate a change. - -## Enumeration - -`Product` - -## Fields - -| Name | Description | -| --- | --- | -| `SQUARE_POS` | Square Point of Sale application. | -| `EXTERNAL_API` | Square Connect APIs (for example, Orders API or Checkout API). | -| `BILLING` | A Square subscription (various products). | -| `APPOINTMENTS` | Square Appointments. | -| `INVOICES` | Square Invoices. | -| `ONLINE_STORE` | Square Online Store. | -| `PAYROLL` | Square Payroll. | -| `DASHBOARD` | Square Dashboard. | -| `ITEM_LIBRARY_IMPORT` | Item Library Import. | -| `OTHER` | A Square product that does not match any other value. | - diff --git a/doc/models/publish-invoice-request.md b/doc/models/publish-invoice-request.md deleted file mode 100644 index 0c8355d04..000000000 --- a/doc/models/publish-invoice-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Publish Invoice Request - -Describes a `PublishInvoice` request. - -## Structure - -`PublishInvoiceRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number` | Required | The version of the [invoice](entity:Invoice) to publish.
This must match the current version of the invoice; otherwise, the request is rejected. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique string that identifies the `PublishInvoice` request. If you do not
provide `idempotency_key` (or provide an empty string as the value), the endpoint
treats each request as independent.

For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `128` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "32da42d0-1997-41b0-826b-f09464fc2c2e", - "version": 1 -} -``` - diff --git a/doc/models/publish-invoice-response.md b/doc/models/publish-invoice-response.md deleted file mode 100644 index f8e766bcd..000000000 --- a/doc/models/publish-invoice-response.md +++ /dev/null @@ -1,107 +0,0 @@ - -# Publish Invoice Response - -Describes a `PublishInvoice` response. - -## Structure - -`PublishInvoiceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoice` | [`Invoice \| undefined`](../../doc/models/invoice.md) | Optional | Stores information about an invoice. You use the Invoices API to create and manage
invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "invoice": { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": false - }, - "created_at": "2020-06-18T17:45:13Z", - "custom_fields": [ - { - "label": "Event Reference Number", - "placement": "ABOVE_LINE_ITEMS", - "value": "Ref. #1234" - }, - { - "label": "Terms of Service", - "placement": "BELOW_LINE_ITEMS", - "value": "The terms of service are..." - } - ], - "delivery_method": "EMAIL", - "description": "We appreciate your business!", - "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "invoice_number": "inv-100", - "location_id": "ES0RJRZYEC39A", - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "payment_requests": [ - { - "automatic_payment_source": "NONE", - "computed_amount_money": { - "amount": 10000, - "currency": "USD" - }, - "due_date": "2030-01-24", - "reminders": [ - { - "message": "Your invoice is due tomorrow", - "relative_scheduled_days": -1, - "status": "PENDING", - "uid": "beebd363-e47f-4075-8785-c235aaa7df11" - } - ], - "request_type": "BALANCE", - "tipping_enabled": true, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "public_url": "https://squareup.com/pay-invoice/inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "sale_or_service_date": "2030-01-24", - "scheduled_at": "2030-01-13T10:00:00Z", - "status": "SCHEDULED", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "title": "Event Planning Services", - "updated_at": "2020-06-18T18:23:11Z", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/qr-code-options.md b/doc/models/qr-code-options.md deleted file mode 100644 index 7e1743a2b..000000000 --- a/doc/models/qr-code-options.md +++ /dev/null @@ -1,27 +0,0 @@ - -# 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": "title8", - "body": "body8", - "barcode_contents": "barcode_contents4" -} -``` - diff --git a/doc/models/quantity-ratio.md b/doc/models/quantity-ratio.md deleted file mode 100644 index 47f214405..000000000 --- a/doc/models/quantity-ratio.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Quantity Ratio - -A whole number or unreduced fractional ratio. - -## Structure - -`QuantityRatio` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `quantity` | `number \| null \| undefined` | Optional | The whole or fractional quantity as the numerator. | -| `quantityDenominator` | `number \| null \| undefined` | Optional | The whole or fractional quantity as the denominator.
With fractional quantity this field is the denominator and quantity is the numerator.
The default value is `1`. For example, when `quantity=3` and `quantity_denominator` is unspecified,
the quantity ratio is `3` or `3/1`. | - -## Example (as JSON) - -```json -{ - "quantity": 86, - "quantity_denominator": 18 -} -``` - diff --git a/doc/models/quick-pay.md b/doc/models/quick-pay.md deleted file mode 100644 index ba846439a..000000000 --- a/doc/models/quick-pay.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Quick Pay - -Describes an ad hoc item and price to generate a quick pay checkout link. -For more information, -see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). - -## Structure - -`QuickPay` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string` | Required | The ad hoc item name. In the resulting `Order`, this name appears as the line item name.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | -| `priceMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `locationId` | `string` | Required | The ID of the business location the checkout is associated with. | - -## Example (as JSON) - -```json -{ - "name": "name8", - "price_money": { - "amount": 202, - "currency": "GTQ" - }, - "location_id": "location_id2" -} -``` - diff --git a/doc/models/range.md b/doc/models/range.md deleted file mode 100644 index 60c0b91c0..000000000 --- a/doc/models/range.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Range - -The range of a number value between the specified lower and upper bounds. - -## Structure - -`Range` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `min` | `string \| null \| undefined` | Optional | The lower bound of the number range. At least one of `min` or `max` must be specified.
If unspecified, the results will have no minimum value. | -| `max` | `string \| null \| undefined` | Optional | The upper bound of the number range. At least one of `min` or `max` must be specified.
If unspecified, the results will have no maximum value. | - -## Example (as JSON) - -```json -{ - "min": "min8", - "max": "max0" -} -``` - diff --git a/doc/models/receipt-options.md b/doc/models/receipt-options.md deleted file mode 100644 index a722d9e2e..000000000 --- a/doc/models/receipt-options.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Receipt Options - -Describes receipt action fields. - -## Structure - -`ReceiptOptions` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentId` | `string` | Required | The reference to the Square payment ID for the receipt. | -| `printOnly` | `boolean \| null \| undefined` | Optional | Instructs the device to print the receipt without displaying the receipt selection screen.
Requires `printer_enabled` set to true.
Defaults to false. | -| `isDuplicate` | `boolean \| null \| undefined` | Optional | Identify the receipt as a reprint rather than an original receipt.
Defaults to false. | - -## Example (as JSON) - -```json -{ - "payment_id": "payment_id6", - "print_only": false, - "is_duplicate": false -} -``` - diff --git a/doc/models/redeem-loyalty-reward-request.md b/doc/models/redeem-loyalty-reward-request.md deleted file mode 100644 index 77dc305f8..000000000 --- a/doc/models/redeem-loyalty-reward-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Redeem Loyalty Reward Request - -A request to redeem a loyalty reward. - -## Structure - -`RedeemLoyaltyRewardRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `RedeemLoyaltyReward` request.
Keys can be any valid string, but must be unique for every request.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | -| `locationId` | `string` | Required | The ID of the [location](entity:Location) where the reward is redeemed.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "98adc7f7-6963-473b-b29c-f3c9cdd7d994", - "location_id": "P034NEENMD09F" -} -``` - diff --git a/doc/models/redeem-loyalty-reward-response.md b/doc/models/redeem-loyalty-reward-response.md deleted file mode 100644 index bbd8db3a5..000000000 --- a/doc/models/redeem-loyalty-reward-response.md +++ /dev/null @@ -1,70 +0,0 @@ - -# Redeem Loyalty Reward Response - -A response that includes the `LoyaltyEvent` published for redeeming the reward. - -## Structure - -`RedeemLoyaltyRewardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `event` | [`LoyaltyEvent \| undefined`](../../doc/models/loyalty-event.md) | Optional | Provides information about a loyalty event.
For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). | - -## Example (as JSON) - -```json -{ - "event": { - "created_at": "2020-05-08T21:56:00Z", - "id": "67377a6e-dbdc-369d-aa16-2e7ed422e71f", - "location_id": "P034NEENMD09F", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "redeem_reward": { - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "reward_id": "9f18ac21-233a-31c3-be77-b45840f5a810", - "order_id": "order_id8" - }, - "source": "LOYALTY_API", - "type": "REDEEM_REWARD", - "accumulate_points": { - "loyalty_program_id": "loyalty_program_id8", - "points": 118, - "order_id": "order_id8" - }, - "create_reward": { - "loyalty_program_id": "loyalty_program_id2", - "reward_id": "reward_id6", - "points": 90 - }, - "delete_reward": { - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 104 - }, - "adjust_points": { - "loyalty_program_id": "loyalty_program_id2", - "points": 96, - "reason": "reason2" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/refund-payment-request.md b/doc/models/refund-payment-request.md deleted file mode 100644 index 881d73bf6..000000000 --- a/doc/models/refund-payment-request.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Refund Payment Request - -Describes a request to refund a payment using [RefundPayment](../../doc/api/refunds.md#refund-payment). - -## Structure - -`RefundPaymentRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `RefundPayment` request. The key can be any valid string
but must be unique for every `RefundPayment` request.

Keys are limited to a max of 45 characters - however, the number of allowed characters might be
less than 45, if multi-byte characters are used.

For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
**Constraints**: *Minimum Length*: `1` | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `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. | -| `paymentId` | `string \| null \| undefined` | Optional | The unique ID of the payment being refunded.
Required when unlinked=false, otherwise must not be set. | -| `destinationId` | `string \| null \| undefined` | Optional | The ID indicating where funds will be refunded to. Required for unlinked refunds. For more
information, see [Process an Unlinked Refund](https://developer.squareup.com/docs/refunds-api/unlinked-refunds).

For refunds linked to Square payments, `destination_id` is usually omitted; in this case, funds
will be returned to the original payment source. The field may be specified in order to request
a cross-method refund to a gift card. For more information,
see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards). | -| `unlinked` | `boolean \| null \| undefined` | Optional | Indicates that the refund is not linked to a Square payment.
If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not
be provided. | -| `locationId` | `string \| null \| undefined` | Optional | The location ID associated with the unlinked refund.
Required for requests specifying `unlinked=true`.
Otherwise, if included when `unlinked=false`, will throw an error.
**Constraints**: *Maximum Length*: `50` | -| `customerId` | `string \| null \| undefined` | Optional | The [Customer](entity:Customer) ID of the customer associated with the refund.
This is required if the `destination_id` refers to a card on file created using the Cards
API. Only allowed when `unlinked=true`. | -| `reason` | `string \| null \| undefined` | Optional | A description of the reason for the refund.
**Constraints**: *Maximum Length*: `192` | -| `paymentVersionToken` | `string \| null \| undefined` | Optional | Used for optimistic concurrency. This opaque token identifies the current `Payment`
version that the caller expects. If the server has a different version of the Payment,
the update fails and a response with a VERSION_MISMATCH error is returned.
If the versions match, or the field is not provided, the refund proceeds as normal. | -| `teamMemberId` | `string \| null \| undefined` | Optional | An optional [TeamMember](entity:TeamMember) ID to associate with this refund.
**Constraints**: *Maximum Length*: `192` | -| `cashDetails` | [`DestinationDetailsCashRefundDetails \| undefined`](../../doc/models/destination-details-cash-refund-details.md) | Optional | Stores details about a cash refund. Contains only non-confidential information. | -| `externalDetails` | [`DestinationDetailsExternalRefundDetails \| undefined`](../../doc/models/destination-details-external-refund-details.md) | Optional | Stores details about an external refund. Contains only non-confidential information. | - -## Example (as JSON) - -```json -{ - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "app_fee_money": { - "amount": 10, - "currency": "USD" - }, - "idempotency_key": "9b7f2dcf-49da-4411-b23e-a2d6af21333a", - "payment_id": "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", - "reason": "Example", - "destination_id": "destination_id6", - "unlinked": false, - "location_id": "location_id8" -} -``` - diff --git a/doc/models/refund-payment-response.md b/doc/models/refund-payment-response.md deleted file mode 100644 index 2e266ca00..000000000 --- a/doc/models/refund-payment-response.md +++ /dev/null @@ -1,89 +0,0 @@ - -# Refund Payment Response - -Defines the response returned by -[RefundPayment](../../doc/api/refunds.md#refund-payment). - -If there are errors processing the request, the `refund` field might not be -present, or it might be present with a status of `FAILED`. - -## Structure - -`RefundPaymentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `refund` | [`PaymentRefund \| undefined`](../../doc/models/payment-refund.md) | Optional | Represents a refund of a payment made using Square. Contains information about
the original payment and the amount of money refunded. | - -## Example (as JSON) - -```json -{ - "refund": { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "app_fee_money": { - "amount": 10, - "currency": "USD" - }, - "created_at": "2021-10-13T21:23:19.116Z", - "id": "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY_KlWP8IC1557ddwc9QWTKrCVU6m0JXDz15R2Qym5eQfR", - "location_id": "L88917AVBK2S5", - "order_id": "1JLEUZeEooAIX8HMqm9kvWd69aQZY", - "payment_id": "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", - "reason": "Example", - "status": "PENDING", - "updated_at": "2021-10-13T21:23:19.508Z", - "unlinked": false, - "destination_type": "destination_type2", - "destination_details": { - "card_details": { - "card": { - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "entry_method": "entry_method8", - "auth_result_code": "auth_result_code0" - }, - "cash_details": { - "seller_supplied_money": { - "amount": 36, - "currency": "MKD" - }, - "change_back_money": { - "amount": 78, - "currency": "XBD" - } - }, - "external_details": { - "type": "type6", - "source": "source0", - "source_id": "source_id8" - } - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/refund-status.md b/doc/models/refund-status.md deleted file mode 100644 index c2ac20277..000000000 --- a/doc/models/refund-status.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Refund Status - -Indicates a refund's current status. - -## Enumeration - -`RefundStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `PENDING` | The refund is pending. | -| `APPROVED` | The refund has been approved by Square. | -| `REJECTED` | The refund has been rejected by Square. | -| `FAILED` | The refund failed. | - diff --git a/doc/models/refund.md b/doc/models/refund.md deleted file mode 100644 index 12e145a03..000000000 --- a/doc/models/refund.md +++ /dev/null @@ -1,75 +0,0 @@ - -# Refund - -Represents a refund processed for a Square transaction. - -## Structure - -`Refund` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string` | Required | The refund's unique ID.
**Constraints**: *Maximum Length*: `255` | -| `locationId` | `string` | Required | The ID of the refund's associated location.
**Constraints**: *Maximum Length*: `50` | -| `transactionId` | `string \| null \| undefined` | Optional | The ID of the transaction that the refunded tender is part of.
**Constraints**: *Maximum Length*: `192` | -| `tenderId` | `string` | Required | The ID of the refunded tender.
**Constraints**: *Maximum Length*: `192` | -| `createdAt` | `string \| undefined` | Optional | The timestamp for when the refund was created, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | -| `reason` | `string` | Required | The reason for the refund being issued.
**Constraints**: *Maximum Length*: `192` | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `status` | [`string`](../../doc/models/refund-status.md) | Required | Indicates a refund's current status. | -| `processingFeeMoney` | [`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. | -| `additionalRecipients` | [`AdditionalRecipient[] \| null \| undefined`](../../doc/models/additional-recipient.md) | Optional | Additional recipients (other than the merchant) receiving a portion of this refund.
For example, fees assessed on a refund of a purchase by a third party integration. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "location_id": "location_id0", - "transaction_id": "transaction_id4", - "tender_id": "tender_id4", - "created_at": "created_at6", - "reason": "reason8", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] -} -``` - diff --git a/doc/models/register-domain-request.md b/doc/models/register-domain-request.md deleted file mode 100644 index a6da40a1b..000000000 --- a/doc/models/register-domain-request.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Register Domain Request - -Defines the parameters that can be included in the body of -a request to the [RegisterDomain](../../doc/api/apple-pay.md#register-domain) endpoint. - -## Structure - -`RegisterDomainRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `domainName` | `string` | Required | A domain name as described in RFC-1034 that will be registered with ApplePay.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "domain_name": "example.com" -} -``` - diff --git a/doc/models/register-domain-response-status.md b/doc/models/register-domain-response-status.md deleted file mode 100644 index ea00a86e2..000000000 --- a/doc/models/register-domain-response-status.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Register Domain Response Status - -The status of the domain registration. - -## Enumeration - -`RegisterDomainResponseStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `PENDING` | The domain is added, but not verified. | -| `VERIFIED` | The domain is added and verified. It can be used to accept Apple Pay transactions. | - diff --git a/doc/models/register-domain-response.md b/doc/models/register-domain-response.md deleted file mode 100644 index 0db6e9b8f..000000000 --- a/doc/models/register-domain-response.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Register Domain Response - -Defines the fields that are included in the response body of -a request to the [RegisterDomain](../../doc/api/apple-pay.md#register-domain) endpoint. - -Either `errors` or `status` are present in a given response (never both). - -## Structure - -`RegisterDomainResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `status` | [`string \| undefined`](../../doc/models/register-domain-response-status.md) | Optional | The status of the domain registration. | - -## Example (as JSON) - -```json -{ - "status": "VERIFIED", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/remove-group-from-customer-response.md b/doc/models/remove-group-from-customer-response.md deleted file mode 100644 index 1aff6281a..000000000 --- a/doc/models/remove-group-from-customer-response.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Remove Group From Customer Response - -Defines the fields that are included in the response body of -a request to the [RemoveGroupFromCustomer](../../doc/api/customers.md#remove-group-from-customer) -endpoint. - -## Structure - -`RemoveGroupFromCustomerResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/resume-subscription-request.md b/doc/models/resume-subscription-request.md deleted file mode 100644 index dd902b04e..000000000 --- a/doc/models/resume-subscription-request.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Resume Subscription Request - -Defines input parameters in a request to the -[ResumeSubscription](../../doc/api/subscriptions.md#resume-subscription) endpoint. - -## Structure - -`ResumeSubscriptionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `resumeEffectiveDate` | `string \| null \| undefined` | Optional | The `YYYY-MM-DD`-formatted date when the subscription reactivated. | -| `resumeChangeTiming` | [`string \| undefined`](../../doc/models/change-timing.md) | Optional | Supported timings when a pending change, as an action, takes place to a subscription. | - -## Example (as JSON) - -```json -{ - "resume_effective_date": "resume_effective_date8", - "resume_change_timing": "IMMEDIATE" -} -``` - diff --git a/doc/models/resume-subscription-response.md b/doc/models/resume-subscription-response.md deleted file mode 100644 index 820d6edb7..000000000 --- a/doc/models/resume-subscription-response.md +++ /dev/null @@ -1,84 +0,0 @@ - -# Resume Subscription Response - -Defines output parameters in a response from the -[ResumeSubscription](../../doc/api/subscriptions.md#resume-subscription) endpoint. - -## Structure - -`ResumeSubscriptionResponse` - -## Fields - -| 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 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) - -```json -{ - "actions": [ - { - "effective_date": "2023-09-01", - "id": "18ff74f4-3da4-30c5-929f-7d6fca84f115", - "type": "RESUME", - "monthly_billing_anchor_date": 186, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] - } - ], - "subscription": { - "card_id": "ccof:qy5x8hHGYsgLrp4Q4GB", - "created_at": "2023-06-20T21:53:10Z", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "id": "56214fb2-cc85-47a1-93bc-44f3766bb56f", - "location_id": "S8GWD5R9QB376", - "phases": [ - { - "order_template_id": "U2NaowWxzXwpsZU697x7ZHOAnCNZY", - "ordinal": 0, - "plan_phase_uid": "X2Q2AONPB3RB64Y27S25QCZP", - "uid": "873451e0-745b-4e87-ab0b-c574933fe616" - } - ], - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "source": { - "name": "My Application" - }, - "start_date": "2023-06-20", - "status": "ACTIVE", - "timezone": "America/Los_Angeles", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-booking-custom-attribute-definition-request.md b/doc/models/retrieve-booking-custom-attribute-definition-request.md deleted file mode 100644 index a3742eebe..000000000 --- a/doc/models/retrieve-booking-custom-attribute-definition-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Booking Custom Attribute Definition Request - -Represents a [RetrieveBookingCustomAttributeDefinition](../../doc/api/booking-custom-attributes.md#retrieve-booking-custom-attribute-definition) request. - -## Structure - -`RetrieveBookingCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number \| undefined` | Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | - -## Example (as JSON) - -```json -{ - "version": 70 -} -``` - diff --git a/doc/models/retrieve-booking-custom-attribute-definition-response.md b/doc/models/retrieve-booking-custom-attribute-definition-response.md deleted file mode 100644 index 4188e64e0..000000000 --- a/doc/models/retrieve-booking-custom-attribute-definition-response.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Retrieve Booking Custom Attribute Definition Response - -Represents a [RetrieveBookingCustomAttributeDefinition](../../doc/api/booking-custom-attributes.md#retrieve-booking-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`RetrieveBookingCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-11-16T15:27:30Z", - "description": "The favorite shampoo of the customer.", - "key": "favoriteShampoo", - "name": "Favorite shampoo", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T15:27:30Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - "errors": [] -} -``` - diff --git a/doc/models/retrieve-booking-custom-attribute-request.md b/doc/models/retrieve-booking-custom-attribute-request.md deleted file mode 100644 index 39492d88d..000000000 --- a/doc/models/retrieve-booking-custom-attribute-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Retrieve Booking Custom Attribute Request - -Represents a [RetrieveBookingCustomAttribute](../../doc/api/booking-custom-attributes.md#retrieve-booking-custom-attribute) request. - -## Structure - -`RetrieveBookingCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `withDefinition` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | -| `version` | `number \| undefined` | Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | - -## Example (as JSON) - -```json -{ - "with_definition": false, - "version": 186 -} -``` - diff --git a/doc/models/retrieve-booking-custom-attribute-response.md b/doc/models/retrieve-booking-custom-attribute-response.md deleted file mode 100644 index ec9aab6a1..000000000 --- a/doc/models/retrieve-booking-custom-attribute-response.md +++ /dev/null @@ -1,63 +0,0 @@ - -# Retrieve Booking Custom Attribute Response - -Represents a [RetrieveBookingCustomAttribute](../../doc/api/booking-custom-attributes.md#retrieve-booking-custom-attribute) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`RetrieveBookingCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-booking-response.md b/doc/models/retrieve-booking-response.md deleted file mode 100644 index 77c5f7a62..000000000 --- a/doc/models/retrieve-booking-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Retrieve Booking Response - -## Structure - -`RetrieveBookingResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `booking` | [`Booking \| undefined`](../../doc/models/booking.md) | Optional | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "booking": { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t" - } - ], - "created_at": "2020-10-28T15:47:41Z", - "customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M", - "customer_note": "", - "id": "zkras0xv0xwswx", - "location_id": "LEQHH0YY8B42M", - "seller_note": "", - "start_at": "2020-11-26T13:00:00Z", - "status": "ACCEPTED", - "updated_at": "2020-10-28T15:49:25Z", - "version": 1 - }, - "errors": [] -} -``` - diff --git a/doc/models/retrieve-business-booking-profile-response.md b/doc/models/retrieve-business-booking-profile-response.md deleted file mode 100644 index e8ec14600..000000000 --- a/doc/models/retrieve-business-booking-profile-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Retrieve Business Booking Profile Response - -## Structure - -`RetrieveBusinessBookingProfileResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `businessBookingProfile` | [`BusinessBookingProfile \| undefined`](../../doc/models/business-booking-profile.md) | Optional | A seller's business booking profile, including booking policy, appointment settings, etc. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "business_booking_profile": { - "allow_user_cancel": true, - "booking_enabled": true, - "booking_policy": "ACCEPT_ALL", - "business_appointment_settings": { - "alignment_time": "HALF_HOURLY", - "any_team_member_booking_enabled": true, - "cancellation_fee_money": { - "currency": "USD" - }, - "cancellation_policy": "CUSTOM_POLICY", - "location_types": [ - "BUSINESS_LOCATION" - ], - "max_booking_lead_time_seconds": 31536000, - "min_booking_lead_time_seconds": 0, - "multiple_service_booking_enabled": true, - "skip_booking_flow_staff_selection": false - }, - "created_at": "2020-09-10T21:40:38Z", - "customer_timezone_choice": "CUSTOMER_CHOICE", - "seller_id": "MLJQYZZRM0D3Y" - }, - "errors": [] -} -``` - diff --git a/doc/models/retrieve-card-response.md b/doc/models/retrieve-card-response.md deleted file mode 100644 index fef5f874b..000000000 --- a/doc/models/retrieve-card-response.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Retrieve Card Response - -Defines the fields that are included in the response body of -a request to the [RetrieveCard](../../doc/api/cards.md#retrieve-card) endpoint. - -Note: if there are errors processing the request, the card field will not be -present. - -## Structure - -`RetrieveCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `card` | [`Card \| undefined`](../../doc/models/card.md) | Optional | Represents the payment details of a card to be used for payments. These
details are determined by the payment token generated by Web Payments SDK. | - -## Example (as JSON) - -```json -{ - "card": { - "billing_address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "bin": "411111", - "card_brand": "VISA", - "card_type": "CREDIT", - "cardholder_name": "Amelia Earhart", - "customer_id": "VDKXEEKPJN48QDG3BGGFAK05P8", - "enabled": true, - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "ex-p-cs80EK9Flz7LsCMv-szbptQ_ssAGrhemzSTsPFgt9nzyE6t7okiLIQc-qw_quqKX4Q", - "id": "ccof:uIbfJXhXETSP197M3GB", - "last_4": "1111", - "merchant_id": "6SSW7HV8K2ST5", - "prepaid_type": "NOT_PREPAID", - "reference_id": "user-id-1", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-cash-drawer-shift-request.md b/doc/models/retrieve-cash-drawer-shift-request.md deleted file mode 100644 index 5f2bf7ac3..000000000 --- a/doc/models/retrieve-cash-drawer-shift-request.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Retrieve Cash Drawer Shift Request - -## Structure - -`RetrieveCashDrawerShiftRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationId` | `string` | Required | The ID of the location to retrieve cash drawer shifts from.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "location_id": "location_id6" -} -``` - diff --git a/doc/models/retrieve-cash-drawer-shift-response.md b/doc/models/retrieve-cash-drawer-shift-response.md deleted file mode 100644 index 731af5cd1..000000000 --- a/doc/models/retrieve-cash-drawer-shift-response.md +++ /dev/null @@ -1,77 +0,0 @@ - -# Retrieve Cash Drawer Shift Response - -## Structure - -`RetrieveCashDrawerShiftResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cashDrawerShift` | [`CashDrawerShift \| undefined`](../../doc/models/cash-drawer-shift.md) | Optional | This model gives the details of a cash drawer shift.
The cash_payment_money, cash_refund_money, cash_paid_in_money,
and cash_paid_out_money fields are all computed by summing their respective
event types. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cash_drawer_shift": { - "cash_paid_in_money": { - "amount": 10000, - "currency": "USD" - }, - "cash_paid_out_money": { - "amount": -10000, - "currency": "USD" - }, - "cash_payment_money": { - "amount": 100, - "currency": "USD" - }, - "cash_refunds_money": { - "amount": -100, - "currency": "USD" - }, - "closed_at": "2019-11-22T00:44:49.000Z", - "closed_cash_money": { - "amount": 9970, - "currency": "USD" - }, - "closing_team_member_id": "", - "description": "Misplaced some change", - "device": { - "name": "My iPad" - }, - "ended_at": "2019-11-22T00:44:49.000Z", - "ending_team_member_id": "", - "expected_cash_money": { - "amount": 10000, - "currency": "USD" - }, - "id": "DCC99978-09A6-4926-849F-300BE9C5793A", - "opened_at": "2019-11-22T00:42:54.000Z", - "opened_cash_money": { - "amount": 10000, - "currency": "USD" - }, - "opening_team_member_id": "", - "state": "CLOSED" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-catalog-object-request.md b/doc/models/retrieve-catalog-object-request.md deleted file mode 100644 index 7ee6fbe89..000000000 --- a/doc/models/retrieve-catalog-object-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Retrieve Catalog Object Request - -## Structure - -`RetrieveCatalogObjectRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `includeRelatedObjects` | `boolean \| null \| undefined` | Optional | If `true`, the response will include additional objects that are related to the
requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field
of the response. These objects are put in the `related_objects` field. Setting this to `true` is
helpful when the objects are needed for immediate display to a user.
This process only goes one level deep. Objects referenced by the related objects will not be included. For example,

if the `objects` field of the response contains a CatalogItem, its associated
CatalogCategory objects, CatalogTax objects, CatalogImage objects and
CatalogModifierLists will be returned in the `related_objects` field of the
response. If the `objects` field of the response contains a CatalogItemVariation,
its parent CatalogItem will be returned in the `related_objects` field of
the response.

Default value: `false` | -| `catalogVersion` | `bigint \| null \| undefined` | Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical
versions of objects. The value to retrieve a specific version of an object can be found
in the version field of [CatalogObject](../../doc/models/catalog-object.md)s. If not included, results will
be from the current version of the catalog. | -| `includeCategoryPathToRoot` | `boolean \| null \| undefined` | Optional | Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists
of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category
and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned
in the response payload. | - -## Example (as JSON) - -```json -{ - "include_related_objects": false, - "catalog_version": 224, - "include_category_path_to_root": false -} -``` - diff --git a/doc/models/retrieve-catalog-object-response.md b/doc/models/retrieve-catalog-object-response.md deleted file mode 100644 index e2035b2ca..000000000 --- a/doc/models/retrieve-catalog-object-response.md +++ /dev/null @@ -1,171 +0,0 @@ - -# Retrieve Catalog Object Response - -## Structure - -`RetrieveCatalogObjectResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `object` | [`CatalogObject \| undefined`](../../doc/models/catalog-object.md) | Optional | The wrapper object for the catalog entries of a given object type.

Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.

For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.

In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.

For a more detailed discussion of the Catalog data model, please see the
[Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. | -| `relatedObjects` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | A list of `CatalogObject`s referenced by the object in the `object` field. | - -## Example (as JSON) - -```json -{ - "object": { - "id": "W62UWFY35CWMYGVWK6TWJDNI", - "is_deleted": false, - "item_data": { - "categories": [ - { - "id": "BJNQCF2FJ6S6UIDT65ABHLRX", - "ordinal": 0 - } - ], - "description": "Hot Leaf Juice", - "name": "Tea", - "tax_ids": [ - "HURXQOOAIC4IZSI2BEXQRYFY" - ], - "variations": [ - { - "id": "2TZFAOHWGG7PAK2QEXWYPZSP", - "is_deleted": false, - "item_variation_data": { - "item_id": "W62UWFY35CWMYGVWK6TWJDNI", - "name": "Mug", - "ordinal": 0, - "price_money": { - "amount": 150, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878 - } - ] - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - "related_objects": [ - { - "category_data": { - "name": "Beverages" - }, - "id": "BJNQCF2FJ6S6UIDT65ABHLRX", - "is_deleted": false, - "present_at_all_locations": true, - "type": "CATEGORY", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "id": "HURXQOOAIC4IZSI2BEXQRYFY", - "is_deleted": false, - "present_at_all_locations": true, - "tax_data": { - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "enabled": true, - "inclusion_type": "ADDITIVE", - "name": "Sales Tax", - "percentage": "5.0" - }, - "type": "TAX", - "updated_at": "2016-11-16T22:25:24.878Z", - "version": 1479335124878, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-customer-custom-attribute-definition-request.md b/doc/models/retrieve-customer-custom-attribute-definition-request.md deleted file mode 100644 index c7f9f2753..000000000 --- a/doc/models/retrieve-customer-custom-attribute-definition-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Customer Custom Attribute Definition Request - -Represents a [RetrieveCustomerCustomAttributeDefinition](../../doc/api/customer-custom-attributes.md#retrieve-customer-custom-attribute-definition) request. - -## Structure - -`RetrieveCustomerCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number \| undefined` | Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | - -## Example (as JSON) - -```json -{ - "version": 38 -} -``` - diff --git a/doc/models/retrieve-customer-custom-attribute-definition-response.md b/doc/models/retrieve-customer-custom-attribute-definition-response.md deleted file mode 100644 index d4340c532..000000000 --- a/doc/models/retrieve-customer-custom-attribute-definition-response.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Retrieve Customer Custom Attribute Definition Response - -Represents a [RetrieveCustomerCustomAttributeDefinition](../../doc/api/customer-custom-attributes.md#retrieve-customer-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`RetrieveCustomerCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-04-26T15:27:30Z", - "description": "The favorite movie of the customer.", - "key": "favoritemovie", - "name": "Favorite Movie", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-04-26T15:27:30Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-customer-custom-attribute-request.md b/doc/models/retrieve-customer-custom-attribute-request.md deleted file mode 100644 index 07e2e6faa..000000000 --- a/doc/models/retrieve-customer-custom-attribute-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Retrieve Customer Custom Attribute Request - -Represents a [RetrieveCustomerCustomAttribute](../../doc/api/customer-custom-attributes.md#retrieve-customer-custom-attribute) request. - -## Structure - -`RetrieveCustomerCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `withDefinition` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | -| `version` | `number \| undefined` | Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | - -## Example (as JSON) - -```json -{ - "with_definition": false, - "version": 232 -} -``` - diff --git a/doc/models/retrieve-customer-custom-attribute-response.md b/doc/models/retrieve-customer-custom-attribute-response.md deleted file mode 100644 index d01f3efc2..000000000 --- a/doc/models/retrieve-customer-custom-attribute-response.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Retrieve Customer Custom Attribute Response - -Represents a [RetrieveCustomerCustomAttribute](../../doc/api/customer-custom-attributes.md#retrieve-customer-custom-attribute) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`RetrieveCustomerCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-customer-group-response.md b/doc/models/retrieve-customer-group-response.md deleted file mode 100644 index 58f07a4af..000000000 --- a/doc/models/retrieve-customer-group-response.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Retrieve Customer Group Response - -Defines the fields that are included in the response body of -a request to the [RetrieveCustomerGroup](../../doc/api/customer-groups.md#retrieve-customer-group) endpoint. - -Either `errors` or `group` is present in a given response (never both). - -## Structure - -`RetrieveCustomerGroupResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `group` | [`CustomerGroup \| undefined`](../../doc/models/customer-group.md) | Optional | Represents a group of customer profiles.

Customer groups can be created, be modified, and have their membership defined using
the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. | - -## Example (as JSON) - -```json -{ - "group": { - "created_at": "2020-04-13T21:54:57.863Z", - "id": "2TAT3CMH4Q0A9M87XJZED0WMR3", - "name": "Loyal Customers", - "updated_at": "2020-04-13T21:54:58Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-customer-response.md b/doc/models/retrieve-customer-response.md deleted file mode 100644 index 849f50a8c..000000000 --- a/doc/models/retrieve-customer-response.md +++ /dev/null @@ -1,85 +0,0 @@ - -# Retrieve Customer Response - -Defines the fields that are included in the response body of -a request to the `RetrieveCustomer` endpoint. - -Either `errors` or `customer` is present in a given response (never both). - -## Structure - -`RetrieveCustomerResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `customer` | [`Customer \| undefined`](../../doc/models/customer.md) | Optional | Represents a Square customer profile in the Customer Directory of a Square seller. | - -## Example (as JSON) - -```json -{ - "customer": { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "created_at": "2016-03-23T20:21:54.859Z", - "creation_source": "THIRD_PARTY", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "group_ids": [ - "545AXB44B4XXWMVQ4W8SBT3HHF" - ], - "id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "note": "a customer", - "phone_number": "+1-212-555-4240", - "preferences": { - "email_unsubscribed": false - }, - "reference_id": "YOUR_REFERENCE_ID", - "segment_ids": [ - "1KB9JE5EGJXCW.REACHABLE" - ], - "updated_at": "2016-03-23T20:21:54.859Z", - "version": 1, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-customer-segment-response.md b/doc/models/retrieve-customer-segment-response.md deleted file mode 100644 index 314e74484..000000000 --- a/doc/models/retrieve-customer-segment-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Retrieve Customer Segment Response - -Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint. - -Either `errors` or `segment` is present in a given response (never both). - -## Structure - -`RetrieveCustomerSegmentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `segment` | [`CustomerSegment \| undefined`](../../doc/models/customer-segment.md) | Optional | Represents a group of customer profiles that match one or more predefined filter criteria.

Segments (also known as Smart Groups) are defined and created within the Customer Directory in the
Square Seller Dashboard or Point of Sale. | - -## Example (as JSON) - -```json -{ - "segment": { - "created_at": "2020-01-09T19:33:24.469Z", - "id": "GMNXRZVEXNQDF.CHURN_RISK", - "name": "Lapsed", - "updated_at": "2020-04-13T23:01:13Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-dispute-evidence-response.md b/doc/models/retrieve-dispute-evidence-response.md deleted file mode 100644 index 8fc55a228..000000000 --- a/doc/models/retrieve-dispute-evidence-response.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Retrieve Dispute Evidence Response - -Defines the fields in a `RetrieveDisputeEvidence` response. - -## Structure - -`RetrieveDisputeEvidenceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `evidence` | [`DisputeEvidence \| undefined`](../../doc/models/dispute-evidence.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "evidence": { - "dispute_id": "bVTprrwk0gygTLZ96VX1oB", - "evidence_file": { - "filename": "customer-interaction.jpg", - "filetype": "image/jpeg" - }, - "evidence_type": "CARDHOLDER_COMMUNICATION", - "id": "TOomLInj6iWmP3N8qfCXrB", - "uploaded_at": "2022-05-18T16:01:10.000Z", - "evidence_id": "evidence_id0", - "evidence_text": "evidence_text6" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-dispute-response.md b/doc/models/retrieve-dispute-response.md deleted file mode 100644 index 89e9b77ab..000000000 --- a/doc/models/retrieve-dispute-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# Retrieve Dispute Response - -Defines fields in a `RetrieveDispute` response. - -## Structure - -`RetrieveDisputeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `dispute` | [`Dispute \| undefined`](../../doc/models/dispute.md) | Optional | Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. | - -## Example (as JSON) - -```json -{ - "dispute": { - "amount_money": { - "amount": 2500, - "currency": "USD" - }, - "brand_dispute_id": "100000809947", - "card_brand": "VISA", - "created_at": "2022-06-29T18:45:22.265Z", - "disputed_payment": { - "payment_id": "zhyh1ch64kRBrrlfVhwjCEjZWzNZY" - }, - "due_at": "2022-07-13T00:00:00.000Z", - "id": "XDgyFu7yo1E2S5lQGGpYn", - "location_id": "L1HN3ZMQK64X9", - "reason": "NO_KNOWLEDGE", - "reported_at": "2022-06-29T00:00:00.000Z", - "state": "ACCEPTED", - "updated_at": "2022-07-07T19:14:42.650Z", - "version": 2, - "dispute_id": "dispute_id8" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-employee-response.md b/doc/models/retrieve-employee-response.md deleted file mode 100644 index abefeea52..000000000 --- a/doc/models/retrieve-employee-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Retrieve Employee Response - -## Structure - -`RetrieveEmployeeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `employee` | [`Employee \| undefined`](../../doc/models/employee.md) | Optional | An employee object that is used by the external API.

DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "employee": { - "id": "id8", - "first_name": "first_name8", - "last_name": "last_name6", - "email": "email8", - "phone_number": "phone_number6" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-gift-card-from-gan-request.md b/doc/models/retrieve-gift-card-from-gan-request.md deleted file mode 100644 index dec6b0b68..000000000 --- a/doc/models/retrieve-gift-card-from-gan-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Gift Card From GAN Request - -A request to retrieve gift cards by their GANs. - -## Structure - -`RetrieveGiftCardFromGANRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `gan` | `string` | Required | The gift card account number (GAN) of the gift card to retrieve.
The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported.
Square-issued gift cards have 16-digit GANs.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "gan": "7783320001001635" -} -``` - diff --git a/doc/models/retrieve-gift-card-from-gan-response.md b/doc/models/retrieve-gift-card-from-gan-response.md deleted file mode 100644 index 0762aa38a..000000000 --- a/doc/models/retrieve-gift-card-from-gan-response.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Retrieve Gift Card From GAN Response - -A response that contains a `GiftCard`. This response might contain a set of `Error` objects -if the request resulted in errors. - -## Structure - -`RetrieveGiftCardFromGANResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCard` | [`GiftCard \| undefined`](../../doc/models/gift-card.md) | Optional | Represents a Square gift card. | - -## Example (as JSON) - -```json -{ - "gift_card": { - "balance_money": { - "amount": 5000, - "currency": "USD" - }, - "created_at": "2021-05-20T22:26:54.000Z", - "gan": "7783320001001635", - "gan_source": "SQUARE", - "id": "gftc:6944163553804e439d89adb47caf806a", - "state": "ACTIVE", - "type": "DIGITAL" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-gift-card-from-nonce-request.md b/doc/models/retrieve-gift-card-from-nonce-request.md deleted file mode 100644 index 4a7ce739d..000000000 --- a/doc/models/retrieve-gift-card-from-nonce-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Gift Card From Nonce Request - -A request to retrieve a gift card by using a payment token. - -## Structure - -`RetrieveGiftCardFromNonceRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `nonce` | `string` | Required | The payment token of the gift card to retrieve. Payment tokens are generated by the
Web Payments SDK or In-App Payments SDK.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "nonce": "cnon:7783322135245171" -} -``` - diff --git a/doc/models/retrieve-gift-card-from-nonce-response.md b/doc/models/retrieve-gift-card-from-nonce-response.md deleted file mode 100644 index 2b395595b..000000000 --- a/doc/models/retrieve-gift-card-from-nonce-response.md +++ /dev/null @@ -1,50 +0,0 @@ - -# Retrieve Gift Card From Nonce Response - -A response that contains a `GiftCard` object. If the request resulted in errors, -the response contains a set of `Error` objects. - -## Structure - -`RetrieveGiftCardFromNonceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCard` | [`GiftCard \| undefined`](../../doc/models/gift-card.md) | Optional | Represents a Square gift card. | - -## Example (as JSON) - -```json -{ - "gift_card": { - "balance_money": { - "amount": 5000, - "currency": "USD" - }, - "created_at": "2021-05-20T22:26:54.000Z", - "gan": "7783320001001635", - "gan_source": "SQUARE", - "id": "gftc:6944163553804e439d89adb47caf806a", - "state": "ACTIVE", - "type": "DIGITAL" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-gift-card-response.md b/doc/models/retrieve-gift-card-response.md deleted file mode 100644 index e8d2d9ec9..000000000 --- a/doc/models/retrieve-gift-card-response.md +++ /dev/null @@ -1,50 +0,0 @@ - -# Retrieve Gift Card Response - -A response that contains a `GiftCard`. The response might contain a set of `Error` objects -if the request resulted in errors. - -## Structure - -`RetrieveGiftCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCard` | [`GiftCard \| undefined`](../../doc/models/gift-card.md) | Optional | Represents a Square gift card. | - -## Example (as JSON) - -```json -{ - "gift_card": { - "balance_money": { - "amount": 1000, - "currency": "USD" - }, - "created_at": "2021-05-20T22:26:54.000Z", - "gan": "7783320001001635", - "gan_source": "SQUARE", - "id": "gftc:00113070ba5745f0b2377c1b9570cb03", - "state": "ACTIVE", - "type": "DIGITAL" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-inventory-adjustment-response.md b/doc/models/retrieve-inventory-adjustment-response.md deleted file mode 100644 index 9c97345b0..000000000 --- a/doc/models/retrieve-inventory-adjustment-response.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Retrieve Inventory Adjustment Response - -## Structure - -`RetrieveInventoryAdjustmentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `adjustment` | [`InventoryAdjustment \| undefined`](../../doc/models/inventory-adjustment.md) | Optional | Represents a change in state or quantity of product inventory at a
particular time and location. | - -## Example (as JSON) - -```json -{ - "adjustment": { - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "catalog_object_type": "ITEM_VARIATION", - "created_at": "2016-11-17T13:02:15.142Z", - "from_state": "IN_STOCK", - "id": "UDMOEO78BG6GYWA2XDRYX3KB", - "location_id": "C6W5YS5QM06F5", - "occurred_at": "2016-11-16T25:44:22.837Z", - "quantity": "7", - "reference_id": "4a366069-4096-47a2-99a5-0084ac879509", - "source": { - "application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0", - "name": "Square Point of Sale 4.37", - "product": "SQUARE_POS" - }, - "team_member_id": "LRK57NSQ5X7PUD05", - "to_state": "SOLD", - "total_price_money": { - "amount": 4550, - "currency": "USD" - } - }, - "errors": [] -} -``` - diff --git a/doc/models/retrieve-inventory-changes-request.md b/doc/models/retrieve-inventory-changes-request.md deleted file mode 100644 index 729d4211a..000000000 --- a/doc/models/retrieve-inventory-changes-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Inventory Changes Request - -## Structure - -`RetrieveInventoryChangesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationIds` | `string \| null \| undefined` | Optional | The [Location](entity:Location) IDs to look up as a comma-separated
list. An empty list queries all locations. | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | - -## Example (as JSON) - -```json -{ - "location_ids": "location_ids2", - "cursor": "cursor4" -} -``` - diff --git a/doc/models/retrieve-inventory-changes-response.md b/doc/models/retrieve-inventory-changes-response.md deleted file mode 100644 index 366373d14..000000000 --- a/doc/models/retrieve-inventory-changes-response.md +++ /dev/null @@ -1,79 +0,0 @@ - -# Retrieve Inventory Changes Response - -## Structure - -`RetrieveInventoryChangesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `changes` | [`InventoryChange[] \| undefined`](../../doc/models/inventory-change.md) | Optional | The set of inventory changes for the requested object and locations. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | - -## Example (as JSON) - -```json -{ - "changes": [ - { - "adjustment": { - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "catalog_object_type": "ITEM_VARIATION", - "created_at": "2016-11-16T22:25:24.878Z", - "from_state": "IN_STOCK", - "id": "OJKJIUANKLMLQANZADNPLKAD", - "location_id": "C6W5YS5QM06F5", - "occurred_at": "2016-11-16T22:25:24.878Z", - "quantity": "3", - "reference_id": "d8207693-168f-4b44-a2fd-a7ff533ddd26", - "source": { - "application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0", - "name": "Square Point of Sale 4.37", - "product": "SQUARE_POS" - }, - "team_member_id": "AV7YRCGI2H1J5NQ8E1XIZCNA", - "to_state": "SOLD", - "total_price_money": { - "amount": 5000, - "currency": "USD" - }, - "transaction_id": "5APV6JYK1SNCZD11AND2RX1Z" - }, - "type": "ADJUSTMENT", - "physical_count": { - "id": "id2", - "reference_id": "reference_id0", - "catalog_object_id": "catalog_object_id6", - "catalog_object_type": "catalog_object_type6", - "state": "SUPPORTED_BY_NEWER_VERSION" - }, - "transfer": { - "id": "id8", - "reference_id": "reference_id6", - "state": "RESERVED_FOR_SALE", - "from_location_id": "from_location_id0", - "to_location_id": "to_location_id0" - }, - "measurement_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 184 - } - } - ], - "errors": [], - "cursor": "cursor0" -} -``` - diff --git a/doc/models/retrieve-inventory-count-request.md b/doc/models/retrieve-inventory-count-request.md deleted file mode 100644 index fd264431f..000000000 --- a/doc/models/retrieve-inventory-count-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Inventory Count Request - -## Structure - -`RetrieveInventoryCountRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationIds` | `string \| null \| undefined` | Optional | The [Location](entity:Location) IDs to look up as a comma-separated
list. An empty list queries all locations. | -| `cursor` | `string \| null \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | - -## Example (as JSON) - -```json -{ - "location_ids": "location_ids4", - "cursor": "cursor8" -} -``` - diff --git a/doc/models/retrieve-inventory-count-response.md b/doc/models/retrieve-inventory-count-response.md deleted file mode 100644 index 4baa8238b..000000000 --- a/doc/models/retrieve-inventory-count-response.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Retrieve Inventory Count Response - -## Structure - -`RetrieveInventoryCountResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `counts` | [`InventoryCount[] \| undefined`](../../doc/models/inventory-count.md) | Optional | The current calculated inventory counts for the requested object and
locations. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | - -## Example (as JSON) - -```json -{ - "counts": [ - { - "calculated_at": "2016-11-16T22:28:01.223Z", - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "catalog_object_type": "ITEM_VARIATION", - "location_id": "C6W5YS5QM06F5", - "quantity": "22", - "state": "IN_STOCK" - } - ], - "errors": [], - "cursor": "cursor2" -} -``` - diff --git a/doc/models/retrieve-inventory-physical-count-response.md b/doc/models/retrieve-inventory-physical-count-response.md deleted file mode 100644 index bffb14d7d..000000000 --- a/doc/models/retrieve-inventory-physical-count-response.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Retrieve Inventory Physical Count Response - -## Structure - -`RetrieveInventoryPhysicalCountResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `count` | [`InventoryPhysicalCount \| undefined`](../../doc/models/inventory-physical-count.md) | Optional | Represents the quantity of an item variation that is physically present
at a specific location, verified by a seller or a seller's employee. For example,
a physical count might come from an employee counting the item variations on
hand or from syncing with an external system. | - -## Example (as JSON) - -```json -{ - "count": { - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "catalog_object_type": "ITEM_VARIATION", - "created_at": "2016-11-16T22:25:24.878Z", - "id": "ANZADNPLKADOJKJIUANKLMLQ", - "location_id": "C6W5YS5QM06F5", - "occurred_at": "2016-11-16T22:25:24.878Z", - "quantity": "15", - "reference_id": "f857ec37-f9a0-4458-8e23-5b5e0bea4e53", - "source": { - "application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0", - "name": "Square Point of Sale 4.37", - "product": "SQUARE_POS" - }, - "state": "IN_STOCK", - "team_member_id": "LRK57NSQ5X7PUD05" - }, - "errors": [] -} -``` - diff --git a/doc/models/retrieve-inventory-transfer-response.md b/doc/models/retrieve-inventory-transfer-response.md deleted file mode 100644 index 411e84f87..000000000 --- a/doc/models/retrieve-inventory-transfer-response.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Retrieve Inventory Transfer Response - -## Structure - -`RetrieveInventoryTransferResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `transfer` | [`InventoryTransfer \| undefined`](../../doc/models/inventory-transfer.md) | Optional | Represents the transfer of a quantity of product inventory at a
particular time from one location to another. | - -## Example (as JSON) - -```json -{ - "errors": [], - "transfer": { - "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI", - "catalog_object_type": "ITEM_VARIATION", - "created_at": "2016-11-17T13:02:15.142Z", - "from_location_id": "C6W5YS5QM06F5", - "id": "UDMOEO78BG6GYWA2XDRYX3KB", - "occurred_at": "2016-11-16T25:44:22.837Z", - "quantity": "7", - "reference_id": "4a366069-4096-47a2-99a5-0084ac879509", - "source": { - "application_id": "416ff29c-86c4-4feb-b58c-9705f21f3ea0", - "name": "Square Point of Sale 4.37", - "product": "SQUARE_POS" - }, - "state": "IN_STOCK", - "team_member_id": "LRK57NSQ5X7PUD05", - "to_location_id": "59TNP9SA8VGDA" - } -} -``` - diff --git a/doc/models/retrieve-job-response.md b/doc/models/retrieve-job-response.md deleted file mode 100644 index d7b186510..000000000 --- a/doc/models/retrieve-job-response.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Retrieve Job Response - -Represents a [RetrieveJob](../../doc/api/team.md#retrieve-job) response. Either `job` or `errors` -is present in the response. - -## Structure - -`RetrieveJobResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `job` | [`Job \| undefined`](../../doc/models/job.md) | Optional | Represents a job that can be assigned to [team members](../../doc/models/team-member.md). This object defines the
job's title and tip eligibility. Compensation is defined in a [job assignment](../../doc/models/job-assignment.md)
in a team member's wage setting. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "job": { - "created_at": "2021-06-11T22:55:45Z", - "id": "1yJlHapkseYnNPETIU1B", - "is_tip_eligible": true, - "title": "Cashier 1", - "updated_at": "2021-06-11T22:55:45Z", - "version": 2 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-location-booking-profile-response.md b/doc/models/retrieve-location-booking-profile-response.md deleted file mode 100644 index f35f845c5..000000000 --- a/doc/models/retrieve-location-booking-profile-response.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Retrieve Location Booking Profile Response - -## Structure - -`RetrieveLocationBookingProfileResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationBookingProfile` | [`LocationBookingProfile \| undefined`](../../doc/models/location-booking-profile.md) | Optional | The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [], - "location_booking_profile": { - "booking_enabled": true, - "booking_site_url": "https://square.site/book/L3HETDGYQ4A2C/prod-business", - "location_id": "L3HETDGYQ4A2C", - "online_booking_enabled": false - } -} -``` - diff --git a/doc/models/retrieve-location-custom-attribute-definition-request.md b/doc/models/retrieve-location-custom-attribute-definition-request.md deleted file mode 100644 index db1d7aa07..000000000 --- a/doc/models/retrieve-location-custom-attribute-definition-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Location Custom Attribute Definition Request - -Represents a [RetrieveLocationCustomAttributeDefinition](../../doc/api/location-custom-attributes.md#retrieve-location-custom-attribute-definition) request. - -## Structure - -`RetrieveLocationCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number \| undefined` | Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | - -## Example (as JSON) - -```json -{ - "version": 50 -} -``` - diff --git a/doc/models/retrieve-location-custom-attribute-definition-response.md b/doc/models/retrieve-location-custom-attribute-definition-response.md deleted file mode 100644 index ec124ba2b..000000000 --- a/doc/models/retrieve-location-custom-attribute-definition-response.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Retrieve Location Custom Attribute Definition Response - -Represents a [RetrieveLocationCustomAttributeDefinition](../../doc/api/location-custom-attributes.md#retrieve-location-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`RetrieveLocationCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-12-02T19:06:36.559Z", - "description": "Bestselling item at location", - "key": "bestseller", - "name": "Bestseller", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-12-02T19:06:36.559Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-location-custom-attribute-request.md b/doc/models/retrieve-location-custom-attribute-request.md deleted file mode 100644 index f88c97f04..000000000 --- a/doc/models/retrieve-location-custom-attribute-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Retrieve Location Custom Attribute Request - -Represents a [RetrieveLocationCustomAttribute](../../doc/api/location-custom-attributes.md#retrieve-location-custom-attribute) request. - -## Structure - -`RetrieveLocationCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `withDefinition` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | -| `version` | `number \| undefined` | Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | - -## Example (as JSON) - -```json -{ - "with_definition": false, - "version": 84 -} -``` - diff --git a/doc/models/retrieve-location-custom-attribute-response.md b/doc/models/retrieve-location-custom-attribute-response.md deleted file mode 100644 index 4cad197f4..000000000 --- a/doc/models/retrieve-location-custom-attribute-response.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Retrieve Location Custom Attribute Response - -Represents a [RetrieveLocationCustomAttribute](../../doc/api/location-custom-attributes.md#retrieve-location-custom-attribute) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`RetrieveLocationCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-location-response.md b/doc/models/retrieve-location-response.md deleted file mode 100644 index cb001e5be..000000000 --- a/doc/models/retrieve-location-response.md +++ /dev/null @@ -1,58 +0,0 @@ - -# Retrieve Location Response - -Defines the fields that the [RetrieveLocation](../../doc/api/locations.md#retrieve-location) -endpoint returns in a response. - -## Structure - -`RetrieveLocationResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `location` | [`Location \| undefined`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | - -## Example (as JSON) - -```json -{ - "location": { - "address": { - "address_line_1": "123 Main St", - "administrative_district_level_1": "CA", - "country": "US", - "locality": "San Francisco", - "postal_code": "94114", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "business_name": "Jet Fuel Coffee", - "capabilities": [ - "CREDIT_CARD_PROCESSING" - ], - "country": "US", - "created_at": "2016-09-19T17:33:12Z", - "currency": "USD", - "id": "18YC4JDH91E1H", - "language_code": "en-US", - "merchant_id": "3MYCJG5GVYQ8Q", - "name": "Grant Park", - "phone_number": "+1 650-354-7217", - "status": "ACTIVE", - "timezone": "America/Los_Angeles" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-location-settings-response.md b/doc/models/retrieve-location-settings-response.md deleted file mode 100644 index a977db1bb..000000000 --- a/doc/models/retrieve-location-settings-response.md +++ /dev/null @@ -1,93 +0,0 @@ - -# Retrieve Location Settings Response - -## Structure - -`RetrieveLocationSettingsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `locationSettings` | [`CheckoutLocationSettings \| undefined`](../../doc/models/checkout-location-settings.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "location_settings": { - "branding": { - "button_color": "#ffffff", - "button_shape": "ROUNDED", - "header_type": "FRAMED_LOGO" - }, - "customer_notes_enabled": true, - "location_id": "LOCATION_ID_1", - "policies": [ - { - "description": "This is my Return Policy", - "title": "Return Policy", - "uid": "POLICY_ID_1" - } - ], - "tipping": { - "default_percent": 15, - "default_whole_amount_money": { - "amount": 100, - "currency": "USD" - }, - "percentages": [ - 10, - 15, - 20 - ], - "smart_tipping_enabled": true, - "whole_amounts": [ - { - "amount": 1000, - "currency": "USD" - }, - { - "amount": 1500, - "currency": "USD" - }, - { - "amount": 2000, - "currency": "USD" - } - ], - "smart_tips": [ - { - "amount": 152, - "currency": "GEL" - }, - { - "amount": 152, - "currency": "GEL" - } - ], - "default_smart_tip": { - "amount": 58, - "currency": "KWD" - } - }, - "updated_at": "2022-06-16T22:25:35Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-loyalty-account-response.md b/doc/models/retrieve-loyalty-account-response.md deleted file mode 100644 index 519dd9218..000000000 --- a/doc/models/retrieve-loyalty-account-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# Retrieve Loyalty Account Response - -A response that includes the loyalty account. - -## Structure - -`RetrieveLoyaltyAccountResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `loyaltyAccount` | [`LoyaltyAccount \| undefined`](../../doc/models/loyalty-account.md) | Optional | Describes a loyalty account in a [loyalty program](../../doc/models/loyalty-program.md). For more information, see
[Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). | - -## Example (as JSON) - -```json -{ - "loyalty_account": { - "balance": 10, - "created_at": "2020-05-08T21:44:32Z", - "customer_id": "Q8002FAM9V1EZ0ADB2T5609X6NET1H0", - "id": "79b807d2-d786-46a9-933b-918028d7a8c5", - "lifetime_points": 20, - "mapping": { - "created_at": "2020-05-08T21:44:32Z", - "id": "66aaab3f-da99-49ed-8b19-b87f851c844f", - "phone_number": "+14155551234" - }, - "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "updated_at": "2020-05-08T21:44:32Z", - "enrolled_at": "enrolled_at6" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-loyalty-program-response.md b/doc/models/retrieve-loyalty-program-response.md deleted file mode 100644 index 8267e9b45..000000000 --- a/doc/models/retrieve-loyalty-program-response.md +++ /dev/null @@ -1,96 +0,0 @@ - -# Retrieve Loyalty Program Response - -A response that contains the loyalty program. - -## Structure - -`RetrieveLoyaltyProgramResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `program` | [`LoyaltyProgram \| undefined`](../../doc/models/loyalty-program.md) | Optional | Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards.
Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard.
For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). | - -## Example (as JSON) - -```json -{ - "program": { - "accrual_rules": [ - { - "accrual_type": "SPEND", - "points": 1, - "spend_data": { - "amount_money": { - "amount": 100, - "currency": "USD" - }, - "excluded_category_ids": [ - "7ZERJKO5PVYXCVUHV2JCZ2UG", - "FQKAOJE5C4FIMF5A2URMLW6V" - ], - "excluded_item_variation_ids": [ - "CBZXBUVVTYUBZGQO44RHMR6B", - "EDILT24Z2NISEXDKGY6HP7XV" - ], - "tax_mode": "BEFORE_TAX" - } - } - ], - "created_at": "2020-04-20T16:55:11Z", - "id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "location_ids": [ - "P034NEENMD09F" - ], - "reward_tiers": [ - { - "created_at": "2020-04-20T16:55:11Z", - "definition": { - "discount_type": "FIXED_PERCENTAGE", - "percentage_discount": "10", - "scope": "ORDER", - "catalog_object_ids": [ - "catalog_object_ids6" - ], - "fixed_discount_money": { - "amount": 36, - "currency": "SLL" - }, - "max_discount_money": { - "amount": 84, - "currency": "BOB" - } - }, - "id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "name": "10% off entire sale", - "points": 10, - "pricing_rule_reference": { - "catalog_version": 1605486402527, - "object_id": "74C4JSHESNLTB2A7ITO5HO6F" - } - } - ], - "status": "ACTIVE", - "terminology": { - "one": "Point", - "other": "Points" - }, - "updated_at": "2020-05-01T02:00:02Z", - "expiration_policy": { - "expiration_duration": "expiration_duration0" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-loyalty-promotion-response.md b/doc/models/retrieve-loyalty-promotion-response.md deleted file mode 100644 index 380d78285..000000000 --- a/doc/models/retrieve-loyalty-promotion-response.md +++ /dev/null @@ -1,75 +0,0 @@ - -# Retrieve Loyalty Promotion Response - -Represents a [RetrieveLoyaltyPromotionPromotions](../../doc/api/loyalty.md#retrieve-loyalty-promotion) response. - -## Structure - -`RetrieveLoyaltyPromotionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `loyaltyPromotion` | [`LoyaltyPromotion \| undefined`](../../doc/models/loyalty-promotion.md) | Optional | Represents a promotion for a [loyalty program](../../doc/models/loyalty-program.md). Loyalty promotions enable buyers
to earn extra points on top of those earned from the base program.

A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. | - -## Example (as JSON) - -```json -{ - "loyalty_promotion": { - "available_time": { - "start_date": "2022-08-16", - "time_periods": [ - "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT" - ], - "end_date": "end_date8" - }, - "created_at": "2022-08-16T08:38:54Z", - "id": "loypromo_f0f9b849-725e-378d-b810-511237e07b67", - "incentive": { - "points_multiplier_data": { - "multiplier": "3.000", - "points_multiplier": 3 - }, - "type": "POINTS_MULTIPLIER", - "points_addition_data": { - "points_addition": 218 - } - }, - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "minimum_spend_amount_money": { - "amount": 2000, - "currency": "USD" - }, - "name": "Tuesday Happy Hour Promo", - "qualifying_item_variation_ids": [ - "CJ3RYL56ITAKMD4VRCM7XERS", - "AT3RYLR3TUA9C34VRCB7X5RR" - ], - "status": "ACTIVE", - "trigger_limit": { - "interval": "DAY", - "times": 1 - }, - "updated_at": "2022-08-16T08:38:54Z", - "canceled_at": "canceled_at0" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-loyalty-reward-response.md b/doc/models/retrieve-loyalty-reward-response.md deleted file mode 100644 index 80a058cd2..000000000 --- a/doc/models/retrieve-loyalty-reward-response.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Retrieve Loyalty Reward Response - -A response that includes the loyalty reward. - -## Structure - -`RetrieveLoyaltyRewardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `reward` | [`LoyaltyReward \| undefined`](../../doc/models/loyalty-reward.md) | Optional | Represents a contract to redeem loyalty points for a [reward tier](../../doc/models/loyalty-program-reward-tier.md) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state.
For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). | - -## Example (as JSON) - -```json -{ - "reward": { - "created_at": "2020-05-08T21:55:42Z", - "id": "9f18ac21-233a-31c3-be77-b45840f5a810", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "points": 10, - "redeemed_at": "2020-05-08T21:56:00Z", - "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "status": "REDEEMED", - "updated_at": "2020-05-08T21:56:00Z", - "order_id": "order_id4" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-merchant-custom-attribute-definition-request.md b/doc/models/retrieve-merchant-custom-attribute-definition-request.md deleted file mode 100644 index 36360139f..000000000 --- a/doc/models/retrieve-merchant-custom-attribute-definition-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Merchant Custom Attribute Definition Request - -Represents a [RetrieveMerchantCustomAttributeDefinition](../../doc/api/merchant-custom-attributes.md#retrieve-merchant-custom-attribute-definition) request. - -## Structure - -`RetrieveMerchantCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number \| undefined` | Optional | The current version of the custom attribute definition, which is used for strongly consistent
reads to guarantee that you receive the most up-to-date data. When included in the request,
Square returns the specified version or a higher version if one exists. If the specified version
is higher than the current version, Square returns a `BAD_REQUEST` error. | - -## Example (as JSON) - -```json -{ - "version": 162 -} -``` - diff --git a/doc/models/retrieve-merchant-custom-attribute-definition-response.md b/doc/models/retrieve-merchant-custom-attribute-definition-response.md deleted file mode 100644 index 8d08c7dc1..000000000 --- a/doc/models/retrieve-merchant-custom-attribute-definition-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Retrieve Merchant Custom Attribute Definition Response - -Represents a [RetrieveMerchantCustomAttributeDefinition](../../doc/api/merchant-custom-attributes.md#retrieve-merchant-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`RetrieveMerchantCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2023-05-05T19:06:36.559Z", - "description": "This is the other name this merchant goes by.", - "key": "alternative_seller_name", - "name": "Alternative Merchant Name", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2023-05-05T19:06:36.559Z", - "version": 1, - "visibility": "VISIBILITY_READ_ONLY" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-merchant-custom-attribute-request.md b/doc/models/retrieve-merchant-custom-attribute-request.md deleted file mode 100644 index b141a75aa..000000000 --- a/doc/models/retrieve-merchant-custom-attribute-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Retrieve Merchant Custom Attribute Request - -Represents a [RetrieveMerchantCustomAttribute](../../doc/api/merchant-custom-attributes.md#retrieve-merchant-custom-attribute) request. - -## Structure - -`RetrieveMerchantCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `withDefinition` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of
the custom attribute. Set this parameter to `true` to get the name and description of the custom
attribute, information about the data type, or other definition details. The default value is `false`. | -| `version` | `number \| undefined` | Optional | The current version of the custom attribute, which is used for strongly consistent reads to
guarantee that you receive the most up-to-date data. When included in the request, Square
returns the specified version or a higher version if one exists. If the specified version is
higher than the current version, Square returns a `BAD_REQUEST` error. | - -## Example (as JSON) - -```json -{ - "with_definition": false, - "version": 52 -} -``` - diff --git a/doc/models/retrieve-merchant-custom-attribute-response.md b/doc/models/retrieve-merchant-custom-attribute-response.md deleted file mode 100644 index 073829455..000000000 --- a/doc/models/retrieve-merchant-custom-attribute-response.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Retrieve Merchant Custom Attribute Response - -Represents a [RetrieveMerchantCustomAttribute](../../doc/api/merchant-custom-attributes.md#retrieve-merchant-custom-attribute) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`RetrieveMerchantCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-merchant-response.md b/doc/models/retrieve-merchant-response.md deleted file mode 100644 index bd29a19e4..000000000 --- a/doc/models/retrieve-merchant-response.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Retrieve Merchant Response - -The response object returned by the [RetrieveMerchant](../../doc/api/merchants.md#retrieve-merchant) endpoint. - -## Structure - -`RetrieveMerchantResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `merchant` | [`Merchant \| undefined`](../../doc/models/merchant.md) | Optional | Represents a business that sells with Square. | - -## Example (as JSON) - -```json -{ - "merchant": { - "business_name": "Apple A Day", - "country": "US", - "created_at": "2021-12-10T19:25:52.484Z", - "currency": "USD", - "id": "DM7VKY8Q63GNP", - "language_code": "en-US", - "main_location_id": "9A65CGC72ZQG1", - "status": "ACTIVE" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-merchant-settings-response.md b/doc/models/retrieve-merchant-settings-response.md deleted file mode 100644 index 3acff4877..000000000 --- a/doc/models/retrieve-merchant-settings-response.md +++ /dev/null @@ -1,76 +0,0 @@ - -# Retrieve Merchant Settings Response - -## Structure - -`RetrieveMerchantSettingsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `merchantSettings` | [`CheckoutMerchantSettings \| undefined`](../../doc/models/checkout-merchant-settings.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "merchant_settings": { - "merchant_id": "MERCHANT_ID", - "payment_methods": { - "afterpay_clearpay": { - "enabled": true, - "item_eligibility_range": { - "max": { - "amount": 10000, - "currency": "USD" - }, - "min": { - "amount": 100, - "currency": "USD" - } - }, - "order_eligibility_range": { - "max": { - "amount": 10000, - "currency": "USD" - }, - "min": { - "amount": 100, - "currency": "USD" - } - } - }, - "apple_pay": { - "enabled": true - }, - "cash_app_pay": { - "enabled": true - }, - "google_pay": { - "enabled": true - }, - "cash_app": { - "enabled": false - } - }, - "updated_at": "2022-06-16T22:25:35Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-order-custom-attribute-definition-request.md b/doc/models/retrieve-order-custom-attribute-definition-request.md deleted file mode 100644 index e07af476d..000000000 --- a/doc/models/retrieve-order-custom-attribute-definition-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Retrieve Order Custom Attribute Definition Request - -Represents a get request for an order custom attribute definition. - -## Structure - -`RetrieveOrderCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number \| undefined` | Optional | To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
control, include this optional field and specify the current version of the custom attribute. | - -## Example (as JSON) - -```json -{ - "version": 142 -} -``` - diff --git a/doc/models/retrieve-order-custom-attribute-definition-response.md b/doc/models/retrieve-order-custom-attribute-definition-response.md deleted file mode 100644 index 8fd4c201f..000000000 --- a/doc/models/retrieve-order-custom-attribute-definition-response.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Retrieve Order Custom Attribute Definition Response - -Represents a response from getting an order custom attribute definition. - -## Structure - -`RetrieveOrderCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-10-06T16:53:23.141Z", - "description": "The number of people seated at a table", - "key": "cover-count", - "name": "Cover count", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-10-06T16:53:23.141Z", - "version": 1, - "visibility": "VISIBILITY_READ_WRITE_VALUES" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-order-custom-attribute-request.md b/doc/models/retrieve-order-custom-attribute-request.md deleted file mode 100644 index 48362607c..000000000 --- a/doc/models/retrieve-order-custom-attribute-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Retrieve Order Custom Attribute Request - -Represents a get request for an order custom attribute. - -## Structure - -`RetrieveOrderCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `version` | `number \| undefined` | Optional | To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency)
control, include this optional field and specify the current version of the custom attribute. | -| `withDefinition` | `boolean \| null \| undefined` | Optional | Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each
custom attribute. Set this parameter to `true` to get the name and description of each custom attribute,
information about the data type, or other definition details. The default value is `false`. | - -## Example (as JSON) - -```json -{ - "version": 110, - "with_definition": false -} -``` - diff --git a/doc/models/retrieve-order-custom-attribute-response.md b/doc/models/retrieve-order-custom-attribute-response.md deleted file mode 100644 index e879f2b65..000000000 --- a/doc/models/retrieve-order-custom-attribute-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Retrieve Order Custom Attribute Response - -Represents a response from getting an order custom attribute. - -## Structure - -`RetrieveOrderCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-order-response.md b/doc/models/retrieve-order-response.md deleted file mode 100644 index 2daaf9c5e..000000000 --- a/doc/models/retrieve-order-response.md +++ /dev/null @@ -1,231 +0,0 @@ - -# Retrieve Order Response - -## Structure - -`RetrieveOrderResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "order": { - "created_at": "2020-05-18T16:30:49.614Z", - "discounts": [ - { - "applied_money": { - "amount": 550, - "currency": "USD" - }, - "name": "50% Off", - "percentage": "50", - "scope": "ORDER", - "type": "FIXED_PERCENTAGE", - "uid": "zGsRZP69aqSSR9lq9euSPB" - } - ], - "id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "line_items": [ - { - "applied_discounts": [ - { - "applied_money": { - "amount": 250, - "currency": "USD" - }, - "discount_uid": "zGsRZP69aqSSR9lq9euSPB", - "uid": "9zr9S4dxvPAixvn0lpa1VC" - } - ], - "base_price_money": { - "amount": 500, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 500, - "currency": "USD" - }, - "name": "Item 1", - "quantity": "1", - "total_discount_money": { - "amount": 250, - "currency": "USD" - }, - "total_money": { - "amount": 250, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "ULkg0tQTRK2bkU9fNv3IJD", - "variation_total_price_money": { - "amount": 500, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "applied_discounts": [ - { - "applied_money": { - "amount": 300, - "currency": "USD" - }, - "discount_uid": "zGsRZP69aqSSR9lq9euSPB", - "uid": "qa8LwwZK82FgSEkQc2HYVC" - } - ], - "base_price_money": { - "amount": 300, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 600, - "currency": "USD" - }, - "name": "Item 2", - "quantity": "2", - "total_discount_money": { - "amount": 300, - "currency": "USD" - }, - "total_money": { - "amount": 300, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "mumY8Nun4BC5aKe2yyx5a", - "variation_total_price_money": { - "amount": 600, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ], - "location_id": "D7AVYMEAPJ3A3", - "net_amounts": { - "discount_money": { - "amount": 550, - "currency": "USD" - }, - "service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "tax_money": { - "amount": 0, - "currency": "USD" - }, - "tip_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 550, - "currency": "USD" - } - }, - "state": "OPEN", - "total_discount_money": { - "amount": 550, - "currency": "USD" - }, - "total_money": { - "amount": 550, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "total_tip_money": { - "amount": 0, - "currency": "USD" - }, - "updated_at": "2020-05-18T16:30:49.614Z", - "version": 1, - "reference_id": "reference_id4", - "source": { - "name": "name4" - }, - "customer_id": "customer_id4" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-payment-link-response.md b/doc/models/retrieve-payment-link-response.md deleted file mode 100644 index 18952a87c..000000000 --- a/doc/models/retrieve-payment-link-response.md +++ /dev/null @@ -1,69 +0,0 @@ - -# Retrieve Payment Link Response - -## Structure - -`RetrievePaymentLinkResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `paymentLink` | [`PaymentLink \| undefined`](../../doc/models/payment-link.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "payment_link": { - "created_at": "2022-04-26T00:10:29Z", - "id": "LLO5Q3FRCFICDB4B", - "long_url": "https://checkout.square.site/EXAMPLE", - "order_id": "4uKASDATqSd1QQ9jV86sPhMdVEbSJc4F", - "url": "https://square.link/u/EXAMPLE", - "version": 1, - "description": "description2", - "checkout_options": { - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id8", - "redirect_url": "redirect_url2", - "merchant_support_email": "merchant_support_email8" - }, - "pre_populated_data": { - "buyer_email": "buyer_email8", - "buyer_phone_number": "buyer_phone_number0", - "buyer_address": { - "address_line_1": "address_line_12", - "address_line_2": "address_line_22", - "address_line_3": "address_line_38", - "locality": "locality2", - "sublocality": "sublocality2" - } - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-snippet-response.md b/doc/models/retrieve-snippet-response.md deleted file mode 100644 index b961af0dd..000000000 --- a/doc/models/retrieve-snippet-response.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Retrieve Snippet Response - -Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`. - -## Structure - -`RetrieveSnippetResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `snippet` | [`Snippet \| undefined`](../../doc/models/snippet.md) | Optional | Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. | - -## Example (as JSON) - -```json -{ - "snippet": { - "content": "", - "created_at": "2021-03-11T25:40:09.000000Z", - "id": "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7", - "site_id": "site_278075276488921835", - "updated_at": "2021-03-11T25:40:09.000000Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-subscription-request.md b/doc/models/retrieve-subscription-request.md deleted file mode 100644 index af705ac46..000000000 --- a/doc/models/retrieve-subscription-request.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Retrieve Subscription Request - -Defines input parameters in a request to the -[RetrieveSubscription](../../doc/api/subscriptions.md#retrieve-subscription) endpoint. - -## Structure - -`RetrieveSubscriptionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `include` | `string \| null \| undefined` | Optional | A query parameter to specify related information to be included in the response.

The supported query parameter values are:

- `actions`: to include scheduled actions on the targeted subscription. | - -## Example (as JSON) - -```json -{ - "include": "include2" -} -``` - diff --git a/doc/models/retrieve-subscription-response.md b/doc/models/retrieve-subscription-response.md deleted file mode 100644 index ddd6e5479..000000000 --- a/doc/models/retrieve-subscription-response.md +++ /dev/null @@ -1,62 +0,0 @@ - -# Retrieve Subscription Response - -Defines output parameters in a response from the -[RetrieveSubscription](../../doc/api/subscriptions.md#retrieve-subscription) endpoint. - -## Structure - -`RetrieveSubscriptionResponse` - -## Fields - -| 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 purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | - -## Example (as JSON) - -```json -{ - "subscription": { - "card_id": "ccof:IkWfpLj4tNHMyFii3GB", - "charged_through_date": "2023-11-20", - "created_at": "2022-07-27T21:53:10Z", - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "id": "8151fc89-da15-4eb9-a685-1a70883cebfc", - "invoice_ids": [ - "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "inv:0-ChrcX_i3sNmfsHTGKhI4Wg2mceA" - ], - "location_id": "S8GWD5R9QB376", - "paid_until_date": "2024-08-01", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "price_override_money": { - "amount": 25000, - "currency": "USD" - }, - "source": { - "name": "My Application" - }, - "start_date": "2022-07-27", - "status": "ACTIVE", - "timezone": "America/Los_Angeles" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-team-member-booking-profile-response.md b/doc/models/retrieve-team-member-booking-profile-response.md deleted file mode 100644 index 1b9d66954..000000000 --- a/doc/models/retrieve-team-member-booking-profile-response.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Retrieve Team Member Booking Profile Response - -## Structure - -`RetrieveTeamMemberBookingProfileResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberBookingProfile` | [`TeamMemberBookingProfile \| undefined`](../../doc/models/team-member-booking-profile.md) | Optional | The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [], - "team_member_booking_profile": { - "display_name": "Sandbox Staff", - "is_bookable": true, - "team_member_id": "TMaJcbiRqPIGZuS9", - "description": "description2", - "profile_image_url": "profile_image_url8" - } -} -``` - diff --git a/doc/models/retrieve-team-member-response.md b/doc/models/retrieve-team-member-response.md deleted file mode 100644 index 66debd53e..000000000 --- a/doc/models/retrieve-team-member-response.md +++ /dev/null @@ -1,82 +0,0 @@ - -# Retrieve Team Member Response - -Represents a response from a retrieve request containing a `TeamMember` object or error messages. - -## Structure - -`RetrieveTeamMemberResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMember` | [`TeamMember \| undefined`](../../doc/models/team-member.md) | Optional | A record representing an individual team member for a business. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "GA2Y9HSJ8KRYT", - "YSGH2WBKG94QZ" - ] - }, - "created_at": "2021-06-11T22:55:45Z", - "email_address": "joe_doe@example.com", - "family_name": "Doe", - "given_name": "Joe", - "id": "1yJlHapkseYnNPETIU1B", - "is_owner": false, - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "status": "ACTIVE", - "updated_at": "2021-06-15T17:38:05Z", - "wage_setting": { - "created_at": "2021-06-11T22:55:45Z", - "is_overtime_exempt": true, - "job_assignments": [ - { - "annual_rate": { - "amount": 3000000, - "currency": "USD" - }, - "hourly_rate": { - "amount": 1443, - "currency": "USD" - }, - "job_id": "FjS8x95cqHiMenw4f1NAUH4P", - "job_title": "Manager", - "pay_type": "SALARY", - "weekly_hours": 40 - }, - { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "job_title": "Cashier", - "pay_type": "HOURLY" - } - ], - "team_member_id": "1yJlHapkseYnNPETIU1B", - "updated_at": "2021-06-11T22:55:45Z", - "version": 1 - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-token-status-response.md b/doc/models/retrieve-token-status-response.md deleted file mode 100644 index 17633a825..000000000 --- a/doc/models/retrieve-token-status-response.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Retrieve Token Status Response - -Defines the fields that are included in the response body of -a request to the `RetrieveTokenStatus` endpoint. - -## Structure - -`RetrieveTokenStatusResponse` - -## Fields - -| 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 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. | - -## Example (as JSON) - -```json -{ - "client_id": "CLIENT_ID", - "expires_at": "2022-10-14T14:44:00Z", - "merchant_id": "MERCHANT_ID", - "scopes": [ - "PAYMENTS_READ", - "PAYMENTS_WRITE" - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-transaction-response.md b/doc/models/retrieve-transaction-response.md deleted file mode 100644 index ca46d06fc..000000000 --- a/doc/models/retrieve-transaction-response.md +++ /dev/null @@ -1,190 +0,0 @@ - -# Retrieve Transaction Response - -Defines the fields that are included in the response body of -a request to the [RetrieveTransaction](api-endpoint:Transactions-RetrieveTransaction) endpoint. - -One of `errors` or `transaction` is present in a given response (never both). - -## Structure - -`RetrieveTransactionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `transaction` | [`Transaction \| undefined`](../../doc/models/transaction.md) | Optional | Represents a transaction processed with Square, either with the
Connect API or with Square Point of Sale.

The `tenders` field of this object lists all methods of payment used to pay in
the transaction. | - -## Example (as JSON) - -```json -{ - "transaction": { - "created_at": "2016-03-10T22:57:56Z", - "id": "KnL67ZIwXCPtzOrqj0HrkxMF", - "location_id": "18YC4JDH91E1H", - "product": "EXTERNAL_API", - "reference_id": "some optional reference id", - "tenders": [ - { - "additional_recipients": [ - { - "amount_money": { - "amount": 20, - "currency": "USD" - }, - "description": "Application fees", - "location_id": "057P5VYJ4A5X1" - } - ], - "amount_money": { - "amount": 5000, - "currency": "USD" - }, - "card_details": { - "card": { - "card_brand": "VISA", - "last_4": "1111" - }, - "entry_method": "KEYED", - "status": "CAPTURED" - }, - "created_at": "2016-03-10T22:57:56Z", - "id": "MtZRYYdDrYNQbOvV7nbuBvMF", - "location_id": "18YC4JDH91E1H", - "note": "some optional note", - "processing_fee_money": { - "amount": 138, - "currency": "USD" - }, - "transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF", - "type": "CARD" - } - ], - "refunds": [ - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - }, - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - }, - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-vendor-response.md b/doc/models/retrieve-vendor-response.md deleted file mode 100644 index 64b8eeef9..000000000 --- a/doc/models/retrieve-vendor-response.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Retrieve Vendor Response - -Represents an output from a call to [RetrieveVendor](../../doc/api/vendors.md#retrieve-vendor). - -## Structure - -`RetrieveVendorResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered when the request fails. | -| `vendor` | [`Vendor \| undefined`](../../doc/models/vendor.md) | Optional | Represents a supplier to a seller. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "vendor": { - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2", - "name": "name6", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } -} -``` - diff --git a/doc/models/retrieve-wage-setting-response.md b/doc/models/retrieve-wage-setting-response.md deleted file mode 100644 index 92377c843..000000000 --- a/doc/models/retrieve-wage-setting-response.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Retrieve Wage Setting Response - -Represents a response from a retrieve request containing the specified `WageSetting` object or error messages. - -## Structure - -`RetrieveWageSettingResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `wageSetting` | [`WageSetting \| undefined`](../../doc/models/wage-setting.md) | Optional | Represents information about the overtime exemption status, job assignments, and compensation
for a [team member](../../doc/models/team-member.md). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "wage_setting": { - "created_at": "2020-06-11T23:01:21+00:00", - "is_overtime_exempt": false, - "job_assignments": [ - { - "annual_rate": { - "amount": 4500000, - "currency": "USD" - }, - "hourly_rate": { - "amount": 2164, - "currency": "USD" - }, - "job_title": "Manager", - "pay_type": "SALARY", - "weekly_hours": 40, - "job_id": "job_id2" - } - ], - "team_member_id": "1yJlHapkseYnNPETIU1B", - "updated_at": "2020-06-11T23:01:21+00:00", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/retrieve-webhook-subscription-response.md b/doc/models/retrieve-webhook-subscription-response.md deleted file mode 100644 index c977c8c57..000000000 --- a/doc/models/retrieve-webhook-subscription-response.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Retrieve Webhook Subscription Response - -Defines the fields that are included in the response body of -a request to the [RetrieveWebhookSubscription](../../doc/api/webhook-subscriptions.md#retrieve-webhook-subscription) endpoint. - -Note: if there are errors processing the request, the [Subscription](../../doc/models/webhook-subscription.md) will not be -present. - -## Structure - -`RetrieveWebhookSubscriptionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `subscription` | [`WebhookSubscription \| undefined`](../../doc/models/webhook-subscription.md) | Optional | Represents the details of a webhook subscription, including notification URL,
event types, and signature key. | - -## Example (as JSON) - -```json -{ - "subscription": { - "api_version": "2021-12-15", - "created_at": "2022-01-10 23:29:48 +0000 UTC", - "enabled": true, - "event_types": [ - "payment.created", - "payment.updated" - ], - "id": "wbhk_b35f6b3145074cf9ad513610786c19d5", - "name": "Example Webhook Subscription", - "notification_url": "https://example-webhook-url.com", - "signature_key": "1k9bIJKCeTmSQwyagtNRLg", - "updated_at": "2022-01-10 23:29:48 +0000 UTC" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/revoke-token-request.md b/doc/models/revoke-token-request.md deleted file mode 100644 index 4992bca19..000000000 --- a/doc/models/revoke-token-request.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Revoke Token Request - -## Structure - -`RevokeTokenRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `clientId` | `string \| null \| 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 \| null \| 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 \| null \| 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 \| null \| undefined` | Optional | If `true`, terminate the given single access token, but do not
terminate the entire authorization.
Default: `false` | - -## Example (as JSON) - -```json -{ - "access_token": "ACCESS_TOKEN", - "client_id": "CLIENT_ID", - "merchant_id": "merchant_id8", - "revoke_only_access_token": false -} -``` - diff --git a/doc/models/revoke-token-response.md b/doc/models/revoke-token-response.md deleted file mode 100644 index b04a96b0d..000000000 --- a/doc/models/revoke-token-response.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Revoke Token Response - -## Structure - -`RevokeTokenResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `success` | `boolean \| undefined` | Optional | If the request is successful, this is `true`. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "success": true, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/risk-evaluation-risk-level.md b/doc/models/risk-evaluation-risk-level.md deleted file mode 100644 index 618df3282..000000000 --- a/doc/models/risk-evaluation-risk-level.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Risk Evaluation Risk Level - -## Enumeration - -`RiskEvaluationRiskLevel` - -## Fields - -| Name | Description | -| --- | --- | -| `PENDING` | Indicates Square is still evaluating the payment. | -| `NORMAL` | Indicates payment risk is within the normal range. | -| `MODERATE` | Indicates elevated risk level associated with the payment. | -| `HIGH` | Indicates significantly elevated risk level with the payment. | - diff --git a/doc/models/risk-evaluation.md b/doc/models/risk-evaluation.md deleted file mode 100644 index 3298c99d7..000000000 --- a/doc/models/risk-evaluation.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Risk Evaluation - -Represents fraud risk information for the associated payment. - -When you take a payment through Square's Payments API (using the `CreatePayment` -endpoint), Square evaluates it and assigns a risk level to the payment. Sellers -can use this information to determine the course of action (for example, -provide the goods/services or refund the payment). - -## Structure - -`RiskEvaluation` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `createdAt` | `string \| undefined` | Optional | The timestamp when payment risk was evaluated, in RFC 3339 format. | -| `riskLevel` | [`string \| undefined`](../../doc/models/risk-evaluation-risk-level.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "created_at": "created_at0", - "risk_level": "MODERATE" -} -``` - diff --git a/doc/models/save-card-options.md b/doc/models/save-card-options.md deleted file mode 100644 index ae6f19bed..000000000 --- a/doc/models/save-card-options.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Save Card Options - -Describes save-card action fields. - -## Structure - -`SaveCardOptions` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Required | The square-assigned ID of the customer linked to the saved card. | -| `cardId` | `string \| undefined` | Optional | The id of the created card-on-file.
**Constraints**: *Maximum Length*: `64` | -| `referenceId` | `string \| null \| undefined` | Optional | An optional user-defined reference ID that can be used to associate
this `Card` to another entity in an external system. For example, a customer
ID generated by a third-party system.
**Constraints**: *Maximum Length*: `128` | - -## Example (as JSON) - -```json -{ - "customer_id": "customer_id4", - "card_id": "card_id8", - "reference_id": "reference_id6" -} -``` - diff --git a/doc/models/search-availability-filter.md b/doc/models/search-availability-filter.md deleted file mode 100644 index 12fcdd582..000000000 --- a/doc/models/search-availability-filter.md +++ /dev/null @@ -1,71 +0,0 @@ - -# Search Availability Filter - -A query filter to search for buyer-accessible availabilities by. - -## Structure - -`SearchAvailabilityFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `startAtRange` | [`TimeRange`](../../doc/models/time-range.md) | Required | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `locationId` | `string \| null \| undefined` | Optional | The query expression to search for buyer-accessible availabilities with their location IDs matching the specified location ID.
This query expression cannot be set if `booking_id` is set.
**Constraints**: *Maximum Length*: `32` | -| `segmentFilters` | [`SegmentFilter[] \| null \| undefined`](../../doc/models/segment-filter.md) | Optional | The query expression to search for buyer-accessible availabilities matching the specified list of segment filters.
If the size of the `segment_filters` list is `n`, the search returns availabilities with `n` segments per availability.

This query expression cannot be set if `booking_id` is set. | -| `bookingId` | `string \| null \| undefined` | Optional | The query expression to search for buyer-accessible availabilities for an existing booking by matching the specified `booking_id` value.
This is commonly used to reschedule an appointment.
If this expression is set, the `location_id` and `segment_filters` expressions cannot be set.
**Constraints**: *Maximum Length*: `36` | - -## Example (as JSON) - -```json -{ - "start_at_range": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "location_id": "location_id8", - "segment_filters": [ - { - "service_variation_id": "service_variation_id4", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } - }, - { - "service_variation_id": "service_variation_id4", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } - } - ], - "booking_id": "booking_id8" -} -``` - diff --git a/doc/models/search-availability-query.md b/doc/models/search-availability-query.md deleted file mode 100644 index 290bfd12c..000000000 --- a/doc/models/search-availability-query.md +++ /dev/null @@ -1,89 +0,0 @@ - -# Search Availability Query - -The query used to search for buyer-accessible availabilities of bookings. - -## Structure - -`SearchAvailabilityQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`SearchAvailabilityFilter`](../../doc/models/search-availability-filter.md) | Required | A query filter to search for buyer-accessible availabilities by. | - -## Example (as JSON) - -```json -{ - "filter": { - "start_at_range": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "location_id": "location_id8", - "segment_filters": [ - { - "service_variation_id": "service_variation_id4", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } - }, - { - "service_variation_id": "service_variation_id4", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } - }, - { - "service_variation_id": "service_variation_id4", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } - } - ], - "booking_id": "booking_id8" - } -} -``` - diff --git a/doc/models/search-availability-request.md b/doc/models/search-availability-request.md deleted file mode 100644 index f158e968c..000000000 --- a/doc/models/search-availability-request.md +++ /dev/null @@ -1,89 +0,0 @@ - -# Search Availability Request - -## Structure - -`SearchAvailabilityRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`SearchAvailabilityQuery`](../../doc/models/search-availability-query.md) | Required | The query used to search for buyer-accessible availabilities of bookings. | - -## Example (as JSON) - -```json -{ - "query": { - "filter": { - "start_at_range": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "location_id": "location_id8", - "segment_filters": [ - { - "service_variation_id": "service_variation_id4", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } - }, - { - "service_variation_id": "service_variation_id4", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } - }, - { - "service_variation_id": "service_variation_id4", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } - } - ], - "booking_id": "booking_id8" - } - } -} -``` - diff --git a/doc/models/search-availability-response.md b/doc/models/search-availability-response.md deleted file mode 100644 index 520ab8ea9..000000000 --- a/doc/models/search-availability-response.md +++ /dev/null @@ -1,276 +0,0 @@ - -# Search Availability Response - -## Structure - -`SearchAvailabilityResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `availabilities` | [`Availability[] \| undefined`](../../doc/models/availability.md) | Optional | List of appointment slots available for booking. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "availabilities": [ - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-26T13:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-26T13:30:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-26T14:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-26T14:30:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-26T15:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-26T15:30:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-26T16:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T09:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T09:30:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T10:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T10:30:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T11:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T11:30:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T12:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T12:30:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T13:00:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T13:30:00Z" - }, - { - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMaJcbiRqPIGZuS9", - "intermission_minutes": 54, - "any_team_member": false - } - ], - "location_id": "LEQHH0YY8B42M", - "start_at": "2020-11-27T14:00:00Z" - } - ], - "errors": [] -} -``` - diff --git a/doc/models/search-catalog-items-request-stock-level.md b/doc/models/search-catalog-items-request-stock-level.md deleted file mode 100644 index e0a17df86..000000000 --- a/doc/models/search-catalog-items-request-stock-level.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Search Catalog Items Request Stock Level - -Defines supported stock levels of the item inventory. - -## Enumeration - -`SearchCatalogItemsRequestStockLevel` - -## Fields - -| Name | Description | -| --- | --- | -| `OUT` | The item inventory is empty. | -| `LOW` | The item inventory is low. | - diff --git a/doc/models/search-catalog-items-request.md b/doc/models/search-catalog-items-request.md deleted file mode 100644 index 9d2e30aa3..000000000 --- a/doc/models/search-catalog-items-request.md +++ /dev/null @@ -1,69 +0,0 @@ - -# Search Catalog Items Request - -Defines the request body for the [SearchCatalogItems](../../doc/api/catalog.md#search-catalog-items) endpoint. - -## Structure - -`SearchCatalogItemsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `textFilter` | `string \| undefined` | Optional | The text filter expression to return items or item variations containing specified text in
the `name`, `description`, or `abbreviation` attribute value of an item, or in
the `name`, `sku`, or `upc` attribute value of an item variation. | -| `categoryIds` | `string[] \| undefined` | Optional | The category id query expression to return items containing the specified category IDs. | -| `stockLevels` | [`string[] \| undefined`](../../doc/models/search-catalog-items-request-stock-level.md) | Optional | The stock-level query expression to return item variations with the specified stock levels.
See [SearchCatalogItemsRequestStockLevel](#type-searchcatalogitemsrequeststocklevel) for possible values | -| `enabledLocationIds` | `string[] \| undefined` | Optional | The enabled-location query expression to return items and item variations having specified enabled locations. | -| `cursor` | `string \| undefined` | Optional | The pagination token, returned in the previous response, used to fetch the next batch of pending results. | -| `limit` | `number \| undefined` | Optional | The maximum number of results to return per page. The default value is 100.
**Constraints**: `<= 100` | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `productTypes` | [`string[] \| undefined`](../../doc/models/catalog-item-product-type.md) | Optional | The product types query expression to return items or item variations having the specified product types. | -| `customAttributeFilters` | [`CustomAttributeFilter[] \| undefined`](../../doc/models/custom-attribute-filter.md) | Optional | The customer-attribute filter to return items or item variations matching the specified
custom attribute expressions. A maximum number of 10 custom attribute expressions are supported in
a single call to the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint. | -| `archivedState` | [`string \| undefined`](../../doc/models/archived-state.md) | Optional | Defines the values for the `archived_state` query expression
used in [SearchCatalogItems](../../doc/api/catalog.md#search-catalog-items)
to return the archived, not archived or either type of catalog items. | - -## Example (as JSON) - -```json -{ - "category_ids": [ - "WINE_CATEGORY_ID" - ], - "custom_attribute_filters": [ - { - "bool_filter": true, - "custom_attribute_definition_id": "VEGAN_DEFINITION_ID" - }, - { - "custom_attribute_definition_id": "BRAND_DEFINITION_ID", - "string_filter": "Dark Horse" - }, - { - "key": "VINTAGE", - "number_filter": { - "max": "2018", - "min": "2017" - } - }, - { - "custom_attribute_definition_id": "VARIETAL_DEFINITION_ID", - "selection_ids_filter": "MERLOT_SELECTION_ID" - } - ], - "enabled_location_ids": [ - "ATL_LOCATION_ID" - ], - "limit": 100, - "product_types": [ - "REGULAR" - ], - "sort_order": "ASC", - "stock_levels": [ - "OUT", - "LOW" - ], - "text_filter": "red", - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-catalog-items-response.md b/doc/models/search-catalog-items-response.md deleted file mode 100644 index 6f881f8e9..000000000 --- a/doc/models/search-catalog-items-response.md +++ /dev/null @@ -1,89 +0,0 @@ - -# Search Catalog Items Response - -Defines the response body returned from the [SearchCatalogItems](../../doc/api/catalog.md#search-catalog-items) endpoint. - -## Structure - -`SearchCatalogItemsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `items` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | Returned items matching the specified query expressions. | -| `cursor` | `string \| undefined` | Optional | Pagination token used in the next request to return more of the search result. | -| `matchedVariationIds` | `string[] \| undefined` | Optional | Ids of returned item variations matching the specified query expression. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "items": [ - { - "type": "SUBSCRIPTION_PLAN", - "id": "id8", - "updated_at": "updated_at6", - "version": 38, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "cursor": "cursor2", - "matched_variation_ids": [ - "matched_variation_ids3" - ] -} -``` - diff --git a/doc/models/search-catalog-objects-request.md b/doc/models/search-catalog-objects-request.md deleted file mode 100644 index 7282616f4..000000000 --- a/doc/models/search-catalog-objects-request.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Search Catalog Objects Request - -## Structure - -`SearchCatalogObjectsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Optional | The pagination cursor returned in the previous response. Leave unset for an initial request.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `objectTypes` | [`string[] \| undefined`](../../doc/models/catalog-object-type.md) | Optional | The desired set of object types to appear in the search results.

If this is unspecified, the operation returns objects of all the top level types at the version
of the Square API used to make the request. Object types that are nested onto other object types
are not included in the defaults.

At the current API version the default object types are:
ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST,
PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,
SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS.

Note that if you wish for the query to return objects belonging to nested types (i.e., COMPONENT, IMAGE,
ITEM_OPTION_VAL, ITEM_VARIATION, or MODIFIER), you must explicitly include all the types of interest
in this field. | -| `includeDeletedObjects` | `boolean \| undefined` | Optional | If `true`, deleted objects will be included in the results. Deleted objects will have their
`is_deleted` field set to `true`. | -| `includeRelatedObjects` | `boolean \| undefined` | Optional | If `true`, the response will include additional objects that are related to the
requested objects. Related objects are objects that are referenced by object ID by the objects
in the response. This is helpful if the objects are being fetched for immediate display to a user.
This process only goes one level deep. Objects referenced by the related objects will not be included.
For example:

If the `objects` field of the response contains a CatalogItem, its associated
CatalogCategory objects, CatalogTax objects, CatalogImage objects and
CatalogModifierLists will be returned in the `related_objects` field of the
response. If the `objects` field of the response contains a CatalogItemVariation,
its parent CatalogItem will be returned in the `related_objects` field of
the response.

Default value: `false` | -| `beginTime` | `string \| undefined` | Optional | Return objects modified after this [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), in RFC 3339
format, e.g., `2016-09-04T23:59:33.123Z`. The timestamp is exclusive - objects with a
timestamp equal to `begin_time` will not be included in the response. | -| `query` | [`CatalogQuery \| undefined`](../../doc/models/catalog-query.md) | Optional | A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint.

Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects](../../doc/api/catalog.md#search-catalog-objects).
Any combination of the following types may be used together:

- [exact_query](../../doc/models/catalog-query-exact.md)
- [prefix_query](../../doc/models/catalog-query-prefix.md)
- [range_query](../../doc/models/catalog-query-range.md)
- [sorted_attribute_query](../../doc/models/catalog-query-sorted-attribute.md)
- [text_query](../../doc/models/catalog-query-text.md)

All other query types cannot be combined with any others.

When a query filter is based on an attribute, the attribute must be searchable.
Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters.

Searchable attribute and objects queryable by searchable attributes:

- `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue`
- `description`: `CatalogItem`, `CatalogItemOptionValue`
- `abbreviation`: `CatalogItem`
- `upc`: `CatalogItemVariation`
- `sku`: `CatalogItemVariation`
- `caption`: `CatalogImage`
- `display_name`: `CatalogItemOption`

For example, to search for [CatalogItem](../../doc/models/catalog-item.md) objects by searchable attributes, you can use
the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter. | -| `limit` | `number \| undefined` | Optional | A limit on the number of results to be returned in a single page. The limit is advisory -
the implementation may return more or fewer results. If the supplied limit is negative, zero, or
is higher than the maximum limit of 1,000, it will be ignored. | -| `includeCategoryPathToRoot` | `boolean \| undefined` | Optional | Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists
of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category
and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned
in the response payload. | - -## Example (as JSON) - -```json -{ - "limit": 100, - "object_types": [ - "ITEM" - ], - "query": { - "prefix_query": { - "attribute_name": "name", - "attribute_prefix": "tea" - } - }, - "cursor": "cursor2", - "include_deleted_objects": false, - "include_related_objects": false, - "begin_time": "begin_time2" -} -``` - diff --git a/doc/models/search-catalog-objects-response.md b/doc/models/search-catalog-objects-response.md deleted file mode 100644 index 3c04f281f..000000000 --- a/doc/models/search-catalog-objects-response.md +++ /dev/null @@ -1,231 +0,0 @@ - -# Search Catalog Objects Response - -## Structure - -`SearchCatalogObjectsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If unset, this is the final response.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `objects` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | The CatalogObjects returned. | -| `relatedObjects` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | A list of CatalogObjects referenced by the objects in the `objects` field. | -| `latestTime` | `string \| undefined` | Optional | When the associated product catalog was last updated. Will
match the value for `end_time` or `cursor` if either field is included in the `SearchCatalog` request. | - -## Example (as JSON) - -```json -{ - "objects": [ - { - "id": "X5DZ5NWWAQ44CKBLKIFQGOWK", - "is_deleted": false, - "item_data": { - "categories": [ - { - "id": "E7CLE5RZZ744BHWVQQEAHI2C", - "ordinal": 0 - } - ], - "description": "A delicious blend of black tea.", - "name": "Tea - Black", - "product_type": "REGULAR", - "tax_ids": [ - "ZXITPM6RWHZ7GZ7EIP3YKECM" - ], - "variations": [ - { - "id": "5GSZPX6EU7MM75S57OONG3V5", - "is_deleted": false, - "item_variation_data": { - "item_id": "X5DZ5NWWAQ44CKBLKIFQGOWK", - "name": "Regular", - "ordinal": 1, - "price_money": { - "amount": 150, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2017-10-26T15:27:31.626Z", - "version": 1509031651626 - }, - { - "id": "XVLBN7DU6JTWHJTG5F265B43", - "is_deleted": false, - "item_variation_data": { - "item_id": "X5DZ5NWWAQ44CKBLKIFQGOWK", - "name": "Large", - "ordinal": 2, - "price_money": { - "amount": 225, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2017-10-26T15:27:31.626Z", - "version": 1509031651626 - } - ], - "visibility": "PRIVATE" - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "2017-10-26T15:41:32.337Z", - "version": 1509032492337, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - { - "id": "NNNEM3LA656Q46NXLWCNI7S5", - "is_deleted": false, - "item_data": { - "categories": [ - { - "id": "E7CLE5RZZ744BHWVQQEAHI2C", - "ordinal": 0 - } - ], - "description": "Relaxing green herbal tea.", - "name": "Tea - Green", - "product_type": "REGULAR", - "tax_ids": [ - "ZXITPM6RWHZ7GZ7EIP3YKECM" - ], - "variations": [ - { - "id": "FHYBVIA6NVBCSOVETA62WEA4", - "is_deleted": false, - "item_variation_data": { - "item_id": "NNNEM3LA656Q46NXLWCNI7S5", - "name": "Regular", - "ordinal": 1, - "price_money": { - "amount": 150, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2017-10-26T15:29:00.524Z", - "version": 1509031740524 - } - ], - "visibility": "PRIVATE" - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "2017-10-26T15:41:23.232Z", - "version": 1509032483232, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor6", - "related_objects": [ - { - "type": "SUBSCRIPTION_PLAN_VARIATION", - "id": "id2", - "updated_at": "updated_at2", - "version": 0, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } - ], - "latest_time": "latest_time2" -} -``` - diff --git a/doc/models/search-customers-request.md b/doc/models/search-customers-request.md deleted file mode 100644 index d632eea48..000000000 --- a/doc/models/search-customers-request.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Search Customers Request - -Defines the fields that are included in the request body of a request to the -`SearchCustomers` endpoint. - -## Structure - -`SearchCustomersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Optional | Include the pagination cursor in subsequent calls to this endpoint to retrieve
the next set of results associated with the original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `limit` | `bigint \| undefined` | Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: `>= 1`, `<= 100` | -| `query` | [`CustomerQuery \| undefined`](../../doc/models/customer-query.md) | Optional | Represents filtering and sorting criteria for a [SearchCustomers](../../doc/api/customers.md#search-customers) request. | -| `count` | `boolean \| undefined` | Optional | Indicates whether to return the total count of matching customers in the `count` field of the response.

The default value is `false`. | - -## Example (as JSON) - -```json -{ - "limit": 2, - "query": { - "filter": { - "created_at": { - "end_at": "2018-02-01T00:00:00-00:00", - "start_at": "2018-01-01T00:00:00-00:00" - }, - "creation_source": { - "rule": "INCLUDE", - "values": [ - "THIRD_PARTY" - ] - }, - "email_address": { - "fuzzy": "example.com", - "exact": "exact2" - }, - "group_ids": { - "all": [ - "545AXB44B4XXWMVQ4W8SBT3HHF" - ] - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "phone_number": { - "exact": "exact2", - "fuzzy": "fuzzy8" - } - }, - "sort": { - "field": "CREATED_AT", - "order": "ASC" - } - }, - "cursor": "cursor0", - "count": false -} -``` - diff --git a/doc/models/search-customers-response.md b/doc/models/search-customers-response.md deleted file mode 100644 index 91468428e..000000000 --- a/doc/models/search-customers-response.md +++ /dev/null @@ -1,131 +0,0 @@ - -# Search Customers Response - -Defines the fields that are included in the response body of -a request to the `SearchCustomers` endpoint. - -Either `errors` or `customers` is present in a given response (never both). - -## Structure - -`SearchCustomersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `customers` | [`Customer[] \| undefined`](../../doc/models/customer.md) | Optional | The customer profiles that match the search query. If any search condition is not met, the result is an empty object (`{}`).
Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`)
are included in the response. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor that can be used during subsequent calls
to `SearchCustomers` to retrieve the next set of results associated
with the original query. Pagination cursors are only present when
a request succeeds and additional results are available.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `count` | `bigint \| undefined` | Optional | The total count of customers associated with the Square account that match the search query. Only customer profiles with
public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is
present only if `count` is set to `true` in the request. | - -## Example (as JSON) - -```json -{ - "cursor": "9dpS093Uy12AzeE", - "customers": [ - { - "address": { - "address_line_1": "505 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "created_at": "2018-01-23T20:21:54.859Z", - "creation_source": "DIRECTORY", - "email_address": "james.bond@example.com", - "family_name": "Bond", - "given_name": "James", - "group_ids": [ - "545AXB44B4XXWMVQ4W8SBT3HHF" - ], - "id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "phone_number": "+1-212-555-4250", - "preferences": { - "email_unsubscribed": false - }, - "reference_id": "YOUR_REFERENCE_ID_2", - "segment_ids": [ - "1KB9JE5EGJXCW.REACHABLE" - ], - "updated_at": "2020-04-20T10:02:43.083Z", - "version": 7, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - }, - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - }, - { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "created_at": "2018-01-30T14:10:54.859Z", - "creation_source": "THIRD_PARTY", - "email_address": "amelia.earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "group_ids": [ - "545AXB44B4XXWMVQ4W8SBT3HHF" - ], - "id": "A9641GZW2H7Z56YYSD41Q12HDW", - "note": "a customer", - "phone_number": "+1-212-555-9238", - "preferences": { - "email_unsubscribed": false - }, - "reference_id": "YOUR_REFERENCE_ID_1", - "segment_ids": [ - "1KB9JE5EGJXCW.REACHABLE" - ], - "updated_at": "2018-03-08T18:25:21.342Z", - "version": 1, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - }, - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "count": 90 -} -``` - diff --git a/doc/models/search-events-filter.md b/doc/models/search-events-filter.md deleted file mode 100644 index a01383218..000000000 --- a/doc/models/search-events-filter.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Search Events Filter - -Criteria to filter events by. - -## Structure - -`SearchEventsFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `eventTypes` | `string[] \| null \| undefined` | Optional | Filter events by event types. | -| `merchantIds` | `string[] \| null \| undefined` | Optional | Filter events by merchant. | -| `locationIds` | `string[] \| null \| undefined` | Optional | Filter events by location. | -| `createdAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | - -## Example (as JSON) - -```json -{ - "event_types": [ - "event_types6", - "event_types7", - "event_types8" - ], - "merchant_ids": [ - "merchant_ids5", - "merchant_ids6", - "merchant_ids7" - ], - "location_ids": [ - "location_ids8", - "location_ids9" - ], - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } -} -``` - diff --git a/doc/models/search-events-query.md b/doc/models/search-events-query.md deleted file mode 100644 index a37f2ff0b..000000000 --- a/doc/models/search-events-query.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Search Events Query - -Contains query criteria for the search. - -## Structure - -`SearchEventsQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`SearchEventsFilter \| undefined`](../../doc/models/search-events-filter.md) | Optional | Criteria to filter events by. | -| `sort` | [`SearchEventsSort \| undefined`](../../doc/models/search-events-sort.md) | Optional | Criteria to sort events by. | - -## Example (as JSON) - -```json -{ - "filter": { - "event_types": [ - "event_types2", - "event_types3" - ], - "merchant_ids": [ - "merchant_ids1", - "merchant_ids2" - ], - "location_ids": [ - "location_ids4" - ], - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "sort": { - "field": "DEFAULT", - "order": "DESC" - } -} -``` - diff --git a/doc/models/search-events-request.md b/doc/models/search-events-request.md deleted file mode 100644 index d4f2d71a0..000000000 --- a/doc/models/search-events-request.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Search Events Request - -Searches [Event](../../doc/models/event.md)s for your application. - -## Structure - -`SearchEventsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of events for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
**Constraints**: *Maximum Length*: `256` | -| `limit` | `number \| undefined` | Optional | The maximum number of events to return in a single page. The response might contain fewer events. The default value is 100, which is also the maximum allowed value.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

Default: 100
**Constraints**: `>= 1`, `<= 100` | -| `query` | [`SearchEventsQuery \| undefined`](../../doc/models/search-events-query.md) | Optional | Contains query criteria for the search. | - -## Example (as JSON) - -```json -{ - "cursor": "cursor8", - "limit": 176, - "query": { - "filter": { - "event_types": [ - "event_types2", - "event_types3" - ], - "merchant_ids": [ - "merchant_ids1", - "merchant_ids2" - ], - "location_ids": [ - "location_ids4" - ], - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "sort": { - "field": "DEFAULT", - "order": "DESC" - } - } -} -``` - diff --git a/doc/models/search-events-response.md b/doc/models/search-events-response.md deleted file mode 100644 index fd1154879..000000000 --- a/doc/models/search-events-response.md +++ /dev/null @@ -1,85 +0,0 @@ - -# Search Events Response - -Defines the fields that are included in the response body of -a request to the [SearchEvents](../../doc/api/events.md#search-events) endpoint. - -Note: if there are errors processing the request, the events field will not be -present. - -## Structure - -`SearchEventsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `events` | [`Event[] \| undefined`](../../doc/models/event.md) | Optional | The list of [Event](entity:Event)s returned by the search. | -| `metadata` | [`EventMetadata[] \| undefined`](../../doc/models/event-metadata.md) | Optional | Contains the metadata of an event. For more information, see [Event](entity:Event). | -| `cursor` | `string \| undefined` | Optional | When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch the next set of events. If empty, this is the final response.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "cursor": "6b571fc9773647f=", - "events": [ - { - "created_at": "2022-04-26T10:08:40.454726", - "data": { - "id": "ORSEVtZAJxb37RA1EiGw", - "object": { - "dispute": { - "amount_money": { - "amount": 8801, - "currency": "USD" - }, - "brand_dispute_id": "r9rKGSBBQbywBNnWWIiGFg", - "card_brand": "VISA", - "created_at": "2020-02-19T21:24:53.258Z", - "disputed_payment": { - "payment_id": "fbmsaEOpoARDKxiSGH1fqPuqoqFZY" - }, - "due_at": "2020-03-04T00:00:00.000Z", - "id": "ORSEVtZAJxb37RA1EiGw", - "location_id": "VJDQQP3CG14EY", - "reason": "AMOUNT_DIFFERS", - "reported_at": "2020-02-19T00:00:00.000Z", - "state": "WON", - "updated_at": "2020-02-19T21:34:41.851Z", - "version": 6 - } - }, - "type": "dispute" - }, - "event_id": "73ecd468-0aba-424f-b862-583d44efe7c8", - "location_id": "VJDQQP3CG14EY", - "merchant_id": "0HPGX5JYE6EE1", - "type": "dispute.state.updated" - } - ], - "metadata": [ - { - "api_version": "2022-12-13", - "event_id": "73ecd468-0aba-424f-b862-583d44efe7c8" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/search-events-sort-field.md b/doc/models/search-events-sort-field.md deleted file mode 100644 index a342344bb..000000000 --- a/doc/models/search-events-sort-field.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Search Events Sort Field - -Specifies the sort key for events returned from a search. - -## Enumeration - -`SearchEventsSortField` - -## Fields - -| Name | Description | -| --- | --- | -| `DEFAULT` | Use the default sort key. The default behavior is to sort events by when they were created (`created_at`). | - diff --git a/doc/models/search-events-sort.md b/doc/models/search-events-sort.md deleted file mode 100644 index 6394e9c83..000000000 --- a/doc/models/search-events-sort.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Search Events Sort - -Criteria to sort events by. - -## Structure - -`SearchEventsSort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `field` | [`string \| undefined`](../../doc/models/search-events-sort-field.md) | Optional | Specifies the sort key for events returned from a search. | -| `order` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "field": "DEFAULT", - "order": "DESC" -} -``` - diff --git a/doc/models/search-invoices-request.md b/doc/models/search-invoices-request.md deleted file mode 100644 index 9d1c05596..000000000 --- a/doc/models/search-invoices-request.md +++ /dev/null @@ -1,41 +0,0 @@ - -# Search Invoices Request - -Describes a `SearchInvoices` request. - -## Structure - -`SearchInvoicesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`InvoiceQuery`](../../doc/models/invoice-query.md) | Required | Describes query criteria for searching invoices. | -| `limit` | `number \| undefined` | Optional | The maximum number of invoices to return (200 is the maximum `limit`).
If not provided, the server uses a default limit of 100 invoices. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for your original query.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "query": { - "filter": { - "customer_ids": [ - "JDKYHBWT1D4F8MFH63DBMEN8Y4" - ], - "location_ids": [ - "ES0RJRZYEC39A" - ] - }, - "limit": 100, - "sort": { - "field": "INVOICE_SORT_DATE", - "order": "DESC" - } - }, - "limit": 26, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-invoices-response.md b/doc/models/search-invoices-response.md deleted file mode 100644 index 21d038fa5..000000000 --- a/doc/models/search-invoices-response.md +++ /dev/null @@ -1,191 +0,0 @@ - -# Search Invoices Response - -Describes a `SearchInvoices` response. - -## Structure - -`SearchInvoicesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoices` | [`Invoice[] \| undefined`](../../doc/models/invoice.md) | Optional | The list of invoices returned by the search. | -| `cursor` | `string \| undefined` | Optional | When a response is truncated, it includes a cursor that you can use in a
subsequent request to fetch the next set of invoices. If empty, this is the final
response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "ChoIDhIWVm54ZVRhLXhySFBOejBBM2xJb2daUQoFCI4IGAE", - "invoices": [ - { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": false - }, - "created_at": "2020-06-18T17:45:13Z", - "custom_fields": [ - { - "label": "Event Reference Number", - "placement": "ABOVE_LINE_ITEMS", - "value": "Ref. #1234" - }, - { - "label": "Terms of Service", - "placement": "BELOW_LINE_ITEMS", - "value": "The terms of service are..." - } - ], - "delivery_method": "EMAIL", - "description": "We appreciate your business!", - "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "invoice_number": "inv-100", - "location_id": "ES0RJRZYEC39A", - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "payment_requests": [ - { - "automatic_payment_source": "NONE", - "computed_amount_money": { - "amount": 10000, - "currency": "USD" - }, - "due_date": "2030-01-24", - "reminders": [ - { - "message": "Your invoice is due tomorrow", - "relative_scheduled_days": -1, - "status": "PENDING", - "uid": "beebd363-e47f-4075-8785-c235aaa7df11" - } - ], - "request_type": "BALANCE", - "tipping_enabled": true, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "sale_or_service_date": "2030-01-24", - "scheduled_at": "2030-01-13T10:00:00Z", - "status": "DRAFT", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "title": "Event Planning Services", - "updated_at": "2020-06-18T17:45:13Z", - "version": 0 - }, - { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": true - }, - "created_at": "2021-01-23T15:29:12Z", - "delivery_method": "EMAIL", - "id": "inv:0-ChC366qAfskpGrBI_1bozs9mEA3", - "invoice_number": "inv-455", - "location_id": "ES0RJRZYEC39A", - "next_payment_amount_money": { - "amount": 3000, - "currency": "USD" - }, - "order_id": "a65jnS8NXbfprvGJzY9F4fQTuaB", - "payment_requests": [ - { - "automatic_payment_source": "CARD_ON_FILE", - "card_id": "ccof:IkWfpLj4tNHMyFii3GB", - "computed_amount_money": { - "amount": 1000, - "currency": "USD" - }, - "due_date": "2021-01-23", - "percentage_requested": "25", - "request_type": "DEPOSIT", - "tipping_enabled": false, - "total_completed_amount_money": { - "amount": 1000, - "currency": "USD" - }, - "uid": "66c3bdfd-5090-4ff9-a8a0-c1e1a2ffa176" - }, - { - "automatic_payment_source": "CARD_ON_FILE", - "card_id": "ccof:IkWfpLj4tNHMyFii3GB", - "computed_amount_money": { - "amount": 3000, - "currency": "USD" - }, - "due_date": "2021-06-15", - "request_type": "BALANCE", - "tipping_enabled": false, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "120c5e18-4f80-4f6b-b159-774cb9bf8f99" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "public_url": "https://squareup.com/pay-invoice/h9sfsfTGTSnYEhISUDBhEQ", - "sale_or_service_date": "2030-01-24", - "status": "PARTIALLY_PAID", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "updated_at": "2021-01-23T15:29:56Z", - "version": 3 - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/search-loyalty-accounts-request-loyalty-account-query.md b/doc/models/search-loyalty-accounts-request-loyalty-account-query.md deleted file mode 100644 index 7be7861bb..000000000 --- a/doc/models/search-loyalty-accounts-request-loyalty-account-query.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Search Loyalty Accounts Request Loyalty Account Query - -The search criteria for the loyalty accounts. - -## Structure - -`SearchLoyaltyAccountsRequestLoyaltyAccountQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `mappings` | [`LoyaltyAccountMapping[] \| null \| undefined`](../../doc/models/loyalty-account-mapping.md) | Optional | The set of mappings to use in the loyalty account search.

This cannot be combined with `customer_ids`.

Max: 30 mappings | -| `customerIds` | `string[] \| null \| undefined` | Optional | The set of customer IDs to use in the loyalty account search.

This cannot be combined with `mappings`.

Max: 30 customer IDs | - -## Example (as JSON) - -```json -{ - "mappings": [ - { - "id": "id8", - "created_at": "created_at6", - "phone_number": "phone_number4" - }, - { - "id": "id8", - "created_at": "created_at6", - "phone_number": "phone_number4" - }, - { - "id": "id8", - "created_at": "created_at6", - "phone_number": "phone_number4" - } - ], - "customer_ids": [ - "customer_ids5", - "customer_ids4", - "customer_ids3" - ] -} -``` - diff --git a/doc/models/search-loyalty-accounts-request.md b/doc/models/search-loyalty-accounts-request.md deleted file mode 100644 index 302f2f19b..000000000 --- a/doc/models/search-loyalty-accounts-request.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Search Loyalty Accounts Request - -A request to search for loyalty accounts. - -## Structure - -`SearchLoyaltyAccountsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`SearchLoyaltyAccountsRequestLoyaltyAccountQuery \| undefined`](../../doc/models/search-loyalty-accounts-request-loyalty-account-query.md) | Optional | The search criteria for the loyalty accounts. | -| `limit` | `number \| undefined` | Optional | The maximum number of results to include in the response. The default value is 30.
**Constraints**: `>= 1`, `<= 200` | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to
this endpoint. Provide this to retrieve the next set of
results for the original query.

For more information,
see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "limit": 10, - "query": { - "mappings": [ - { - "phone_number": "+14155551234", - "id": "id8", - "created_at": "created_at6" - } - ], - "customer_ids": [ - "customer_ids1", - "customer_ids2", - "customer_ids3" - ] - }, - "cursor": "cursor0" -} -``` - diff --git a/doc/models/search-loyalty-accounts-response.md b/doc/models/search-loyalty-accounts-response.md deleted file mode 100644 index 8c30a6773..000000000 --- a/doc/models/search-loyalty-accounts-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Search Loyalty Accounts Response - -A response that includes loyalty accounts that satisfy the search criteria. - -## Structure - -`SearchLoyaltyAccountsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `loyaltyAccounts` | [`LoyaltyAccount[] \| undefined`](../../doc/models/loyalty-account.md) | Optional | The loyalty accounts that met the search criteria,
in order of creation date. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to use in a subsequent
request. If empty, this is the final response.
For more information,
see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "loyalty_accounts": [ - { - "balance": 10, - "created_at": "2020-05-08T21:44:32Z", - "customer_id": "Q8002FAM9V1EZ0ADB2T5609X6NET1H0", - "id": "79b807d2-d786-46a9-933b-918028d7a8c5", - "lifetime_points": 20, - "mapping": { - "created_at": "2020-05-08T21:44:32Z", - "id": "66aaab3f-da99-49ed-8b19-b87f851c844f", - "phone_number": "+14155551234" - }, - "program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "updated_at": "2020-05-08T21:44:32Z", - "enrolled_at": "enrolled_at4" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor8" -} -``` - diff --git a/doc/models/search-loyalty-events-request.md b/doc/models/search-loyalty-events-request.md deleted file mode 100644 index 591c3065a..000000000 --- a/doc/models/search-loyalty-events-request.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Search Loyalty Events Request - -A request to search for loyalty events. - -## Structure - -`SearchLoyaltyEventsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`LoyaltyEventQuery \| undefined`](../../doc/models/loyalty-event-query.md) | Optional | Represents a query used to search for loyalty events. | -| `limit` | `number \| undefined` | Optional | The maximum number of results to include in the response.
The last page might contain fewer events.
The default is 30 events.
**Constraints**: `>= 1`, `<= 30` | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "limit": 30, - "query": { - "filter": { - "order_filter": { - "order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY" - }, - "loyalty_account_filter": { - "loyalty_account_id": "loyalty_account_id8" - }, - "type_filter": { - "types": [ - "ACCUMULATE_PROMOTION_POINTS", - "ACCUMULATE_POINTS", - "CREATE_REWARD" - ] - }, - "date_time_filter": { - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "location_filter": { - "location_ids": [ - "location_ids0", - "location_ids1", - "location_ids2" - ] - } - } - }, - "cursor": "cursor8" -} -``` - diff --git a/doc/models/search-loyalty-events-response.md b/doc/models/search-loyalty-events-response.md deleted file mode 100644 index 97d48339a..000000000 --- a/doc/models/search-loyalty-events-response.md +++ /dev/null @@ -1,146 +0,0 @@ - -# Search Loyalty Events Response - -A response that contains loyalty events that satisfy the search -criteria, in order by the `created_at` date. - -## Structure - -`SearchLoyaltyEventsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `events` | [`LoyaltyEvent[] \| undefined`](../../doc/models/loyalty-event.md) | Optional | The loyalty events that satisfy the search criteria. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent
request. If empty, this is the final response.
For more information,
see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "events": [ - { - "accumulate_points": { - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY", - "points": 5 - }, - "created_at": "2020-05-08T22:01:30Z", - "id": "c27c8465-806e-36f2-b4b3-71f5887b5ba8", - "location_id": "P034NEENMD09F", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "source": "LOYALTY_API", - "type": "ACCUMULATE_POINTS", - "create_reward": { - "loyalty_program_id": "loyalty_program_id2", - "reward_id": "reward_id6", - "points": 90 - }, - "redeem_reward": { - "loyalty_program_id": "loyalty_program_id8", - "reward_id": "reward_id2", - "order_id": "order_id8" - }, - "delete_reward": { - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 104 - }, - "adjust_points": { - "loyalty_program_id": "loyalty_program_id2", - "points": 96, - "reason": "reason2" - } - }, - { - "created_at": "2020-05-08T22:01:15Z", - "id": "e4a5cbc3-a4d0-3779-98e9-e578885d9430", - "location_id": "P034NEENMD09F", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "redeem_reward": { - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY", - "reward_id": "d03f79f4-815f-3500-b851-cc1e68a457f9" - }, - "source": "LOYALTY_API", - "type": "REDEEM_REWARD", - "accumulate_points": { - "loyalty_program_id": "loyalty_program_id8", - "points": 118, - "order_id": "order_id8" - }, - "create_reward": { - "loyalty_program_id": "loyalty_program_id2", - "reward_id": "reward_id6", - "points": 90 - }, - "delete_reward": { - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 104 - }, - "adjust_points": { - "loyalty_program_id": "loyalty_program_id2", - "points": 96, - "reason": "reason2" - } - }, - { - "create_reward": { - "loyalty_program_id": "d619f755-2d17-41f3-990d-c04ecedd64dd", - "points": -10, - "reward_id": "d03f79f4-815f-3500-b851-cc1e68a457f9" - }, - "created_at": "2020-05-08T22:00:44Z", - "id": "5e127479-0b03-3671-ab1e-15faea8b7188", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "source": "LOYALTY_API", - "type": "CREATE_REWARD", - "accumulate_points": { - "loyalty_program_id": "loyalty_program_id8", - "points": 118, - "order_id": "order_id8" - }, - "redeem_reward": { - "loyalty_program_id": "loyalty_program_id8", - "reward_id": "reward_id2", - "order_id": "order_id8" - }, - "delete_reward": { - "loyalty_program_id": "loyalty_program_id4", - "reward_id": "reward_id8", - "points": 104 - }, - "adjust_points": { - "loyalty_program_id": "loyalty_program_id2", - "points": 96, - "reason": "reason2" - } - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-loyalty-rewards-request-loyalty-reward-query.md b/doc/models/search-loyalty-rewards-request-loyalty-reward-query.md deleted file mode 100644 index b30960bbf..000000000 --- a/doc/models/search-loyalty-rewards-request-loyalty-reward-query.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Search Loyalty Rewards Request Loyalty Reward Query - -The set of search requirements. - -## Structure - -`SearchLoyaltyRewardsRequestLoyaltyRewardQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `loyaltyAccountId` | `string` | Required | The ID of the [loyalty account](entity:LoyaltyAccount) to which the loyalty reward belongs.
**Constraints**: *Minimum Length*: `1` | -| `status` | [`string \| undefined`](../../doc/models/loyalty-reward-status.md) | Optional | The status of the loyalty reward. | - -## Example (as JSON) - -```json -{ - "loyalty_account_id": "loyalty_account_id2", - "status": "DELETED" -} -``` - diff --git a/doc/models/search-loyalty-rewards-request.md b/doc/models/search-loyalty-rewards-request.md deleted file mode 100644 index 08e50c0cd..000000000 --- a/doc/models/search-loyalty-rewards-request.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Search Loyalty Rewards Request - -A request to search for loyalty rewards. - -## Structure - -`SearchLoyaltyRewardsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`SearchLoyaltyRewardsRequestLoyaltyRewardQuery \| undefined`](../../doc/models/search-loyalty-rewards-request-loyalty-reward-query.md) | Optional | The set of search requirements. | -| `limit` | `number \| undefined` | Optional | The maximum number of results to return in the response. The default value is 30.
**Constraints**: `>= 1`, `<= 30` | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to
this endpoint. Provide this to retrieve the next set of
results for the original query.
For more information,
see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "limit": 10, - "query": { - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "status": "ISSUED" - }, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-loyalty-rewards-response.md b/doc/models/search-loyalty-rewards-response.md deleted file mode 100644 index a9a442054..000000000 --- a/doc/models/search-loyalty-rewards-response.md +++ /dev/null @@ -1,89 +0,0 @@ - -# Search Loyalty Rewards Response - -A response that includes the loyalty rewards satisfying the search criteria. - -## Structure - -`SearchLoyaltyRewardsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `rewards` | [`LoyaltyReward[] \| undefined`](../../doc/models/loyalty-reward.md) | Optional | The loyalty rewards that satisfy the search criteria.
These are returned in descending order by `updated_at`. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent
request. If empty, this is the final response. | - -## Example (as JSON) - -```json -{ - "rewards": [ - { - "created_at": "2020-05-08T22:00:44Z", - "id": "d03f79f4-815f-3500-b851-cc1e68a457f9", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "order_id": "PyATxhYLfsMqpVkcKJITPydgEYfZY", - "points": 10, - "redeemed_at": "2020-05-08T22:01:17Z", - "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "status": "REDEEMED", - "updated_at": "2020-05-08T22:01:17Z" - }, - { - "created_at": "2020-05-08T21:55:42Z", - "id": "9f18ac21-233a-31c3-be77-b45840f5a810", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "points": 10, - "redeemed_at": "2020-05-08T21:56:00Z", - "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "status": "REDEEMED", - "updated_at": "2020-05-08T21:56:00Z", - "order_id": "order_id4" - }, - { - "created_at": "2020-05-01T21:49:54Z", - "id": "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "order_id": "5NB69ZNh3FbsOs1ox43bh1xrli6YY", - "points": 10, - "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "status": "DELETED", - "updated_at": "2020-05-08T21:55:10Z" - }, - { - "created_at": "2020-05-01T20:20:37Z", - "id": "a051254c-f840-3b45-8cf1-50bcd38ff92a", - "loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", - "order_id": "LQQ16znvi2VIUKPVhUfJefzr1eEZY", - "points": 10, - "reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f", - "status": "ISSUED", - "updated_at": "2020-05-01T20:20:40Z" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-orders-customer-filter.md b/doc/models/search-orders-customer-filter.md deleted file mode 100644 index b773e6e65..000000000 --- a/doc/models/search-orders-customer-filter.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Search Orders Customer Filter - -A filter based on the order `customer_id` and any tender `customer_id` -associated with the order. It does not filter based on the -[FulfillmentRecipient](../../doc/models/fulfillment-recipient.md) `customer_id`. - -## Structure - -`SearchOrdersCustomerFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerIds` | `string[] \| null \| undefined` | Optional | A list of customer IDs to filter by.

Max: 10 customer ids. | - -## Example (as JSON) - -```json -{ - "customer_ids": [ - "customer_ids9", - "customer_ids0", - "customer_ids1" - ] -} -``` - diff --git a/doc/models/search-orders-date-time-filter.md b/doc/models/search-orders-date-time-filter.md deleted file mode 100644 index a5bc34881..000000000 --- a/doc/models/search-orders-date-time-filter.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Search Orders Date Time Filter - -Filter for `Order` objects based on whether their `CREATED_AT`, -`CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range. -You can specify the time range and which timestamp to filter for. You can filter -for only one time range at a time. - -For each time range, the start time and end time are inclusive. If the end time -is absent, it defaults to the time of the first request for the cursor. - -__Important:__ If you use the `DateTimeFilter` in a `SearchOrders` query, -you must set the `sort_field` in [OrdersSort](../../doc/models/search-orders-sort.md) -to the same field you filter for. For example, if you set the `CLOSED_AT` field -in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to -`CLOSED_AT`. Otherwise, `SearchOrders` throws an error. -[Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) - -## Structure - -`SearchOrdersDateTimeFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `createdAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `updatedAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `closedAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | - -## Example (as JSON) - -```json -{ - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "closed_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } -} -``` - diff --git a/doc/models/search-orders-filter.md b/doc/models/search-orders-filter.md deleted file mode 100644 index 58a8462a1..000000000 --- a/doc/models/search-orders-filter.md +++ /dev/null @@ -1,67 +0,0 @@ - -# Search Orders Filter - -Filtering criteria to use for a `SearchOrders` request. Multiple filters -are ANDed together. - -## Structure - -`SearchOrdersFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `stateFilter` | [`SearchOrdersStateFilter \| undefined`](../../doc/models/search-orders-state-filter.md) | Optional | Filter by the current order `state`. | -| `dateTimeFilter` | [`SearchOrdersDateTimeFilter \| undefined`](../../doc/models/search-orders-date-time-filter.md) | Optional | Filter for `Order` objects based on whether their `CREATED_AT`,
`CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range.
You can specify the time range and which timestamp to filter for. You can filter
for only one time range at a time.

For each time range, the start time and end time are inclusive. If the end time
is absent, it defaults to the time of the first request for the cursor.

__Important:__ If you use the `DateTimeFilter` in a `SearchOrders` query,
you must set the `sort_field` in [OrdersSort](../../doc/models/search-orders-sort.md)
to the same field you filter for. For example, if you set the `CLOSED_AT` field
in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to
`CLOSED_AT`. Otherwise, `SearchOrders` throws an error.
[Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) | -| `fulfillmentFilter` | [`SearchOrdersFulfillmentFilter \| undefined`](../../doc/models/search-orders-fulfillment-filter.md) | Optional | Filter based on [order fulfillment](../../doc/models/fulfillment.md) information. | -| `sourceFilter` | [`SearchOrdersSourceFilter \| undefined`](../../doc/models/search-orders-source-filter.md) | Optional | A filter based on order `source` information. | -| `customerFilter` | [`SearchOrdersCustomerFilter \| undefined`](../../doc/models/search-orders-customer-filter.md) | Optional | A filter based on the order `customer_id` and any tender `customer_id`
associated with the order. It does not filter based on the
[FulfillmentRecipient](../../doc/models/fulfillment-recipient.md) `customer_id`. | - -## Example (as JSON) - -```json -{ - "state_filter": { - "states": [ - "CANCELED", - "DRAFT" - ] - }, - "date_time_filter": { - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "closed_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "fulfillment_filter": { - "fulfillment_types": [ - "DELIVERY" - ], - "fulfillment_states": [ - "CANCELED", - "FAILED" - ] - }, - "source_filter": { - "source_names": [ - "source_names6" - ] - }, - "customer_filter": { - "customer_ids": [ - "customer_ids3", - "customer_ids4" - ] - } -} -``` - diff --git a/doc/models/search-orders-fulfillment-filter.md b/doc/models/search-orders-fulfillment-filter.md deleted file mode 100644 index 739f9ae70..000000000 --- a/doc/models/search-orders-fulfillment-filter.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Search Orders Fulfillment Filter - -Filter based on [order fulfillment](../../doc/models/fulfillment.md) information. - -## Structure - -`SearchOrdersFulfillmentFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `fulfillmentTypes` | [`string[] \| null \| undefined`](../../doc/models/fulfillment-type.md) | Optional | A list of [fulfillment types](entity:FulfillmentType) to filter
for. The list returns orders if any of its fulfillments match any of the fulfillment types
listed in this field.
See [FulfillmentType](#type-fulfillmenttype) for possible values | -| `fulfillmentStates` | [`string[] \| null \| undefined`](../../doc/models/fulfillment-state.md) | Optional | A list of [fulfillment states](entity:FulfillmentState) to filter
for. The list returns orders if any of its fulfillments match any of the
fulfillment states listed in this field.
See [FulfillmentState](#type-fulfillmentstate) for possible values | - -## Example (as JSON) - -```json -{ - "fulfillment_types": [ - "PICKUP", - "SHIPMENT" - ], - "fulfillment_states": [ - "PROPOSED" - ] -} -``` - diff --git a/doc/models/search-orders-query.md b/doc/models/search-orders-query.md deleted file mode 100644 index 84e5ede74..000000000 --- a/doc/models/search-orders-query.md +++ /dev/null @@ -1,69 +0,0 @@ - -# Search Orders Query - -Contains query criteria for the search. - -## Structure - -`SearchOrdersQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`SearchOrdersFilter \| undefined`](../../doc/models/search-orders-filter.md) | Optional | Filtering criteria to use for a `SearchOrders` request. Multiple filters
are ANDed together. | -| `sort` | [`SearchOrdersSort \| undefined`](../../doc/models/search-orders-sort.md) | Optional | Sorting criteria for a `SearchOrders` request. Results can only be sorted
by a timestamp field. | - -## Example (as JSON) - -```json -{ - "filter": { - "state_filter": { - "states": [ - "CANCELED", - "DRAFT" - ] - }, - "date_time_filter": { - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "closed_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "fulfillment_filter": { - "fulfillment_types": [ - "DELIVERY" - ], - "fulfillment_states": [ - "CANCELED", - "FAILED" - ] - }, - "source_filter": { - "source_names": [ - "source_names6" - ] - }, - "customer_filter": { - "customer_ids": [ - "customer_ids3", - "customer_ids4" - ] - } - }, - "sort": { - "sort_field": "UPDATED_AT", - "sort_order": "DESC" - } -} -``` - diff --git a/doc/models/search-orders-request.md b/doc/models/search-orders-request.md deleted file mode 100644 index 596703e77..000000000 --- a/doc/models/search-orders-request.md +++ /dev/null @@ -1,78 +0,0 @@ - -# Search Orders Request - -## Structure - -`SearchOrdersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationIds` | `string[] \| undefined` | Optional | The location IDs for the orders to query. All locations must belong to
the same merchant.

Max: 10 location IDs. | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for your original query.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `query` | [`SearchOrdersQuery \| undefined`](../../doc/models/search-orders-query.md) | Optional | Contains query criteria for the search. | -| `limit` | `number \| undefined` | Optional | The maximum number of results to be returned in a single page.

Default: `500`
Max: `1000` | -| `returnEntries` | `boolean \| undefined` | Optional | A Boolean that controls the format of the search results. If `true`,
`SearchOrders` returns [OrderEntry](entity:OrderEntry) objects. If `false`, `SearchOrders`
returns complete order objects.

Default: `false`. | - -## Example (as JSON) - -```json -{ - "limit": 3, - "location_ids": [ - "057P5VYJ4A5X1", - "18YC4JDH91E1H" - ], - "query": { - "filter": { - "date_time_filter": { - "closed_at": { - "end_at": "2019-03-04T21:54:45+00:00", - "start_at": "2018-03-03T20:00:00+00:00" - }, - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "updated_at": { - "start_at": "start_at6", - "end_at": "end_at6" - } - }, - "state_filter": { - "states": [ - "COMPLETED" - ] - }, - "fulfillment_filter": { - "fulfillment_types": [ - "DELIVERY" - ], - "fulfillment_states": [ - "CANCELED", - "FAILED" - ] - }, - "source_filter": { - "source_names": [ - "source_names6" - ] - }, - "customer_filter": { - "customer_ids": [ - "customer_ids3", - "customer_ids4" - ] - } - }, - "sort": { - "sort_field": "CLOSED_AT", - "sort_order": "DESC" - } - }, - "return_entries": true, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-orders-response.md b/doc/models/search-orders-response.md deleted file mode 100644 index 1d69bd2ba..000000000 --- a/doc/models/search-orders-response.md +++ /dev/null @@ -1,225 +0,0 @@ - -# Search Orders Response - -Either the `order_entries` or `orders` field is set, depending on whether -`return_entries` is set on the [SearchOrdersRequest](../../doc/api/orders.md#search-orders). - -## Structure - -`SearchOrdersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `orderEntries` | [`OrderEntry[] \| undefined`](../../doc/models/order-entry.md) | Optional | A list of [OrderEntries](entity:OrderEntry) that fit the query
conditions. The list is populated only if `return_entries` is set to `true` in the request. | -| `orders` | [`Order[] \| undefined`](../../doc/models/order.md) | Optional | A list of
[Order](entity:Order) objects that match the query conditions. The list is populated only if
`return_entries` is set to `false` in the request. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.
For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | [Errors](entity:Error) encountered during the search. | - -## Example (as JSON) - -```json -{ - "cursor": "123", - "order_entries": [ - { - "location_id": "057P5VYJ4A5X1", - "order_id": "CAISEM82RcpmcFBM0TfOyiHV3es", - "version": 1 - }, - { - "location_id": "18YC4JDH91E1H", - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "version": 182 - }, - { - "location_id": "057P5VYJ4A5X1", - "order_id": "CAISEM52YcpmcWAzERDOyiWS3ty", - "version": 182 - } - ], - "orders": [ - { - "id": "id2", - "location_id": "location_id6", - "reference_id": "reference_id0", - "source": { - "name": "name4" - }, - "customer_id": "customer_id0", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] - }, - { - "id": "id2", - "location_id": "location_id6", - "reference_id": "reference_id0", - "source": { - "name": "name4" - }, - "customer_id": "customer_id0", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] - }, - { - "id": "id2", - "location_id": "location_id6", - "reference_id": "reference_id0", - "source": { - "name": "name4" - }, - "customer_id": "customer_id0", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/search-orders-sort-field.md b/doc/models/search-orders-sort-field.md deleted file mode 100644 index 6c556a9d6..000000000 --- a/doc/models/search-orders-sort-field.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Search Orders Sort Field - -Specifies which timestamp to use to sort `SearchOrder` results. - -## Enumeration - -`SearchOrdersSortField` - -## Fields - -| Name | Description | -| --- | --- | -| `CREATED_AT` | The time when the order was created, in RFC-3339 format. If you are also
filtering for a time range in this query, you must set the `CREATED_AT`
field in your `DateTimeFilter`. | -| `UPDATED_AT` | The time when the order last updated, in RFC-3339 format. If you are also
filtering for a time range in this query, you must set the `UPDATED_AT`
field in your `DateTimeFilter`. | -| `CLOSED_AT` | The time when the order was closed, in RFC-3339 format. If you use this
value, you must also set a `StateFilter` with closed states. If you are also
filtering for a time range in this query, you must set the `CLOSED_AT`
field in your `DateTimeFilter`. | - diff --git a/doc/models/search-orders-sort.md b/doc/models/search-orders-sort.md deleted file mode 100644 index 77120ea24..000000000 --- a/doc/models/search-orders-sort.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Search Orders Sort - -Sorting criteria for a `SearchOrders` request. Results can only be sorted -by a timestamp field. - -## Structure - -`SearchOrdersSort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sortField` | [`string`](../../doc/models/search-orders-sort-field.md) | Required | Specifies which timestamp to use to sort `SearchOrder` results. | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "sort_field": "CREATED_AT", - "sort_order": "DESC" -} -``` - diff --git a/doc/models/search-orders-source-filter.md b/doc/models/search-orders-source-filter.md deleted file mode 100644 index afcebddcb..000000000 --- a/doc/models/search-orders-source-filter.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Search Orders Source Filter - -A filter based on order `source` information. - -## Structure - -`SearchOrdersSourceFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sourceNames` | `string[] \| null \| undefined` | Optional | Filters by the [Source](entity:OrderSource) `name`. The filter returns any orders
with a `source.name` that matches any of the listed source names.

Max: 10 source names. | - -## Example (as JSON) - -```json -{ - "source_names": [ - "source_names4", - "source_names5", - "source_names6" - ] -} -``` - diff --git a/doc/models/search-orders-state-filter.md b/doc/models/search-orders-state-filter.md deleted file mode 100644 index f09e9b1b4..000000000 --- a/doc/models/search-orders-state-filter.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Search Orders State Filter - -Filter by the current order `state`. - -## Structure - -`SearchOrdersStateFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `states` | [`string[]`](../../doc/models/order-state.md) | Required | States to filter for.
See [OrderState](#type-orderstate) for possible values | - -## Example (as JSON) - -```json -{ - "states": [ - "CANCELED", - "DRAFT", - "OPEN" - ] -} -``` - diff --git a/doc/models/search-shifts-request.md b/doc/models/search-shifts-request.md deleted file mode 100644 index ced630167..000000000 --- a/doc/models/search-shifts-request.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Search Shifts Request - -A request for a filtered and sorted set of `Shift` objects. - -## Structure - -`SearchShiftsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`ShiftQuery \| undefined`](../../doc/models/shift-query.md) | Optional | The parameters of a `Shift` search query, which includes filter and sort options. | -| `limit` | `number \| undefined` | Optional | The number of resources in a page (200 by default).
**Constraints**: `>= 1`, `<= 200` | -| `cursor` | `string \| undefined` | Optional | An opaque cursor for fetching the next page. | - -## Example (as JSON) - -```json -{ - "limit": 100, - "query": { - "filter": { - "workday": { - "date_range": { - "end_date": "2019-02-03", - "start_date": "2019-01-20" - }, - "default_timezone": "America/Los_Angeles", - "match_shifts_by": "START_AT" - }, - "location_ids": [ - "location_ids4" - ], - "employee_ids": [ - "employee_ids9" - ], - "status": "OPEN", - "start": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "end": { - "start_at": "start_at0", - "end_at": "end_at2" - } - }, - "sort": { - "field": "START_AT", - "order": "DESC" - } - }, - "cursor": "cursor2" -} -``` - diff --git a/doc/models/search-shifts-response.md b/doc/models/search-shifts-response.md deleted file mode 100644 index fb0ae9220..000000000 --- a/doc/models/search-shifts-response.md +++ /dev/null @@ -1,120 +0,0 @@ - -# Search Shifts Response - -The response to a request for `Shift` objects. The response contains -the requested `Shift` objects and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`SearchShiftsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `shifts` | [`Shift[] \| undefined`](../../doc/models/shift.md) | Optional | Shifts. | -| `cursor` | `string \| undefined` | Optional | An opaque cursor for fetching the next page. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "shifts": [ - { - "breaks": [ - { - "break_type_id": "REGS1EQR1TPZ5", - "end_at": "2019-01-21T06:11:00-05:00", - "expected_duration": "PT10M", - "id": "SJW7X6AKEJQ65", - "is_paid": true, - "name": "Tea Break", - "start_at": "2019-01-21T06:11:00-05:00" - } - ], - "created_at": "2019-01-24T01:12:03Z", - "declared_cash_tip_money": { - "amount": 500, - "currency": "USD" - }, - "employee_id": "ormj0jJJZ5OZIzxrZYJI", - "end_at": "2019-01-21T13:11:00-05:00", - "id": "X714F3HA6D1PT", - "location_id": "PAA1RJZZKXBFG", - "start_at": "2019-01-21T03:11:00-05:00", - "status": "CLOSED", - "team_member_id": "ormj0jJJZ5OZIzxrZYJI", - "timezone": "America/New_York", - "updated_at": "2019-02-07T22:21:08Z", - "version": 6, - "wage": { - "hourly_rate": { - "amount": 1100, - "currency": "USD" - }, - "job_id": "FzbJAtt9qEWncK1BWgVCxQ6M", - "tip_eligible": true, - "title": "Barista" - } - }, - { - "breaks": [ - { - "break_type_id": "WQX00VR99F53J", - "end_at": "2019-01-23T14:40:00-05:00", - "expected_duration": "PT10M", - "id": "BKS6VR7WR748A", - "is_paid": true, - "name": "Tea Break", - "start_at": "2019-01-23T14:30:00-05:00" - }, - { - "break_type_id": "P6Q468ZFRN1AC", - "end_at": "2019-01-22T12:44:00-05:00", - "expected_duration": "PT15M", - "id": "BQFEZSHFZSC51", - "is_paid": false, - "name": "Coffee Break", - "start_at": "2019-01-22T12:30:00-05:00" - } - ], - "created_at": "2019-01-23T23:32:45Z", - "declared_cash_tip_money": { - "amount": 0, - "currency": "USD" - }, - "employee_id": "33fJchumvVdJwxV0H6L9", - "end_at": "2019-01-22T13:02:00-05:00", - "id": "GDHYBZYWK0P2V", - "location_id": "PAA1RJZZKXBFG", - "start_at": "2019-01-22T12:02:00-05:00", - "status": "CLOSED", - "team_member_id": "33fJchumvVdJwxV0H6L9", - "timezone": "America/New_York", - "updated_at": "2019-01-24T00:56:25Z", - "version": 16, - "wage": { - "hourly_rate": { - "amount": 1600, - "currency": "USD" - }, - "job_id": "gcbz15vKGnMKmaWJJ152kjim", - "tip_eligible": true, - "title": "Cook" - } - } - ], - "cursor": "cursor8", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/search-subscriptions-filter.md b/doc/models/search-subscriptions-filter.md deleted file mode 100644 index b35246094..000000000 --- a/doc/models/search-subscriptions-filter.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Search Subscriptions Filter - -Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by -the [SearchSubscriptions](../../doc/api/subscriptions.md#search-subscriptions) endpoint. - -## Structure - -`SearchSubscriptionsFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerIds` | `string[] \| null \| undefined` | Optional | A filter to select subscriptions based on the subscribing customer IDs. | -| `locationIds` | `string[] \| null \| undefined` | Optional | A filter to select subscriptions based on the location. | -| `sourceNames` | `string[] \| null \| undefined` | Optional | A filter to select subscriptions based on the source application. | - -## Example (as JSON) - -```json -{ - "customer_ids": [ - "customer_ids1", - "customer_ids2" - ], - "location_ids": [ - "location_ids4", - "location_ids5", - "location_ids6" - ], - "source_names": [ - "source_names2", - "source_names3", - "source_names4" - ] -} -``` - diff --git a/doc/models/search-subscriptions-query.md b/doc/models/search-subscriptions-query.md deleted file mode 100644 index 61d043fb3..000000000 --- a/doc/models/search-subscriptions-query.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Search Subscriptions Query - -Represents a query, consisting of specified query expressions, used to search for subscriptions. - -## Structure - -`SearchSubscriptionsQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`SearchSubscriptionsFilter \| undefined`](../../doc/models/search-subscriptions-filter.md) | Optional | Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by
the [SearchSubscriptions](../../doc/api/subscriptions.md#search-subscriptions) endpoint. | - -## Example (as JSON) - -```json -{ - "filter": { - "customer_ids": [ - "customer_ids3", - "customer_ids2" - ], - "location_ids": [ - "location_ids4" - ], - "source_names": [ - "source_names2" - ] - } -} -``` - diff --git a/doc/models/search-subscriptions-request.md b/doc/models/search-subscriptions-request.md deleted file mode 100644 index 15a8cb24e..000000000 --- a/doc/models/search-subscriptions-request.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Search Subscriptions Request - -Defines input parameters in a request to the -[SearchSubscriptions](../../doc/api/subscriptions.md#search-subscriptions) endpoint. - -## Structure - -`SearchSubscriptionsRequest` - -## Fields - -| 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/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. | - -## Example (as JSON) - -```json -{ - "query": { - "filter": { - "customer_ids": [ - "CHFGVKYY8RSV93M5KCYTG4PN0G" - ], - "location_ids": [ - "S8GWD5R9QB376" - ], - "source_names": [ - "My App" - ] - } - }, - "cursor": "cursor6", - "limit": 230, - "include": [ - "include8" - ] -} -``` - diff --git a/doc/models/search-subscriptions-response.md b/doc/models/search-subscriptions-response.md deleted file mode 100644 index 7280d508d..000000000 --- a/doc/models/search-subscriptions-response.md +++ /dev/null @@ -1,100 +0,0 @@ - -# Search Subscriptions Response - -Defines output parameters in a response from the -[SearchSubscriptions](../../doc/api/subscriptions.md#search-subscriptions) endpoint. - -## Structure - -`SearchSubscriptionsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `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/build-basics/common-api-patterns/pagination). | - -## Example (as JSON) - -```json -{ - "subscriptions": [ - { - "canceled_date": "2021-10-30", - "card_id": "ccof:mueUsvgajChmjEbp4GB", - "charged_through_date": "2021-11-20", - "created_at": "2021-10-20T21:53:10Z", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "id": "de86fc96-8664-474b-af1a-abbe59cacf0e", - "location_id": "S8GWD5R9QB376", - "paid_until_date": "2021-11-20", - "plan_variation_id": "L3TJVDHVBEQEGQDEZL2JJM7R", - "source": { - "name": "My Application" - }, - "start_date": "2021-10-20", - "status": "CANCELED", - "timezone": "UTC" - }, - { - "charged_through_date": "2022-08-19", - "created_at": "2022-01-19T21:53:10Z", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "id": "56214fb2-cc85-47a1-93bc-44f3766bb56f", - "invoice_ids": [ - "grebK0Q_l8H4fqoMMVvt-Q", - "rcX_i3sNmHTGKhI4W2mceA" - ], - "location_id": "S8GWD5R9QB376", - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "price_override_money": { - "amount": 1000, - "currency": "USD" - }, - "source": { - "name": "My Application" - }, - "start_date": "2022-01-19", - "status": "PAUSED", - "tax_percentage": "5", - "timezone": "America/Los_Angeles", - "version": 2 - }, - { - "card_id": "ccof:qy5x8hHGYsgLrp4Q4GB", - "created_at": "2023-06-20T21:53:10Z", - "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", - "id": "56214fb2-cc85-47a1-93bc-44f3766bb56f", - "location_id": "S8GWD5R9QB376", - "phases": [ - { - "order_template_id": "U2NaowWxzXwpsZU697x7ZHOAnCNZY", - "ordinal": 0, - "plan_phase_uid": "X2Q2AONPB3RB64Y27S25QCZP", - "uid": "873451e0-745b-4e87-ab0b-c574933fe616" - } - ], - "plan_variation_id": "6JHXF3B2CW3YKHDV4XEM674H", - "source": { - "name": "My Application" - }, - "start_date": "2023-06-20", - "status": "ACTIVE", - "timezone": "America/Los_Angeles", - "version": 1 - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor2" -} -``` - diff --git a/doc/models/search-team-members-filter.md b/doc/models/search-team-members-filter.md deleted file mode 100644 index 4f504fe2a..000000000 --- a/doc/models/search-team-members-filter.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Search Team Members Filter - -Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied -between the individual fields, and `OR` logic is applied within list-based fields. -For example, setting this filter value: - -``` -filter = (locations_ids = ["A", "B"], status = ACTIVE) -``` - -returns only active team members assigned to either location "A" or "B". - -## Structure - -`SearchTeamMembersFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationIds` | `string[] \| null \| undefined` | Optional | When present, filters by team members assigned to the specified locations.
When empty, includes team members assigned to any location. | -| `status` | [`string \| undefined`](../../doc/models/team-member-status.md) | Optional | Enumerates the possible statuses the team member can have within a business. | -| `isOwner` | `boolean \| null \| undefined` | Optional | When present and set to true, returns the team member who is the owner of the Square account. | - -## Example (as JSON) - -```json -{ - "location_ids": [ - "location_ids6" - ], - "status": "ACTIVE", - "is_owner": false -} -``` - diff --git a/doc/models/search-team-members-query.md b/doc/models/search-team-members-query.md deleted file mode 100644 index 29b6f4507..000000000 --- a/doc/models/search-team-members-query.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Search Team Members Query - -Represents the parameters in a search for `TeamMember` objects. - -## Structure - -`SearchTeamMembersQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`SearchTeamMembersFilter \| undefined`](../../doc/models/search-team-members-filter.md) | Optional | Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied
between the individual fields, and `OR` logic is applied within list-based fields.
For example, setting this filter value:

```
filter = (locations_ids = ["A", "B"], status = ACTIVE)
```

returns only active team members assigned to either location "A" or "B". | - -## Example (as JSON) - -```json -{ - "filter": { - "location_ids": [ - "location_ids4" - ], - "status": "ACTIVE", - "is_owner": false - } -} -``` - diff --git a/doc/models/search-team-members-request.md b/doc/models/search-team-members-request.md deleted file mode 100644 index 8fda961f8..000000000 --- a/doc/models/search-team-members-request.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Search Team Members Request - -Represents a search request for a filtered list of `TeamMember` objects. - -## Structure - -`SearchTeamMembersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`SearchTeamMembersQuery \| undefined`](../../doc/models/search-team-members-query.md) | Optional | Represents the parameters in a search for `TeamMember` objects. | -| `limit` | `number \| undefined` | Optional | The maximum number of `TeamMember` objects in a page (100 by default).
**Constraints**: `>= 1`, `<= 200` | -| `cursor` | `string \| undefined` | Optional | The opaque cursor for fetching the next page. For more information, see
[pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | - -## Example (as JSON) - -```json -{ - "limit": 10, - "query": { - "filter": { - "location_ids": [ - "0G5P3VGACMMQZ" - ], - "status": "ACTIVE", - "is_owner": false - } - }, - "cursor": "cursor8" -} -``` - diff --git a/doc/models/search-team-members-response.md b/doc/models/search-team-members-response.md deleted file mode 100644 index 85aeabeca..000000000 --- a/doc/models/search-team-members-response.md +++ /dev/null @@ -1,284 +0,0 @@ - -# Search Team Members Response - -Represents a response from a search request containing a filtered list of `TeamMember` objects. - -## Structure - -`SearchTeamMembersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMembers` | [`TeamMember[] \| undefined`](../../doc/models/team-member.md) | Optional | The filtered list of `TeamMember` objects. | -| `cursor` | `string \| undefined` | Optional | The opaque cursor for fetching the next page. For more information, see
[pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "cursor": "N:9UglUjOXQ13-hMFypCft", - "team_members": [ - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2019-07-10T17:26:48Z", - "email_address": "johnny_cash@squareup.com", - "family_name": "Cash", - "given_name": "Johnny", - "id": "-3oZQKPKVk6gUXU_V5Qa", - "is_owner": false, - "reference_id": "12345678", - "status": "ACTIVE", - "updated_at": "2020-04-28T21:49:28Z", - "wage_setting": { - "created_at": "2021-06-11T22:55:45Z", - "is_overtime_exempt": true, - "job_assignments": [ - { - "annual_rate": { - "amount": 3000000, - "currency": "USD" - }, - "hourly_rate": { - "amount": 1443, - "currency": "USD" - }, - "job_id": "FjS8x95cqHiMenw4f1NAUH4P", - "job_title": "Manager", - "pay_type": "SALARY", - "weekly_hours": 40 - }, - { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "job_title": "Cashier", - "pay_type": "HOURLY" - } - ], - "team_member_id": "-3oZQKPKVk6gUXU_V5Qa", - "updated_at": "2021-06-11T22:55:45Z", - "version": 1 - } - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T18:14:01Z", - "family_name": "Smith", - "given_name": "Lombard", - "id": "1AVJj0DjkzbmbJw5r4KK", - "is_owner": false, - "phone_number": "+14155552671", - "reference_id": "abcded", - "status": "ACTIVE", - "updated_at": "2020-06-09T17:38:05Z", - "wage_setting": { - "created_at": "2020-03-24T18:14:01Z", - "is_overtime_exempt": true, - "job_assignments": [ - { - "hourly_rate": { - "amount": 2400, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "job_title": "Cashier", - "pay_type": "HOURLY" - } - ], - "team_member_id": "1AVJj0DjkzbmbJw5r4KK", - "updated_at": "2020-06-09T17:38:05Z", - "version": 2 - } - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T01:09:25Z", - "family_name": "Sway", - "given_name": "Monica", - "id": "2JCmiJol_KKFs9z2Evim", - "is_owner": false, - "status": "ACTIVE", - "updated_at": "2020-03-24T01:11:25Z", - "wage_setting": { - "created_at": "2020-03-24T01:09:25Z", - "is_overtime_exempt": true, - "job_assignments": [ - { - "hourly_rate": { - "amount": 2400, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "job_title": "Cashier", - "pay_type": "HOURLY" - } - ], - "team_member_id": "2JCmiJol_KKFs9z2Evim", - "updated_at": "2020-03-24T01:09:25Z", - "version": 1 - }, - "reference_id": "reference_id4" - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T01:09:23Z", - "family_name": "Ipsum", - "given_name": "Elton", - "id": "4uXcJQSLtbk3F0UQHFNQ", - "is_owner": false, - "status": "ACTIVE", - "updated_at": "2020-03-24T01:15:23Z", - "reference_id": "reference_id4" - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T01:09:23Z", - "family_name": "Lo", - "given_name": "Steven", - "id": "5CoUpyrw1YwGWcRd-eDL", - "is_owner": false, - "status": "ACTIVE", - "updated_at": "2020-03-24T01:19:23Z", - "reference_id": "reference_id4" - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T18:14:03Z", - "family_name": "Steward", - "given_name": "Patrick", - "id": "5MRPTTp8MMBLVSmzrGha", - "is_owner": false, - "phone_number": "+14155552671", - "status": "ACTIVE", - "updated_at": "2020-03-24T18:18:03Z", - "wage_setting": { - "created_at": "2020-03-24T18:14:03Z", - "is_overtime_exempt": true, - "job_assignments": [ - { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "job_title": "Cashier", - "pay_type": "HOURLY" - } - ], - "team_member_id": "5MRPTTp8MMBLVSmzrGha", - "updated_at": "2020-03-24T18:14:03Z", - "version": 1 - }, - "reference_id": "reference_id4" - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T01:09:25Z", - "family_name": "Manny", - "given_name": "Ivy", - "id": "7F5ZxsfRnkexhu1PTbfh", - "is_owner": false, - "status": "ACTIVE", - "updated_at": "2020-03-24T01:09:25Z", - "reference_id": "reference_id4" - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T18:14:02Z", - "email_address": "john_smith@example.com", - "family_name": "Smith", - "given_name": "John", - "id": "808X9HR72yKvVaigQXf4", - "is_owner": false, - "phone_number": "+14155552671", - "status": "ACTIVE", - "updated_at": "2020-03-24T18:14:02Z", - "reference_id": "reference_id4" - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T18:14:00Z", - "email_address": "r_wen@example.com", - "family_name": "Wen", - "given_name": "Robert", - "id": "9MVDVoY4hazkWKGo_OuZ", - "is_owner": false, - "phone_number": "+14155552671", - "status": "ACTIVE", - "updated_at": "2020-03-24T18:14:00Z", - "reference_id": "reference_id4" - }, - { - "assigned_locations": { - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS" - }, - "created_at": "2020-03-24T18:14:00Z", - "email_address": "asimpson@example.com", - "family_name": "Simpson", - "given_name": "Ashley", - "id": "9UglUjOXQ13-hMFypCft", - "is_owner": false, - "phone_number": "+14155552671", - "status": "ACTIVE", - "updated_at": "2020-03-24T18:18:00Z", - "wage_setting": { - "created_at": "2020-03-24T18:14:00Z", - "is_overtime_exempt": true, - "job_assignments": [ - { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "job_title": "Cashier", - "pay_type": "HOURLY" - } - ], - "team_member_id": "9UglUjOXQ13-hMFypCft", - "updated_at": "2020-03-24T18:14:03Z", - "version": 1 - }, - "reference_id": "reference_id4" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/search-terminal-actions-request.md b/doc/models/search-terminal-actions-request.md deleted file mode 100644 index a955205c1..000000000 --- a/doc/models/search-terminal-actions-request.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Search Terminal Actions Request - -## Structure - -`SearchTerminalActionsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`TerminalActionQuery \| undefined`](../../doc/models/terminal-action-query.md) | Optional | - | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more
information. | -| `limit` | `number \| undefined` | Optional | Limit the number of results returned for a single request.
**Constraints**: `>= 1`, `<= 100` | - -## Example (as JSON) - -```json -{ - "limit": 2, - "query": { - "filter": { - "created_at": { - "start_at": "2022-04-01T00:00:00.000Z", - "end_at": "end_at8" - }, - "device_id": "device_id0", - "status": "status6", - "type": "SAVE_CARD" - }, - "sort": { - "sort_order": "DESC" - } - }, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-terminal-actions-response.md b/doc/models/search-terminal-actions-response.md deleted file mode 100644 index a2b849842..000000000 --- a/doc/models/search-terminal-actions-response.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Search Terminal Actions Response - -## Structure - -`SearchTerminalActionsResponse` - -## 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 | The requested search result of `TerminalAction`s. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty,
this is the final response.

See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more
information. | - -## Example (as JSON) - -```json -{ - "action": [ - { - "app_id": "APP_ID", - "created_at": "2022-04-08T15:14:04.895Z", - "deadline_duration": "PT5M", - "device_id": "DEVICE_ID", - "id": "termapia:oBGWlAats8xWCiCE", - "location_id": "LOCATION_ID", - "save_card_options": { - "customer_id": "CUSTOMER_ID", - "reference_id": "user-id-1" - }, - "status": "IN_PROGRESS", - "type": "SAVE_CARD", - "updated_at": "2022-04-08T15:14:05.446Z", - "cancel_reason": "TIMED_OUT" - }, - { - "app_id": "APP_ID", - "created_at": "2022-04-08T15:14:01.210Z", - "deadline_duration": "PT5M", - "device_id": "DEVICE_ID", - "id": "termapia:K2NY2YSSml3lTiCE", - "location_id": "LOCATION_ID", - "save_card_options": { - "card_id": "ccof:CARD_ID", - "customer_id": "CUSTOMER_ID", - "reference_id": "user-id-1" - }, - "status": "COMPLETED", - "type": "SAVE_CARD", - "updated_at": "2022-04-08T15:14:09.861Z", - "cancel_reason": "TIMED_OUT" - } - ], - "cursor": "CURSOR", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/search-terminal-checkouts-request.md b/doc/models/search-terminal-checkouts-request.md deleted file mode 100644 index 38b33f805..000000000 --- a/doc/models/search-terminal-checkouts-request.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Search Terminal Checkouts Request - -## Structure - -`SearchTerminalCheckoutsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`TerminalCheckoutQuery \| undefined`](../../doc/models/terminal-checkout-query.md) | Optional | - | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.
See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | -| `limit` | `number \| undefined` | Optional | Limits the number of results returned for a single request.
**Constraints**: `>= 1`, `<= 100` | - -## Example (as JSON) - -```json -{ - "limit": 2, - "query": { - "filter": { - "status": "COMPLETED", - "device_id": "device_id0", - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "sort": { - "sort_order": "DESC" - } - }, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-terminal-checkouts-response.md b/doc/models/search-terminal-checkouts-response.md deleted file mode 100644 index d4f439c6c..000000000 --- a/doc/models/search-terminal-checkouts-response.md +++ /dev/null @@ -1,123 +0,0 @@ - -# Search Terminal Checkouts Response - -## Structure - -`SearchTerminalCheckoutsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `checkouts` | [`TerminalCheckout[] \| undefined`](../../doc/models/terminal-checkout.md) | Optional | The requested search result of `TerminalCheckout` objects. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty,
this is the final response.

See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "checkouts": [ - { - "amount_money": { - "amount": 2610, - "currency": "USD" - }, - "app_id": "APP_ID", - "created_at": "2020-03-31T18:13:15.921Z", - "deadline_duration": "PT5M", - "device_options": { - "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", - "skip_receipt_screen": false, - "tip_settings": { - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "collect_signature": false, - "show_itemized_cart": false - }, - "id": "tsQPvzwBpMqqO", - "note": "A brief note", - "payment_ids": [ - "rXnhZzywrEk4vR6pw76fPZfgvaB" - ], - "reference_id": "id14467", - "status": "COMPLETED", - "updated_at": "2020-03-31T18:13:52.725Z", - "order_id": "order_id2", - "payment_options": { - "autocomplete": false, - "delay_duration": "delay_duration2", - "accept_partial_authorization": false, - "delay_action": "CANCEL" - } - }, - { - "amount_money": { - "amount": 2610, - "currency": "USD" - }, - "app_id": "APP_ID", - "created_at": "2020-03-31T18:08:31.882Z", - "deadline_duration": "PT5M", - "device_options": { - "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", - "skip_receipt_screen": true, - "tip_settings": { - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "collect_signature": false, - "show_itemized_cart": false - }, - "id": "XlOPTgcEhrbqO", - "note": "A brief note", - "payment_ids": [ - "VYBF861PaoKPP7Pih0TlbZiNvaB" - ], - "reference_id": "id41623", - "status": "COMPLETED", - "updated_at": "2020-03-31T18:08:41.635Z", - "order_id": "order_id2", - "payment_options": { - "autocomplete": false, - "delay_duration": "delay_duration2", - "accept_partial_authorization": false, - "delay_action": "CANCEL" - } - } - ], - "cursor": "RiTJqBoTuXlbLmmrPvEkX9iG7XnQ4W4RjGnH", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/search-terminal-refunds-request.md b/doc/models/search-terminal-refunds-request.md deleted file mode 100644 index 82c272bd0..000000000 --- a/doc/models/search-terminal-refunds-request.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Search Terminal Refunds Request - -## Structure - -`SearchTerminalRefundsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `query` | [`TerminalRefundQuery \| undefined`](../../doc/models/terminal-refund-query.md) | Optional | - | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query. | -| `limit` | `number \| undefined` | Optional | Limits the number of results returned for a single request.
**Constraints**: `>= 1`, `<= 100` | - -## Example (as JSON) - -```json -{ - "limit": 1, - "query": { - "filter": { - "status": "COMPLETED", - "device_id": "device_id0", - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - } - }, - "sort": { - "sort_order": "sort_order8" - } - }, - "cursor": "cursor4" -} -``` - diff --git a/doc/models/search-terminal-refunds-response.md b/doc/models/search-terminal-refunds-response.md deleted file mode 100644 index 9a2f2d87a..000000000 --- a/doc/models/search-terminal-refunds-response.md +++ /dev/null @@ -1,72 +0,0 @@ - -# Search Terminal Refunds Response - -## Structure - -`SearchTerminalRefundsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `refunds` | [`TerminalRefund[] \| undefined`](../../doc/models/terminal-refund.md) | Optional | The requested search result of `TerminalRefund` objects. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If empty,
this is the final response.

See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. | - -## Example (as JSON) - -```json -{ - "refunds": [ - { - "amount_money": { - "amount": 111, - "currency": "CAD" - }, - "app_id": "sandbox-sq0idb-c2OuYt13YaCAeJq_2cd8OQ", - "card": { - "bin": "411111", - "card_brand": "INTERAC", - "card_type": "CREDIT", - "exp_month": 1, - "exp_year": 2022, - "fingerprint": "sq-1-B1fP9MNNmZgVVaPKRND6oDKYbz25S2cTvg9Mzwg3RMTK1zT1PiGRT-AE3nTA8vSmmw", - "last_4": "1111" - }, - "created_at": "2020-09-29T15:21:46.771Z", - "deadline_duration": "PT5M", - "device_id": "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", - "id": "009DP5HD-5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "location_id": "76C9W6K8CNNQ5", - "order_id": "kcuKDKreRaI4gF4TjmEgZjHk8Z7YY", - "payment_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY", - "reason": "Returning item", - "refund_id": "5O5OvgkcNUhl7JBuINflcjKqUzXZY_43Q4iGp7sNeATiWrUruA1EYeMRUXaddXXlDDJ1EQLvb", - "status": "COMPLETED", - "updated_at": "2020-09-29T15:21:48.675Z" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "cursor": "cursor8" -} -``` - diff --git a/doc/models/search-vendors-request-filter.md b/doc/models/search-vendors-request-filter.md deleted file mode 100644 index 219005f74..000000000 --- a/doc/models/search-vendors-request-filter.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Search Vendors Request Filter - -Defines supported query expressions to search for vendors by. - -## Structure - -`SearchVendorsRequestFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string[] \| null \| undefined` | Optional | The names of the [Vendor](entity:Vendor) objects to retrieve. | -| `status` | [`string[] \| null \| undefined`](../../doc/models/vendor-status.md) | Optional | The statuses of the [Vendor](entity:Vendor) objects to retrieve.
See [VendorStatus](#type-vendorstatus) for possible values | - -## Example (as JSON) - -```json -{ - "name": [ - "name4", - "name5", - "name6" - ], - "status": [ - "ACTIVE", - "INACTIVE", - "ACTIVE" - ] -} -``` - diff --git a/doc/models/search-vendors-request-sort-field.md b/doc/models/search-vendors-request-sort-field.md deleted file mode 100644 index 11f90af3f..000000000 --- a/doc/models/search-vendors-request-sort-field.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Search Vendors Request Sort Field - -The field to sort the returned [Vendor](../../doc/models/vendor.md) objects by. - -## Enumeration - -`SearchVendorsRequestSortField` - -## Fields - -| Name | Description | -| --- | --- | -| `NAME` | To sort the result by the name of the [Vendor](../../doc/models/vendor.md) objects. | -| `CREATED_AT` | To sort the result by the creation time of the [Vendor](../../doc/models/vendor.md) objects. | - diff --git a/doc/models/search-vendors-request-sort.md b/doc/models/search-vendors-request-sort.md deleted file mode 100644 index bda094938..000000000 --- a/doc/models/search-vendors-request-sort.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Search Vendors Request Sort - -Defines a sorter used to sort results from [SearchVendors](../../doc/api/vendors.md#search-vendors). - -## Structure - -`SearchVendorsRequestSort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `field` | [`string \| undefined`](../../doc/models/search-vendors-request-sort-field.md) | Optional | The field to sort the returned [Vendor](../../doc/models/vendor.md) objects by. | -| `order` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "field": "NAME", - "order": "DESC" -} -``` - diff --git a/doc/models/search-vendors-request.md b/doc/models/search-vendors-request.md deleted file mode 100644 index e7e1ae91d..000000000 --- a/doc/models/search-vendors-request.md +++ /dev/null @@ -1,55 +0,0 @@ - -# Search Vendors Request - -Represents an input into a call to [SearchVendors](../../doc/api/vendors.md#search-vendors). - -## Structure - -`SearchVendorsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`SearchVendorsRequestFilter \| undefined`](../../doc/models/search-vendors-request-filter.md) | Optional | Defines supported query expressions to search for vendors by. | -| `sort` | [`SearchVendorsRequestSort \| undefined`](../../doc/models/search-vendors-request-sort.md) | Optional | Defines a sorter used to sort results from [SearchVendors](../../doc/api/vendors.md#search-vendors). | -| `cursor` | `string \| undefined` | Optional | A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for the original query.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | - -## Example (as JSON) - -```json -{ - "query": { - "filter": { - "name": [ - "Joe's Fresh Seafood", - "Hannah's Bakery" - ], - "status": [ - "ACTIVE" - ] - }, - "sort": { - "field": "CREATED_AT", - "order": "ASC" - } - }, - "filter": { - "name": [ - "name4", - "name5", - "name6" - ], - "status": [ - "ACTIVE", - "INACTIVE" - ] - }, - "sort": { - "field": "NAME", - "order": "DESC" - }, - "cursor": "cursor0" -} -``` - diff --git a/doc/models/search-vendors-response.md b/doc/models/search-vendors-response.md deleted file mode 100644 index 3d55256e8..000000000 --- a/doc/models/search-vendors-response.md +++ /dev/null @@ -1,61 +0,0 @@ - -# Search Vendors Response - -Represents an output from a call to [SearchVendors](../../doc/api/vendors.md#search-vendors). - -## Structure - -`SearchVendorsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered when the request fails. | -| `vendors` | [`Vendor[] \| undefined`](../../doc/models/vendor.md) | Optional | The [Vendor](entity:Vendor) objects matching the specified search filter. | -| `cursor` | `string \| undefined` | Optional | The pagination cursor to be used in a subsequent request. If unset,
this is the final response.

See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "vendors": [ - { - "id": "id8", - "created_at": "created_at6", - "updated_at": "updated_at4", - "name": "name8", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - { - "id": "id8", - "created_at": "created_at6", - "updated_at": "updated_at4", - "name": "name8", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - ], - "cursor": "cursor8" -} -``` - diff --git a/doc/models/segment-filter.md b/doc/models/segment-filter.md deleted file mode 100644 index 0961ff1b6..000000000 --- a/doc/models/segment-filter.md +++ /dev/null @@ -1,40 +0,0 @@ - -# Segment Filter - -A query filter to search for buyer-accessible appointment segments by. - -## Structure - -`SegmentFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `serviceVariationId` | `string` | Required | The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | -| `teamMemberIdFilter` | [`FilterValue \| undefined`](../../doc/models/filter-value.md) | Optional | A filter to select resources based on an exact field value. For any given
value, the value can only be in one property. Depending on the field, either
all properties can be set or only a subset will be available.

Refer to the documentation of the field. | - -## Example (as JSON) - -```json -{ - "service_variation_id": "service_variation_id0", - "team_member_id_filter": { - "all": [ - "all5", - "all6", - "all7" - ], - "any": [ - "any2", - "any3", - "any4" - ], - "none": [ - "none7", - "none8" - ] - } -} -``` - diff --git a/doc/models/select-option.md b/doc/models/select-option.md deleted file mode 100644 index 7eb0a1a13..000000000 --- a/doc/models/select-option.md +++ /dev/null @@ -1,23 +0,0 @@ - -# 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_id6", - "title": "title8" -} -``` - diff --git a/doc/models/select-options.md b/doc/models/select-options.md deleted file mode 100644 index e7a6d8c36..000000000 --- a/doc/models/select-options.md +++ /dev/null @@ -1,35 +0,0 @@ - -# 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": "title0", - "body": "body0", - "options": [ - { - "reference_id": "reference_id0", - "title": "title2" - } - ], - "selected_option": { - "reference_id": "reference_id6", - "title": "title8" - } -} -``` - diff --git a/doc/models/shift-filter-status.md b/doc/models/shift-filter-status.md deleted file mode 100644 index 988934df2..000000000 --- a/doc/models/shift-filter-status.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Shift Filter Status - -Specifies the `status` of `Shift` records to be returned. - -## Enumeration - -`ShiftFilterStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `OPEN` | Shifts that have been started and not ended. | -| `CLOSED` | Shifts that have been started and ended. | - diff --git a/doc/models/shift-filter.md b/doc/models/shift-filter.md deleted file mode 100644 index a96fe0c63..000000000 --- a/doc/models/shift-filter.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Shift Filter - -Defines a filter used in a search for `Shift` records. `AND` logic is -used by Square's servers to apply each filter property specified. - -## Structure - -`ShiftFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationIds` | `string[] \| null \| undefined` | Optional | Fetch shifts for the specified location. | -| `employeeIds` | `string[] \| null \| undefined` | Optional | Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead. | -| `status` | [`string \| undefined`](../../doc/models/shift-filter-status.md) | Optional | Specifies the `status` of `Shift` records to be returned. | -| `start` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `end` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `workday` | [`ShiftWorkday \| undefined`](../../doc/models/shift-workday.md) | Optional | A `Shift` search query filter parameter that sets a range of days that
a `Shift` must start or end in before passing the filter condition. | -| `teamMemberIds` | `string[] \| null \| undefined` | Optional | Fetch shifts for the specified team members. Replaced `employee_ids` at version "2020-08-26". | - -## Example (as JSON) - -```json -{ - "location_ids": [ - "location_ids8", - "location_ids9", - "location_ids0" - ], - "employee_ids": [ - "employee_ids3", - "employee_ids4", - "employee_ids5" - ], - "status": "OPEN", - "start": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "end": { - "start_at": "start_at0", - "end_at": "end_at2" - } -} -``` - diff --git a/doc/models/shift-query.md b/doc/models/shift-query.md deleted file mode 100644 index 6a6ebdce1..000000000 --- a/doc/models/shift-query.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Shift Query - -The parameters of a `Shift` search query, which includes filter and sort options. - -## Structure - -`ShiftQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`ShiftFilter \| undefined`](../../doc/models/shift-filter.md) | Optional | Defines a filter used in a search for `Shift` records. `AND` logic is
used by Square's servers to apply each filter property specified. | -| `sort` | [`ShiftSort \| undefined`](../../doc/models/shift-sort.md) | Optional | Sets the sort order of search results. | - -## Example (as JSON) - -```json -{ - "filter": { - "location_ids": [ - "location_ids4" - ], - "employee_ids": [ - "employee_ids9" - ], - "status": "OPEN", - "start": { - "start_at": "start_at6", - "end_at": "end_at6" - }, - "end": { - "start_at": "start_at0", - "end_at": "end_at2" - } - }, - "sort": { - "field": "START_AT", - "order": "DESC" - } -} -``` - diff --git a/doc/models/shift-sort-field.md b/doc/models/shift-sort-field.md deleted file mode 100644 index eefd8b5c3..000000000 --- a/doc/models/shift-sort-field.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Shift Sort Field - -Enumerates the `Shift` fields to sort on. - -## Enumeration - -`ShiftSortField` - -## Fields - -| Name | Description | -| --- | --- | -| `START_AT` | The start date/time of a `Shift` | -| `END_AT` | The end date/time of a `Shift` | -| `CREATED_AT` | The date/time that a `Shift` is created | -| `UPDATED_AT` | The most recent date/time that a `Shift` is updated | - diff --git a/doc/models/shift-sort.md b/doc/models/shift-sort.md deleted file mode 100644 index 7bad70e43..000000000 --- a/doc/models/shift-sort.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Shift Sort - -Sets the sort order of search results. - -## Structure - -`ShiftSort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `field` | [`string \| undefined`](../../doc/models/shift-sort-field.md) | Optional | Enumerates the `Shift` fields to sort on. | -| `order` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "field": "START_AT", - "order": "DESC" -} -``` - diff --git a/doc/models/shift-status.md b/doc/models/shift-status.md deleted file mode 100644 index dbeaf3c6c..000000000 --- a/doc/models/shift-status.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Shift Status - -Enumerates the possible status of a `Shift`. - -## Enumeration - -`ShiftStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `OPEN` | Employee started a work shift and the shift is not complete | -| `CLOSED` | Employee started and ended a work shift. | - diff --git a/doc/models/shift-wage.md b/doc/models/shift-wage.md deleted file mode 100644 index 4a72ce3a9..000000000 --- a/doc/models/shift-wage.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Shift Wage - -The hourly wage rate used to compensate an employee for this shift. - -## Structure - -`ShiftWage` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `title` | `string \| null \| 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. | -| `tipEligible` | `boolean \| null \| undefined` | Optional | Whether team members are eligible for tips when working this job. | - -## Example (as JSON) - -```json -{ - "title": "title6", - "hourly_rate": { - "amount": 172, - "currency": "LAK" - }, - "job_id": "job_id2", - "tip_eligible": false -} -``` - diff --git a/doc/models/shift-workday-matcher.md b/doc/models/shift-workday-matcher.md deleted file mode 100644 index 3d87afa5f..000000000 --- a/doc/models/shift-workday-matcher.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Shift Workday Matcher - -Defines the logic used to apply a workday filter. - -## Enumeration - -`ShiftWorkdayMatcher` - -## Fields - -| Name | Description | -| --- | --- | -| `START_AT` | All shifts that start on or after the specified workday | -| `END_AT` | All shifts that end on or before the specified workday | -| `INTERSECTION` | All shifts that start between the start and end workdays (inclusive) | - diff --git a/doc/models/shift-workday.md b/doc/models/shift-workday.md deleted file mode 100644 index a2a464fb7..000000000 --- a/doc/models/shift-workday.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Shift Workday - -A `Shift` search query filter parameter that sets a range of days that -a `Shift` must start or end in before passing the filter condition. - -## Structure - -`ShiftWorkday` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `dateRange` | [`DateRange \| undefined`](../../doc/models/date-range.md) | Optional | A range defined by two dates. Used for filtering a query for Connect v2
objects that have date properties. | -| `matchShiftsBy` | [`string \| undefined`](../../doc/models/shift-workday-matcher.md) | Optional | Defines the logic used to apply a workday filter. | -| `defaultTimezone` | `string \| null \| undefined` | Optional | Location-specific timezones convert workdays to datetime filters.
Every location included in the query must have a timezone or this field
must be provided as a fallback. Format: the IANA timezone database
identifier for the relevant timezone. | - -## Example (as JSON) - -```json -{ - "date_range": { - "start_date": "start_date6", - "end_date": "end_date2" - }, - "match_shifts_by": "END_AT", - "default_timezone": "default_timezone2" -} -``` - diff --git a/doc/models/shift.md b/doc/models/shift.md deleted file mode 100644 index 95ba3fe01..000000000 --- a/doc/models/shift.md +++ /dev/null @@ -1,52 +0,0 @@ - -# Shift - -A record of the hourly rate, start, and end times for a single work shift -for an employee. This might include a record of the start and end times for breaks -taken during the shift. - -## Structure - -`Shift` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The UUID for this object.
**Constraints**: *Maximum Length*: `255` | -| `employeeId` | `string \| null \| undefined` | Optional | The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id` instead. | -| `locationId` | `string` | Required | The ID of the location this shift occurred at. The location should be based on
where the employee clocked in.
**Constraints**: *Minimum Length*: `1` | -| `timezone` | `string \| null \| undefined` | Optional | The read-only convenience value that is calculated from the location based
on the `location_id`. Format: the IANA timezone database identifier for the
location timezone. | -| `startAt` | `string` | Required | RFC 3339; shifted to the location timezone + offset. Precision up to the
minute is respected; seconds are truncated.
**Constraints**: *Minimum Length*: `1` | -| `endAt` | `string \| null \| undefined` | Optional | RFC 3339; shifted to the timezone + offset. Precision up to the minute is
respected; seconds are truncated. | -| `wage` | [`ShiftWage \| undefined`](../../doc/models/shift-wage.md) | Optional | The hourly wage rate used to compensate an employee for this shift. | -| `breaks` | [`Break[] \| null \| undefined`](../../doc/models/break.md) | Optional | A list of all the paid or unpaid breaks that were taken during this shift. | -| `status` | [`string \| undefined`](../../doc/models/shift-status.md) | Optional | Enumerates the possible status of a `Shift`. | -| `version` | `number \| undefined` | Optional | Used for resolving concurrency issues. The request fails if the version
provided does not match the server version at the time of the request. If not provided,
Square executes a blind write; potentially overwriting data from another
write. | -| `createdAt` | `string \| undefined` | Optional | A read-only timestamp in RFC 3339 format; presented in UTC. | -| `updatedAt` | `string \| undefined` | Optional | A read-only timestamp in RFC 3339 format; presented in UTC. | -| `teamMemberId` | `string \| null \| undefined` | Optional | The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26". | -| `declaredCashTipMoney` | [`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 -{ - "id": "id0", - "employee_id": "employee_id0", - "location_id": "location_id4", - "timezone": "timezone0", - "start_at": "start_at2", - "end_at": "end_at0", - "wage": { - "title": "title8", - "hourly_rate": { - "amount": 172, - "currency": "LAK" - }, - "job_id": "job_id0", - "tip_eligible": false - } -} -``` - diff --git a/doc/models/shipping-fee.md b/doc/models/shipping-fee.md deleted file mode 100644 index 8d7c248ef..000000000 --- a/doc/models/shipping-fee.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Shipping Fee - -## Structure - -`ShippingFee` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The name for the shipping fee. | -| `charge` | [`Money`](../../doc/models/money.md) | Required | 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 -{ - "name": "name6", - "charge": { - "amount": 80, - "currency": "TTD" - } -} -``` - diff --git a/doc/models/signature-image.md b/doc/models/signature-image.md deleted file mode 100644 index 08e33fe70..000000000 --- a/doc/models/signature-image.md +++ /dev/null @@ -1,23 +0,0 @@ - -# 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_type4", - "data": "data8" -} -``` - diff --git a/doc/models/signature-options.md b/doc/models/signature-options.md deleted file mode 100644 index e452c535e..000000000 --- a/doc/models/signature-options.md +++ /dev/null @@ -1,38 +0,0 @@ - -# 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": "title2", - "body": "body8", - "signature": [ - { - "image_type": "image_type4", - "data": "data8" - }, - { - "image_type": "image_type4", - "data": "data8" - }, - { - "image_type": "image_type4", - "data": "data8" - } - ] -} -``` - diff --git a/doc/models/site.md b/doc/models/site.md deleted file mode 100644 index 78b795482..000000000 --- a/doc/models/site.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Site - -Represents a Square Online site, which is an online store for a Square seller. - -## Structure - -`Site` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID of the site.
**Constraints**: *Maximum Length*: `32` | -| `siteTitle` | `string \| null \| undefined` | Optional | The title of the site. | -| `domain` | `string \| null \| undefined` | Optional | The domain of the site (without the protocol). For example, `mysite1.square.site`. | -| `isPublished` | `boolean \| null \| undefined` | Optional | Indicates whether the site is published. | -| `createdAt` | `string \| undefined` | Optional | The timestamp of when the site was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp of when the site was last updated, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "site_title": "site_title6", - "domain": "domain6", - "is_published": false, - "created_at": "created_at8" -} -``` - diff --git a/doc/models/snippet-response.md b/doc/models/snippet-response.md deleted file mode 100644 index 42486b33f..000000000 --- a/doc/models/snippet-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Snippet Response - -## Structure - -`SnippetResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `snippet` | [`Snippet \| undefined`](../../doc/models/snippet.md) | Optional | Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "snippet": { - "id": "id0", - "site_id": "site_id6", - "content": "content4", - "created_at": "created_at8", - "updated_at": "updated_at4" - } -} -``` - diff --git a/doc/models/snippet.md b/doc/models/snippet.md deleted file mode 100644 index c987ee6c6..000000000 --- a/doc/models/snippet.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Snippet - -Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. - -## Structure - -`Snippet` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The Square-assigned ID for the snippet.
**Constraints**: *Maximum Length*: `48` | -| `siteId` | `string \| undefined` | Optional | The ID of the site that contains the snippet. | -| `content` | `string` | Required | The snippet code, which can contain valid HTML, JavaScript, or both.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `65535` | -| `createdAt` | `string \| undefined` | Optional | The timestamp of when the snippet was initially added to the site, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp of when the snippet was last updated on the site, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "id": "id2", - "site_id": "site_id8", - "content": "content6", - "created_at": "created_at0", - "updated_at": "updated_at8" -} -``` - diff --git a/doc/models/sort-order.md b/doc/models/sort-order.md deleted file mode 100644 index b9e77cbad..000000000 --- a/doc/models/sort-order.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Sort Order - -The order (e.g., chronological or alphabetical) in which results from a request are returned. - -## Enumeration - -`SortOrder` - -## Fields - -| Name | Description | -| --- | --- | -| `DESC` | The results are returned in descending (e.g., newest-first or Z-A) order. | -| `ASC` | The results are returned in ascending (e.g., oldest-first or A-Z) order. | - diff --git a/doc/models/source-application.md b/doc/models/source-application.md deleted file mode 100644 index 3acadfd21..000000000 --- a/doc/models/source-application.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Source Application - -Represents information about the application used to generate a change. - -## Structure - -`SourceApplication` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `product` | [`string \| undefined`](../../doc/models/product.md) | Optional | Indicates the Square product used to generate a change. | -| `applicationId` | `string \| null \| undefined` | Optional | __Read only__ The Square-assigned ID of the application. This field is used only if the
[product](entity:Product) type is `EXTERNAL_API`. | -| `name` | `string \| null \| undefined` | Optional | __Read only__ The display name of the application
(for example, `"Custom Application"` or `"Square POS 4.74 for Android"`). | - -## Example (as JSON) - -```json -{ - "product": "INVOICES", - "application_id": "application_id0", - "name": "name4" -} -``` - diff --git a/doc/models/square-account-details.md b/doc/models/square-account-details.md deleted file mode 100644 index 0cf2fba47..000000000 --- a/doc/models/square-account-details.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Square Account Details - -Additional details about Square Account payments. - -## Structure - -`SquareAccountDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentSourceToken` | `string \| null \| undefined` | Optional | Unique identifier for the payment source used for this payment.
**Constraints**: *Maximum Length*: `255` | -| `errors` | [`Error[] \| null \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "payment_source_token": "payment_source_token8", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/standard-unit-description-group.md b/doc/models/standard-unit-description-group.md deleted file mode 100644 index 3980cceed..000000000 --- a/doc/models/standard-unit-description-group.md +++ /dev/null @@ -1,68 +0,0 @@ - -# Standard Unit Description Group - -Group of standard measurement units. - -## Structure - -`StandardUnitDescriptionGroup` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `standardUnitDescriptions` | [`StandardUnitDescription[] \| null \| undefined`](../../doc/models/standard-unit-description.md) | Optional | List of standard (non-custom) measurement units in this description group. | -| `languageCode` | `string \| null \| undefined` | Optional | IETF language tag. | - -## Example (as JSON) - -```json -{ - "standard_unit_descriptions": [ - { - "unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_MILLILITER", - "weight_unit": "IMPERIAL_STONE" - }, - "name": "name4", - "abbreviation": "abbreviation6" - }, - { - "unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_MILLILITER", - "weight_unit": "IMPERIAL_STONE" - }, - "name": "name4", - "abbreviation": "abbreviation6" - }, - { - "unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_MILLILITER", - "weight_unit": "IMPERIAL_STONE" - }, - "name": "name4", - "abbreviation": "abbreviation6" - } - ], - "language_code": "language_code4" -} -``` - diff --git a/doc/models/standard-unit-description.md b/doc/models/standard-unit-description.md deleted file mode 100644 index 1fe0ec0ba..000000000 --- a/doc/models/standard-unit-description.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Standard Unit Description - -Contains the name and abbreviation for standard measurement unit. - -## Structure - -`StandardUnitDescription` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `unit` | [`MeasurementUnit \| undefined`](../../doc/models/measurement-unit.md) | Optional | Represents a unit of measurement to use with a quantity, such as ounces
or inches. Exactly one of the following fields are required: `custom_unit`,
`area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. | -| `name` | `string \| null \| undefined` | Optional | UI display name of the measurement unit. For example, 'Pound'. | -| `abbreviation` | `string \| null \| undefined` | Optional | UI display abbreviation for the measurement unit. For example, 'lb'. | - -## Example (as JSON) - -```json -{ - "unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_MILLILITER", - "weight_unit": "IMPERIAL_STONE" - }, - "name": "name4", - "abbreviation": "abbreviation6" -} -``` - diff --git a/doc/models/submit-evidence-response.md b/doc/models/submit-evidence-response.md deleted file mode 100644 index a2b7ce7dd..000000000 --- a/doc/models/submit-evidence-response.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Submit Evidence Response - -Defines the fields in a `SubmitEvidence` response. - -## Structure - -`SubmitEvidenceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `dispute` | [`Dispute \| undefined`](../../doc/models/dispute.md) | Optional | Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. | - -## Example (as JSON) - -```json -{ - "dispute": { - "amount_money": { - "amount": 4350, - "currency": "USD" - }, - "brand_dispute_id": "100000399240", - "card_brand": "VISA", - "created_at": "2022-05-18T16:02:15.313Z", - "disputed_payment": { - "payment_id": "2yeBUWJzllJTpmnSqtMRAL19taB" - }, - "due_at": "2022-06-01T00:00:00.000Z", - "id": "EAZoK70gX3fyvibecLwIGB", - "location_id": "LSY8XKGSMMX94", - "reason": "CUSTOMER_REQUESTS_CREDIT", - "reported_at": "2022-05-18T00:00:00.000Z", - "state": "PROCESSING", - "updated_at": "2022-05-18T16:02:15.313Z", - "version": 4, - "dispute_id": "dispute_id8" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/subscription-action-type.md b/doc/models/subscription-action-type.md deleted file mode 100644 index bff9f231a..000000000 --- a/doc/models/subscription-action-type.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Subscription Action Type - -Supported types of an action as a pending change to a subscription. - -## Enumeration - -`SubscriptionActionType` - -## Fields - -| Name | Description | -| --- | --- | -| `CANCEL` | The action to execute a scheduled cancellation of a subscription. | -| `PAUSE` | The action to execute a scheduled pause of a subscription. | -| `RESUME` | The action to execute a scheduled resumption of a subscription. | -| `SWAP_PLAN` | The action to execute a scheduled swap of a subscription plan in a subscription. | -| `CHANGE_BILLING_ANCHOR_DATE` | A billing anchor date change action. | - diff --git a/doc/models/subscription-action.md b/doc/models/subscription-action.md deleted file mode 100644 index 55ca63e93..000000000 --- a/doc/models/subscription-action.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Subscription Action - -Represents an action as a pending change to a subscription. - -## Structure - -`SubscriptionAction` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `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 \| null \| undefined` | Optional | The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. | -| `monthlyBillingAnchorDate` | `number \| null \| undefined` | Optional | The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. | -| `phases` | [`Phase[] \| null \| undefined`](../../doc/models/phase.md) | Optional | A list of Phases, to pass phase-specific information used in the swap. | -| `newPlanVariationId` | `string \| null \| undefined` | Optional | The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action. | - -## Example (as JSON) - -```json -{ - "id": "id2", - "type": "SWAP_PLAN", - "effective_date": "effective_date2", - "monthly_billing_anchor_date": 18, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ] -} -``` - diff --git a/doc/models/subscription-cadence.md b/doc/models/subscription-cadence.md deleted file mode 100644 index 0499ca72a..000000000 --- a/doc/models/subscription-cadence.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Subscription Cadence - -Determines the billing cadence of a [Subscription](../../doc/models/subscription.md) - -## Enumeration - -`SubscriptionCadence` - -## Fields - -| Name | Description | -| --- | --- | -| `DAILY` | Once per day | -| `WEEKLY` | Once per week | -| `EVERY_TWO_WEEKS` | Every two weeks | -| `THIRTY_DAYS` | Once every 30 days | -| `SIXTY_DAYS` | Once every 60 days | -| `NINETY_DAYS` | Once every 90 days | -| `MONTHLY` | Once per month | -| `EVERY_TWO_MONTHS` | Once every two months | -| `QUARTERLY` | Once every three months | -| `EVERY_FOUR_MONTHS` | Once every four months | -| `EVERY_SIX_MONTHS` | Once every six months | -| `ANNUAL` | Once per year | -| `EVERY_TWO_YEARS` | Once every two years | - diff --git a/doc/models/subscription-event-info-code.md b/doc/models/subscription-event-info-code.md deleted file mode 100644 index de7baf133..000000000 --- a/doc/models/subscription-event-info-code.md +++ /dev/null @@ -1,20 +0,0 @@ - -# Subscription Event Info Code - -Supported info codes of a subscription event. - -## Enumeration - -`SubscriptionEventInfoCode` - -## Fields - -| Name | Description | -| --- | --- | -| `LOCATION_NOT_ACTIVE` | The location is not active. | -| `LOCATION_CANNOT_ACCEPT_PAYMENT` | The location cannot accept payments. | -| `CUSTOMER_DELETED` | The subscribing customer profile has been deleted. | -| `CUSTOMER_NO_EMAIL` | The subscribing customer does not have an email. | -| `CUSTOMER_NO_NAME` | The subscribing customer does not have a name. | -| `USER_PROVIDED` | User-provided detail. | - diff --git a/doc/models/subscription-event-info.md b/doc/models/subscription-event-info.md deleted file mode 100644 index 91c74a94c..000000000 --- a/doc/models/subscription-event-info.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Subscription Event Info - -Provides information about the subscription event. - -## Structure - -`SubscriptionEventInfo` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `detail` | `string \| null \| undefined` | Optional | A human-readable explanation for the event. | -| `code` | [`string \| undefined`](../../doc/models/subscription-event-info-code.md) | Optional | Supported info codes of a subscription event. | - -## Example (as JSON) - -```json -{ - "detail": "detail8", - "code": "CUSTOMER_NO_NAME" -} -``` - diff --git a/doc/models/subscription-event-subscription-event-type.md b/doc/models/subscription-event-subscription-event-type.md deleted file mode 100644 index 8ca123a4e..000000000 --- a/doc/models/subscription-event-subscription-event-type.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Subscription Event Subscription Event Type - -Supported types of an event occurred to a subscription. - -## Enumeration - -`SubscriptionEventSubscriptionEventType` - -## Fields - -| Name | Description | -| --- | --- | -| `START_SUBSCRIPTION` | The subscription was started. | -| `PLAN_CHANGE` | The subscription plan was changed. | -| `STOP_SUBSCRIPTION` | The subscription was stopped. | -| `DEACTIVATE_SUBSCRIPTION` | The subscription was deactivated | -| `RESUME_SUBSCRIPTION` | The subscription was resumed. | -| `PAUSE_SUBSCRIPTION` | The subscription was paused. | -| `BILLING_ANCHOR_DATE_CHANGED` | The billing anchor date was changed. | - diff --git a/doc/models/subscription-event.md b/doc/models/subscription-event.md deleted file mode 100644 index 322c904de..000000000 --- a/doc/models/subscription-event.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Subscription Event - -Describes changes to a subscription and the subscription status. - -## Structure - -`SubscriptionEvent` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `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. | -| `monthlyBillingAnchorDate` | `number \| undefined` | Optional | The day-of-the-month the billing anchor date was changed to, if applicable. | -| `info` | [`SubscriptionEventInfo \| undefined`](../../doc/models/subscription-event-info.md) | Optional | Provides information about the subscription event. | -| `phases` | [`Phase[] \| null \| 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) - -```json -{ - "id": "id6", - "subscription_event_type": "RESUME_SUBSCRIPTION", - "effective_date": "effective_date4", - "monthly_billing_anchor_date": 54, - "info": { - "detail": "detail6", - "code": "CUSTOMER_DELETED" - }, - "phases": [ - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - }, - { - "uid": "uid0", - "ordinal": 78, - "order_template_id": "order_template_id2", - "plan_phase_uid": "plan_phase_uid6" - } - ], - "plan_variation_id": "plan_variation_id0" -} -``` - diff --git a/doc/models/subscription-phase.md b/doc/models/subscription-phase.md deleted file mode 100644 index 95f92ec58..000000000 --- a/doc/models/subscription-phase.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Subscription Phase - -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 - -`SubscriptionPhase` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `string \| null \| undefined` | Optional | The Square-assigned ID of the subscription phase. This field cannot be changed after a `SubscriptionPhase` is created. | -| `cadence` | [`string`](../../doc/models/subscription-cadence.md) | Required | Determines the billing cadence of a [Subscription](../../doc/models/subscription.md) | -| `periods` | `number \| null \| 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 \| null \| 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) - -```json -{ - "uid": "uid2", - "cadence": "EVERY_SIX_MONTHS", - "periods": 36, - "recurring_price_money": { - "amount": 66, - "currency": "ZMW" - }, - "ordinal": 2, - "pricing": { - "type": "STATIC", - "discount_ids": [ - "discount_ids5", - "discount_ids6" - ], - "price_money": { - "amount": 202, - "currency": "GTQ" - } - } -} -``` - diff --git a/doc/models/subscription-pricing-type.md b/doc/models/subscription-pricing-type.md deleted file mode 100644 index 105aa699b..000000000 --- a/doc/models/subscription-pricing-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# 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 deleted file mode 100644 index d24c668f2..000000000 --- a/doc/models/subscription-pricing.md +++ /dev/null @@ -1,33 +0,0 @@ - -# 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[] \| null \| 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_ids9", - "discount_ids0" - ], - "price_money": { - "amount": 202, - "currency": "GTQ" - } -} -``` - diff --git a/doc/models/subscription-source.md b/doc/models/subscription-source.md deleted file mode 100644 index 14f73af1f..000000000 --- a/doc/models/subscription-source.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Subscription Source - -The origination details of the subscription. - -## Structure - -`SubscriptionSource` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `string \| null \| undefined` | Optional | The name used to identify the place (physical or digital) that
a subscription originates. If unset, the name defaults to the name
of the application that created the subscription.
**Constraints**: *Maximum Length*: `255` | - -## Example (as JSON) - -```json -{ - "name": "name0" -} -``` - diff --git a/doc/models/subscription-status.md b/doc/models/subscription-status.md deleted file mode 100644 index 8693d7868..000000000 --- a/doc/models/subscription-status.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Subscription Status - -Supported subscription statuses. - -## Enumeration - -`SubscriptionStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `PENDING` | The subscription is pending to start in the future. | -| `ACTIVE` | The subscription is active. | -| `CANCELED` | The subscription is canceled. | -| `DEACTIVATED` | The subscription is deactivated. | -| `PAUSED` | The subscription is paused. | - diff --git a/doc/models/subscription-test-result.md b/doc/models/subscription-test-result.md deleted file mode 100644 index 92252d564..000000000 --- a/doc/models/subscription-test-result.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Subscription Test Result - -Represents the details of a webhook subscription, including notification URL, -event types, and signature key. - -## Structure - -`SubscriptionTestResult` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A Square-generated unique ID for the subscription test result.
**Constraints**: *Maximum Length*: `64` | -| `statusCode` | `number \| null \| undefined` | Optional | The status code returned by the subscription notification URL. | -| `payload` | `string \| null \| undefined` | Optional | An object containing the payload of the test event. For example, a `payment.created` event. | -| `createdAt` | `string \| undefined` | Optional | The timestamp of when the subscription was created, in RFC 3339 format.
For example, "2016-09-04T23:59:33.123Z". | -| `updatedAt` | `string \| undefined` | Optional | The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z".
Because a subscription test result is unique, this field is the same as the `created_at` field. | - -## Example (as JSON) - -```json -{ - "id": "id0", - "status_code": 208, - "payload": "payload6", - "created_at": "created_at8", - "updated_at": "updated_at4" -} -``` - diff --git a/doc/models/subscription.md b/doc/models/subscription.md deleted file mode 100644 index dbdc965dc..000000000 --- a/doc/models/subscription.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Subscription - -Represents a subscription purchased by a customer. - -For more information, see -[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). - -## Structure - -`Subscription` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `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. | -| `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 \| null \| 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. | -| `chargedThroughDate` | `string \| undefined` | Optional | The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the
subscription.

After the invoice is sent for a given billing period,
this date will be the last day of the billing period.
For example,
suppose for the month of May a subscriber gets an invoice
(or charged the card) on May 1. For the monthly billing scenario,
this date is then set to May 31. | -| `status` | [`string \| undefined`](../../doc/models/subscription-status.md) | Optional | Supported subscription statuses. | -| `taxPercentage` | `string \| null \| undefined` | Optional | The tax amount applied 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%. | -| `invoiceIds` | `string[] \| undefined` | Optional | The IDs of the [invoices](entity:Invoice) created for the
subscription, listed in order when the invoices were created
(newest invoices appear first). | -| `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. | -| `version` | `bigint \| undefined` | Optional | The version of the object. When updating an object, the version
supplied must match the version in the database, otherwise the write will
be rejected as conflicting. | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the subscription was created, in RFC 3339 format. | -| `cardId` | `string \| null \| undefined` | Optional | The ID of the [subscriber's](entity:Customer) [card](entity:Card)
used to charge for the subscription. | -| `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[] \| null \| 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"]`. | -| `monthlyBillingAnchorDate` | `number \| undefined` | Optional | The day of the month on which the subscription will issue invoices and publish orders. | -| `phases` | [`Phase[] \| undefined`](../../doc/models/phase.md) | Optional | array of phases for this subscription | - -## Example (as JSON) - -```json -{ - "id": "id4", - "location_id": "location_id8", - "plan_variation_id": "plan_variation_id8", - "customer_id": "customer_id2", - "start_date": "start_date8" -} -``` - diff --git a/doc/models/swap-plan-request.md b/doc/models/swap-plan-request.md deleted file mode 100644 index f698a9fb4..000000000 --- a/doc/models/swap-plan-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Swap Plan Request - -Defines input parameters in a call to the -[SwapPlan](../../doc/api/subscriptions.md#swap-plan) endpoint. - -## Structure - -`SwapPlanRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `newPlanVariationId` | `string \| null \| undefined` | Optional | The ID of the new subscription plan variation.

This field is required. | -| `phases` | [`PhaseInput[] \| null \| 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_variation_id": "FQ7CDXXWSLUJRPM3GFJSJGZ7", - "phases": [ - { - "order_template_id": "uhhnjH9osVv3shUADwaC0b3hNxQZY", - "ordinal": 0 - } - ] -} -``` - diff --git a/doc/models/swap-plan-response.md b/doc/models/swap-plan-response.md deleted file mode 100644 index 8a3ca6126..000000000 --- a/doc/models/swap-plan-response.md +++ /dev/null @@ -1,88 +0,0 @@ - -# Swap Plan Response - -Defines output parameters in a response of the -[SwapPlan](../../doc/api/subscriptions.md#swap-plan) endpoint. - -## Structure - -`SwapPlanResponse` - -## Fields - -| 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 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) - -```json -{ - "actions": [ - { - "effective_date": "2023-11-17", - "id": "f0a1dfdc-675b-3a14-a640-99f7ac1cee83", - "new_plan_variation_id": "FQ7CDXXWSLUJRPM3GFJSJGZ7", - "phases": [ - { - "order_template_id": "uhhnjH9osVv3shUADwaC0b3hNxQZY", - "ordinal": 0, - "uid": "uid0", - "plan_phase_uid": "plan_phase_uid6" - } - ], - "type": "SWAP_PLAN", - "monthly_billing_anchor_date": 186 - } - ], - "subscription": { - "created_at": "2023-06-20T21:53:10Z", - "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_variation_id": "FQ7CDXXWSLUJRPM3GFJSJGZ7", - "price_override_money": { - "amount": 2000, - "currency": "USD" - }, - "source": { - "name": "My Application" - }, - "status": "ACTIVE", - "timezone": "America/Los_Angeles", - "version": 3, - "start_date": "start_date8" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/tax-calculation-phase.md b/doc/models/tax-calculation-phase.md deleted file mode 100644 index 314d812b8..000000000 --- a/doc/models/tax-calculation-phase.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Tax Calculation Phase - -When to calculate the taxes due on a cart. - -## Enumeration - -`TaxCalculationPhase` - -## Fields - -| Name | Description | -| --- | --- | -| `TAX_SUBTOTAL_PHASE` | The fee is calculated based on the payment's subtotal. | -| `TAX_TOTAL_PHASE` | The fee is calculated based on the payment's total. | - diff --git a/doc/models/tax-ids.md b/doc/models/tax-ids.md deleted file mode 100644 index dba7bceb0..000000000 --- a/doc/models/tax-ids.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Tax Ids - -Identifiers for the location used by various governments for tax purposes. - -## Structure - -`TaxIds` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `euVat` | `string \| undefined` | Optional | The EU VAT number for this location. For example, `IE3426675K`.
If the EU VAT number is present, it is well-formed and has been
validated with VIES, the VAT Information Exchange System. | -| `frSiret` | `string \| undefined` | Optional | The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements)
number is a 14-digit code issued by the French INSEE. For example, `39922799000021`. | -| `frNaf` | `string \| undefined` | Optional | The French government uses the NAF (Nomenclature des Activités Françaises) to display and
track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code.
For example, `6910Z`. | -| `esNif` | `string \| undefined` | Optional | The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain.
If it is present, it has been validated. For example, `73628495A`. | -| `jpQii` | `string \| undefined` | Optional | The QII (Qualified Invoice Issuer) number is a 14-character tax identifier used in Japan.
For example, `T1234567890123`. | - -## Example (as JSON) - -```json -{ - "eu_vat": "eu_vat8", - "fr_siret": "fr_siret0", - "fr_naf": "fr_naf0", - "es_nif": "es_nif4", - "jp_qii": "jp_qii0" -} -``` - diff --git a/doc/models/tax-inclusion-type.md b/doc/models/tax-inclusion-type.md deleted file mode 100644 index d8f3c0d76..000000000 --- a/doc/models/tax-inclusion-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Tax Inclusion Type - -Whether to the tax amount should be additional to or included in the CatalogItem price. - -## Enumeration - -`TaxInclusionType` - -## Fields - -| Name | Description | -| --- | --- | -| `ADDITIVE` | The tax is an additive tax. The tax amount is added on top of the
CatalogItemVariation price. For example, a $1.00 item with a 10% additive
tax would have a total cost to the buyer of $1.10. | -| `INCLUSIVE` | The tax is an inclusive tax. The tax amount is included in the
CatalogItemVariation price. For example, a $1.00 item with a 10% inclusive
tax would have a total cost to the buyer of $1.00, with $0.91 (91 cents) of
that total being the cost of the item and $0.09 (9 cents) being tax. | - diff --git a/doc/models/team-member-assigned-locations-assignment-type.md b/doc/models/team-member-assigned-locations-assignment-type.md deleted file mode 100644 index 6f582ec60..000000000 --- a/doc/models/team-member-assigned-locations-assignment-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Team Member Assigned Locations Assignment Type - -Enumerates the possible assignment types that the team member can have. - -## Enumeration - -`TeamMemberAssignedLocationsAssignmentType` - -## Fields - -| Name | Description | -| --- | --- | -| `ALL_CURRENT_AND_FUTURE_LOCATIONS` | The team member is assigned to all current and future locations. The `location_ids` field
is empty if the team member has this assignment type. | -| `EXPLICIT_LOCATIONS` | The team member is assigned to an explicit subset of locations. The `location_ids` field
is the list of locations that the team member is assigned to. | - diff --git a/doc/models/team-member-assigned-locations.md b/doc/models/team-member-assigned-locations.md deleted file mode 100644 index 39a8b54d7..000000000 --- a/doc/models/team-member-assigned-locations.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Team Member Assigned Locations - -An object that represents a team member's assignment to locations. - -## Structure - -`TeamMemberAssignedLocations` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `assignmentType` | [`string \| undefined`](../../doc/models/team-member-assigned-locations-assignment-type.md) | Optional | Enumerates the possible assignment types that the team member can have. | -| `locationIds` | `string[] \| null \| undefined` | Optional | The explicit locations that the team member is assigned to. | - -## Example (as JSON) - -```json -{ - "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS", - "location_ids": [ - "location_ids4", - "location_ids5" - ] -} -``` - diff --git a/doc/models/team-member-booking-profile.md b/doc/models/team-member-booking-profile.md deleted file mode 100644 index fb3810313..000000000 --- a/doc/models/team-member-booking-profile.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Team Member Booking Profile - -The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. - -## Structure - -`TeamMemberBookingProfile` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string \| undefined` | Optional | The ID of the [TeamMember](entity:TeamMember) object for the team member associated with the booking profile.
**Constraints**: *Maximum Length*: `32` | -| `description` | `string \| undefined` | Optional | The description of the team member.
**Constraints**: *Maximum Length*: `65536` | -| `displayName` | `string \| undefined` | Optional | The display name of the team member.
**Constraints**: *Maximum Length*: `512` | -| `isBookable` | `boolean \| null \| undefined` | Optional | Indicates whether the team member can be booked through the Bookings API or the seller's online booking channel or site (`true`) or not (`false`). | -| `profileImageUrl` | `string \| undefined` | Optional | The URL of the team member's image for the bookings profile.
**Constraints**: *Maximum Length*: `2048` | - -## Example (as JSON) - -```json -{ - "team_member_id": "team_member_id0", - "description": "description0", - "display_name": "display_name0", - "is_bookable": false, - "profile_image_url": "profile_image_url6" -} -``` - diff --git a/doc/models/team-member-invitation-status.md b/doc/models/team-member-invitation-status.md deleted file mode 100644 index cd18b4cb7..000000000 --- a/doc/models/team-member-invitation-status.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Team Member Invitation Status - -Enumerates the possible invitation statuses the team member can have within a business. - -## Enumeration - -`TeamMemberInvitationStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `UNINVITED` | The team member has not received an invitation. | -| `PENDING` | The team member has received an invitation, but had not accepted it. | -| `ACCEPTED` | The team member has both received and accepted an invitation. | - diff --git a/doc/models/team-member-status.md b/doc/models/team-member-status.md deleted file mode 100644 index 93dacc258..000000000 --- a/doc/models/team-member-status.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Team Member Status - -Enumerates the possible statuses the team member can have within a business. - -## Enumeration - -`TeamMemberStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `ACTIVE` | The team member can sign in to Point of Sale and the Seller Dashboard. | -| `INACTIVE` | The team member can no longer sign in to Point of Sale or the Seller Dashboard,
but the team member's sales reports remain available. | - diff --git a/doc/models/team-member-wage.md b/doc/models/team-member-wage.md deleted file mode 100644 index cf9d818ff..000000000 --- a/doc/models/team-member-wage.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Team Member Wage - -The hourly wage rate that a team member earns on a `Shift` for doing the job -specified by the `title` property of this object. - -## Structure - -`TeamMemberWage` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The UUID for this object. | -| `teamMemberId` | `string \| null \| undefined` | Optional | The `TeamMember` that this wage is assigned to. | -| `title` | `string \| null \| 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 \| null \| undefined` | Optional | An identifier for the job that this wage relates to. This cannot be
used to retrieve the job. | -| `tipEligible` | `boolean \| null \| undefined` | Optional | Whether team members are eligible for tips when working this job. | - -## Example (as JSON) - -```json -{ - "id": "id2", - "team_member_id": "team_member_id2", - "title": "title8", - "hourly_rate": { - "amount": 172, - "currency": "LAK" - }, - "job_id": "job_id0" -} -``` - diff --git a/doc/models/team-member.md b/doc/models/team-member.md deleted file mode 100644 index acdc7d679..000000000 --- a/doc/models/team-member.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Team Member - -A record representing an individual team member for a business. - -## Structure - -`TeamMember` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The unique ID for the team member. | -| `referenceId` | `string \| null \| undefined` | Optional | A second ID used to associate the team member with an entity in another system. | -| `isOwner` | `boolean \| undefined` | Optional | Whether the team member is the owner of the Square account. | -| `status` | [`string \| undefined`](../../doc/models/team-member-status.md) | Optional | Enumerates the possible statuses the team member can have within a business. | -| `givenName` | `string \| null \| undefined` | Optional | The given name (that is, the first name) associated with the team member. | -| `familyName` | `string \| null \| undefined` | Optional | The family name (that is, the last name) associated with the team member. | -| `emailAddress` | `string \| null \| undefined` | Optional | The email address associated with the team member. After accepting the invitation
from Square, only the team member can change this value. | -| `phoneNumber` | `string \| null \| undefined` | Optional | The team member's phone number, in E.164 format. For example:
+14155552671 - the country code is 1 for US
+551155256325 - the country code is 55 for BR | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the team member was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the team member was last updated, in RFC 3339 format. | -| `assignedLocations` | [`TeamMemberAssignedLocations \| undefined`](../../doc/models/team-member-assigned-locations.md) | Optional | An object that represents a team member's assignment to locations. | -| `wageSetting` | [`WageSetting \| undefined`](../../doc/models/wage-setting.md) | Optional | Represents information about the overtime exemption status, job assignments, and compensation
for a [team member](../../doc/models/team-member.md). | - -## Example (as JSON) - -```json -{ - "id": "id4", - "reference_id": "reference_id8", - "is_owner": false, - "status": "ACTIVE", - "given_name": "given_name6" -} -``` - diff --git a/doc/models/tender-bank-account-details-status.md b/doc/models/tender-bank-account-details-status.md deleted file mode 100644 index 29b0c1f16..000000000 --- a/doc/models/tender-bank-account-details-status.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Tender Bank Account Details Status - -Indicates the bank account payment's current status. - -## Enumeration - -`TenderBankAccountDetailsStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `PENDING` | The bank account payment is in progress. | -| `COMPLETED` | The bank account payment has been completed. | -| `FAILED` | The bank account payment failed. | - diff --git a/doc/models/tender-bank-account-details.md b/doc/models/tender-bank-account-details.md deleted file mode 100644 index 8819dbc93..000000000 --- a/doc/models/tender-bank-account-details.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Tender Bank Account Details - -Represents the details of a tender with `type` `BANK_ACCOUNT`. - -See [BankAccountPaymentDetails](../../doc/models/bank-account-payment-details.md) -for more exposed details of a bank account payment. - -## Structure - -`TenderBankAccountDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `status` | [`string \| undefined`](../../doc/models/tender-bank-account-details-status.md) | Optional | Indicates the bank account payment's current status. | - -## Example (as JSON) - -```json -{ - "status": "FAILED" -} -``` - diff --git a/doc/models/tender-buy-now-pay-later-details-brand.md b/doc/models/tender-buy-now-pay-later-details-brand.md deleted file mode 100644 index 49e6ff579..000000000 --- a/doc/models/tender-buy-now-pay-later-details-brand.md +++ /dev/null @@ -1,14 +0,0 @@ - -# Tender Buy Now Pay Later Details Brand - -## Enumeration - -`TenderBuyNowPayLaterDetailsBrand` - -## Fields - -| Name | -| --- | -| `OTHER_BRAND` | -| `AFTERPAY` | - diff --git a/doc/models/tender-buy-now-pay-later-details-status.md b/doc/models/tender-buy-now-pay-later-details-status.md deleted file mode 100644 index 2dacca320..000000000 --- a/doc/models/tender-buy-now-pay-later-details-status.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Tender Buy Now Pay Later Details Status - -## Enumeration - -`TenderBuyNowPayLaterDetailsStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `AUTHORIZED` | The buy now pay later payment has been authorized but not yet captured. | -| `CAPTURED` | The buy now pay later payment was authorized and subsequently captured (i.e., completed). | -| `VOIDED` | The buy now pay later payment was authorized and subsequently voided (i.e., canceled). | -| `FAILED` | The buy now pay later payment failed. | - diff --git a/doc/models/tender-buy-now-pay-later-details.md b/doc/models/tender-buy-now-pay-later-details.md deleted file mode 100644 index 32e75a055..000000000 --- a/doc/models/tender-buy-now-pay-later-details.md +++ /dev/null @@ -1,25 +0,0 @@ - -# Tender Buy Now Pay Later Details - -Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. - -## Structure - -`TenderBuyNowPayLaterDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `buyNowPayLaterBrand` | [`string \| undefined`](../../doc/models/tender-buy-now-pay-later-details-brand.md) | Optional | - | -| `status` | [`string \| undefined`](../../doc/models/tender-buy-now-pay-later-details-status.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "buy_now_pay_later_brand": "OTHER_BRAND", - "status": "AUTHORIZED" -} -``` - diff --git a/doc/models/tender-card-details-entry-method.md b/doc/models/tender-card-details-entry-method.md deleted file mode 100644 index 24603553b..000000000 --- a/doc/models/tender-card-details-entry-method.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Tender Card Details Entry Method - -Indicates the method used to enter the card's details. - -## Enumeration - -`TenderCardDetailsEntryMethod` - -## Fields - -| Name | Description | -| --- | --- | -| `SWIPED` | The card was swiped through a Square reader or Square stand. | -| `KEYED` | The card information was keyed manually into Square Point of Sale or a
Square-hosted web form. | -| `EMV` | The card was processed via EMV with a Square reader. | -| `ON_FILE` | The buyer's card details were already on file with Square. | -| `CONTACTLESS` | The card was processed via a contactless (i.e., NFC) transaction
with a Square reader. | - diff --git a/doc/models/tender-card-details-status.md b/doc/models/tender-card-details-status.md deleted file mode 100644 index fe05323ab..000000000 --- a/doc/models/tender-card-details-status.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Tender Card Details Status - -Indicates the card transaction's current status. - -## Enumeration - -`TenderCardDetailsStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `AUTHORIZED` | The card transaction has been authorized but not yet captured. | -| `CAPTURED` | The card transaction was authorized and subsequently captured (i.e., completed). | -| `VOIDED` | The card transaction was authorized and subsequently voided (i.e., canceled). | -| `FAILED` | The card transaction failed. | - diff --git a/doc/models/tender-card-details.md b/doc/models/tender-card-details.md deleted file mode 100644 index 93db96737..000000000 --- a/doc/models/tender-card-details.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Tender Card Details - -Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` - -## Structure - -`TenderCardDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `status` | [`string \| undefined`](../../doc/models/tender-card-details-status.md) | Optional | Indicates the card transaction's current status. | -| `card` | [`Card \| undefined`](../../doc/models/card.md) | Optional | Represents the payment details of a card to be used for payments. These
details are determined by the payment token generated by Web Payments SDK. | -| `entryMethod` | [`string \| undefined`](../../doc/models/tender-card-details-entry-method.md) | Optional | Indicates the method used to enter the card's details. | - -## Example (as JSON) - -```json -{ - "status": "VOIDED", - "card": { - "id": "id6", - "card_brand": "OTHER_BRAND", - "last_4": "last_48", - "exp_month": 228, - "exp_year": 68 - }, - "entry_method": "CONTACTLESS" -} -``` - diff --git a/doc/models/tender-cash-details.md b/doc/models/tender-cash-details.md deleted file mode 100644 index 5c1b1d248..000000000 --- a/doc/models/tender-cash-details.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Tender Cash Details - -Represents the details of a tender with `type` `CASH`. - -## Structure - -`TenderCashDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `buyerTenderedMoney` | [`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. | -| `changeBackMoney` | [`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 -{ - "buyer_tendered_money": { - "amount": 238, - "currency": "XOF" - }, - "change_back_money": { - "amount": 78, - "currency": "XBD" - } -} -``` - diff --git a/doc/models/tender-square-account-details-status.md b/doc/models/tender-square-account-details-status.md deleted file mode 100644 index 8c46abdf2..000000000 --- a/doc/models/tender-square-account-details-status.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Tender Square Account Details Status - -## Enumeration - -`TenderSquareAccountDetailsStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `AUTHORIZED` | The Square Account payment has been authorized but not yet captured. | -| `CAPTURED` | The Square Account payment was authorized and subsequently captured (i.e., completed). | -| `VOIDED` | The Square Account payment was authorized and subsequently voided (i.e., canceled). | -| `FAILED` | The Square Account payment failed. | - diff --git a/doc/models/tender-square-account-details.md b/doc/models/tender-square-account-details.md deleted file mode 100644 index 7b2da076e..000000000 --- a/doc/models/tender-square-account-details.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Tender Square Account Details - -Represents the details of a tender with `type` `SQUARE_ACCOUNT`. - -## Structure - -`TenderSquareAccountDetails` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `status` | [`string \| undefined`](../../doc/models/tender-square-account-details-status.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "status": "AUTHORIZED" -} -``` - diff --git a/doc/models/tender-type.md b/doc/models/tender-type.md deleted file mode 100644 index 6771990f6..000000000 --- a/doc/models/tender-type.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Tender Type - -Indicates a tender's type. - -## Enumeration - -`TenderType` - -## Fields - -| Name | Description | -| --- | --- | -| `CARD` | A credit card. | -| `CASH` | Cash. | -| `THIRD_PARTY_CARD` | A credit card processed with a card processor other than Square.

This value applies only to merchants in countries where Square does not
yet provide card processing. | -| `SQUARE_GIFT_CARD` | A Square gift card. | -| `NO_SALE` | This tender represents the register being opened for a "no sale" event. | -| `BANK_ACCOUNT` | A bank account payment. | -| `WALLET` | A payment from a digital wallet, e.g. Cash App, Paypay, Rakuten Pay,
Au Pay, D Barai, Merpay, Wechat Pay, Alipay.

Note: Some "digital wallets", including Google Pay and Apple Pay, facilitate
card payments. Those payments have the `CARD` type. | -| `BUY_NOW_PAY_LATER` | A Buy Now Pay Later payment. | -| `SQUARE_ACCOUNT` | A Square House Account payment. | -| `OTHER` | A form of tender that does not match any other value. | - diff --git a/doc/models/tender.md b/doc/models/tender.md deleted file mode 100644 index 5f5b03d4f..000000000 --- a/doc/models/tender.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Tender - -Represents a tender (i.e., a method of payment) used in a Square transaction. - -## Structure - -`Tender` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The tender's unique ID. It is the associated payment ID.
**Constraints**: *Maximum Length*: `192` | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the transaction's associated location.
**Constraints**: *Maximum Length*: `50` | -| `transactionId` | `string \| null \| undefined` | Optional | The ID of the tender's associated transaction.
**Constraints**: *Maximum Length*: `192` | -| `createdAt` | `string \| undefined` | Optional | The timestamp for when the tender was created, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | -| `note` | `string \| null \| undefined` | Optional | An optional note associated with the tender at the time of payment.
**Constraints**: *Maximum Length*: `500` | -| `amountMoney` | [`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. | -| `tipMoney` | [`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. | -| `processingFeeMoney` | [`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. | -| `customerId` | `string \| null \| undefined` | Optional | If the tender is associated with a customer or represents a customer's card on file,
this is the ID of the associated customer.
**Constraints**: *Maximum Length*: `191` | -| `type` | [`string`](../../doc/models/tender-type.md) | Required | Indicates a tender's type. | -| `cardDetails` | [`TenderCardDetails \| undefined`](../../doc/models/tender-card-details.md) | Optional | Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` | -| `cashDetails` | [`TenderCashDetails \| undefined`](../../doc/models/tender-cash-details.md) | Optional | Represents the details of a tender with `type` `CASH`. | -| `bankAccountDetails` | [`TenderBankAccountDetails \| undefined`](../../doc/models/tender-bank-account-details.md) | Optional | Represents the details of a tender with `type` `BANK_ACCOUNT`.

See [BankAccountPaymentDetails](../../doc/models/bank-account-payment-details.md)
for more exposed details of a bank account payment. | -| `buyNowPayLaterDetails` | [`TenderBuyNowPayLaterDetails \| undefined`](../../doc/models/tender-buy-now-pay-later-details.md) | Optional | Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. | -| `squareAccountDetails` | [`TenderSquareAccountDetails \| undefined`](../../doc/models/tender-square-account-details.md) | Optional | Represents the details of a tender with `type` `SQUARE_ACCOUNT`. | -| `additionalRecipients` | [`AdditionalRecipient[] \| null \| undefined`](../../doc/models/additional-recipient.md) | Optional | Additional recipients (other than the merchant) receiving a portion of this tender.
For example, fees assessed on the purchase by a third party integration. | -| `paymentId` | `string \| null \| undefined` | Optional | The ID of the [Payment](entity:Payment) that corresponds to this tender.
This value is only present for payments created with the v2 Payments API.
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "created_at": "created_at6", - "note": "note4", - "type": "SQUARE_ACCOUNT" -} -``` - diff --git a/doc/models/terminal-action-action-type.md b/doc/models/terminal-action-action-type.md deleted file mode 100644 index 09d26ffd1..000000000 --- a/doc/models/terminal-action-action-type.md +++ /dev/null @@ -1,22 +0,0 @@ - -# Terminal Action Action Type - -Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. - -## Enumeration - -`TerminalActionActionType` - -## Fields - -| 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 deleted file mode 100644 index f6108f264..000000000 --- a/doc/models/terminal-action-query-filter.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Terminal Action Query Filter - -## Structure - -`TerminalActionQueryFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `deviceId` | `string \| null \| undefined` | Optional | `TerminalAction`s associated with a specific device. If no device is specified then all
`TerminalAction`s for the merchant will be displayed. | -| `createdAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `status` | `string \| null \| undefined` | Optional | Filter results with the desired status of the `TerminalAction`
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` | -| `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. | - -## Example (as JSON) - -```json -{ - "device_id": "device_id4", - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "status": "status0", - "type": "DATA_COLLECTION" -} -``` - diff --git a/doc/models/terminal-action-query-sort.md b/doc/models/terminal-action-query-sort.md deleted file mode 100644 index faf4326f8..000000000 --- a/doc/models/terminal-action-query-sort.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Terminal Action Query Sort - -## Structure - -`TerminalActionQuerySort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "sort_order": "DESC" -} -``` - diff --git a/doc/models/terminal-action-query.md b/doc/models/terminal-action-query.md deleted file mode 100644 index e4ef1bf1e..000000000 --- a/doc/models/terminal-action-query.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Terminal Action Query - -## Structure - -`TerminalActionQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`TerminalActionQueryFilter \| undefined`](../../doc/models/terminal-action-query-filter.md) | Optional | - | -| `sort` | [`TerminalActionQuerySort \| undefined`](../../doc/models/terminal-action-query-sort.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "include": [ - "CUSTOMER" - ], - "limit": 2, - "query": { - "filter": { - "status": "COMPLETED" - } - }, - "filter": { - "device_id": "device_id0", - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "status": "status6", - "type": "SAVE_CARD" - }, - "sort": { - "sort_order": "DESC" - } -} -``` - diff --git a/doc/models/terminal-action.md b/doc/models/terminal-action.md deleted file mode 100644 index 7a6e28118..000000000 --- a/doc/models/terminal-action.md +++ /dev/null @@ -1,46 +0,0 @@ - -# Terminal Action - -Represents an action processed by the Square Terminal. - -## Structure - -`TerminalAction` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique ID for this `TerminalAction`.
**Constraints**: *Minimum Length*: `10`, *Maximum Length*: `255` | -| `deviceId` | `string \| null \| undefined` | Optional | The unique Id of the device intended for this `TerminalAction`.
The Id can be retrieved from /v2/devices api. | -| `deadlineDuration` | `string \| null \| undefined` | Optional | The duration as an RFC 3339 duration, after which the action will be automatically canceled.
TerminalActions that are `PENDING` will be automatically `CANCELED` and have a cancellation reason
of `TIMED_OUT`

Default: 5 minutes from creation

Maximum: 5 minutes | -| `status` | `string \| undefined` | Optional | The status of the `TerminalAction`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` | -| `cancelReason` | [`string \| undefined`](../../doc/models/action-cancel-reason.md) | Optional | - | -| `createdAt` | `string \| undefined` | Optional | The time when the `TerminalAction` was created as an RFC 3339 timestamp. | -| `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. | -| `locationId` | `string \| undefined` | Optional | The location id the action is attached to, if a link can be made.
**Constraints**: *Maximum Length*: `64` | -| `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 \| null \| 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 \| null \| 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) - -```json -{ - "id": "id8", - "device_id": "device_id4", - "deadline_duration": "deadline_duration0", - "status": "status0", - "cancel_reason": "TIMED_OUT" -} -``` - diff --git a/doc/models/terminal-checkout-query-filter.md b/doc/models/terminal-checkout-query-filter.md deleted file mode 100644 index 7fbdabcac..000000000 --- a/doc/models/terminal-checkout-query-filter.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Terminal Checkout Query Filter - -## Structure - -`TerminalCheckoutQueryFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `deviceId` | `string \| null \| undefined` | Optional | The `TerminalCheckout` objects associated with a specific device. If no device is specified, then all
`TerminalCheckout` objects for the merchant are displayed. | -| `createdAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `status` | `string \| null \| undefined` | Optional | Filtered results with the desired status of the `TerminalCheckout`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` | - -## Example (as JSON) - -```json -{ - "device_id": "device_id4", - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "status": "status0" -} -``` - diff --git a/doc/models/terminal-checkout-query-sort.md b/doc/models/terminal-checkout-query-sort.md deleted file mode 100644 index 44d0be828..000000000 --- a/doc/models/terminal-checkout-query-sort.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Terminal Checkout Query Sort - -## Structure - -`TerminalCheckoutQuerySort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sortOrder` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | - -## Example (as JSON) - -```json -{ - "sort_order": "DESC" -} -``` - diff --git a/doc/models/terminal-checkout-query.md b/doc/models/terminal-checkout-query.md deleted file mode 100644 index 1926229aa..000000000 --- a/doc/models/terminal-checkout-query.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Terminal Checkout Query - -## Structure - -`TerminalCheckoutQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`TerminalCheckoutQueryFilter \| undefined`](../../doc/models/terminal-checkout-query-filter.md) | Optional | - | -| `sort` | [`TerminalCheckoutQuerySort \| undefined`](../../doc/models/terminal-checkout-query-sort.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "filter": { - "device_id": "device_id0", - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "status": "status6" - }, - "sort": { - "sort_order": "DESC" - } -} -``` - diff --git a/doc/models/terminal-checkout.md b/doc/models/terminal-checkout.md deleted file mode 100644 index 66a7bafd8..000000000 --- a/doc/models/terminal-checkout.md +++ /dev/null @@ -1,71 +0,0 @@ - -# Terminal Checkout - -Represents a checkout processed by the Square Terminal. - -## Structure - -`TerminalCheckout` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique ID for this `TerminalCheckout`.
**Constraints**: *Minimum Length*: `10`, *Maximum Length*: `255` | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `referenceId` | `string \| null \| undefined` | Optional | An optional user-defined reference ID that can be used to associate
this `TerminalCheckout` to another entity in an external system. For example, an order
ID generated by a third-party shopping cart. The ID is also associated with any payments
used to complete the checkout.
**Constraints**: *Maximum Length*: `40` | -| `note` | `string \| null \| undefined` | Optional | An optional note to associate with the checkout, as well as with any payments used to complete the checkout.
Note: maximum 500 characters
**Constraints**: *Maximum Length*: `500` | -| `orderId` | `string \| null \| undefined` | Optional | The reference to the Square order ID for the checkout request. Supported only in the US. | -| `paymentOptions` | [`PaymentOptions \| undefined`](../../doc/models/payment-options.md) | Optional | - | -| `deviceOptions` | [`DeviceCheckoutOptions`](../../doc/models/device-checkout-options.md) | Required | - | -| `deadlineDuration` | `string \| null \| undefined` | Optional | An RFC 3339 duration, after which the checkout is automatically canceled.
A `TerminalCheckout` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
of `TIMED_OUT`.

Default: 5 minutes from creation

Maximum: 5 minutes | -| `status` | `string \| undefined` | Optional | The status of the `TerminalCheckout`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` | -| `cancelReason` | [`string \| undefined`](../../doc/models/action-cancel-reason.md) | Optional | - | -| `paymentIds` | `string[] \| undefined` | Optional | A list of IDs for payments created by this `TerminalCheckout`. | -| `createdAt` | `string \| undefined` | Optional | The time when the `TerminalCheckout` was created, as an RFC 3339 timestamp. | -| `updatedAt` | `string \| undefined` | Optional | The time when the `TerminalCheckout` was last updated, as an RFC 3339 timestamp. | -| `appId` | `string \| undefined` | Optional | The ID of the application that created the checkout. | -| `locationId` | `string \| undefined` | Optional | The location of the device where the `TerminalCheckout` was directed.
**Constraints**: *Maximum Length*: `64` | -| `paymentType` | [`string \| undefined`](../../doc/models/checkout-options-payment-type.md) | Optional | - | -| `teamMemberId` | `string \| null \| undefined` | Optional | An optional ID of the team member associated with creating the checkout. | -| `customerId` | `string \| null \| undefined` | Optional | An optional ID of the customer associated with the checkout. | -| `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. | -| `statementDescriptionIdentifier` | `string \| null \| undefined` | Optional | Optional additional payment information to include on the customer's card statement as
part of the statement description. This can be, for example, an invoice number, ticket number,
or short description that uniquely identifies the purchase. Supported only in the US.
**Constraints**: *Maximum Length*: `20` | -| `tipMoney` | [`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 -{ - "id": "id6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "reference_id": "reference_id6", - "note": "note8", - "order_id": "order_id0", - "payment_options": { - "autocomplete": false, - "delay_duration": "delay_duration2", - "accept_partial_authorization": false, - "delay_action": "CANCEL" - }, - "device_options": { - "device_id": "device_id6", - "skip_receipt_screen": false, - "collect_signature": false, - "tip_settings": { - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 48 - ], - "smart_tipping": false - }, - "show_itemized_cart": false - } -} -``` - diff --git a/doc/models/terminal-refund-query-filter.md b/doc/models/terminal-refund-query-filter.md deleted file mode 100644 index 990a01c21..000000000 --- a/doc/models/terminal-refund-query-filter.md +++ /dev/null @@ -1,28 +0,0 @@ - -# Terminal Refund Query Filter - -## Structure - -`TerminalRefundQueryFilter` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `deviceId` | `string \| null \| undefined` | Optional | `TerminalRefund` objects associated with a specific device. If no device is specified, then all
`TerminalRefund` objects for the signed-in account are displayed. | -| `createdAt` | [`TimeRange \| undefined`](../../doc/models/time-range.md) | Optional | Represents a generic time range. The start and end values are
represented in RFC 3339 format. Time ranges are customized to be
inclusive or exclusive based on the needs of a particular endpoint.
Refer to the relevant endpoint-specific documentation to determine
how time ranges are handled. | -| `status` | `string \| null \| undefined` | Optional | Filtered results with the desired status of the `TerminalRefund`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. | - -## Example (as JSON) - -```json -{ - "device_id": "device_id4", - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "status": "status0" -} -``` - diff --git a/doc/models/terminal-refund-query-sort.md b/doc/models/terminal-refund-query-sort.md deleted file mode 100644 index 9c596f957..000000000 --- a/doc/models/terminal-refund-query-sort.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Terminal Refund Query Sort - -## Structure - -`TerminalRefundQuerySort` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `sortOrder` | `string \| null \| undefined` | Optional | The order in which results are listed.

- `ASC` - Oldest to newest.
- `DESC` - Newest to oldest (default). | - -## Example (as JSON) - -```json -{ - "sort_order": "sort_order0" -} -``` - diff --git a/doc/models/terminal-refund-query.md b/doc/models/terminal-refund-query.md deleted file mode 100644 index 3a4e78e34..000000000 --- a/doc/models/terminal-refund-query.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Terminal Refund Query - -## Structure - -`TerminalRefundQuery` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `filter` | [`TerminalRefundQueryFilter \| undefined`](../../doc/models/terminal-refund-query-filter.md) | Optional | - | -| `sort` | [`TerminalRefundQuerySort \| undefined`](../../doc/models/terminal-refund-query-sort.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "filter": { - "device_id": "device_id0", - "created_at": { - "start_at": "start_at4", - "end_at": "end_at8" - }, - "status": "status6" - }, - "sort": { - "sort_order": "sort_order8" - } -} -``` - diff --git a/doc/models/terminal-refund.md b/doc/models/terminal-refund.md deleted file mode 100644 index db2be085f..000000000 --- a/doc/models/terminal-refund.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Terminal Refund - -Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. - -## Structure - -`TerminalRefund` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique ID for this `TerminalRefund`.
**Constraints**: *Minimum Length*: `10`, *Maximum Length*: `255` | -| `refundId` | `string \| undefined` | Optional | The reference to the payment refund created by completing this `TerminalRefund`. | -| `paymentId` | `string` | Required | The unique ID of the payment being refunded.
**Constraints**: *Minimum Length*: `1` | -| `orderId` | `string \| undefined` | Optional | The reference to the Square order ID for the payment identified by the `payment_id`. | -| `amountMoney` | [`Money`](../../doc/models/money.md) | Required | 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. | -| `reason` | `string` | Required | A description of the reason for the refund.
**Constraints**: *Maximum Length*: `192` | -| `deviceId` | `string` | Required | The unique ID of the device intended for this `TerminalRefund`.
The Id can be retrieved from /v2/devices api. | -| `deadlineDuration` | `string \| null \| undefined` | Optional | The RFC 3339 duration, after which the refund is automatically canceled.
A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason
of `TIMED_OUT`.

Default: 5 minutes from creation.

Maximum: 5 minutes | -| `status` | `string \| undefined` | Optional | The status of the `TerminalRefund`.
Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. | -| `cancelReason` | [`string \| undefined`](../../doc/models/action-cancel-reason.md) | Optional | - | -| `createdAt` | `string \| undefined` | Optional | The time when the `TerminalRefund` was created, as an RFC 3339 timestamp. | -| `updatedAt` | `string \| undefined` | Optional | The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp. | -| `appId` | `string \| undefined` | Optional | The ID of the application that created the refund. | -| `locationId` | `string \| undefined` | Optional | The location of the device where the `TerminalRefund` was directed.
**Constraints**: *Maximum Length*: `64` | - -## Example (as JSON) - -```json -{ - "id": "id8", - "refund_id": "refund_id2", - "payment_id": "payment_id8", - "order_id": "order_id2", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "reason": "reason6", - "device_id": "device_id4", - "deadline_duration": "deadline_duration0", - "status": "status0" -} -``` - diff --git a/doc/models/test-webhook-subscription-request.md b/doc/models/test-webhook-subscription-request.md deleted file mode 100644 index 405461362..000000000 --- a/doc/models/test-webhook-subscription-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Test Webhook Subscription Request - -Tests a [Subscription](../../doc/models/webhook-subscription.md) by sending a test event to its notification URL. - -## Structure - -`TestWebhookSubscriptionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `eventType` | `string \| null \| undefined` | Optional | The event type that will be used to test the [Subscription](entity:WebhookSubscription). The event type must be
contained in the list of event types in the [Subscription](entity:WebhookSubscription). | - -## Example (as JSON) - -```json -{ - "event_type": "payment.created" -} -``` - diff --git a/doc/models/test-webhook-subscription-response.md b/doc/models/test-webhook-subscription-response.md deleted file mode 100644 index 1ce9b46f6..000000000 --- a/doc/models/test-webhook-subscription-response.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Test Webhook Subscription Response - -Defines the fields that are included in the response body of -a request to the [TestWebhookSubscription](../../doc/api/webhook-subscriptions.md#test-webhook-subscription) endpoint. - -Note: If there are errors processing the request, the [SubscriptionTestResult](../../doc/models/subscription-test-result.md) field is not -present. - -## Structure - -`TestWebhookSubscriptionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `subscriptionTestResult` | [`SubscriptionTestResult \| undefined`](../../doc/models/subscription-test-result.md) | Optional | Represents the details of a webhook subscription, including notification URL,
event types, and signature key. | - -## Example (as JSON) - -```json -{ - "subscription_test_result": { - "created_at": "2022-01-11 00:06:48.322945116 +0000 UTC m=+3863.054453746", - "id": "23eed5a9-2b12-403e-b212-7e2889aea0f6", - "payload": "{\"merchant_id\":\"1ZYMKZY1YFGBW\",\"type\":\"payment.created\",\"event_id\":\"23eed5a9-2b12-403e-b212-7e2889aea0f6\",\"created_at\":\"2022-01-11T00:06:48.322945116Z\",\"data\":{\"type\":\"payment\",\"id\":\"KkAkhdMsgzn59SM8A89WgKwekxLZY\",\"object\":{\"payment\":{\"amount_money\":{\"amount\":100,\"currency\":\"USD\"},\"approved_money\":{\"amount\":100,\"currency\":\"USD\"},\"capabilities\":[\"EDIT_TIP_AMOUNT\",\"EDIT_TIP_AMOUNT_UP\",\"EDIT_TIP_AMOUNT_DOWN\"],\"card_details\":{\"avs_status\":\"AVS_ACCEPTED\",\"card\":{\"bin\":\"540988\",\"card_brand\":\"MASTERCARD\",\"card_type\":\"CREDIT\",\"exp_month\":11,\"exp_year\":2022,\"fingerprint\":\"sq-1-Tvruf3vPQxlvI6n0IcKYfBukrcv6IqWr8UyBdViWXU2yzGn5VMJvrsHMKpINMhPmVg\",\"last_4\":\"9029\",\"prepaid_type\":\"NOT_PREPAID\"},\"card_payment_timeline\":{\"authorized_at\":\"2020-11-22T21:16:51.198Z\"},\"cvv_status\":\"CVV_ACCEPTED\",\"entry_method\":\"KEYED\",\"statement_description\":\"SQ *DEFAULT TEST ACCOUNT\",\"status\":\"AUTHORIZED\"},\"created_at\":\"2020-11-22T21:16:51.086Z\",\"delay_action\":\"CANCEL\",\"delay_duration\":\"PT168H\",\"delayed_until\":\"2020-11-29T21:16:51.086Z\",\"id\":\"hYy9pRFVxpDsO1FB05SunFWUe9JZY\",\"location_id\":\"S8GWD5R9QB376\",\"order_id\":\"03O3USaPaAaFnI6kkwB1JxGgBsUZY\",\"receipt_number\":\"hYy9\",\"risk_evaluation\":{\"created_at\":\"2020-11-22T21:16:51.198Z\",\"risk_level\":\"NORMAL\"},\"source_type\":\"CARD\",\"status\":\"APPROVED\",\"total_money\":{\"amount\":100,\"currency\":\"USD\"},\"updated_at\":\"2020-11-22T21:16:51.198Z\",\"version_token\":\"FfQhQJf9r3VSQIgyWBk1oqhIwiznLwVwJbVVA0bdyEv6o\"}}}}", - "status_code": 404, - "updated_at": "2022-01-11 00:06:48.322945116 +0000 UTC m=+3863.054453746" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/time-range.md b/doc/models/time-range.md deleted file mode 100644 index 8e1775f14..000000000 --- a/doc/models/time-range.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Time Range - -Represents a generic time range. The start and end values are -represented in RFC 3339 format. Time ranges are customized to be -inclusive or exclusive based on the needs of a particular endpoint. -Refer to the relevant endpoint-specific documentation to determine -how time ranges are handled. - -## Structure - -`TimeRange` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `startAt` | `string \| null \| undefined` | Optional | A datetime value in RFC 3339 format indicating when the time range
starts. | -| `endAt` | `string \| null \| undefined` | Optional | A datetime value in RFC 3339 format indicating when the time range
ends. | - -## Example (as JSON) - -```json -{ - "start_at": "start_at2", - "end_at": "end_at0" -} -``` - diff --git a/doc/models/tip-settings.md b/doc/models/tip-settings.md deleted file mode 100644 index 627446bc3..000000000 --- a/doc/models/tip-settings.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Tip Settings - -## Structure - -`TipSettings` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `allowTipping` | `boolean \| null \| undefined` | Optional | Indicates whether tipping is enabled for this checkout. Defaults to false. | -| `separateTipScreen` | `boolean \| null \| undefined` | Optional | Indicates whether tip options should be presented on the screen before presenting
the signature screen during card payment. Defaults to false. | -| `customTipField` | `boolean \| null \| undefined` | Optional | Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false. | -| `tipPercentages` | `number[] \| null \| undefined` | Optional | A list of tip percentages that should be presented during the checkout flow, specified as
up to 3 non-negative integers from 0 to 100 (inclusive). Defaults to 15, 20, and 25. | -| `smartTipping` | `boolean \| null \| undefined` | Optional | Enables the "Smart Tip Amounts" behavior.
Exact tipping options depend on the region in which the Square seller is active.

For payments under 10.00, in the Australia, Canada, Ireland, United Kingdom, and United States, tipping options are presented as no tip, .50, 1.00 or 2.00.

For payment amounts of 10.00 or greater, tipping options are presented as the following percentages: 0%, 5%, 10%, 15%.

If set to true, the `tip_percentages` settings is ignored.
Defaults to false.

To learn more about smart tipping, see [Accept Tips with the Square App](https://squareup.com/help/us/en/article/5069-accept-tips-with-the-square-app). | - -## Example (as JSON) - -```json -{ - "allow_tipping": false, - "separate_tip_screen": false, - "custom_tip_field": false, - "tip_percentages": [ - 66, - 67, - 68 - ], - "smart_tipping": false -} -``` - diff --git a/doc/models/transaction-product.md b/doc/models/transaction-product.md deleted file mode 100644 index d6237d9c6..000000000 --- a/doc/models/transaction-product.md +++ /dev/null @@ -1,22 +0,0 @@ - -# Transaction Product - -Indicates the Square product used to process a transaction. - -## Enumeration - -`TransactionProduct` - -## Fields - -| Name | Description | -| --- | --- | -| `REGISTER` | Square Point of Sale. | -| `EXTERNAL_API` | The Square Connect API. | -| `BILLING` | A Square subscription for one of multiple products. | -| `APPOINTMENTS` | Square Appointments. | -| `INVOICES` | Square Invoices. | -| `ONLINE_STORE` | Square Online Store. | -| `PAYROLL` | Square Payroll. | -| `OTHER` | A Square product that does not match any other value. | - diff --git a/doc/models/transaction-type.md b/doc/models/transaction-type.md deleted file mode 100644 index fdc3351a4..000000000 --- a/doc/models/transaction-type.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Transaction Type - -The transaction type used in the disputed payment. - -## Enumeration - -`TransactionType` - -## Fields - -| Name | -| --- | -| `DEBIT` | -| `CREDIT` | - diff --git a/doc/models/transaction.md b/doc/models/transaction.md deleted file mode 100644 index 59900cd37..000000000 --- a/doc/models/transaction.md +++ /dev/null @@ -1,177 +0,0 @@ - -# Transaction - -Represents a transaction processed with Square, either with the -Connect API or with Square Point of Sale. - -The `tenders` field of this object lists all methods of payment used to pay in -the transaction. - -## Structure - -`Transaction` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The transaction's unique ID, issued by Square payments servers.
**Constraints**: *Maximum Length*: `192` | -| `locationId` | `string \| null \| undefined` | Optional | The ID of the transaction's associated location.
**Constraints**: *Maximum Length*: `50` | -| `createdAt` | `string \| undefined` | Optional | The timestamp for when the transaction was created, in RFC 3339 format.
**Constraints**: *Maximum Length*: `32` | -| `tenders` | [`Tender[] \| null \| undefined`](../../doc/models/tender.md) | Optional | The tenders used to pay in the transaction. | -| `refunds` | [`Refund[] \| null \| undefined`](../../doc/models/refund.md) | Optional | Refunds that have been applied to any tender in the transaction. | -| `referenceId` | `string \| null \| undefined` | Optional | If the transaction was created with the [Charge](api-endpoint:Transactions-Charge)
endpoint, this value is the same as the value provided for the `reference_id`
parameter in the request to that endpoint. Otherwise, it is not set.
**Constraints**: *Maximum Length*: `40` | -| `product` | [`string \| undefined`](../../doc/models/transaction-product.md) | Optional | Indicates the Square product used to process a transaction. | -| `clientId` | `string \| null \| undefined` | Optional | If the transaction was created in the Square Point of Sale app, this value
is the ID generated for the transaction by Square Point of Sale.

This ID has no relationship to the transaction's canonical `id`, which is
generated by Square's backend servers. This value is generated for bookkeeping
purposes, in case the transaction cannot immediately be completed (for example,
if the transaction is processed in offline mode).

It is not currently possible with the Connect API to perform a transaction
lookup by this value.
**Constraints**: *Maximum Length*: `192` | -| `shippingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `orderId` | `string \| null \| undefined` | Optional | The order_id is an identifier for the order associated with this transaction, if any.
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "id": "id4", - "location_id": "location_id8", - "created_at": "created_at8", - "tenders": [ - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "created_at": "created_at6", - "note": "note4", - "type": "THIRD_PARTY_CARD" - }, - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "created_at": "created_at6", - "note": "note4", - "type": "THIRD_PARTY_CARD" - }, - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "created_at": "created_at6", - "note": "note4", - "type": "THIRD_PARTY_CARD" - } - ], - "refunds": [ - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - }, - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - }, - { - "id": "id8", - "location_id": "location_id2", - "transaction_id": "transaction_id6", - "tender_id": "tender_id6", - "created_at": "created_at6", - "reason": "reason4", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "status": "PENDING", - "processing_fee_money": { - "amount": 112, - "currency": "DJF" - }, - "additional_recipients": [ - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - }, - { - "location_id": "location_id0", - "description": "description6", - "amount_money": { - "amount": 186, - "currency": "AUD" - }, - "receivable_id": "receivable_id6" - } - ] - } - ] -} -``` - diff --git a/doc/models/unlink-customer-from-gift-card-request.md b/doc/models/unlink-customer-from-gift-card-request.md deleted file mode 100644 index 5148a9beb..000000000 --- a/doc/models/unlink-customer-from-gift-card-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Unlink Customer From Gift Card Request - -A request to unlink a customer from a gift card. - -## Structure - -`UnlinkCustomerFromGiftCardRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customerId` | `string` | Required | The ID of the customer to unlink from the gift card.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `191` | - -## Example (as JSON) - -```json -{ - "customer_id": "GKY0FZ3V717AH8Q2D821PNT2ZW" -} -``` - diff --git a/doc/models/unlink-customer-from-gift-card-response.md b/doc/models/unlink-customer-from-gift-card-response.md deleted file mode 100644 index b9225e48f..000000000 --- a/doc/models/unlink-customer-from-gift-card-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Unlink Customer From Gift Card Response - -A response that contains the unlinked `GiftCard` object. If the request resulted in errors, -the response contains a set of `Error` objects. - -## Structure - -`UnlinkCustomerFromGiftCardResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `giftCard` | [`GiftCard \| undefined`](../../doc/models/gift-card.md) | Optional | Represents a Square gift card. | - -## Example (as JSON) - -```json -{ - "gift_card": { - "balance_money": { - "amount": 2500, - "currency": "USD" - }, - "created_at": "2021-03-25T05:13:01Z", - "gan": "7783320005440920", - "gan_source": "SQUARE", - "id": "gftc:71ea002277a34f8a945e284b04822edb", - "state": "ACTIVE", - "type": "DIGITAL" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-booking-custom-attribute-definition-request.md b/doc/models/update-booking-custom-attribute-definition-request.md deleted file mode 100644 index 4a779aa11..000000000 --- a/doc/models/update-booking-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Update Booking Custom Attribute Definition Request - -Represents an [UpdateBookingCustomAttributeDefinition](../../doc/api/booking-custom-attributes.md#update-booking-custom-attribute-definition) request. - -## Structure - -`UpdateBookingCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "key": "key2", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name2", - "description": "description8", - "visibility": "VISIBILITY_HIDDEN" - }, - "idempotency_key": "idempotency_key2" -} -``` - diff --git a/doc/models/update-booking-custom-attribute-definition-response.md b/doc/models/update-booking-custom-attribute-definition-response.md deleted file mode 100644 index ffe9539db..000000000 --- a/doc/models/update-booking-custom-attribute-definition-response.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Update Booking Custom Attribute Definition Response - -Represents an [UpdateBookingCustomAttributeDefinition](../../doc/api/booking-custom-attributes.md#update-booking-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`UpdateBookingCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-11-16T15:27:30Z", - "description": "Update the description as desired.", - "key": "favoriteShampoo", - "name": "Favorite shampoo", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T15:39:38Z", - "version": 2, - "visibility": "VISIBILITY_READ_ONLY" - }, - "errors": [] -} -``` - diff --git a/doc/models/update-booking-request.md b/doc/models/update-booking-request.md deleted file mode 100644 index 6f75bbb8d..000000000 --- a/doc/models/update-booking-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Update Booking Request - -## Structure - -`UpdateBookingRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique key to make this request an idempotent operation.
**Constraints**: *Maximum Length*: `255` | -| `booking` | [`Booking`](../../doc/models/booking.md) | Required | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "idempotency_key4", - "booking": { - "id": "id4", - "version": 156, - "status": "CANCELLED_BY_SELLER", - "created_at": "created_at2", - "updated_at": "updated_at0" - } -} -``` - diff --git a/doc/models/update-booking-response.md b/doc/models/update-booking-response.md deleted file mode 100644 index ceeed45fb..000000000 --- a/doc/models/update-booking-response.md +++ /dev/null @@ -1,50 +0,0 @@ - -# Update Booking Response - -## Structure - -`UpdateBookingResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `booking` | [`Booking \| undefined`](../../doc/models/booking.md) | Optional | Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service
at a given location to a requesting customer in one or more appointment segments. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "booking": { - "address": { - "address_line_1": "1955 Broadway", - "address_line_2": "Suite 600", - "administrative_district_level_1": "CA", - "locality": "Oakland", - "postal_code": "94612" - }, - "appointment_segments": [ - { - "duration_minutes": 60, - "service_variation_id": "RU3PBTZTK7DXZDQFCJHOK2MC", - "service_variation_version": 1599775456731, - "team_member_id": "TMXUrsBWWcHTt79t" - } - ], - "created_at": "2020-10-28T15:47:41Z", - "customer_id": "EX2QSVGTZN4K1E5QE1CBFNVQ8M", - "customer_note": "I would like to sit near the window please", - "id": "zkras0xv0xwswx", - "location_id": "LEQHH0YY8B42M", - "location_type": "CUSTOMER_LOCATION", - "seller_note": "", - "start_at": "2020-11-26T13:00:00Z", - "status": "ACCEPTED", - "updated_at": "2020-10-28T15:49:25Z", - "version": 2 - }, - "errors": [] -} -``` - diff --git a/doc/models/update-break-type-request.md b/doc/models/update-break-type-request.md deleted file mode 100644 index e2d0cb9de..000000000 --- a/doc/models/update-break-type-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Update Break Type Request - -A request to update a `BreakType`. - -## Structure - -`UpdateBreakTypeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `breakType` | [`BreakType`](../../doc/models/break-type.md) | Required | A defined break template that sets an expectation for possible `Break`
instances on a `Shift`. | - -## Example (as JSON) - -```json -{ - "break_type": { - "break_name": "Lunch", - "expected_duration": "PT50M", - "is_paid": true, - "location_id": "26M7H24AZ9N6R", - "version": 1, - "id": "id8", - "created_at": "created_at6", - "updated_at": "updated_at4" - } -} -``` - diff --git a/doc/models/update-break-type-response.md b/doc/models/update-break-type-response.md deleted file mode 100644 index e1e54fb8e..000000000 --- a/doc/models/update-break-type-response.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Update Break Type Response - -A response to a request to update a `BreakType`. The response contains -the requested `BreakType` objects and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`UpdateBreakTypeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `breakType` | [`BreakType \| undefined`](../../doc/models/break-type.md) | Optional | A defined break template that sets an expectation for possible `Break`
instances on a `Shift`. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "break_type": { - "break_name": "Lunch", - "created_at": "2018-06-12T20:19:12Z", - "expected_duration": "PT50M", - "id": "Q6JSJS6D4DBCH", - "is_paid": true, - "location_id": "26M7H24AZ9N6R", - "updated_at": "2019-02-26T23:12:59Z", - "version": 2 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-catalog-image-request.md b/doc/models/update-catalog-image-request.md deleted file mode 100644 index f5085fea2..000000000 --- a/doc/models/update-catalog-image-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Update Catalog Image Request - -## Structure - -`UpdateCatalogImageRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A unique string that identifies this UpdateCatalogImage request.
Keys can be any valid string but must be unique for every UpdateCatalogImage request.

See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
**Constraints**: *Minimum Length*: `1` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "528dea59-7bfb-43c1-bd48-4a6bba7dd61f86", - "image": { - "image_data": { - "caption": "A picture of a cup of coffee", - "name": "Coffee" - }, - "type": "IMAGE" - }, - "object_id": "ND6EA5AAJEO5WL3JNNIAQA32" -} -``` - diff --git a/doc/models/update-catalog-image-response.md b/doc/models/update-catalog-image-response.md deleted file mode 100644 index ea7161e1e..000000000 --- a/doc/models/update-catalog-image-response.md +++ /dev/null @@ -1,77 +0,0 @@ - -# Update Catalog Image Response - -## Structure - -`UpdateCatalogImageResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `image` | [`CatalogObject \| undefined`](../../doc/models/catalog-object.md) | Optional | The wrapper object for the catalog entries of a given object type.

Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.

For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.

In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.

For a more detailed discussion of the Catalog data model, please see the
[Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. | - -## Example (as JSON) - -```json -{ - "image": { - "id": "L52QOQN2SW3M5QTF9JOCQKNB", - "image_data": { - "caption": "A picture of a cup of coffee", - "name": "Coffee", - "url": "https://..." - }, - "type": "IMAGE", - "updated_at": "updated_at2", - "version": 100, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-customer-custom-attribute-definition-request.md b/doc/models/update-customer-custom-attribute-definition-request.md deleted file mode 100644 index 082b412ec..000000000 --- a/doc/models/update-customer-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Update Customer Custom Attribute Definition Request - -Represents an [UpdateCustomerCustomAttributeDefinition](../../doc/api/customer-custom-attributes.md#update-customer-custom-attribute-definition) request. - -## Structure - -`UpdateCustomerCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "description": "Update the description as desired.", - "visibility": "VISIBILITY_READ_ONLY", - "key": "key2", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name2" - }, - "idempotency_key": "idempotency_key2" -} -``` - diff --git a/doc/models/update-customer-custom-attribute-definition-response.md b/doc/models/update-customer-custom-attribute-definition-response.md deleted file mode 100644 index 56b2aa200..000000000 --- a/doc/models/update-customer-custom-attribute-definition-response.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Update Customer Custom Attribute Definition Response - -Represents an [UpdateCustomerCustomAttributeDefinition](../../doc/api/customer-custom-attributes.md#update-customer-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`UpdateCustomerCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-04-26T15:27:30Z", - "description": "Update the description as desired.", - "key": "favoritemovie", - "name": "Favorite Movie", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-04-26T15:39:38Z", - "version": 2, - "visibility": "VISIBILITY_READ_ONLY" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-customer-group-request.md b/doc/models/update-customer-group-request.md deleted file mode 100644 index 16e60f99b..000000000 --- a/doc/models/update-customer-group-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Update Customer Group Request - -Defines the body parameters that can be included in a request to the -[UpdateCustomerGroup](../../doc/api/customer-groups.md#update-customer-group) endpoint. - -## Structure - -`UpdateCustomerGroupRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `group` | [`CustomerGroup`](../../doc/models/customer-group.md) | Required | Represents a group of customer profiles.

Customer groups can be created, be modified, and have their membership defined using
the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. | - -## Example (as JSON) - -```json -{ - "group": { - "name": "Loyal Customers", - "id": "id8", - "created_at": "created_at4", - "updated_at": "updated_at6" - } -} -``` - diff --git a/doc/models/update-customer-group-response.md b/doc/models/update-customer-group-response.md deleted file mode 100644 index 9c0c1ddea..000000000 --- a/doc/models/update-customer-group-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# Update Customer Group Response - -Defines the fields that are included in the response body of -a request to the [UpdateCustomerGroup](../../doc/api/customer-groups.md#update-customer-group) endpoint. - -Either `errors` or `group` is present in a given response (never both). - -## Structure - -`UpdateCustomerGroupResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `group` | [`CustomerGroup \| undefined`](../../doc/models/customer-group.md) | Optional | Represents a group of customer profiles.

Customer groups can be created, be modified, and have their membership defined using
the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. | - -## Example (as JSON) - -```json -{ - "group": { - "created_at": "2020-04-13T21:54:57.863Z", - "id": "2TAT3CMH4Q0A9M87XJZED0WMR3", - "name": "Loyal Customers", - "updated_at": "2020-04-13T21:54:58Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-customer-request.md b/doc/models/update-customer-request.md deleted file mode 100644 index 1c8ae30f3..000000000 --- a/doc/models/update-customer-request.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Update Customer Request - -Defines the body parameters that can be included in a request to the -`UpdateCustomer` endpoint. - -## Structure - -`UpdateCustomerRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `givenName` | `string \| null \| undefined` | Optional | The given name (that is, the first name) associated with the customer profile.

The maximum length for this value is 300 characters. | -| `familyName` | `string \| null \| undefined` | Optional | The family name (that is, the last name) associated with the customer profile.

The maximum length for this value is 300 characters. | -| `companyName` | `string \| null \| undefined` | Optional | A business name associated with the customer profile.

The maximum length for this value is 500 characters. | -| `nickname` | `string \| null \| undefined` | Optional | A nickname for the customer profile.

The maximum length for this value is 100 characters. | -| `emailAddress` | `string \| null \| undefined` | Optional | The email address associated with the customer profile.

The maximum length for this value is 254 characters. | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number associated with the customer profile. The phone number must be valid and can contain
9–16 digits, with an optional `+` prefix and country code. For more information, see
[Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). | -| `referenceId` | `string \| null \| undefined` | Optional | An optional second ID used to associate the customer profile with an
entity in another system.

The maximum length for this value is 100 characters. | -| `note` | `string \| null \| undefined` | Optional | A custom note associated with the customer profile. | -| `birthday` | `string \| null \| undefined` | Optional | The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified. | -| `version` | `bigint \| undefined` | Optional | The current version of the customer profile.

As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile). | -| `taxIds` | [`CustomerTaxIds \| undefined`](../../doc/models/customer-tax-ids.md) | Optional | Represents the tax ID associated with a [customer profile](../../doc/models/customer.md). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom.
For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). | - -## Example (as JSON) - -```json -{ - "email_address": "New.Amelia.Earhart@example.com", - "note": "updated customer note", - "phone_number": null, - "version": 2, - "given_name": "given_name0", - "family_name": "family_name8", - "company_name": "company_name4", - "nickname": "nickname4" -} -``` - diff --git a/doc/models/update-customer-response.md b/doc/models/update-customer-response.md deleted file mode 100644 index 1b3673395..000000000 --- a/doc/models/update-customer-response.md +++ /dev/null @@ -1,73 +0,0 @@ - -# Update Customer Response - -Defines the fields that are included in the response body of -a request to the [UpdateCustomer](../../doc/api/customers.md#update-customer) or -[BulkUpdateCustomers](../../doc/api/customers.md#bulk-update-customers) endpoint. - -Either `errors` or `customer` is present in a given response (never both). - -## Structure - -`UpdateCustomerResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `customer` | [`Customer \| undefined`](../../doc/models/customer.md) | Optional | Represents a Square customer profile in the Customer Directory of a Square seller. | - -## Example (as JSON) - -```json -{ - "customer": { - "address": { - "address_line_1": "500 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003" - }, - "created_at": "2016-03-23T20:21:54.859Z", - "creation_source": "THIRD_PARTY", - "email_address": "New.Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "note": "updated customer note", - "preferences": { - "email_unsubscribed": false - }, - "reference_id": "YOUR_REFERENCE_ID", - "updated_at": "2016-05-15T20:21:55Z", - "version": 3, - "cards": [ - { - "id": "id8", - "card_brand": "DISCOVER", - "last_4": "last_40", - "exp_month": 152, - "exp_year": 144 - } - ] - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-invoice-request.md b/doc/models/update-invoice-request.md deleted file mode 100644 index 65149f5a8..000000000 --- a/doc/models/update-invoice-request.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Update Invoice Request - -Describes a `UpdateInvoice` request. - -## Structure - -`UpdateInvoiceRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | Stores information about an invoice. You use the Invoices API to create and manage
invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique string that identifies the `UpdateInvoice` request. If you do not
provide `idempotency_key` (or provide an empty string as the value), the endpoint
treats each request as independent.

For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `128` | -| `fieldsToClear` | `string[] \| null \| undefined` | Optional | The list of fields to clear. Although this field is currently supported, we
recommend using null values or the `remove` field when possible. For examples, see
[Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices). | - -## Example (as JSON) - -```json -{ - "idempotency_key": "4ee82288-0910-499e-ab4c-5d0071dad1be", - "invoice": { - "payment_requests": [ - { - "reminders": null, - "tipping_enabled": false, - "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355" - } - ], - "version": 1, - "id": "id6", - "location_id": "location_id0", - "order_id": "order_id0", - "primary_recipient": { - "customer_id": "customer_id2", - "given_name": "given_name6", - "family_name": "family_name8", - "email_address": "email_address2", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } - }, - "fields_to_clear": [ - "fields_to_clear1", - "fields_to_clear2", - "fields_to_clear3" - ] -} -``` - diff --git a/doc/models/update-invoice-response.md b/doc/models/update-invoice-response.md deleted file mode 100644 index 32ad0ef7e..000000000 --- a/doc/models/update-invoice-response.md +++ /dev/null @@ -1,108 +0,0 @@ - -# Update Invoice Response - -Describes a `UpdateInvoice` response. - -## Structure - -`UpdateInvoiceResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `invoice` | [`Invoice \| undefined`](../../doc/models/invoice.md) | Optional | Stores information about an invoice. You use the Invoices API to create and manage
invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | - -## Example (as JSON) - -```json -{ - "invoice": { - "accepted_payment_methods": { - "bank_account": false, - "buy_now_pay_later": false, - "card": true, - "cash_app_pay": false, - "square_gift_card": false - }, - "created_at": "2020-06-18T17:45:13Z", - "custom_fields": [ - { - "label": "Event Reference Number", - "placement": "ABOVE_LINE_ITEMS", - "value": "Ref. #1234" - }, - { - "label": "Terms of Service", - "placement": "BELOW_LINE_ITEMS", - "value": "The terms of service are..." - } - ], - "delivery_method": "EMAIL", - "description": "We appreciate your business!", - "id": "inv:0-ChCHu2mZEabLeeHahQnXDjZQECY", - "invoice_number": "inv-100", - "location_id": "ES0RJRZYEC39A", - "next_payment_amount_money": { - "amount": 10000, - "currency": "USD" - }, - "order_id": "CAISENgvlJ6jLWAzERDzjyHVybY", - "payment_requests": [ - { - "automatic_payment_source": "NONE", - "computed_amount_money": { - "amount": 10000, - "currency": "USD" - }, - "due_date": "2030-01-24", - "request_type": "BALANCE", - "tipping_enabled": false, - "total_completed_amount_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "2da7964f-f3d2-4f43-81e8-5aa220bf3355" - } - ], - "primary_recipient": { - "customer_id": "JDKYHBWT1D4F8MFH63DBMEN8Y4", - "email_address": "Amelia.Earhart@example.com", - "family_name": "Earhart", - "given_name": "Amelia", - "phone_number": "1-212-555-4240", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - }, - "sale_or_service_date": "2030-01-24", - "scheduled_at": "2030-01-13T10:00:00Z", - "status": "UNPAID", - "store_payment_method_enabled": false, - "timezone": "America/Los_Angeles", - "title": "Event Planning Services", - "updated_at": "2020-06-18T18:23:11Z", - "version": 2 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-item-modifier-lists-request.md b/doc/models/update-item-modifier-lists-request.md deleted file mode 100644 index 8686442df..000000000 --- a/doc/models/update-item-modifier-lists-request.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Update Item Modifier Lists Request - -## Structure - -`UpdateItemModifierListsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemIds` | `string[]` | Required | The IDs of the catalog items associated with the CatalogModifierList objects being updated. | -| `modifierListsToEnable` | `string[] \| null \| undefined` | Optional | The IDs of the CatalogModifierList objects to enable for the CatalogItem.
At least one of `modifier_lists_to_enable` or `modifier_lists_to_disable` must be specified. | -| `modifierListsToDisable` | `string[] \| null \| undefined` | Optional | The IDs of the CatalogModifierList objects to disable for the CatalogItem.
At least one of `modifier_lists_to_enable` or `modifier_lists_to_disable` must be specified. | - -## Example (as JSON) - -```json -{ - "item_ids": [ - "H42BRLUJ5KTZTTMPVSLFAACQ", - "2JXOBJIHCWBQ4NZ3RIXQGJA6" - ], - "modifier_lists_to_disable": [ - "7WRC16CJZDVLSNDQ35PP6YAD" - ], - "modifier_lists_to_enable": [ - "H42BRLUJ5KTZTTMPVSLFAACQ", - "2JXOBJIHCWBQ4NZ3RIXQGJA6" - ] -} -``` - diff --git a/doc/models/update-item-modifier-lists-response.md b/doc/models/update-item-modifier-lists-response.md deleted file mode 100644 index fe3a22cea..000000000 --- a/doc/models/update-item-modifier-lists-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Update Item Modifier Lists Response - -## Structure - -`UpdateItemModifierListsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `updatedAt` | `string \| undefined` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. | - -## Example (as JSON) - -```json -{ - "updated_at": "2016-11-16T22:25:24.878Z", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-item-taxes-request.md b/doc/models/update-item-taxes-request.md deleted file mode 100644 index e9b239000..000000000 --- a/doc/models/update-item-taxes-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Update Item Taxes Request - -## Structure - -`UpdateItemTaxesRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `itemIds` | `string[]` | Required | IDs for the CatalogItems associated with the CatalogTax objects being updated.
No more than 1,000 IDs may be provided. | -| `taxesToEnable` | `string[] \| null \| undefined` | Optional | IDs of the CatalogTax objects to enable.
At least one of `taxes_to_enable` or `taxes_to_disable` must be specified. | -| `taxesToDisable` | `string[] \| null \| undefined` | Optional | IDs of the CatalogTax objects to disable.
At least one of `taxes_to_enable` or `taxes_to_disable` must be specified. | - -## Example (as JSON) - -```json -{ - "item_ids": [ - "H42BRLUJ5KTZTTMPVSLFAACQ", - "2JXOBJIHCWBQ4NZ3RIXQGJA6" - ], - "taxes_to_disable": [ - "AQCEGCEBBQONINDOHRGZISEX" - ], - "taxes_to_enable": [ - "4WRCNHCJZDVLSNDQ35PP6YAD" - ] -} -``` - diff --git a/doc/models/update-item-taxes-response.md b/doc/models/update-item-taxes-response.md deleted file mode 100644 index e0d4d268a..000000000 --- a/doc/models/update-item-taxes-response.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Update Item Taxes Response - -## Structure - -`UpdateItemTaxesResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `updatedAt` | `string \| undefined` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. | - -## Example (as JSON) - -```json -{ - "updated_at": "2016-11-16T22:25:24.878Z", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-job-request.md b/doc/models/update-job-request.md deleted file mode 100644 index 997e75cf9..000000000 --- a/doc/models/update-job-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Update Job Request - -Represents an [UpdateJob](../../doc/api/team.md#update-job) request. - -## Structure - -`UpdateJobRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `job` | [`Job`](../../doc/models/job.md) | Required | Represents a job that can be assigned to [team members](../../doc/models/team-member.md). This object defines the
job's title and tip eligibility. Compensation is defined in a [job assignment](../../doc/models/job-assignment.md)
in a team member's wage setting. | - -## Example (as JSON) - -```json -{ - "job": { - "is_tip_eligible": true, - "title": "Cashier 1", - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at8" - } -} -``` - diff --git a/doc/models/update-job-response.md b/doc/models/update-job-response.md deleted file mode 100644 index 6a1b39004..000000000 --- a/doc/models/update-job-response.md +++ /dev/null @@ -1,52 +0,0 @@ - -# Update Job Response - -Represents an [UpdateJob](../../doc/api/team.md#update-job) response. Either `job` or `errors` -is present in the response. - -## Structure - -`UpdateJobResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `job` | [`Job \| undefined`](../../doc/models/job.md) | Optional | Represents a job that can be assigned to [team members](../../doc/models/team-member.md). This object defines the
job's title and tip eligibility. Compensation is defined in a [job assignment](../../doc/models/job-assignment.md)
in a team member's wage setting. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "job": { - "created_at": "2021-06-11T22:55:45Z", - "id": "1yJlHapkseYnNPETIU1B", - "is_tip_eligible": true, - "title": "Cashier 1", - "updated_at": "2021-06-13T12:55:45Z", - "version": 2 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-location-custom-attribute-definition-request.md b/doc/models/update-location-custom-attribute-definition-request.md deleted file mode 100644 index fc60f3722..000000000 --- a/doc/models/update-location-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Update Location Custom Attribute Definition Request - -Represents an [UpdateLocationCustomAttributeDefinition](../../doc/api/location-custom-attributes.md#update-location-custom-attribute-definition) request. - -## Structure - -`UpdateLocationCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "description": "Update the description as desired.", - "visibility": "VISIBILITY_READ_ONLY", - "key": "key2", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name2" - }, - "idempotency_key": "idempotency_key2" -} -``` - diff --git a/doc/models/update-location-custom-attribute-definition-response.md b/doc/models/update-location-custom-attribute-definition-response.md deleted file mode 100644 index a930b05e5..000000000 --- a/doc/models/update-location-custom-attribute-definition-response.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Update Location Custom Attribute Definition Response - -Represents an [UpdateLocationCustomAttributeDefinition](../../doc/api/location-custom-attributes.md#update-location-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`UpdateLocationCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-12-02T19:06:36.559Z", - "description": "Update the description as desired.", - "key": "bestseller", - "name": "Bestseller", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-12-02T19:34:10.181Z", - "version": 2, - "visibility": "VISIBILITY_READ_ONLY" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-location-request.md b/doc/models/update-location-request.md deleted file mode 100644 index 0114fccf5..000000000 --- a/doc/models/update-location-request.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Update Location Request - -The request object for the [UpdateLocation](../../doc/api/locations.md#update-location) endpoint. - -## Structure - -`UpdateLocationRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `location` | [`Location \| undefined`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | - -## Example (as JSON) - -```json -{ - "location": { - "business_hours": { - "periods": [ - { - "day_of_week": "FRI", - "end_local_time": "18:00", - "start_local_time": "07:00" - }, - { - "day_of_week": "SAT", - "end_local_time": "18:00", - "start_local_time": "07:00" - }, - { - "day_of_week": "SUN", - "end_local_time": "15:00", - "start_local_time": "09:00" - } - ] - }, - "description": "Midtown Atlanta store - Open weekends", - "id": "id4", - "name": "name4", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - }, - "timezone": "timezone6", - "capabilities": [ - "CREDIT_CARD_PROCESSING" - ] - } -} -``` - diff --git a/doc/models/update-location-response.md b/doc/models/update-location-response.md deleted file mode 100644 index 1ab5992ce..000000000 --- a/doc/models/update-location-response.md +++ /dev/null @@ -1,87 +0,0 @@ - -# Update Location Response - -The response object returned by the [UpdateLocation](../../doc/api/locations.md#update-location) endpoint. - -## Structure - -`UpdateLocationResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | -| `location` | [`Location \| undefined`](../../doc/models/location.md) | Optional | Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). | - -## Example (as JSON) - -```json -{ - "location": { - "address": { - "address_line_1": "1234 Peachtree St. NE", - "administrative_district_level_1": "GA", - "locality": "Atlanta", - "postal_code": "30309", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "business_hours": { - "periods": [ - { - "day_of_week": "FRI", - "end_local_time": "18:00", - "start_local_time": "07:00" - }, - { - "day_of_week": "SAT", - "end_local_time": "18:00", - "start_local_time": "07:00" - }, - { - "day_of_week": "SUN", - "end_local_time": "15:00", - "start_local_time": "09:00" - } - ] - }, - "business_name": "Jet Fuel Coffee", - "capabilities": [ - "CREDIT_CARD_PROCESSING" - ], - "coordinates": { - "latitude": 33.7889, - "longitude": -84.3841 - }, - "country": "US", - "created_at": "2022-02-19T17:58:25Z", - "currency": "USD", - "description": "Midtown Atlanta store - Open weekends", - "id": "3Z4V4WHQK64X9", - "language_code": "en-US", - "mcc": "7299", - "merchant_id": "3MYCJG5GVYQ8Q", - "name": "Midtown", - "status": "ACTIVE", - "timezone": "America/New_York", - "type": "PHYSICAL" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-location-settings-request.md b/doc/models/update-location-settings-request.md deleted file mode 100644 index d664a9b2b..000000000 --- a/doc/models/update-location-settings-request.md +++ /dev/null @@ -1,68 +0,0 @@ - -# Update Location Settings Request - -## Structure - -`UpdateLocationSettingsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `locationSettings` | [`CheckoutLocationSettings`](../../doc/models/checkout-location-settings.md) | Required | - | - -## Example (as JSON) - -```json -{ - "location_settings": { - "location_id": "location_id0", - "customer_notes_enabled": false, - "policies": [ - { - "uid": "uid8", - "title": "title4", - "description": "description8" - }, - { - "uid": "uid8", - "title": "title4", - "description": "description8" - }, - { - "uid": "uid8", - "title": "title4", - "description": "description8" - } - ], - "branding": { - "header_type": "FULL_WIDTH_LOGO", - "button_color": "button_color2", - "button_shape": "PILL" - }, - "tipping": { - "percentages": [ - 246, - 247 - ], - "smart_tipping_enabled": false, - "default_percent": 46, - "smart_tips": [ - { - "amount": 152, - "currency": "GEL" - }, - { - "amount": 152, - "currency": "GEL" - } - ], - "default_smart_tip": { - "amount": 58, - "currency": "KWD" - } - } - } -} -``` - diff --git a/doc/models/update-location-settings-response.md b/doc/models/update-location-settings-response.md deleted file mode 100644 index 79ddd2a61..000000000 --- a/doc/models/update-location-settings-response.md +++ /dev/null @@ -1,104 +0,0 @@ - -# Update Location Settings Response - -## Structure - -`UpdateLocationSettingsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred when updating the location settings. | -| `locationSettings` | [`CheckoutLocationSettings \| undefined`](../../doc/models/checkout-location-settings.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "location_settings": { - "branding": { - "button_color": "#00b23b", - "button_shape": "ROUNDED", - "header_type": "FRAMED_LOGO" - }, - "customer_notes_enabled": false, - "location_id": "LOCATION_ID_1", - "policies": [ - { - "description": "This is my Return Policy", - "title": "Return Policy", - "uid": "POLICY_ID_1" - }, - { - "description": "Items may be returned within 30 days of purchase.", - "title": "Return Policy", - "uid": "POLICY_ID_2" - } - ], - "tipping": { - "default_percent": 20, - "default_whole_amount_money": { - "amount": 100, - "currency": "USD" - }, - "percentages": [ - 15, - 20, - 25 - ], - "smart_tipping_enabled": true, - "whole_amounts": [ - { - "amount": 1000, - "currency": "USD" - }, - { - "amount": 1500, - "currency": "USD" - }, - { - "amount": 2000, - "currency": "USD" - } - ], - "smart_tips": [ - { - "amount": 152, - "currency": "GEL" - }, - { - "amount": 152, - "currency": "GEL" - } - ], - "default_smart_tip": { - "amount": 58, - "currency": "KWD" - } - }, - "updated_at": "2022-06-16T22:25:35Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-merchant-custom-attribute-definition-request.md b/doc/models/update-merchant-custom-attribute-definition-request.md deleted file mode 100644 index de53405f7..000000000 --- a/doc/models/update-merchant-custom-attribute-definition-request.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Update Merchant Custom Attribute Definition Request - -Represents an [UpdateMerchantCustomAttributeDefinition](../../doc/api/merchant-custom-attributes.md#update-merchant-custom-attribute-definition) request. - -## Structure - -`UpdateMerchantCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "description": "Update the description as desired.", - "visibility": "VISIBILITY_READ_ONLY", - "key": "key2", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name2" - }, - "idempotency_key": "idempotency_key4" -} -``` - diff --git a/doc/models/update-merchant-custom-attribute-definition-response.md b/doc/models/update-merchant-custom-attribute-definition-response.md deleted file mode 100644 index bb89d8822..000000000 --- a/doc/models/update-merchant-custom-attribute-definition-response.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Update Merchant Custom Attribute Definition Response - -Represents an [UpdateMerchantCustomAttributeDefinition](../../doc/api/merchant-custom-attributes.md#update-merchant-custom-attribute-definition) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`UpdateMerchantCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2023-05-05T19:06:36.559Z", - "description": "Update the description as desired.", - "key": "alternative_seller_name", - "name": "Alternative Merchant Name", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2023-05-05T19:34:10.181Z", - "version": 2, - "visibility": "VISIBILITY_READ_ONLY" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-merchant-settings-request.md b/doc/models/update-merchant-settings-request.md deleted file mode 100644 index 6539283ec..000000000 --- a/doc/models/update-merchant-settings-request.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Update Merchant Settings Request - -## Structure - -`UpdateMerchantSettingsRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `merchantSettings` | [`CheckoutMerchantSettings`](../../doc/models/checkout-merchant-settings.md) | Required | - | - -## Example (as JSON) - -```json -{ - "merchant_settings": { - "payment_methods": { - "apple_pay": { - "enabled": false - }, - "google_pay": { - "enabled": false - }, - "cash_app": { - "enabled": false - }, - "afterpay_clearpay": { - "order_eligibility_range": { - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } - }, - "item_eligibility_range": { - "min": { - "amount": 34, - "currency": "OMR" - }, - "max": { - "amount": 140, - "currency": "JPY" - } - }, - "enabled": false - } - }, - "updated_at": "updated_at6" - } -} -``` - diff --git a/doc/models/update-merchant-settings-response.md b/doc/models/update-merchant-settings-response.md deleted file mode 100644 index 30ebba505..000000000 --- a/doc/models/update-merchant-settings-response.md +++ /dev/null @@ -1,76 +0,0 @@ - -# Update Merchant Settings Response - -## Structure - -`UpdateMerchantSettingsResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred when updating the merchant settings. | -| `merchantSettings` | [`CheckoutMerchantSettings \| undefined`](../../doc/models/checkout-merchant-settings.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "merchant_settings": { - "merchant_id": "MERCHANT_ID", - "payment_methods": { - "afterpay_clearpay": { - "enabled": true, - "item_eligibility_range": { - "max": { - "amount": 10000, - "currency": "USD" - }, - "min": { - "amount": 100, - "currency": "USD" - } - }, - "order_eligibility_range": { - "max": { - "amount": 10000, - "currency": "USD" - }, - "min": { - "amount": 100, - "currency": "USD" - } - } - }, - "apple_pay": { - "enabled": false - }, - "cash_app_pay": { - "enabled": true - }, - "google_pay": { - "enabled": true - }, - "cash_app": { - "enabled": false - } - }, - "updated_at": "2022-06-16T22:25:35Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-order-custom-attribute-definition-request.md b/doc/models/update-order-custom-attribute-definition-request.md deleted file mode 100644 index ff6366e62..000000000 --- a/doc/models/update-order-custom-attribute-definition-request.md +++ /dev/null @@ -1,35 +0,0 @@ - -# Update Order Custom Attribute Definition Request - -Represents an update request for an order custom attribute definition. - -## Structure - -`UpdateOrderCustomAttributeDefinitionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition`](../../doc/models/custom-attribute-definition.md) | Required | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "key": "cover-count", - "version": 1, - "visibility": "VISIBILITY_READ_ONLY", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name2", - "description": "description8" - }, - "idempotency_key": "IDEMPOTENCY_KEY" -} -``` - diff --git a/doc/models/update-order-custom-attribute-definition-response.md b/doc/models/update-order-custom-attribute-definition-response.md deleted file mode 100644 index 6d66d694a..000000000 --- a/doc/models/update-order-custom-attribute-definition-response.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Update Order Custom Attribute Definition Response - -Represents a response from updating an order custom attribute definition. - -## Structure - -`UpdateOrderCustomAttributeDefinitionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttributeDefinition` | [`CustomAttributeDefinition \| undefined`](../../doc/models/custom-attribute-definition.md) | Optional | Represents a definition for custom attribute values. A custom attribute definition
specifies the key, visibility, schema, and other properties for a custom attribute. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute_definition": { - "created_at": "2022-11-16T16:53:23.141Z", - "description": "The number of people seated at a table", - "key": "cover-count", - "name": "Cover count", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "updated_at": "2022-11-16T17:44:11.436Z", - "version": 2, - "visibility": "VISIBILITY_READ_ONLY" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-order-request.md b/doc/models/update-order-request.md deleted file mode 100644 index 0d9c4182e..000000000 --- a/doc/models/update-order-request.md +++ /dev/null @@ -1,64 +0,0 @@ - -# Update Order Request - -Defines the fields that are included in requests to the -[UpdateOrder](../../doc/api/orders.md#update-order) endpoint. - -## Structure - -`UpdateOrderRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `fieldsToClear` | `string[] \| null \| undefined` | Optional | The [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete)
fields to clear. For example, `line_items[uid].note`.
For more information, see [Deleting fields](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#deleting-fields). | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A value you specify that uniquely identifies this update request.

If you are unsure whether a particular update was applied to an order successfully,
you can reattempt it with the same idempotency key without
worrying about creating duplicate updates to the order.
The latest order version is returned.

For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `192` | - -## Example (as JSON) - -```json -{ - "order": { - "id": "id6", - "location_id": "location_id0", - "reference_id": "reference_id4", - "source": { - "name": "name4" - }, - "customer_id": "customer_id4", - "line_items": [ - { - "uid": "uid8", - "name": "name8", - "quantity": "quantity4", - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ] - }, - "fields_to_clear": [ - "fields_to_clear7", - "fields_to_clear8", - "fields_to_clear9" - ], - "idempotency_key": "idempotency_key2" -} -``` - diff --git a/doc/models/update-order-response.md b/doc/models/update-order-response.md deleted file mode 100644 index a6722bd3f..000000000 --- a/doc/models/update-order-response.md +++ /dev/null @@ -1,187 +0,0 @@ - -# Update Order Response - -Defines the fields that are included in the response body of -a request to the [UpdateOrder](../../doc/api/orders.md#update-order) endpoint. - -## Structure - -`UpdateOrderResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`Order \| undefined`](../../doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,
including line items that specify the products to purchase. `Order` objects also
include information about any associated tenders, refunds, and returns.

All Connect V2 Transactions have all been converted to Orders including all associated
itemization data. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "order": { - "created_at": "2019-08-23T18:26:18.243Z", - "id": "DREk7wJcyXNHqULq8JJ2iPAsluJZY", - "line_items": [ - { - "base_price_money": { - "amount": 500, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 500, - "currency": "USD" - }, - "name": "Small Coffee", - "quantity": "1", - "total_discount_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 500, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "EuYkakhmu3ksHIds5Hiot", - "variation_total_price_money": { - "amount": 500, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - }, - { - "base_price_money": { - "amount": 200, - "currency": "USD" - }, - "gross_sales_money": { - "amount": 400, - "currency": "USD" - }, - "name": "COOKIE", - "quantity": "2", - "total_discount_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 400, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "uid": "cookie_uid", - "variation_total_price_money": { - "amount": 400, - "currency": "USD" - }, - "quantity_unit": { - "measurement_unit": { - "custom_unit": { - "name": "name2", - "abbreviation": "abbreviation4" - }, - "area_unit": "IMPERIAL_ACRE", - "length_unit": "IMPERIAL_INCH", - "volume_unit": "METRIC_LITER", - "weight_unit": "IMPERIAL_WEIGHT_OUNCE" - }, - "precision": 54, - "catalog_object_id": "catalog_object_id0", - "catalog_version": 12 - }, - "note": "note4", - "catalog_object_id": "catalog_object_id2" - } - ], - "location_id": "MXVQSVNDGN3C8", - "net_amounts": { - "discount_money": { - "amount": 0, - "currency": "USD" - }, - "service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "tax_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 900, - "currency": "USD" - } - }, - "source": { - "name": "Cookies" - }, - "state": "OPEN", - "total_discount_money": { - "amount": 0, - "currency": "USD" - }, - "total_money": { - "amount": 900, - "currency": "USD" - }, - "total_service_charge_money": { - "amount": 0, - "currency": "USD" - }, - "total_tax_money": { - "amount": 0, - "currency": "USD" - }, - "updated_at": "2019-08-23T18:33:47.523Z", - "version": 2, - "reference_id": "reference_id4", - "customer_id": "customer_id4" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-payment-link-request.md b/doc/models/update-payment-link-request.md deleted file mode 100644 index 4032846b9..000000000 --- a/doc/models/update-payment-link-request.md +++ /dev/null @@ -1,52 +0,0 @@ - -# Update Payment Link Request - -## Structure - -`UpdatePaymentLinkRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `paymentLink` | [`PaymentLink`](../../doc/models/payment-link.md) | Required | - | - -## Example (as JSON) - -```json -{ - "payment_link": { - "checkout_options": { - "ask_for_shipping_address": true, - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id8", - "redirect_url": "redirect_url2", - "merchant_support_email": "merchant_support_email8" - }, - "version": 1, - "id": "id2", - "description": "description2", - "order_id": "order_id6", - "pre_populated_data": { - "buyer_email": "buyer_email8", - "buyer_phone_number": "buyer_phone_number0", - "buyer_address": { - "address_line_1": "address_line_12", - "address_line_2": "address_line_22", - "address_line_3": "address_line_38", - "locality": "locality2", - "sublocality": "sublocality2" - } - } - } -} -``` - diff --git a/doc/models/update-payment-link-response.md b/doc/models/update-payment-link-response.md deleted file mode 100644 index 4d2b24099..000000000 --- a/doc/models/update-payment-link-response.md +++ /dev/null @@ -1,78 +0,0 @@ - -# Update Payment Link Response - -## Structure - -`UpdatePaymentLinkResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred when updating the payment link. | -| `paymentLink` | [`PaymentLink \| undefined`](../../doc/models/payment-link.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "payment_link": { - "checkout_options": { - "ask_for_shipping_address": true, - "allow_tipping": false, - "custom_fields": [ - { - "title": "title8" - }, - { - "title": "title8" - } - ], - "subscription_plan_id": "subscription_plan_id8", - "redirect_url": "redirect_url2", - "merchant_support_email": "merchant_support_email8" - }, - "created_at": "2022-04-26T00:15:15Z", - "id": "TY4BWEDJ6AI5MBIV", - "long_url": "https://checkout.square.site/EXAMPLE", - "order_id": "Qqc8ypQGvxVwc46Cch4zHTaJqc4F", - "payment_note": "test", - "updated_at": "2022-04-26T00:18:24Z", - "url": "https://square.link/u/EXAMPLE", - "version": 2, - "description": "description2", - "pre_populated_data": { - "buyer_email": "buyer_email8", - "buyer_phone_number": "buyer_phone_number0", - "buyer_address": { - "address_line_1": "address_line_12", - "address_line_2": "address_line_22", - "address_line_3": "address_line_38", - "locality": "locality2", - "sublocality": "sublocality2" - } - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-payment-request.md b/doc/models/update-payment-request.md deleted file mode 100644 index 7488f4429..000000000 --- a/doc/models/update-payment-request.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Update Payment Request - -Describes a request to update a payment using -[UpdatePayment](../../doc/api/payments.md#update-payment). - -## Structure - -`UpdatePaymentRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `payment` | [`Payment \| undefined`](../../doc/models/payment.md) | Optional | Represents a payment processed by the Square API. | -| `idempotencyKey` | `string` | Required | A unique string that identifies this `UpdatePayment` request. Keys can be any valid string
but must be unique for every `UpdatePayment` request.

For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de", - "payment": { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "tip_money": { - "amount": 100, - "currency": "USD" - }, - "version_token": "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o", - "id": "id6", - "created_at": "created_at4", - "updated_at": "updated_at2" - } -} -``` - diff --git a/doc/models/update-payment-response.md b/doc/models/update-payment-response.md deleted file mode 100644 index 48b72fb11..000000000 --- a/doc/models/update-payment-response.md +++ /dev/null @@ -1,111 +0,0 @@ - -# Update Payment Response - -Defines the response returned by -[UpdatePayment](../../doc/api/payments.md#update-payment). - -## Structure - -`UpdatePaymentResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `payment` | [`Payment \| undefined`](../../doc/models/payment.md) | Optional | Represents a payment processed by the Square API. | - -## Example (as JSON) - -```json -{ - "payment": { - "amount_money": { - "amount": 1000, - "currency": "USD" - }, - "application_details": { - "application_id": "sq0ids-TcgftTEtKxJTRF1lCFJ9TA", - "square_product": "ECOMMERCE_API" - }, - "approved_money": { - "amount": 1000, - "currency": "USD" - }, - "capabilities": [ - "EDIT_AMOUNT_UP", - "EDIT_AMOUNT_DOWN", - "EDIT_TIP_AMOUNT_UP", - "EDIT_TIP_AMOUNT_DOWN" - ], - "card_details": { - "auth_result_code": "68aLBM", - "avs_status": "AVS_ACCEPTED", - "card": { - "bin": "411111", - "card_brand": "VISA", - "card_type": "DEBIT", - "exp_month": 11, - "exp_year": 2022, - "fingerprint": "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ", - "last_4": "1111", - "prepaid_type": "NOT_PREPAID" - }, - "card_payment_timeline": { - "authorized_at": "2021-10-13T20:26:44.364Z" - }, - "cvv_status": "CVV_ACCEPTED", - "entry_method": "ON_FILE", - "statement_description": "SQ *EXAMPLE TEST GOSQ.C", - "status": "AUTHORIZED" - }, - "created_at": "2021-10-13T20:26:44.191Z", - "customer_id": "W92WH6P11H4Z77CTET0RNTGFW8", - "delay_action": "CANCEL", - "delay_duration": "PT168H", - "delayed_until": "2021-10-20T20:26:44.191Z", - "id": "1QjqpBVyrI9S4H9sTGDWU9JeiWdZY", - "location_id": "L88917AVBK2S5", - "note": "Example Note", - "order_id": "nUSN9TdxpiK3SrQg3wzmf6r8LP9YY", - "receipt_number": "1Qjq", - "risk_evaluation": { - "created_at": "2021-10-13T20:26:45.271Z", - "risk_level": "NORMAL" - }, - "source_type": "CARD", - "status": "APPROVED", - "tip_money": { - "amount": 100, - "currency": "USD" - }, - "total_money": { - "amount": 1100, - "currency": "USD" - }, - "updated_at": "2021-10-13T20:26:44.364Z", - "version_token": "rDrXnqiS7fJgexccgdpzmwqTiXui1aIKCp9EchZ7trE6o" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-shift-request.md b/doc/models/update-shift-request.md deleted file mode 100644 index ab1d3a411..000000000 --- a/doc/models/update-shift-request.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Update Shift Request - -A request to update a `Shift` object. - -## Structure - -`UpdateShiftRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `shift` | [`Shift`](../../doc/models/shift.md) | Required | A record of the hourly rate, start, and end times for a single work shift
for an employee. This might include a record of the start and end times for breaks
taken during the shift. | - -## Example (as JSON) - -```json -{ - "shift": { - "breaks": [ - { - "break_type_id": "REGS1EQR1TPZ5", - "end_at": "2019-01-25T06:16:00-05:00", - "expected_duration": "PT5M", - "id": "X7GAQYVVRRG6P", - "is_paid": true, - "name": "Tea Break", - "start_at": "2019-01-25T06:11:00-05:00" - } - ], - "declared_cash_tip_money": { - "amount": 500, - "currency": "USD" - }, - "end_at": "2019-01-25T13:11:00-05:00", - "location_id": "PAA1RJZZKXBFG", - "start_at": "2019-01-25T03:11:00-05:00", - "team_member_id": "ormj0jJJZ5OZIzxrZYJI", - "version": 1, - "wage": { - "hourly_rate": { - "amount": 1500, - "currency": "USD" - }, - "tip_eligible": true, - "title": "Bartender", - "job_id": "job_id0" - }, - "id": "id4", - "employee_id": "employee_id4", - "timezone": "timezone4" - } -} -``` - diff --git a/doc/models/update-shift-response.md b/doc/models/update-shift-response.md deleted file mode 100644 index 0316c880f..000000000 --- a/doc/models/update-shift-response.md +++ /dev/null @@ -1,82 +0,0 @@ - -# Update Shift Response - -The response to a request to update a `Shift`. The response contains -the updated `Shift` object and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`UpdateShiftResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `shift` | [`Shift \| undefined`](../../doc/models/shift.md) | Optional | A record of the hourly rate, start, and end times for a single work shift
for an employee. This might include a record of the start and end times for breaks
taken during the shift. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "shift": { - "breaks": [ - { - "break_type_id": "REGS1EQR1TPZ5", - "end_at": "2019-01-25T06:16:00-05:00", - "expected_duration": "PT5M", - "id": "X7GAQYVVRRG6P", - "is_paid": true, - "name": "Tea Break", - "start_at": "2019-01-25T06:11:00-05:00" - } - ], - "created_at": "2019-02-28T00:39:02Z", - "declared_cash_tip_money": { - "amount": 500, - "currency": "USD" - }, - "employee_id": "ormj0jJJZ5OZIzxrZYJI", - "end_at": "2019-01-25T13:11:00-05:00", - "id": "K0YH4CV5462JB", - "location_id": "PAA1RJZZKXBFG", - "start_at": "2019-01-25T03:11:00-05:00", - "status": "CLOSED", - "team_member_id": "ormj0jJJZ5OZIzxrZYJI", - "timezone": "America/New_York", - "updated_at": "2019-02-28T00:42:41Z", - "version": 2, - "wage": { - "hourly_rate": { - "amount": 1500, - "currency": "USD" - }, - "job_id": "dZtrPh5GSDGugyXGByesVp51", - "tip_eligible": true, - "title": "Bartender" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-subscription-request.md b/doc/models/update-subscription-request.md deleted file mode 100644 index 2cfe23597..000000000 --- a/doc/models/update-subscription-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Update Subscription Request - -Defines input parameters in a request to the -[UpdateSubscription](../../doc/api/subscriptions.md#update-subscription) endpoint. - -## Structure - -`UpdateSubscriptionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `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) - -```json -{ - "subscription": { - "canceled_date": null, - "card_id": "{NEW CARD ID}", - "id": "id4", - "location_id": "location_id8", - "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 deleted file mode 100644 index bc90653bc..000000000 --- a/doc/models/update-subscription-response.md +++ /dev/null @@ -1,58 +0,0 @@ - -# Update Subscription Response - -Defines output parameters in a response from the -[UpdateSubscription](../../doc/api/subscriptions.md#update-subscription) endpoint. - -## Structure - -`UpdateSubscriptionResponse` - -## Fields - -| 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 purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | - -## Example (as JSON) - -```json -{ - "subscription": { - "card_id": "{NEW CARD ID}", - "charged_through_date": "2023-03-13", - "created_at": "2023-01-30T19:27:32Z", - "customer_id": "AM69AB81FT4479YH9HGWS1HZY8", - "id": "7217d8ca-1fee-4446-a9e5-8540b5d8c9bb", - "invoice_ids": [ - "inv:0-ChAPSfVYvNewckgf3x4iigN_ENMM", - "inv:0-ChBQaCCLfjcm9WEUBGxvuydJENMM" - ], - "location_id": "LPJKHYR7WFDKN", - "plan_variation_id": "XOUNEKCE6NSXQW5NTSQ73MMX", - "source": { - "name": "My Application" - }, - "start_date": "2023-01-30", - "status": "ACTIVE", - "timezone": "UTC", - "version": 3 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-team-member-request.md b/doc/models/update-team-member-request.md deleted file mode 100644 index f3a6bee0f..000000000 --- a/doc/models/update-team-member-request.md +++ /dev/null @@ -1,61 +0,0 @@ - -# Update Team Member Request - -Represents an update request for a `TeamMember` object. - -## Structure - -`UpdateTeamMemberRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMember` | [`TeamMember \| undefined`](../../doc/models/team-member.md) | Optional | A record representing an individual team member for a business. | - -## Example (as JSON) - -```json -{ - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "YSGH2WBKG94QZ", - "GA2Y9HSJ8KRYT" - ], - "wage_setting": { - "is_overtime_exempt": true, - "job_assignments": [ - { - "annual_rate": { - "amount": 3000000, - "currency": "USD" - }, - "job_id": "FjS8x95cqHiMenw4f1NAUH4P", - "pay_type": "SALARY", - "weekly_hours": 40 - }, - { - "hourly_rate": { - "amount": 1200, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "pay_type": "HOURLY" - } - ] - } - }, - "email_address": "joe_doe@gmail.com", - "family_name": "Doe", - "given_name": "Joe", - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "status": "ACTIVE", - "id": "id6", - "is_owner": false - } -} -``` - diff --git a/doc/models/update-team-member-response.md b/doc/models/update-team-member-response.md deleted file mode 100644 index 822f51e73..000000000 --- a/doc/models/update-team-member-response.md +++ /dev/null @@ -1,82 +0,0 @@ - -# Update Team Member Response - -Represents a response from an update request containing the updated `TeamMember` object or error messages. - -## Structure - -`UpdateTeamMemberResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMember` | [`TeamMember \| undefined`](../../doc/models/team-member.md) | Optional | A record representing an individual team member for a business. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "team_member": { - "assigned_locations": { - "assignment_type": "EXPLICIT_LOCATIONS", - "location_ids": [ - "GA2Y9HSJ8KRYT", - "YSGH2WBKG94QZ" - ] - }, - "created_at": "2021-06-11T22:55:45Z", - "email_address": "joe_doe@example.com", - "family_name": "Doe", - "given_name": "Joe", - "id": "1yJlHapkseYnNPETIU1B", - "is_owner": false, - "phone_number": "+14159283333", - "reference_id": "reference_id_1", - "status": "ACTIVE", - "updated_at": "2021-06-15T17:38:05Z", - "wage_setting": { - "created_at": "2021-06-11T22:55:45Z", - "is_overtime_exempt": true, - "job_assignments": [ - { - "annual_rate": { - "amount": 3000000, - "currency": "USD" - }, - "hourly_rate": { - "amount": 1443, - "currency": "USD" - }, - "job_id": "FjS8x95cqHiMenw4f1NAUH4P", - "job_title": "Manager", - "pay_type": "SALARY", - "weekly_hours": 40 - }, - { - "hourly_rate": { - "amount": 1200, - "currency": "USD" - }, - "job_id": "VDNpRv8da51NU8qZFC5zDWpF", - "job_title": "Cashier", - "pay_type": "HOURLY" - } - ], - "team_member_id": "1yJlHapkseYnNPETIU1B", - "updated_at": "2021-06-11T22:55:45Z", - "version": 1 - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-vendor-request.md b/doc/models/update-vendor-request.md deleted file mode 100644 index 51e811e37..000000000 --- a/doc/models/update-vendor-request.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Update Vendor Request - -Represents an input to a call to [UpdateVendor](../../doc/api/vendors.md#update-vendor). - -## Structure - -`UpdateVendorRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A client-supplied, universally unique identifier (UUID) for the
request.

See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
[API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
information.
**Constraints**: *Maximum Length*: `128` | -| `vendor` | [`Vendor`](../../doc/models/vendor.md) | Required | Represents a supplier to a seller. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", - "vendor": { - "id": "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", - "name": "Jack's Chicken Shack", - "status": "ACTIVE", - "version": 1, - "created_at": "created_at4", - "updated_at": "updated_at2", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } - } -} -``` - diff --git a/doc/models/update-vendor-response.md b/doc/models/update-vendor-response.md deleted file mode 100644 index b0c95058b..000000000 --- a/doc/models/update-vendor-response.md +++ /dev/null @@ -1,71 +0,0 @@ - -# Update Vendor Response - -Represents an output from a call to [UpdateVendor](../../doc/api/vendors.md#update-vendor). - -## Structure - -`UpdateVendorResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors occurred when the request fails. | -| `vendor` | [`Vendor \| undefined`](../../doc/models/vendor.md) | Optional | Represents a supplier to a seller. | - -## Example (as JSON) - -```json -{ - "vendor": { - "account_number": "4025391", - "address": { - "address_line_1": "505 Electric Ave", - "address_line_2": "Suite 600", - "administrative_district_level_1": "NY", - "country": "US", - "locality": "New York", - "postal_code": "10003", - "address_line_3": "address_line_32", - "sublocality": "sublocality6" - }, - "contacts": [ - { - "email_address": "joe@joesfreshseafood.com", - "id": "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A", - "name": "Joe Burrow", - "ordinal": 0, - "phone_number": "1-212-555-4250" - } - ], - "created_at": "2022-03-16T10:21:54.859Z", - "id": "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", - "name": "Jack's Chicken Shack", - "status": "ACTIVE", - "updated_at": "2022-03-16T20:21:54.859Z", - "version": 2 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-wage-setting-request.md b/doc/models/update-wage-setting-request.md deleted file mode 100644 index 0430dd4f8..000000000 --- a/doc/models/update-wage-setting-request.md +++ /dev/null @@ -1,58 +0,0 @@ - -# Update Wage Setting Request - -Represents an update request for the `WageSetting` object describing a `TeamMember`. - -## Structure - -`UpdateWageSettingRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `wageSetting` | [`WageSetting`](../../doc/models/wage-setting.md) | Required | Represents information about the overtime exemption status, job assignments, and compensation
for a [team member](../../doc/models/team-member.md). | - -## Example (as JSON) - -```json -{ - "wage_setting": { - "is_overtime_exempt": true, - "job_assignments": [ - { - "annual_rate": { - "amount": 3000000, - "currency": "USD" - }, - "job_title": "Manager", - "pay_type": "SALARY", - "weekly_hours": 40, - "hourly_rate": { - "amount": 172, - "currency": "LAK" - }, - "job_id": "job_id2" - }, - { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "job_title": "Cashier", - "pay_type": "HOURLY", - "annual_rate": { - "amount": 232, - "currency": "NIO" - }, - "weekly_hours": 98, - "job_id": "job_id2" - } - ], - "team_member_id": "team_member_id8", - "version": 130, - "created_at": "created_at6" - } -} -``` - diff --git a/doc/models/update-wage-setting-response.md b/doc/models/update-wage-setting-response.md deleted file mode 100644 index aa73897ce..000000000 --- a/doc/models/update-wage-setting-response.md +++ /dev/null @@ -1,75 +0,0 @@ - -# Update Wage Setting Response - -Represents a response from an update request containing the updated `WageSetting` object -or error messages. - -## Structure - -`UpdateWageSettingResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `wageSetting` | [`WageSetting \| undefined`](../../doc/models/wage-setting.md) | Optional | Represents information about the overtime exemption status, job assignments, and compensation
for a [team member](../../doc/models/team-member.md). | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "wage_setting": { - "created_at": "2019-07-10T17:26:48+00:00", - "is_overtime_exempt": true, - "job_assignments": [ - { - "annual_rate": { - "amount": 3000000, - "currency": "USD" - }, - "hourly_rate": { - "amount": 1443, - "currency": "USD" - }, - "job_title": "Manager", - "pay_type": "SALARY", - "weekly_hours": 40, - "job_id": "job_id2" - }, - { - "hourly_rate": { - "amount": 2000, - "currency": "USD" - }, - "job_title": "Cashier", - "pay_type": "HOURLY", - "annual_rate": { - "amount": 232, - "currency": "NIO" - }, - "weekly_hours": 98, - "job_id": "job_id2" - } - ], - "team_member_id": "-3oZQKPKVk6gUXU_V5Qa", - "updated_at": "2020-06-11T23:12:04+00:00", - "version": 1 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-webhook-subscription-request.md b/doc/models/update-webhook-subscription-request.md deleted file mode 100644 index 8ff3e357f..000000000 --- a/doc/models/update-webhook-subscription-request.md +++ /dev/null @@ -1,32 +0,0 @@ - -# Update Webhook Subscription Request - -Updates a [Subscription](../../doc/models/webhook-subscription.md). - -## Structure - -`UpdateWebhookSubscriptionRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `subscription` | [`WebhookSubscription \| undefined`](../../doc/models/webhook-subscription.md) | Optional | Represents the details of a webhook subscription, including notification URL,
event types, and signature key. | - -## Example (as JSON) - -```json -{ - "subscription": { - "enabled": false, - "name": "Updated Example Webhook Subscription", - "id": "id4", - "event_types": [ - "event_types2", - "event_types3" - ], - "notification_url": "notification_url8" - } -} -``` - diff --git a/doc/models/update-webhook-subscription-response.md b/doc/models/update-webhook-subscription-response.md deleted file mode 100644 index e055ceac6..000000000 --- a/doc/models/update-webhook-subscription-response.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Update Webhook Subscription Response - -Defines the fields that are included in the response body of -a request to the [UpdateWebhookSubscription](../../doc/api/webhook-subscriptions.md#update-webhook-subscription) endpoint. - -Note: If there are errors processing the request, the [Subscription](../../doc/models/webhook-subscription.md) is not -present. - -## Structure - -`UpdateWebhookSubscriptionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `subscription` | [`WebhookSubscription \| undefined`](../../doc/models/webhook-subscription.md) | Optional | Represents the details of a webhook subscription, including notification URL,
event types, and signature key. | - -## Example (as JSON) - -```json -{ - "subscription": { - "api_version": "2021-12-15", - "created_at": "2022-01-10 23:29:48 +0000 UTC", - "enabled": false, - "event_types": [ - "payment.created", - "payment.updated" - ], - "id": "wbhk_b35f6b3145074cf9ad513610786c19d5", - "name": "Updated Example Webhook Subscription", - "notification_url": "https://example-webhook-url.com", - "updated_at": "2022-01-10 23:45:51 +0000 UTC" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-webhook-subscription-signature-key-request.md b/doc/models/update-webhook-subscription-signature-key-request.md deleted file mode 100644 index 99e1fc85f..000000000 --- a/doc/models/update-webhook-subscription-signature-key-request.md +++ /dev/null @@ -1,23 +0,0 @@ - -# Update Webhook Subscription Signature Key Request - -Updates a [Subscription](../../doc/models/webhook-subscription.md) by replacing the existing signature key with a new one. - -## Structure - -`UpdateWebhookSubscriptionSignatureKeyRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique string that identifies the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) request.
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "idempotency_key": "ed80ae6b-0654-473b-bbab-a39aee89a60d" -} -``` - diff --git a/doc/models/update-webhook-subscription-signature-key-response.md b/doc/models/update-webhook-subscription-signature-key-response.md deleted file mode 100644 index 198abf75b..000000000 --- a/doc/models/update-webhook-subscription-signature-key-response.md +++ /dev/null @@ -1,48 +0,0 @@ - -# Update Webhook Subscription Signature Key Response - -Defines the fields that are included in the response body of -a request to the [UpdateWebhookSubscriptionSignatureKey](../../doc/api/webhook-subscriptions.md#update-webhook-subscription-signature-key) endpoint. - -Note: If there are errors processing the request, the [Subscription](../../doc/models/webhook-subscription.md) is not -present. - -## Structure - -`UpdateWebhookSubscriptionSignatureKeyResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | -| `signatureKey` | `string \| undefined` | Optional | The new Square-generated signature key used to validate the origin of the webhook event. | - -## Example (as JSON) - -```json -{ - "signature_key": "1k9bIJKCeTmSQwyagtNRLg", - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/update-workweek-config-request.md b/doc/models/update-workweek-config-request.md deleted file mode 100644 index d72b936be..000000000 --- a/doc/models/update-workweek-config-request.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Update Workweek Config Request - -A request to update a `WorkweekConfig` object. - -## Structure - -`UpdateWorkweekConfigRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `workweekConfig` | [`WorkweekConfig`](../../doc/models/workweek-config.md) | Required | Sets the day of the week and hour of the day that a business starts a
workweek. This is used to calculate overtime pay. | - -## Example (as JSON) - -```json -{ - "workweek_config": { - "start_of_day_local_time": "10:00", - "start_of_week": "MON", - "version": 10, - "id": "id0", - "created_at": "created_at8", - "updated_at": "updated_at6" - } -} -``` - diff --git a/doc/models/update-workweek-config-response.md b/doc/models/update-workweek-config-response.md deleted file mode 100644 index d2946e94b..000000000 --- a/doc/models/update-workweek-config-response.md +++ /dev/null @@ -1,53 +0,0 @@ - -# Update Workweek Config Response - -The response to a request to update a `WorkweekConfig` object. The response contains -the updated `WorkweekConfig` object and might contain a set of `Error` objects if -the request resulted in errors. - -## Structure - -`UpdateWorkweekConfigResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `workweekConfig` | [`WorkweekConfig \| undefined`](../../doc/models/workweek-config.md) | Optional | Sets the day of the week and hour of the day that a business starts a
workweek. This is used to calculate overtime pay. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "workweek_config": { - "created_at": "2016-02-04T00:58:24Z", - "id": "FY4VCAQN700GM", - "start_of_day_local_time": "10:00", - "start_of_week": "MON", - "updated_at": "2019-02-28T01:04:35Z", - "version": 11 - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/upsert-booking-custom-attribute-request.md b/doc/models/upsert-booking-custom-attribute-request.md deleted file mode 100644 index 8d91a27c4..000000000 --- a/doc/models/upsert-booking-custom-attribute-request.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Upsert Booking Custom Attribute Request - -Represents an [UpsertBookingCustomAttribute](../../doc/api/booking-custom-attributes.md#upsert-booking-custom-attribute) request. - -## Structure - -`UpsertBookingCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key4" -} -``` - diff --git a/doc/models/upsert-booking-custom-attribute-response.md b/doc/models/upsert-booking-custom-attribute-response.md deleted file mode 100644 index 393e27db3..000000000 --- a/doc/models/upsert-booking-custom-attribute-response.md +++ /dev/null @@ -1,63 +0,0 @@ - -# Upsert Booking Custom Attribute Response - -Represents an [UpsertBookingCustomAttribute](../../doc/api/booking-custom-attributes.md#upsert-booking-custom-attribute) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`UpsertBookingCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/upsert-catalog-object-request.md b/doc/models/upsert-catalog-object-request.md deleted file mode 100644 index 1b2bf539b..000000000 --- a/doc/models/upsert-catalog-object-request.md +++ /dev/null @@ -1,80 +0,0 @@ - -# Upsert Catalog Object Request - -## Structure - -`UpsertCatalogObjectRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `idempotencyKey` | `string` | Required | A value you specify that uniquely identifies this
request among all your requests. A common way to create
a valid idempotency key is to use a Universally unique
identifier (UUID).

If you're unsure whether a particular request was successful,
you can reattempt it with the same idempotency key without
worrying about creating duplicate objects.

See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information.
**Constraints**: *Minimum Length*: `1` | -| `object` | [`CatalogObject`](../../doc/models/catalog-object.md) | Required | The wrapper object for the catalog entries of a given object type.

Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.

For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.

In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.

For a more detailed discussion of the Catalog data model, please see the
[Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. | - -## Example (as JSON) - -```json -{ - "idempotency_key": "af3d1afc-7212-4300-b463-0bfc5314a5ae", - "object": { - "id": "#Cocoa", - "item_data": { - "abbreviation": "Ch", - "description_html": "

Hot Chocolate

", - "name": "Cocoa", - "variations": [ - { - "id": "#Small", - "item_variation_data": { - "item_id": "#Cocoa", - "name": "Small", - "pricing_type": "VARIABLE_PRICING" - }, - "type": "ITEM_VARIATION" - }, - { - "id": "#Large", - "item_variation_data": { - "item_id": "#Cocoa", - "name": "Large", - "price_money": { - "amount": 400, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING" - }, - "type": "ITEM_VARIATION" - } - ] - }, - "type": "ITEM", - "updated_at": "updated_at8", - "version": 4, - "is_deleted": false, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - } -} -``` - diff --git a/doc/models/upsert-catalog-object-response.md b/doc/models/upsert-catalog-object-response.md deleted file mode 100644 index 7ae4600a9..000000000 --- a/doc/models/upsert-catalog-object-response.md +++ /dev/null @@ -1,139 +0,0 @@ - -# Upsert Catalog Object Response - -## Structure - -`UpsertCatalogObjectResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `catalogObject` | [`CatalogObject \| undefined`](../../doc/models/catalog-object.md) | Optional | The wrapper object for the catalog entries of a given object type.

Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object.

For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance.

In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance.

For a more detailed discussion of the Catalog data model, please see the
[Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. | -| `idMappings` | [`CatalogIdMapping[] \| undefined`](../../doc/models/catalog-id-mapping.md) | Optional | The mapping between client and server IDs for this upsert. | - -## Example (as JSON) - -```json -{ - "catalog_object": { - "id": "R2TA2FOBUGCJZNIWJSOSNAI4", - "is_deleted": false, - "item_data": { - "abbreviation": "Ch", - "description": "Hot Chocolate", - "description_html": "

Hot Chocolate

", - "description_plaintext": "Hot Chocolate", - "name": "Cocoa", - "product_type": "REGULAR", - "variations": [ - { - "id": "QRT53UP4LITLWGOGBZCUWP63", - "is_deleted": false, - "item_variation_data": { - "item_id": "R2TA2FOBUGCJZNIWJSOSNAI4", - "name": "Small", - "ordinal": 0, - "pricing_type": "VARIABLE_PRICING", - "stockable": true - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2021-06-14T15:51:39.021Z", - "version": 1623685899021 - }, - { - "id": "NS77DKEIQ3AEQTCP727DSA7U", - "is_deleted": false, - "item_variation_data": { - "item_id": "R2TA2FOBUGCJZNIWJSOSNAI4", - "name": "Large", - "ordinal": 1, - "price_money": { - "amount": 400, - "currency": "USD" - }, - "pricing_type": "FIXED_PRICING", - "stockable": true - }, - "present_at_all_locations": true, - "type": "ITEM_VARIATION", - "updated_at": "2021-06-14T15:51:39.021Z", - "version": 1623685899021 - } - ] - }, - "present_at_all_locations": true, - "type": "ITEM", - "updated_at": "2021-06-14T15:51:39.021Z", - "version": 1623685899021, - "custom_attribute_values": { - "key0": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key1": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - }, - "key2": { - "name": "name8", - "string_value": "string_value2", - "custom_attribute_definition_id": "custom_attribute_definition_id4", - "type": "STRING", - "number_value": "number_value8" - } - }, - "catalog_v1_ids": [ - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - }, - { - "catalog_v1_id": "catalog_v1_id4", - "location_id": "location_id4" - } - ] - }, - "id_mappings": [ - { - "client_object_id": "#Cocoa", - "object_id": "R2TA2FOBUGCJZNIWJSOSNAI4" - }, - { - "client_object_id": "#Small", - "object_id": "QRT53UP4LITLWGOGBZCUWP63" - }, - { - "client_object_id": "#Large", - "object_id": "NS77DKEIQ3AEQTCP727DSA7U" - } - ], - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/upsert-customer-custom-attribute-request.md b/doc/models/upsert-customer-custom-attribute-request.md deleted file mode 100644 index 0caa85f26..000000000 --- a/doc/models/upsert-customer-custom-attribute-request.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Upsert Customer Custom Attribute Request - -Represents an [UpsertCustomerCustomAttribute](../../doc/api/customer-custom-attributes.md#upsert-customer-custom-attribute) request. - -## Structure - -`UpsertCustomerCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" -} -``` - diff --git a/doc/models/upsert-customer-custom-attribute-response.md b/doc/models/upsert-customer-custom-attribute-response.md deleted file mode 100644 index 3d321ceb8..000000000 --- a/doc/models/upsert-customer-custom-attribute-response.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Upsert Customer Custom Attribute Response - -Represents an [UpsertCustomerCustomAttribute](../../doc/api/customer-custom-attributes.md#upsert-customer-custom-attribute) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`UpsertCustomerCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/upsert-location-custom-attribute-request.md b/doc/models/upsert-location-custom-attribute-request.md deleted file mode 100644 index 754bfc026..000000000 --- a/doc/models/upsert-location-custom-attribute-request.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Upsert Location Custom Attribute Request - -Represents an [UpsertLocationCustomAttribute](../../doc/api/location-custom-attributes.md#upsert-location-custom-attribute) request. - -## Structure - -`UpsertLocationCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key8" -} -``` - diff --git a/doc/models/upsert-location-custom-attribute-response.md b/doc/models/upsert-location-custom-attribute-response.md deleted file mode 100644 index f9b4c49f3..000000000 --- a/doc/models/upsert-location-custom-attribute-response.md +++ /dev/null @@ -1,57 +0,0 @@ - -# Upsert Location Custom Attribute Response - -Represents an [UpsertLocationCustomAttribute](../../doc/api/location-custom-attributes.md#upsert-location-custom-attribute) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`UpsertLocationCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/upsert-merchant-custom-attribute-request.md b/doc/models/upsert-merchant-custom-attribute-request.md deleted file mode 100644 index fdfc1df5c..000000000 --- a/doc/models/upsert-merchant-custom-attribute-request.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Upsert Merchant Custom Attribute Request - -Represents an [UpsertMerchantCustomAttribute](../../doc/api/merchant-custom-attributes.md#upsert-merchant-custom-attribute) request. - -## Structure - -`UpsertMerchantCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency. For more information,
see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key6" -} -``` - diff --git a/doc/models/upsert-merchant-custom-attribute-response.md b/doc/models/upsert-merchant-custom-attribute-response.md deleted file mode 100644 index e4b1a55bb..000000000 --- a/doc/models/upsert-merchant-custom-attribute-response.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Upsert Merchant Custom Attribute Response - -Represents an [UpsertMerchantCustomAttribute](../../doc/api/merchant-custom-attributes.md#upsert-merchant-custom-attribute) response. -Either `custom_attribute_definition` or `errors` is present in the response. - -## Structure - -`UpsertMerchantCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/upsert-order-custom-attribute-request.md b/doc/models/upsert-order-custom-attribute-request.md deleted file mode 100644 index 8e88e5dbe..000000000 --- a/doc/models/upsert-order-custom-attribute-request.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Upsert Order Custom Attribute Request - -Represents an upsert request for an order custom attribute. - -## Structure - -`UpsertOrderCustomAttributeRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `idempotencyKey` | `string \| null \| undefined` | Optional | A unique identifier for this request, used to ensure idempotency.
For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `45` | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "idempotency_key": "idempotency_key4" -} -``` - diff --git a/doc/models/upsert-order-custom-attribute-response.md b/doc/models/upsert-order-custom-attribute-response.md deleted file mode 100644 index c641b0267..000000000 --- a/doc/models/upsert-order-custom-attribute-response.md +++ /dev/null @@ -1,62 +0,0 @@ - -# Upsert Order Custom Attribute Response - -Represents a response from upserting order custom attribute definitions. - -## Structure - -`UpsertOrderCustomAttributeResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `customAttribute` | [`CustomAttribute \| undefined`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding
`CustomAttributeDefinition` object. | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "custom_attribute": { - "key": "key2", - "value": { - "key1": "val1", - "key2": "val2" - }, - "version": 102, - "visibility": "VISIBILITY_READ_ONLY", - "definition": { - "key": "key0", - "schema": { - "key1": "val1", - "key2": "val2" - }, - "name": "name0", - "description": "description0", - "visibility": "VISIBILITY_HIDDEN" - } - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/upsert-snippet-request.md b/doc/models/upsert-snippet-request.md deleted file mode 100644 index 8856b05be..000000000 --- a/doc/models/upsert-snippet-request.md +++ /dev/null @@ -1,29 +0,0 @@ - -# Upsert Snippet Request - -Represents an `UpsertSnippet` request. - -## Structure - -`UpsertSnippetRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `snippet` | [`Snippet`](../../doc/models/snippet.md) | Required | Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. | - -## Example (as JSON) - -```json -{ - "snippet": { - "content": "", - "id": "id0", - "site_id": "site_id6", - "created_at": "created_at8", - "updated_at": "updated_at4" - } -} -``` - diff --git a/doc/models/upsert-snippet-response.md b/doc/models/upsert-snippet-response.md deleted file mode 100644 index 98544fbc4..000000000 --- a/doc/models/upsert-snippet-response.md +++ /dev/null @@ -1,44 +0,0 @@ - -# Upsert Snippet Response - -Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`. - -## Structure - -`UpsertSnippetResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `snippet` | [`Snippet \| undefined`](../../doc/models/snippet.md) | Optional | Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. | - -## Example (as JSON) - -```json -{ - "snippet": { - "content": "", - "created_at": "2021-03-11T25:40:09.000000Z", - "id": "snippet_5d178150-a6c0-11eb-a9f1-437e6a2881e7", - "site_id": "site_278075276488921835", - "updated_at": "2021-03-11T25:40:09.000000Z" - }, - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/v1-device.md b/doc/models/v1-device.md deleted file mode 100644 index 76412bd3b..000000000 --- a/doc/models/v1-device.md +++ /dev/null @@ -1,23 +0,0 @@ - -# V1 Device - -## Structure - -`V1Device` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The device's Square-issued ID. | -| `name` | `string \| null \| undefined` | Optional | The device's merchant-specified name. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "name": "name6" -} -``` - diff --git a/doc/models/v1-list-orders-request.md b/doc/models/v1-list-orders-request.md deleted file mode 100644 index 914f8386a..000000000 --- a/doc/models/v1-list-orders-request.md +++ /dev/null @@ -1,25 +0,0 @@ - -# V1 List Orders Request - -## Structure - -`V1ListOrdersRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `order` | [`string \| undefined`](../../doc/models/sort-order.md) | Optional | The order (e.g., chronological or alphabetical) in which results from a request are returned. | -| `limit` | `number \| null \| undefined` | Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. | -| `batchToken` | `string \| null \| undefined` | Optional | A pagination cursor to retrieve the next set of results for your
original query to the endpoint. | - -## Example (as JSON) - -```json -{ - "order": "DESC", - "limit": 24, - "batch_token": "batch_token4" -} -``` - diff --git a/doc/models/v1-list-orders-response.md b/doc/models/v1-list-orders-response.md deleted file mode 100644 index e4b55c446..000000000 --- a/doc/models/v1-list-orders-response.md +++ /dev/null @@ -1,50 +0,0 @@ - -# V1 List Orders Response - -## Structure - -`V1ListOrdersResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `items` | [`V1Order[] \| undefined`](../../doc/models/v1-order.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "items": [ - { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "id": "id8", - "buyer_email": "buyer_email0", - "recipient_name": "recipient_name6", - "recipient_phone_number": "recipient_phone_number6" - }, - { - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "id": "id8", - "buyer_email": "buyer_email0", - "recipient_name": "recipient_name6", - "recipient_phone_number": "recipient_phone_number6" - } - ] -} -``` - diff --git a/doc/models/v1-money.md b/doc/models/v1-money.md deleted file mode 100644 index e6540cb73..000000000 --- a/doc/models/v1-money.md +++ /dev/null @@ -1,23 +0,0 @@ - -# V1 Money - -## Structure - -`V1Money` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amount` | `number \| null \| undefined` | Optional | Amount in the lowest denominated value of this Currency. E.g. in USD
these are cents, in JPY they are Yen (which do not have a 'cent' concept). | -| `currencyCode` | [`string \| undefined`](../../doc/models/currency.md) | Optional | Indicates the associated currency for an amount of money. Values correspond
to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). | - -## Example (as JSON) - -```json -{ - "amount": 24, - "currency_code": "XPT" -} -``` - diff --git a/doc/models/v1-order-history-entry-action.md b/doc/models/v1-order-history-entry-action.md deleted file mode 100644 index 1d9f6752c..000000000 --- a/doc/models/v1-order-history-entry-action.md +++ /dev/null @@ -1,19 +0,0 @@ - -# V1 Order History Entry Action - -## Enumeration - -`V1OrderHistoryEntryAction` - -## Fields - -| Name | -| --- | -| `ORDER_PLACED` | -| `DECLINED` | -| `PAYMENT_RECEIVED` | -| `CANCELED` | -| `COMPLETED` | -| `REFUNDED` | -| `EXPIRED` | - diff --git a/doc/models/v1-order-history-entry.md b/doc/models/v1-order-history-entry.md deleted file mode 100644 index 191bd24f8..000000000 --- a/doc/models/v1-order-history-entry.md +++ /dev/null @@ -1,25 +0,0 @@ - -# V1 Order History Entry - -V1OrderHistoryEntry - -## Structure - -`V1OrderHistoryEntry` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `action` | [`string \| undefined`](../../doc/models/v1-order-history-entry-action.md) | Optional | - | -| `createdAt` | `string \| undefined` | Optional | The time when the action was performed, in ISO 8601 format. | - -## Example (as JSON) - -```json -{ - "action": "EXPIRED", - "created_at": "created_at8" -} -``` - diff --git a/doc/models/v1-order-state.md b/doc/models/v1-order-state.md deleted file mode 100644 index ed04b532a..000000000 --- a/doc/models/v1-order-state.md +++ /dev/null @@ -1,18 +0,0 @@ - -# V1 Order State - -## Enumeration - -`V1OrderState` - -## Fields - -| Name | -| --- | -| `PENDING` | -| `OPEN` | -| `COMPLETED` | -| `CANCELED` | -| `REFUNDED` | -| `REJECTED` | - diff --git a/doc/models/v1-order.md b/doc/models/v1-order.md deleted file mode 100644 index 8cf7d3b57..000000000 --- a/doc/models/v1-order.md +++ /dev/null @@ -1,64 +0,0 @@ - -# V1 Order - -V1Order - -## Structure - -`V1Order` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| null \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | -| `id` | `string \| undefined` | Optional | The order's unique identifier. | -| `buyerEmail` | `string \| null \| undefined` | Optional | The email address of the order's buyer. | -| `recipientName` | `string \| null \| undefined` | Optional | The name of the order's buyer. | -| `recipientPhoneNumber` | `string \| null \| undefined` | Optional | The phone number to use for the order's delivery. | -| `state` | [`string \| undefined`](../../doc/models/v1-order-state.md) | Optional | - | -| `shippingAddress` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `subtotalMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `totalShippingMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `totalTaxMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `totalPriceMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `totalDiscountMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `createdAt` | `string \| undefined` | Optional | The time when the order was created, in ISO 8601 format. | -| `updatedAt` | `string \| undefined` | Optional | The time when the order was last modified, in ISO 8601 format. | -| `expiresAt` | `string \| null \| undefined` | Optional | The time when the order expires if no action is taken, in ISO 8601 format. | -| `paymentId` | `string \| null \| undefined` | Optional | The unique identifier of the payment associated with the order. | -| `buyerNote` | `string \| null \| undefined` | Optional | A note provided by the buyer when the order was created, if any. | -| `completedNote` | `string \| null \| undefined` | Optional | A note provided by the merchant when the order's state was set to COMPLETED, if any | -| `refundedNote` | `string \| null \| undefined` | Optional | A note provided by the merchant when the order's state was set to REFUNDED, if any. | -| `canceledNote` | `string \| null \| undefined` | Optional | A note provided by the merchant when the order's state was set to CANCELED, if any. | -| `tender` | [`V1Tender \| undefined`](../../doc/models/v1-tender.md) | Optional | A tender represents a discrete monetary exchange. Square represents this
exchange as a money object with a specific currency and amount, where the
amount is given in the smallest denomination of the given currency.

Square POS can accept more than one form of tender for a single payment (such
as by splitting a bill between a credit card and a gift card). The `tender`
field of the Payment object lists all forms of tender used for the payment.

Split tender payments behave slightly differently from single tender payments:

The receipt_url for a split tender corresponds only to the first tender listed
in the tender field. To get the receipt URLs for the remaining tenders, use
the receipt_url fields of the corresponding Tender objects.

*A note on gift cards**: when a customer purchases a Square gift card from a
merchant, the merchant receives the full amount of the gift card in the
associated payment.

When that gift card is used as a tender, the balance of the gift card is
reduced and the merchant receives no funds. A `Tender` object with a type of
`SQUARE_GIFT_CARD` indicates a gift card was used for some or all of the
associated payment. | -| `orderHistory` | [`V1OrderHistoryEntry[] \| null \| undefined`](../../doc/models/v1-order-history-entry.md) | Optional | The history of actions associated with the order. | -| `promoCode` | `string \| null \| undefined` | Optional | The promo code provided by the buyer, if any. | -| `btcReceiveAddress` | `string \| null \| undefined` | Optional | For Bitcoin transactions, the address that the buyer sent Bitcoin to. | -| `btcPriceSatoshi` | `number \| null \| undefined` | Optional | For Bitcoin transactions, the price of the buyer's order in satoshi (100 million satoshi equals 1 BTC). | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ], - "id": "id0", - "buyer_email": "buyer_email8", - "recipient_name": "recipient_name8", - "recipient_phone_number": "recipient_phone_number4" -} -``` - diff --git a/doc/models/v1-phone-number.md b/doc/models/v1-phone-number.md deleted file mode 100644 index 9531b0535..000000000 --- a/doc/models/v1-phone-number.md +++ /dev/null @@ -1,25 +0,0 @@ - -# V1 Phone Number - -Represents a phone number. - -## Structure - -`V1PhoneNumber` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `callingCode` | `string` | Required | The phone number's international calling code. For US phone numbers, this value is +1. | -| `number` | `string` | Required | The phone number. | - -## Example (as JSON) - -```json -{ - "calling_code": "calling_code0", - "number": "number4" -} -``` - diff --git a/doc/models/v1-tender-card-brand.md b/doc/models/v1-tender-card-brand.md deleted file mode 100644 index cf0508a98..000000000 --- a/doc/models/v1-tender-card-brand.md +++ /dev/null @@ -1,23 +0,0 @@ - -# V1 Tender Card Brand - -The brand of a credit card. - -## Enumeration - -`V1TenderCardBrand` - -## Fields - -| Name | -| --- | -| `OTHER_BRAND` | -| `VISA` | -| `MASTER_CARD` | -| `AMERICAN_EXPRESS` | -| `DISCOVER` | -| `DISCOVER_DINERS` | -| `JCB` | -| `CHINA_UNIONPAY` | -| `SQUARE_GIFT_CARD` | - diff --git a/doc/models/v1-tender-entry-method.md b/doc/models/v1-tender-entry-method.md deleted file mode 100644 index 749c522fd..000000000 --- a/doc/models/v1-tender-entry-method.md +++ /dev/null @@ -1,19 +0,0 @@ - -# V1 Tender Entry Method - -## Enumeration - -`V1TenderEntryMethod` - -## Fields - -| Name | -| --- | -| `MANUAL` | -| `SCANNED` | -| `SQUARE_CASH` | -| `SQUARE_WALLET` | -| `SWIPED` | -| `WEB_FORM` | -| `OTHER` | - diff --git a/doc/models/v1-tender-type.md b/doc/models/v1-tender-type.md deleted file mode 100644 index df7b569bc..000000000 --- a/doc/models/v1-tender-type.md +++ /dev/null @@ -1,20 +0,0 @@ - -# V1 Tender Type - -## Enumeration - -`V1TenderType` - -## Fields - -| Name | -| --- | -| `CREDIT_CARD` | -| `CASH` | -| `THIRD_PARTY_CARD` | -| `NO_SALE` | -| `SQUARE_WALLET` | -| `SQUARE_GIFT_CARD` | -| `UNKNOWN` | -| `OTHER` | - diff --git a/doc/models/v1-tender.md b/doc/models/v1-tender.md deleted file mode 100644 index aaf542f15..000000000 --- a/doc/models/v1-tender.md +++ /dev/null @@ -1,63 +0,0 @@ - -# V1 Tender - -A tender represents a discrete monetary exchange. Square represents this -exchange as a money object with a specific currency and amount, where the -amount is given in the smallest denomination of the given currency. - -Square POS can accept more than one form of tender for a single payment (such -as by splitting a bill between a credit card and a gift card). The `tender` -field of the Payment object lists all forms of tender used for the payment. - -Split tender payments behave slightly differently from single tender payments: - -The receipt_url for a split tender corresponds only to the first tender listed -in the tender field. To get the receipt URLs for the remaining tenders, use -the receipt_url fields of the corresponding Tender objects. - -*A note on gift cards**: when a customer purchases a Square gift card from a -merchant, the merchant receives the full amount of the gift card in the -associated payment. - -When that gift card is used as a tender, the balance of the gift card is -reduced and the merchant receives no funds. A `Tender` object with a type of -`SQUARE_GIFT_CARD` indicates a gift card was used for some or all of the -associated payment. - -## Structure - -`V1Tender` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The tender's unique ID. | -| `type` | [`string \| undefined`](../../doc/models/v1-tender-type.md) | Optional | - | -| `name` | `string \| null \| undefined` | Optional | A human-readable description of the tender. | -| `employeeId` | `string \| null \| undefined` | Optional | The ID of the employee that processed the tender. | -| `receiptUrl` | `string \| null \| undefined` | Optional | The URL of the receipt for the tender. | -| `cardBrand` | [`string \| undefined`](../../doc/models/v1-tender-card-brand.md) | Optional | The brand of a credit card. | -| `panSuffix` | `string \| null \| undefined` | Optional | The last four digits of the provided credit card's account number. | -| `entryMethod` | [`string \| undefined`](../../doc/models/v1-tender-entry-method.md) | Optional | - | -| `paymentNote` | `string \| null \| undefined` | Optional | Notes entered by the merchant about the tender at the time of payment, if any. Typically only present for tender with the type: OTHER. | -| `totalMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `tenderedMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `tenderedAt` | `string \| null \| undefined` | Optional | The time when the tender was created, in ISO 8601 format. | -| `settledAt` | `string \| null \| undefined` | Optional | The time when the tender was settled, in ISO 8601 format. | -| `changeBackMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `refundedMoney` | [`V1Money \| undefined`](../../doc/models/v1-money.md) | Optional | - | -| `isExchange` | `boolean \| null \| undefined` | Optional | Indicates whether or not the tender is associated with an exchange. If is_exchange is true, the tender represents the value of goods returned in an exchange not the actual money paid. The exchange value reduces the tender amounts needed to pay for items purchased in the exchange. | - -## Example (as JSON) - -```json -{ - "id": "id6", - "type": "SQUARE_WALLET", - "name": "name6", - "employee_id": "employee_id4", - "receipt_url": "receipt_url2" -} -``` - diff --git a/doc/models/v1-update-order-request-action.md b/doc/models/v1-update-order-request-action.md deleted file mode 100644 index 6fd004a5b..000000000 --- a/doc/models/v1-update-order-request-action.md +++ /dev/null @@ -1,15 +0,0 @@ - -# V1 Update Order Request Action - -## Enumeration - -`V1UpdateOrderRequestAction` - -## Fields - -| Name | -| --- | -| `COMPLETE` | -| `CANCEL` | -| `REFUND` | - diff --git a/doc/models/v1-update-order-request.md b/doc/models/v1-update-order-request.md deleted file mode 100644 index 0f8973be1..000000000 --- a/doc/models/v1-update-order-request.md +++ /dev/null @@ -1,31 +0,0 @@ - -# V1 Update Order Request - -V1UpdateOrderRequest - -## Structure - -`V1UpdateOrderRequest` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `action` | [`string`](../../doc/models/v1-update-order-request-action.md) | Required | - | -| `shippedTrackingNumber` | `string \| null \| undefined` | Optional | The tracking number of the shipment associated with the order. Only valid if action is COMPLETE. | -| `completedNote` | `string \| null \| undefined` | Optional | A merchant-specified note about the completion of the order. Only valid if action is COMPLETE. | -| `refundedNote` | `string \| null \| undefined` | Optional | A merchant-specified note about the refunding of the order. Only valid if action is REFUND. | -| `canceledNote` | `string \| null \| undefined` | Optional | A merchant-specified note about the canceling of the order. Only valid if action is CANCEL. | - -## Example (as JSON) - -```json -{ - "action": "COMPLETE", - "shipped_tracking_number": "shipped_tracking_number4", - "completed_note": "completed_note4", - "refunded_note": "refunded_note8", - "canceled_note": "canceled_note6" -} -``` - diff --git a/doc/models/vendor-contact.md b/doc/models/vendor-contact.md deleted file mode 100644 index 38cf1b6b8..000000000 --- a/doc/models/vendor-contact.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Vendor Contact - -Represents a contact of a [Vendor](../../doc/models/vendor.md). - -## Structure - -`VendorContact` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique Square-generated ID for the [VendorContact](entity:VendorContact).
This field is required when attempting to update a [VendorContact](entity:VendorContact).
**Constraints**: *Maximum Length*: `100` | -| `name` | `string \| null \| undefined` | Optional | The name of the [VendorContact](entity:VendorContact).
This field is required when attempting to create a [Vendor](entity:Vendor).
**Constraints**: *Maximum Length*: `255` | -| `emailAddress` | `string \| null \| undefined` | Optional | The email address of the [VendorContact](entity:VendorContact).
**Constraints**: *Maximum Length*: `255` | -| `phoneNumber` | `string \| null \| undefined` | Optional | The phone number of the [VendorContact](entity:VendorContact).
**Constraints**: *Maximum Length*: `255` | -| `removed` | `boolean \| null \| undefined` | Optional | The state of the [VendorContact](entity:VendorContact). | -| `ordinal` | `number` | Required | The ordinal of the [VendorContact](entity:VendorContact). | - -## Example (as JSON) - -```json -{ - "id": "id0", - "name": "name0", - "email_address": "email_address8", - "phone_number": "phone_number8", - "removed": false, - "ordinal": 244 -} -``` - diff --git a/doc/models/vendor-status.md b/doc/models/vendor-status.md deleted file mode 100644 index 11bb2813c..000000000 --- a/doc/models/vendor-status.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Vendor Status - -The status of the [Vendor](../../doc/models/vendor.md), -whether a [Vendor](../../doc/models/vendor.md) is active or inactive. - -## Enumeration - -`VendorStatus` - -## Fields - -| Name | Description | -| --- | --- | -| `ACTIVE` | Vendor is active and can receive purchase orders. | -| `INACTIVE` | Vendor is inactive and cannot receive purchase orders. | - diff --git a/doc/models/vendor.md b/doc/models/vendor.md deleted file mode 100644 index 330838714..000000000 --- a/doc/models/vendor.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Vendor - -Represents a supplier to a seller. - -## Structure - -`Vendor` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A unique Square-generated ID for the [Vendor](entity:Vendor).
This field is required when attempting to update a [Vendor](entity:Vendor).
**Constraints**: *Maximum Length*: `100` | -| `createdAt` | `string \| undefined` | Optional | An RFC 3339-formatted timestamp that indicates when the
[Vendor](entity:Vendor) was created.
**Constraints**: *Maximum Length*: `34` | -| `updatedAt` | `string \| undefined` | Optional | An RFC 3339-formatted timestamp that indicates when the
[Vendor](entity:Vendor) was last updated.
**Constraints**: *Maximum Length*: `34` | -| `name` | `string \| null \| undefined` | Optional | The name of the [Vendor](entity:Vendor).
This field is required when attempting to create or update a [Vendor](entity:Vendor).
**Constraints**: *Maximum Length*: `100` | -| `address` | [`Address \| undefined`](../../doc/models/address.md) | Optional | Represents a postal address in a country.
For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | -| `contacts` | [`VendorContact[] \| null \| undefined`](../../doc/models/vendor-contact.md) | Optional | The contacts of the [Vendor](entity:Vendor). | -| `accountNumber` | `string \| null \| undefined` | Optional | The account number of the [Vendor](entity:Vendor).
**Constraints**: *Maximum Length*: `100` | -| `note` | `string \| null \| undefined` | Optional | A note detailing information about the [Vendor](entity:Vendor).
**Constraints**: *Maximum Length*: `4096` | -| `version` | `number \| undefined` | Optional | The version of the [Vendor](entity:Vendor). | -| `status` | [`string \| undefined`](../../doc/models/vendor-status.md) | Optional | The status of the [Vendor](../../doc/models/vendor.md),
whether a [Vendor](../../doc/models/vendor.md) is active or inactive. | - -## Example (as JSON) - -```json -{ - "id": "id8", - "created_at": "created_at6", - "updated_at": "updated_at4", - "name": "name8", - "address": { - "address_line_1": "address_line_16", - "address_line_2": "address_line_26", - "address_line_3": "address_line_32", - "locality": "locality6", - "sublocality": "sublocality6" - } -} -``` - diff --git a/doc/models/visibility-filter.md b/doc/models/visibility-filter.md deleted file mode 100644 index d39343bc1..000000000 --- a/doc/models/visibility-filter.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Visibility Filter - -Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. - -## Enumeration - -`VisibilityFilter` - -## Fields - -| Name | Description | -| --- | --- | -| `ALL` | All custom attributes or custom attribute definitions. | -| `READ` | All custom attributes or custom attribute definitions with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. | -| `READ_WRITE` | All custom attributes or custom attribute definitions with the `visibility` field set to `VISIBILITY_READ_WRITE_VALUES`. | - diff --git a/doc/models/void-transaction-response.md b/doc/models/void-transaction-response.md deleted file mode 100644 index 5520bba56..000000000 --- a/doc/models/void-transaction-response.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Void Transaction Response - -Defines the fields that are included in the response body of -a request to the [VoidTransaction](api-endpoint:Transactions-VoidTransaction) endpoint. - -## Structure - -`VoidTransactionResponse` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | - -## Example (as JSON) - -```json -{ - "errors": [ - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - }, - { - "category": "MERCHANT_SUBSCRIPTION_ERROR", - "code": "INVALID_EXPIRATION", - "detail": "detail6", - "field": "field4" - } - ] -} -``` - diff --git a/doc/models/wage-setting.md b/doc/models/wage-setting.md deleted file mode 100644 index 993088b17..000000000 --- a/doc/models/wage-setting.md +++ /dev/null @@ -1,76 +0,0 @@ - -# Wage Setting - -Represents information about the overtime exemption status, job assignments, and compensation -for a [team member](../../doc/models/team-member.md). - -## Structure - -`WageSetting` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `teamMemberId` | `string \| null \| undefined` | Optional | The ID of the team member associated with the wage setting. | -| `jobAssignments` | [`JobAssignment[] \| null \| undefined`](../../doc/models/job-assignment.md) | Optional | **Required** The ordered list of jobs that the team member is assigned to.
The first job assignment is considered the team member's primary job. | -| `isOvertimeExempt` | `boolean \| null \| undefined` | Optional | Whether the team member is exempt from the overtime rules of the seller's country. | -| `version` | `number \| undefined` | Optional | **Read only** Used for resolving concurrency issues. The request fails if the version
provided does not match the server version at the time of the request. If not provided,
Square executes a blind write, potentially overwriting data from another write. For more information,
see [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency). | -| `createdAt` | `string \| undefined` | Optional | The timestamp when the wage setting was created, in RFC 3339 format. | -| `updatedAt` | `string \| undefined` | Optional | The timestamp when the wage setting was last updated, in RFC 3339 format. | - -## Example (as JSON) - -```json -{ - "team_member_id": "team_member_id2", - "job_assignments": [ - { - "job_title": "job_title6", - "pay_type": "SALARY", - "hourly_rate": { - "amount": 172, - "currency": "LAK" - }, - "annual_rate": { - "amount": 232, - "currency": "NIO" - }, - "weekly_hours": 98, - "job_id": "job_id2" - }, - { - "job_title": "job_title6", - "pay_type": "SALARY", - "hourly_rate": { - "amount": 172, - "currency": "LAK" - }, - "annual_rate": { - "amount": 232, - "currency": "NIO" - }, - "weekly_hours": 98, - "job_id": "job_id2" - }, - { - "job_title": "job_title6", - "pay_type": "SALARY", - "hourly_rate": { - "amount": 172, - "currency": "LAK" - }, - "annual_rate": { - "amount": 232, - "currency": "NIO" - }, - "weekly_hours": 98, - "job_id": "job_id2" - } - ], - "is_overtime_exempt": false, - "version": 140, - "created_at": "created_at0" -} -``` - diff --git a/doc/models/webhook-subscription.md b/doc/models/webhook-subscription.md deleted file mode 100644 index 80c8bdd4a..000000000 --- a/doc/models/webhook-subscription.md +++ /dev/null @@ -1,38 +0,0 @@ - -# Webhook Subscription - -Represents the details of a webhook subscription, including notification URL, -event types, and signature key. - -## Structure - -`WebhookSubscription` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | A Square-generated unique ID for the subscription.
**Constraints**: *Maximum Length*: `64` | -| `name` | `string \| null \| undefined` | Optional | The name of this subscription.
**Constraints**: *Maximum Length*: `64` | -| `enabled` | `boolean \| null \| undefined` | Optional | Indicates whether the subscription is enabled (`true`) or not (`false`). | -| `eventTypes` | `string[] \| null \| undefined` | Optional | The event types associated with this subscription. | -| `notificationUrl` | `string \| null \| undefined` | Optional | The URL to which webhooks are sent. | -| `apiVersion` | `string \| null \| undefined` | Optional | The API version of the subscription.
This field is optional for `CreateWebhookSubscription`.
The value defaults to the API version used by the application. | -| `signatureKey` | `string \| undefined` | Optional | The Square-generated signature key used to validate the origin of the webhook event. | -| `createdAt` | `string \| undefined` | Optional | The timestamp of when the subscription was created, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". | -| `updatedAt` | `string \| undefined` | Optional | The timestamp of when the subscription was last updated, in RFC 3339 format.
For example, "2016-09-04T23:59:33.123Z". | - -## Example (as JSON) - -```json -{ - "id": "id8", - "name": "name8", - "enabled": false, - "event_types": [ - "event_types6" - ], - "notification_url": "notification_url2" -} -``` - diff --git a/doc/models/weekday.md b/doc/models/weekday.md deleted file mode 100644 index 308543ff6..000000000 --- a/doc/models/weekday.md +++ /dev/null @@ -1,21 +0,0 @@ - -# Weekday - -The days of the week. - -## Enumeration - -`Weekday` - -## Fields - -| Name | Description | -| --- | --- | -| `MON` | Monday | -| `TUE` | Tuesday | -| `WED` | Wednesday | -| `THU` | Thursday | -| `FRI` | Friday | -| `SAT` | Saturday | -| `SUN` | Sunday | - diff --git a/doc/models/workweek-config.md b/doc/models/workweek-config.md deleted file mode 100644 index 2ba7e1efe..000000000 --- a/doc/models/workweek-config.md +++ /dev/null @@ -1,34 +0,0 @@ - -# Workweek Config - -Sets the day of the week and hour of the day that a business starts a -workweek. This is used to calculate overtime pay. - -## Structure - -`WorkweekConfig` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `string \| undefined` | Optional | The UUID for this object. | -| `startOfWeek` | [`string`](../../doc/models/weekday.md) | Required | The days of the week. | -| `startOfDayLocalTime` | `string` | Required | The local time at which a business week starts. Represented as a
string in `HH:MM` format (`HH:MM:SS` is also accepted, but seconds are
truncated).
**Constraints**: *Minimum Length*: `1` | -| `version` | `number \| undefined` | Optional | Used for resolving concurrency issues. The request fails if the version
provided does not match the server version at the time of the request. If not provided,
Square executes a blind write; potentially overwriting data from another
write. | -| `createdAt` | `string \| undefined` | Optional | A read-only timestamp in RFC 3339 format; presented in UTC. | -| `updatedAt` | `string \| undefined` | Optional | A read-only timestamp in RFC 3339 format; presented in UTC. | - -## Example (as JSON) - -```json -{ - "id": "id4", - "start_of_week": "SUN", - "start_of_day_local_time": "start_of_day_local_time0", - "version": 104, - "created_at": "created_at2", - "updated_at": "updated_at0" -} -``` - diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 091b875d7..000000000 --- a/jest.config.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - testEnvironment: 'node', - preset: 'ts-jest', - transform: { - '^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.base.json' }], - }, -}; diff --git a/jest.config.mjs b/jest.config.mjs new file mode 100644 index 000000000..c7248211d --- /dev/null +++ b/jest.config.mjs @@ -0,0 +1,8 @@ +/** @type {import('jest').Config} */ +export default { + preset: "ts-jest", + testEnvironment: "node", + moduleNameMapper: { + "(.+)\.js$": "$1", + }, +}; diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 24fdc7754..000000000 --- a/package-lock.json +++ /dev/null @@ -1,9852 +0,0 @@ -{ - "name": "square", - "version": "4.5.6", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@apimatic/schema": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@apimatic/schema/-/schema-0.4.1.tgz", - "integrity": "sha512-KdGp4GaC0sTlcwshahvqZ8OrB/QEM99lxm3sEAo5JgVQP3XH0y/+zeguV8OZhiXRsHERoVZvcI4rKBSHcL84gQ==", - "requires": { - "lodash.flatten": "^4.4.0" - } - }, - "@babel/code-frame": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", - "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", - "dev": true, - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "@babel/compat-data": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.12.1.tgz", - "integrity": "sha512-725AQupWJZ8ba0jbKceeFblZTY90McUBWMwHhkFQ9q1zKPJ95GUktljFcgcsIVwRnTnRKlcYzfiNImg5G9m6ZQ==", - "dev": true - }, - "@babel/core": { - "version": "7.12.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", - "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.1", - "@babel/helper-module-transforms": "^7.12.1", - "@babel/helpers": "^7.12.1", - "@babel/parser": "^7.12.3", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.12.1", - "@babel/types": "^7.12.1", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", - "json5": "^2.1.2", - "lodash": "^4.17.19", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "@babel/generator": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.1.tgz", - "integrity": "sha512-DB+6rafIdc9o72Yc3/Ph5h+6hUjeOp66pF0naQBgUFFuPqzQwIlPTm3xZR7YNvduIMtkDIj2t21LSQwnbCrXvg==", - "dev": true, - "requires": { - "@babel/types": "^7.12.1", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "@babel/helper-annotate-as-pure": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.4.tgz", - "integrity": "sha512-XQlqKQP4vXFB7BN8fEEerrmYvHp3fK/rBkRFz9jaJbzK0B1DSfej9Kc7ZzE8Z/OnId1jpJdNAZ3BFQjWG68rcA==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz", - "integrity": "sha512-L0zGlFrGWZK4PbT8AszSfLTM5sDU1+Az/En9VrdT8/LmEiJt4zXt+Jve9DCAnQcbqDhCI+29y/L93mrDzddCcg==", - "dev": true, - "requires": { - "@babel/helper-explode-assignable-expression": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-compilation-targets": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.12.1.tgz", - "integrity": "sha512-jtBEif7jsPwP27GPHs06v4WBV0KrE8a/P7n0N0sSvHn2hwUCYnolP/CLmz51IzAW4NlN+HuoBtb9QcwnRo9F/g==", - "dev": true, - "requires": { - "@babel/compat-data": "^7.12.1", - "@babel/helper-validator-option": "^7.12.1", - "browserslist": "^4.12.0", - "semver": "^5.5.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "@babel/helper-create-class-features-plugin": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.1.tgz", - "integrity": "sha512-hkL++rWeta/OVOBTRJc9a5Azh5mt5WgZUGAKMD8JM141YsE08K//bp1unBBieO6rUKkIPyUE0USQ30jAy3Sk1w==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-member-expression-to-functions": "^7.12.1", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/helper-replace-supers": "^7.12.1", - "@babel/helper-split-export-declaration": "^7.10.4" - } - }, - "@babel/helper-create-regexp-features-plugin": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.1.tgz", - "integrity": "sha512-rsZ4LGvFTZnzdNZR5HZdmJVuXK8834R5QkF3WvcnBhrlVtF0HSIUC6zbreL9MgjTywhKokn8RIYRiq99+DLAxA==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.10.4", - "@babel/helper-regex": "^7.10.4", - "regexpu-core": "^4.7.1" - } - }, - "@babel/helper-define-map": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz", - "integrity": "sha512-fMw4kgFB720aQFXSVaXr79pjjcW5puTCM16+rECJ/plGS+zByelE8l9nCpV1GibxTnFVmUuYG9U8wYfQHdzOEQ==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/types": "^7.10.5", - "lodash": "^4.17.19" - } - }, - "@babel/helper-define-polyfill-provider": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.0.3.tgz", - "integrity": "sha512-dULDd/APiP4JowYDAMosecKOi/1v+UId99qhBGiO3myM29KtAVKS/R3x3OJJNBR0FeYB1BcYb2dCwkhqvxWXXQ==", - "dev": true, - "requires": { - "@babel/helper-compilation-targets": "^7.10.4", - "@babel/helper-module-imports": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/traverse": "^7.11.5", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "@babel/helper-explode-assignable-expression": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.12.1.tgz", - "integrity": "sha512-dmUwH8XmlrUpVqgtZ737tK88v07l840z9j3OEhCLwKTkjlvKpfqXVIZ0wpK3aeOxspwGrf/5AP5qLx4rO3w5rA==", - "dev": true, - "requires": { - "@babel/types": "^7.12.1" - } - }, - "@babel/helper-function-name": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz", - "integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz", - "integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.4.tgz", - "integrity": "sha512-wljroF5PgCk2juF69kanHVs6vrLwIPNp6DLD+Lrl3hoQ3PpPPikaDRNFA+0t81NOoMt2DL6WW/mdU8k4k6ZzuA==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.1.tgz", - "integrity": "sha512-k0CIe3tXUKTRSoEx1LQEPFU9vRQfqHtl+kf8eNnDqb4AUJEy5pz6aIiog+YWtVm2jpggjS1laH68bPsR+KWWPQ==", - "dev": true, - "requires": { - "@babel/types": "^7.12.1" - } - }, - "@babel/helper-module-imports": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.1.tgz", - "integrity": "sha512-ZeC1TlMSvikvJNy1v/wPIazCu3NdOwgYZLIkmIyAsGhqkNpiDoQQRmaCK8YP4Pq3GPTLPV9WXaPCJKvx06JxKA==", - "dev": true, - "requires": { - "@babel/types": "^7.12.1" - } - }, - "@babel/helper-module-transforms": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz", - "integrity": "sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.12.1", - "@babel/helper-replace-supers": "^7.12.1", - "@babel/helper-simple-access": "^7.12.1", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/helper-validator-identifier": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.12.1", - "@babel/types": "^7.12.1", - "lodash": "^4.17.19" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz", - "integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==", - "dev": true, - "requires": { - "@babel/types": "^7.10.4" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz", - "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==", - "dev": true - }, - "@babel/helper-regex": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.10.5.tgz", - "integrity": "sha512-68kdUAzDrljqBrio7DYAEgCoJHxppJOERHOgOrDN7WjOzP0ZQ1LsSDRXcemzVZaLvjaJsJEESb6qt+znNuENDg==", - "dev": true, - "requires": { - "lodash": "^4.17.19" - } - }, - "@babel/helper-remap-async-to-generator": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.12.1.tgz", - "integrity": "sha512-9d0KQCRM8clMPcDwo8SevNs+/9a8yWVVmaE80FGJcEP8N1qToREmWEGnBn8BUlJhYRFz6fqxeRL1sl5Ogsed7A==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.10.4", - "@babel/helper-wrap-function": "^7.10.4", - "@babel/types": "^7.12.1" - } - }, - "@babel/helper-replace-supers": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.1.tgz", - "integrity": "sha512-zJjTvtNJnCFsCXVi5rUInstLd/EIVNmIKA1Q9ynESmMBWPWd+7sdR+G4/wdu+Mppfep0XLyG2m7EBPvjCeFyrw==", - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.12.1", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/traverse": "^7.12.1", - "@babel/types": "^7.12.1" - } - }, - "@babel/helper-simple-access": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz", - "integrity": "sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==", - "dev": true, - "requires": { - "@babel/types": "^7.12.1" - } - }, - "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.12.1.tgz", - "integrity": "sha512-Mf5AUuhG1/OCChOJ/HcADmvcHM42WJockombn8ATJG3OnyiSxBK/Mm5x78BQWvmtXZKHgbjdGL2kin/HOLlZGA==", - "dev": true, - "requires": { - "@babel/types": "^7.12.1" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz", - "integrity": "sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==", - "dev": true, - "requires": { - "@babel/types": "^7.11.0" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", - "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", - "dev": true - }, - "@babel/helper-validator-option": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.1.tgz", - "integrity": "sha512-YpJabsXlJVWP0USHjnC/AQDTLlZERbON577YUVO/wLpqyj6HAtVYnWaQaN0iUN+1/tWn3c+uKKXjRut5115Y2A==", - "dev": true - }, - "@babel/helper-wrap-function": { - "version": "7.12.3", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.12.3.tgz", - "integrity": "sha512-Cvb8IuJDln3rs6tzjW3Y8UeelAOdnpB8xtQ4sme2MSZ9wOxrbThporC0y/EtE16VAtoyEfLM404Xr1e0OOp+ow==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/helpers": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.1.tgz", - "integrity": "sha512-9JoDSBGoWtmbay98efmT2+mySkwjzeFeAL9BuWNoVQpkPFQF8SIIFUfY5os9u8wVzglzoiPRSW7cuJmBDUt43g==", - "dev": true, - "requires": { - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.12.1", - "@babel/types": "^7.12.1" - } - }, - "@babel/highlight": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", - "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - } - } - }, - "@babel/parser": { - "version": "7.12.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.12.3.tgz", - "integrity": "sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw==", - "dev": true - }, - "@babel/plugin-proposal-async-generator-functions": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.1.tgz", - "integrity": "sha512-d+/o30tJxFxrA1lhzJqiUcEJdI6jKlNregCv5bASeGf2Q4MXmnwH7viDo7nhx1/ohf09oaH8j1GVYG/e3Yqk6A==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-remap-async-to-generator": "^7.12.1", - "@babel/plugin-syntax-async-generators": "^7.8.0" - } - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.1.tgz", - "integrity": "sha512-cKp3dlQsFsEs5CWKnN7BnSHOd0EOW8EKpEjkoz1pO2E5KzIDNV9Ros1b0CnmbVgAGXJubOYVBOGCT1OmJwOI7w==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-proposal-dynamic-import": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.12.1.tgz", - "integrity": "sha512-a4rhUSZFuq5W8/OO8H7BL5zspjnc1FLd9hlOxIK/f7qG4a0qsqk8uvF/ywgBA8/OmjsapjpvaEOYItfGG1qIvQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-dynamic-import": "^7.8.0" - } - }, - "@babel/plugin-proposal-export-namespace-from": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.12.1.tgz", - "integrity": "sha512-6CThGf0irEkzujYS5LQcjBx8j/4aQGiVv7J9+2f7pGfxqyKh3WnmVJYW3hdrQjyksErMGBPQrCnHfOtna+WLbw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - } - }, - "@babel/plugin-proposal-json-strings": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.12.1.tgz", - "integrity": "sha512-GoLDUi6U9ZLzlSda2Df++VSqDJg3CG+dR0+iWsv6XRw1rEq+zwt4DirM9yrxW6XWaTpmai1cWJLMfM8qQJf+yw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-json-strings": "^7.8.0" - } - }, - "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.12.1.tgz", - "integrity": "sha512-k8ZmVv0JU+4gcUGeCDZOGd0lCIamU/sMtIiX3UWnUc5yzgq6YUGyEolNYD+MLYKfSzgECPcqetVcJP9Afe/aCA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - } - }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.12.1.tgz", - "integrity": "sha512-nZY0ESiaQDI1y96+jk6VxMOaL4LPo/QDHBqL+SF3/vl6dHkTwHlOI8L4ZwuRBHgakRBw5zsVylel7QPbbGuYgg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" - } - }, - "@babel/plugin-proposal-numeric-separator": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.12.1.tgz", - "integrity": "sha512-MR7Ok+Af3OhNTCxYVjJZHS0t97ydnJZt/DbR4WISO39iDnhiD8XHrY12xuSJ90FFEGjir0Fzyyn7g/zY6hxbxA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - } - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.12.1.tgz", - "integrity": "sha512-s6SowJIjzlhx8o7lsFx5zmY4At6CTtDvgNQDdPzkBQucle58A6b/TTeEBYtyDgmcXjUTM+vE8YOGHZzzbc/ioA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.0", - "@babel/plugin-transform-parameters": "^7.12.1" - } - }, - "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.12.1.tgz", - "integrity": "sha512-hFvIjgprh9mMw5v42sJWLI1lzU5L2sznP805zeT6rySVRA0Y18StRhDqhSxlap0oVgItRsB6WSROp4YnJTJz0g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.0" - } - }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.12.1.tgz", - "integrity": "sha512-c2uRpY6WzaVDzynVY9liyykS+kVU+WRZPMPYpkelXH8KBt1oXoI89kPbZKKG/jDT5UK92FTW2fZkZaJhdiBabw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1", - "@babel/plugin-syntax-optional-chaining": "^7.8.0" - } - }, - "@babel/plugin-proposal-private-methods": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.1.tgz", - "integrity": "sha512-mwZ1phvH7/NHK6Kf8LP7MYDogGV+DKB1mryFOEwx5EBNQrosvIczzZFTUmWaeujd5xT6G1ELYWUz3CutMhjE1w==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.12.1.tgz", - "integrity": "sha512-MYq+l+PvHuw/rKUz1at/vb6nCnQ2gmJBNaM62z0OgH7B2W1D9pvkpYtlti9bGtizNIU1K3zm4bZF9F91efVY0w==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-class-properties": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.1.tgz", - "integrity": "sha512-U40A76x5gTwmESz+qiqssqmeEsKvcSyvtgktrm0uzcARAmM9I1jR221f6Oq+GmHrcD+LvZDag1UTOTe2fL3TeA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.3" - } - }, - "@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.1.tgz", - "integrity": "sha512-i7ooMZFS+a/Om0crxZodrTzNEPJHZrlMVGMTEpFAj6rYY/bKCddB0Dk/YxfPuYXOopuhKk/e1jV6h+WUU9XN3A==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-arrow-functions": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.12.1.tgz", - "integrity": "sha512-5QB50qyN44fzzz4/qxDPQMBCTHgxg3n0xRBLJUmBlLoU/sFvxVWGZF/ZUfMVDQuJUKXaBhbupxIzIfZ6Fwk/0A==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-async-to-generator": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.12.1.tgz", - "integrity": "sha512-SDtqoEcarK1DFlRJ1hHRY5HvJUj5kX4qmtpMAm2QnhOlyuMC4TMdCRgW6WXpv93rZeYNeLP22y8Aq2dbcDRM1A==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-remap-async-to-generator": "^7.12.1" - } - }, - "@babel/plugin-transform-block-scoped-functions": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.12.1.tgz", - "integrity": "sha512-5OpxfuYnSgPalRpo8EWGPzIYf0lHBWORCkj5M0oLBwHdlux9Ri36QqGW3/LR13RSVOAoUUMzoPI/jpE4ABcHoA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-block-scoping": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.1.tgz", - "integrity": "sha512-zJyAC9sZdE60r1nVQHblcfCj29Dh2Y0DOvlMkcqSo0ckqjiCwNiUezUKw+RjOCwGfpLRwnAeQ2XlLpsnGkvv9w==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-classes": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.12.1.tgz", - "integrity": "sha512-/74xkA7bVdzQTBeSUhLLJgYIcxw/dpEpCdRDiHgPJ3Mv6uC11UhjpOhl72CgqbBCmt1qtssCyB2xnJm1+PFjog==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.10.4", - "@babel/helper-define-map": "^7.10.4", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-optimise-call-expression": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-replace-supers": "^7.12.1", - "@babel/helper-split-export-declaration": "^7.10.4", - "globals": "^11.1.0" - } - }, - "@babel/plugin-transform-computed-properties": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.12.1.tgz", - "integrity": "sha512-vVUOYpPWB7BkgUWPo4C44mUQHpTZXakEqFjbv8rQMg7TC6S6ZhGZ3otQcRH6u7+adSlE5i0sp63eMC/XGffrzg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-destructuring": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.12.1.tgz", - "integrity": "sha512-fRMYFKuzi/rSiYb2uRLiUENJOKq4Gnl+6qOv5f8z0TZXg3llUwUhsNNwrwaT/6dUhJTzNpBr+CUvEWBtfNY1cw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-dotall-regex": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.12.1.tgz", - "integrity": "sha512-B2pXeRKoLszfEW7J4Hg9LoFaWEbr/kzo3teWHmtFCszjRNa/b40f9mfeqZsIDLLt/FjwQ6pz/Gdlwy85xNckBA==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-duplicate-keys": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.12.1.tgz", - "integrity": "sha512-iRght0T0HztAb/CazveUpUQrZY+aGKKaWXMJ4uf9YJtqxSUe09j3wteztCUDRHs+SRAL7yMuFqUsLoAKKzgXjw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-exponentiation-operator": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.12.1.tgz", - "integrity": "sha512-7tqwy2bv48q+c1EHbXK0Zx3KXd2RVQp6OC7PbwFNt/dPTAV3Lu5sWtWuAj8owr5wqtWnqHfl2/mJlUmqkChKug==", - "dev": true, - "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-for-of": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.12.1.tgz", - "integrity": "sha512-Zaeq10naAsuHo7heQvyV0ptj4dlZJwZgNAtBYBnu5nNKJoW62m0zKcIEyVECrUKErkUkg6ajMy4ZfnVZciSBhg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-function-name": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.12.1.tgz", - "integrity": "sha512-JF3UgJUILoFrFMEnOJLJkRHSk6LUSXLmEFsA23aR2O5CSLUxbeUX1IZ1YQ7Sn0aXb601Ncwjx73a+FVqgcljVw==", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-literals": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.12.1.tgz", - "integrity": "sha512-+PxVGA+2Ag6uGgL0A5f+9rklOnnMccwEBzwYFL3EUaKuiyVnUipyXncFcfjSkbimLrODoqki1U9XxZzTvfN7IQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-member-expression-literals": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.12.1.tgz", - "integrity": "sha512-1sxePl6z9ad0gFMB9KqmYofk34flq62aqMt9NqliS/7hPEpURUCMbyHXrMPlo282iY7nAvUB1aQd5mg79UD9Jg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-modules-amd": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.12.1.tgz", - "integrity": "sha512-tDW8hMkzad5oDtzsB70HIQQRBiTKrhfgwC/KkJeGsaNFTdWhKNt/BiE8c5yj19XiGyrxpbkOfH87qkNg1YGlOQ==", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-commonjs": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.12.1.tgz", - "integrity": "sha512-dY789wq6l0uLY8py9c1B48V8mVL5gZh/+PQ5ZPrylPYsnAvnEMjqsUXkuoDVPeVK+0VyGar+D08107LzDQ6pag==", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-simple-access": "^7.12.1", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-systemjs": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.12.1.tgz", - "integrity": "sha512-Hn7cVvOavVh8yvW6fLwveFqSnd7rbQN3zJvoPNyNaQSvgfKmDBO9U1YL9+PCXGRlZD9tNdWTy5ACKqMuzyn32Q==", - "dev": true, - "requires": { - "@babel/helper-hoist-variables": "^7.10.4", - "@babel/helper-module-transforms": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-validator-identifier": "^7.10.4", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-umd": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.12.1.tgz", - "integrity": "sha512-aEIubCS0KHKM0zUos5fIoQm+AZUMt1ZvMpqz0/H5qAQ7vWylr9+PLYurT+Ic7ID/bKLd4q8hDovaG3Zch2uz5Q==", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.12.1.tgz", - "integrity": "sha512-tB43uQ62RHcoDp9v2Nsf+dSM8sbNodbEicbQNA53zHz8pWUhsgHSJCGpt7daXxRydjb0KnfmB+ChXOv3oADp1Q==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.12.1" - } - }, - "@babel/plugin-transform-new-target": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.12.1.tgz", - "integrity": "sha512-+eW/VLcUL5L9IvJH7rT1sT0CzkdUTvPrXC2PXTn/7z7tXLBuKvezYbGdxD5WMRoyvyaujOq2fWoKl869heKjhw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-object-super": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.12.1.tgz", - "integrity": "sha512-AvypiGJH9hsquNUn+RXVcBdeE3KHPZexWRdimhuV59cSoOt5kFBmqlByorAeUlGG2CJWd0U+4ZtNKga/TB0cAw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-replace-supers": "^7.12.1" - } - }, - "@babel/plugin-transform-parameters": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.12.1.tgz", - "integrity": "sha512-xq9C5EQhdPK23ZeCdMxl8bbRnAgHFrw5EOC3KJUsSylZqdkCaFEXxGSBuTSObOpiiHHNyb82es8M1QYgfQGfNg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-property-literals": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.12.1.tgz", - "integrity": "sha512-6MTCR/mZ1MQS+AwZLplX4cEySjCpnIF26ToWo942nqn8hXSm7McaHQNeGx/pt7suI1TWOWMfa/NgBhiqSnX0cQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-regenerator": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.12.1.tgz", - "integrity": "sha512-gYrHqs5itw6i4PflFX3OdBPMQdPbF4bj2REIUxlMRUFk0/ZOAIpDFuViuxPjUL7YC8UPnf+XG7/utJvqXdPKng==", - "dev": true, - "requires": { - "regenerator-transform": "^0.14.2" - } - }, - "@babel/plugin-transform-reserved-words": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.12.1.tgz", - "integrity": "sha512-pOnUfhyPKvZpVyBHhSBoX8vfA09b7r00Pmm1sH+29ae2hMTKVmSp4Ztsr8KBKjLjx17H0eJqaRC3bR2iThM54A==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-shorthand-properties": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.12.1.tgz", - "integrity": "sha512-GFZS3c/MhX1OusqB1MZ1ct2xRzX5ppQh2JU1h2Pnfk88HtFTM+TWQqJNfwkmxtPQtb/s1tk87oENfXJlx7rSDw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-spread": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.12.1.tgz", - "integrity": "sha512-vuLp8CP0BE18zVYjsEBZ5xoCecMK6LBMMxYzJnh01rxQRvhNhH1csMMmBfNo5tGpGO+NhdSNW2mzIvBu3K1fng==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-skip-transparent-expression-wrappers": "^7.12.1" - } - }, - "@babel/plugin-transform-sticky-regex": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.12.1.tgz", - "integrity": "sha512-CiUgKQ3AGVk7kveIaPEET1jNDhZZEl1RPMWdTBE1799bdz++SwqDHStmxfCtDfBhQgCl38YRiSnrMuUMZIWSUQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-regex": "^7.10.4" - } - }, - "@babel/plugin-transform-template-literals": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.12.1.tgz", - "integrity": "sha512-b4Zx3KHi+taXB1dVRBhVJtEPi9h1THCeKmae2qP0YdUHIFhVjtpqqNfxeVAa1xeHVhAy4SbHxEwx5cltAu5apw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-typeof-symbol": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.12.1.tgz", - "integrity": "sha512-EPGgpGy+O5Kg5pJFNDKuxt9RdmTgj5sgrus2XVeMp/ZIbOESadgILUbm50SNpghOh3/6yrbsH+NB5+WJTmsA7Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-unicode-escapes": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.12.1.tgz", - "integrity": "sha512-I8gNHJLIc7GdApm7wkVnStWssPNbSRMPtgHdmH3sRM1zopz09UWPS4x5V4n1yz/MIWTVnJ9sp6IkuXdWM4w+2Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-transform-unicode-regex": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.12.1.tgz", - "integrity": "sha512-SqH4ClNngh/zGwHZOOQMTD+e8FGWexILV+ePMyiDJttAWRh5dhDL8rcl5lSgU3Huiq6Zn6pWTMvdPAb21Dwdyg==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/preset-env": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.12.1.tgz", - "integrity": "sha512-H8kxXmtPaAGT7TyBvSSkoSTUK6RHh61So05SyEbpmr0MCZrsNYn7mGMzzeYoOUCdHzww61k8XBft2TaES+xPLg==", - "dev": true, - "requires": { - "@babel/compat-data": "^7.12.1", - "@babel/helper-compilation-targets": "^7.12.1", - "@babel/helper-module-imports": "^7.12.1", - "@babel/helper-plugin-utils": "^7.10.4", - "@babel/helper-validator-option": "^7.12.1", - "@babel/plugin-proposal-async-generator-functions": "^7.12.1", - "@babel/plugin-proposal-class-properties": "^7.12.1", - "@babel/plugin-proposal-dynamic-import": "^7.12.1", - "@babel/plugin-proposal-export-namespace-from": "^7.12.1", - "@babel/plugin-proposal-json-strings": "^7.12.1", - "@babel/plugin-proposal-logical-assignment-operators": "^7.12.1", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1", - "@babel/plugin-proposal-numeric-separator": "^7.12.1", - "@babel/plugin-proposal-object-rest-spread": "^7.12.1", - "@babel/plugin-proposal-optional-catch-binding": "^7.12.1", - "@babel/plugin-proposal-optional-chaining": "^7.12.1", - "@babel/plugin-proposal-private-methods": "^7.12.1", - "@babel/plugin-proposal-unicode-property-regex": "^7.12.1", - "@babel/plugin-syntax-async-generators": "^7.8.0", - "@babel/plugin-syntax-class-properties": "^7.12.1", - "@babel/plugin-syntax-dynamic-import": "^7.8.0", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.0", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.0", - "@babel/plugin-syntax-top-level-await": "^7.12.1", - "@babel/plugin-transform-arrow-functions": "^7.12.1", - "@babel/plugin-transform-async-to-generator": "^7.12.1", - "@babel/plugin-transform-block-scoped-functions": "^7.12.1", - "@babel/plugin-transform-block-scoping": "^7.12.1", - "@babel/plugin-transform-classes": "^7.12.1", - "@babel/plugin-transform-computed-properties": "^7.12.1", - "@babel/plugin-transform-destructuring": "^7.12.1", - "@babel/plugin-transform-dotall-regex": "^7.12.1", - "@babel/plugin-transform-duplicate-keys": "^7.12.1", - "@babel/plugin-transform-exponentiation-operator": "^7.12.1", - "@babel/plugin-transform-for-of": "^7.12.1", - "@babel/plugin-transform-function-name": "^7.12.1", - "@babel/plugin-transform-literals": "^7.12.1", - "@babel/plugin-transform-member-expression-literals": "^7.12.1", - "@babel/plugin-transform-modules-amd": "^7.12.1", - "@babel/plugin-transform-modules-commonjs": "^7.12.1", - "@babel/plugin-transform-modules-systemjs": "^7.12.1", - "@babel/plugin-transform-modules-umd": "^7.12.1", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.12.1", - "@babel/plugin-transform-new-target": "^7.12.1", - "@babel/plugin-transform-object-super": "^7.12.1", - "@babel/plugin-transform-parameters": "^7.12.1", - "@babel/plugin-transform-property-literals": "^7.12.1", - "@babel/plugin-transform-regenerator": "^7.12.1", - "@babel/plugin-transform-reserved-words": "^7.12.1", - "@babel/plugin-transform-shorthand-properties": "^7.12.1", - "@babel/plugin-transform-spread": "^7.12.1", - "@babel/plugin-transform-sticky-regex": "^7.12.1", - "@babel/plugin-transform-template-literals": "^7.12.1", - "@babel/plugin-transform-typeof-symbol": "^7.12.1", - "@babel/plugin-transform-unicode-escapes": "^7.12.1", - "@babel/plugin-transform-unicode-regex": "^7.12.1", - "@babel/preset-modules": "^0.1.3", - "@babel/types": "^7.12.1", - "core-js-compat": "^3.6.2", - "semver": "^5.5.0" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "@babel/preset-modules": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.4.tgz", - "integrity": "sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - } - }, - "@babel/runtime": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", - "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", - "dev": true, - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, - "@babel/runtime-corejs3": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.12.1.tgz", - "integrity": "sha512-umhPIcMrlBZ2aTWlWjUseW9LjQKxi1dpFlQS8DzsxB//5K+u6GLTC/JliPKHsd5kJVPIU6X/Hy0YvWOYPcMxBw==", - "dev": true, - "requires": { - "core-js-pure": "^3.0.0", - "regenerator-runtime": "^0.13.4" - } - }, - "@babel/template": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.4.tgz", - "integrity": "sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/parser": "^7.10.4", - "@babel/types": "^7.10.4" - } - }, - "@babel/traverse": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.1.tgz", - "integrity": "sha512-MA3WPoRt1ZHo2ZmoGKNqi20YnPt0B1S0GTZEPhhd+hw2KGUzBlHuVunj6K4sNuK+reEvyiPwtp0cpaqLzJDmAw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.1", - "@babel/helper-function-name": "^7.10.4", - "@babel/helper-split-export-declaration": "^7.11.0", - "@babel/parser": "^7.12.1", - "@babel/types": "^7.12.1", - "debug": "^4.1.0", - "globals": "^11.1.0", - "lodash": "^4.17.19" - } - }, - "@babel/types": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.1.tgz", - "integrity": "sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.10.4", - "lodash": "^4.17.19", - "to-fast-properties": "^2.0.0" - } - }, - "@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true - }, - "@cnakazawa/watch": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", - "integrity": "sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ==", - "dev": true, - "requires": { - "exec-sh": "^0.3.2", - "minimist": "^1.2.0" - } - }, - "@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true - } - } - }, - "@istanbuljs/schema": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", - "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", - "dev": true - }, - "@jest/console": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-25.5.0.tgz", - "integrity": "sha512-T48kZa6MK1Y6k4b89sexwmSF4YLeZS/Udqg3Jj3jG/cHH+N/sLFCEoXEDMOKugJQ9FxPN1osxIknvKkxt6MKyw==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "chalk": "^3.0.0", - "jest-message-util": "^25.5.0", - "jest-util": "^25.5.0", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/core": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-25.5.4.tgz", - "integrity": "sha512-3uSo7laYxF00Dg/DMgbn4xMJKmDdWvZnf89n8Xj/5/AeQ2dOQmn6b6Hkj/MleyzZWXpwv+WSdYWl4cLsy2JsoA==", - "dev": true, - "requires": { - "@jest/console": "^25.5.0", - "@jest/reporters": "^25.5.1", - "@jest/test-result": "^25.5.0", - "@jest/transform": "^25.5.1", - "@jest/types": "^25.5.0", - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-changed-files": "^25.5.0", - "jest-config": "^25.5.4", - "jest-haste-map": "^25.5.1", - "jest-message-util": "^25.5.0", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.5.1", - "jest-resolve-dependencies": "^25.5.4", - "jest-runner": "^25.5.4", - "jest-runtime": "^25.5.4", - "jest-snapshot": "^25.5.1", - "jest-util": "^25.5.0", - "jest-validate": "^25.5.0", - "jest-watcher": "^25.5.0", - "micromatch": "^4.0.2", - "p-each-series": "^2.1.0", - "realpath-native": "^2.0.0", - "rimraf": "^3.0.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/environment": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-25.5.0.tgz", - "integrity": "sha512-U2VXPEqL07E/V7pSZMSQCvV5Ea4lqOlT+0ZFijl/i316cRMHvZ4qC+jBdryd+lmRetjQo0YIQr6cVPNxxK87mA==", - "dev": true, - "requires": { - "@jest/fake-timers": "^25.5.0", - "@jest/types": "^25.5.0", - "jest-mock": "^25.5.0" - } - }, - "@jest/fake-timers": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-25.5.0.tgz", - "integrity": "sha512-9y2+uGnESw/oyOI3eww9yaxdZyHq7XvprfP/eeoCsjqKYts2yRlsHS/SgjPDV8FyMfn2nbMy8YzUk6nyvdLOpQ==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "jest-message-util": "^25.5.0", - "jest-mock": "^25.5.0", - "jest-util": "^25.5.0", - "lolex": "^5.0.0" - } - }, - "@jest/globals": { - "version": "25.5.2", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-25.5.2.tgz", - "integrity": "sha512-AgAS/Ny7Q2RCIj5kZ+0MuKM1wbF0WMLxbCVl/GOMoCNbODRdJ541IxJ98xnZdVSZXivKpJlNPIWa3QmY0l4CXA==", - "dev": true, - "requires": { - "@jest/environment": "^25.5.0", - "@jest/types": "^25.5.0", - "expect": "^25.5.0" - } - }, - "@jest/reporters": { - "version": "25.5.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-25.5.1.tgz", - "integrity": "sha512-3jbd8pPDTuhYJ7vqiHXbSwTJQNavczPs+f1kRprRDxETeE3u6srJ+f0NPuwvOmk+lmunZzPkYWIFZDLHQPkviw==", - "dev": true, - "requires": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^25.5.0", - "@jest/test-result": "^25.5.0", - "@jest/transform": "^25.5.1", - "@jest/types": "^25.5.0", - "chalk": "^3.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.2", - "graceful-fs": "^4.2.4", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.2", - "jest-haste-map": "^25.5.1", - "jest-resolve": "^25.5.1", - "jest-util": "^25.5.0", - "jest-worker": "^25.5.0", - "node-notifier": "^6.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.0", - "string-length": "^3.1.0", - "terminal-link": "^2.0.0", - "v8-to-istanbul": "^4.1.3" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/source-map": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-25.5.0.tgz", - "integrity": "sha512-eIGx0xN12yVpMcPaVpjXPnn3N30QGJCJQSkEDUt9x1fI1Gdvb07Ml6K5iN2hG7NmMP6FDmtPEssE3z6doOYUwQ==", - "dev": true, - "requires": { - "callsites": "^3.0.0", - "graceful-fs": "^4.2.4", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "@jest/test-result": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-25.5.0.tgz", - "integrity": "sha512-oV+hPJgXN7IQf/fHWkcS99y0smKLU2czLBJ9WA0jHITLst58HpQMtzSYxzaBvYc6U5U6jfoMthqsUlUlbRXs0A==", - "dev": true, - "requires": { - "@jest/console": "^25.5.0", - "@jest/types": "^25.5.0", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - } - }, - "@jest/test-sequencer": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-25.5.4.tgz", - "integrity": "sha512-pTJGEkSeg1EkCO2YWq6hbFvKNXk8ejqlxiOg1jBNLnWrgXOkdY6UmqZpwGFXNnRt9B8nO1uWMzLLZ4eCmhkPNA==", - "dev": true, - "requires": { - "@jest/test-result": "^25.5.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^25.5.1", - "jest-runner": "^25.5.4", - "jest-runtime": "^25.5.4" - } - }, - "@jest/transform": { - "version": "25.5.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.5.1.tgz", - "integrity": "sha512-Y8CEoVwXb4QwA6Y/9uDkn0Xfz0finGkieuV0xkdF9UtZGJeLukD5nLkaVrVsODB1ojRWlaoD0AJZpVHCSnJEvg==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^25.5.0", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^3.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^25.5.1", - "jest-regex-util": "^25.2.6", - "jest-util": "^25.5.0", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/types": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", - "integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@rollup/plugin-babel": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.2.1.tgz", - "integrity": "sha512-Jd7oqFR2dzZJ3NWANDyBjwTtX/lYbZpVcmkHrfQcpvawHs9E4c0nYk5U2mfZ6I/DZcIvy506KZJi54XK/jxH7A==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.10.4", - "@rollup/pluginutils": "^3.1.0" - } - }, - "@rollup/plugin-commonjs": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz", - "integrity": "sha512-Ycr12N3ZPN96Fw2STurD21jMqzKwL9QuFhms3SD7KKRK7oaXUsBU9Zt0jL/rOPHiPYisI21/rXGO3jr9BnLHUA==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.0.8", - "commondir": "^1.0.1", - "estree-walker": "^1.0.1", - "glob": "^7.1.2", - "is-reference": "^1.1.2", - "magic-string": "^0.25.2", - "resolve": "^1.11.0" - } - }, - "@rollup/plugin-json": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", - "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.0.8" - } - }, - "@rollup/plugin-node-resolve": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-9.0.0.tgz", - "integrity": "sha512-gPz+utFHLRrd41WMP13Jq5mqqzHL3OXrfj3/MkSyB6UBIcuNt9j60GCbarzMzdf1VHFpOxfQh/ez7wyadLMqkg==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.1.0", - "@types/resolve": "1.17.1", - "builtin-modules": "^3.1.0", - "deepmerge": "^4.2.2", - "is-module": "^1.0.0", - "resolve": "^1.17.0" - } - }, - "@rollup/plugin-replace": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-2.3.3.tgz", - "integrity": "sha512-XPmVXZ7IlaoWaJLkSCDaa0Y6uVo5XQYHhiMFzOd5qSv5rE+t/UJToPIOE56flKIxBFQI27ONsxb7dqHnwSsjKQ==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.0.8", - "magic-string": "^0.25.5" - } - }, - "@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", - "dev": true, - "requires": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" - } - }, - "@sinonjs/commons": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz", - "integrity": "sha512-892K+kWUUi3cl+LlqEWIDrhvLgdL79tECi8JZUyq6IviKy/DNhuzCRlbHUjxK89f4ypPMMaFnFuR9Ie6DoIMsw==", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@types/babel__core": { - "version": "7.1.10", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.10.tgz", - "integrity": "sha512-x8OM8XzITIMyiwl5Vmo2B1cR1S1Ipkyv4mdlbJjMa1lmuKvKY9FrBbEANIaMlnWn5Rf7uO+rC/VgYabNkE17Hw==", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "@types/babel__generator": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.2.tgz", - "integrity": "sha512-MdSJnBjl+bdwkLskZ3NGFp9YcXGx5ggLpQQPqtgakVhsWK0hTtNYhjpZLlWQTviGTvF8at+Bvli3jV7faPdgeQ==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@types/babel__template": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.0.3.tgz", - "integrity": "sha512-uCoznIPDmnickEi6D0v11SBpW0OuVqHJCa7syXqQHy5uktSCreIlt0iglsCnmvz8yCb38hGcWeseA8cWJSwv5Q==", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@types/babel__traverse": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.15.tgz", - "integrity": "sha512-Pzh9O3sTK8V6I1olsXpCfj2k/ygO2q1X0vhhnDrEQyYLHZesWz+zMZMVcwXLCYf0U36EtmyYaFGPfXlTtDHe3A==", - "dev": true, - "requires": { - "@babel/types": "^7.3.0" - } - }, - "@types/detect-node": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/detect-node/-/detect-node-2.0.0.tgz", - "integrity": "sha512-+BozjlbPTACYITf1PWf62HLtDV79HbmZosUN1mv1gGrnjDCRwBXkDKka1sf6YQJvspmfPXVcy+X6tFW62KteeQ==", - "dev": true - }, - "@types/eslint-visitor-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", - "dev": true - }, - "@types/estree": { - "version": "0.0.39", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", - "dev": true - }, - "@types/graceful-fs": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.4.tgz", - "integrity": "sha512-mWA/4zFQhfvOA8zWkXobwJvBD7vzcxgrOQ0J5CH1votGqdq9m7+FwtGaqyCZqC3NyyBkc9z4m+iry4LlqcMWJg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/istanbul-lib-coverage": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", - "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", - "dev": true - }, - "@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*" - } - }, - "@types/istanbul-reports": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz", - "integrity": "sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*", - "@types/istanbul-lib-report": "*" - } - }, - "@types/jest": { - "version": "25.2.3", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.2.3.tgz", - "integrity": "sha512-JXc1nK/tXHiDhV55dvfzqtmP4S3sy3T3ouV2tkViZgxY/zeUkcpQcQPGRlgF4KmWzWW5oiWYSZwtCB+2RsE4Fw==", - "dev": true, - "requires": { - "jest-diff": "^25.2.1", - "pretty-format": "^25.2.1" - } - }, - "@types/json-schema": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", - "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", - "dev": true - }, - "@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", - "dev": true - }, - "@types/lodash": { - "version": "4.14.161", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.161.tgz", - "integrity": "sha512-EP6O3Jkr7bXvZZSZYlsgt5DIjiGr0dXP1/jVEwVLTFgg0d+3lWVQkRavYVQszV7dYUwvg0B8R0MBDpcmXg7XIA==", - "dev": true - }, - "@types/lodash.flatmap": { - "version": "4.5.6", - "resolved": "https://registry.npmjs.org/@types/lodash.flatmap/-/lodash.flatmap-4.5.6.tgz", - "integrity": "sha512-ELNrUL9q+MB7AACaHivWIsKDFDgYhHE3/svXhqvDJgONtn2c467Cy87nEb7CEDvfaGCPv91lPaW596I8s5oiNQ==", - "dev": true, - "requires": { - "@types/lodash": "*" - } - }, - "@types/node": { - "version": "14.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.2.tgz", - "integrity": "sha512-jeYJU2kl7hL9U5xuI/BhKPZ4vqGM/OmK6whiFAXVhlstzZhVamWhDSmHyGLIp+RVyuF9/d0dqr2P85aFj4BvJg==", - "dev": true - }, - "@types/normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", - "dev": true - }, - "@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", - "dev": true - }, - "@types/prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ==", - "dev": true - }, - "@types/resolve": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", - "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/stack-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", - "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==", - "dev": true - }, - "@types/uuid": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.0.tgz", - "integrity": "sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ==", - "dev": true - }, - "@types/yargs": { - "version": "15.0.9", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.9.tgz", - "integrity": "sha512-HmU8SeIRhZCWcnRskCs36Q1Q00KBV6Cqh/ora8WN1+22dY07AZdn6Gel8QZ3t26XYPImtcL8WV/eqjhVmMEw4g==", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "@types/yargs-parser": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", - "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", - "dev": true - }, - "@typescript-eslint/eslint-plugin": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", - "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", - "dev": true, - "requires": { - "@typescript-eslint/experimental-utils": "2.34.0", - "functional-red-black-tree": "^1.0.1", - "regexpp": "^3.0.0", - "tsutils": "^3.17.1" - } - }, - "@typescript-eslint/experimental-utils": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", - "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.34.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" - } - }, - "@typescript-eslint/parser": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", - "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", - "dev": true, - "requires": { - "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.34.0", - "@typescript-eslint/typescript-estree": "2.34.0", - "eslint-visitor-keys": "^1.1.0" - } - }, - "@typescript-eslint/typescript-estree": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", - "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "eslint-visitor-keys": "^1.1.0", - "glob": "^7.1.6", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - } - }, - "abab": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz", - "integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==", - "dev": true - }, - "abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dev": true, - "requires": { - "event-target-shim": "^5.0.0" - } - }, - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - }, - "acorn-globals": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz", - "integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==", - "dev": true, - "requires": { - "acorn": "^6.0.1", - "acorn-walk": "^6.0.1" - }, - "dependencies": { - "acorn": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", - "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", - "dev": true - } - } - }, - "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", - "dev": true - }, - "acorn-walk": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", - "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", - "dev": true - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "ansi-escapes": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", - "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", - "dev": true, - "requires": { - "type-fest": "^0.11.0" - } - }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "aria-query": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz", - "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==", - "dev": true, - "requires": { - "@babel/runtime": "^7.10.2", - "@babel/runtime-corejs3": "^7.10.2" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", - "dev": true - }, - "array-includes": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.1.tgz", - "integrity": "sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0", - "is-string": "^1.0.5" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "array.prototype.flat": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz", - "integrity": "sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "array.prototype.flatmap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.2.3.tgz", - "integrity": "sha512-OOEk+lkePcg+ODXIpvuU9PAryCikCJyo7GlDG1upleEpQRx6mzL9puEBkozQ5iAx20KV0l3DbyQwqciJtqe5Pg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true - }, - "ast-types-flow": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", - "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=", - "dev": true - }, - "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "asyncro": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/asyncro/-/asyncro-3.0.0.tgz", - "integrity": "sha512-nEnWYfrBmA3taTiuiOoZYmgJ/CNrSoQLeLs29SeLcPu60yaw/mHDBHV0iOZ051fTvsTHxpCY+gXibqT9wbQYfg==", - "dev": true - }, - "at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true - }, - "atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz", - "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==", - "dev": true - }, - "axe-core": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-3.5.5.tgz", - "integrity": "sha512-5P0QZ6J5xGikH780pghEdbEKijCTrruK9KxtPZCFWUpef0f6GipO+xEZ5GKCb020mmqgbiNO6TcA55CriL784Q==", - "dev": true - }, - "axios": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz", - "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==", - "requires": { - "follow-redirects": "^1.10.0" - } - }, - "axobject-query": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", - "integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==", - "dev": true - }, - "babel-eslint": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", - "integrity": "sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.7.0", - "@babel/traverse": "^7.7.0", - "@babel/types": "^7.7.0", - "eslint-visitor-keys": "^1.0.0", - "resolve": "^1.12.0" - } - }, - "babel-jest": { - "version": "25.5.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-25.5.1.tgz", - "integrity": "sha512-9dA9+GmMjIzgPnYtkhBg73gOo/RHqPmLruP3BaGL4KEX3Dwz6pI8auSN8G8+iuEG90+GSswyKvslN+JYSaacaQ==", - "dev": true, - "requires": { - "@jest/transform": "^25.5.1", - "@jest/types": "^25.5.0", - "@types/babel__core": "^7.1.7", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^25.5.0", - "chalk": "^3.0.0", - "graceful-fs": "^4.2.4", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "babel-plugin-annotate-pure-calls": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-annotate-pure-calls/-/babel-plugin-annotate-pure-calls-0.4.0.tgz", - "integrity": "sha512-oi4M/PWUJOU9ZyRGoPTfPMqdyMp06jbJAomd3RcyYuzUtBOddv98BqLm96Lucpi2QFoQHkdGQt0ACvw7VzVEQA==", - "dev": true - }, - "babel-plugin-dev-expression": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/babel-plugin-dev-expression/-/babel-plugin-dev-expression-0.2.2.tgz", - "integrity": "sha512-y32lfBif+c2FIh5dwGfcc/IfX5aw/Bru7Du7W2n17sJE/GJGAsmIk5DPW/8JOoeKpXW5evJfJOvRq5xkiS6vng==", - "dev": true - }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, - "babel-plugin-istanbul": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz", - "integrity": "sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^4.0.0", - "test-exclude": "^6.0.0" - } - }, - "babel-plugin-jest-hoist": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.5.0.tgz", - "integrity": "sha512-u+/W+WAjMlvoocYGTwthAiQSxDcJAyHpQ6oWlHdFZaaN+Rlk8Q7iiwDPg2lN/FyJtAYnKjFxbn7xus4HCFkg5g==", - "dev": true, - "requires": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__traverse": "^7.0.6" - } - }, - "babel-plugin-macros": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz", - "integrity": "sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==", - "dev": true, - "requires": { - "@babel/runtime": "^7.7.2", - "cosmiconfig": "^6.0.0", - "resolve": "^1.12.0" - } - }, - "babel-plugin-polyfill-regenerator": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.0.4.tgz", - "integrity": "sha512-+/uCzO9JTYVZVGCpZpVAQkgPGt2zkR0VYiZvJ4aVoCe4ccgpKvNQqcjzAgQzSsjK64Jhc5hvrCR3l0087BevkA==", - "dev": true, - "requires": { - "@babel/helper-define-polyfill-provider": "^0.0.3" - } - }, - "babel-plugin-transform-rename-import": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-rename-import/-/babel-plugin-transform-rename-import-2.3.0.tgz", - "integrity": "sha512-dPgJoT57XC0PqSnLgl2FwNvxFrWlspatX2dkk7yjKQj5HHGw071vAcOf+hqW8ClqcBDMvEbm6mevn5yHAD8mlQ==", - "dev": true - }, - "babel-preset-current-node-syntax": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-0.1.4.tgz", - "integrity": "sha512-5/INNCYhUGqw7VbVjT/hb3ucjgkVHKXY7lX3ZjlN4gm565VyFmJUrJ/h+h16ECVB38R/9SF6aACydpKMLZ/c9w==", - "dev": true, - "requires": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - } - }, - "babel-preset-jest": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-25.5.0.tgz", - "integrity": "sha512-8ZczygctQkBU+63DtSOKGh7tFL0CeCuz+1ieud9lJ1WPQ9O6A1a/r+LGn6Y705PA6whHQ3T1XuB/PmpfNYf8Fw==", - "dev": true, - "requires": { - "babel-plugin-jest-hoist": "^25.5.0", - "babel-preset-current-node-syntax": "^0.1.2" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, - "browser-resolve": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", - "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", - "dev": true, - "requires": { - "resolve": "1.1.7" - }, - "dependencies": { - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - } - } - }, - "browserslist": { - "version": "4.14.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.5.tgz", - "integrity": "sha512-Z+vsCZIvCBvqLoYkBFTwEYH3v5MCQbsAjp50ERycpOjnPmolg1Gjy4+KaWWpm8QOJt9GHkhdqAl14NpCX73CWA==", - "dev": true, - "requires": { - "caniuse-lite": "^1.0.30001135", - "electron-to-chromium": "^1.3.571", - "escalade": "^3.1.0", - "node-releases": "^1.1.61" - } - }, - "bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "dev": true, - "requires": { - "fast-json-stable-stringify": "2.x" - } - }, - "bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "requires": { - "node-int64": "^0.4.0" - } - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, - "builtin-modules": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", - "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", - "dev": true - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.1.0.tgz", - "integrity": "sha512-WCMml9ivU60+8rEJgELlFp1gxFcEGxwYleE3bziHEDeqsqAWGHdimB7beBFGjLzVNgPGyDsfgXLQEYMpmIFnVQ==", - "dev": true - }, - "caniuse-lite": { - "version": "1.0.30001150", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001150.tgz", - "integrity": "sha512-kiNKvihW0m36UhAFnl7bOAv0i1K1f6wpfVtTF5O5O82XzgtBnb05V0XeV3oZ968vfg2sRNChsHw8ASH2hDfoYQ==", - "dev": true - }, - "capture-exit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", - "integrity": "sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==", - "dev": true, - "requires": { - "rsvp": "^4.8.4" - } - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, - "cli-spinners": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.5.0.tgz", - "integrity": "sha512-PC+AmIuK04E6aeSs/pUccSujsTzBhu4HzC2dL+CfJB/Jcc2qTRbEwZQDfIUpt2Xl8BodYBEq8w4fc0kU2I9DjQ==", - "dev": true - }, - "cli-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", - "dev": true - }, - "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - }, - "dependencies": { - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true - }, - "collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", - "dev": true - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "confusing-browser-globals": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz", - "integrity": "sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==", - "dev": true - }, - "contains-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", - "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", - "dev": true - }, - "convert-source-map": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", - "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "core-js-compat": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.6.5.tgz", - "integrity": "sha512-7ItTKOhOZbznhXAQ2g/slGg1PJV5zDO/WdkTwi7UEOJmkvsE32PWvx6mKtDjiMpjnR2CNf6BAD6sSxIlv7ptng==", - "dev": true, - "requires": { - "browserslist": "^4.8.5", - "semver": "7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true - } - } - }, - "core-js-pure": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.6.5.tgz", - "integrity": "sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cosmiconfig": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", - "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", - "dev": true, - "requires": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.7.2" - } - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true - }, - "cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "requires": { - "cssom": "~0.3.6" - }, - "dependencies": { - "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - } - } - }, - "damerau-levenshtein": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.6.tgz", - "integrity": "sha512-JVrozIeElnj3QzfUIt8tB8YMluBJom4Vw9qTPpjGYQ9fYlB3D/rb6OordUxf3xeFB35LKWs0xqcO5U6ySvBtug==", - "dev": true - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "data-urls": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz", - "integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==", - "dev": true, - "requires": { - "abab": "^2.0.0", - "whatwg-mimetype": "^2.2.0", - "whatwg-url": "^7.0.0" - } - }, - "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "deepmerge": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", - "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true - }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dev": true, - "requires": { - "clone": "^1.0.2" - } - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true - }, - "detect-node": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz", - "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==" - }, - "diff-sequences": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-25.2.6.tgz", - "integrity": "sha512-Hq8o7+6GaZeoFjtpgvRBUknSXNeJiCx7V9Fr94ZMljNiCr9n9L8H8aJqgWOQiDDGdyn29fRNcDdRVJ5fdyihfg==", - "dev": true - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "domexception": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", - "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", - "dev": true, - "requires": { - "webidl-conversions": "^4.0.2" - } - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dev": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "electron-to-chromium": { - "version": "1.3.582", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.582.tgz", - "integrity": "sha512-0nCJ7cSqnkMC+kUuPs0YgklFHraWGl/xHqtZWWtOeVtyi+YqkoAOMGuZQad43DscXCQI/yizcTa3u6B5r+BLww==", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", - "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", - "dev": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true - } - } - }, - "eslint": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", - "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.3", - "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.2", - "esquery": "^1.0.1", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.3", - "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "eslint-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", - "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "regexpp": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true - } - } - }, - "eslint-config-prettier": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.14.0.tgz", - "integrity": "sha512-DbVwh0qZhAC7CNDWcq8cBdK6FcVHiMTKmCypOPWeZkp9hJ8xYwTaWSa6bb6cjfi8KOeJy0e9a8Izxyx+O4+gCQ==", - "dev": true, - "requires": { - "get-stdin": "^6.0.0" - } - }, - "eslint-config-react-app": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-5.2.1.tgz", - "integrity": "sha512-pGIZ8t0mFLcV+6ZirRgYK6RVqUIKRIi9MmgzUEmrIknsn3AdO0I32asO86dJgloHq+9ZPl8UIg8mYrvgP5u2wQ==", - "dev": true, - "requires": { - "confusing-browser-globals": "^1.0.9" - } - }, - "eslint-import-resolver-node": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", - "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==", - "dev": true, - "requires": { - "debug": "^2.6.9", - "resolve": "^1.13.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-module-utils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", - "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", - "dev": true, - "requires": { - "debug": "^2.6.9", - "pkg-dir": "^2.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-flowtype": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.13.0.tgz", - "integrity": "sha512-bhewp36P+t7cEV0b6OdmoRWJCBYRiHFlqPZAG1oS3SF+Y0LQkeDvFSM4oxoxvczD1OdONCXMlJfQFiWLcV9urw==", - "dev": true, - "requires": { - "lodash": "^4.17.15" - } - }, - "eslint-plugin-import": { - "version": "2.22.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", - "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", - "dev": true, - "requires": { - "array-includes": "^3.1.1", - "array.prototype.flat": "^1.2.3", - "contains-path": "^0.1.0", - "debug": "^2.6.9", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.4", - "eslint-module-utils": "^2.6.0", - "has": "^1.0.3", - "minimatch": "^3.0.4", - "object.values": "^1.1.1", - "read-pkg-up": "^2.0.0", - "resolve": "^1.17.0", - "tsconfig-paths": "^3.9.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-jsx-a11y": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.3.1.tgz", - "integrity": "sha512-i1S+P+c3HOlBJzMFORRbC58tHa65Kbo8b52/TwCwSKLohwvpfT5rm2GjGWzOHTEuq4xxf2aRlHHTtmExDQOP+g==", - "dev": true, - "requires": { - "@babel/runtime": "^7.10.2", - "aria-query": "^4.2.2", - "array-includes": "^3.1.1", - "ast-types-flow": "^0.0.7", - "axe-core": "^3.5.4", - "axobject-query": "^2.1.2", - "damerau-levenshtein": "^1.0.6", - "emoji-regex": "^9.0.0", - "has": "^1.0.3", - "jsx-ast-utils": "^2.4.1", - "language-tags": "^1.0.5" - }, - "dependencies": { - "emoji-regex": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.0.tgz", - "integrity": "sha512-DNc3KFPK18bPdElMJnf/Pkv5TXhxFU3YFDEuGLDRtPmV4rkmCjBkCSEp22u6rBHdSN9Vlp/GK7k98prmE1Jgug==", - "dev": true - } - } - }, - "eslint-plugin-prettier": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", - "integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==", - "dev": true, - "requires": { - "prettier-linter-helpers": "^1.0.0" - } - }, - "eslint-plugin-react": { - "version": "7.21.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.21.5.tgz", - "integrity": "sha512-8MaEggC2et0wSF6bUeywF7qQ46ER81irOdWS4QWxnnlAEsnzeBevk1sWh7fhpCghPpXb+8Ks7hvaft6L/xsR6g==", - "dev": true, - "requires": { - "array-includes": "^3.1.1", - "array.prototype.flatmap": "^1.2.3", - "doctrine": "^2.1.0", - "has": "^1.0.3", - "jsx-ast-utils": "^2.4.1 || ^3.0.0", - "object.entries": "^1.1.2", - "object.fromentries": "^2.0.2", - "object.values": "^1.1.1", - "prop-types": "^15.7.2", - "resolve": "^1.18.1", - "string.prototype.matchall": "^4.0.2" - }, - "dependencies": { - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - } - } - }, - "eslint-plugin-react-hooks": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.5.1.tgz", - "integrity": "sha512-Y2c4b55R+6ZzwtTppKwSmK/Kar8AdLiC2f9NADCuxbcTgPPg41Gyqa6b9GppgXSvCtkRw43ZE86CT5sejKC6/g==", - "dev": true - }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - }, - "espree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", - "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", - "dev": true, - "requires": { - "acorn": "^7.1.1", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", - "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, - "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "dev": true - }, - "exec-sh": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.4.tgz", - "integrity": "sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A==", - "dev": true - }, - "execa": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.0.3.tgz", - "integrity": "sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", - "dev": true - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "expect": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-25.5.0.tgz", - "integrity": "sha512-w7KAXo0+6qqZZhovCaBVPSIqQp7/UTcx4M9uKt2m6pd2VB1voyC8JizLRqeEqud3AAVP02g+hbErDu5gu64tlA==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "ansi-styles": "^4.0.0", - "jest-get-type": "^25.2.6", - "jest-matcher-utils": "^25.5.0", - "jest-message-util": "^25.5.0", - "jest-regex-util": "^25.2.6" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "requires": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fb-watchman": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz", - "integrity": "sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==", - "dev": true, - "requires": { - "bser": "2.1.1" - } - }, - "figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", - "dev": true, - "requires": { - "flat-cache": "^2.0.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-cache-dir": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", - "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - } - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "flat-cache": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", - "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", - "dev": true, - "requires": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" - } - }, - "flatted": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", - "dev": true - }, - "follow-redirects": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", - "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==" - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fs-extra": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", - "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", - "dev": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^1.0.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", - "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", - "dev": true, - "optional": true - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.1", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", - "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true - }, - "get-stdin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", - "dev": true - }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true - }, - "globalyzer": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.4.tgz", - "integrity": "sha512-LeguVWaxgHN0MNbWC6YljNMzHkrCny9fzjmEUdnF1kQ7wATFD1RHFRqA1qxaX2tgxGENlcxjOflopBwj3YZiXA==", - "dev": true - }, - "globrex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", - "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", - "dev": true - }, - "graceful-fs": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", - "dev": true - }, - "growly": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", - "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", - "dev": true, - "optional": true - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "dev": true, - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-symbols": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "hosted-git-info": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", - "dev": true - }, - "html-encoding-sniffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", - "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", - "dev": true, - "requires": { - "whatwg-encoding": "^1.0.1" - } - }, - "html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "human-signals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", - "dev": true - }, - "humanize-duration": { - "version": "3.24.0", - "resolved": "https://registry.npmjs.org/humanize-duration/-/humanize-duration-3.24.0.tgz", - "integrity": "sha512-B3udnqisaDeRsvUSb+5n2hjxhABI9jotB+i1IEhgHhguTeM5LxIUKoVIu7UpeyaPOygr/Fnv7UhOi45kYYG+tg==", - "dev": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - }, - "import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "import-local": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", - "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", - "dev": true, - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - } - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "inquirer": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", - "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "internal-slot": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.2.tgz", - "integrity": "sha512-2cQNfwhAfJIkU4KZPkDI+Gj5yNNnbqi40W9Gge6dfnk4TocEVm00B3bdiL+JINrbGJil2TeHvM4rETGzk/f/0g==", - "dev": true, - "requires": { - "es-abstract": "^1.17.0-next.1", - "has": "^1.0.3", - "side-channel": "^1.0.2" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "dev": true - }, - "ip-regex": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", - "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", - "dev": true - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-callable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", - "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", - "dev": true - }, - "is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "is-core-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz", - "integrity": "sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "is-docker": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", - "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==", - "dev": true, - "optional": true - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-interactive": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", - "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", - "dev": true - }, - "is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", - "dev": true - }, - "is-negative-zero": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", - "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", - "dev": true - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-reference": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", - "dev": true, - "requires": { - "@types/estree": "*" - } - }, - "is-regex": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", - "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true - }, - "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", - "dev": true - }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true - }, - "is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "optional": true, - "requires": { - "is-docker": "^2.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, - "istanbul-lib-coverage": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", - "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", - "dev": true - }, - "istanbul-lib-instrument": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", - "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", - "dev": true, - "requires": { - "@babel/core": "^7.7.5", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", - "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", - "dev": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, - "jest": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/jest/-/jest-25.5.4.tgz", - "integrity": "sha512-hHFJROBTqZahnO+X+PMtT6G2/ztqAZJveGqz//FnWWHurizkD05PQGzRZOhF3XP6z7SJmL+5tCfW8qV06JypwQ==", - "dev": true, - "requires": { - "@jest/core": "^25.5.4", - "import-local": "^3.0.2", - "jest-cli": "^25.5.4" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "jest-cli": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-25.5.4.tgz", - "integrity": "sha512-rG8uJkIiOUpnREh1768/N3n27Cm+xPFkSNFO91tgg+8o2rXeVLStz+vkXkGr4UtzH6t1SNbjwoiswd7p4AhHTw==", - "dev": true, - "requires": { - "@jest/core": "^25.5.4", - "@jest/test-result": "^25.5.0", - "@jest/types": "^25.5.0", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "import-local": "^3.0.2", - "is-ci": "^2.0.0", - "jest-config": "^25.5.4", - "jest-util": "^25.5.0", - "jest-validate": "^25.5.0", - "prompts": "^2.0.1", - "realpath-native": "^2.0.0", - "yargs": "^15.3.1" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-changed-files": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-25.5.0.tgz", - "integrity": "sha512-EOw9QEqapsDT7mKF162m8HFzRPbmP8qJQny6ldVOdOVBz3ACgPm/1nAn5fPQ/NDaYhX/AHkrGwwkCncpAVSXcw==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "execa": "^3.2.0", - "throat": "^5.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "execa": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", - "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "p-finally": "^2.0.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - } - }, - "p-finally": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", - "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "jest-config": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-25.5.4.tgz", - "integrity": "sha512-SZwR91SwcdK6bz7Gco8qL7YY2sx8tFJYzvg216DLihTWf+LKY/DoJXpM9nTzYakSyfblbqeU48p/p7Jzy05Atg==", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^25.5.4", - "@jest/types": "^25.5.0", - "babel-jest": "^25.5.1", - "chalk": "^3.0.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.1", - "graceful-fs": "^4.2.4", - "jest-environment-jsdom": "^25.5.0", - "jest-environment-node": "^25.5.0", - "jest-get-type": "^25.2.6", - "jest-jasmine2": "^25.5.4", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.5.1", - "jest-util": "^25.5.0", - "jest-validate": "^25.5.0", - "micromatch": "^4.0.2", - "pretty-format": "^25.5.0", - "realpath-native": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-diff": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-25.5.0.tgz", - "integrity": "sha512-z1kygetuPiREYdNIumRpAHY6RXiGmp70YHptjdaxTWGmA085W3iCnXNx0DhflK3vwrKmrRWyY1wUpkPMVxMK7A==", - "dev": true, - "requires": { - "chalk": "^3.0.0", - "diff-sequences": "^25.2.6", - "jest-get-type": "^25.2.6", - "pretty-format": "^25.5.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-docblock": { - "version": "25.3.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-25.3.0.tgz", - "integrity": "sha512-aktF0kCar8+zxRHxQZwxMy70stc9R1mOmrLsT5VO3pIT0uzGRSDAXxSlz4NqQWpuLjPpuMhPRl7H+5FRsvIQAg==", - "dev": true, - "requires": { - "detect-newline": "^3.0.0" - } - }, - "jest-each": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-25.5.0.tgz", - "integrity": "sha512-QBogUxna3D8vtiItvn54xXde7+vuzqRrEeaw8r1s+1TG9eZLVJE5ZkKoSUlqFwRjnlaA4hyKGiu9OlkFIuKnjA==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "chalk": "^3.0.0", - "jest-get-type": "^25.2.6", - "jest-util": "^25.5.0", - "pretty-format": "^25.5.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-environment-jsdom": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-25.5.0.tgz", - "integrity": "sha512-7Jr02ydaq4jaWMZLY+Skn8wL5nVIYpWvmeatOHL3tOcV3Zw8sjnPpx+ZdeBfc457p8jCR9J6YCc+Lga0oIy62A==", - "dev": true, - "requires": { - "@jest/environment": "^25.5.0", - "@jest/fake-timers": "^25.5.0", - "@jest/types": "^25.5.0", - "jest-mock": "^25.5.0", - "jest-util": "^25.5.0", - "jsdom": "^15.2.1" - } - }, - "jest-environment-node": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-25.5.0.tgz", - "integrity": "sha512-iuxK6rQR2En9EID+2k+IBs5fCFd919gVVK5BeND82fYeLWPqvRcFNPKu9+gxTwfB5XwBGBvZ0HFQa+cHtIoslA==", - "dev": true, - "requires": { - "@jest/environment": "^25.5.0", - "@jest/fake-timers": "^25.5.0", - "@jest/types": "^25.5.0", - "jest-mock": "^25.5.0", - "jest-util": "^25.5.0", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "jest-get-type": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-25.2.6.tgz", - "integrity": "sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig==", - "dev": true - }, - "jest-haste-map": { - "version": "25.5.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-25.5.1.tgz", - "integrity": "sha512-dddgh9UZjV7SCDQUrQ+5t9yy8iEgKc1AKqZR9YDww8xsVOtzPQSMVLDChc21+g29oTRexb9/B0bIlZL+sWmvAQ==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "@types/graceful-fs": "^4.1.2", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.4", - "jest-serializer": "^25.5.0", - "jest-util": "^25.5.0", - "jest-worker": "^25.5.0", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7", - "which": "^2.0.2" - }, - "dependencies": { - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "jest-jasmine2": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-25.5.4.tgz", - "integrity": "sha512-9acbWEfbmS8UpdcfqnDO+uBUgKa/9hcRh983IHdM+pKmJPL77G0sWAAK0V0kr5LK3a8cSBfkFSoncXwQlRZfkQ==", - "dev": true, - "requires": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^25.5.0", - "@jest/source-map": "^25.5.0", - "@jest/test-result": "^25.5.0", - "@jest/types": "^25.5.0", - "chalk": "^3.0.0", - "co": "^4.6.0", - "expect": "^25.5.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^25.5.0", - "jest-matcher-utils": "^25.5.0", - "jest-message-util": "^25.5.0", - "jest-runtime": "^25.5.4", - "jest-snapshot": "^25.5.1", - "jest-util": "^25.5.0", - "pretty-format": "^25.5.0", - "throat": "^5.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-leak-detector": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-25.5.0.tgz", - "integrity": "sha512-rV7JdLsanS8OkdDpZtgBf61L5xZ4NnYLBq72r6ldxahJWWczZjXawRsoHyXzibM5ed7C2QRjpp6ypgwGdKyoVA==", - "dev": true, - "requires": { - "jest-get-type": "^25.2.6", - "pretty-format": "^25.5.0" - } - }, - "jest-matcher-utils": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-25.5.0.tgz", - "integrity": "sha512-VWI269+9JS5cpndnpCwm7dy7JtGQT30UHfrnM3mXl22gHGt/b7NkjBqXfbhZ8V4B7ANUsjK18PlSBmG0YH7gjw==", - "dev": true, - "requires": { - "chalk": "^3.0.0", - "jest-diff": "^25.5.0", - "jest-get-type": "^25.2.6", - "pretty-format": "^25.5.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-message-util": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-25.5.0.tgz", - "integrity": "sha512-ezddz3YCT/LT0SKAmylVyWWIGYoKHOFOFXx3/nA4m794lfVUskMcwhip6vTgdVrOtYdjeQeis2ypzes9mZb4EA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@jest/types": "^25.5.0", - "@types/stack-utils": "^1.0.1", - "chalk": "^3.0.0", - "graceful-fs": "^4.2.4", - "micromatch": "^4.0.2", - "slash": "^3.0.0", - "stack-utils": "^1.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-mock": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-25.5.0.tgz", - "integrity": "sha512-eXWuTV8mKzp/ovHc5+3USJMYsTBhyQ+5A1Mak35dey/RG8GlM4YWVylZuGgVXinaW6tpvk/RSecmF37FKUlpXA==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0" - } - }, - "jest-pnp-resolver": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz", - "integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==", - "dev": true - }, - "jest-regex-util": { - "version": "25.2.6", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-25.2.6.tgz", - "integrity": "sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw==", - "dev": true - }, - "jest-resolve": { - "version": "25.5.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-25.5.1.tgz", - "integrity": "sha512-Hc09hYch5aWdtejsUZhA+vSzcotf7fajSlPA6EZPE1RmPBAD39XtJhvHWFStid58iit4IPDLI/Da4cwdDmAHiQ==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "browser-resolve": "^1.11.3", - "chalk": "^3.0.0", - "graceful-fs": "^4.2.4", - "jest-pnp-resolver": "^1.2.1", - "read-pkg-up": "^7.0.1", - "realpath-native": "^2.0.0", - "resolve": "^1.17.0", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "read-pkg": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", - "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "dependencies": { - "type-fest": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", - "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", - "dev": true - } - } - }, - "read-pkg-up": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", - "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", - "dev": true, - "requires": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true - } - } - }, - "jest-resolve-dependencies": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-25.5.4.tgz", - "integrity": "sha512-yFmbPd+DAQjJQg88HveObcGBA32nqNZ02fjYmtL16t1xw9bAttSn5UGRRhzMHIQbsep7znWvAvnD4kDqOFM0Uw==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "jest-regex-util": "^25.2.6", - "jest-snapshot": "^25.5.1" - } - }, - "jest-runner": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-25.5.4.tgz", - "integrity": "sha512-V/2R7fKZo6blP8E9BL9vJ8aTU4TH2beuqGNxHbxi6t14XzTb+x90B3FRgdvuHm41GY8ch4xxvf0ATH4hdpjTqg==", - "dev": true, - "requires": { - "@jest/console": "^25.5.0", - "@jest/environment": "^25.5.0", - "@jest/test-result": "^25.5.0", - "@jest/types": "^25.5.0", - "chalk": "^3.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-config": "^25.5.4", - "jest-docblock": "^25.3.0", - "jest-haste-map": "^25.5.1", - "jest-jasmine2": "^25.5.4", - "jest-leak-detector": "^25.5.0", - "jest-message-util": "^25.5.0", - "jest-resolve": "^25.5.1", - "jest-runtime": "^25.5.4", - "jest-util": "^25.5.0", - "jest-worker": "^25.5.0", - "source-map-support": "^0.5.6", - "throat": "^5.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-runtime": { - "version": "25.5.4", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-25.5.4.tgz", - "integrity": "sha512-RWTt8LeWh3GvjYtASH2eezkc8AehVoWKK20udV6n3/gC87wlTbE1kIA+opCvNWyyPeBs6ptYsc6nyHUb1GlUVQ==", - "dev": true, - "requires": { - "@jest/console": "^25.5.0", - "@jest/environment": "^25.5.0", - "@jest/globals": "^25.5.2", - "@jest/source-map": "^25.5.0", - "@jest/test-result": "^25.5.0", - "@jest/transform": "^25.5.1", - "@jest/types": "^25.5.0", - "@types/yargs": "^15.0.0", - "chalk": "^3.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.4", - "jest-config": "^25.5.4", - "jest-haste-map": "^25.5.1", - "jest-message-util": "^25.5.0", - "jest-mock": "^25.5.0", - "jest-regex-util": "^25.2.6", - "jest-resolve": "^25.5.1", - "jest-snapshot": "^25.5.1", - "jest-util": "^25.5.0", - "jest-validate": "^25.5.0", - "realpath-native": "^2.0.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0", - "yargs": "^15.3.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-serializer": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-25.5.0.tgz", - "integrity": "sha512-LxD8fY1lByomEPflwur9o4e2a5twSQ7TaVNLlFUuToIdoJuBt8tzHfCsZ42Ok6LkKXWzFWf3AGmheuLAA7LcCA==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.4" - } - }, - "jest-snapshot": { - "version": "25.5.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-25.5.1.tgz", - "integrity": "sha512-C02JE1TUe64p2v1auUJ2ze5vcuv32tkv9PyhEb318e8XOKF7MOyXdJ7kdjbvrp3ChPLU2usI7Rjxs97Dj5P0uQ==", - "dev": true, - "requires": { - "@babel/types": "^7.0.0", - "@jest/types": "^25.5.0", - "@types/prettier": "^1.19.0", - "chalk": "^3.0.0", - "expect": "^25.5.0", - "graceful-fs": "^4.2.4", - "jest-diff": "^25.5.0", - "jest-get-type": "^25.2.6", - "jest-matcher-utils": "^25.5.0", - "jest-message-util": "^25.5.0", - "jest-resolve": "^25.5.1", - "make-dir": "^3.0.0", - "natural-compare": "^1.4.0", - "pretty-format": "^25.5.0", - "semver": "^6.3.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-util": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-25.5.0.tgz", - "integrity": "sha512-KVlX+WWg1zUTB9ktvhsg2PXZVdkI1NBevOJSkTKYAyXyH4QSvh+Lay/e/v+bmaFfrkfx43xD8QTfgobzlEXdIA==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "chalk": "^3.0.0", - "graceful-fs": "^4.2.4", - "is-ci": "^2.0.0", - "make-dir": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-validate": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-25.5.0.tgz", - "integrity": "sha512-okUFKqhZIpo3jDdtUXUZ2LxGUZJIlfdYBvZb1aczzxrlyMlqdnnws9MOxezoLGhSaFc2XYaHNReNQfj5zPIWyQ==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "camelcase": "^5.3.1", - "chalk": "^3.0.0", - "jest-get-type": "^25.2.6", - "leven": "^3.1.0", - "pretty-format": "^25.5.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-watch-typeahead": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jest-watch-typeahead/-/jest-watch-typeahead-0.5.0.tgz", - "integrity": "sha512-4r36w9vU8+rdg48hj0Z7TvcSqVP6Ao8dk04grlHQNgduyCB0SqrI0xWIl85ZhXrzYvxQ0N5H+rRLAejkQzEHeQ==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "jest-regex-util": "^25.2.1", - "jest-watcher": "^25.2.4", - "slash": "^3.0.0", - "string-length": "^3.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-watcher": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-25.5.0.tgz", - "integrity": "sha512-XrSfJnVASEl+5+bb51V0Q7WQx65dTSk7NL4yDdVjPnRNpM0hG+ncFmDYJo9O8jaSRcAitVbuVawyXCRoxGrT5Q==", - "dev": true, - "requires": { - "@jest/test-result": "^25.5.0", - "@jest/types": "^25.5.0", - "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", - "jest-util": "^25.5.0", - "string-length": "^3.1.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-worker": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.5.0.tgz", - "integrity": "sha512-/dsSmUkIy5EBGfv/IjjqmFxrNAUpBERfGs1oHROyD7yxjG/w+t0GOJDX8O1k32ySmd7+a5IhnJU2qQFcJ4n1vw==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jpjs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/jpjs/-/jpjs-1.2.1.tgz", - "integrity": "sha512-GxJWybWU4NV0RNKi6EIqk6IRPOTqd/h+U7sbtyuD7yUISUzV78LdHnq2xkevJsTlz/EImux4sWj+wfMiwKLkiw==", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true - }, - "jsdom": { - "version": "15.2.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", - "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", - "dev": true, - "requires": { - "abab": "^2.0.0", - "acorn": "^7.1.0", - "acorn-globals": "^4.3.2", - "array-equal": "^1.0.0", - "cssom": "^0.4.1", - "cssstyle": "^2.0.0", - "data-urls": "^1.1.0", - "domexception": "^1.0.1", - "escodegen": "^1.11.1", - "html-encoding-sniffer": "^1.0.2", - "nwsapi": "^2.2.0", - "parse5": "5.1.0", - "pn": "^1.1.0", - "request": "^2.88.0", - "request-promise-native": "^1.0.7", - "saxes": "^3.1.9", - "symbol-tree": "^3.2.2", - "tough-cookie": "^3.0.1", - "w3c-hr-time": "^1.0.1", - "w3c-xmlserializer": "^1.1.2", - "webidl-conversions": "^4.0.2", - "whatwg-encoding": "^1.0.5", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^7.0.0", - "ws": "^7.0.0", - "xml-name-validator": "^3.0.0" - } - }, - "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "json5": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", - "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "jsonfile": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", - "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^1.0.0" - } - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "jsx-ast-utils": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz", - "integrity": "sha512-z1xSldJ6imESSzOjd3NNkieVJKRlKYSOtMG8SFyCj2FIrvSaSuli/WjpBkEzCBoR9bYYYFgqJw61Xhu7Lcgk+w==", - "dev": true, - "requires": { - "array-includes": "^3.1.1", - "object.assign": "^4.1.0" - } - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - }, - "kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true - }, - "language-subtag-registry": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.20.tgz", - "integrity": "sha512-KPMwROklF4tEx283Xw0pNKtfTj1gZ4UByp4EsIFWLgBavJltF4TiYPc39k06zSTsLzxTVXXDSpbwaQXaFB4Qeg==", - "dev": true - }, - "language-tags": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/language-tags/-/language-tags-1.0.5.tgz", - "integrity": "sha1-0yHbxNowuovzAk4ED6XBRmH5GTo=", - "dev": true, - "requires": { - "language-subtag-registry": "~0.3.2" - } - }, - "leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "lines-and-columns": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", - "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", - "dev": true - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - }, - "dependencies": { - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - } - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", - "dev": true - }, - "lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", - "dev": true - }, - "lodash.flatmap": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.flatmap/-/lodash.flatmap-4.5.0.tgz", - "integrity": "sha1-74y/QI9uSCaGYzRTBcaswLd4cC4=" - }, - "lodash.flatten": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" - }, - "lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", - "dev": true - }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", - "dev": true - }, - "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", - "dev": true, - "requires": { - "chalk": "^2.4.2" - }, - "dependencies": { - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - } - } - }, - "log-update": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-2.3.0.tgz", - "integrity": "sha1-iDKP19HOeTiykoN0bwsbwSayRwg=", - "dev": true, - "requires": { - "ansi-escapes": "^3.0.0", - "cli-cursor": "^2.0.0", - "wrap-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-escapes": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", - "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "wrap-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-3.0.1.tgz", - "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0" - } - } - } - }, - "lolex": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", - "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.7.0" - } - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "lower-case": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.1.tgz", - "integrity": "sha512-LiWgfDLLb1dwbFQZsSglpRj+1ctGnayXz3Uv0/WO8n558JycT5fg6zkNcnW0G68Nn0aEldTFeEfmjCfmqry/rQ==", - "dev": true, - "requires": { - "tslib": "^1.10.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - } - } - }, - "magic-string": { - "version": "0.25.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", - "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", - "dev": true, - "requires": { - "sourcemap-codec": "^1.4.4" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "makeerror": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", - "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", - "dev": true, - "requires": { - "tmpl": "1.0.x" - } - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, - "mime-db": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" - }, - "mime-types": { - "version": "2.1.27", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", - "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", - "requires": { - "mime-db": "1.44.0" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - }, - "mixin-deep": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", - "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "mri": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz", - "integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==", - "dev": true - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, - "nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "no-case": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.3.tgz", - "integrity": "sha512-ehY/mVQCf9BL0gKfsJBvFJen+1V//U+0HQMPrWct40ixE4jnv0bfvxDbWtAHL9EcaPEOJHVVYKoQn1TlZUB8Tw==", - "dev": true, - "requires": { - "lower-case": "^2.0.1", - "tslib": "^1.10.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - } - } - }, - "node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", - "dev": true - }, - "node-modules-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", - "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=", - "dev": true - }, - "node-notifier": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-6.0.0.tgz", - "integrity": "sha512-SVfQ/wMw+DesunOm5cKqr6yDcvUTDl/yc97ybGHMrteNEY6oekXpNpS3lZwgLlwz0FLgHoiW28ZpmBHUDg37cw==", - "dev": true, - "optional": true, - "requires": { - "growly": "^1.3.0", - "is-wsl": "^2.1.1", - "semver": "^6.3.0", - "shellwords": "^0.1.1", - "which": "^1.3.1" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "optional": true - } - } - }, - "node-releases": { - "version": "1.1.64", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.64.tgz", - "integrity": "sha512-Iec8O9166/x2HRMJyLLLWkd0sFFLrFNy+Xf+JQfSQsdBJzPcHpNl3JQ9gD4j+aJxmCa25jNsIbM4bmACtSbkSg==", - "dev": true - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - }, - "dependencies": { - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - } - } - }, - "nwsapi": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", - "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==", - "dev": true - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "object-inspect": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.1.tgz", - "integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.0", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "object.entries": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.2.tgz", - "integrity": "sha512-BQdB9qKmb/HyNdMNWVr7O3+z5MUIx3aiegEIJqjMBbBf0YT9RRxTJSim4mzFqtyr7PDAHigq0N9dO0m0tRakQA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5", - "has": "^1.0.3" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "object.fromentries": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.2.tgz", - "integrity": "sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "object.values": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", - "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1", - "function-bind": "^1.1.1", - "has": "^1.0.3" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "ora": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ora/-/ora-4.1.1.tgz", - "integrity": "sha512-sjYP8QyVWBpBZWD6Vr1M/KwknSw6kJOz41tvGMlwWeClHBtYKTbHMki1PsLZnxKpXMPbTKv9b3pjQu3REib96A==", - "dev": true, - "requires": { - "chalk": "^3.0.0", - "cli-cursor": "^3.1.0", - "cli-spinners": "^2.2.0", - "is-interactive": "^1.0.0", - "log-symbols": "^3.0.0", - "mute-stream": "0.0.8", - "strip-ansi": "^6.0.0", - "wcwidth": "^1.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-each-series": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", - "integrity": "sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parse-json": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", - "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "parse5": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", - "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", - "dev": true - }, - "pascal-case": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.1.tgz", - "integrity": "sha512-XIeHKqIrsquVTQL2crjq3NfJUxmdLasn3TYOU0VBM+UX2a6ztAWBlJQBePLGY7VHW8+2dRadeIPK5+KImwTxQA==", - "dev": true, - "requires": { - "no-case": "^3.0.3", - "tslib": "^1.10.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - } - } - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, - "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", - "dev": true - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pirates": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.1.tgz", - "integrity": "sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==", - "dev": true, - "requires": { - "node-modules-regexp": "^1.0.0" - } - }, - "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - } - }, - "pn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", - "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", - "dev": true - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", - "dev": true - }, - "prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "requires": { - "fast-diff": "^1.1.2" - } - }, - "pretty-format": { - "version": "25.5.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz", - "integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==", - "dev": true, - "requires": { - "@jest/types": "^25.5.0", - "ansi-regex": "^5.0.0", - "ansi-styles": "^4.0.0", - "react-is": "^16.12.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "progress-estimator": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/progress-estimator/-/progress-estimator-0.2.2.tgz", - "integrity": "sha512-GF76Ac02MTJD6o2nMNtmtOFjwWCnHcvXyn5HOWPQnEMO8OTLw7LAvNmrwe8LmdsB+eZhwUu9fX/c9iQnBxWaFA==", - "dev": true, - "requires": { - "chalk": "^2.4.1", - "cli-spinners": "^1.3.1", - "humanize-duration": "^3.15.3", - "log-update": "^2.3.0" - }, - "dependencies": { - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "cli-spinners": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-1.3.1.tgz", - "integrity": "sha512-1QL4544moEsDVH9T/l6Cemov/37iv1RtoKf7NJ04A60+4MREXNfx/QvavbH6QoGdsD4N4Mwy49cmaINR/o2mdg==", - "dev": true - } - } - }, - "prompts": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.3.2.tgz", - "integrity": "sha512-Q06uKs2CkNYVID0VqwfAl9mipo99zkBv/n2JtWY89Yxa3ZabWSrs0e2KTudKVa3peLUvYXMefDqIleLPVUBZMA==", - "dev": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.4" - } - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "dev": true, - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - }, - "psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "dev": true - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "dev": true - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - }, - "dependencies": { - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "^2.0.0" - } - } - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - } - }, - "realpath-native": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/realpath-native/-/realpath-native-2.0.0.tgz", - "integrity": "sha512-v1SEYUOXXdbBZK8ZuNgO4TBjamPsiSgcFr0aP+tEKpQZK8vooEUqV6nm6Cv502mX4NF2EfsnVqtNAHG+/6Ur1Q==", - "dev": true - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "regenerate": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.1.tgz", - "integrity": "sha512-j2+C8+NtXQgEKWk49MMP5P/u2GhnahTtVkRIHr5R5lVRlbKvmQ+oS+A5aLKWp2ma5VkT8sh6v+v4hbH0YHR66A==", - "dev": true - }, - "regenerate-unicode-properties": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", - "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", - "dev": true, - "requires": { - "regenerate": "^1.4.0" - } - }, - "regenerator-runtime": { - "version": "0.13.7", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", - "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", - "dev": true - }, - "regenerator-transform": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz", - "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==", - "dev": true, - "requires": { - "@babel/runtime": "^7.8.4" - } - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "regexp.prototype.flags": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", - "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0-next.1" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", - "dev": true - }, - "regexpu-core": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.1.tgz", - "integrity": "sha512-ywH2VUraA44DZQuRKzARmw6S66mr48pQVva4LBeRhcOltJ6hExvWly5ZjFLYo67xbIxb6W1q4bAGtgfEl20zfQ==", - "dev": true, - "requires": { - "regenerate": "^1.4.0", - "regenerate-unicode-properties": "^8.2.0", - "regjsgen": "^0.5.1", - "regjsparser": "^0.6.4", - "unicode-match-property-ecmascript": "^1.0.4", - "unicode-match-property-value-ecmascript": "^1.2.0" - } - }, - "regjsgen": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", - "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", - "dev": true - }, - "regjsparser": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.4.tgz", - "integrity": "sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw==", - "dev": true, - "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - } - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "repeat-element": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true - } - } - }, - "request-promise-core": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", - "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", - "dev": true, - "requires": { - "lodash": "^4.17.19" - } - }, - "request-promise-native": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", - "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", - "dev": true, - "requires": { - "request-promise-core": "1.1.4", - "stealthy-require": "^1.1.1", - "tough-cookie": "^2.3.3" - }, - "dependencies": { - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - } - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "resolve": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", - "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", - "dev": true, - "requires": { - "is-core-module": "^2.0.0", - "path-parse": "^1.0.6" - } - }, - "resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "requires": { - "resolve-from": "^5.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true - } - } - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true - }, - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "rollup": { - "version": "1.32.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz", - "integrity": "sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A==", - "dev": true, - "requires": { - "@types/estree": "*", - "@types/node": "*", - "acorn": "^7.1.0" - } - }, - "rollup-plugin-sourcemaps": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.3.tgz", - "integrity": "sha512-paFu+nT1xvuO1tPFYXGe+XnQvg4Hjqv/eIhG8i5EspfYYPBKL57X7iVbfv55aNVASg3dzWvES9dmWsL2KhfByw==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.0.9", - "source-map-resolve": "^0.6.0" - }, - "dependencies": { - "source-map-resolve": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz", - "integrity": "sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==", - "dev": true, - "requires": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0" - } - } - } - }, - "rollup-plugin-terser": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.3.1.tgz", - "integrity": "sha512-1pkwkervMJQGFYvM9nscrUoncPwiKR/K+bHdjv6PFgRo3cgPHoRT83y2Aa3GvINj4539S15t/tpFPb775TDs6w==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.5.5", - "jest-worker": "^24.9.0", - "rollup-pluginutils": "^2.8.2", - "serialize-javascript": "^4.0.0", - "terser": "^4.6.2" - }, - "dependencies": { - "jest-worker": { - "version": "24.9.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-24.9.0.tgz", - "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", - "dev": true, - "requires": { - "merge-stream": "^2.0.0", - "supports-color": "^6.1.0" - } - }, - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "rollup-plugin-typescript2": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.27.3.tgz", - "integrity": "sha512-gmYPIFmALj9D3Ga1ZbTZAKTXq1JKlTQBtj299DXhqYz9cL3g/AQfUvbb2UhH+Nf++cCq941W2Mv7UcrcgLzJJg==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.1.0", - "find-cache-dir": "^3.3.1", - "fs-extra": "8.1.0", - "resolve": "1.17.0", - "tslib": "2.0.1" - }, - "dependencies": { - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, - "tslib": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", - "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - } - } - }, - "rollup-pluginutils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", - "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", - "dev": true, - "requires": { - "estree-walker": "^0.6.1" - }, - "dependencies": { - "estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", - "dev": true - } - } - }, - "rsvp": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", - "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", - "dev": true - }, - "run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true - }, - "rxjs": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", - "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - } - } - }, - "sade": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/sade/-/sade-1.7.4.tgz", - "integrity": "sha512-y5yauMD93rX840MwUJr7C1ysLFBgMspsdTo4UVrDg3fXDvtwOyIqykhVAAm6fk/3au77773itJStObgK+LKaiA==", - "dev": true, - "requires": { - "mri": "^1.1.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", - "dev": true, - "requires": { - "ret": "~0.1.10" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "sane": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/sane/-/sane-4.1.0.tgz", - "integrity": "sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==", - "dev": true, - "requires": { - "@cnakazawa/watch": "^1.0.3", - "anymatch": "^2.0.0", - "capture-exit": "^2.0.0", - "exec-sh": "^0.3.2", - "execa": "^1.0.0", - "fb-watchman": "^2.0.0", - "micromatch": "^3.1.4", - "minimist": "^1.1.1", - "walker": "~1.0.5" - }, - "dependencies": { - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - } - } - }, - "saxes": { - "version": "3.1.11", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-3.1.11.tgz", - "integrity": "sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g==", - "dev": true, - "requires": { - "xmlchars": "^2.1.1" - } - }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true - }, - "serialize-javascript": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", - "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "set-value": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", - "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", - "dev": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - }, - "shellwords": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", - "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true, - "optional": true - }, - "side-channel": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz", - "integrity": "sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g==", - "dev": true, - "requires": { - "es-abstract": "^1.18.0-next.0", - "object-inspect": "^1.8.0" - } - }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, - "sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "dev": true - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "slice-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", - "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "astral-regex": "^1.0.0", - "is-fullwidth-code-point": "^2.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - } - } - }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", - "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", - "dev": true, - "requires": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "dev": true - }, - "spdx-correct": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", - "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", - "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "stack-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.2.tgz", - "integrity": "sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "stealthy-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", - "dev": true - }, - "stream-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-equal/-/stream-equal-2.0.1.tgz", - "integrity": "sha512-AWR6CrePDXP/6fAf63rBT+wy8jxFIg7Q2l3YuckVQC06zkiYG2cdvYalZN9LBAch5MoXJUOmUckcoOtJw1PLfQ==", - "dev": true - }, - "string-length": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-3.1.0.tgz", - "integrity": "sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA==", - "dev": true, - "requires": { - "astral-regex": "^1.0.0", - "strip-ansi": "^5.2.0" - } - }, - "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "string.prototype.matchall": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz", - "integrity": "sha512-N/jp6O5fMf9os0JU3E72Qhf590RSRZU/ungsL/qJUYVTNv7hTG0P/dbPjxINVN9jpscu3nzYwKESU3P3RY5tOg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.0", - "has-symbols": "^1.0.1", - "internal-slot": "^1.0.2", - "regexp.prototype.flags": "^1.3.0", - "side-channel": "^1.0.2" - }, - "dependencies": { - "es-abstract": { - "version": "1.17.7", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", - "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - } - } - }, - "string.prototype.trimend": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.2.tgz", - "integrity": "sha512-8oAG/hi14Z4nOVP0z6mdiVZ/wqjDtWSLygMigTzAb+7aPEDTleeFf+WrF+alzecxIRkckkJVn+dTlwzJXORATw==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" - } - }, - "string.prototype.trimstart": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.2.tgz", - "integrity": "sha512-7F6CdBTl5zyu30BJFdzSTlSlLPwODC23Od+iLoVH8X6+3fvDPPuBVVj9iaB1GOsSTSIgVfsfm27R2FGrAPznWg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - } - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "supports-hyperlinks": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz", - "integrity": "sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA==", - "dev": true, - "requires": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "symbol-tree": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", - "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true - }, - "table": { - "version": "5.4.6", - "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", - "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", - "dev": true, - "requires": { - "ajv": "^6.10.2", - "lodash": "^4.17.14", - "slice-ansi": "^2.1.0", - "string-width": "^3.0.0" - }, - "dependencies": { - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - } - } - }, - "terminal-link": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", - "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "supports-hyperlinks": "^2.0.0" - } - }, - "terser": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", - "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", - "dev": true, - "requires": { - "commander": "^2.20.0", - "source-map": "~0.6.1", - "source-map-support": "~0.5.12" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "requires": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "throat": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz", - "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "tiny-glob": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.6.tgz", - "integrity": "sha512-A7ewMqPu1B5PWwC3m7KVgAu96Ch5LA0w4SnEN/LbDREj/gAD0nPWboRbn8YoP9ISZXqeNAlMvKSKoEuhcfK3Pw==", - "dev": true, - "requires": { - "globalyzer": "^0.1.0", - "globrex": "^0.1.1" - } - }, - "tiny-warning": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", - "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, - "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "tough-cookie": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", - "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", - "dev": true, - "requires": { - "ip-regex": "^2.1.0", - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, - "tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "ts-jest": { - "version": "25.5.1", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.5.1.tgz", - "integrity": "sha512-kHEUlZMK8fn8vkxDjwbHlxXRB9dHYpyzqKIGDNxbzs+Rz+ssNDSDNusEK8Fk/sDd4xE6iKoQLfFkFVaskmTJyw==", - "dev": true, - "requires": { - "bs-logger": "0.x", - "buffer-from": "1.x", - "fast-json-stable-stringify": "2.x", - "json5": "2.x", - "lodash.memoize": "4.x", - "make-error": "1.x", - "micromatch": "4.x", - "mkdirp": "0.x", - "semver": "6.x", - "yargs-parser": "18.x" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "tsconfig-paths": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", - "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", - "dev": true, - "requires": { - "@types/json5": "^0.0.29", - "json5": "^1.0.1", - "minimist": "^1.2.0", - "strip-bom": "^3.0.0" - }, - "dependencies": { - "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - } - } - }, - "tsdx": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/tsdx/-/tsdx-0.14.1.tgz", - "integrity": "sha512-keHmFdCL2kx5nYFlBdbE3639HQ2v9iGedAFAajobrUTH2wfX0nLPdDhbHv+GHLQZqf0c5ur1XteE8ek/+Eyj5w==", - "dev": true, - "requires": { - "@babel/core": "^7.4.4", - "@babel/helper-module-imports": "^7.0.0", - "@babel/parser": "^7.11.5", - "@babel/plugin-proposal-class-properties": "^7.4.4", - "@babel/preset-env": "^7.11.0", - "@babel/traverse": "^7.11.5", - "@rollup/plugin-babel": "^5.1.0", - "@rollup/plugin-commonjs": "^11.0.0", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-node-resolve": "^9.0.0", - "@rollup/plugin-replace": "^2.2.1", - "@types/jest": "^25.2.1", - "@typescript-eslint/eslint-plugin": "^2.12.0", - "@typescript-eslint/parser": "^2.12.0", - "ansi-escapes": "^4.2.1", - "asyncro": "^3.0.0", - "babel-eslint": "^10.0.3", - "babel-plugin-annotate-pure-calls": "^0.4.0", - "babel-plugin-dev-expression": "^0.2.1", - "babel-plugin-macros": "^2.6.1", - "babel-plugin-polyfill-regenerator": "^0.0.4", - "babel-plugin-transform-rename-import": "^2.3.0", - "camelcase": "^6.0.0", - "chalk": "^4.0.0", - "enquirer": "^2.3.4", - "eslint": "^6.1.0", - "eslint-config-prettier": "^6.0.0", - "eslint-config-react-app": "^5.2.1", - "eslint-plugin-flowtype": "^3.13.0", - "eslint-plugin-import": "^2.18.2", - "eslint-plugin-jsx-a11y": "^6.2.3", - "eslint-plugin-prettier": "^3.1.0", - "eslint-plugin-react": "^7.14.3", - "eslint-plugin-react-hooks": "^2.2.0", - "execa": "^4.0.3", - "fs-extra": "^9.0.0", - "jest": "^25.3.0", - "jest-watch-typeahead": "^0.5.0", - "jpjs": "^1.2.1", - "lodash.merge": "^4.6.2", - "ora": "^4.0.3", - "pascal-case": "^3.1.1", - "prettier": "^1.19.1", - "progress-estimator": "^0.2.2", - "regenerator-runtime": "^0.13.7", - "rollup": "^1.32.1", - "rollup-plugin-sourcemaps": "^0.6.2", - "rollup-plugin-terser": "^5.1.2", - "rollup-plugin-typescript2": "^0.27.3", - "sade": "^1.4.2", - "semver": "^7.1.1", - "shelljs": "^0.8.3", - "tiny-glob": "^0.2.6", - "ts-jest": "^25.3.1", - "tslib": "^1.9.3", - "typescript": "^3.7.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - } - } - }, - "tslib": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", - "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==", - "dev": true - }, - "tsutils": { - "version": "3.17.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", - "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - } - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "type-fest": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", - "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", - "dev": true - }, - "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, - "typescript": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", - "dev": true - }, - "unicode-canonical-property-names-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", - "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", - "dev": true - }, - "unicode-match-property-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", - "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", - "dev": true, - "requires": { - "unicode-canonical-property-names-ecmascript": "^1.0.4", - "unicode-property-aliases-ecmascript": "^1.0.4" - } - }, - "unicode-match-property-value-ecmascript": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", - "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", - "dev": true - }, - "unicode-property-aliases-ecmascript": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", - "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", - "dev": true - }, - "union-value": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", - "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - } - }, - "universalify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", - "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", - "dev": true - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - } - } - }, - "uri-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", - "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "use": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true - }, - "uuid": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", - "integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==", - "dev": true - }, - "v8-compile-cache": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", - "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==", - "dev": true - }, - "v8-to-istanbul": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-4.1.4.tgz", - "integrity": "sha512-Rw6vJHj1mbdK8edjR7+zuJrpDtKIgNdAvTSAcpYfgMIw+u2dPDntD3dgN4XQFLU2/fvFQdzj+EeSGfd/jnY5fQ==", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0", - "source-map": "^0.7.3" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true - } - } - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "dev": true, - "requires": { - "browser-process-hrtime": "^1.0.0" - } - }, - "w3c-xmlserializer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz", - "integrity": "sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg==", - "dev": true, - "requires": { - "domexception": "^1.0.1", - "webidl-conversions": "^4.0.2", - "xml-name-validator": "^3.0.0" - } - }, - "walker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", - "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", - "dev": true, - "requires": { - "makeerror": "1.0.x" - } - }, - "wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", - "dev": true, - "requires": { - "defaults": "^1.0.3" - } - }, - "webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true - }, - "whatwg-encoding": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", - "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", - "dev": true, - "requires": { - "iconv-lite": "0.4.24" - } - }, - "whatwg-mimetype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", - "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", - "dev": true - }, - "whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true - }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", - "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", - "dev": true, - "requires": { - "mkdirp": "^0.5.1" - } - }, - "write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "ws": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", - "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==", - "dev": true - }, - "xml-name-validator": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", - "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", - "dev": true - }, - "xmlchars": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", - "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true - }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, - "yaml": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", - "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", - "dev": true - }, - "yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "dev": true, - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - } - } - }, - "yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "dependencies": { - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - } - } - } - } -} diff --git a/package.json b/package.json index bbea73e8b..0dc6e6508 100644 --- a/package.json +++ b/package.json @@ -1,64 +1,72 @@ { - "version": "39.1.1", - "license": "MIT", - "sideEffects": false, - "main": "dist/cjs/index.js", - "typings": "dist/types/index.d.ts", - "module": "dist/esm/index.js", - "files": [ - "dist", - "src", - "test" - ], - "engines": { - "node": ">=14.17.0" - }, - "scripts": { - "build": "rm -rf dist & tsc -p tsconfig.esm.json & tsc -p tsconfig.cjs.json", - "prepare": "rm -rf dist & tsc -p tsconfig.esm.json & tsc -p tsconfig.cjs.json", - "test": "jest --passWithNoTests", - "test:coverage": "jest --coverage --passWithNoTests", - "lint": "eslint **/*.ts --ignore-path .eslintignore", - "lint:fix": "eslint **/*.ts --ignore-path .eslintignore --fix" - }, - "peerDependencies": {}, - "prettier": { - "printWidth": 80, - "semi": true, - "singleQuote": true, - "trailingComma": "es5", - "quoteProps": "preserve" - }, - "name": "square", - "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", - "author": { - "name": "Square Developer Platform", - "email": "developers@squareup.com", - "url": "https://squareup.com/developers" - }, - "devDependencies": { - "@apimatic/test-utilities": "^0.0.1", - "@types/jest": "^29.4.0", - "@types/uuid": "^8.3.0", - "@typescript-eslint/eslint-plugin": "^5.52.0", - "@typescript-eslint/parser": "^5.52.0", - "eslint": "^8.34.0", - "jest": "^29.4.3", - "ts-jest": "^29.0.5", - "tslib": "^2.5.0", - "typescript": "^4.9.5", - "uuid": "^8.3.0" - }, - "dependencies": { - "@apimatic/authentication-adapters": "^0.5.4", - "@apimatic/axios-client-adapter": "^0.3.7", - "@apimatic/core": "^0.10.16", - "@apimatic/json-bigint": "^1.2.0", - "@apimatic/schema": "^0.7.14", - "@types/node": "^14.14.30" - }, - "bugs": { - "url": "https://squareup.com/developers", - "email": "developers@squareup.com" - } -} \ No newline at end of file + "name": "square", + "version": "40.0.0", + "private": false, + "repository": "https://github.com/square/square-nodejs-sdk", + "license": "MIT", + "main": "./index.js", + "types": "./index.d.ts", + "scripts": { + "format": "prettier . --write --ignore-unknown", + "build": "tsc", + "prepack": "cp -rv dist/. .", + "test": "yarn test:unit", + "test:unit": "jest --testPathPattern=tests/unit", + "test:integration": "jest --testPathPattern=tests/integration" + }, + "dependencies": { + "url-join": "4.0.1", + "form-data": "^4.0.0", + "formdata-node": "^6.0.3", + "node-fetch": "^2.7.0", + "qs": "^6.13.1", + "readable-stream": "^4.5.2", + "js-base64": "3.7.7", + "form-data-encoder": "^4.0.2", + "square-legacy": "npm:square@^39.1.1" + }, + "devDependencies": { + "@types/url-join": "4.0.1", + "@types/qs": "^6.9.17", + "@types/node-fetch": "^2.6.12", + "@types/readable-stream": "^4.0.18", + "webpack": "^5.97.1", + "ts-loader": "^9.5.1", + "jest": "^29.7.0", + "@types/jest": "^29.5.14", + "ts-jest": "^29.1.1", + "jest-environment-jsdom": "^29.7.0", + "@types/node": "^18.19.70", + "prettier": "^3.4.2", + "typescript": "~5.7.2" + }, + "browser": { + "fs": false, + "os": false, + "path": false + }, + "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.", + "author": { + "name": "Square Developer Platform", + "url": "https://developer.squareup.com", + "email": "developers@squareup.com" + }, + "bugs": { + "url": "https://developer.squareup.com", + "email": "developers@squareup.com" + }, + "exports": { + ".": "./index.js", + "./legacy": { + "types": "./legacy/exports/index.d.ts", + "require": { + "types": "./legacy/exports/index.d.ts", + "default": "./legacy/exports/index.js" + }, + "import": { + "types": "./legacy/exports/index.d.mts", + "default": "./legacy/exports/index.mjs" + } + } + } +} diff --git a/reference.md b/reference.md new file mode 100644 index 000000000..89c7026ad --- /dev/null +++ b/reference.md @@ -0,0 +1,22568 @@ +# Reference + +## Mobile + +
client.mobile.authorizationCode({ ...params }) -> Square.CreateMobileAuthorizationCodeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Generates code to authorize a mobile application to connect to a Square card reader. + +Authorization codes are one-time-use codes and expire 60 minutes after being issued. + +**Important:** The `Authorization` header you provide to this endpoint must have the following format: + +``` +Authorization: Bearer ACCESS_TOKEN +``` + +Replace `ACCESS_TOKEN` with a +[valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.mobile.authorizationCode({ + locationId: "YOUR_LOCATION_ID", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateMobileAuthorizationCodeRequest` + +
+
+ +
+
+ +**requestOptions:** `Mobile.RequestOptions` + +
+
+
+
+ +
+
+
+ +## OAuth + +
client.oAuth.revokeToken({ ...params }) -> Square.RevokeTokenResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Revokes an access token generated with the OAuth flow. + +If an account has more than one OAuth access token for your application, this +endpoint revokes all of them, regardless of which token you specify. + +**Important:** The `Authorization` header for this endpoint must have the +following format: + +``` +Authorization: Client APPLICATION_SECRET +``` + +Replace `APPLICATION_SECRET` with the application secret on the **OAuth** +page for your application in the Developer Dashboard. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.oAuth.revokeToken({ + clientId: "CLIENT_ID", + accessToken: "ACCESS_TOKEN", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RevokeTokenRequest` + +
+
+ +
+
+ +**requestOptions:** `OAuth.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.oAuth.obtainToken({ ...params }) -> Square.ObtainTokenResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns an OAuth access token and a refresh token unless the +`short_lived` parameter is set to `true`, in which case the endpoint +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'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. + +You can use the `scopes` parameter to limit the set of permissions granted +to the access token and refresh token. You can use the `short_lived` parameter +to create an access token that expires in 24 hours. + +**Note:** OAuth tokens should be encrypted and stored on a secure server. +Application clients should never interact directly with OAuth tokens. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.oAuth.obtainToken({ + clientId: "APPLICATION_ID", + clientSecret: "APPLICATION_SECRET", + code: "CODE_FROM_AUTHORIZE", + grantType: "authorization_code", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.ObtainTokenRequest` + +
+
+ +
+
+ +**requestOptions:** `OAuth.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.oAuth.retrieveTokenStatus() -> Square.RetrieveTokenStatusResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token). + +Add the access token to the Authorization header of the request. + +**Important:** The `Authorization` header you provide to this endpoint must have the following format: + +``` +Authorization: Bearer ACCESS_TOKEN +``` + +where `ACCESS_TOKEN` is a +[valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). + +If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.oAuth.retrieveTokenStatus(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `OAuth.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.oAuth.authorize() -> void +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.oAuth.authorize(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `OAuth.RequestOptions` + +
+
+
+
+ +
+
+
+ +## V1Transactions + +
client.v1Transactions.v1ListOrders({ ...params }) -> Square.V1Order[] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides summary information for a merchant's online store orders. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.v1Transactions.v1ListOrders({ + locationId: "location_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.V1ListOrdersRequest` + +
+
+ +
+
+ +**requestOptions:** `V1Transactions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.v1Transactions.v1RetrieveOrder({ ...params }) -> Square.V1Order +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides comprehensive information for a single online store order, including the order's history. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.v1Transactions.v1RetrieveOrder({ + locationId: "location_id", + orderId: "order_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.V1RetrieveOrderRequest` + +
+
+ +
+
+ +**requestOptions:** `V1Transactions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.v1Transactions.v1UpdateOrder({ ...params }) -> Square.V1Order +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.v1Transactions.v1UpdateOrder({ + locationId: "location_id", + orderId: "order_id", + action: "COMPLETE", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.V1UpdateOrderRequest` + +
+
+ +
+
+ +**requestOptions:** `V1Transactions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## ApplePay + +
client.applePay.registerDomain({ ...params }) -> Square.RegisterDomainResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Activates a domain for use with Apple Pay on the Web and Square. A validation +is performed on this domain by Apple to ensure that it is properly set up as +an Apple Pay enabled domain. + +This endpoint provides an easy way for platform developers to bulk activate +Apple Pay on the Web with Square for merchants using their platform. + +Note: You will need to host a valid domain verification file on your domain to support Apple Pay. The +current version of this file is always available at https://app.squareup.com/digital-wallets/apple-pay/apple-developer-merchantid-domain-association, +and should be hosted at `.well_known/apple-developer-merchantid-domain-association` on your +domain. This file is subject to change; we strongly recommend checking for updates regularly and avoiding +long-lived caches that might not keep in sync with the correct file version. + +To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an Apple Pay Payment](https://developer.squareup.com/docs/web-payments/apple-pay). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.applePay.registerDomain({ + domainName: "example.com", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RegisterDomainRequest` + +
+
+ +
+
+ +**requestOptions:** `ApplePay.RequestOptions` + +
+
+
+
+ +
+
+
+ +## BankAccounts + +
client.bankAccounts.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of [BankAccount](entity:BankAccount) objects linked to a Square account. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.bankAccounts.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.bankAccounts.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BankAccountsListRequest` + +
+
+ +
+
+ +**requestOptions:** `BankAccounts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bankAccounts.getByV1Id({ ...params }) -> Square.GetBankAccountByV1IdResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank account ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bankAccounts.getByV1Id({ + v1BankAccountId: "v1_bank_account_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BankAccountsGetByV1IdRequest` + +
+
+ +
+
+ +**requestOptions:** `BankAccounts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bankAccounts.get({ ...params }) -> Square.GetBankAccountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns details of a [BankAccount](entity:BankAccount) +linked to a Square account. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bankAccounts.get({ + bankAccountId: "bank_account_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BankAccountsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `BankAccounts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Bookings + +
client.bookings.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a collection of bookings. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.bookings.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.bookings.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BookingsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.create({ ...params }) -> Square.CreateBookingResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a booking. + +The required input must include the following: + +- `Booking.location_id` +- `Booking.start_at` +- `Booking.AppointmentSegment.team_member_id` +- `Booking.AppointmentSegment.service_variation_id` +- `Booking.AppointmentSegment.service_variation_version` + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.create({ + booking: {}, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateBookingRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.searchAvailability({ ...params }) -> Square.SearchAvailabilityResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for availabilities for booking. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.searchAvailability({ + query: { + filter: { + startAtRange: {}, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchAvailabilityRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.bulkRetrieveBookings({ ...params }) -> Square.BulkRetrieveBookingsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Bulk-Retrieves a list of bookings by booking IDs. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.bulkRetrieveBookings({ + bookingIds: ["booking_ids"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BulkRetrieveBookingsRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.getBusinessProfile() -> Square.GetBusinessBookingProfileResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a seller's booking profile. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.getBusinessProfile(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.retrieveLocationBookingProfile({ ...params }) -> Square.RetrieveLocationBookingProfileResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a seller's location booking profile. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.retrieveLocationBookingProfile({ + locationId: "location_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RetrieveLocationBookingProfileRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.bulkRetrieveTeamMemberBookingProfiles({ ...params }) -> Square.BulkRetrieveTeamMemberBookingProfilesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves one or more team members' booking profiles. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.bulkRetrieveTeamMemberBookingProfiles({ + teamMemberIds: ["team_member_ids"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BulkRetrieveTeamMemberBookingProfilesRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.get({ ...params }) -> Square.GetBookingResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a booking. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.get({ + bookingId: "booking_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BookingsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.update({ ...params }) -> Square.UpdateBookingResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a booking. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.update({ + bookingId: "booking_id", + booking: {}, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateBookingRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.cancel({ ...params }) -> Square.CancelBookingResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels an existing booking. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.cancel({ + bookingId: "booking_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CancelBookingRequest` + +
+
+ +
+
+ +**requestOptions:** `Bookings.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Cards + +
client.cards.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of cards owned by the account making the request. +A max of 25 cards will be returned. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.cards.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.cards.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CardsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Cards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.cards.create({ ...params }) -> Square.CreateCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds a card on file to an existing merchant. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.cards.create({ + idempotencyKey: "4935a656-a929-4792-b97c-8848be85c27c", + sourceId: "cnon:uIbfJXhXETSP197M3GB", + 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", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateCardRequest` + +
+
+ +
+
+ +**requestOptions:** `Cards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.cards.get({ ...params }) -> Square.GetCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves details for a specific Card. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.cards.get({ + cardId: "card_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CardsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Cards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.cards.disable({ ...params }) -> Square.DisableCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Disables the card, preventing any further updates or charges. +Disabling an already disabled card is allowed but has no effect. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.cards.disable({ + cardId: "card_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CardsDisableRequest` + +
+
+ +
+
+ +**requestOptions:** `Cards.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Catalog + +
client.catalog.batchDelete({ ...params }) -> Square.BatchDeleteCatalogObjectsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a set of [CatalogItem](entity:CatalogItem)s based on the +provided list of target IDs and returns a set of successfully deleted IDs in +the response. Deletion is a cascading event such that all children of the +targeted object are also deleted. For example, deleting a CatalogItem will +also delete all of its [CatalogItemVariation](entity:CatalogItemVariation) +children. + +`BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted +IDs can be deleted. The response will only include IDs that were +actually deleted. + +To ensure consistency, only one delete request is processed at a time per seller account. +While one (batch or non-batch) delete request is being processed, other (batched and non-batched) +delete requests are rejected with the `429` error code. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.batchDelete({ + objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchDeleteCatalogObjectsRequest` + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.batchGet({ ...params }) -> Square.BatchGetCatalogObjectsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a set of objects based on the provided ID. +Each [CatalogItem](entity:CatalogItem) returned in the set includes all of its +child information including: all of its +[CatalogItemVariation](entity:CatalogItemVariation) objects, references to +its [CatalogModifierList](entity:CatalogModifierList) objects, and the ids of +any [CatalogTax](entity:CatalogTax) objects that apply to it. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.batchGet({ + objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + includeRelatedObjects: true, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchGetCatalogObjectsRequest` + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.batchUpsert({ ...params }) -> Square.BatchUpsertCatalogObjectsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates up to 10,000 target objects based on the provided +list of objects. The target objects are grouped into batches and each batch is +inserted/updated in an all-or-nothing manner. If an object within a batch is +malformed in some way, or violates a database constraint, the entire batch +containing that item will be disregarded. However, other batches in the same +request may still succeed. Each batch may contain up to 1,000 objects, and +batches will be processed in order as long as the total object count for the +request (items, variations, modifier lists, discounts, and taxes) is no more +than 10,000. + +To ensure consistency, only one update request is processed at a time per seller account. +While one (batch or non-batch) update request is being processed, other (batched and non-batched) +update requests are rejected with the `429` error code. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.batchUpsert({ + idempotencyKey: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", + batches: [ + { + objects: [ + { + type: "SUBSCRIPTION_PRODUCT", + id: "#Tea", + presentAtAllLocations: true, + }, + { + type: "SUBSCRIPTION_PRODUCT", + id: "#Coffee", + presentAtAllLocations: true, + }, + { + type: "SUBSCRIPTION_PRODUCT", + id: "#Beverages", + presentAtAllLocations: true, + }, + { + type: "SUBSCRIPTION_PRODUCT", + id: "#SalesTax", + presentAtAllLocations: true, + }, + ], + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchUpsertCatalogObjectsRequest` + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.info() -> Square.CatalogInfoResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves information about the Square Catalog API, such as batch size +limits that can be used by the `BatchUpsertCatalogObjects` endpoint. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.info(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of all [CatalogObject](entity:CatalogObject)s of the specified types in the catalog. + +The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values, +for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`". + +**Important:** ListCatalog does not return deleted catalog items. To retrieve +deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects) +and set the `include_deleted_objects` attribute value to `true`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.catalog.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.catalog.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CatalogListRequest` + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.search({ ...params }) -> Square.SearchCatalogObjectsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for [CatalogObject](entity:CatalogObject) of any type by matching supported search attribute values, +excluding custom attribute values on items or item variations, against one or more of the specified query filters. + +This (`SearchCatalogObjects`) endpoint differs from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) +endpoint in the following aspects: + +- `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. +- `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not. +- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does. +- The both endpoints have different call conventions, including the query filter formats. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.search({ + objectTypes: ["ITEM"], + query: { + prefixQuery: { + attributeName: "name", + attributePrefix: "tea", + }, + }, + limit: 100, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchCatalogObjectsRequest` + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.searchItems({ ...params }) -> Square.SearchCatalogItemsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for catalog items or item variations by matching supported search attribute values, including +custom attribute values, against one or more of the specified query filters. + +This (`SearchCatalogItems`) endpoint differs from the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects) +endpoint in the following aspects: + +- `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. +- `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not. +- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does. +- The both endpoints use different call conventions, including the query filter formats. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.searchItems({ + 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: "min", + max: "max", + }, + }, + { + customAttributeDefinitionId: "VARIETAL_DEFINITION_ID", + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchCatalogItemsRequest` + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.updateItemModifierLists({ ...params }) -> Square.UpdateItemModifierListsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the [CatalogModifierList](entity:CatalogModifierList) objects +that apply to the targeted [CatalogItem](entity:CatalogItem) without having +to perform an upsert on the entire item. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.updateItemModifierLists({ + itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + modifierListsToEnable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + modifierListsToDisable: ["7WRC16CJZDVLSNDQ35PP6YAD"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateItemModifierListsRequest` + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.updateItemTaxes({ ...params }) -> Square.UpdateItemTaxesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the [CatalogTax](entity:CatalogTax) objects that apply to the +targeted [CatalogItem](entity:CatalogItem) without having to perform an +upsert on the entire item. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.updateItemTaxes({ + itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + taxesToEnable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], + taxesToDisable: ["AQCEGCEBBQONINDOHRGZISEX"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateItemTaxesRequest` + +
+
+ +
+
+ +**requestOptions:** `Catalog.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Customers + +
client.customers.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists customer profiles associated with a Square account. + +Under normal operating conditions, newly created or updated customer profiles become available +for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated +profiles can take closer to one minute or longer, especially during network incidents and outages. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.customers.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.customers.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CustomersListRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.create({ ...params }) -> Square.CreateCustomerResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new customer for a business. + +You must provide at least one of the following values in your request to this +endpoint: + +- `given_name` +- `family_name` +- `company_name` +- `email_address` +- `phone_number` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.create({ + 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", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateCustomerRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.batchCreate({ ...params }) -> Square.BulkCreateCustomersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates multiple [customer profiles](entity:Customer) for a business. + +This endpoint takes a map of individual create requests and returns a map of responses. + +You must provide at least one of the following values in each create request: + +- `given_name` +- `family_name` +- `company_name` +- `email_address` +- `phone_number` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.batchCreate({ + customers: { + "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { + 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", + }, + "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + givenName: "Marie", + familyName: "Curie", + emailAddress: "Marie.Curie@example.com", + address: { + addressLine1: "500 Electric Ave", + addressLine2: "Suite 601", + locality: "New York", + administrativeDistrictLevel1: "NY", + postalCode: "10003", + country: "US", + }, + phoneNumber: "+1-212-444-4240", + referenceId: "YOUR_REFERENCE_ID", + note: "another customer", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BulkCreateCustomersRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.bulkDeleteCustomers({ ...params }) -> Square.BulkDeleteCustomersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes multiple customer profiles. + +The endpoint takes a list of customer IDs and returns a map of responses. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.bulkDeleteCustomers({ + customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BulkDeleteCustomersRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.bulkRetrieveCustomers({ ...params }) -> Square.BulkRetrieveCustomersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves multiple customer profiles. + +This endpoint takes a list of customer IDs and returns a map of responses. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.bulkRetrieveCustomers({ + customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BulkRetrieveCustomersRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.bulkUpdateCustomers({ ...params }) -> Square.BulkUpdateCustomersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates multiple customer profiles. + +This endpoint takes a map of individual update requests and returns a map of responses. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.bulkUpdateCustomers({ + customers: { + "8DDA5NZVBZFGAX0V3HPF81HHE0": { + emailAddress: "New.Amelia.Earhart@example.com", + note: "updated customer note", + version: 2, + }, + N18CPRVXR5214XPBBA6BZQWF3C: { + givenName: "Marie", + familyName: "Curie", + version: 0, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BulkUpdateCustomersRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.search({ ...params }) -> Square.SearchCustomersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches the customer profiles associated with a Square account using one or more supported query filters. + +Calling `SearchCustomers` without any explicit query filter returns all +customer profiles ordered alphabetically based on `given_name` and +`family_name`. + +Under normal operating conditions, newly created or updated customer profiles become available +for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated +profiles can take closer to one minute or longer, especially during network incidents and outages. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.search({ + limit: 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", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchCustomersRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.get({ ...params }) -> Square.GetCustomerResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns details for a single customer. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.get({ + customerId: "customer_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CustomersGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.update({ ...params }) -> Square.UpdateCustomerResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. +To add or update a field, specify the new value. To remove a field, specify `null`. + +To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.update({ + customerId: "customer_id", + emailAddress: "New.Amelia.Earhart@example.com", + note: "updated customer note", + version: 2, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateCustomerRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.delete({ ...params }) -> Square.DeleteCustomerResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a customer profile from a business. + +To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.delete({ + customerId: "customer_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CustomersDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Customers.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Devices + +
client.devices.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List devices associated with the merchant. Currently, only Terminal API +devices are supported. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.devices.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.devices.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DevicesListRequest` + +
+
+ +
+
+ +**requestOptions:** `Devices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.devices.get({ ...params }) -> Square.GetDeviceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves Device with the associated `device_id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.devices.get({ + deviceId: "device_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DevicesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Devices.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Disputes + +
client.disputes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of disputes associated with a particular account. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.disputes.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.disputes.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DisputesListRequest` + +
+
+ +
+
+ +**requestOptions:** `Disputes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.disputes.get({ ...params }) -> Square.GetDisputeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns details about a specific dispute. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.disputes.get({ + disputeId: "dispute_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DisputesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Disputes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.disputes.accept({ ...params }) -> Square.AcceptDisputeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and +updates the dispute state to ACCEPTED. + +Square debits the disputed amount from the seller’s Square account. If the Square account +does not have sufficient funds, Square debits the associated bank account. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.disputes.accept({ + disputeId: "dispute_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DisputesAcceptRequest` + +
+
+ +
+
+ +**requestOptions:** `Disputes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.disputes.createEvidenceFile({ ...params }) -> Square.CreateDisputeEvidenceFileResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP +multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.disputes.createEvidenceFile({ + disputeId: "dispute_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DisputesCreateEvidenceFileRequest` + +
+
+ +
+
+ +**requestOptions:** `Disputes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.disputes.createEvidenceText({ ...params }) -> Square.CreateDisputeEvidenceTextResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Uploads text to use as evidence for a dispute challenge. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.disputes.createEvidenceText({ + disputeId: "dispute_id", + idempotencyKey: "ed3ee3933d946f1514d505d173c82648", + evidenceType: "TRACKING_NUMBER", + evidenceText: "1Z8888888888888888", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateDisputeEvidenceTextRequest` + +
+
+ +
+
+ +**requestOptions:** `Disputes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.disputes.submitEvidence({ ...params }) -> Square.SubmitEvidenceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Submits evidence to the cardholder's bank. + +The evidence submitted by this endpoint includes evidence uploaded +using the [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) and +[CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText) endpoints and +evidence automatically provided by Square, when available. Evidence cannot be removed from +a dispute after submission. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.disputes.submitEvidence({ + disputeId: "dispute_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DisputesSubmitEvidenceRequest` + +
+
+ +
+
+ +**requestOptions:** `Disputes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Employees + +
client.employees.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.employees.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.employees.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.EmployeesListRequest` + +
+
+ +
+
+ +**requestOptions:** `Employees.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.employees.get({ ...params }) -> Square.GetEmployeeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.employees.get({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.EmployeesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Employees.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Events + +
client.events.searchEvents({ ...params }) -> Square.SearchEventsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Search for Square API events that occur within a 28-day timeframe. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.searchEvents(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchEventsRequest` + +
+
+ +
+
+ +**requestOptions:** `Events.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.events.disableEvents() -> Square.DisableEventsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Disables events to prevent them from being searchable. +All events are disabled by default. You must enable events to make them searchable. +Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.disableEvents(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Events.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.events.enableEvents() -> Square.EnableEventsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enables events to make them searchable. Only events that occur while in the enabled state are searchable. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.enableEvents(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Events.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.events.listEventTypes({ ...params }) -> Square.ListEventTypesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all event types that you can subscribe to as webhooks or query using the Events API. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.listEventTypes(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.ListEventTypesRequest` + +
+
+ +
+
+ +**requestOptions:** `Events.RequestOptions` + +
+
+
+
+ +
+
+
+ +## GiftCards + +
client.giftCards.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all gift cards. You can specify optional filters to retrieve +a subset of the gift cards. Results are sorted by `created_at` in ascending order. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.giftCards.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.giftCards.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.GiftCardsListRequest` + +
+
+ +
+
+ +**requestOptions:** `GiftCards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.giftCards.create({ ...params }) -> Square.CreateGiftCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card +has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call +[CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) and create an `ACTIVATE` +activity with the initial balance. Alternatively, you can use [RefundPayment](api-endpoint:Refunds-RefundPayment) +to refund a payment to the new gift card. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.giftCards.create({ + idempotencyKey: "NC9Tm69EjbjtConu", + locationId: "81FN9BNFZTKS4", + giftCard: { + type: "DIGITAL", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateGiftCardRequest` + +
+
+ +
+
+ +**requestOptions:** `GiftCards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.giftCards.getFromGan({ ...params }) -> Square.GetGiftCardFromGanResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a gift card using the gift card account number (GAN). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.giftCards.getFromGan({ + gan: "7783320001001635", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.GetGiftCardFromGanRequest` + +
+
+ +
+
+ +**requestOptions:** `GiftCards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.giftCards.getFromNonce({ ...params }) -> Square.GetGiftCardFromNonceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a gift card using a secure payment token that represents the gift card. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.giftCards.getFromNonce({ + nonce: "cnon:7783322135245171", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.GetGiftCardFromNonceRequest` + +
+
+ +
+
+ +**requestOptions:** `GiftCards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.giftCards.linkCustomer({ ...params }) -> Square.LinkCustomerToGiftCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Links a customer to a gift card, which is also referred to as adding a card on file. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.giftCards.linkCustomer({ + giftCardId: "gift_card_id", + customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.LinkCustomerToGiftCardRequest` + +
+
+ +
+
+ +**requestOptions:** `GiftCards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.giftCards.unlinkCustomer({ ...params }) -> Square.UnlinkCustomerFromGiftCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Unlinks a customer from a gift card, which is also referred to as removing a card on file. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.giftCards.unlinkCustomer({ + giftCardId: "gift_card_id", + customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UnlinkCustomerFromGiftCardRequest` + +
+
+ +
+
+ +**requestOptions:** `GiftCards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.giftCards.get({ ...params }) -> Square.GetGiftCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a gift card using the gift card ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.giftCards.get({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.GiftCardsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `GiftCards.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Inventory + +
client.inventory.deprecatedGetAdjustment({ ...params }) -> Square.GetInventoryAdjustmentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL +is updated to conform to the standard convention. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.deprecatedGetAdjustment({ + adjustmentId: "adjustment_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InventoryDeprecatedGetAdjustmentRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.getAdjustment({ ...params }) -> Square.GetInventoryAdjustmentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the [InventoryAdjustment](entity:InventoryAdjustment) object +with the provided `adjustment_id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.getAdjustment({ + adjustmentId: "adjustment_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InventoryGetAdjustmentRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.deprecatedBatchChange({ ...params }) -> Square.BatchChangeInventoryResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL +is updated to conform to the standard convention. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.deprecatedBatchChange({ + 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, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchChangeInventoryRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.deprecatedBatchGetChanges({ ...params }) -> Square.BatchGetInventoryChangesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL +is updated to conform to the standard convention. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.deprecatedBatchGetChanges({ + catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + locationIds: ["C6W5YS5QM06F5"], + types: ["PHYSICAL_COUNT"], + states: ["IN_STOCK"], + updatedAfter: "2016-11-01T00:00:00.000Z", + updatedBefore: "2016-12-01T00:00:00.000Z", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchRetrieveInventoryChangesRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.deprecatedBatchGetCounts({ ...params }) -> Square.BatchGetInventoryCountsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL +is updated to conform to the standard convention. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.deprecatedBatchGetCounts({ + catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + locationIds: ["59TNP9SA8VGDA"], + updatedAfter: "2016-11-16T00:00:00.000Z", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchGetInventoryCountsRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.batchCreateChanges({ ...params }) -> Square.BatchChangeInventoryResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Applies adjustments and counts to the provided item quantities. + +On success: returns the current calculated counts for all objects +referenced in the request. +On failure: returns a list of related errors. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.batchCreateChanges({ + 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, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchChangeInventoryRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.batchGetChanges({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns historical physical counts and adjustments based on the +provided filter criteria. + +Results are paginated and sorted in ascending order according their +`occurred_at` timestamp (oldest first). + +BatchRetrieveInventoryChanges is a catch-all query endpoint for queries +that cannot be handled by other, simpler endpoints. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.inventory.batchGetChanges({ + catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + locationIds: ["C6W5YS5QM06F5"], + types: ["PHYSICAL_COUNT"], + states: ["IN_STOCK"], + updatedAfter: "2016-11-01T00:00:00.000Z", + updatedBefore: "2016-12-01T00:00:00.000Z", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.inventory.batchGetChanges({ + catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + locationIds: ["C6W5YS5QM06F5"], + types: ["PHYSICAL_COUNT"], + states: ["IN_STOCK"], + updatedAfter: "2016-11-01T00:00:00.000Z", + updatedBefore: "2016-12-01T00:00:00.000Z", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchRetrieveInventoryChangesRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.batchGetCounts({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns current counts for the provided +[CatalogObject](entity:CatalogObject)s at the requested +[Location](entity:Location)s. + +Results are paginated and sorted in descending order according to their +`calculated_at` timestamp (newest first). + +When `updated_after` is specified, only counts that have changed since that +time (based on the server timestamp for the most recent change) are +returned. This allows clients to perform a "sync" operation, for example +in response to receiving a Webhook notification. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.inventory.batchGetCounts({ + catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + locationIds: ["59TNP9SA8VGDA"], + updatedAfter: "2016-11-16T00:00:00.000Z", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.inventory.batchGetCounts({ + catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + locationIds: ["59TNP9SA8VGDA"], + updatedAfter: "2016-11-16T00:00:00.000Z", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchGetInventoryCountsRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.deprecatedGetPhysicalCount({ ...params }) -> Square.GetInventoryPhysicalCountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL +is updated to conform to the standard convention. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.deprecatedGetPhysicalCount({ + physicalCountId: "physical_count_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InventoryDeprecatedGetPhysicalCountRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.getPhysicalCount({ ...params }) -> Square.GetInventoryPhysicalCountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount) +object with the provided `physical_count_id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.getPhysicalCount({ + physicalCountId: "physical_count_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InventoryGetPhysicalCountRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.getTransfer({ ...params }) -> Square.GetInventoryTransferResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the [InventoryTransfer](entity:InventoryTransfer) object +with the provided `transfer_id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.inventory.getTransfer({ + transferId: "transfer_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InventoryGetTransferRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.get({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the current calculated stock count for a given +[CatalogObject](entity:CatalogObject) at a given set of +[Location](entity:Location)s. Responses are paginated and unsorted. +For more sophisticated queries, use a batch endpoint. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.inventory.get({ + catalogObjectId: "catalog_object_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.inventory.get({ + catalogObjectId: "catalog_object_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InventoryGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.inventory.changes({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a set of physical counts and inventory adjustments for the +provided [CatalogObject](entity:CatalogObject) at the requested +[Location](entity:Location)s. + +You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) +and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID. + +Results are paginated and sorted in descending order according to their +`occurred_at` timestamp (newest first). + +There are no limits on how far back the caller can page. This endpoint can be +used to display recent changes for a specific item. For more +sophisticated queries, use a batch endpoint. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.inventory.changes({ + catalogObjectId: "catalog_object_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.inventory.changes({ + catalogObjectId: "catalog_object_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InventoryChangesRequest` + +
+
+ +
+
+ +**requestOptions:** `Inventory.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Invoices + +
client.invoices.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of invoices for a given location. The response +is paginated. If truncated, the response includes a `cursor` that you +use in a subsequent request to retrieve the next set of invoices. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.invoices.list({ + locationId: "location_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.invoices.list({ + locationId: "location_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InvoicesListRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.create({ ...params }) -> Square.CreateInvoiceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a draft [invoice](entity:Invoice) +for an order created using the Orders API. + +A draft invoice remains in your account and no action is taken. +You must publish the invoice before Square can process it (send it to the customer's email address or charge the customer’s card on file). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.create({ + 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, + cashAppPay: 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", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateInvoiceRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.search({ ...params }) -> Square.SearchInvoicesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for invoices from a location specified in +the filter. You can optionally specify customers in the filter for whom to +retrieve invoices. In the current implementation, you can only specify one location and +optionally one customer. + +The response is paginated. If truncated, the response includes a `cursor` +that you use in a subsequent request to retrieve the next set of invoices. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.search({ + query: { + filter: { + locationIds: ["ES0RJRZYEC39A"], + customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"], + }, + sort: { + field: "INVOICE_SORT_DATE", + order: "DESC", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchInvoicesRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.get({ ...params }) -> Square.GetInvoiceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves an invoice by invoice ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.get({ + invoiceId: "invoice_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InvoicesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.update({ ...params }) -> Square.UpdateInvoiceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an invoice. This endpoint supports sparse updates, so you only need +to specify the fields you want to change along with the required `version` field. +Some restrictions apply to updating invoices. For example, you cannot change the +`order_id` or `location_id` field. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.update({ + invoiceId: "invoice_id", + invoice: { + version: 1, + paymentRequests: [ + { + uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + tippingEnabled: false, + }, + ], + }, + idempotencyKey: "4ee82288-0910-499e-ab4c-5d0071dad1be", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateInvoiceRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.delete({ ...params }) -> Square.DeleteInvoiceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes the specified invoice. When an invoice is deleted, the +associated order status changes to CANCELED. You can only delete a draft +invoice (you cannot delete a published invoice, including one that is scheduled for processing). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.delete({ + invoiceId: "invoice_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.InvoicesDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.createInvoiceAttachment({ ...params }) -> Square.CreateInvoiceAttachmentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads +with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file +in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF. + +Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices +in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.createInvoiceAttachment({ + invoiceId: "invoice_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateInvoiceAttachmentRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.deleteInvoiceAttachment({ ...params }) -> Square.DeleteInvoiceAttachmentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only +from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.deleteInvoiceAttachment({ + invoiceId: "invoice_id", + attachmentId: "attachment_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DeleteInvoiceAttachmentRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.cancel({ ...params }) -> Square.CancelInvoiceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels an invoice. The seller cannot collect payments for +the canceled invoice. + +You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.cancel({ + invoiceId: "invoice_id", + version: 0, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CancelInvoiceRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.invoices.publish({ ...params }) -> Square.PublishInvoiceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Publishes the specified draft invoice. + +After an invoice is published, Square +follows up based on the invoice configuration. For example, Square +sends the invoice to the customer's email address, charges the customer's card on file, or does +nothing. Square also makes the invoice available on a Square-hosted invoice page. + +The invoice `status` also changes from `DRAFT` to a status +based on the invoice configuration. For example, the status changes to `UNPAID` if +Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the +invoice amount. + +In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ` +and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.invoices.publish({ + invoiceId: "invoice_id", + version: 1, + idempotencyKey: "32da42d0-1997-41b0-826b-f09464fc2c2e", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PublishInvoiceRequest` + +
+
+ +
+
+ +**requestOptions:** `Invoices.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Locations + +
client.locations.list() -> Square.ListLocationsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api), +including those with an inactive status. Locations are listed alphabetically by `name`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.list(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Locations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.create({ ...params }) -> Square.CreateLocationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a [location](https://developer.squareup.com/docs/locations-api). +Creating new locations allows for separate configuration of receipt layouts, item prices, +and sales reports. Developers can use locations to separate sales activity through applications +that integrate with Square from sales activity elsewhere in a seller's account. +Locations created programmatically with the Locations API last forever and +are visible to the seller for their own management. Therefore, ensure that +each location has a sensible and unique name. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.create({ + location: { + name: "Midtown", + address: { + addressLine1: "1234 Peachtree St. NE", + locality: "Atlanta", + administrativeDistrictLevel1: "GA", + postalCode: "30309", + }, + description: "Midtown Atlanta store", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateLocationRequest` + +
+
+ +
+
+ +**requestOptions:** `Locations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.get({ ...params }) -> Square.GetLocationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves details of a single location. Specify "main" +as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.get({ + locationId: "location_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.LocationsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Locations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.update({ ...params }) -> Square.UpdateLocationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a [location](https://developer.squareup.com/docs/locations-api). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.update({ + locationId: "location_id", + 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", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateLocationRequest` + +
+
+ +
+
+ +**requestOptions:** `Locations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.checkouts({ ...params }) -> Square.CreateCheckoutResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Links a `checkoutId` to a `checkout_page_url` that customers are +directed to in order to provide their payment information using a +payment processing workflow hosted on connect.squareup.com. + +NOTE: The Checkout API has been updated with new features. +For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.checkouts({ + locationId: "location_id", + idempotencyKey: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", + order: { + order: { + locationId: "location_id", + referenceId: "reference_id", + customerId: "customer_id", + lineItems: [ + { + name: "Printed T Shirt", + quantity: "2", + appliedTaxes: [ + { + taxUid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3", + }, + ], + appliedDiscounts: [ + { + discountUid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4", + }, + ], + basePriceMoney: { + amount: 1500, + currency: "USD", + }, + }, + { + name: "Slim Jeans", + quantity: "1", + basePriceMoney: { + amount: 2500, + currency: "USD", + }, + }, + { + name: "Woven Sweater", + quantity: "3", + basePriceMoney: { + amount: 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: 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: 60, + currency: "USD", + }, + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateCheckoutRequest` + +
+
+ +
+
+ +**requestOptions:** `Locations.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Loyalty + +
client.loyalty.searchEvents({ ...params }) -> Square.SearchLoyaltyEventsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for loyalty events. + +A Square loyalty program maintains a ledger of events that occur during the lifetime of a +buyer's loyalty account. Each change in the point balance +(for example, points earned, points redeemed, and points expired) is +recorded in the ledger. Using this endpoint, you can search the ledger for events. + +Search results are sorted by `created_at` in descending order. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.searchEvents({ + query: { + filter: { + orderFilter: { + orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY", + }, + }, + }, + limit: 30, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchLoyaltyEventsRequest` + +
+
+ +
+
+ +**requestOptions:** `Loyalty.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Merchants + +
client.merchants.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides details about the merchant associated with a given access token. + +The access token used to connect your application to a Square seller is associated +with a single merchant. That means that `ListMerchants` returns a list +with a single `Merchant` object. You can specify your personal access token +to get your own merchant information or specify an OAuth token to get the +information for the merchant that granted your application access. + +If you know the merchant ID, you can also use the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) +endpoint to retrieve the merchant information. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.merchants.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.merchants.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.MerchantsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Merchants.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.get({ ...params }) -> Square.GetMerchantResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the `Merchant` object for the given `merchant_id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.get({ + merchantId: "merchant_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.MerchantsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Merchants.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Checkout + +
client.checkout.retrieveLocationSettings({ ...params }) -> Square.RetrieveLocationSettingsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the location-level settings for a Square-hosted checkout page. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.retrieveLocationSettings({ + locationId: "location_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RetrieveLocationSettingsRequest` + +
+
+ +
+
+ +**requestOptions:** `Checkout.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.checkout.updateLocationSettings({ ...params }) -> Square.UpdateLocationSettingsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the location-level settings for a Square-hosted checkout page. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.updateLocationSettings({ + locationId: "location_id", + locationSettings: {}, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateLocationSettingsRequest` + +
+
+ +
+
+ +**requestOptions:** `Checkout.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.checkout.retrieveMerchantSettings() -> Square.RetrieveMerchantSettingsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the merchant-level settings for a Square-hosted checkout page. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.retrieveMerchantSettings(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Checkout.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.checkout.updateMerchantSettings({ ...params }) -> Square.UpdateMerchantSettingsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the merchant-level settings for a Square-hosted checkout page. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.updateMerchantSettings({ + merchantSettings: {}, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateMerchantSettingsRequest` + +
+
+ +
+
+ +**requestOptions:** `Checkout.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Orders + +
client.orders.create({ ...params }) -> Square.CreateOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new [order](entity:Order) that can include information about products for +purchase and settings to apply to the purchase. + +To pay for a created order, see +[Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). + +You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.create({ + order: { + locationId: "057P5VYJ4A5X1", + referenceId: "my-order-001", + lineItems: [ + { + name: "New York Strip Steak", + quantity: "1", + basePriceMoney: { + amount: 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: 100, + currency: "USD", + }, + scope: "LINE_ITEM", + }, + ], + }, + idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateOrderRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.batchGet({ ...params }) -> Square.BatchGetOrdersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a set of [orders](entity:Order) by their IDs. + +If a given order ID does not exist, the ID is ignored instead of generating an error. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.batchGet({ + locationId: "057P5VYJ4A5X1", + orderIds: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchGetOrdersRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.calculate({ ...params }) -> Square.CalculateOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enables applications to preview order pricing without creating an order. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.calculate({ + order: { + locationId: "D7AVYMEAPJ3A3", + lineItems: [ + { + name: "Item 1", + quantity: "1", + basePriceMoney: { + amount: 500, + currency: "USD", + }, + }, + { + name: "Item 2", + quantity: "2", + basePriceMoney: { + amount: 300, + currency: "USD", + }, + }, + ], + discounts: [ + { + name: "50% Off", + percentage: "50", + scope: "ORDER", + }, + ], + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CalculateOrderRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.clone({ ...params }) -> Square.CloneOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has +only the core fields (such as line items, taxes, and discounts) copied from the original order. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.clone({ + orderId: "ZAISEM52YcpmcWAzERDOyiWS123", + version: 3, + idempotencyKey: "UNIQUE_STRING", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CloneOrderRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.search({ ...params }) -> Square.SearchOrdersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Search all orders for one or more locations. Orders include all sales, +returns, and exchanges regardless of how or when they entered the Square +ecosystem (such as Point of Sale, Invoices, and Connect APIs). + +`SearchOrders` requests need to specify which locations to search and define a +[SearchOrdersQuery](entity:SearchOrdersQuery) object that controls +how to sort or filter the results. Your `SearchOrdersQuery` can: + +Set filter criteria. +Set the sort order. +Determine whether to return results as complete `Order` objects or as +[OrderEntry](entity:OrderEntry) objects. + +Note that details for orders processed with Square Point of Sale while in +offline mode might not be transmitted to Square for up to 72 hours. Offline +orders have a `created_at` value that reflects the time the order was created, +not the time it was subsequently transmitted to Square. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.search({ + 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, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchOrdersRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.get({ ...params }) -> Square.GetOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves an [Order](entity:Order) by ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.get({ + orderId: "order_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.OrdersGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.update({ ...params }) -> Square.UpdateOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an open [order](entity:Order) by adding, replacing, or deleting +fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. + +An `UpdateOrder` request requires the following: + +- The `order_id` in the endpoint path, identifying the order to update. +- The latest `version` of the order to update. +- The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects) + containing only the fields to update and the version to which the update is + being applied. +- If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete) + identifying the fields to clear. + +To pay for an order, see +[Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.update({ + orderId: "order_id", + order: { + locationId: "location_id", + lineItems: [ + { + uid: "cookie_uid", + name: "COOKIE", + quantity: "2", + basePriceMoney: { + amount: 200, + currency: "USD", + }, + }, + ], + version: 1, + }, + fieldsToClear: ["discounts"], + idempotencyKey: "UNIQUE_STRING", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateOrderRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.pay({ ...params }) -> Square.PayOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment) +or settle an order with a total of `0`. + +The total of the `payment_ids` listed in the request must be equal to the order +total. Orders with a total amount of `0` can be marked as paid by specifying an empty +array of `payment_ids` in the request. + +To be used with `PayOrder`, a payment must: + +- Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment). + Any approved payments that reference the same `order_id` not specified in the + `payment_ids` is canceled. +- Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture). +Using a delayed capture payment with `PayOrder` completes the approved payment. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.pay({ + orderId: "order_id", + idempotencyKey: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", + paymentIds: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PayOrderRequest` + +
+
+ +
+
+ +**requestOptions:** `Orders.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Payments + +
client.payments.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of payments taken by the account making the request. + +Results are eventually consistent, and new payments or changes to payments might take several +seconds to appear. + +The maximum results per page is 100. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.payments.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.payments.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PaymentsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Payments.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.payments.create({ ...params }) -> Square.CreatePaymentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a payment using the provided source. You can use this endpoint +to charge a card (credit/debit card or +Square gift card) or record a payment that the seller received outside of Square +(cash payment from a buyer or a payment that an external entity +processed on behalf of the seller). + +The endpoint creates a +`Payment` object and returns it in the response. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.payments.create({ + sourceId: "ccof:GaJGNaZa8x4OgDJn4GB", + idempotencyKey: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + amountMoney: { + amount: 1000, + currency: "USD", + }, + appFeeMoney: { + amount: 10, + currency: "USD", + }, + autocomplete: true, + customerId: "W92WH6P11H4Z77CTET0RNTGFW8", + locationId: "L88917AVBK2S5", + referenceId: "123456", + note: "Brief description", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreatePaymentRequest` + +
+
+ +
+
+ +**requestOptions:** `Payments.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.payments.cancelByIdempotencyKey({ ...params }) -> Square.CancelPaymentByIdempotencyKeyResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels (voids) a payment identified by the idempotency key that is specified in the +request. + +Use this method when the status of a `CreatePayment` request is unknown (for example, after you send a +`CreatePayment` request, a network error occurs and you do not get a response). In this case, you can +direct Square to cancel the payment using this endpoint. In the request, you provide the same +idempotency key that you provided in your `CreatePayment` request that you want to cancel. After +canceling the payment, you can submit your `CreatePayment` request again. + +Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint +returns successfully. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.payments.cancelByIdempotencyKey({ + idempotencyKey: "a7e36d40-d24b-11e8-b568-0800200c9a66", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CancelPaymentByIdempotencyKeyRequest` + +
+
+ +
+
+ +**requestOptions:** `Payments.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.payments.get({ ...params }) -> Square.GetPaymentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves details for a specific payment. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.payments.get({ + paymentId: "payment_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PaymentsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Payments.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.payments.update({ ...params }) -> Square.UpdatePaymentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a payment with the APPROVED status. +You can update the `amount_money` and `tip_money` using this endpoint. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.payments.update({ + paymentId: "payment_id", + payment: { + amountMoney: { + amount: 1000, + currency: "USD", + }, + tipMoney: { + amount: 100, + currency: "USD", + }, + versionToken: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o", + }, + idempotencyKey: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdatePaymentRequest` + +
+
+ +
+
+ +**requestOptions:** `Payments.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.payments.cancel({ ...params }) -> Square.CancelPaymentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels (voids) a payment. You can use this endpoint to cancel a payment with +the APPROVED `status`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.payments.cancel({ + paymentId: "payment_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PaymentsCancelRequest` + +
+
+ +
+
+ +**requestOptions:** `Payments.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.payments.complete({ ...params }) -> Square.CompletePaymentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Completes (captures) a payment. +By default, payments are set to complete immediately after they are created. + +You can use this endpoint to complete a payment with the APPROVED `status`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.payments.complete({ + paymentId: "payment_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CompletePaymentRequest` + +
+
+ +
+
+ +**requestOptions:** `Payments.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Payouts + +
client.payouts.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of all payouts for the default location. +You can filter payouts by location ID, status, time range, and order them in ascending or descending order. +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.payouts.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.payouts.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PayoutsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Payouts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.payouts.get({ ...params }) -> Square.GetPayoutResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves details of a specific payout identified by a payout ID. +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.payouts.get({ + payoutId: "payout_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PayoutsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Payouts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.payouts.listEntries({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of all payout entries for a specific payout. +To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.payouts.listEntries({ + payoutId: "payout_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.payouts.listEntries({ + payoutId: "payout_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PayoutsListEntriesRequest` + +
+
+ +
+
+ +**requestOptions:** `Payouts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Refunds + +
client.refunds.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of refunds for the account making the request. + +Results are eventually consistent, and new refunds or changes to refunds might take several +seconds to appear. + +The maximum results per page is 100. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.refunds.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.refunds.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RefundsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Refunds.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.refunds.refundPayment({ ...params }) -> Square.RefundPaymentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Refunds a payment. You can refund the entire payment amount or a +portion of it. You can use this endpoint to refund a card payment or record a +refund of a cash or external payment. For more information, see +[Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.refunds.refundPayment({ + idempotencyKey: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", + amountMoney: { + amount: 1000, + currency: "USD", + }, + appFeeMoney: { + amount: 10, + currency: "USD", + }, + paymentId: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + reason: "Example", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RefundPaymentRequest` + +
+
+ +
+
+ +**requestOptions:** `Refunds.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.refunds.get({ ...params }) -> Square.GetPaymentRefundResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a specific refund using the `refund_id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.refunds.get({ + refundId: "refund_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RefundsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Refunds.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Sites + +
client.sites.list() -> Square.ListSitesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date. + +**Note:** Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.sites.list(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Sites.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Snippets + +
client.snippets.get({ ...params }) -> Square.GetSnippetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application. + +You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + +**Note:** Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.snippets.get({ + siteId: "site_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SnippetsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Snippets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.snippets.upsert({ ...params }) -> Square.UpsertSnippetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds a snippet to a Square Online site or updates the existing snippet on the site. +The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site. + +You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + +**Note:** Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.snippets.upsert({ + siteId: "site_id", + snippet: { + content: "", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpsertSnippetRequest` + +
+
+ +
+
+ +**requestOptions:** `Snippets.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.snippets.delete({ ...params }) -> Square.DeleteSnippetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes your snippet from a Square Online site. + +You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + +**Note:** Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.snippets.delete({ + siteId: "site_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SnippetsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Snippets.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Subscriptions + +
client.subscriptions.create({ ...params }) -> Square.CreateSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +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 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). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.create({ + idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf", + locationId: "S8GWD5R9QB376", + planVariationId: "6JHXF3B2CW3YKHDV4XEM674H", + customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", + startDate: "2023-06-20", + cardId: "ccof:qy5x8hHGYsgLrp4Q4GB", + timezone: "America/Los_Angeles", + source: { + name: "My Application", + }, + phases: [ + { + ordinal: 0, + orderTemplateId: "U2NaowWxzXwpsZU697x7ZHOAnCNZY", + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateSubscriptionRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.bulkSwapPlan({ ...params }) -> Square.BulkSwapPlanResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Schedules a plan variation change for all active subscriptions under a given plan +variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.bulkSwapPlan({ + newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + oldPlanVariationId: "6JHXF3B2CW3YKHDV4XEM674H", + locationId: "S8GWD5R9QB376", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BulkSwapPlanRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.search({ ...params }) -> Square.SearchSubscriptionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for subscriptions. + +Results are ordered chronologically by subscription creation date. If +the request specifies more than one location ID, +the endpoint orders the result +by location ID, and then by creation date within each location. If no locations are given +in the query, all locations are searched. + +You can also optionally specify `customer_ids` to search by customer. +If left unset, all customers +associated with the specified locations are returned. +If the request specifies customer IDs, the endpoint orders results +first by location, within location by customer ID, and within +customer by subscription creation date. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.search({ + query: { + filter: { + customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + locationIds: ["S8GWD5R9QB376"], + sourceNames: ["My App"], + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchSubscriptionsRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.get({ ...params }) -> Square.GetSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a specific subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.get({ + subscriptionId: "subscription_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SubscriptionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.update({ ...params }) -> Square.UpdateSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a subscription by modifying or clearing `subscription` field values. +To clear a field, set its value to `null`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.update({ + subscriptionId: "subscription_id", + subscription: { + cardId: "{NEW CARD ID}", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateSubscriptionRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.deleteAction({ ...params }) -> Square.DeleteSubscriptionActionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a scheduled action for a subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.deleteAction({ + subscriptionId: "subscription_id", + actionId: "action_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SubscriptionsDeleteActionRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.changeBillingAnchorDate({ ...params }) -> Square.ChangeBillingAnchorDateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates) +for a subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.changeBillingAnchorDate({ + subscriptionId: "subscription_id", + monthlyBillingAnchorDate: 1, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.ChangeBillingAnchorDateRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.cancel({ ...params }) -> Square.CancelSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +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. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.cancel({ + subscriptionId: "subscription_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SubscriptionsCancelRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.listEvents({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.subscriptions.listEvents({ + subscriptionId: "subscription_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.subscriptions.listEvents({ + subscriptionId: "subscription_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SubscriptionsListEventsRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.pause({ ...params }) -> Square.PauseSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Schedules a `PAUSE` action to pause an active subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.pause({ + subscriptionId: "subscription_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.PauseSubscriptionRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.resume({ ...params }) -> Square.ResumeSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Schedules a `RESUME` action to resume a paused or a deactivated subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.resume({ + subscriptionId: "subscription_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.ResumeSubscriptionRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.subscriptions.swapPlan({ ...params }) -> Square.SwapPlanResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +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). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.subscriptions.swapPlan({ + subscriptionId: "subscription_id", + newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + phases: [ + { + ordinal: 0, + orderTemplateId: "uhhnjH9osVv3shUADwaC0b3hNxQZY", + }, + ], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SwapPlanRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## TeamMembers + +
client.teamMembers.create({ ...params }) -> Square.CreateTeamMemberResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates. +You must provide the following values in your request to this endpoint: + +- `given_name` +- `family_name` + +Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteammember). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.create({ + 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"], + }, + wageSetting: { + jobAssignments: [ + { + payType: "SALARY", + annualRate: { + amount: 3000000, + currency: "USD", + }, + weeklyHours: 40, + jobId: "FjS8x95cqHiMenw4f1NAUH4P", + }, + { + payType: "HOURLY", + hourlyRate: { + amount: 2000, + currency: "USD", + }, + jobId: "VDNpRv8da51NU8qZFC5zDWpF", + }, + ], + isOvertimeExempt: true, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateTeamMemberRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.batchCreate({ ...params }) -> Square.BatchCreateTeamMembersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful creates. +This process is non-transactional and processes as much of the request as possible. If one of the creates in +the request cannot be successfully processed, the request is not marked as failed, but the body of the response +contains explicit error information for the failed create. + +Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-team-members). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.batchCreate({ + 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", + }, + }, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchCreateTeamMembersRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.batchUpdate({ ...params }) -> Square.BatchUpdateTeamMembersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates. +This process is non-transactional and processes as much of the request as possible. If one of the updates in +the request cannot be successfully processed, the request is not marked as failed, but the body of the response +contains explicit error information for the failed update. +Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.batchUpdate({ + 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"], + }, + }, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchUpdateTeamMembersRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.search({ ...params }) -> Square.SearchTeamMembersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of `TeamMember` objects for a business. +The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether +the team member is the Square account owner. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.search({ + query: { + filter: { + locationIds: ["0G5P3VGACMMQZ"], + status: "ACTIVE", + }, + }, + limit: 10, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchTeamMembersRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.get({ ...params }) -> Square.GetTeamMemberResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a `TeamMember` object for the given `TeamMember.id`. +Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.get({ + teamMemberId: "team_member_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.TeamMembersGetRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.update({ ...params }) -> Square.UpdateTeamMemberResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates. +Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.update({ + teamMemberId: "team_member_id", + body: { + 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"], + }, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.TeamMembersUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMembers.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Team + +
client.team.listJobs({ ...params }) -> Square.ListJobsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists jobs in a seller account. Results are sorted by title in ascending order. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.team.listJobs(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.ListJobsRequest` + +
+
+ +
+
+ +**requestOptions:** `Team.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.team.createJob({ ...params }) -> Square.CreateJobResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a job in a seller account. A job defines a title and tip eligibility. Note that +compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.team.createJob({ + job: { + title: "Cashier", + isTipEligible: true, + }, + idempotencyKey: "idempotency-key-0", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateJobRequest` + +
+
+ +
+
+ +**requestOptions:** `Team.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.team.retrieveJob({ ...params }) -> Square.RetrieveJobResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a specified job. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.team.retrieveJob({ + jobId: "job_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.RetrieveJobRequest` + +
+
+ +
+
+ +**requestOptions:** `Team.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.team.updateJob({ ...params }) -> Square.UpdateJobResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the title or tip eligibility of a job. Changes to the title propagate to all +`JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to +tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.team.updateJob({ + jobId: "job_id", + job: { + title: "Cashier 1", + isTipEligible: true, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.UpdateJobRequest` + +
+
+ +
+
+ +**requestOptions:** `Team.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Terminal + +
client.terminal.dismissTerminalAction({ ...params }) -> Square.DismissTerminalActionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +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. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.dismissTerminalAction({ + actionId: "action_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DismissTerminalActionRequest` + +
+
+ +
+
+ +**requestOptions:** `Terminal.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.dismissTerminalCheckout({ ...params }) -> Square.DismissTerminalCheckoutResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Dismisses a Terminal checkout request if the status and type of the request permits it. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.dismissTerminalCheckout({ + checkoutId: "checkout_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DismissTerminalCheckoutRequest` + +
+
+ +
+
+ +**requestOptions:** `Terminal.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.dismissTerminalRefund({ ...params }) -> Square.DismissTerminalRefundResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Dismisses a Terminal refund request if the status and type of the request permits it. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.dismissTerminalRefund({ + terminalRefundId: "terminal_refund_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.DismissTerminalRefundRequest` + +
+
+ +
+
+ +**requestOptions:** `Terminal.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Vendors + +
client.vendors.batchCreate({ ...params }) -> Square.BatchCreateVendorsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.vendors.batchCreate({ + vendors: { + "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { + name: "Joe's Fresh Seafood", + address: { + addressLine1: "505 Electric Ave", + addressLine2: "Suite 600", + locality: "New York", + administrativeDistrictLevel1: "NY", + postalCode: "10003", + country: "US", + }, + contacts: [ + { + name: "Joe Burrow", + emailAddress: "joe@joesfreshseafood.com", + phoneNumber: "1-212-555-4250", + ordinal: 1, + }, + ], + accountNumber: "4025391", + note: "a vendor", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchCreateVendorsRequest` + +
+
+ +
+
+ +**requestOptions:** `Vendors.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.vendors.batchGet({ ...params }) -> Square.BatchGetVendorsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.vendors.batchGet({ + vendorIds: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"], +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchGetVendorsRequest` + +
+
+ +
+
+ +**requestOptions:** `Vendors.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.vendors.batchUpdate({ ...params }) -> Square.BatchUpdateVendorsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.vendors.batchUpdate({ + vendors: { + FMCYHBWT1TPL8MFH52PBMEN92A: { + vendor: {}, + }, + INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4: { + vendor: {}, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.BatchUpdateVendorsRequest` + +
+
+ +
+
+ +**requestOptions:** `Vendors.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.vendors.create({ ...params }) -> Square.CreateVendorResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.vendors.create({ + idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + vendor: { + name: "Joe's Fresh Seafood", + address: { + addressLine1: "505 Electric Ave", + addressLine2: "Suite 600", + locality: "New York", + administrativeDistrictLevel1: "NY", + postalCode: "10003", + country: "US", + }, + contacts: [ + { + name: "Joe Burrow", + emailAddress: "joe@joesfreshseafood.com", + phoneNumber: "1-212-555-4250", + ordinal: 1, + }, + ], + accountNumber: "4025391", + note: "a vendor", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.CreateVendorRequest` + +
+
+ +
+
+ +**requestOptions:** `Vendors.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.vendors.search({ ...params }) -> Square.SearchVendorsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.vendors.search(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.SearchVendorsRequest` + +
+
+ +
+
+ +**requestOptions:** `Vendors.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.vendors.get({ ...params }) -> Square.GetVendorResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the vendor of a specified [Vendor](entity:Vendor) ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.vendors.get({ + vendorId: "vendor_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.VendorsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Vendors.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.vendors.update({ ...params }) -> Square.UpdateVendorResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.vendors.update({ + vendorId: "vendor_id", + body: { + idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + vendor: { + id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + name: "Jack's Chicken Shack", + version: 1, + status: "ACTIVE", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.VendorsUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `Vendors.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Bookings CustomAttributeDefinitions + +
client.bookings.customAttributeDefinitions.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all bookings custom attribute definitions. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.bookings.customAttributeDefinitions.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.bookings.customAttributeDefinitions.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.CustomAttributeDefinitionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributeDefinitions.create({ ...params }) -> Square.CreateBookingCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a bookings custom attribute definition. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributeDefinitions.create({ + customAttributeDefinition: {}, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.CreateBookingCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributeDefinitions.get({ ...params }) -> Square.RetrieveBookingCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a bookings custom attribute definition. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributeDefinitions.get({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.CustomAttributeDefinitionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributeDefinitions.update({ ...params }) -> Square.UpdateBookingCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a bookings custom attribute definition. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributeDefinitions.update({ + key: "key", + customAttributeDefinition: {}, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.UpdateBookingCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributeDefinitions.delete({ ...params }) -> Square.DeleteBookingCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a bookings custom attribute definition. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributeDefinitions.delete({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.CustomAttributeDefinitionsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Bookings CustomAttributes + +
client.bookings.customAttributes.batchDelete({ ...params }) -> Square.BulkDeleteBookingCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Bulk deletes bookings custom attributes. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributes.batchDelete({ + values: { + key: { + bookingId: "booking_id", + key: "key", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.BulkDeleteBookingCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributes.batchUpsert({ ...params }) -> Square.BulkUpsertBookingCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Bulk upserts bookings custom attributes. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributes.batchUpsert({ + values: { + key: { + bookingId: "booking_id", + customAttribute: {}, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.BulkUpsertBookingCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists a booking's custom attributes. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.bookings.customAttributes.list({ + bookingId: "booking_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.bookings.customAttributes.list({ + bookingId: "booking_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.CustomAttributesListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributes.get({ ...params }) -> Square.RetrieveBookingCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a bookings custom attribute. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributes.get({ + bookingId: "booking_id", + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.CustomAttributesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributes.upsert({ ...params }) -> Square.UpsertBookingCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Upserts a bookings custom attribute. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributes.upsert({ + bookingId: "booking_id", + key: "key", + customAttribute: {}, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.UpsertBookingCustomAttributeRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.customAttributes.delete({ ...params }) -> Square.DeleteBookingCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a bookings custom attribute. + +To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. +To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + +For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to _Appointments Plus_ +or _Appointments Premium_. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.customAttributes.delete({ + bookingId: "booking_id", + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.CustomAttributesDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Bookings LocationProfiles + +
client.bookings.locationProfiles.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists location booking profiles of a seller. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.bookings.locationProfiles.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.bookings.locationProfiles.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.LocationProfilesListRequest` + +
+
+ +
+
+ +**requestOptions:** `LocationProfiles.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Bookings TeamMemberProfiles + +
client.bookings.teamMemberProfiles.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists booking profiles for team members. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.bookings.teamMemberProfiles.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.bookings.teamMemberProfiles.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.TeamMemberProfilesListRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMemberProfiles.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.bookings.teamMemberProfiles.get({ ...params }) -> Square.GetTeamMemberBookingProfileResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a team member's booking profile. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.bookings.teamMemberProfiles.get({ + teamMemberId: "team_member_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.bookings.TeamMemberProfilesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMemberProfiles.RequestOptions` + +
+
+
+
+ +
+
+
+ +## CashDrawers Shifts + +
client.cashDrawers.shifts.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides the details for all of the cash drawer shifts for a location +in a date range. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.cashDrawers.shifts.list({ + locationId: "location_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.cashDrawers.shifts.list({ + locationId: "location_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.cashDrawers.ShiftsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Shifts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.cashDrawers.shifts.get({ ...params }) -> Square.GetCashDrawerShiftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides the summary details for a single cash drawer shift. See +[ListCashDrawerShiftEvents](api-endpoint:CashDrawers-ListCashDrawerShiftEvents) for a list of cash drawer shift events. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.cashDrawers.shifts.get({ + shiftId: "shift_id", + locationId: "location_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.cashDrawers.ShiftsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Shifts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.cashDrawers.shifts.listEvents({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides a paginated list of events for a single cash drawer shift. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.cashDrawers.shifts.listEvents({ + shiftId: "shift_id", + locationId: "location_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.cashDrawers.shifts.listEvents({ + shiftId: "shift_id", + locationId: "location_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.cashDrawers.ShiftsListEventsRequest` + +
+
+ +
+
+ +**requestOptions:** `Shifts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Catalog Images + +
client.catalog.images.create({ ...params }) -> Square.CreateCatalogImageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Uploads an image file to be represented by a [CatalogImage](entity:CatalogImage) object that can be linked to an existing +[CatalogObject](entity:CatalogObject) instance. The resulting `CatalogImage` is unattached to any `CatalogObject` if the `object_id` +is not specified. + +This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in +JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.images.create({}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.catalog.ImagesCreateRequest` + +
+
+ +
+
+ +**requestOptions:** `Images.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.images.update({ ...params }) -> Square.UpdateCatalogImageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Uploads a new image file to replace the existing one in the specified [CatalogImage](entity:CatalogImage) object. + +This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in +JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.images.update({ + imageId: "image_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.catalog.ImagesUpdateRequest` + +
+
+ +
+
+ +**requestOptions:** `Images.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Catalog Object + +
client.catalog.object.upsert({ ...params }) -> Square.UpsertCatalogObjectResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new or updates the specified [CatalogObject](entity:CatalogObject). + +To ensure consistency, only one update request is processed at a time per seller account. +While one (batch or non-batch) update request is being processed, other (batched and non-batched) +update requests are rejected with the `429` error code. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.object.upsert({ + idempotencyKey: "af3d1afc-7212-4300-b463-0bfc5314a5ae", + object: { + type: "SUBSCRIPTION_PRODUCT", + id: "#Cocoa", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.catalog.UpsertCatalogObjectRequest` + +
+
+ +
+
+ +**requestOptions:** `Object_.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.object.get({ ...params }) -> Square.GetCatalogObjectResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a single [CatalogItem](entity:CatalogItem) as a +[CatalogObject](entity:CatalogObject) based on the provided ID. The returned +object includes all of the relevant [CatalogItem](entity:CatalogItem) +information including: [CatalogItemVariation](entity:CatalogItemVariation) +children, references to its +[CatalogModifierList](entity:CatalogModifierList) objects, and the ids of +any [CatalogTax](entity:CatalogTax) objects that apply to it. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.object.get({ + objectId: "object_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.catalog.ObjectGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Object_.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.catalog.object.delete({ ...params }) -> Square.DeleteCatalogObjectResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a single [CatalogObject](entity:CatalogObject) based on the +provided ID and returns the set of successfully deleted IDs in the response. +Deletion is a cascading event such that all children of the targeted object +are also deleted. For example, deleting a [CatalogItem](entity:CatalogItem) +will also delete all of its +[CatalogItemVariation](entity:CatalogItemVariation) children. + +To ensure consistency, only one delete request is processed at a time per seller account. +While one (batch or non-batch) delete request is being processed, other (batched and non-batched) +delete requests are rejected with the `429` error code. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalog.object.delete({ + objectId: "object_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.catalog.ObjectDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Object_.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Checkout PaymentLinks + +
client.checkout.paymentLinks.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all payment links. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.checkout.paymentLinks.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.checkout.paymentLinks.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.checkout.PaymentLinksListRequest` + +
+
+ +
+
+ +**requestOptions:** `PaymentLinks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.checkout.paymentLinks.create({ ...params }) -> Square.CreatePaymentLinkResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.paymentLinks.create({ + idempotencyKey: "cd9e25dc-d9f2-4430-aedb-61605070e95f", + quickPay: { + name: "Auto Detailing", + priceMoney: { + amount: 10000, + currency: "USD", + }, + locationId: "A9Y43N9ABXZBP", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.checkout.CreatePaymentLinkRequest` + +
+
+ +
+
+ +**requestOptions:** `PaymentLinks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.checkout.paymentLinks.get({ ...params }) -> Square.GetPaymentLinkResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a payment link. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.paymentLinks.get({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.checkout.PaymentLinksGetRequest` + +
+
+ +
+
+ +**requestOptions:** `PaymentLinks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.checkout.paymentLinks.update({ ...params }) -> Square.UpdatePaymentLinkResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a payment link. You can update the `payment_link` fields such as +`description`, `checkout_options`, and `pre_populated_data`. +You cannot update other fields such as the `order_id`, `version`, `URL`, or `timestamp` field. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.paymentLinks.update({ + id: "id", + paymentLink: { + version: 1, + checkoutOptions: { + askForShippingAddress: true, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.checkout.UpdatePaymentLinkRequest` + +
+
+ +
+
+ +**requestOptions:** `PaymentLinks.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.checkout.paymentLinks.delete({ ...params }) -> Square.DeletePaymentLinkResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a payment link. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.checkout.paymentLinks.delete({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.checkout.PaymentLinksDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `PaymentLinks.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Customers CustomAttributeDefinitions + +
client.customers.customAttributeDefinitions.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + +When all response pages are retrieved, the results include all custom attribute definitions +that are visible to the requesting application, including those that are created by other +applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that +seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.customers.customAttributeDefinitions.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.customers.customAttributeDefinitions.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CustomAttributeDefinitionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.customAttributeDefinitions.create({ ...params }) -> Square.CreateCustomerCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. +Use this endpoint to define a custom attribute that can be associated with customer profiles. + +A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties +for a custom attribute. After the definition is created, you can call +[UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) or +[BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) +to set the custom attribute for customer profiles in the seller's Customer Directory. + +Sellers can view all custom attributes in exported customer data, including those set to +`VISIBILITY_HIDDEN`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.customAttributeDefinitions.create({ + customAttributeDefinition: { + key: "favoritemovie", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Favorite Movie", + description: "The favorite movie of the customer.", + visibility: "VISIBILITY_HIDDEN", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CreateCustomerCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.customAttributeDefinitions.get({ ...params }) -> Square.GetCustomerCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + +To retrieve a custom attribute definition created by another application, the `visibility` +setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.customAttributeDefinitions.get({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CustomAttributeDefinitionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.customAttributeDefinitions.update({ ...params }) -> Square.UpdateCustomerCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + +Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the +`schema` for a `Selection` data type. + +Only the definition owner can update a custom attribute definition. Note that sellers can view +all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.customAttributeDefinitions.update({ + key: "key", + customAttributeDefinition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.UpdateCustomerCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.customAttributeDefinitions.delete({ ...params }) -> Square.DeleteCustomerCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + +Deleting a custom attribute definition also deletes the corresponding custom attribute from +all customer profiles in the seller's Customer Directory. + +Only the definition owner can delete a custom attribute definition. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.customAttributeDefinitions.delete({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CustomAttributeDefinitionsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.customAttributeDefinitions.batchUpsert({ ...params }) -> Square.BatchUpsertCustomerCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates [custom attributes](entity:CustomAttribute) for customer profiles as a bulk operation. + +Use this endpoint to set the value of one or more custom attributes for one or more customer profiles. +A custom attribute is based on a custom attribute definition in a Square seller account, which is +created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint. + +This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert +requests and returns a map of individual upsert responses. Each upsert request has a unique ID +and provides a customer ID and custom attribute. Each upsert response is returned with the ID +of the corresponding request. + +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.customAttributeDefinitions.batchUpsert({ + values: { + id1: { + customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", + customAttribute: { + key: "favoritemovie", + value: "Dune", + }, + }, + id2: { + customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + customAttribute: { + key: "ownsmovie", + value: false, + }, + }, + id3: { + customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + customAttribute: { + key: "favoritemovie", + value: "Star Wars", + }, + }, + id4: { + customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", + customAttribute: { + key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", + value: "10.5", + }, + }, + id5: { + customerId: "70548QG1HN43B05G0KCZ4MMC1G", + customAttribute: { + key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", + value: "fake-email@squareup.com", + }, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.BatchUpsertCustomerCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Customers Groups + +
client.customers.groups.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the list of customer groups of a business. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.customers.groups.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.customers.groups.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.GroupsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Groups.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.groups.create({ ...params }) -> Square.CreateCustomerGroupResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new customer group for a business. + +The request must include the `name` value of the group. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.groups.create({ + group: { + name: "Loyal Customers", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CreateCustomerGroupRequest` + +
+
+ +
+
+ +**requestOptions:** `Groups.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.groups.get({ ...params }) -> Square.GetCustomerGroupResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a specific customer group as identified by the `group_id` value. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.groups.get({ + groupId: "group_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.GroupsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Groups.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.groups.update({ ...params }) -> Square.UpdateCustomerGroupResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a customer group as identified by the `group_id` value. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.groups.update({ + groupId: "group_id", + group: { + name: "Loyal Customers", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.UpdateCustomerGroupRequest` + +
+
+ +
+
+ +**requestOptions:** `Groups.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.groups.delete({ ...params }) -> Square.DeleteCustomerGroupResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a customer group as identified by the `group_id` value. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.groups.delete({ + groupId: "group_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.GroupsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Groups.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.groups.add({ ...params }) -> Square.AddGroupToCustomerResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds a group membership to a customer. + +The customer is identified by the `customer_id` value +and the customer group is identified by the `group_id` value. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.groups.add({ + customerId: "customer_id", + groupId: "group_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.GroupsAddRequest` + +
+
+ +
+
+ +**requestOptions:** `Groups.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.groups.remove({ ...params }) -> Square.RemoveGroupFromCustomerResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes a group membership from a customer. + +The customer is identified by the `customer_id` value +and the customer group is identified by the `group_id` value. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.groups.remove({ + customerId: "customer_id", + groupId: "group_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.GroupsRemoveRequest` + +
+
+ +
+
+ +**requestOptions:** `Groups.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Customers Segments + +
client.customers.segments.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the list of customer segments of a business. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.customers.segments.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.customers.segments.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.SegmentsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Segments.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.segments.get({ ...params }) -> Square.GetCustomerSegmentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a specific customer segment as identified by the `segment_id` value. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.segments.get({ + segmentId: "segment_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.SegmentsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Segments.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Customers Cards + +
client.customers.cards.create({ ...params }) -> Square.CreateCustomerCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds a card on file to an existing customer. + +As with charges, calls to `CreateCustomerCard` are idempotent. Multiple +calls with the same card nonce return the same card record that was created +with the provided nonce during the _first_ call. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.cards.create({ + customerId: "customer_id", + cardNonce: "YOUR_CARD_NONCE", + billingAddress: { + addressLine1: "500 Electric Ave", + addressLine2: "Suite 600", + locality: "New York", + administrativeDistrictLevel1: "NY", + postalCode: "10003", + country: "US", + }, + cardholderName: "Amelia Earhart", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CreateCustomerCardRequest` + +
+
+ +
+
+ +**requestOptions:** `Cards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.cards.delete({ ...params }) -> Square.DeleteCustomerCardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes a card on file from a customer. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.cards.delete({ + customerId: "customer_id", + cardId: "card_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CardsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Cards.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Customers CustomAttributes + +
client.customers.customAttributes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile. + +You can use the `with_definitions` query parameter to also retrieve custom attribute definitions +in the same call. + +When all response pages are retrieved, the results include all custom attributes that are +visible to the requesting application, including those that are owned by other applications +and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.customers.customAttributes.list({ + customerId: "customer_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.customers.customAttributes.list({ + customerId: "customer_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CustomAttributesListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.customAttributes.get({ ...params }) -> Square.GetCustomerCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a [custom attribute](entity:CustomAttribute) associated with a customer profile. + +You can use the `with_definition` query parameter to also retrieve the custom attribute definition +in the same call. + +To retrieve a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.customAttributes.get({ + customerId: "customer_id", + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CustomAttributesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.customAttributes.upsert({ ...params }) -> Square.UpsertCustomerCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates a [custom attribute](entity:CustomAttribute) for a customer profile. + +Use this endpoint to set the value of a custom attribute for a specified customer profile. +A custom attribute is based on a custom attribute definition in a Square seller account, which +is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint. + +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.customAttributes.upsert({ + customerId: "customer_id", + key: "key", + customAttribute: { + value: "Dune", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.UpsertCustomerCustomAttributeRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customers.customAttributes.delete({ ...params }) -> Square.DeleteCustomerCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile. + +To delete a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customers.customAttributes.delete({ + customerId: "customer_id", + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.customers.CustomAttributesDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Devices Codes + +
client.devices.codes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all DeviceCodes associated with the merchant. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.devices.codes.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.devices.codes.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.devices.CodesListRequest` + +
+
+ +
+
+ +**requestOptions:** `Codes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.devices.codes.create({ ...params }) -> Square.CreateDeviceCodeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected +terminal mode. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.devices.codes.create({ + idempotencyKey: "01bb00a6-0c86-4770-94ed-f5fca973cd56", + deviceCode: { + name: "Counter 1", + productType: "TERMINAL_API", + locationId: "B5E4484SHHNYH", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.devices.CreateDeviceCodeRequest` + +
+
+ +
+
+ +**requestOptions:** `Codes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.devices.codes.get({ ...params }) -> Square.GetDeviceCodeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves DeviceCode with the associated ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.devices.codes.get({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.devices.CodesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Codes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Disputes Evidence + +
client.disputes.evidence.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of evidence associated with a dispute. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.disputes.evidence.list({ + disputeId: "dispute_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.disputes.evidence.list({ + disputeId: "dispute_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.disputes.EvidenceListRequest` + +
+
+ +
+
+ +**requestOptions:** `Evidence.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.disputes.evidence.get({ ...params }) -> Square.GetDisputeEvidenceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the metadata for the evidence specified in the request URL path. + +You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.disputes.evidence.get({ + disputeId: "dispute_id", + evidenceId: "evidence_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.disputes.EvidenceGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Evidence.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.disputes.evidence.delete({ ...params }) -> Square.DeleteDisputeEvidenceResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes specified evidence from a dispute. +Square does not send the bank any evidence that is removed. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.disputes.evidence.delete({ + disputeId: "dispute_id", + evidenceId: "evidence_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.disputes.EvidenceDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Evidence.RequestOptions` + +
+
+
+
+ +
+
+
+ +## GiftCards Activities + +
client.giftCards.activities.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists gift card activities. By default, you get gift card activities for all +gift cards in the seller's account. You can optionally specify query parameters to +filter the list. For example, you can get a list of gift card activities for a gift card, +for all gift cards in a specific region, or for activities within a time window. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.giftCards.activities.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.giftCards.activities.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.giftCards.ActivitiesListRequest` + +
+
+ +
+
+ +**requestOptions:** `Activities.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.giftCards.activities.create({ ...params }) -> Square.CreateGiftCardActivityResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a gift card activity to manage the balance or state of a [gift card](entity:GiftCard). +For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.giftCards.activities.create({ + idempotencyKey: "U16kfr-kA70er-q4Rsym-7U7NnY", + giftCardActivity: { + type: "ACTIVATE", + locationId: "81FN9BNFZTKS4", + giftCardId: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + activateActivityDetails: { + orderId: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + lineItemUid: "eIWl7X0nMuO9Ewbh0ChIx", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.giftCards.CreateGiftCardActivityRequest` + +
+
+ +
+
+ +**requestOptions:** `Activities.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Labor BreakTypes + +
client.labor.breakTypes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of `BreakType` instances for a business. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.labor.breakTypes.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.labor.breakTypes.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.BreakTypesListRequest` + +
+
+ +
+
+ +**requestOptions:** `BreakTypes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.breakTypes.create({ ...params }) -> Square.CreateBreakTypeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new `BreakType`. + +A `BreakType` is a template for creating `Break` objects. +You must provide the following values in your request to this +endpoint: + +- `location_id` +- `break_name` +- `expected_duration` +- `is_paid` + +You can only have three `BreakType` instances per location. If you attempt to add a fourth +`BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location." +is returned. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.breakTypes.create({ + idempotencyKey: "PAD3NG5KSN2GL", + breakType: { + locationId: "CGJN03P1D08GF", + breakName: "Lunch Break", + expectedDuration: "PT30M", + isPaid: true, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.CreateBreakTypeRequest` + +
+
+ +
+
+ +**requestOptions:** `BreakTypes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.breakTypes.get({ ...params }) -> Square.GetBreakTypeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a single `BreakType` specified by `id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.breakTypes.get({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.BreakTypesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `BreakTypes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.breakTypes.update({ ...params }) -> Square.UpdateBreakTypeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an existing `BreakType`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.breakTypes.update({ + id: "id", + breakType: { + locationId: "26M7H24AZ9N6R", + breakName: "Lunch", + expectedDuration: "PT50M", + isPaid: true, + version: 1, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.UpdateBreakTypeRequest` + +
+
+ +
+
+ +**requestOptions:** `BreakTypes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.breakTypes.delete({ ...params }) -> Square.DeleteBreakTypeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an existing `BreakType`. + +A `BreakType` can be deleted even if it is referenced from a `Shift`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.breakTypes.delete({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.BreakTypesDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `BreakTypes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Labor EmployeeWages + +
client.labor.employeeWages.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of `EmployeeWage` instances for a business. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.labor.employeeWages.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.labor.employeeWages.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.EmployeeWagesListRequest` + +
+
+ +
+
+ +**requestOptions:** `EmployeeWages.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.employeeWages.get({ ...params }) -> Square.GetEmployeeWageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a single `EmployeeWage` specified by `id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.employeeWages.get({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.EmployeeWagesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `EmployeeWages.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Labor Shifts + +
client.labor.shifts.create({ ...params }) -> Square.CreateShiftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new `Shift`. + +A `Shift` represents a complete workday for a single team member. +You must provide the following values in your request to this +endpoint: + +- `location_id` +- `team_member_id` +- `start_at` + +An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when: + +- The `status` of the new `Shift` is `OPEN` and the team member has another + shift with an `OPEN` status. +- The `start_at` date is in the future. +- The `start_at` or `end_at` date overlaps another shift for the same team member. +- The `Break` instances are set in the request and a break `start_at` +is before the `Shift.start_at`, a break `end_at` is after +the `Shift.end_at`, or both. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.shifts.create({ + idempotencyKey: "HIDSNG5KS478L", + shift: { + locationId: "PAA1RJZZKXBFG", + startAt: "2019-01-25T03:11:00-05:00", + endAt: "2019-01-25T13:11:00-05:00", + wage: { + title: "Barista", + hourlyRate: { + amount: 1100, + currency: "USD", + }, + tipEligible: true, + }, + breaks: [ + { + startAt: "2019-01-25T06:11:00-05:00", + endAt: "2019-01-25T06:16:00-05:00", + breakTypeId: "REGS1EQR1TPZ5", + name: "Tea Break", + expectedDuration: "PT5M", + isPaid: true, + }, + ], + teamMemberId: "ormj0jJJZ5OZIzxrZYJI", + declaredCashTipMoney: { + amount: 500, + currency: "USD", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.CreateShiftRequest` + +
+
+ +
+
+ +**requestOptions:** `Shifts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.shifts.search({ ...params }) -> Square.SearchShiftsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of `Shift` records for a business. +The list to be returned can be filtered by: + +- Location IDs +- Team member IDs +- Shift status (`OPEN` or `CLOSED`) +- Shift start +- Shift end +- Workday details + +The list can be sorted by: + +- `START_AT` +- `END_AT` +- `CREATED_AT` +- `UPDATED_AT` +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.shifts.search({ + query: { + filter: { + workday: { + dateRange: { + startDate: "2019-01-20", + endDate: "2019-02-03", + }, + matchShiftsBy: "START_AT", + defaultTimezone: "America/Los_Angeles", + }, + }, + }, + limit: 100, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.SearchShiftsRequest` + +
+
+ +
+
+ +**requestOptions:** `Shifts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.shifts.get({ ...params }) -> Square.GetShiftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a single `Shift` specified by `id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.shifts.get({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.ShiftsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Shifts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.shifts.update({ ...params }) -> Square.UpdateShiftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an existing `Shift`. + +When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have +the `end_at` property set to a valid RFC-3339 datetime string. + +When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at` +set on each `Break`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.shifts.update({ + id: "id", + shift: { + locationId: "PAA1RJZZKXBFG", + startAt: "2019-01-25T03:11:00-05:00", + endAt: "2019-01-25T13:11:00-05:00", + wage: { + title: "Bartender", + hourlyRate: { + amount: 1500, + currency: "USD", + }, + tipEligible: true, + }, + breaks: [ + { + id: "X7GAQYVVRRG6P", + startAt: "2019-01-25T06:11:00-05:00", + endAt: "2019-01-25T06:16:00-05:00", + breakTypeId: "REGS1EQR1TPZ5", + name: "Tea Break", + expectedDuration: "PT5M", + isPaid: true, + }, + ], + version: 1, + teamMemberId: "ormj0jJJZ5OZIzxrZYJI", + declaredCashTipMoney: { + amount: 500, + currency: "USD", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.UpdateShiftRequest` + +
+
+ +
+
+ +**requestOptions:** `Shifts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.shifts.delete({ ...params }) -> Square.DeleteShiftResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a `Shift`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.shifts.delete({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.ShiftsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Shifts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Labor TeamMemberWages + +
client.labor.teamMemberWages.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of `TeamMemberWage` instances for a business. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.labor.teamMemberWages.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.labor.teamMemberWages.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.TeamMemberWagesListRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMemberWages.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.teamMemberWages.get({ ...params }) -> Square.GetTeamMemberWageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a single `TeamMemberWage` specified by `id`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.teamMemberWages.get({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.TeamMemberWagesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `TeamMemberWages.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Labor WorkweekConfigs + +
client.labor.workweekConfigs.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of `WorkweekConfig` instances for a business. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.labor.workweekConfigs.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.labor.workweekConfigs.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.WorkweekConfigsListRequest` + +
+
+ +
+
+ +**requestOptions:** `WorkweekConfigs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.labor.workweekConfigs.get({ ...params }) -> Square.UpdateWorkweekConfigResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a `WorkweekConfig`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.labor.workweekConfigs.get({ + id: "id", + workweekConfig: { + startOfWeek: "MON", + startOfDayLocalTime: "10:00", + version: 10, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.labor.UpdateWorkweekConfigRequest` + +
+
+ +
+
+ +**requestOptions:** `WorkweekConfigs.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Locations CustomAttributeDefinitions + +
client.locations.customAttributeDefinitions.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. +When all response pages are retrieved, the results include all custom attribute definitions +that are visible to the requesting application, including those that are created by other +applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.locations.customAttributeDefinitions.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.locations.customAttributeDefinitions.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.CustomAttributeDefinitionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributeDefinitions.create({ ...params }) -> Square.CreateLocationCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. +Use this endpoint to define a custom attribute that can be associated with locations. +A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties +for a custom attribute. After the definition is created, you can call +[UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) or +[BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) +to set the custom attribute for locations. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributeDefinitions.create({ + customAttributeDefinition: { + key: "bestseller", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Bestseller", + description: "Bestselling item at location", + visibility: "VISIBILITY_READ_WRITE_VALUES", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.CreateLocationCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributeDefinitions.get({ ...params }) -> Square.RetrieveLocationCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. +To retrieve a custom attribute definition created by another application, the `visibility` +setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributeDefinitions.get({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.CustomAttributeDefinitionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributeDefinitions.update({ ...params }) -> Square.UpdateLocationCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. +Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the +`schema` for a `Selection` data type. +Only the definition owner can update a custom attribute definition. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributeDefinitions.update({ + key: "key", + customAttributeDefinition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.UpdateLocationCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributeDefinitions.delete({ ...params }) -> Square.DeleteLocationCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. +Deleting a custom attribute definition also deletes the corresponding custom attribute from +all locations. +Only the definition owner can delete a custom attribute definition. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributeDefinitions.delete({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.CustomAttributeDefinitionsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Locations CustomAttributes + +
client.locations.customAttributes.batchDelete({ ...params }) -> Square.BulkDeleteLocationCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation. +To delete a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributes.batchDelete({ + values: { + id1: { + key: "bestseller", + }, + id2: { + key: "bestseller", + }, + id3: { + key: "phone-number", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.BulkDeleteLocationCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributes.batchUpsert({ ...params }) -> Square.BulkUpsertLocationCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates [custom attributes](entity:CustomAttribute) for locations as a bulk operation. +Use this endpoint to set the value of one or more custom attributes for one or more locations. +A custom attribute is based on a custom attribute definition in a Square seller account, which is +created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint. +This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert +requests and returns a map of individual upsert responses. Each upsert request has a unique ID +and provides a location ID and custom attribute. Each upsert response is returned with the ID +of the corresponding request. +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributes.batchUpsert({ + values: { + id1: { + locationId: "L0TBCBTB7P8RQ", + customAttribute: { + key: "bestseller", + value: "hot cocoa", + }, + }, + id2: { + locationId: "L9XMD04V3STJX", + customAttribute: { + key: "bestseller", + value: "berry smoothie", + }, + }, + id3: { + locationId: "L0TBCBTB7P8RQ", + customAttribute: { + key: "phone-number", + value: "+12223334444", + }, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.BulkUpsertLocationCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the [custom attributes](entity:CustomAttribute) associated with a location. +You can use the `with_definitions` query parameter to also retrieve custom attribute definitions +in the same call. +When all response pages are retrieved, the results include all custom attributes that are +visible to the requesting application, including those that are owned by other applications +and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.locations.customAttributes.list({ + locationId: "location_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.locations.customAttributes.list({ + locationId: "location_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.CustomAttributesListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributes.get({ ...params }) -> Square.RetrieveLocationCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a [custom attribute](entity:CustomAttribute) associated with a location. +You can use the `with_definition` query parameter to also retrieve the custom attribute definition +in the same call. +To retrieve a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributes.get({ + locationId: "location_id", + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.CustomAttributesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributes.upsert({ ...params }) -> Square.UpsertLocationCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates a [custom attribute](entity:CustomAttribute) for a location. +Use this endpoint to set the value of a custom attribute for a specified location. +A custom attribute is based on a custom attribute definition in a Square seller account, which +is created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint. +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributes.upsert({ + locationId: "location_id", + key: "key", + customAttribute: { + value: "hot cocoa", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.UpsertLocationCustomAttributeRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.customAttributes.delete({ ...params }) -> Square.DeleteLocationCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a [custom attribute](entity:CustomAttribute) associated with a location. +To delete a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.customAttributes.delete({ + locationId: "location_id", + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.CustomAttributesDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Locations Transactions + +
client.locations.transactions.list({ ...params }) -> Square.ListTransactionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists transactions for a particular location. + +Transactions include payment information from sales and exchanges and refund +information from returns and exchanges. + +Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50 + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.transactions.list({ + locationId: "location_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.TransactionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Transactions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.transactions.get({ ...params }) -> Square.GetTransactionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves details for a single transaction. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.transactions.get({ + locationId: "location_id", + transactionId: "transaction_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.TransactionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Transactions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.transactions.capture({ ...params }) -> Square.CaptureTransactionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) +endpoint with a `delay_capture` value of `true`. + +See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture) +for more information. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.transactions.capture({ + locationId: "location_id", + transactionId: "transaction_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.TransactionsCaptureRequest` + +
+
+ +
+
+ +**requestOptions:** `Transactions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.locations.transactions.void({ ...params }) -> Square.VoidTransactionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) +endpoint with a `delay_capture` value of `true`. + +See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture) +for more information. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.locations.transactions.void({ + locationId: "location_id", + transactionId: "transaction_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.locations.TransactionsVoidRequest` + +
+
+ +
+
+ +**requestOptions:** `Transactions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Loyalty Accounts + +
client.loyalty.accounts.create({ ...params }) -> Square.CreateLoyaltyAccountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.accounts.create({ + loyaltyAccount: { + programId: "d619f755-2d17-41f3-990d-c04ecedd64dd", + mapping: { + phoneNumber: "+14155551234", + }, + }, + idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.CreateLoyaltyAccountRequest` + +
+
+ +
+
+ +**requestOptions:** `Accounts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.accounts.search({ ...params }) -> Square.SearchLoyaltyAccountsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for loyalty accounts in a loyalty program. + +You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty `query` object or omit it entirely. + +Search results are sorted by `created_at` in ascending order. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.accounts.search({ + query: { + mappings: [ + { + phoneNumber: "+14155551234", + }, + ], + }, + limit: 10, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.SearchLoyaltyAccountsRequest` + +
+
+ +
+
+ +**requestOptions:** `Accounts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.accounts.get({ ...params }) -> Square.GetLoyaltyAccountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a loyalty account. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.accounts.get({ + accountId: "account_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.AccountsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Accounts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.accounts.accumulatePoints({ ...params }) -> Square.AccumulateLoyaltyPointsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount). + +- If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order + to compute the points earned from both the base loyalty program and an associated + [loyalty promotion](entity:LoyaltyPromotion). For purchases that qualify for multiple accrual + rules, Square computes points based on the accrual rule that grants the most points. + For purchases that qualify for multiple promotions, Square computes points based on the most + recently created promotion. A purchase must first qualify for program points to be eligible for promotion points. + +- If you are not using the Orders API to manage orders, provide `points` with the number of points to add. +You must first perform a client-side computation of the points earned from the loyalty program and +loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) +to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see +[Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.accounts.accumulatePoints({ + accountId: "account_id", + accumulatePoints: { + orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + }, + idempotencyKey: "58b90739-c3e8-4b11-85f7-e636d48d72cb", + locationId: "P034NEENMD09F", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.AccumulateLoyaltyPointsRequest` + +
+
+ +
+
+ +**requestOptions:** `Accounts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.accounts.adjust({ ...params }) -> Square.AdjustLoyaltyPointsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds points to or subtracts points from a buyer's account. + +Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call +[AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) +to add points when a buyer pays for the purchase. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.accounts.adjust({ + accountId: "account_id", + idempotencyKey: "bc29a517-3dc9-450e-aa76-fae39ee849d1", + adjustPoints: { + points: 10, + reason: "Complimentary points", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.AdjustLoyaltyPointsRequest` + +
+
+ +
+
+ +**requestOptions:** `Accounts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Loyalty Programs + +
client.loyalty.programs.list() -> Square.ListLoyaltyProgramsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of loyalty programs in the seller's account. +Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). + +Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword `main`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.programs.list(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Programs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.programs.get({ ...params }) -> Square.GetLoyaltyProgramResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`. + +Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.programs.get({ + programId: "program_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.ProgramsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Programs.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.programs.calculate({ ...params }) -> Square.CalculateLoyaltyPointsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint +to display the points to the buyer. + +- If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`. + Square reads the order to compute the points earned from the base loyalty program and an associated + [loyalty promotion](entity:LoyaltyPromotion). + +- If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the +purchase amount. Square uses this amount to calculate the points earned from the base loyalty program, +but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode` +setting of the accrual rule indicates how taxes should be treated for loyalty points accrual. +If the purchase qualifies for program points, call +[ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) and perform a client-side computation +to calculate whether the purchase also qualifies for promotion points. For more information, see +[Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.programs.calculate({ + programId: "program_id", + orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + loyaltyAccountId: "79b807d2-d786-46a9-933b-918028d7a8c5", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.CalculateLoyaltyPointsRequest` + +
+
+ +
+
+ +**requestOptions:** `Programs.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Loyalty Rewards + +
client.loyalty.rewards.create({ ...params }) -> Square.CreateLoyaltyRewardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a loyalty reward. In the process, the endpoint does following: + +- Uses the `reward_tier_id` in the request to determine the number of points + to lock for this reward. +- If the request includes `order_id`, it adds the reward and related discount to the order. + +After a reward is created, the points are locked and +not available for the buyer to redeem another reward. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.rewards.create({ + reward: { + loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + }, + idempotencyKey: "18c2e5ea-a620-4b1f-ad60-7b167285e451", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.CreateLoyaltyRewardRequest` + +
+
+ +
+
+ +**requestOptions:** `Rewards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.rewards.search({ ...params }) -> Square.SearchLoyaltyRewardsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. +If you include a `query` object, `loyalty_account_id` is required and `status` is optional. + +If you know a reward ID, use the +[RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint. + +Search results are sorted by `updated_at` in descending order. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.rewards.search({ + query: { + loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + }, + limit: 10, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.SearchLoyaltyRewardsRequest` + +
+
+ +
+
+ +**requestOptions:** `Rewards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.rewards.get({ ...params }) -> Square.GetLoyaltyRewardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a loyalty reward. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.rewards.get({ + rewardId: "reward_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.RewardsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Rewards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.rewards.delete({ ...params }) -> Square.DeleteLoyaltyRewardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a loyalty reward by doing the following: + +- Returns the loyalty points back to the loyalty account. +- If an order ID was specified when the reward was created + (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)), + it updates the order by removing the reward and related + discounts. + +You cannot delete a reward that has reached the terminal state (REDEEMED). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.rewards.delete({ + rewardId: "reward_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.RewardsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Rewards.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.rewards.redeem({ ...params }) -> Square.RedeemLoyaltyRewardResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Redeems a loyalty reward. + +The endpoint sets the reward to the `REDEEMED` terminal state. + +If you are using your own order processing system (not using the +Orders API), you call this endpoint after the buyer paid for the +purchase. + +After the reward reaches the terminal state, it cannot be deleted. +In other words, points used for the reward cannot be returned +to the account. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.rewards.redeem({ + rewardId: "reward_id", + idempotencyKey: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", + locationId: "P034NEENMD09F", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.RedeemLoyaltyRewardRequest` + +
+
+ +
+
+ +**requestOptions:** `Rewards.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Loyalty Programs Promotions + +
client.loyalty.programs.promotions.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram). +Results are sorted by the `created_at` date in descending order (newest to oldest). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.loyalty.programs.promotions.list({ + programId: "program_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.loyalty.programs.promotions.list({ + programId: "program_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.programs.PromotionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Promotions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.programs.promotions.create({ ...params }) -> Square.CreateLoyaltyPromotionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion +enables buyers to earn points in addition to those earned from the base loyalty program. + +This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the +`available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an +`ACTIVE` or `SCHEDULED` status. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.programs.promotions.create({ + programId: "program_id", + loyaltyPromotion: { + name: "Tuesday Happy Hour Promo", + incentive: { + type: "POINTS_MULTIPLIER", + pointsMultiplierData: { + multiplier: "3.0", + }, + }, + availableTime: { + timePeriods: [ + "BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT", + ], + }, + triggerLimit: { + times: 1, + interval: "DAY", + }, + minimumSpendAmountMoney: { + amount: 2000, + currency: "USD", + }, + qualifyingCategoryIds: ["XTQPYLR3IIU9C44VRCB3XD12"], + }, + idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.programs.CreateLoyaltyPromotionRequest` + +
+
+ +
+
+ +**requestOptions:** `Promotions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.programs.promotions.get({ ...params }) -> Square.GetLoyaltyPromotionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a loyalty promotion. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.programs.promotions.get({ + promotionId: "promotion_id", + programId: "program_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.programs.PromotionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Promotions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.loyalty.programs.promotions.cancel({ ...params }) -> Square.CancelLoyaltyPromotionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the +end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion. +Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before +you create a new one. + +This endpoint sets the loyalty promotion to the `CANCELED` state + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.loyalty.programs.promotions.cancel({ + promotionId: "promotion_id", + programId: "program_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.loyalty.programs.PromotionsCancelRequest` + +
+
+ +
+
+ +**requestOptions:** `Promotions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Merchants CustomAttributeDefinitions + +
client.merchants.customAttributeDefinitions.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. +When all response pages are retrieved, the results include all custom attribute definitions +that are visible to the requesting application, including those that are created by other +applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.merchants.customAttributeDefinitions.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.merchants.customAttributeDefinitions.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.CustomAttributeDefinitionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributeDefinitions.create({ ...params }) -> Square.CreateMerchantCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. +Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application. +A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties +for a custom attribute. After the definition is created, you can call +[UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) or +[BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) +to set the custom attribute for a merchant. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributeDefinitions.create({ + customAttributeDefinition: { + key: "alternative_seller_name", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String", + }, + name: "Alternative Merchant Name", + description: "This is the other name this merchant goes by.", + visibility: "VISIBILITY_READ_ONLY", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.CreateMerchantCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributeDefinitions.get({ ...params }) -> Square.RetrieveMerchantCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. +To retrieve a custom attribute definition created by another application, the `visibility` +setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributeDefinitions.get({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.CustomAttributeDefinitionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributeDefinitions.update({ ...params }) -> Square.UpdateMerchantCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. +Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the +`schema` for a `Selection` data type. +Only the definition owner can update a custom attribute definition. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributeDefinitions.update({ + key: "key", + customAttributeDefinition: { + description: "Update the description as desired.", + visibility: "VISIBILITY_READ_ONLY", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.UpdateMerchantCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributeDefinitions.delete({ ...params }) -> Square.DeleteMerchantCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. +Deleting a custom attribute definition also deletes the corresponding custom attribute from +the merchant. +Only the definition owner can delete a custom attribute definition. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributeDefinitions.delete({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.CustomAttributeDefinitionsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Merchants CustomAttributes + +
client.merchants.customAttributes.batchDelete({ ...params }) -> Square.BulkDeleteMerchantCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. +To delete a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributes.batchDelete({ + values: { + id1: { + key: "alternative_seller_name", + }, + id2: { + key: "has_seen_tutorial", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.BulkDeleteMerchantCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributes.batchUpsert({ ...params }) -> Square.BulkUpsertMerchantCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. +Use this endpoint to set the value of one or more custom attributes for a merchant. +A custom attribute is based on a custom attribute definition in a Square seller account, which is +created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint. +This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert +requests and returns a map of individual upsert responses. Each upsert request has a unique ID +and provides a merchant ID and custom attribute. Each upsert response is returned with the ID +of the corresponding request. +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributes.batchUpsert({ + values: { + id1: { + merchantId: "DM7VKY8Q63GNP", + customAttribute: { + key: "alternative_seller_name", + value: "Ultimate Sneaker Store", + }, + }, + id2: { + merchantId: "DM7VKY8Q63GNP", + customAttribute: { + key: "has_seen_tutorial", + value: true, + }, + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.BulkUpsertMerchantCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the [custom attributes](entity:CustomAttribute) associated with a merchant. +You can use the `with_definitions` query parameter to also retrieve custom attribute definitions +in the same call. +When all response pages are retrieved, the results include all custom attributes that are +visible to the requesting application, including those that are owned by other applications +and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.merchants.customAttributes.list({ + merchantId: "merchant_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.merchants.customAttributes.list({ + merchantId: "merchant_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.CustomAttributesListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributes.get({ ...params }) -> Square.RetrieveMerchantCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a [custom attribute](entity:CustomAttribute) associated with a merchant. +You can use the `with_definition` query parameter to also retrieve the custom attribute definition +in the same call. +To retrieve a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributes.get({ + merchantId: "merchant_id", + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.CustomAttributesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributes.upsert({ ...params }) -> Square.UpsertMerchantCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates a [custom attribute](entity:CustomAttribute) for a merchant. +Use this endpoint to set the value of a custom attribute for a specified merchant. +A custom attribute is based on a custom attribute definition in a Square seller account, which +is created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint. +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributes.upsert({ + merchantId: "merchant_id", + key: "key", + customAttribute: { + value: "Ultimate Sneaker Store", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.UpsertMerchantCustomAttributeRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.merchants.customAttributes.delete({ ...params }) -> Square.DeleteMerchantCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a [custom attribute](entity:CustomAttribute) associated with a merchant. +To delete a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.merchants.customAttributes.delete({ + merchantId: "merchant_id", + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.merchants.CustomAttributesDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Orders CustomAttributeDefinitions + +
client.orders.customAttributeDefinitions.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + +When all response pages are retrieved, the results include all custom attribute definitions +that are visible to the requesting application, including those that are created by other +applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that +seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.orders.customAttributeDefinitions.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.orders.customAttributeDefinitions.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.CustomAttributeDefinitionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributeDefinitions.create({ ...params }) -> Square.CreateOrderCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates an order-related custom attribute definition. Use this endpoint to +define a custom attribute that can be associated with orders. + +After creating a custom attribute definition, you can set the custom attribute for orders +in the Square seller account. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributeDefinitions.create({ + customAttributeDefinition: { + key: "cover-count", + schema: { + ref: "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number", + }, + name: "Cover count", + description: "The number of people seated at a table", + visibility: "VISIBILITY_READ_WRITE_VALUES", + }, + idempotencyKey: "IDEMPOTENCY_KEY", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.CreateOrderCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributeDefinitions.get({ ...params }) -> Square.RetrieveOrderCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + +To retrieve a custom attribute definition created by another application, the `visibility` +setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributeDefinitions.get({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.CustomAttributeDefinitionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributeDefinitions.update({ ...params }) -> Square.UpdateOrderCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an order-related custom attribute definition for a Square seller account. + +Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributeDefinitions.update({ + key: "key", + customAttributeDefinition: { + key: "cover-count", + visibility: "VISIBILITY_READ_ONLY", + version: 1, + }, + idempotencyKey: "IDEMPOTENCY_KEY", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.UpdateOrderCustomAttributeDefinitionRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributeDefinitions.delete({ ...params }) -> Square.DeleteOrderCustomAttributeDefinitionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + +Only the definition owner can delete a custom attribute definition. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributeDefinitions.delete({ + key: "key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.CustomAttributeDefinitionsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributeDefinitions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Orders CustomAttributes + +
client.orders.customAttributes.batchDelete({ ...params }) -> Square.BulkDeleteOrderCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation. + +Use this endpoint to delete one or more custom attributes from one or more orders. +A custom attribute is based on a custom attribute definition in a Square seller account. (To create a +custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + +This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete +requests and returns a map of individual delete responses. Each delete request has a unique ID +and provides an order ID and custom attribute. Each delete response is returned with the ID +of the corresponding request. + +To delete a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributes.batchDelete({ + values: { + "cover-count": { + key: "cover-count", + orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + "table-number": { + key: "table-number", + orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.BulkDeleteOrderCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributes.batchUpsert({ ...params }) -> Square.BulkUpsertOrderCustomAttributesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates order [custom attributes](entity:CustomAttribute) as a bulk operation. + +Use this endpoint to delete one or more custom attributes from one or more orders. +A custom attribute is based on a custom attribute definition in a Square seller account. (To create a +custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + +This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert +requests and returns a map of individual upsert responses. Each upsert request has a unique ID +and provides an order ID and custom attribute. Each upsert response is returned with the ID +of the corresponding request. + +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributes.batchUpsert({ + values: { + "cover-count": { + customAttribute: { + key: "cover-count", + value: "6", + version: 2, + }, + orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + "table-number": { + customAttribute: { + key: "table-number", + value: "11", + version: 4, + }, + orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.BulkUpsertOrderCustomAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the [custom attributes](entity:CustomAttribute) associated with an order. + +You can use the `with_definitions` query parameter to also retrieve custom attribute definitions +in the same call. + +When all response pages are retrieved, the results include all custom attributes that are +visible to the requesting application, including those that are owned by other applications +and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.orders.customAttributes.list({ + orderId: "order_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.orders.customAttributes.list({ + orderId: "order_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.CustomAttributesListRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributes.get({ ...params }) -> Square.RetrieveOrderCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a [custom attribute](entity:CustomAttribute) associated with an order. + +You can use the `with_definition` query parameter to also retrieve the custom attribute definition +in the same call. + +To retrieve a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributes.get({ + orderId: "order_id", + customAttributeKey: "custom_attribute_key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.CustomAttributesGetRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributes.upsert({ ...params }) -> Square.UpsertOrderCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates a [custom attribute](entity:CustomAttribute) for an order. + +Use this endpoint to set the value of a custom attribute for a specific order. +A custom attribute is based on a custom attribute definition in a Square seller account. (To create a +custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + +To create or update a custom attribute owned by another application, the `visibility` setting +must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributes.upsert({ + orderId: "order_id", + customAttributeKey: "custom_attribute_key", + customAttribute: { + key: "table-number", + value: "42", + version: 1, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.UpsertOrderCustomAttributeRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.orders.customAttributes.delete({ ...params }) -> Square.DeleteOrderCustomAttributeResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile. + +To delete a custom attribute owned by another application, the `visibility` setting must be +`VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes +(also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.orders.customAttributes.delete({ + orderId: "order_id", + customAttributeKey: "custom_attribute_key", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.orders.CustomAttributesDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## TeamMembers WageSetting + +
client.teamMembers.wageSetting.get({ ...params }) -> Square.GetWageSettingResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a `WageSetting` object for a team member specified +by `TeamMember.id`. For more information, see +[Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrievewagesetting). + +Square recommends using [RetrieveTeamMember](api-endpoint:Team-RetrieveTeamMember) or [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) +to get this information directly from the `TeamMember.wage_setting` field. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.wageSetting.get({ + teamMemberId: "team_member_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.teamMembers.WageSettingGetRequest` + +
+
+ +
+
+ +**requestOptions:** `WageSetting.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.teamMembers.wageSetting.update({ ...params }) -> Square.UpdateWageSettingResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates or updates a `WageSetting` object. The object is created if a +`WageSetting` with the specified `team_member_id` doesn't exist. Otherwise, +it fully replaces the `WageSetting` object for the team member. +The `WageSetting` is returned on a successful update. For more information, see +[Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting). + +Square recommends using [CreateTeamMember](api-endpoint:Team-CreateTeamMember) or [UpdateTeamMember](api-endpoint:Team-UpdateTeamMember) +to manage the `TeamMember.wage_setting` field directly. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teamMembers.wageSetting.update({ + teamMemberId: "team_member_id", + wageSetting: { + jobAssignments: [ + { + jobTitle: "Manager", + payType: "SALARY", + annualRate: { + amount: 3000000, + currency: "USD", + }, + weeklyHours: 40, + }, + { + jobTitle: "Cashier", + payType: "HOURLY", + hourlyRate: { + amount: 2000, + currency: "USD", + }, + }, + ], + isOvertimeExempt: true, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.teamMembers.UpdateWageSettingRequest` + +
+
+ +
+
+ +**requestOptions:** `WageSetting.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Terminal Actions + +
client.terminal.actions.create({ ...params }) -> Square.CreateTerminalActionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a Terminal action request and sends it to the specified device. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.actions.create({ + idempotencyKey: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", + action: { + deviceId: "{{DEVICE_ID}}", + deadlineDuration: "PT5M", + type: "SAVE_CARD", + saveCardOptions: { + customerId: "{{CUSTOMER_ID}}", + referenceId: "user-id-1", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.CreateTerminalActionRequest` + +
+
+ +
+
+ +**requestOptions:** `Actions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.actions.search({ ...params }) -> Square.SearchTerminalActionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.actions.search({ + query: { + filter: { + createdAt: { + startAt: "2022-04-01T00:00:00.000Z", + }, + }, + sort: { + sortOrder: "DESC", + }, + }, + limit: 2, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.SearchTerminalActionsRequest` + +
+
+ +
+
+ +**requestOptions:** `Actions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.actions.get({ ...params }) -> Square.GetTerminalActionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.actions.get({ + actionId: "action_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.ActionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Actions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.actions.cancel({ ...params }) -> Square.CancelTerminalActionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels a Terminal action request if the status of the request permits it. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.actions.cancel({ + actionId: "action_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.ActionsCancelRequest` + +
+
+ +
+
+ +**requestOptions:** `Actions.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Terminal Checkouts + +
client.terminal.checkouts.create({ ...params }) -> Square.CreateTerminalCheckoutResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a Terminal checkout request and sends it to the specified device to take a payment +for the requested amount. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.checkouts.create({ + idempotencyKey: "28a0c3bc-7839-11ea-bc55-0242ac130003", + checkout: { + amountMoney: { + amount: 2610, + currency: "USD", + }, + referenceId: "id11572", + note: "A brief note", + deviceOptions: { + deviceId: "dbb5d83a-7838-11ea-bc55-0242ac130003", + }, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.CreateTerminalCheckoutRequest` + +
+
+ +
+
+ +**requestOptions:** `Checkouts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.checkouts.search({ ...params }) -> Square.SearchTerminalCheckoutsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.checkouts.search({ + query: { + filter: { + status: "COMPLETED", + }, + }, + limit: 2, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.SearchTerminalCheckoutsRequest` + +
+
+ +
+
+ +**requestOptions:** `Checkouts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.checkouts.get({ ...params }) -> Square.GetTerminalCheckoutResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.checkouts.get({ + checkoutId: "checkout_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.CheckoutsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Checkouts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.checkouts.cancel({ ...params }) -> Square.CancelTerminalCheckoutResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels a Terminal checkout request if the status of the request permits it. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.checkouts.cancel({ + checkoutId: "checkout_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.CheckoutsCancelRequest` + +
+
+ +
+
+ +**requestOptions:** `Checkouts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Terminal Refunds + +
client.terminal.refunds.create({ ...params }) -> Square.CreateTerminalRefundResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](api:Refunds). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.refunds.create({ + idempotencyKey: "402a640b-b26f-401f-b406-46f839590c04", + refund: { + paymentId: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + amountMoney: { + amount: 111, + currency: "CAD", + }, + reason: "Returning items", + deviceId: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.CreateTerminalRefundRequest` + +
+
+ +
+
+ +**requestOptions:** `Refunds.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.refunds.search({ ...params }) -> Square.SearchTerminalRefundsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.refunds.search({ + query: { + filter: { + status: "COMPLETED", + }, + }, + limit: 1, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.SearchTerminalRefundsRequest` + +
+
+ +
+
+ +**requestOptions:** `Refunds.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.refunds.get({ ...params }) -> Square.GetTerminalRefundResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.refunds.get({ + terminalRefundId: "terminal_refund_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.RefundsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Refunds.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.terminal.refunds.cancel({ ...params }) -> Square.CancelTerminalRefundResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.terminal.refunds.cancel({ + terminalRefundId: "terminal_refund_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.terminal.RefundsCancelRequest` + +
+
+ +
+
+ +**requestOptions:** `Refunds.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Webhooks EventTypes + +
client.webhooks.eventTypes.list({ ...params }) -> Square.ListWebhookEventTypesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all webhook event types that can be subscribed to. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.eventTypes.list(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.webhooks.EventTypesListRequest` + +
+
+ +
+
+ +**requestOptions:** `EventTypes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Webhooks Subscriptions + +
client.webhooks.subscriptions.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all webhook subscriptions owned by your application. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.webhooks.subscriptions.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.webhooks.subscriptions.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.webhooks.SubscriptionsListRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.subscriptions.create({ ...params }) -> Square.CreateWebhookSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a webhook subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.subscriptions.create({ + idempotencyKey: "63f84c6c-2200-4c99-846c-2670a1311fbf", + subscription: { + name: "Example Webhook Subscription", + eventTypes: ["payment.created", "payment.updated"], + notificationUrl: "https://example-webhook-url.com", + apiVersion: "2021-12-15", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.webhooks.CreateWebhookSubscriptionRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.subscriptions.get({ ...params }) -> Square.GetWebhookSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a webhook subscription identified by its ID. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.subscriptions.get({ + subscriptionId: "subscription_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.webhooks.SubscriptionsGetRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.subscriptions.update({ ...params }) -> Square.UpdateWebhookSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a webhook subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.subscriptions.update({ + subscriptionId: "subscription_id", + subscription: { + name: "Updated Example Webhook Subscription", + enabled: false, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.webhooks.UpdateWebhookSubscriptionRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.subscriptions.delete({ ...params }) -> Square.DeleteWebhookSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a webhook subscription. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.subscriptions.delete({ + subscriptionId: "subscription_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.webhooks.SubscriptionsDeleteRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.subscriptions.updateSignatureKey({ ...params }) -> Square.UpdateWebhookSubscriptionSignatureKeyResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a webhook subscription by replacing the existing signature key with a new one. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.subscriptions.updateSignatureKey({ + subscriptionId: "subscription_id", + idempotencyKey: "ed80ae6b-0654-473b-bbab-a39aee89a60d", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.webhooks.UpdateWebhookSubscriptionSignatureKeyRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.webhooks.subscriptions.test({ ...params }) -> Square.TestWebhookSubscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Tests a webhook subscription by sending a test event to the notification URL. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.webhooks.subscriptions.test({ + subscriptionId: "subscription_id", + eventType: "payment.created", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Square.webhooks.TestWebhookSubscriptionRequest` + +
+
+ +
+
+ +**requestOptions:** `Subscriptions.RequestOptions` + +
+
+
+
+ +
+
+
diff --git a/scripts/rename-to-esm-files.js b/scripts/rename-to-esm-files.js new file mode 100644 index 000000000..81dac6a75 --- /dev/null +++ b/scripts/rename-to-esm-files.js @@ -0,0 +1,115 @@ +#!/usr/bin/env node + +const fs = require("fs").promises; +const path = require("path"); + +const extensionMap = { + ".js": ".mjs", + ".d.ts": ".d.mts", +}; +const oldExtensions = Object.keys(extensionMap); + +async function findFiles(rootPath) { + const files = []; + + async function scan(directory) { + const entries = await fs.readdir(directory, { withFileTypes: true }); + + for (const entry of entries) { + const fullPath = path.join(directory, entry.name); + + if (entry.isDirectory()) { + if (entry.name !== "node_modules" && !entry.name.startsWith(".")) { + await scan(fullPath); + } + } else if (entry.isFile()) { + if (oldExtensions.some((ext) => entry.name.endsWith(ext))) { + files.push(fullPath); + } + } + } + } + + await scan(rootPath); + return files; +} + +async function updateFiles(files) { + const updatedFiles = []; + for (const file of files) { + const updated = await updateFileContents(file); + updatedFiles.push(updated); + } + + console.log(`Updated imports in ${updatedFiles.length} files.`); +} + +async function updateFileContents(file) { + const content = await fs.readFile(file, "utf8"); + + let newContent = content; + // Update each extension type defined in the map + for (const [oldExt, newExt] of Object.entries(extensionMap)) { + const regex = new RegExp(`(import|export)(.+from\\s+['"])(\\.\\.?\\/[^'"]+)(\\${oldExt})(['"])`, "g"); + newContent = newContent.replace(regex, `$1$2$3${newExt}$5`); + } + + if (content !== newContent) { + await fs.writeFile(file, newContent, "utf8"); + return true; + } + return false; +} + +async function renameFiles(files) { + let counter = 0; + for (const file of files) { + const ext = oldExtensions.find((ext) => file.endsWith(ext)); + const newExt = extensionMap[ext]; + + if (newExt) { + const newPath = file.slice(0, -ext.length) + newExt; + await fs.rename(file, newPath); + counter++; + } + } + + console.log(`Renamed ${counter} files.`); +} + +async function main() { + try { + const targetDir = process.argv[2]; + if (!targetDir) { + console.error("Please provide a target directory"); + process.exit(1); + } + + const targetPath = path.resolve(targetDir); + const targetStats = await fs.stat(targetPath); + + if (!targetStats.isDirectory()) { + console.error("The provided path is not a directory"); + process.exit(1); + } + + console.log(`Scanning directory: ${targetDir}`); + + const files = await findFiles(targetDir); + + if (files.length === 0) { + console.log("No matching files found."); + process.exit(0); + } + + console.log(`Found ${files.length} files.`); + await updateFiles(files); + await renameFiles(files); + console.log("\nDone!"); + } catch (error) { + console.error("An error occurred:", error.message); + process.exit(1); + } +} + +main(); diff --git a/src/Client.ts b/src/Client.ts new file mode 100644 index 000000000..c3bdd20ca --- /dev/null +++ b/src/Client.ts @@ -0,0 +1,240 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "./environments"; +import * as core from "./core"; +import { Mobile } from "./api/resources/mobile/client/Client"; +import { OAuth } from "./api/resources/oAuth/client/Client"; +import { V1Transactions } from "./api/resources/v1Transactions/client/Client"; +import { ApplePay } from "./api/resources/applePay/client/Client"; +import { BankAccounts } from "./api/resources/bankAccounts/client/Client"; +import { Bookings } from "./api/resources/bookings/client/Client"; +import { Cards } from "./api/resources/cards/client/Client"; +import { Catalog } from "./api/resources/catalog/client/Client"; +import { Customers } from "./api/resources/customers/client/Client"; +import { Devices } from "./api/resources/devices/client/Client"; +import { Disputes } from "./api/resources/disputes/client/Client"; +import { Employees } from "./api/resources/employees/client/Client"; +import { Events } from "./api/resources/events/client/Client"; +import { GiftCards } from "./api/resources/giftCards/client/Client"; +import { Inventory } from "./api/resources/inventory/client/Client"; +import { Invoices } from "./api/resources/invoices/client/Client"; +import { Locations } from "./api/resources/locations/client/Client"; +import { Loyalty } from "./api/resources/loyalty/client/Client"; +import { Merchants } from "./api/resources/merchants/client/Client"; +import { Checkout } from "./api/resources/checkout/client/Client"; +import { Orders } from "./api/resources/orders/client/Client"; +import { Payments } from "./api/resources/payments/client/Client"; +import { Payouts } from "./api/resources/payouts/client/Client"; +import { Refunds } from "./api/resources/refunds/client/Client"; +import { Sites } from "./api/resources/sites/client/Client"; +import { Snippets } from "./api/resources/snippets/client/Client"; +import { Subscriptions } from "./api/resources/subscriptions/client/Client"; +import { TeamMembers } from "./api/resources/teamMembers/client/Client"; +import { Team } from "./api/resources/team/client/Client"; +import { Terminal } from "./api/resources/terminal/client/Client"; +import { Vendors } from "./api/resources/vendors/client/Client"; +import { CashDrawers } from "./api/resources/cashDrawers/client/Client"; +import { Labor } from "./api/resources/labor/client/Client"; +import { Webhooks } from "./api/resources/webhooks/client/Client"; + +export declare namespace SquareClient { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class SquareClient { + protected _mobile: Mobile | undefined; + protected _oAuth: OAuth | undefined; + protected _v1Transactions: V1Transactions | undefined; + protected _applePay: ApplePay | undefined; + protected _bankAccounts: BankAccounts | undefined; + protected _bookings: Bookings | undefined; + protected _cards: Cards | undefined; + protected _catalog: Catalog | undefined; + protected _customers: Customers | undefined; + protected _devices: Devices | undefined; + protected _disputes: Disputes | undefined; + protected _employees: Employees | undefined; + protected _events: Events | undefined; + protected _giftCards: GiftCards | undefined; + protected _inventory: Inventory | undefined; + protected _invoices: Invoices | undefined; + protected _locations: Locations | undefined; + protected _loyalty: Loyalty | undefined; + protected _merchants: Merchants | undefined; + protected _checkout: Checkout | undefined; + protected _orders: Orders | undefined; + protected _payments: Payments | undefined; + protected _payouts: Payouts | undefined; + protected _refunds: Refunds | undefined; + protected _sites: Sites | undefined; + protected _snippets: Snippets | undefined; + protected _subscriptions: Subscriptions | undefined; + protected _teamMembers: TeamMembers | undefined; + protected _team: Team | undefined; + protected _terminal: Terminal | undefined; + protected _vendors: Vendors | undefined; + protected _cashDrawers: CashDrawers | undefined; + protected _labor: Labor | undefined; + protected _webhooks: Webhooks | undefined; + + constructor(protected readonly _options: SquareClient.Options = {}) {} + + public get mobile(): Mobile { + return (this._mobile ??= new Mobile(this._options)); + } + + public get oAuth(): OAuth { + return (this._oAuth ??= new OAuth(this._options)); + } + + public get v1Transactions(): V1Transactions { + return (this._v1Transactions ??= new V1Transactions(this._options)); + } + + public get applePay(): ApplePay { + return (this._applePay ??= new ApplePay(this._options)); + } + + public get bankAccounts(): BankAccounts { + return (this._bankAccounts ??= new BankAccounts(this._options)); + } + + public get bookings(): Bookings { + return (this._bookings ??= new Bookings(this._options)); + } + + public get cards(): Cards { + return (this._cards ??= new Cards(this._options)); + } + + public get catalog(): Catalog { + return (this._catalog ??= new Catalog(this._options)); + } + + public get customers(): Customers { + return (this._customers ??= new Customers(this._options)); + } + + public get devices(): Devices { + return (this._devices ??= new Devices(this._options)); + } + + public get disputes(): Disputes { + return (this._disputes ??= new Disputes(this._options)); + } + + public get employees(): Employees { + return (this._employees ??= new Employees(this._options)); + } + + public get events(): Events { + return (this._events ??= new Events(this._options)); + } + + public get giftCards(): GiftCards { + return (this._giftCards ??= new GiftCards(this._options)); + } + + public get inventory(): Inventory { + return (this._inventory ??= new Inventory(this._options)); + } + + public get invoices(): Invoices { + return (this._invoices ??= new Invoices(this._options)); + } + + public get locations(): Locations { + return (this._locations ??= new Locations(this._options)); + } + + public get loyalty(): Loyalty { + return (this._loyalty ??= new Loyalty(this._options)); + } + + public get merchants(): Merchants { + return (this._merchants ??= new Merchants(this._options)); + } + + public get checkout(): Checkout { + return (this._checkout ??= new Checkout(this._options)); + } + + public get orders(): Orders { + return (this._orders ??= new Orders(this._options)); + } + + public get payments(): Payments { + return (this._payments ??= new Payments(this._options)); + } + + public get payouts(): Payouts { + return (this._payouts ??= new Payouts(this._options)); + } + + public get refunds(): Refunds { + return (this._refunds ??= new Refunds(this._options)); + } + + public get sites(): Sites { + return (this._sites ??= new Sites(this._options)); + } + + public get snippets(): Snippets { + return (this._snippets ??= new Snippets(this._options)); + } + + public get subscriptions(): Subscriptions { + return (this._subscriptions ??= new Subscriptions(this._options)); + } + + public get teamMembers(): TeamMembers { + return (this._teamMembers ??= new TeamMembers(this._options)); + } + + public get team(): Team { + return (this._team ??= new Team(this._options)); + } + + public get terminal(): Terminal { + return (this._terminal ??= new Terminal(this._options)); + } + + public get vendors(): Vendors { + return (this._vendors ??= new Vendors(this._options)); + } + + public get cashDrawers(): CashDrawers { + return (this._cashDrawers ??= new CashDrawers(this._options)); + } + + public get labor(): Labor { + return (this._labor ??= new Labor(this._options)); + } + + public get webhooks(): Webhooks { + return (this._webhooks ??= new Webhooks(this._options)); + } +} diff --git a/src/api/applePayApi.ts b/src/api/applePayApi.ts deleted file mode 100644 index 6a0fda23d..000000000 --- a/src/api/applePayApi.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - RegisterDomainRequest, - registerDomainRequestSchema, -} from '../models/registerDomainRequest'; -import { - RegisterDomainResponse, - registerDomainResponseSchema, -} from '../models/registerDomainResponse'; -import { BaseApi } from './baseApi'; - -export class ApplePayApi extends BaseApi { - /** - * Activates a domain for use with Apple Pay on the Web and Square. A validation - * is performed on this domain by Apple to ensure that it is properly set up as - * an Apple Pay enabled domain. - * - * This endpoint provides an easy way for platform developers to bulk activate - * Apple Pay on the Web with Square for merchants using their platform. - * - * Note: You will need to host a valid domain verification file on your domain to support Apple Pay. - * The - * current version of this file is always available at https://app.squareup.com/digital-wallets/apple- - * pay/apple-developer-merchantid-domain-association, - * and should be hosted at `.well_known/apple-developer-merchantid-domain-association` on your - * domain. This file is subject to change; we strongly recommend checking for updates regularly and - * avoiding - * long-lived caches that might not keep in sync with the correct file version. - * - * To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an Apple Pay - * Payment](https://developer.squareup.com/docs/web-payments/apple-pay). - * - * @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 - */ - async registerDomain( - body: RegisterDomainRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/apple-pay/domains'); - const mapped = req.prepareArgs({ - body: [body, registerDomainRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(registerDomainResponseSchema, requestOptions); - } -} diff --git a/src/api/bankAccountsApi.ts b/src/api/bankAccountsApi.ts deleted file mode 100644 index c3e1859ea..000000000 --- a/src/api/bankAccountsApi.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - GetBankAccountByV1IdResponse, - getBankAccountByV1IdResponseSchema, -} from '../models/getBankAccountByV1IdResponse'; -import { - GetBankAccountResponse, - getBankAccountResponseSchema, -} from '../models/getBankAccountResponse'; -import { - ListBankAccountsResponse, - listBankAccountsResponseSchema, -} from '../models/listBankAccountsResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class BankAccountsApi extends BaseApi { - /** - * Returns a list of [BankAccount]($m/BankAccount) objects linked to a Square account. - * - * @param cursor The pagination cursor returned by a previous call to this endpoint. Use it in the - * next `ListBankAccounts` request to retrieve the next set of results. See the - * [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide - * for more information. - * @param limit Upper limit on the number of bank accounts to return in the response. Currently, - * 1000 is the largest supported limit. You can specify a limit of up to 1000 bank - * accounts. This is also the default limit. - * @param locationId Location ID. You can specify this optional filter to retrieve only the linked bank - * accounts belonging to a specific location. - * @return Response from the API call - */ - async listBankAccounts( - cursor?: string, - limit?: number, - locationId?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/bank-accounts'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - locationId: [locationId, optional(string())], - }); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.query('location_id', mapped.locationId); - req.authenticate([{ global: true }]); - return req.callAsJson(listBankAccountsResponseSchema, requestOptions); - } - - /** - * Returns details of a [BankAccount]($m/BankAccount) identified by V1 bank account ID. - * - * @param v1BankAccountId Connect V1 ID of the desired `BankAccount`. For more information, see - * [Retrieve a bank account by using an ID issued by V1 Bank Accounts API](https: - * //developer.squareup.com/docs/bank-accounts-api#retrieve-a-bank-account-by- - * using-an-id-issued-by-v1-bank-accounts-api). - * @return Response from the API call - */ - async getBankAccountByV1Id( - v1BankAccountId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - v1BankAccountId: [v1BankAccountId, string()], - }); - req.appendTemplatePath`/v2/bank-accounts/by-v1-id/${mapped.v1BankAccountId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getBankAccountByV1IdResponseSchema, requestOptions); - } - - /** - * Returns details of a [BankAccount]($m/BankAccount) - * linked to a Square account. - * - * @param bankAccountId Square-issued ID of the desired `BankAccount`. - * @return Response from the API call - */ - async getBankAccount( - bankAccountId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - bankAccountId: [bankAccountId, string()], - }); - req.appendTemplatePath`/v2/bank-accounts/${mapped.bankAccountId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getBankAccountResponseSchema, requestOptions); - } -} diff --git a/src/api/baseApi.ts b/src/api/baseApi.ts deleted file mode 100644 index 7f3b0a1f3..000000000 --- a/src/api/baseApi.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ClientInterface, SdkRequestBuilderFactory } from '../clientInterface'; - -/** Base class for all controllers */ -export class BaseApi { - /** Create a request builder */ - protected createRequest: SdkRequestBuilderFactory; - - constructor(client: ClientInterface) { - this.createRequest = client.getRequestBuilderFactory(); - } -} diff --git a/src/api/bookingCustomAttributesApi.ts b/src/api/bookingCustomAttributesApi.ts deleted file mode 100644 index d66d8fdc6..000000000 --- a/src/api/bookingCustomAttributesApi.ts +++ /dev/null @@ -1,496 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkDeleteBookingCustomAttributesRequest, - bulkDeleteBookingCustomAttributesRequestSchema, -} from '../models/bulkDeleteBookingCustomAttributesRequest'; -import { - BulkDeleteBookingCustomAttributesResponse, - bulkDeleteBookingCustomAttributesResponseSchema, -} from '../models/bulkDeleteBookingCustomAttributesResponse'; -import { - BulkUpsertBookingCustomAttributesRequest, - bulkUpsertBookingCustomAttributesRequestSchema, -} from '../models/bulkUpsertBookingCustomAttributesRequest'; -import { - BulkUpsertBookingCustomAttributesResponse, - bulkUpsertBookingCustomAttributesResponseSchema, -} from '../models/bulkUpsertBookingCustomAttributesResponse'; -import { - CreateBookingCustomAttributeDefinitionRequest, - createBookingCustomAttributeDefinitionRequestSchema, -} from '../models/createBookingCustomAttributeDefinitionRequest'; -import { - CreateBookingCustomAttributeDefinitionResponse, - createBookingCustomAttributeDefinitionResponseSchema, -} from '../models/createBookingCustomAttributeDefinitionResponse'; -import { - DeleteBookingCustomAttributeDefinitionResponse, - deleteBookingCustomAttributeDefinitionResponseSchema, -} from '../models/deleteBookingCustomAttributeDefinitionResponse'; -import { - DeleteBookingCustomAttributeResponse, - deleteBookingCustomAttributeResponseSchema, -} from '../models/deleteBookingCustomAttributeResponse'; -import { - ListBookingCustomAttributeDefinitionsResponse, - listBookingCustomAttributeDefinitionsResponseSchema, -} from '../models/listBookingCustomAttributeDefinitionsResponse'; -import { - ListBookingCustomAttributesResponse, - listBookingCustomAttributesResponseSchema, -} from '../models/listBookingCustomAttributesResponse'; -import { - RetrieveBookingCustomAttributeDefinitionResponse, - retrieveBookingCustomAttributeDefinitionResponseSchema, -} from '../models/retrieveBookingCustomAttributeDefinitionResponse'; -import { - RetrieveBookingCustomAttributeResponse, - retrieveBookingCustomAttributeResponseSchema, -} from '../models/retrieveBookingCustomAttributeResponse'; -import { - UpdateBookingCustomAttributeDefinitionRequest, - updateBookingCustomAttributeDefinitionRequestSchema, -} from '../models/updateBookingCustomAttributeDefinitionRequest'; -import { - UpdateBookingCustomAttributeDefinitionResponse, - updateBookingCustomAttributeDefinitionResponseSchema, -} from '../models/updateBookingCustomAttributeDefinitionResponse'; -import { - UpsertBookingCustomAttributeRequest, - upsertBookingCustomAttributeRequestSchema, -} from '../models/upsertBookingCustomAttributeRequest'; -import { - UpsertBookingCustomAttributeResponse, - upsertBookingCustomAttributeResponseSchema, -} from '../models/upsertBookingCustomAttributeResponse'; -import { boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class BookingCustomAttributesApi extends BaseApi { - /** - * Get all bookings custom attribute definitions. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and - * `APPOINTMENTS_READ` for the OAuth scope. - * - * @param limit The maximum number of results to return in a single paged response. This limit is - * advisory. The response might contain more or fewer results. The minimum value is 1 and the - * maximum value is 100. The default value is 20. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). - * @param cursor The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. For - * more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common- - * api-patterns/pagination). - * @return Response from the API call - */ - async listBookingCustomAttributeDefinitions( - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/bookings/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson( - listBookingCustomAttributeDefinitionsResponseSchema, - requestOptions - ); - } - - /** - * Creates a bookings custom attribute definition. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @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 - */ - async createBookingCustomAttributeDefinition( - body: CreateBookingCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/bookings/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - body: [body, createBookingCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - createBookingCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Deletes a bookings custom attribute definition. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @param key The key of the custom attribute definition to delete. - * @return Response from the API call - */ - async deleteBookingCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ key: [key, string()] }); - req.appendTemplatePath`/v2/bookings/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteBookingCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a bookings custom attribute definition. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and - * `APPOINTMENTS_READ` for the OAuth scope. - * - * @param key The key of the custom attribute definition to retrieve. If the requesting application is - * not the definition owner, you must use the qualified key. - * @param version The current version of the custom attribute definition, which is used for strongly - * consistent reads to guarantee that you receive the most up-to-date data. When included in - * the request, Square returns the specified version or a higher version if one exists. If - * the specified version is higher than the current version, Square returns a `BAD_REQUEST` - * error. - * @return Response from the API call - */ - async retrieveBookingCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - key: [key, string()], - version: [version, optional(number())], - }); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/bookings/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveBookingCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Updates a bookings custom attribute definition. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @param key The key of the custom attribute - * definition to update. - * @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 - */ - async updateBookingCustomAttributeDefinition( - key: string, - body: UpdateBookingCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - key: [key, string()], - body: [body, updateBookingCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/bookings/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - updateBookingCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Bulk deletes bookings custom attributes. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @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 - */ - async bulkDeleteBookingCustomAttributes( - body: BulkDeleteBookingCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/bookings/custom-attributes/bulk-delete' - ); - const mapped = req.prepareArgs({ - body: [body, bulkDeleteBookingCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkDeleteBookingCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Bulk upserts bookings custom attributes. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @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 - */ - async bulkUpsertBookingCustomAttributes( - body: BulkUpsertBookingCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/bookings/custom-attributes/bulk-upsert' - ); - const mapped = req.prepareArgs({ - body: [body, bulkUpsertBookingCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkUpsertBookingCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Lists a booking's custom attributes. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and - * `APPOINTMENTS_READ` for the OAuth scope. - * - * @param bookingId The ID of the target [booking](entity:Booking). - * @param limit The maximum number of results to return in a single paged response. This limit - * is advisory. The response might contain more or fewer results. The minimum - * value is 1 and the maximum value is 100. The default value is 20. For more - * information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @param cursor The cursor returned in the paged response from the previous call to this - * endpoint. Provide this cursor to retrieve the next page of results for your - * original request. For more information, see [Pagination](https://developer. - * squareup.com/docs/build-basics/common-api-patterns/pagination). - * @param withDefinitions Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of each custom attribute. - * Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @return Response from the API call - */ - async listBookingCustomAttributes( - bookingId: string, - limit?: number, - cursor?: string, - withDefinitions?: boolean, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - bookingId: [bookingId, string()], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - withDefinitions: [withDefinitions, optional(boolean())], - }); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.query('with_definitions', mapped.withDefinitions); - req.appendTemplatePath`/v2/bookings/${mapped.bookingId}/custom-attributes`; - req.authenticate([{ global: true }]); - return req.callAsJson( - listBookingCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Deletes a bookings custom attribute. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @param bookingId The ID of the target [booking](entity:Booking). - * @param key The key of the custom attribute to delete. This key must match the `key` of a custom - * attribute definition in the Square seller account. If the requesting application is - * not the definition owner, you must use the qualified key. - * @return Response from the API call - */ - async deleteBookingCustomAttribute( - bookingId: string, - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - bookingId: [bookingId, string()], - key: [key, string()], - }); - req.appendTemplatePath`/v2/bookings/${mapped.bookingId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteBookingCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a bookings custom attribute. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and - * `APPOINTMENTS_READ` for the OAuth scope. - * - * @param bookingId The ID of the target [booking](entity:Booking). - * @param key The key of the custom attribute to retrieve. This key must match the `key` of a - * custom attribute definition in the Square seller account. If the requesting - * application is not the definition owner, you must use the qualified key. - * @param withDefinition Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of the custom attribute. - * Set this parameter to `true` to get the name and description of the custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @param version The current version of the custom attribute, which is used for strongly - * consistent reads to guarantee that you receive the most up-to-date data. When - * included in the request, Square returns the specified version or a higher - * version if one exists. If the specified version is higher than the current - * version, Square returns a `BAD_REQUEST` error. - * @return Response from the API call - */ - async retrieveBookingCustomAttribute( - bookingId: string, - key: string, - withDefinition?: boolean, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - bookingId: [bookingId, string()], - key: [key, string()], - withDefinition: [withDefinition, optional(boolean())], - version: [version, optional(number())], - }); - req.query('with_definition', mapped.withDefinition); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/bookings/${mapped.bookingId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveBookingCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Upserts a bookings custom attribute. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @param bookingId The ID of the target [booking](entity:Booking). - * @param key The key of the custom attribute to create or - * update. This key must match the `key` of a - * custom attribute definition in the Square seller - * account. If the requesting application is not - * the definition owner, you must use the qualified - * key. - * @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 - */ - async upsertBookingCustomAttribute( - bookingId: string, - key: string, - body: UpsertBookingCustomAttributeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - bookingId: [bookingId, string()], - key: [key, string()], - body: [body, upsertBookingCustomAttributeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/bookings/${mapped.bookingId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - upsertBookingCustomAttributeResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/bookingsApi.ts b/src/api/bookingsApi.ts deleted file mode 100644 index aca6277ae..000000000 --- a/src/api/bookingsApi.ts +++ /dev/null @@ -1,469 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkRetrieveBookingsRequest, - bulkRetrieveBookingsRequestSchema, -} from '../models/bulkRetrieveBookingsRequest'; -import { - BulkRetrieveBookingsResponse, - bulkRetrieveBookingsResponseSchema, -} from '../models/bulkRetrieveBookingsResponse'; -import { - BulkRetrieveTeamMemberBookingProfilesRequest, - bulkRetrieveTeamMemberBookingProfilesRequestSchema, -} from '../models/bulkRetrieveTeamMemberBookingProfilesRequest'; -import { - BulkRetrieveTeamMemberBookingProfilesResponse, - bulkRetrieveTeamMemberBookingProfilesResponseSchema, -} from '../models/bulkRetrieveTeamMemberBookingProfilesResponse'; -import { - CancelBookingRequest, - cancelBookingRequestSchema, -} from '../models/cancelBookingRequest'; -import { - CancelBookingResponse, - cancelBookingResponseSchema, -} from '../models/cancelBookingResponse'; -import { - CreateBookingRequest, - createBookingRequestSchema, -} from '../models/createBookingRequest'; -import { - CreateBookingResponse, - createBookingResponseSchema, -} from '../models/createBookingResponse'; -import { - ListBookingsResponse, - listBookingsResponseSchema, -} from '../models/listBookingsResponse'; -import { - ListLocationBookingProfilesResponse, - listLocationBookingProfilesResponseSchema, -} from '../models/listLocationBookingProfilesResponse'; -import { - ListTeamMemberBookingProfilesResponse, - listTeamMemberBookingProfilesResponseSchema, -} from '../models/listTeamMemberBookingProfilesResponse'; -import { - RetrieveBookingResponse, - retrieveBookingResponseSchema, -} from '../models/retrieveBookingResponse'; -import { - RetrieveBusinessBookingProfileResponse, - retrieveBusinessBookingProfileResponseSchema, -} from '../models/retrieveBusinessBookingProfileResponse'; -import { - RetrieveLocationBookingProfileResponse, - retrieveLocationBookingProfileResponseSchema, -} from '../models/retrieveLocationBookingProfileResponse'; -import { - RetrieveTeamMemberBookingProfileResponse, - retrieveTeamMemberBookingProfileResponseSchema, -} from '../models/retrieveTeamMemberBookingProfileResponse'; -import { - SearchAvailabilityRequest, - searchAvailabilityRequestSchema, -} from '../models/searchAvailabilityRequest'; -import { - SearchAvailabilityResponse, - searchAvailabilityResponseSchema, -} from '../models/searchAvailabilityResponse'; -import { - UpdateBookingRequest, - updateBookingRequestSchema, -} from '../models/updateBookingRequest'; -import { - UpdateBookingResponse, - updateBookingResponseSchema, -} from '../models/updateBookingResponse'; -import { boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class BookingsApi extends BaseApi { - /** - * Retrieve a collection of bookings. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and - * `APPOINTMENTS_READ` for the OAuth scope. - * - * @param limit The maximum number of results per page to return in a paged response. - * @param cursor The pagination cursor from the preceding response to return the next page of the - * results. Do not set this when retrieving the first page of the results. - * @param customerId The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, - * bookings for all customers are retrieved. - * @param teamMemberId The team member for whom to retrieve bookings. If this is not set, bookings of - * all members are retrieved. - * @param locationId The location for which to retrieve bookings. If this is not set, all locations' - * bookings are retrieved. - * @param startAtMin The RFC 3339 timestamp specifying the earliest of the start time. If this is not - * set, the current time is used. - * @param startAtMax The RFC 3339 timestamp specifying the latest of the start time. If this is not - * set, the time of 31 days after `start_at_min` is used. - * @return Response from the API call - */ - async listBookings( - limit?: number, - cursor?: string, - customerId?: string, - teamMemberId?: string, - locationId?: string, - startAtMin?: string, - startAtMax?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/bookings'); - const mapped = req.prepareArgs({ - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - customerId: [customerId, optional(string())], - teamMemberId: [teamMemberId, optional(string())], - locationId: [locationId, optional(string())], - startAtMin: [startAtMin, optional(string())], - startAtMax: [startAtMax, optional(string())], - }); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.query('customer_id', mapped.customerId); - req.query('team_member_id', mapped.teamMemberId); - req.query('location_id', mapped.locationId); - req.query('start_at_min', mapped.startAtMin); - req.query('start_at_max', mapped.startAtMax); - req.authenticate([{ global: true }]); - return req.callAsJson(listBookingsResponseSchema, requestOptions); - } - - /** - * Creates a booking. - * - * The required input must include the following: - * - `Booking.location_id` - * - `Booking.start_at` - * - `Booking.AppointmentSegment.team_member_id` - * - `Booking.AppointmentSegment.service_variation_id` - * - `Booking.AppointmentSegment.service_variation_version` - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @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 - */ - async createBooking( - body: CreateBookingRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/bookings'); - const mapped = req.prepareArgs({ - body: [body, createBookingRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createBookingResponseSchema, requestOptions); - } - - /** - * Searches for availabilities for booking. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and - * `APPOINTMENTS_READ` for the OAuth scope. - * - * @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 - */ - async searchAvailability( - body: SearchAvailabilityRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/bookings/availability/search'); - const mapped = req.prepareArgs({ - body: [body, searchAvailabilityRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchAvailabilityResponseSchema, requestOptions); - } - - /** - * Bulk-Retrieves a list of bookings by booking IDs. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and - * `APPOINTMENTS_READ` for the OAuth scope. - * - * @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 - */ - async bulkRetrieveBookings( - body: BulkRetrieveBookingsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/bookings/bulk-retrieve'); - const mapped = req.prepareArgs({ - body: [body, bulkRetrieveBookingsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkRetrieveBookingsResponseSchema, requestOptions); - } - - /** - * Retrieves a seller's booking profile. - * - * @return Response from the API call - */ - async retrieveBusinessBookingProfile( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/bookings/business-booking-profile' - ); - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveBusinessBookingProfileResponseSchema, - requestOptions - ); - } - - /** - * Lists location booking profiles of a seller. - * - * @param limit The maximum number of results to return in a paged response. - * @param cursor The pagination cursor from the preceding response to return the next page of the results. - * Do not set this when retrieving the first page of the results. - * @return Response from the API call - */ - async listLocationBookingProfiles( - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/bookings/location-booking-profiles' - ); - const mapped = req.prepareArgs({ - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson( - listLocationBookingProfilesResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a seller's location booking profile. - * - * @param locationId The ID of the location to retrieve the booking profile. - * @return Response from the API call - */ - async retrieveLocationBookingProfile( - locationId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ locationId: [locationId, string()] }); - req.appendTemplatePath`/v2/bookings/location-booking-profiles/${mapped.locationId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveLocationBookingProfileResponseSchema, - requestOptions - ); - } - - /** - * Lists booking profiles for team members. - * - * @param bookableOnly Indicates whether to include only bookable team members in the returned result - * (`true`) or not (`false`). - * @param limit The maximum number of results to return in a paged response. - * @param cursor The pagination cursor from the preceding response to return the next page of the - * results. Do not set this when retrieving the first page of the results. - * @param locationId Indicates whether to include only team members enabled at the given location in - * the returned result. - * @return Response from the API call - */ - async listTeamMemberBookingProfiles( - bookableOnly?: boolean, - limit?: number, - cursor?: string, - locationId?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/bookings/team-member-booking-profiles' - ); - const mapped = req.prepareArgs({ - bookableOnly: [bookableOnly, optional(boolean())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - locationId: [locationId, optional(string())], - }); - req.query('bookable_only', mapped.bookableOnly); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.query('location_id', mapped.locationId); - req.authenticate([{ global: true }]); - return req.callAsJson( - listTeamMemberBookingProfilesResponseSchema, - requestOptions - ); - } - - /** - * Retrieves one or more team members' booking profiles. - * - * @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 - */ - async bulkRetrieveTeamMemberBookingProfiles( - body: BulkRetrieveTeamMemberBookingProfilesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/bookings/team-member-booking-profiles/bulk-retrieve' - ); - const mapped = req.prepareArgs({ - body: [body, bulkRetrieveTeamMemberBookingProfilesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkRetrieveTeamMemberBookingProfilesResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a team member's booking profile. - * - * @param teamMemberId The ID of the team member to retrieve. - * @return Response from the API call - */ - async retrieveTeamMemberBookingProfile( - teamMemberId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ teamMemberId: [teamMemberId, string()] }); - req.appendTemplatePath`/v2/bookings/team-member-booking-profiles/${mapped.teamMemberId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveTeamMemberBookingProfileResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a booking. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and - * `APPOINTMENTS_READ` for the OAuth scope. - * - * @param bookingId The ID of the [Booking](entity:Booking) object representing the to-be-retrieved - * booking. - * @return Response from the API call - */ - async retrieveBooking( - bookingId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ bookingId: [bookingId, string()] }); - req.appendTemplatePath`/v2/bookings/${mapped.bookingId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveBookingResponseSchema, requestOptions); - } - - /** - * Updates a booking. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @param bookingId The ID of the [Booking](entity:Booking) object representing - * the to-be-updated booking. - * @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 - */ - async updateBooking( - bookingId: string, - body: UpdateBookingRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - bookingId: [bookingId, string()], - body: [body, updateBookingRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/bookings/${mapped.bookingId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateBookingResponseSchema, requestOptions); - } - - /** - * Cancels an existing booking. - * - * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. - * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and - * `APPOINTMENTS_WRITE` for the OAuth scope. - * - * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed - * to *Appointments Plus* - * or *Appointments Premium*. - * - * @param bookingId The ID of the [Booking](entity:Booking) object representing - * the to-be-cancelled booking. - * @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 - */ - async cancelBooking( - bookingId: string, - body: CancelBookingRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - bookingId: [bookingId, string()], - body: [body, cancelBookingRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/bookings/${mapped.bookingId}/cancel`; - req.authenticate([{ global: true }]); - return req.callAsJson(cancelBookingResponseSchema, requestOptions); - } -} diff --git a/src/api/cardsApi.ts b/src/api/cardsApi.ts deleted file mode 100644 index 9701ce333..000000000 --- a/src/api/cardsApi.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateCardRequest, - createCardRequestSchema, -} from '../models/createCardRequest'; -import { - CreateCardResponse, - createCardResponseSchema, -} from '../models/createCardResponse'; -import { - DisableCardResponse, - disableCardResponseSchema, -} from '../models/disableCardResponse'; -import { - ListCardsResponse, - listCardsResponseSchema, -} from '../models/listCardsResponse'; -import { - RetrieveCardResponse, - retrieveCardResponseSchema, -} from '../models/retrieveCardResponse'; -import { boolean, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class CardsApi extends BaseApi { - /** - * Retrieves a list of cards owned by the account making the request. - * A max of 25 cards will be returned. - * - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * to retrieve the next set of results for your original query. See - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination) for more information. - * @param customerId Limit results to cards associated with the customer supplied. By default, all - * cards owned by the merchant are returned. - * @param includeDisabled Includes disabled cards. By default, all enabled cards owned by the merchant - * are returned. - * @param referenceId Limit results to cards associated with the reference_id supplied. - * @param sortOrder Sorts the returned list by when the card was created with the specified order. - * This field defaults to ASC. - * @return Response from the API call - */ - async listCards( - cursor?: string, - customerId?: string, - includeDisabled?: boolean, - referenceId?: string, - sortOrder?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/cards'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - customerId: [customerId, optional(string())], - includeDisabled: [includeDisabled, optional(boolean())], - referenceId: [referenceId, optional(string())], - sortOrder: [sortOrder, optional(string())], - }); - req.query('cursor', mapped.cursor); - req.query('customer_id', mapped.customerId); - req.query('include_disabled', mapped.includeDisabled); - req.query('reference_id', mapped.referenceId); - req.query('sort_order', mapped.sortOrder); - req.authenticate([{ global: true }]); - return req.callAsJson(listCardsResponseSchema, requestOptions); - } - - /** - * Adds a card on file to an existing merchant. - * - * @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 - */ - async createCard( - body: CreateCardRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/cards'); - const mapped = req.prepareArgs({ body: [body, createCardRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createCardResponseSchema, requestOptions); - } - - /** - * Retrieves details for a specific Card. - * - * @param cardId Unique ID for the desired Card. - * @return Response from the API call - */ - async retrieveCard( - cardId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ cardId: [cardId, string()] }); - req.appendTemplatePath`/v2/cards/${mapped.cardId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveCardResponseSchema, requestOptions); - } - - /** - * Disables the card, preventing any further updates or charges. - * Disabling an already disabled card is allowed but has no effect. - * - * @param cardId Unique ID for the desired Card. - * @return Response from the API call - */ - async disableCard( - cardId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ cardId: [cardId, string()] }); - req.appendTemplatePath`/v2/cards/${mapped.cardId}/disable`; - req.authenticate([{ global: true }]); - return req.callAsJson(disableCardResponseSchema, requestOptions); - } -} diff --git a/src/api/cashDrawersApi.ts b/src/api/cashDrawersApi.ts deleted file mode 100644 index f1df70fa3..000000000 --- a/src/api/cashDrawersApi.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - ListCashDrawerShiftEventsResponse, - listCashDrawerShiftEventsResponseSchema, -} from '../models/listCashDrawerShiftEventsResponse'; -import { - ListCashDrawerShiftsResponse, - listCashDrawerShiftsResponseSchema, -} from '../models/listCashDrawerShiftsResponse'; -import { - RetrieveCashDrawerShiftResponse, - retrieveCashDrawerShiftResponseSchema, -} from '../models/retrieveCashDrawerShiftResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class CashDrawersApi extends BaseApi { - /** - * Provides the details for all of the cash drawer shifts for a location - * in a date range. - * - * @param locationId The ID of the location to query for a list of cash drawer shifts. - * @param sortOrder The order in which cash drawer shifts are listed in the response, based on their - * opened_at field. Default value: ASC - * @param beginTime The inclusive start time of the query on opened_at, in ISO 8601 format. - * @param endTime The exclusive end date of the query on opened_at, in ISO 8601 format. - * @param limit Number of cash drawer shift events in a page of results (200 by default, 1000 max). - * @param cursor Opaque cursor for fetching the next page of results. - * @return Response from the API call - */ - async listCashDrawerShifts( - locationId: string, - sortOrder?: string, - beginTime?: string, - endTime?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/cash-drawers/shifts'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - sortOrder: [sortOrder, optional(string())], - beginTime: [beginTime, optional(string())], - endTime: [endTime, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('location_id', mapped.locationId); - req.query('sort_order', mapped.sortOrder); - req.query('begin_time', mapped.beginTime); - req.query('end_time', mapped.endTime); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson(listCashDrawerShiftsResponseSchema, requestOptions); - } - - /** - * Provides the summary details for a single cash drawer shift. See - * [ListCashDrawerShiftEvents]($e/CashDrawers/ListCashDrawerShiftEvents) for a list of cash drawer - * shift events. - * - * @param locationId The ID of the location to retrieve cash drawer shifts from. - * @param shiftId The shift ID. - * @return Response from the API call - */ - async retrieveCashDrawerShift( - locationId: string, - shiftId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - shiftId: [shiftId, string()], - }); - req.query('location_id', mapped.locationId); - req.appendTemplatePath`/v2/cash-drawers/shifts/${mapped.shiftId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveCashDrawerShiftResponseSchema, - requestOptions - ); - } - - /** - * Provides a paginated list of events for a single cash drawer shift. - * - * @param locationId The ID of the location to list cash drawer shifts for. - * @param shiftId The shift ID. - * @param limit Number of resources to be returned in a page of results (200 by default, 1000 max). - * @param cursor Opaque cursor for fetching the next page of results. - * @return Response from the API call - */ - async listCashDrawerShiftEvents( - locationId: string, - shiftId: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - shiftId: [shiftId, string()], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('location_id', mapped.locationId); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.appendTemplatePath`/v2/cash-drawers/shifts/${mapped.shiftId}/events`; - req.authenticate([{ global: true }]); - return req.callAsJson( - listCashDrawerShiftEventsResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/catalogApi.ts b/src/api/catalogApi.ts deleted file mode 100644 index f6048dbab..000000000 --- a/src/api/catalogApi.ts +++ /dev/null @@ -1,584 +0,0 @@ -import { ApiResponse, FileWrapper, RequestOptions } from '../core'; -import { - BatchDeleteCatalogObjectsRequest, - batchDeleteCatalogObjectsRequestSchema, -} from '../models/batchDeleteCatalogObjectsRequest'; -import { - BatchDeleteCatalogObjectsResponse, - batchDeleteCatalogObjectsResponseSchema, -} from '../models/batchDeleteCatalogObjectsResponse'; -import { - BatchRetrieveCatalogObjectsRequest, - batchRetrieveCatalogObjectsRequestSchema, -} from '../models/batchRetrieveCatalogObjectsRequest'; -import { - BatchRetrieveCatalogObjectsResponse, - batchRetrieveCatalogObjectsResponseSchema, -} from '../models/batchRetrieveCatalogObjectsResponse'; -import { - BatchUpsertCatalogObjectsRequest, - batchUpsertCatalogObjectsRequestSchema, -} from '../models/batchUpsertCatalogObjectsRequest'; -import { - BatchUpsertCatalogObjectsResponse, - batchUpsertCatalogObjectsResponseSchema, -} from '../models/batchUpsertCatalogObjectsResponse'; -import { - CatalogInfoResponse, - catalogInfoResponseSchema, -} from '../models/catalogInfoResponse'; -import { - CreateCatalogImageRequest, - createCatalogImageRequestSchema, -} from '../models/createCatalogImageRequest'; -import { - CreateCatalogImageResponse, - createCatalogImageResponseSchema, -} from '../models/createCatalogImageResponse'; -import { - DeleteCatalogObjectResponse, - deleteCatalogObjectResponseSchema, -} from '../models/deleteCatalogObjectResponse'; -import { - ListCatalogResponse, - listCatalogResponseSchema, -} from '../models/listCatalogResponse'; -import { - RetrieveCatalogObjectResponse, - retrieveCatalogObjectResponseSchema, -} from '../models/retrieveCatalogObjectResponse'; -import { - SearchCatalogItemsRequest, - searchCatalogItemsRequestSchema, -} from '../models/searchCatalogItemsRequest'; -import { - SearchCatalogItemsResponse, - searchCatalogItemsResponseSchema, -} from '../models/searchCatalogItemsResponse'; -import { - SearchCatalogObjectsRequest, - searchCatalogObjectsRequestSchema, -} from '../models/searchCatalogObjectsRequest'; -import { - SearchCatalogObjectsResponse, - searchCatalogObjectsResponseSchema, -} from '../models/searchCatalogObjectsResponse'; -import { - UpdateCatalogImageRequest, - updateCatalogImageRequestSchema, -} from '../models/updateCatalogImageRequest'; -import { - UpdateCatalogImageResponse, - updateCatalogImageResponseSchema, -} from '../models/updateCatalogImageResponse'; -import { - UpdateItemModifierListsRequest, - updateItemModifierListsRequestSchema, -} from '../models/updateItemModifierListsRequest'; -import { - UpdateItemModifierListsResponse, - updateItemModifierListsResponseSchema, -} from '../models/updateItemModifierListsResponse'; -import { - UpdateItemTaxesRequest, - updateItemTaxesRequestSchema, -} from '../models/updateItemTaxesRequest'; -import { - UpdateItemTaxesResponse, - updateItemTaxesResponseSchema, -} from '../models/updateItemTaxesResponse'; -import { - UpsertCatalogObjectRequest, - upsertCatalogObjectRequestSchema, -} from '../models/upsertCatalogObjectRequest'; -import { - UpsertCatalogObjectResponse, - upsertCatalogObjectResponseSchema, -} from '../models/upsertCatalogObjectResponse'; -import { bigint, boolean, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class CatalogApi extends BaseApi { - /** - * Deletes a set of [CatalogItem]($m/CatalogItem)s based on the - * provided list of target IDs and returns a set of successfully deleted IDs in - * the response. Deletion is a cascading event such that all children of the - * targeted object are also deleted. For example, deleting a CatalogItem will - * also delete all of its [CatalogItemVariation]($m/CatalogItemVariation) - * children. - * - * `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted - * IDs can be deleted. The response will only include IDs that were - * actually deleted. - * - * To ensure consistency, only one delete request is processed at a time per seller account. - * While one (batch or non-batch) delete request is being processed, other (batched and non-batched) - * delete requests are rejected with the `429` error code. - * - * @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 - */ - async batchDeleteCatalogObjects( - body: BatchDeleteCatalogObjectsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/catalog/batch-delete'); - const mapped = req.prepareArgs({ - body: [body, batchDeleteCatalogObjectsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - batchDeleteCatalogObjectsResponseSchema, - requestOptions - ); - } - - /** - * Returns a set of objects based on the provided ID. - * Each [CatalogItem]($m/CatalogItem) returned in the set includes all of its - * child information including: all of its - * [CatalogItemVariation]($m/CatalogItemVariation) objects, references to - * its [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of - * any [CatalogTax]($m/CatalogTax) objects that apply to it. - * - * @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 - */ - async batchRetrieveCatalogObjects( - body: BatchRetrieveCatalogObjectsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/catalog/batch-retrieve'); - const mapped = req.prepareArgs({ - body: [body, batchRetrieveCatalogObjectsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - batchRetrieveCatalogObjectsResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates up to 10,000 target objects based on the provided - * list of objects. The target objects are grouped into batches and each batch is - * inserted/updated in an all-or-nothing manner. If an object within a batch is - * malformed in some way, or violates a database constraint, the entire batch - * containing that item will be disregarded. However, other batches in the same - * request may still succeed. Each batch may contain up to 1,000 objects, and - * batches will be processed in order as long as the total object count for the - * request (items, variations, modifier lists, discounts, and taxes) is no more - * than 10,000. - * - * To ensure consistency, only one update request is processed at a time per seller account. - * While one (batch or non-batch) update request is being processed, other (batched and non-batched) - * update requests are rejected with the `429` error code. - * - * @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 - */ - async batchUpsertCatalogObjects( - body: BatchUpsertCatalogObjectsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/catalog/batch-upsert'); - const mapped = req.prepareArgs({ - body: [body, batchUpsertCatalogObjectsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - batchUpsertCatalogObjectsResponseSchema, - requestOptions - ); - } - - /** - * Uploads an image file to be represented by a [CatalogImage]($m/CatalogImage) object that can be - * linked to an existing - * [CatalogObject]($m/CatalogObject) instance. The resulting `CatalogImage` is unattached to any - * `CatalogObject` if the `object_id` - * is not specified. - * - * This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an - * image file part in - * JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. - * - * @param request - * @param imageFile - * @return Response from the API call - */ - async createCatalogImage( - request?: CreateCatalogImageRequest, - imageFile?: FileWrapper, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/catalog/images'); - const mapped = req.prepareArgs({ - request: [request, optional(createCatalogImageRequestSchema)], - }); - req.formData({ - request: JSON.stringify(mapped.request), - image_file: imageFile, - }); - req.authenticate([{ global: true }]); - return req.callAsJson(createCatalogImageResponseSchema, requestOptions); - } - - /** - * Uploads a new image file to replace the existing one in the specified - * [CatalogImage]($m/CatalogImage) object. - * - * This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an - * image file part in - * JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. - * - * @param imageId The ID of the `CatalogImage` object to update the - * encapsulated image file. - * @param request - * @param imageFile - * @return Response from the API call - */ - async updateCatalogImage( - imageId: string, - request?: UpdateCatalogImageRequest, - imageFile?: FileWrapper, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - imageId: [imageId, string()], - request: [request, optional(updateCatalogImageRequestSchema)], - }); - req.formData({ - request: JSON.stringify(mapped.request), - image_file: imageFile, - }); - req.appendTemplatePath`/v2/catalog/images/${mapped.imageId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateCatalogImageResponseSchema, requestOptions); - } - - /** - * Retrieves information about the Square Catalog API, such as batch size - * limits that can be used by the `BatchUpsertCatalogObjects` endpoint. - * - * @return Response from the API call - */ - async catalogInfo( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/catalog/info'); - req.authenticate([{ global: true }]); - return req.callAsJson(catalogInfoResponseSchema, requestOptions); - } - - /** - * Returns a list of all [CatalogObject]($m/CatalogObject)s of the specified types in the catalog. - * - * The `types` parameter is specified as a comma-separated list of the - * [CatalogObjectType]($m/CatalogObjectType) values, - * for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, - * `IMAGE`". - * - * __Important:__ ListCatalog does not return deleted catalog items. To retrieve - * deleted catalog items, use [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects) - * and set the `include_deleted_objects` attribute value to `true`. - * - * @param cursor The pagination cursor returned in the previous response. Leave unset for an - * initial request. The page size is currently set to be 100. See [Pagination](https: - * //developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for - * more information. - * @param types An optional case-insensitive, comma-separated list of object types to retrieve. - * The valid values are defined in the [CatalogObjectType](entity:CatalogObjectType) - * enum, for example, `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, - * `MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc. If this is unspecified, the operation - * returns objects of all the top level types at the version of the Square API used - * to make the request. Object types that are nested onto other object types are not - * included in the defaults. At the current API version the default object types - * are: ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, PRICING_RULE, PRODUCT_SET, - * TIME_PERIOD, MEASUREMENT_UNIT, SUBSCRIPTION_PLAN, ITEM_OPTION, - * CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. - * @param catalogVersion The specific version of the catalog objects to be included in the response. This - * allows you to retrieve historical versions of objects. The specified version - * value is matched against the [CatalogObject]($m/CatalogObject)s' `version` - * attribute. If not included, results will be from the current version of the - * catalog. - * @return Response from the API call - */ - async listCatalog( - cursor?: string, - types?: string, - catalogVersion?: bigint, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/catalog/list'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - types: [types, optional(string())], - catalogVersion: [catalogVersion, optional(bigint())], - }); - req.query('cursor', mapped.cursor); - req.query('types', mapped.types); - req.query('catalog_version', mapped.catalogVersion); - req.authenticate([{ global: true }]); - return req.callAsJson(listCatalogResponseSchema, requestOptions); - } - - /** - * Creates a new or updates the specified [CatalogObject]($m/CatalogObject). - * - * To ensure consistency, only one update request is processed at a time per seller account. - * While one (batch or non-batch) update request is being processed, other (batched and non-batched) - * update requests are rejected with the `429` error code. - * - * @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 - */ - async upsertCatalogObject( - body: UpsertCatalogObjectRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/catalog/object'); - const mapped = req.prepareArgs({ - body: [body, upsertCatalogObjectRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(upsertCatalogObjectResponseSchema, requestOptions); - } - - /** - * Deletes a single [CatalogObject]($m/CatalogObject) based on the - * provided ID and returns the set of successfully deleted IDs in the response. - * Deletion is a cascading event such that all children of the targeted object - * are also deleted. For example, deleting a [CatalogItem]($m/CatalogItem) - * will also delete all of its - * [CatalogItemVariation]($m/CatalogItemVariation) children. - * - * To ensure consistency, only one delete request is processed at a time per seller account. - * While one (batch or non-batch) delete request is being processed, other (batched and non-batched) - * delete requests are rejected with the `429` error code. - * - * @param objectId The ID of the catalog object to be deleted. When an object is deleted, other objects - * in the graph that depend on that object will be deleted as well (for example, deleting - * a catalog item will delete its catalog item variations). - * @return Response from the API call - */ - async deleteCatalogObject( - objectId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ objectId: [objectId, string()] }); - req.appendTemplatePath`/v2/catalog/object/${mapped.objectId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteCatalogObjectResponseSchema, requestOptions); - } - - /** - * Returns a single [CatalogItem]($m/CatalogItem) as a - * [CatalogObject]($m/CatalogObject) based on the provided ID. The returned - * object includes all of the relevant [CatalogItem]($m/CatalogItem) - * information including: [CatalogItemVariation]($m/CatalogItemVariation) - * children, references to its - * [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of - * any [CatalogTax]($m/CatalogTax) objects that apply to it. - * - * @param objectId The object ID of any type of catalog objects to be retrieved. - * @param includeRelatedObjects If `true`, the response will include additional objects that are - * related to the requested objects. Related objects are defined as - * any objects referenced by ID by the results in the `objects` field - * of the response. These objects are put in the `related_objects` - * field. Setting this to `true` is helpful when the objects are - * needed for immediate display to a user. This process only goes one - * level deep. Objects referenced by the related objects will not be - * included. For example, if the `objects` field of the response - * contains a CatalogItem, its associated CatalogCategory objects, - * CatalogTax objects, CatalogImage objects and CatalogModifierLists - * will be returned in the `related_objects` field of the response. - * If the `objects` field of the response contains a - * CatalogItemVariation, its parent CatalogItem will be returned in - * the `related_objects` field of the response. Default value: - * `false` - * @param catalogVersion Requests objects as of a specific version of the catalog. This - * allows you to retrieve historical versions of objects. The value - * to retrieve a specific version of an object can be found in the - * version field of [CatalogObject]($m/CatalogObject)s. If not - * included, results will be from the current version of the catalog. - * @param includeCategoryPathToRoot Specifies whether or not to include the `path_to_root` list for - * each returned category instance. The `path_to_root` list consists - * of `CategoryPathToRootNode` objects and specifies the path that - * starts with the immediate parent category of the returned category - * and ends with its root category. If the returned category is a top- - * level category, the `path_to_root` list is empty and is not - * returned in the response payload. - * @return Response from the API call - */ - async retrieveCatalogObject( - objectId: string, - includeRelatedObjects?: boolean, - catalogVersion?: bigint, - includeCategoryPathToRoot?: boolean, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - objectId: [objectId, string()], - includeRelatedObjects: [includeRelatedObjects, optional(boolean())], - catalogVersion: [catalogVersion, optional(bigint())], - includeCategoryPathToRoot: [ - includeCategoryPathToRoot, - optional(boolean()), - ], - }); - req.query('include_related_objects', mapped.includeRelatedObjects); - req.query('catalog_version', mapped.catalogVersion); - req.query( - 'include_category_path_to_root', - mapped.includeCategoryPathToRoot - ); - req.appendTemplatePath`/v2/catalog/object/${mapped.objectId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveCatalogObjectResponseSchema, requestOptions); - } - - /** - * Searches for [CatalogObject]($m/CatalogObject) of any type by matching supported search attribute - * values, - * excluding custom attribute values on items or item variations, against one or more of the specified - * query filters. - * - * This (`SearchCatalogObjects`) endpoint differs from the - * [SearchCatalogItems]($e/Catalog/SearchCatalogItems) - * endpoint in the following aspects: - * - * - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` - * can search for any type of catalog objects. - * - `SearchCatalogItems` supports the custom attribute query filters to return items or item - * variations that contain custom attribute values, where `SearchCatalogObjects` does not. - * - `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted - * items or item variations, whereas `SearchCatalogObjects` does. - * - The both endpoints have different call conventions, including the query filter formats. - * - * @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 - */ - async searchCatalogObjects( - body: SearchCatalogObjectsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/catalog/search'); - const mapped = req.prepareArgs({ - body: [body, searchCatalogObjectsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchCatalogObjectsResponseSchema, requestOptions); - } - - /** - * Searches for catalog items or item variations by matching supported search attribute values, - * including - * custom attribute values, against one or more of the specified query filters. - * - * This (`SearchCatalogItems`) endpoint differs from the - * [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects) - * endpoint in the following aspects: - * - * - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` - * can search for any type of catalog objects. - * - `SearchCatalogItems` supports the custom attribute query filters to return items or item - * variations that contain custom attribute values, where `SearchCatalogObjects` does not. - * - `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted - * items or item variations, whereas `SearchCatalogObjects` does. - * - The both endpoints use different call conventions, including the query filter formats. - * - * @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 - */ - async searchCatalogItems( - body: SearchCatalogItemsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/catalog/search-catalog-items'); - const mapped = req.prepareArgs({ - body: [body, searchCatalogItemsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchCatalogItemsResponseSchema, requestOptions); - } - - /** - * Updates the [CatalogModifierList]($m/CatalogModifierList) objects - * that apply to the targeted [CatalogItem]($m/CatalogItem) without having - * to perform an upsert on the entire item. - * - * @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 - */ - async updateItemModifierLists( - body: UpdateItemModifierListsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/catalog/update-item-modifier-lists' - ); - const mapped = req.prepareArgs({ - body: [body, updateItemModifierListsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - updateItemModifierListsResponseSchema, - requestOptions - ); - } - - /** - * Updates the [CatalogTax]($m/CatalogTax) objects that apply to the - * targeted [CatalogItem]($m/CatalogItem) without having to perform an - * upsert on the entire item. - * - * @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 - */ - async updateItemTaxes( - body: UpdateItemTaxesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/catalog/update-item-taxes'); - const mapped = req.prepareArgs({ - body: [body, updateItemTaxesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(updateItemTaxesResponseSchema, requestOptions); - } -} diff --git a/src/api/checkoutApi.ts b/src/api/checkoutApi.ts deleted file mode 100644 index 0576cf9d9..000000000 --- a/src/api/checkoutApi.ts +++ /dev/null @@ -1,302 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateCheckoutRequest, - createCheckoutRequestSchema, -} from '../models/createCheckoutRequest'; -import { - CreateCheckoutResponse, - createCheckoutResponseSchema, -} from '../models/createCheckoutResponse'; -import { - CreatePaymentLinkRequest, - createPaymentLinkRequestSchema, -} from '../models/createPaymentLinkRequest'; -import { - CreatePaymentLinkResponse, - createPaymentLinkResponseSchema, -} from '../models/createPaymentLinkResponse'; -import { - DeletePaymentLinkResponse, - deletePaymentLinkResponseSchema, -} from '../models/deletePaymentLinkResponse'; -import { - ListPaymentLinksResponse, - listPaymentLinksResponseSchema, -} from '../models/listPaymentLinksResponse'; -import { - RetrieveLocationSettingsResponse, - retrieveLocationSettingsResponseSchema, -} from '../models/retrieveLocationSettingsResponse'; -import { - RetrieveMerchantSettingsResponse, - retrieveMerchantSettingsResponseSchema, -} from '../models/retrieveMerchantSettingsResponse'; -import { - RetrievePaymentLinkResponse, - retrievePaymentLinkResponseSchema, -} from '../models/retrievePaymentLinkResponse'; -import { - UpdateLocationSettingsRequest, - updateLocationSettingsRequestSchema, -} from '../models/updateLocationSettingsRequest'; -import { - UpdateLocationSettingsResponse, - updateLocationSettingsResponseSchema, -} from '../models/updateLocationSettingsResponse'; -import { - UpdateMerchantSettingsRequest, - updateMerchantSettingsRequestSchema, -} from '../models/updateMerchantSettingsRequest'; -import { - UpdateMerchantSettingsResponse, - updateMerchantSettingsResponseSchema, -} from '../models/updateMerchantSettingsResponse'; -import { - UpdatePaymentLinkRequest, - updatePaymentLinkRequestSchema, -} from '../models/updatePaymentLinkRequest'; -import { - UpdatePaymentLinkResponse, - updatePaymentLinkResponseSchema, -} from '../models/updatePaymentLinkResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class CheckoutApi extends BaseApi { - /** - * Links a `checkoutId` to a `checkout_page_url` that customers are - * directed to in order to provide their payment information using a - * payment processing workflow hosted on connect.squareup.com. - * - * - * NOTE: The Checkout API has been updated with new features. - * For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout- - * api#checkout-api-highlights). - * - * @param locationId The ID of the business location to associate the checkout - * with. - * @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 - * @deprecated - */ - async createCheckout( - locationId: string, - body: CreateCheckoutRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - body: [body, createCheckoutRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/checkouts`; - req.deprecated('CheckoutApi.createCheckout'); - req.authenticate([{ global: true }]); - return req.callAsJson(createCheckoutResponseSchema, requestOptions); - } - - /** - * Retrieves the location-level settings for a Square-hosted checkout page. - * - * @param locationId The ID of the location for which to retrieve settings. - * @return Response from the API call - */ - async retrieveLocationSettings( - locationId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ locationId: [locationId, string()] }); - req.appendTemplatePath`/v2/online-checkout/location-settings/${mapped.locationId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveLocationSettingsResponseSchema, - requestOptions - ); - } - - /** - * Updates the location-level settings for a Square-hosted checkout page. - * - * @param locationId The ID of the location for which to retrieve settings. - * @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 - */ - async updateLocationSettings( - locationId: string, - body: UpdateLocationSettingsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - body: [body, updateLocationSettingsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/online-checkout/location-settings/${mapped.locationId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateLocationSettingsResponseSchema, requestOptions); - } - - /** - * Retrieves the merchant-level settings for a Square-hosted checkout page. - * - * @return Response from the API call - */ - async retrieveMerchantSettings( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/online-checkout/merchant-settings' - ); - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveMerchantSettingsResponseSchema, - requestOptions - ); - } - - /** - * Updates the merchant-level settings for a Square-hosted checkout page. - * - * @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 - */ - async updateMerchantSettings( - body: UpdateMerchantSettingsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'PUT', - '/v2/online-checkout/merchant-settings' - ); - const mapped = req.prepareArgs({ - body: [body, updateMerchantSettingsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(updateMerchantSettingsResponseSchema, requestOptions); - } - - /** - * Lists all payment links. - * - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this cursor to - * retrieve the next set of results for the original query. If a cursor is not provided, the - * endpoint returns the first page of the results. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). - * @param limit A limit on the number of results to return per page. The limit is advisory and the - * implementation might return more or less results. If the supplied limit is negative, zero, - * or greater than the maximum limit of 1000, it is ignored. Default value: `100` - * @return Response from the API call - */ - async listPaymentLinks( - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/online-checkout/payment-links'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.authenticate([{ global: true }]); - return req.callAsJson(listPaymentLinksResponseSchema, requestOptions); - } - - /** - * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their - * buyer to pay for goods and services. - * - * @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 - */ - async createPaymentLink( - body: CreatePaymentLinkRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/online-checkout/payment-links'); - const mapped = req.prepareArgs({ - body: [body, createPaymentLinkRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createPaymentLinkResponseSchema, requestOptions); - } - - /** - * Deletes a payment link. - * - * @param id The ID of the payment link to delete. - * @return Response from the API call - */ - async deletePaymentLink( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/online-checkout/payment-links/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deletePaymentLinkResponseSchema, requestOptions); - } - - /** - * Retrieves a payment link. - * - * @param id The ID of link to retrieve. - * @return Response from the API call - */ - async retrievePaymentLink( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/online-checkout/payment-links/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrievePaymentLinkResponseSchema, requestOptions); - } - - /** - * Updates a payment link. You can update the `payment_link` fields such as - * `description`, `checkout_options`, and `pre_populated_data`. - * You cannot update other fields such as the `order_id`, `version`, `URL`, or `timestamp` field. - * - * @param id The ID of the payment link to update. - * @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 - */ - async updatePaymentLink( - id: string, - body: UpdatePaymentLinkRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - id: [id, string()], - body: [body, updatePaymentLinkRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/online-checkout/payment-links/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updatePaymentLinkResponseSchema, requestOptions); - } -} diff --git a/src/api/customerCustomAttributesApi.ts b/src/api/customerCustomAttributesApi.ts deleted file mode 100644 index 6d7784b45..000000000 --- a/src/api/customerCustomAttributesApi.ts +++ /dev/null @@ -1,471 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkUpsertCustomerCustomAttributesRequest, - bulkUpsertCustomerCustomAttributesRequestSchema, -} from '../models/bulkUpsertCustomerCustomAttributesRequest'; -import { - BulkUpsertCustomerCustomAttributesResponse, - bulkUpsertCustomerCustomAttributesResponseSchema, -} from '../models/bulkUpsertCustomerCustomAttributesResponse'; -import { - CreateCustomerCustomAttributeDefinitionRequest, - createCustomerCustomAttributeDefinitionRequestSchema, -} from '../models/createCustomerCustomAttributeDefinitionRequest'; -import { - CreateCustomerCustomAttributeDefinitionResponse, - createCustomerCustomAttributeDefinitionResponseSchema, -} from '../models/createCustomerCustomAttributeDefinitionResponse'; -import { - DeleteCustomerCustomAttributeDefinitionResponse, - deleteCustomerCustomAttributeDefinitionResponseSchema, -} from '../models/deleteCustomerCustomAttributeDefinitionResponse'; -import { - DeleteCustomerCustomAttributeResponse, - deleteCustomerCustomAttributeResponseSchema, -} from '../models/deleteCustomerCustomAttributeResponse'; -import { - ListCustomerCustomAttributeDefinitionsResponse, - listCustomerCustomAttributeDefinitionsResponseSchema, -} from '../models/listCustomerCustomAttributeDefinitionsResponse'; -import { - ListCustomerCustomAttributesResponse, - listCustomerCustomAttributesResponseSchema, -} from '../models/listCustomerCustomAttributesResponse'; -import { - RetrieveCustomerCustomAttributeDefinitionResponse, - retrieveCustomerCustomAttributeDefinitionResponseSchema, -} from '../models/retrieveCustomerCustomAttributeDefinitionResponse'; -import { - RetrieveCustomerCustomAttributeResponse, - retrieveCustomerCustomAttributeResponseSchema, -} from '../models/retrieveCustomerCustomAttributeResponse'; -import { - UpdateCustomerCustomAttributeDefinitionRequest, - updateCustomerCustomAttributeDefinitionRequestSchema, -} from '../models/updateCustomerCustomAttributeDefinitionRequest'; -import { - UpdateCustomerCustomAttributeDefinitionResponse, - updateCustomerCustomAttributeDefinitionResponseSchema, -} from '../models/updateCustomerCustomAttributeDefinitionResponse'; -import { - UpsertCustomerCustomAttributeRequest, - upsertCustomerCustomAttributeRequestSchema, -} from '../models/upsertCustomerCustomAttributeRequest'; -import { - UpsertCustomerCustomAttributeResponse, - upsertCustomerCustomAttributeResponseSchema, -} from '../models/upsertCustomerCustomAttributeResponse'; -import { boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class CustomerCustomAttributesApi extends BaseApi { - /** - * Lists the customer-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong - * to a Square seller account. - * - * When all response pages are retrieved, the results include all custom attribute definitions - * that are visible to the requesting application, including those that are created by other - * applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that - * seller-defined custom attributes (also known as custom fields) are always set to - * `VISIBILITY_READ_WRITE_VALUES`. - * - * @param limit The maximum number of results to return in a single paged response. This limit is - * advisory. The response might contain more or fewer results. The minimum value is 1 and the - * maximum value is 100. The default value is 20. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). - * @param cursor The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. For - * more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common- - * api-patterns/pagination). - * @return Response from the API call - */ - async listCustomerCustomAttributeDefinitions( - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/customers/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson( - listCustomerCustomAttributeDefinitionsResponseSchema, - requestOptions - ); - } - - /** - * Creates a customer-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square - * seller account. - * Use this endpoint to define a custom attribute that can be associated with customer profiles. - * - * A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties - * for a custom attribute. After the definition is created, you can call - * [UpsertCustomerCustomAttribute]($e/CustomerCustomAttributes/UpsertCustomerCustomAttribute) or - * [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) - * to set the custom attribute for customer profiles in the seller's Customer Directory. - * - * Sellers can view all custom attributes in exported customer data, including those set to - * `VISIBILITY_HIDDEN`. - * - * @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 - */ - async createCustomerCustomAttributeDefinition( - body: CreateCustomerCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/customers/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - body: [body, createCustomerCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - createCustomerCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Deletes a customer-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square - * seller account. - * - * Deleting a custom attribute definition also deletes the corresponding custom attribute from - * all customer profiles in the seller's Customer Directory. - * - * Only the definition owner can delete a custom attribute definition. - * - * @param key The key of the custom attribute definition to delete. - * @return Response from the API call - */ - async deleteCustomerCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ key: [key, string()] }); - req.appendTemplatePath`/v2/customers/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteCustomerCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a customer-related [custom attribute definition]($m/CustomAttributeDefinition) from a - * Square seller account. - * - * To retrieve a custom attribute definition created by another application, the `visibility` - * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined - * custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @param key The key of the custom attribute definition to retrieve. If the requesting application is - * not the definition owner, you must use the qualified key. - * @param version The current version of the custom attribute definition, which is used for strongly - * consistent reads to guarantee that you receive the most up-to-date data. When included in - * the request, Square returns the specified version or a higher version if one exists. If - * the specified version is higher than the current version, Square returns a `BAD_REQUEST` - * error. - * @return Response from the API call - */ - async retrieveCustomerCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - key: [key, string()], - version: [version, optional(number())], - }); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/customers/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveCustomerCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Updates a customer-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square - * seller account. - * - * Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the - * `schema` for a `Selection` data type. - * - * Only the definition owner can update a custom attribute definition. Note that sellers can view - * all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. - * - * @param key The key of the custom attribute - * definition to update. - * @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 - */ - async updateCustomerCustomAttributeDefinition( - key: string, - body: UpdateCustomerCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - key: [key, string()], - body: [body, updateCustomerCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/customers/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - updateCustomerCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates [custom attributes]($m/CustomAttribute) for customer profiles as a bulk operation. - * - * Use this endpoint to set the value of one or more custom attributes for one or more customer - * profiles. - * A custom attribute is based on a custom attribute definition in a Square seller account, which is - * created using the - * [CreateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/CreateCustomerCustomAttributeD - * efinition) endpoint. - * - * This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert - * requests and returns a map of individual upsert responses. Each upsert request has a unique ID - * and provides a customer ID and custom attribute. Each upsert response is returned with the ID - * of the corresponding request. - * - * To create or update a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @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 - */ - async bulkUpsertCustomerCustomAttributes( - body: BulkUpsertCustomerCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/customers/custom-attributes/bulk-upsert' - ); - const mapped = req.prepareArgs({ - body: [body, bulkUpsertCustomerCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkUpsertCustomerCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Lists the [custom attributes]($m/CustomAttribute) associated with a customer profile. - * - * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions - * in the same call. - * - * When all response pages are retrieved, the results include all custom attributes that are - * visible to the requesting application, including those that are owned by other applications - * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param customerId The ID of the target [customer profile](entity:Customer). - * @param limit The maximum number of results to return in a single paged response. This limit - * is advisory. The response might contain more or fewer results. The minimum - * value is 1 and the maximum value is 100. The default value is 20. For more - * information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @param cursor The cursor returned in the paged response from the previous call to this - * endpoint. Provide this cursor to retrieve the next page of results for your - * original request. For more information, see [Pagination](https://developer. - * squareup.com/docs/build-basics/common-api-patterns/pagination). - * @param withDefinitions Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of each custom attribute. - * Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @return Response from the API call - */ - async listCustomerCustomAttributes( - customerId: string, - limit?: number, - cursor?: string, - withDefinitions?: boolean, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - withDefinitions: [withDefinitions, optional(boolean())], - }); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.query('with_definitions', mapped.withDefinitions); - req.appendTemplatePath`/v2/customers/${mapped.customerId}/custom-attributes`; - req.authenticate([{ global: true }]); - return req.callAsJson( - listCustomerCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Deletes a [custom attribute]($m/CustomAttribute) associated with a customer profile. - * - * To delete a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @param customerId The ID of the target [customer profile](entity:Customer). - * @param key The key of the custom attribute to delete. This key must match the `key` of a custom - * attribute definition in the Square seller account. If the requesting application is - * not the definition owner, you must use the qualified key. - * @return Response from the API call - */ - async deleteCustomerCustomAttribute( - customerId: string, - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - key: [key, string()], - }); - req.appendTemplatePath`/v2/customers/${mapped.customerId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteCustomerCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a [custom attribute]($m/CustomAttribute) associated with a customer profile. - * - * You can use the `with_definition` query parameter to also retrieve the custom attribute definition - * in the same call. - * - * To retrieve a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom - * attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @param customerId The ID of the target [customer profile](entity:Customer). - * @param key The key of the custom attribute to retrieve. This key must match the `key` of a - * custom attribute definition in the Square seller account. If the requesting - * application is not the definition owner, you must use the qualified key. - * @param withDefinition Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of the custom attribute. - * Set this parameter to `true` to get the name and description of the custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @param version The current version of the custom attribute, which is used for strongly - * consistent reads to guarantee that you receive the most up-to-date data. When - * included in the request, Square returns the specified version or a higher - * version if one exists. If the specified version is higher than the current - * version, Square returns a `BAD_REQUEST` error. - * @return Response from the API call - */ - async retrieveCustomerCustomAttribute( - customerId: string, - key: string, - withDefinition?: boolean, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - key: [key, string()], - withDefinition: [withDefinition, optional(boolean())], - version: [version, optional(number())], - }); - req.query('with_definition', mapped.withDefinition); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/customers/${mapped.customerId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveCustomerCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates a [custom attribute]($m/CustomAttribute) for a customer profile. - * - * Use this endpoint to set the value of a custom attribute for a specified customer profile. - * A custom attribute is based on a custom attribute definition in a Square seller account, which - * is created using the - * [CreateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/CreateCustomerCustomAttributeD - * efinition) endpoint. - * - * To create or update a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @param customerId The ID of the target [customer profile](entity: - * Customer). - * @param key The key of the custom attribute to create or - * update. This key must match the `key` of a - * custom attribute definition in the Square - * seller account. If the requesting application - * is not the definition owner, you must use the - * qualified key. - * @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 - */ - async upsertCustomerCustomAttribute( - customerId: string, - key: string, - body: UpsertCustomerCustomAttributeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - key: [key, string()], - body: [body, upsertCustomerCustomAttributeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/customers/${mapped.customerId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - upsertCustomerCustomAttributeResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/customerGroupsApi.ts b/src/api/customerGroupsApi.ts deleted file mode 100644 index eed4e14a1..000000000 --- a/src/api/customerGroupsApi.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateCustomerGroupRequest, - createCustomerGroupRequestSchema, -} from '../models/createCustomerGroupRequest'; -import { - CreateCustomerGroupResponse, - createCustomerGroupResponseSchema, -} from '../models/createCustomerGroupResponse'; -import { - DeleteCustomerGroupResponse, - deleteCustomerGroupResponseSchema, -} from '../models/deleteCustomerGroupResponse'; -import { - ListCustomerGroupsResponse, - listCustomerGroupsResponseSchema, -} from '../models/listCustomerGroupsResponse'; -import { - RetrieveCustomerGroupResponse, - retrieveCustomerGroupResponseSchema, -} from '../models/retrieveCustomerGroupResponse'; -import { - UpdateCustomerGroupRequest, - updateCustomerGroupRequestSchema, -} from '../models/updateCustomerGroupRequest'; -import { - UpdateCustomerGroupResponse, - updateCustomerGroupResponseSchema, -} from '../models/updateCustomerGroupResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class CustomerGroupsApi extends BaseApi { - /** - * Retrieves the list of customer groups of a business. - * - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this cursor to - * retrieve the next set of results for your original query. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). - * @param limit The maximum number of results to return in a single page. This limit is advisory. The - * response might contain more or fewer results. If the limit is less than 1 or greater than - * 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value - * is 50. For more information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @return Response from the API call - */ - async listCustomerGroups( - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/customers/groups'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.authenticate([{ global: true }]); - return req.callAsJson(listCustomerGroupsResponseSchema, requestOptions); - } - - /** - * Creates a new customer group for a business. - * - * The request must include the `name` value of the group. - * - * @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 - */ - async createCustomerGroup( - body: CreateCustomerGroupRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/customers/groups'); - const mapped = req.prepareArgs({ - body: [body, createCustomerGroupRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createCustomerGroupResponseSchema, requestOptions); - } - - /** - * Deletes a customer group as identified by the `group_id` value. - * - * @param groupId The ID of the customer group to delete. - * @return Response from the API call - */ - async deleteCustomerGroup( - groupId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ groupId: [groupId, string()] }); - req.appendTemplatePath`/v2/customers/groups/${mapped.groupId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteCustomerGroupResponseSchema, requestOptions); - } - - /** - * Retrieves a specific customer group as identified by the `group_id` value. - * - * @param groupId The ID of the customer group to retrieve. - * @return Response from the API call - */ - async retrieveCustomerGroup( - groupId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ groupId: [groupId, string()] }); - req.appendTemplatePath`/v2/customers/groups/${mapped.groupId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveCustomerGroupResponseSchema, requestOptions); - } - - /** - * Updates a customer group as identified by the `group_id` value. - * - * @param groupId The ID of the customer group to update. - * @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 - */ - async updateCustomerGroup( - groupId: string, - body: UpdateCustomerGroupRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - groupId: [groupId, string()], - body: [body, updateCustomerGroupRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/customers/groups/${mapped.groupId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateCustomerGroupResponseSchema, requestOptions); - } -} diff --git a/src/api/customerSegmentsApi.ts b/src/api/customerSegmentsApi.ts deleted file mode 100644 index efe4afeca..000000000 --- a/src/api/customerSegmentsApi.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - ListCustomerSegmentsResponse, - listCustomerSegmentsResponseSchema, -} from '../models/listCustomerSegmentsResponse'; -import { - RetrieveCustomerSegmentResponse, - retrieveCustomerSegmentResponseSchema, -} from '../models/retrieveCustomerSegmentResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class CustomerSegmentsApi extends BaseApi { - /** - * Retrieves the list of customer segments of a business. - * - * @param cursor A pagination cursor returned by previous calls to `ListCustomerSegments`. This cursor is - * used to retrieve the next set of query results. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). - * @param limit The maximum number of results to return in a single page. This limit is advisory. The - * response might contain more or fewer results. If the specified limit is less than 1 or - * greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The - * default value is 50. For more information, see [Pagination](https://developer.squareup. - * com/docs/build-basics/common-api-patterns/pagination). - * @return Response from the API call - */ - async listCustomerSegments( - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/customers/segments'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.authenticate([{ global: true }]); - return req.callAsJson(listCustomerSegmentsResponseSchema, requestOptions); - } - - /** - * Retrieves a specific customer segment as identified by the `segment_id` value. - * - * @param segmentId The Square-issued ID of the customer segment. - * @return Response from the API call - */ - async retrieveCustomerSegment( - segmentId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ segmentId: [segmentId, string()] }); - req.appendTemplatePath`/v2/customers/segments/${mapped.segmentId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveCustomerSegmentResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/customersApi.ts b/src/api/customersApi.ts deleted file mode 100644 index e6e0443ce..000000000 --- a/src/api/customersApi.ts +++ /dev/null @@ -1,497 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - AddGroupToCustomerResponse, - addGroupToCustomerResponseSchema, -} from '../models/addGroupToCustomerResponse'; -import { - BulkCreateCustomersRequest, - bulkCreateCustomersRequestSchema, -} from '../models/bulkCreateCustomersRequest'; -import { - BulkCreateCustomersResponse, - bulkCreateCustomersResponseSchema, -} from '../models/bulkCreateCustomersResponse'; -import { - BulkDeleteCustomersRequest, - bulkDeleteCustomersRequestSchema, -} from '../models/bulkDeleteCustomersRequest'; -import { - BulkDeleteCustomersResponse, - bulkDeleteCustomersResponseSchema, -} from '../models/bulkDeleteCustomersResponse'; -import { - BulkRetrieveCustomersRequest, - bulkRetrieveCustomersRequestSchema, -} from '../models/bulkRetrieveCustomersRequest'; -import { - BulkRetrieveCustomersResponse, - bulkRetrieveCustomersResponseSchema, -} from '../models/bulkRetrieveCustomersResponse'; -import { - BulkUpdateCustomersRequest, - bulkUpdateCustomersRequestSchema, -} from '../models/bulkUpdateCustomersRequest'; -import { - BulkUpdateCustomersResponse, - bulkUpdateCustomersResponseSchema, -} from '../models/bulkUpdateCustomersResponse'; -import { - CreateCustomerCardRequest, - createCustomerCardRequestSchema, -} from '../models/createCustomerCardRequest'; -import { - CreateCustomerCardResponse, - createCustomerCardResponseSchema, -} from '../models/createCustomerCardResponse'; -import { - CreateCustomerRequest, - createCustomerRequestSchema, -} from '../models/createCustomerRequest'; -import { - CreateCustomerResponse, - createCustomerResponseSchema, -} from '../models/createCustomerResponse'; -import { - DeleteCustomerCardResponse, - deleteCustomerCardResponseSchema, -} from '../models/deleteCustomerCardResponse'; -import { - DeleteCustomerResponse, - deleteCustomerResponseSchema, -} from '../models/deleteCustomerResponse'; -import { - ListCustomersResponse, - listCustomersResponseSchema, -} from '../models/listCustomersResponse'; -import { - RemoveGroupFromCustomerResponse, - removeGroupFromCustomerResponseSchema, -} from '../models/removeGroupFromCustomerResponse'; -import { - RetrieveCustomerResponse, - retrieveCustomerResponseSchema, -} from '../models/retrieveCustomerResponse'; -import { - SearchCustomersRequest, - searchCustomersRequestSchema, -} from '../models/searchCustomersRequest'; -import { - SearchCustomersResponse, - searchCustomersResponseSchema, -} from '../models/searchCustomersResponse'; -import { - UpdateCustomerRequest, - updateCustomerRequestSchema, -} from '../models/updateCustomerRequest'; -import { - UpdateCustomerResponse, - updateCustomerResponseSchema, -} from '../models/updateCustomerResponse'; -import { bigint, boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class CustomersApi extends BaseApi { - /** - * Lists customer profiles associated with a Square account. - * - * Under normal operating conditions, newly created or updated customer profiles become available - * for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated - * profiles can take closer to one minute or longer, especially during network incidents and outages. - * - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * cursor to retrieve the next set of results for your original query. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common- - * api-patterns/pagination). - * @param limit The maximum number of results to return in a single page. This limit is advisory. - * The response might contain more or fewer results. If the specified limit is less than - * 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` - * error. The default value is 100. For more information, see [Pagination](https: - * //developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - * @param sortField Indicates how customers should be sorted. The default value is `DEFAULT`. - * @param sortOrder Indicates whether customers should be sorted in ascending (`ASC`) or descending - * (`DESC`) order. The default value is `ASC`. - * @param count Indicates whether to return the total count of customers in the `count` field of the - * response. The default value is `false`. - * @return Response from the API call - */ - async listCustomers( - cursor?: string, - limit?: number, - sortField?: string, - sortOrder?: string, - count?: boolean, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/customers'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - sortField: [sortField, optional(string())], - sortOrder: [sortOrder, optional(string())], - count: [count, optional(boolean())], - }); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.query('sort_field', mapped.sortField); - req.query('sort_order', mapped.sortOrder); - req.query('count', mapped.count); - req.authenticate([{ global: true }]); - return req.callAsJson(listCustomersResponseSchema, requestOptions); - } - - /** - * Creates a new customer for a business. - * - * You must provide at least one of the following values in your request to this - * endpoint: - * - * - `given_name` - * - `family_name` - * - `company_name` - * - `email_address` - * - `phone_number` - * - * @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 - */ - async createCustomer( - body: CreateCustomerRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/customers'); - const mapped = req.prepareArgs({ - body: [body, createCustomerRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createCustomerResponseSchema, requestOptions); - } - - /** - * Creates multiple [customer profiles]($m/Customer) for a business. - * - * This endpoint takes a map of individual create requests and returns a map of responses. - * - * You must provide at least one of the following values in each create request: - * - * - `given_name` - * - `family_name` - * - `company_name` - * - `email_address` - * - `phone_number` - * - * @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 - */ - async bulkCreateCustomers( - body: BulkCreateCustomersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/customers/bulk-create'); - const mapped = req.prepareArgs({ - body: [body, bulkCreateCustomersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkCreateCustomersResponseSchema, requestOptions); - } - - /** - * Deletes multiple customer profiles. - * - * The endpoint takes a list of customer IDs and returns a map of responses. - * - * @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 - */ - async bulkDeleteCustomers( - body: BulkDeleteCustomersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/customers/bulk-delete'); - const mapped = req.prepareArgs({ - body: [body, bulkDeleteCustomersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkDeleteCustomersResponseSchema, requestOptions); - } - - /** - * Retrieves multiple customer profiles. - * - * This endpoint takes a list of customer IDs and returns a map of responses. - * - * @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 - */ - async bulkRetrieveCustomers( - body: BulkRetrieveCustomersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/customers/bulk-retrieve'); - const mapped = req.prepareArgs({ - body: [body, bulkRetrieveCustomersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkRetrieveCustomersResponseSchema, requestOptions); - } - - /** - * Updates multiple customer profiles. - * - * This endpoint takes a map of individual update requests and returns a map of responses. - * - * You cannot use this endpoint to change cards on file. To make changes, use the [Cards API]($e/Cards) - * or [Gift Cards API]($e/GiftCards). - * - * @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 - */ - async bulkUpdateCustomers( - body: BulkUpdateCustomersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/customers/bulk-update'); - const mapped = req.prepareArgs({ - body: [body, bulkUpdateCustomersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkUpdateCustomersResponseSchema, requestOptions); - } - - /** - * Searches the customer profiles associated with a Square account using one or more supported query - * filters. - * - * Calling `SearchCustomers` without any explicit query filter returns all - * customer profiles ordered alphabetically based on `given_name` and - * `family_name`. - * - * Under normal operating conditions, newly created or updated customer profiles become available - * for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated - * profiles can take closer to one minute or longer, especially during network incidents and outages. - * - * @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 - */ - async searchCustomers( - body: SearchCustomersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/customers/search'); - const mapped = req.prepareArgs({ - body: [body, searchCustomersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchCustomersResponseSchema, requestOptions); - } - - /** - * Deletes a customer profile from a business. This operation also unlinks any associated cards on file. - * - * To delete a customer profile that was created by merging existing profiles, you must use the ID of - * the newly created profile. - * - * @param customerId The ID of the customer to delete. - * @param version The current version of the customer profile. As a best practice, you should include - * this parameter to enable [optimistic concurrency](https://developer.squareup. - * com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more - * information, see [Delete a customer profile](https://developer.squareup. - * com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). - * @return Response from the API call - */ - async deleteCustomer( - customerId: string, - version?: bigint, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - version: [version, optional(bigint())], - }); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/customers/${mapped.customerId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteCustomerResponseSchema, requestOptions); - } - - /** - * Returns details for a single customer. - * - * @param customerId The ID of the customer to retrieve. - * @return Response from the API call - */ - async retrieveCustomer( - customerId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ customerId: [customerId, string()] }); - req.appendTemplatePath`/v2/customers/${mapped.customerId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveCustomerResponseSchema, requestOptions); - } - - /** - * Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are - * required in the request. - * To add or update a field, specify the new value. To remove a field, specify `null`. - * - * To update a customer profile that was created by merging existing profiles, you must use the ID of - * the newly created profile. - * - * You cannot use this endpoint to change cards on file. To make changes, use the [Cards API]($e/Cards) - * or [Gift Cards API]($e/GiftCards). - * - * @param customerId The ID of the customer to update. - * @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 - */ - async updateCustomer( - customerId: string, - body: UpdateCustomerRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - body: [body, updateCustomerRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/customers/${mapped.customerId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateCustomerResponseSchema, requestOptions); - } - - /** - * Adds a card on file to an existing customer. - * - * As with charges, calls to `CreateCustomerCard` are idempotent. Multiple - * calls with the same card nonce return the same card record that was created - * with the provided nonce during the _first_ call. - * - * @param customerId The Square ID of the customer profile the card is linked - * to. - * @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 - * @deprecated - */ - async createCustomerCard( - customerId: string, - body: CreateCustomerCardRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - body: [body, createCustomerCardRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/customers/${mapped.customerId}/cards`; - req.deprecated('CustomersApi.createCustomerCard'); - req.authenticate([{ global: true }]); - return req.callAsJson(createCustomerCardResponseSchema, requestOptions); - } - - /** - * Removes a card on file from a customer. - * - * @param customerId The ID of the customer that the card on file belongs to. - * @param cardId The ID of the card on file to delete. - * @return Response from the API call - * @deprecated - */ - async deleteCustomerCard( - customerId: string, - cardId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - cardId: [cardId, string()], - }); - req.appendTemplatePath`/v2/customers/${mapped.customerId}/cards/${mapped.cardId}`; - req.deprecated('CustomersApi.deleteCustomerCard'); - req.authenticate([{ global: true }]); - return req.callAsJson(deleteCustomerCardResponseSchema, requestOptions); - } - - /** - * Removes a group membership from a customer. - * - * The customer is identified by the `customer_id` value - * and the customer group is identified by the `group_id` value. - * - * @param customerId The ID of the customer to remove from the group. - * @param groupId The ID of the customer group to remove the customer from. - * @return Response from the API call - */ - async removeGroupFromCustomer( - customerId: string, - groupId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - groupId: [groupId, string()], - }); - req.appendTemplatePath`/v2/customers/${mapped.customerId}/groups/${mapped.groupId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - removeGroupFromCustomerResponseSchema, - requestOptions - ); - } - - /** - * Adds a group membership to a customer. - * - * The customer is identified by the `customer_id` value - * and the customer group is identified by the `group_id` value. - * - * @param customerId The ID of the customer to add to a group. - * @param groupId The ID of the customer group to add the customer to. - * @return Response from the API call - */ - async addGroupToCustomer( - customerId: string, - groupId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - customerId: [customerId, string()], - groupId: [groupId, string()], - }); - req.appendTemplatePath`/v2/customers/${mapped.customerId}/groups/${mapped.groupId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(addGroupToCustomerResponseSchema, requestOptions); - } -} diff --git a/src/api/devicesApi.ts b/src/api/devicesApi.ts deleted file mode 100644 index 3709edbc8..000000000 --- a/src/api/devicesApi.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateDeviceCodeRequest, - createDeviceCodeRequestSchema, -} from '../models/createDeviceCodeRequest'; -import { - CreateDeviceCodeResponse, - createDeviceCodeResponseSchema, -} from '../models/createDeviceCodeResponse'; -import { - GetDeviceCodeResponse, - getDeviceCodeResponseSchema, -} from '../models/getDeviceCodeResponse'; -import { - GetDeviceResponse, - getDeviceResponseSchema, -} from '../models/getDeviceResponse'; -import { - ListDeviceCodesResponse, - listDeviceCodesResponseSchema, -} from '../models/listDeviceCodesResponse'; -import { - ListDevicesResponse, - listDevicesResponseSchema, -} from '../models/listDevicesResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class DevicesApi extends BaseApi { - /** - * List devices associated with the merchant. Currently, only Terminal API - * devices are supported. - * - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * cursor to retrieve the next set of results for the original query. See - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination) for more information. - * @param sortOrder The order in which results are listed. - `ASC` - Oldest to newest. - `DESC` - Newest - * to oldest (default). - * @param limit The number of results to return in a single page. - * @param locationId If present, only returns devices at the target location. - * @return Response from the API call - */ - async listDevices( - cursor?: string, - sortOrder?: string, - limit?: number, - locationId?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/devices'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - sortOrder: [sortOrder, optional(string())], - limit: [limit, optional(number())], - locationId: [locationId, optional(string())], - }); - req.query('cursor', mapped.cursor); - req.query('sort_order', mapped.sortOrder); - req.query('limit', mapped.limit); - req.query('location_id', mapped.locationId); - req.authenticate([{ global: true }]); - return req.callAsJson(listDevicesResponseSchema, requestOptions); - } - - /** - * Lists all DeviceCodes associated with the merchant. - * - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to - * retrieve the next set of results for your original query. See [Paginating - * results](https://developer.squareup.com/docs/working-with-apis/pagination) for more - * information. - * @param locationId If specified, only returns DeviceCodes of the specified location. Returns - * DeviceCodes of all locations if empty. - * @param productType If specified, only returns DeviceCodes targeting the specified product type. - * Returns DeviceCodes of all product types if empty. - * @param status If specified, returns DeviceCodes with the specified statuses. Returns DeviceCodes - * of status `PAIRED` and `UNPAIRED` if empty. - * @return Response from the API call - */ - async listDeviceCodes( - cursor?: string, - locationId?: string, - productType?: string, - status?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/devices/codes'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - locationId: [locationId, optional(string())], - productType: [productType, optional(string())], - status: [status, optional(string())], - }); - req.query('cursor', mapped.cursor); - req.query('location_id', mapped.locationId); - req.query('product_type', mapped.productType); - req.query('status', mapped.status); - req.authenticate([{ global: true }]); - return req.callAsJson(listDeviceCodesResponseSchema, requestOptions); - } - - /** - * Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected - * terminal mode. - * - * @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 - */ - async createDeviceCode( - body: CreateDeviceCodeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/devices/codes'); - const mapped = req.prepareArgs({ - body: [body, createDeviceCodeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createDeviceCodeResponseSchema, requestOptions); - } - - /** - * Retrieves DeviceCode with the associated ID. - * - * @param id The unique identifier for the device code. - * @return Response from the API call - */ - async getDeviceCode( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/devices/codes/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getDeviceCodeResponseSchema, requestOptions); - } - - /** - * Retrieves Device with the associated `device_id`. - * - * @param deviceId The unique ID for the desired `Device`. - * @return Response from the API call - */ - async getDevice( - deviceId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ deviceId: [deviceId, string()] }); - req.appendTemplatePath`/v2/devices/${mapped.deviceId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getDeviceResponseSchema, requestOptions); - } -} diff --git a/src/api/disputesApi.ts b/src/api/disputesApi.ts deleted file mode 100644 index 2d184415b..000000000 --- a/src/api/disputesApi.ts +++ /dev/null @@ -1,283 +0,0 @@ -import { ApiResponse, FileWrapper, RequestOptions } from '../core'; -import { - AcceptDisputeResponse, - acceptDisputeResponseSchema, -} from '../models/acceptDisputeResponse'; -import { - CreateDisputeEvidenceFileRequest, - createDisputeEvidenceFileRequestSchema, -} from '../models/createDisputeEvidenceFileRequest'; -import { - CreateDisputeEvidenceFileResponse, - createDisputeEvidenceFileResponseSchema, -} from '../models/createDisputeEvidenceFileResponse'; -import { - CreateDisputeEvidenceTextRequest, - createDisputeEvidenceTextRequestSchema, -} from '../models/createDisputeEvidenceTextRequest'; -import { - CreateDisputeEvidenceTextResponse, - createDisputeEvidenceTextResponseSchema, -} from '../models/createDisputeEvidenceTextResponse'; -import { - DeleteDisputeEvidenceResponse, - deleteDisputeEvidenceResponseSchema, -} from '../models/deleteDisputeEvidenceResponse'; -import { - ListDisputeEvidenceResponse, - listDisputeEvidenceResponseSchema, -} from '../models/listDisputeEvidenceResponse'; -import { - ListDisputesResponse, - listDisputesResponseSchema, -} from '../models/listDisputesResponse'; -import { - RetrieveDisputeEvidenceResponse, - retrieveDisputeEvidenceResponseSchema, -} from '../models/retrieveDisputeEvidenceResponse'; -import { - RetrieveDisputeResponse, - retrieveDisputeResponseSchema, -} from '../models/retrieveDisputeResponse'; -import { - SubmitEvidenceResponse, - submitEvidenceResponseSchema, -} from '../models/submitEvidenceResponse'; -import { optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class DisputesApi extends BaseApi { - /** - * Returns a list of disputes associated with a particular account. - * - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * cursor to retrieve the next set of results for the original query. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common- - * api-patterns/pagination). - * @param states The dispute states used to filter the result. If not specified, the endpoint returns - * all disputes. - * @param locationId The ID of the location for which to return a list of disputes. If not specified, the - * endpoint returns disputes associated with all locations. - * @return Response from the API call - */ - async listDisputes( - cursor?: string, - states?: string, - locationId?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/disputes'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - states: [states, optional(string())], - locationId: [locationId, optional(string())], - }); - req.query('cursor', mapped.cursor); - req.query('states', mapped.states); - req.query('location_id', mapped.locationId); - req.authenticate([{ global: true }]); - return req.callAsJson(listDisputesResponseSchema, requestOptions); - } - - /** - * Returns details about a specific dispute. - * - * @param disputeId The ID of the dispute you want more details about. - * @return Response from the API call - */ - async retrieveDispute( - disputeId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ disputeId: [disputeId, string()] }); - req.appendTemplatePath`/v2/disputes/${mapped.disputeId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveDisputeResponseSchema, requestOptions); - } - - /** - * Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and - * updates the dispute state to ACCEPTED. - * - * Square debits the disputed amount from the seller’s Square account. If the Square account - * does not have sufficient funds, Square debits the associated bank account. - * - * @param disputeId The ID of the dispute you want to accept. - * @return Response from the API call - */ - async acceptDispute( - disputeId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ disputeId: [disputeId, string()] }); - req.appendTemplatePath`/v2/disputes/${mapped.disputeId}/accept`; - req.authenticate([{ global: true }]); - return req.callAsJson(acceptDisputeResponseSchema, requestOptions); - } - - /** - * Returns a list of evidence associated with a dispute. - * - * @param disputeId The ID of the dispute. - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this cursor - * to retrieve the next set of results for the original query. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). - * @return Response from the API call - */ - async listDisputeEvidence( - disputeId: string, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - disputeId: [disputeId, string()], - cursor: [cursor, optional(string())], - }); - req.query('cursor', mapped.cursor); - req.appendTemplatePath`/v2/disputes/${mapped.disputeId}/evidence`; - req.authenticate([{ global: true }]); - return req.callAsJson(listDisputeEvidenceResponseSchema, requestOptions); - } - - /** - * Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP - * multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats. - * - * @param disputeId The ID of the dispute for which you want to upload - * evidence. - * @param request Defines the parameters for a - * `CreateDisputeEvidenceFile` request. - * @param imageFile - * @return Response from the API call - */ - async createDisputeEvidenceFile( - disputeId: string, - request?: CreateDisputeEvidenceFileRequest, - imageFile?: FileWrapper, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - disputeId: [disputeId, string()], - request: [request, optional(createDisputeEvidenceFileRequestSchema)], - }); - req.formData({ - request: JSON.stringify(mapped.request), - image_file: imageFile, - }); - req.appendTemplatePath`/v2/disputes/${mapped.disputeId}/evidence-files`; - req.authenticate([{ global: true }]); - return req.callAsJson( - createDisputeEvidenceFileResponseSchema, - requestOptions - ); - } - - /** - * Uploads text to use as evidence for a dispute challenge. - * - * @param disputeId The ID of the dispute for which you want to upload - * evidence. - * @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 - */ - async createDisputeEvidenceText( - disputeId: string, - body: CreateDisputeEvidenceTextRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - disputeId: [disputeId, string()], - body: [body, createDisputeEvidenceTextRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/disputes/${mapped.disputeId}/evidence-text`; - req.authenticate([{ global: true }]); - return req.callAsJson( - createDisputeEvidenceTextResponseSchema, - requestOptions - ); - } - - /** - * Removes specified evidence from a dispute. - * Square does not send the bank any evidence that is removed. - * - * @param disputeId The ID of the dispute from which you want to remove evidence. - * @param evidenceId The ID of the evidence you want to remove. - * @return Response from the API call - */ - async deleteDisputeEvidence( - disputeId: string, - evidenceId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - disputeId: [disputeId, string()], - evidenceId: [evidenceId, string()], - }); - req.appendTemplatePath`/v2/disputes/${mapped.disputeId}/evidence/${mapped.evidenceId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteDisputeEvidenceResponseSchema, requestOptions); - } - - /** - * Returns the metadata for the evidence specified in the request URL path. - * - * You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot - * be downloaded after you upload it. - * - * @param disputeId The ID of the dispute from which you want to retrieve evidence metadata. - * @param evidenceId The ID of the evidence to retrieve. - * @return Response from the API call - */ - async retrieveDisputeEvidence( - disputeId: string, - evidenceId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - disputeId: [disputeId, string()], - evidenceId: [evidenceId, string()], - }); - req.appendTemplatePath`/v2/disputes/${mapped.disputeId}/evidence/${mapped.evidenceId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveDisputeEvidenceResponseSchema, - requestOptions - ); - } - - /** - * Submits evidence to the cardholder's bank. - * - * The evidence submitted by this endpoint includes evidence uploaded - * using the [CreateDisputeEvidenceFile]($e/Disputes/CreateDisputeEvidenceFile) and - * [CreateDisputeEvidenceText]($e/Disputes/CreateDisputeEvidenceText) endpoints and - * evidence automatically provided by Square, when available. Evidence cannot be removed from - * a dispute after submission. - * - * @param disputeId The ID of the dispute for which you want to submit evidence. - * @return Response from the API call - */ - async submitEvidence( - disputeId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ disputeId: [disputeId, string()] }); - req.appendTemplatePath`/v2/disputes/${mapped.disputeId}/submit-evidence`; - req.authenticate([{ global: true }]); - return req.callAsJson(submitEvidenceResponseSchema, requestOptions); - } -} diff --git a/src/api/employeesApi.ts b/src/api/employeesApi.ts deleted file mode 100644 index 84777cab6..000000000 --- a/src/api/employeesApi.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - ListEmployeesResponse, - listEmployeesResponseSchema, -} from '../models/listEmployeesResponse'; -import { - RetrieveEmployeeResponse, - retrieveEmployeeResponseSchema, -} from '../models/retrieveEmployeeResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class EmployeesApi extends BaseApi { - /** - * @param locationId - * @param status Specifies the EmployeeStatus to filter the employee by. - * @param limit The number of employees to be returned on each page. - * @param cursor The token required to retrieve the specified page of results. - * @return Response from the API call - * @deprecated - */ - async listEmployees( - locationId?: string, - status?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/employees'); - const mapped = req.prepareArgs({ - locationId: [locationId, optional(string())], - status: [status, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('location_id', mapped.locationId); - req.query('status', mapped.status); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.deprecated('EmployeesApi.listEmployees'); - req.authenticate([{ global: true }]); - return req.callAsJson(listEmployeesResponseSchema, requestOptions); - } - - /** - * @param id UUID for the employee that was requested. - * @return Response from the API call - * @deprecated - */ - async retrieveEmployee( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/employees/${mapped.id}`; - req.deprecated('EmployeesApi.retrieveEmployee'); - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveEmployeeResponseSchema, requestOptions); - } -} diff --git a/src/api/eventsApi.ts b/src/api/eventsApi.ts deleted file mode 100644 index a16886225..000000000 --- a/src/api/eventsApi.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - DisableEventsResponse, - disableEventsResponseSchema, -} from '../models/disableEventsResponse'; -import { - EnableEventsResponse, - enableEventsResponseSchema, -} from '../models/enableEventsResponse'; -import { - ListEventTypesResponse, - listEventTypesResponseSchema, -} from '../models/listEventTypesResponse'; -import { - SearchEventsRequest, - searchEventsRequestSchema, -} from '../models/searchEventsRequest'; -import { - SearchEventsResponse, - searchEventsResponseSchema, -} from '../models/searchEventsResponse'; -import { optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class EventsApi extends BaseApi { - /** - * Search for Square API events that occur within a 28-day timeframe. - * - * @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 - */ - async searchEvents( - body: SearchEventsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/events'); - const mapped = req.prepareArgs({ body: [body, searchEventsRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchEventsResponseSchema, requestOptions); - } - - /** - * Disables events to prevent them from being searchable. - * All events are disabled by default. You must enable events to make them searchable. - * Disabling events for a specific time period prevents them from being searchable, even if you re- - * enable them later. - * - * @return Response from the API call - */ - async disableEvents( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT', '/v2/events/disable'); - req.authenticate([{ global: true }]); - return req.callAsJson(disableEventsResponseSchema, requestOptions); - } - - /** - * Enables events to make them searchable. Only events that occur while in the enabled state are - * searchable. - * - * @return Response from the API call - */ - async enableEvents( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT', '/v2/events/enable'); - req.authenticate([{ global: true }]); - return req.callAsJson(enableEventsResponseSchema, requestOptions); - } - - /** - * Lists all event types that you can subscribe to as webhooks or query using the Events API. - * - * @param apiVersion The API version for which to list event types. Setting this field overrides the - * default version used by the application. - * @return Response from the API call - */ - async listEventTypes( - apiVersion?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/events/types'); - const mapped = req.prepareArgs({ - apiVersion: [apiVersion, optional(string())], - }); - req.query('api_version', mapped.apiVersion); - req.authenticate([{ global: true }]); - return req.callAsJson(listEventTypesResponseSchema, requestOptions); - } -} diff --git a/src/api/giftCardActivitiesApi.ts b/src/api/giftCardActivitiesApi.ts deleted file mode 100644 index 61c1aeb88..000000000 --- a/src/api/giftCardActivitiesApi.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateGiftCardActivityRequest, - createGiftCardActivityRequestSchema, -} from '../models/createGiftCardActivityRequest'; -import { - CreateGiftCardActivityResponse, - createGiftCardActivityResponseSchema, -} from '../models/createGiftCardActivityResponse'; -import { - ListGiftCardActivitiesResponse, - listGiftCardActivitiesResponseSchema, -} from '../models/listGiftCardActivitiesResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class GiftCardActivitiesApi extends BaseApi { - /** - * Lists gift card activities. By default, you get gift card activities for all - * gift cards in the seller's account. You can optionally specify query parameters to - * filter the list. For example, you can get a list of gift card activities for a gift card, - * for all gift cards in a specific region, or for activities within a time window. - * - * @param giftCardId If a gift card ID is provided, the endpoint returns activities related to the - * specified gift card. Otherwise, the endpoint returns all gift card activities for - * the seller. - * @param type If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift - * card activities of the specified type. Otherwise, the endpoint returns all types of - * gift card activities. - * @param locationId If a location ID is provided, the endpoint returns gift card activities for the - * specified location. Otherwise, the endpoint returns gift card activities for all - * locations. - * @param beginTime The timestamp for the beginning of the reporting period, in RFC 3339 format. This - * start time is inclusive. The default value is the current time minus one year. - * @param endTime The timestamp for the end of the reporting period, in RFC 3339 format. This end - * time is inclusive. The default value is the current time. - * @param limit If a limit is provided, the endpoint returns the specified number of results (or - * fewer) per page. The maximum value is 100. The default value is 50. For more - * information, see [Pagination](https://developer.squareup.com/docs/working-with- - * apis/pagination). - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * cursor to retrieve the next set of results for the original query. If a cursor is - * not provided, the endpoint returns the first page of the results. For more - * information, see [Pagination](https://developer.squareup.com/docs/working-with- - * apis/pagination). - * @param sortOrder The order in which the endpoint returns the activities, based on `created_at`. - - * `ASC` - Oldest to newest. - `DESC` - Newest to oldest (default). - * @return Response from the API call - */ - async listGiftCardActivities( - giftCardId?: string, - type?: string, - locationId?: string, - beginTime?: string, - endTime?: string, - limit?: number, - cursor?: string, - sortOrder?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/gift-cards/activities'); - const mapped = req.prepareArgs({ - giftCardId: [giftCardId, optional(string())], - type: [type, optional(string())], - locationId: [locationId, optional(string())], - beginTime: [beginTime, optional(string())], - endTime: [endTime, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - sortOrder: [sortOrder, optional(string())], - }); - req.query('gift_card_id', mapped.giftCardId); - req.query('type', mapped.type); - req.query('location_id', mapped.locationId); - req.query('begin_time', mapped.beginTime); - req.query('end_time', mapped.endTime); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.query('sort_order', mapped.sortOrder); - req.authenticate([{ global: true }]); - return req.callAsJson(listGiftCardActivitiesResponseSchema, requestOptions); - } - - /** - * Creates a gift card activity to manage the balance or state of a [gift card]($m/GiftCard). - * For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before - * first use. - * - * @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 - */ - async createGiftCardActivity( - body: CreateGiftCardActivityRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/gift-cards/activities'); - const mapped = req.prepareArgs({ - body: [body, createGiftCardActivityRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createGiftCardActivityResponseSchema, requestOptions); - } -} diff --git a/src/api/giftCardsApi.ts b/src/api/giftCardsApi.ts deleted file mode 100644 index 86a67958b..000000000 --- a/src/api/giftCardsApi.ts +++ /dev/null @@ -1,245 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateGiftCardRequest, - createGiftCardRequestSchema, -} from '../models/createGiftCardRequest'; -import { - CreateGiftCardResponse, - createGiftCardResponseSchema, -} from '../models/createGiftCardResponse'; -import { - LinkCustomerToGiftCardRequest, - linkCustomerToGiftCardRequestSchema, -} from '../models/linkCustomerToGiftCardRequest'; -import { - LinkCustomerToGiftCardResponse, - linkCustomerToGiftCardResponseSchema, -} from '../models/linkCustomerToGiftCardResponse'; -import { - ListGiftCardsResponse, - listGiftCardsResponseSchema, -} from '../models/listGiftCardsResponse'; -import { - RetrieveGiftCardFromGANRequest, - retrieveGiftCardFromGANRequestSchema, -} from '../models/retrieveGiftCardFromGANRequest'; -import { - RetrieveGiftCardFromGANResponse, - retrieveGiftCardFromGANResponseSchema, -} from '../models/retrieveGiftCardFromGANResponse'; -import { - RetrieveGiftCardFromNonceRequest, - retrieveGiftCardFromNonceRequestSchema, -} from '../models/retrieveGiftCardFromNonceRequest'; -import { - RetrieveGiftCardFromNonceResponse, - retrieveGiftCardFromNonceResponseSchema, -} from '../models/retrieveGiftCardFromNonceResponse'; -import { - RetrieveGiftCardResponse, - retrieveGiftCardResponseSchema, -} from '../models/retrieveGiftCardResponse'; -import { - UnlinkCustomerFromGiftCardRequest, - unlinkCustomerFromGiftCardRequestSchema, -} from '../models/unlinkCustomerFromGiftCardRequest'; -import { - UnlinkCustomerFromGiftCardResponse, - unlinkCustomerFromGiftCardResponseSchema, -} from '../models/unlinkCustomerFromGiftCardResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class GiftCardsApi extends BaseApi { - /** - * Lists all gift cards. You can specify optional filters to retrieve - * a subset of the gift cards. Results are sorted by `created_at` in ascending order. - * - * @param type If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the - * specified type. Otherwise, the endpoint returns gift cards of all types. - * @param state If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards - * in the specified state. Otherwise, the endpoint returns the gift cards of all states. - * @param limit If a limit is provided, the endpoint returns only the specified number of results - * per page. The maximum value is 200. The default value is 30. For more information, - * see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * cursor to retrieve the next set of results for the original query. If a cursor is not - * provided, the endpoint returns the first page of the results. For more information, - * see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - * @param customerId If a customer ID is provided, the endpoint returns only the gift cards linked to the - * specified customer. - * @return Response from the API call - */ - async listGiftCards( - type?: string, - state?: string, - limit?: number, - cursor?: string, - customerId?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/gift-cards'); - const mapped = req.prepareArgs({ - type: [type, optional(string())], - state: [state, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - customerId: [customerId, optional(string())], - }); - req.query('type', mapped.type); - req.query('state', mapped.state); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.query('customer_id', mapped.customerId); - req.authenticate([{ global: true }]); - return req.callAsJson(listGiftCardsResponseSchema, requestOptions); - } - - /** - * Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card - * has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call - * [CreateGiftCardActivity]($e/GiftCardActivities/CreateGiftCardActivity) and create an `ACTIVATE` - * activity with the initial balance. Alternatively, you can use - * [RefundPayment]($e/Refunds/RefundPayment) - * to refund a payment to the new gift card. - * - * @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 - */ - async createGiftCard( - body: CreateGiftCardRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/gift-cards'); - const mapped = req.prepareArgs({ - body: [body, createGiftCardRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createGiftCardResponseSchema, requestOptions); - } - - /** - * Retrieves a gift card using the gift card account number (GAN). - * - * @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 - */ - async retrieveGiftCardFromGAN( - body: RetrieveGiftCardFromGANRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/gift-cards/from-gan'); - const mapped = req.prepareArgs({ - body: [body, retrieveGiftCardFromGANRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveGiftCardFromGANResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a gift card using a secure payment token that represents the gift card. - * - * @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 - */ - async retrieveGiftCardFromNonce( - body: RetrieveGiftCardFromNonceRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/gift-cards/from-nonce'); - const mapped = req.prepareArgs({ - body: [body, retrieveGiftCardFromNonceRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveGiftCardFromNonceResponseSchema, - requestOptions - ); - } - - /** - * Links a customer to a gift card, which is also referred to as adding a card on file. - * - * @param giftCardId The ID of the gift card to be linked. - * @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 - */ - async linkCustomerToGiftCard( - giftCardId: string, - body: LinkCustomerToGiftCardRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - giftCardId: [giftCardId, string()], - body: [body, linkCustomerToGiftCardRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/gift-cards/${mapped.giftCardId}/link-customer`; - req.authenticate([{ global: true }]); - return req.callAsJson(linkCustomerToGiftCardResponseSchema, requestOptions); - } - - /** - * Unlinks a customer from a gift card, which is also referred to as removing a card on file. - * - * @param giftCardId The ID of the gift card to be unlinked. - * @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 - */ - async unlinkCustomerFromGiftCard( - giftCardId: string, - body: UnlinkCustomerFromGiftCardRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - giftCardId: [giftCardId, string()], - body: [body, unlinkCustomerFromGiftCardRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/gift-cards/${mapped.giftCardId}/unlink-customer`; - req.authenticate([{ global: true }]); - return req.callAsJson( - unlinkCustomerFromGiftCardResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a gift card using the gift card ID. - * - * @param id The ID of the gift card to retrieve. - * @return Response from the API call - */ - async retrieveGiftCard( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/gift-cards/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveGiftCardResponseSchema, requestOptions); - } -} diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 000000000..3ce0a3e38 --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./resources"; diff --git a/src/api/inventoryApi.ts b/src/api/inventoryApi.ts deleted file mode 100644 index 15f25a2f6..000000000 --- a/src/api/inventoryApi.ts +++ /dev/null @@ -1,439 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BatchChangeInventoryRequest, - batchChangeInventoryRequestSchema, -} from '../models/batchChangeInventoryRequest'; -import { - BatchChangeInventoryResponse, - batchChangeInventoryResponseSchema, -} from '../models/batchChangeInventoryResponse'; -import { - BatchRetrieveInventoryChangesRequest, - batchRetrieveInventoryChangesRequestSchema, -} from '../models/batchRetrieveInventoryChangesRequest'; -import { - BatchRetrieveInventoryChangesResponse, - batchRetrieveInventoryChangesResponseSchema, -} from '../models/batchRetrieveInventoryChangesResponse'; -import { - BatchRetrieveInventoryCountsRequest, - batchRetrieveInventoryCountsRequestSchema, -} from '../models/batchRetrieveInventoryCountsRequest'; -import { - BatchRetrieveInventoryCountsResponse, - batchRetrieveInventoryCountsResponseSchema, -} from '../models/batchRetrieveInventoryCountsResponse'; -import { - RetrieveInventoryAdjustmentResponse, - retrieveInventoryAdjustmentResponseSchema, -} from '../models/retrieveInventoryAdjustmentResponse'; -import { - RetrieveInventoryChangesResponse, - retrieveInventoryChangesResponseSchema, -} from '../models/retrieveInventoryChangesResponse'; -import { - RetrieveInventoryCountResponse, - retrieveInventoryCountResponseSchema, -} from '../models/retrieveInventoryCountResponse'; -import { - RetrieveInventoryPhysicalCountResponse, - retrieveInventoryPhysicalCountResponseSchema, -} from '../models/retrieveInventoryPhysicalCountResponse'; -import { - RetrieveInventoryTransferResponse, - retrieveInventoryTransferResponseSchema, -} from '../models/retrieveInventoryTransferResponse'; -import { optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class InventoryApi extends BaseApi { - /** - * Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory- - * RetrieveInventoryAdjustment) after the endpoint URL - * is updated to conform to the standard convention. - * - * @param adjustmentId ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve. - * @return Response from the API call - * @deprecated - */ - async deprecatedRetrieveInventoryAdjustment( - adjustmentId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ adjustmentId: [adjustmentId, string()] }); - req.appendTemplatePath`/v2/inventory/adjustment/${mapped.adjustmentId}`; - req.deprecated('InventoryApi.deprecatedRetrieveInventoryAdjustment'); - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveInventoryAdjustmentResponseSchema, - requestOptions - ); - } - - /** - * Returns the [InventoryAdjustment]($m/InventoryAdjustment) object - * with the provided `adjustment_id`. - * - * @param adjustmentId ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve. - * @return Response from the API call - */ - async retrieveInventoryAdjustment( - adjustmentId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ adjustmentId: [adjustmentId, string()] }); - req.appendTemplatePath`/v2/inventory/adjustments/${mapped.adjustmentId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveInventoryAdjustmentResponseSchema, - requestOptions - ); - } - - /** - * Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the - * endpoint URL - * is updated to conform to the standard convention. - * - * @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 - * @deprecated - */ - async deprecatedBatchChangeInventory( - body: BatchChangeInventoryRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/inventory/batch-change'); - const mapped = req.prepareArgs({ - body: [body, batchChangeInventoryRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.deprecated('InventoryApi.deprecatedBatchChangeInventory'); - req.authenticate([{ global: true }]); - return req.callAsJson(batchChangeInventoryResponseSchema, requestOptions); - } - - /** - * Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory- - * BatchRetrieveInventoryChanges) after the endpoint URL - * is updated to conform to the standard convention. - * - * @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 - * @deprecated - */ - async deprecatedBatchRetrieveInventoryChanges( - body: BatchRetrieveInventoryChangesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/inventory/batch-retrieve-changes' - ); - const mapped = req.prepareArgs({ - body: [body, batchRetrieveInventoryChangesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.deprecated('InventoryApi.deprecatedBatchRetrieveInventoryChanges'); - req.authenticate([{ global: true }]); - return req.callAsJson( - batchRetrieveInventoryChangesResponseSchema, - requestOptions - ); - } - - /** - * Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory- - * BatchRetrieveInventoryCounts) after the endpoint URL - * is updated to conform to the standard convention. - * - * @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 - * @deprecated - */ - async deprecatedBatchRetrieveInventoryCounts( - body: BatchRetrieveInventoryCountsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/inventory/batch-retrieve-counts' - ); - const mapped = req.prepareArgs({ - body: [body, batchRetrieveInventoryCountsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.deprecated('InventoryApi.deprecatedBatchRetrieveInventoryCounts'); - req.authenticate([{ global: true }]); - return req.callAsJson( - batchRetrieveInventoryCountsResponseSchema, - requestOptions - ); - } - - /** - * Applies adjustments and counts to the provided item quantities. - * - * On success: returns the current calculated counts for all objects - * referenced in the request. - * On failure: returns a list of related errors. - * - * @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 - */ - async batchChangeInventory( - body: BatchChangeInventoryRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/inventory/changes/batch-create' - ); - const mapped = req.prepareArgs({ - body: [body, batchChangeInventoryRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(batchChangeInventoryResponseSchema, requestOptions); - } - - /** - * Returns historical physical counts and adjustments based on the - * provided filter criteria. - * - * Results are paginated and sorted in ascending order according their - * `occurred_at` timestamp (oldest first). - * - * BatchRetrieveInventoryChanges is a catch-all query endpoint for queries - * that cannot be handled by other, simpler endpoints. - * - * @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 - */ - async batchRetrieveInventoryChanges( - body: BatchRetrieveInventoryChangesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/inventory/changes/batch-retrieve' - ); - const mapped = req.prepareArgs({ - body: [body, batchRetrieveInventoryChangesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - batchRetrieveInventoryChangesResponseSchema, - requestOptions - ); - } - - /** - * Returns current counts for the provided - * [CatalogObject]($m/CatalogObject)s at the requested - * [Location]($m/Location)s. - * - * Results are paginated and sorted in descending order according to their - * `calculated_at` timestamp (newest first). - * - * When `updated_after` is specified, only counts that have changed since that - * time (based on the server timestamp for the most recent change) are - * returned. This allows clients to perform a "sync" operation, for example - * in response to receiving a Webhook notification. - * - * @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 - */ - async batchRetrieveInventoryCounts( - body: BatchRetrieveInventoryCountsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/inventory/counts/batch-retrieve' - ); - const mapped = req.prepareArgs({ - body: [body, batchRetrieveInventoryCountsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - batchRetrieveInventoryCountsResponseSchema, - requestOptions - ); - } - - /** - * Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory- - * RetrieveInventoryPhysicalCount) after the endpoint URL - * is updated to conform to the standard convention. - * - * @param physicalCountId ID of the [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve. - * @return Response from the API call - * @deprecated - */ - async deprecatedRetrieveInventoryPhysicalCount( - physicalCountId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - physicalCountId: [physicalCountId, string()], - }); - req.appendTemplatePath`/v2/inventory/physical-count/${mapped.physicalCountId}`; - req.deprecated('InventoryApi.deprecatedRetrieveInventoryPhysicalCount'); - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveInventoryPhysicalCountResponseSchema, - requestOptions - ); - } - - /** - * Returns the [InventoryPhysicalCount]($m/InventoryPhysicalCount) - * object with the provided `physical_count_id`. - * - * @param physicalCountId ID of the [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve. - * @return Response from the API call - */ - async retrieveInventoryPhysicalCount( - physicalCountId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - physicalCountId: [physicalCountId, string()], - }); - req.appendTemplatePath`/v2/inventory/physical-counts/${mapped.physicalCountId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveInventoryPhysicalCountResponseSchema, - requestOptions - ); - } - - /** - * Returns the [InventoryTransfer]($m/InventoryTransfer) object - * with the provided `transfer_id`. - * - * @param transferId ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve. - * @return Response from the API call - */ - async retrieveInventoryTransfer( - transferId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ transferId: [transferId, string()] }); - req.appendTemplatePath`/v2/inventory/transfers/${mapped.transferId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveInventoryTransferResponseSchema, - requestOptions - ); - } - - /** - * Retrieves the current calculated stock count for a given - * [CatalogObject]($m/CatalogObject) at a given set of - * [Location]($m/Location)s. Responses are paginated and unsorted. - * For more sophisticated queries, use a batch endpoint. - * - * @param catalogObjectId ID of the [CatalogObject](entity:CatalogObject) to retrieve. - * @param locationIds The [Location](entity:Location) IDs to look up as a comma-separated list. An - * empty list queries all locations. - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * to retrieve the next set of results for the original query. See the - * [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) - * guide for more information. - * @return Response from the API call - */ - async retrieveInventoryCount( - catalogObjectId: string, - locationIds?: string, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - catalogObjectId: [catalogObjectId, string()], - locationIds: [locationIds, optional(string())], - cursor: [cursor, optional(string())], - }); - req.query('location_ids', mapped.locationIds); - req.query('cursor', mapped.cursor); - req.appendTemplatePath`/v2/inventory/${mapped.catalogObjectId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveInventoryCountResponseSchema, requestOptions); - } - - /** - * Returns a set of physical counts and inventory adjustments for the - * provided [CatalogObject](entity:CatalogObject) at the requested - * [Location](entity:Location)s. - * - * You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory- - * BatchRetrieveInventoryChanges) - * and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID. - * - * Results are paginated and sorted in descending order according to their - * `occurred_at` timestamp (newest first). - * - * There are no limits on how far back the caller can page. This endpoint can be - * used to display recent changes for a specific item. For more - * sophisticated queries, use a batch endpoint. - * - * @param catalogObjectId ID of the [CatalogObject](entity:CatalogObject) to retrieve. - * @param locationIds The [Location](entity:Location) IDs to look up as a comma-separated list. An - * empty list queries all locations. - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * to retrieve the next set of results for the original query. See the - * [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) - * guide for more information. - * @return Response from the API call - * @deprecated - */ - async retrieveInventoryChanges( - catalogObjectId: string, - locationIds?: string, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - catalogObjectId: [catalogObjectId, string()], - locationIds: [locationIds, optional(string())], - cursor: [cursor, optional(string())], - }); - req.query('location_ids', mapped.locationIds); - req.query('cursor', mapped.cursor); - req.appendTemplatePath`/v2/inventory/${mapped.catalogObjectId}/changes`; - req.deprecated('InventoryApi.retrieveInventoryChanges'); - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveInventoryChangesResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/invoicesApi.ts b/src/api/invoicesApi.ts deleted file mode 100644 index cba832fb7..000000000 --- a/src/api/invoicesApi.ts +++ /dev/null @@ -1,363 +0,0 @@ -import { ApiResponse, FileWrapper, RequestOptions } from '../core'; -import { - CancelInvoiceRequest, - cancelInvoiceRequestSchema, -} from '../models/cancelInvoiceRequest'; -import { - CancelInvoiceResponse, - cancelInvoiceResponseSchema, -} from '../models/cancelInvoiceResponse'; -import { - CreateInvoiceAttachmentRequest, - createInvoiceAttachmentRequestSchema, -} from '../models/createInvoiceAttachmentRequest'; -import { - CreateInvoiceAttachmentResponse, - createInvoiceAttachmentResponseSchema, -} from '../models/createInvoiceAttachmentResponse'; -import { - CreateInvoiceRequest, - createInvoiceRequestSchema, -} from '../models/createInvoiceRequest'; -import { - CreateInvoiceResponse, - createInvoiceResponseSchema, -} from '../models/createInvoiceResponse'; -import { - DeleteInvoiceAttachmentResponse, - deleteInvoiceAttachmentResponseSchema, -} from '../models/deleteInvoiceAttachmentResponse'; -import { - DeleteInvoiceResponse, - deleteInvoiceResponseSchema, -} from '../models/deleteInvoiceResponse'; -import { - GetInvoiceResponse, - getInvoiceResponseSchema, -} from '../models/getInvoiceResponse'; -import { - ListInvoicesResponse, - listInvoicesResponseSchema, -} from '../models/listInvoicesResponse'; -import { - PublishInvoiceRequest, - publishInvoiceRequestSchema, -} from '../models/publishInvoiceRequest'; -import { - PublishInvoiceResponse, - publishInvoiceResponseSchema, -} from '../models/publishInvoiceResponse'; -import { - SearchInvoicesRequest, - searchInvoicesRequestSchema, -} from '../models/searchInvoicesRequest'; -import { - SearchInvoicesResponse, - searchInvoicesResponseSchema, -} from '../models/searchInvoicesResponse'; -import { - UpdateInvoiceRequest, - updateInvoiceRequestSchema, -} from '../models/updateInvoiceRequest'; -import { - UpdateInvoiceResponse, - updateInvoiceResponseSchema, -} from '../models/updateInvoiceResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class InvoicesApi extends BaseApi { - /** - * Returns a list of invoices for a given location. The response - * is paginated. If truncated, the response includes a `cursor` that you - * use in a subsequent request to retrieve the next set of invoices. - * - * @param locationId The ID of the location for which to list invoices. - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * cursor to retrieve the next set of results for your original query. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common- - * api-patterns/pagination). - * @param limit The maximum number of invoices to return (200 is the maximum `limit`). If not - * provided, the server uses a default limit of 100 invoices. - * @return Response from the API call - */ - async listInvoices( - locationId: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/invoices'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('location_id', mapped.locationId); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.authenticate([{ global: true }]); - return req.callAsJson(listInvoicesResponseSchema, requestOptions); - } - - /** - * Creates a draft [invoice]($m/Invoice) - * for an order created using the Orders API. - * - * A draft invoice remains in your account and no action is taken. - * You must publish the invoice before Square can process it (send it to the customer's email address - * or charge the customer’s card on file). - * - * @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 - */ - async createInvoice( - body: CreateInvoiceRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/invoices'); - const mapped = req.prepareArgs({ - body: [body, createInvoiceRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createInvoiceResponseSchema, requestOptions); - } - - /** - * Searches for invoices from a location specified in - * the filter. You can optionally specify customers in the filter for whom to - * retrieve invoices. In the current implementation, you can only specify one location and - * optionally one customer. - * - * The response is paginated. If truncated, the response includes a `cursor` - * that you use in a subsequent request to retrieve the next set of invoices. - * - * @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 - */ - async searchInvoices( - body: SearchInvoicesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/invoices/search'); - const mapped = req.prepareArgs({ - body: [body, searchInvoicesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchInvoicesResponseSchema, requestOptions); - } - - /** - * Deletes the specified invoice. When an invoice is deleted, the - * associated order status changes to CANCELED. You can only delete a draft - * invoice (you cannot delete a published invoice, including one that is scheduled for processing). - * - * @param invoiceId The ID of the invoice to delete. - * @param version The version of the [invoice](entity:Invoice) to delete. If you do not know the - * version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or - * [ListInvoices](api-endpoint:Invoices-ListInvoices). - * @return Response from the API call - */ - async deleteInvoice( - invoiceId: string, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - invoiceId: [invoiceId, string()], - version: [version, optional(number())], - }); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/invoices/${mapped.invoiceId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteInvoiceResponseSchema, requestOptions); - } - - /** - * Retrieves an invoice by invoice ID. - * - * @param invoiceId The ID of the invoice to retrieve. - * @return Response from the API call - */ - async getInvoice( - invoiceId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ invoiceId: [invoiceId, string()] }); - req.appendTemplatePath`/v2/invoices/${mapped.invoiceId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getInvoiceResponseSchema, requestOptions); - } - - /** - * Updates an invoice. This endpoint supports sparse updates, so you only need - * to specify the fields you want to change along with the required `version` field. - * Some restrictions apply to updating invoices. For example, you cannot change the - * `order_id` or `location_id` field. - * - * @param invoiceId The ID of the invoice to update. - * @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 - */ - async updateInvoice( - invoiceId: string, - body: UpdateInvoiceRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - invoiceId: [invoiceId, string()], - body: [body, updateInvoiceRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/invoices/${mapped.invoiceId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateInvoiceResponseSchema, requestOptions); - } - - /** - * Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file - * uploads - * with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that - * contains a file - * in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF. - * - * Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added - * only to invoices - * in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. - * - * @param invoiceId The ID of the [invoice](entity:Invoice) to attach the - * file to. - * @param request Represents a - * [CreateInvoiceAttachment]($e/Invoices/CreateInvoiceAtta - * chment) request. - * @param imageFile - * @return Response from the API call - */ - async createInvoiceAttachment( - invoiceId: string, - request?: CreateInvoiceAttachmentRequest, - imageFile?: FileWrapper, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - invoiceId: [invoiceId, string()], - request: [request, optional(createInvoiceAttachmentRequestSchema)], - }); - req.formData({ - request: JSON.stringify(mapped.request), - image_file: imageFile, - }); - req.appendTemplatePath`/v2/invoices/${mapped.invoiceId}/attachments`; - req.authenticate([{ global: true }]); - return req.callAsJson( - createInvoiceAttachmentResponseSchema, - requestOptions - ); - } - - /** - * Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed - * only - * from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. - * - * @param invoiceId The ID of the [invoice](entity:Invoice) to delete the attachment from. - * @param attachmentId The ID of the [attachment](entity:InvoiceAttachment) to delete. - * @return Response from the API call - */ - async deleteInvoiceAttachment( - invoiceId: string, - attachmentId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - invoiceId: [invoiceId, string()], - attachmentId: [attachmentId, string()], - }); - req.appendTemplatePath`/v2/invoices/${mapped.invoiceId}/attachments/${mapped.attachmentId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteInvoiceAttachmentResponseSchema, - requestOptions - ); - } - - /** - * Cancels an invoice. The seller cannot collect payments for - * the canceled invoice. - * - * You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, - * `CANCELED`, or `FAILED`. - * - * @param invoiceId The ID of the [invoice](entity:Invoice) to cancel. - * @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 - */ - async cancelInvoice( - invoiceId: string, - body: CancelInvoiceRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - invoiceId: [invoiceId, string()], - body: [body, cancelInvoiceRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/invoices/${mapped.invoiceId}/cancel`; - req.authenticate([{ global: true }]); - return req.callAsJson(cancelInvoiceResponseSchema, requestOptions); - } - - /** - * Publishes the specified draft invoice. - * - * After an invoice is published, Square - * follows up based on the invoice configuration. For example, Square - * sends the invoice to the customer's email address, charges the customer's card on file, or does - * nothing. Square also makes the invoice available on a Square-hosted invoice page. - * - * The invoice `status` also changes from `DRAFT` to a status - * based on the invoice configuration. For example, the status changes to `UNPAID` if - * Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the - * invoice amount. - * - * In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ` - * and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments. - * - * @param invoiceId The ID of the invoice to publish. - * @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 - */ - async publishInvoice( - invoiceId: string, - body: PublishInvoiceRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - invoiceId: [invoiceId, string()], - body: [body, publishInvoiceRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/invoices/${mapped.invoiceId}/publish`; - req.authenticate([{ global: true }]); - return req.callAsJson(publishInvoiceResponseSchema, requestOptions); - } -} diff --git a/src/api/laborApi.ts b/src/api/laborApi.ts deleted file mode 100644 index f97c7b715..000000000 --- a/src/api/laborApi.ts +++ /dev/null @@ -1,495 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateBreakTypeRequest, - createBreakTypeRequestSchema, -} from '../models/createBreakTypeRequest'; -import { - CreateBreakTypeResponse, - createBreakTypeResponseSchema, -} from '../models/createBreakTypeResponse'; -import { - CreateShiftRequest, - createShiftRequestSchema, -} from '../models/createShiftRequest'; -import { - CreateShiftResponse, - createShiftResponseSchema, -} from '../models/createShiftResponse'; -import { - DeleteBreakTypeResponse, - deleteBreakTypeResponseSchema, -} from '../models/deleteBreakTypeResponse'; -import { - DeleteShiftResponse, - deleteShiftResponseSchema, -} from '../models/deleteShiftResponse'; -import { - GetBreakTypeResponse, - getBreakTypeResponseSchema, -} from '../models/getBreakTypeResponse'; -import { - GetEmployeeWageResponse, - getEmployeeWageResponseSchema, -} from '../models/getEmployeeWageResponse'; -import { - GetShiftResponse, - getShiftResponseSchema, -} from '../models/getShiftResponse'; -import { - GetTeamMemberWageResponse, - getTeamMemberWageResponseSchema, -} from '../models/getTeamMemberWageResponse'; -import { - ListBreakTypesResponse, - listBreakTypesResponseSchema, -} from '../models/listBreakTypesResponse'; -import { - ListEmployeeWagesResponse, - listEmployeeWagesResponseSchema, -} from '../models/listEmployeeWagesResponse'; -import { - ListTeamMemberWagesResponse, - listTeamMemberWagesResponseSchema, -} from '../models/listTeamMemberWagesResponse'; -import { - ListWorkweekConfigsResponse, - listWorkweekConfigsResponseSchema, -} from '../models/listWorkweekConfigsResponse'; -import { - SearchShiftsRequest, - searchShiftsRequestSchema, -} from '../models/searchShiftsRequest'; -import { - SearchShiftsResponse, - searchShiftsResponseSchema, -} from '../models/searchShiftsResponse'; -import { - UpdateBreakTypeRequest, - updateBreakTypeRequestSchema, -} from '../models/updateBreakTypeRequest'; -import { - UpdateBreakTypeResponse, - updateBreakTypeResponseSchema, -} from '../models/updateBreakTypeResponse'; -import { - UpdateShiftRequest, - updateShiftRequestSchema, -} from '../models/updateShiftRequest'; -import { - UpdateShiftResponse, - updateShiftResponseSchema, -} from '../models/updateShiftResponse'; -import { - UpdateWorkweekConfigRequest, - updateWorkweekConfigRequestSchema, -} from '../models/updateWorkweekConfigRequest'; -import { - UpdateWorkweekConfigResponse, - updateWorkweekConfigResponseSchema, -} from '../models/updateWorkweekConfigResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class LaborApi extends BaseApi { - /** - * Returns a paginated list of `BreakType` instances for a business. - * - * @param locationId Filter the returned `BreakType` results to only those that are associated with the - * specified location. - * @param limit The maximum number of `BreakType` results to return per page. The number can range - * between 1 and 200. The default is 200. - * @param cursor A pointer to the next page of `BreakType` results to fetch. - * @return Response from the API call - */ - async listBreakTypes( - locationId?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/labor/break-types'); - const mapped = req.prepareArgs({ - locationId: [locationId, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('location_id', mapped.locationId); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson(listBreakTypesResponseSchema, requestOptions); - } - - /** - * Creates a new `BreakType`. - * - * A `BreakType` is a template for creating `Break` objects. - * You must provide the following values in your request to this - * endpoint: - * - * - `location_id` - * - `break_name` - * - `expected_duration` - * - `is_paid` - * - * You can only have three `BreakType` instances per location. If you attempt to add a fourth - * `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location." - * is returned. - * - * @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 - */ - async createBreakType( - body: CreateBreakTypeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/labor/break-types'); - const mapped = req.prepareArgs({ - body: [body, createBreakTypeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createBreakTypeResponseSchema, requestOptions); - } - - /** - * Deletes an existing `BreakType`. - * - * A `BreakType` can be deleted even if it is referenced from a `Shift`. - * - * @param id The UUID for the `BreakType` being deleted. - * @return Response from the API call - */ - async deleteBreakType( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/labor/break-types/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteBreakTypeResponseSchema, requestOptions); - } - - /** - * Returns a single `BreakType` specified by `id`. - * - * @param id The UUID for the `BreakType` being retrieved. - * @return Response from the API call - */ - async getBreakType( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/labor/break-types/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getBreakTypeResponseSchema, requestOptions); - } - - /** - * Updates an existing `BreakType`. - * - * @param id The UUID for the `BreakType` being updated. - * @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 - */ - async updateBreakType( - id: string, - body: UpdateBreakTypeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - id: [id, string()], - body: [body, updateBreakTypeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/labor/break-types/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateBreakTypeResponseSchema, requestOptions); - } - - /** - * Returns a paginated list of `EmployeeWage` instances for a business. - * - * @param employeeId Filter the returned wages to only those that are associated with the specified - * employee. - * @param limit The maximum number of `EmployeeWage` results to return per page. The number can - * range between 1 and 200. The default is 200. - * @param cursor A pointer to the next page of `EmployeeWage` results to fetch. - * @return Response from the API call - * @deprecated - */ - async listEmployeeWages( - employeeId?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/labor/employee-wages'); - const mapped = req.prepareArgs({ - employeeId: [employeeId, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('employee_id', mapped.employeeId); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.deprecated('LaborApi.listEmployeeWages'); - req.authenticate([{ global: true }]); - return req.callAsJson(listEmployeeWagesResponseSchema, requestOptions); - } - - /** - * Returns a single `EmployeeWage` specified by `id`. - * - * @param id The UUID for the `EmployeeWage` being retrieved. - * @return Response from the API call - * @deprecated - */ - async getEmployeeWage( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/labor/employee-wages/${mapped.id}`; - req.deprecated('LaborApi.getEmployeeWage'); - req.authenticate([{ global: true }]); - return req.callAsJson(getEmployeeWageResponseSchema, requestOptions); - } - - /** - * Creates a new `Shift`. - * - * A `Shift` represents a complete workday for a single team member. - * You must provide the following values in your request to this - * endpoint: - * - * - `location_id` - * - `team_member_id` - * - `start_at` - * - * An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when: - * - The `status` of the new `Shift` is `OPEN` and the team member has another - * shift with an `OPEN` status. - * - The `start_at` date is in the future. - * - The `start_at` or `end_at` date overlaps another shift for the same team member. - * - The `Break` instances are set in the request and a break `start_at` - * is before the `Shift.start_at`, a break `end_at` is after - * the `Shift.end_at`, or both. - * - * @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 - */ - async createShift( - body: CreateShiftRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/labor/shifts'); - const mapped = req.prepareArgs({ body: [body, createShiftRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createShiftResponseSchema, requestOptions); - } - - /** - * Returns a paginated list of `Shift` records for a business. - * The list to be returned can be filtered by: - * - Location IDs - * - Team member IDs - * - Shift status (`OPEN` or `CLOSED`) - * - Shift start - * - Shift end - * - Workday details - * - * The list can be sorted by: - * - `START_AT` - * - `END_AT` - * - `CREATED_AT` - * - `UPDATED_AT` - * - * @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 - */ - async searchShifts( - body: SearchShiftsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/labor/shifts/search'); - const mapped = req.prepareArgs({ body: [body, searchShiftsRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchShiftsResponseSchema, requestOptions); - } - - /** - * Deletes a `Shift`. - * - * @param id The UUID for the `Shift` being deleted. - * @return Response from the API call - */ - async deleteShift( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/labor/shifts/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteShiftResponseSchema, requestOptions); - } - - /** - * Returns a single `Shift` specified by `id`. - * - * @param id The UUID for the `Shift` being retrieved. - * @return Response from the API call - */ - async getShift( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/labor/shifts/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getShiftResponseSchema, requestOptions); - } - - /** - * Updates an existing `Shift`. - * - * When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have - * the `end_at` property set to a valid RFC-3339 datetime string. - * - * When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at` - * set on each `Break`. - * - * @param id The ID of the object being updated. - * @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 - */ - async updateShift( - id: string, - body: UpdateShiftRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - id: [id, string()], - body: [body, updateShiftRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/labor/shifts/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateShiftResponseSchema, requestOptions); - } - - /** - * Returns a paginated list of `TeamMemberWage` instances for a business. - * - * @param teamMemberId Filter the returned wages to only those that are associated with the specified - * team member. - * @param limit The maximum number of `TeamMemberWage` results to return per page. The number can - * range between 1 and 200. The default is 200. - * @param cursor A pointer to the next page of `EmployeeWage` results to fetch. - * @return Response from the API call - */ - async listTeamMemberWages( - teamMemberId?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/labor/team-member-wages'); - const mapped = req.prepareArgs({ - teamMemberId: [teamMemberId, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('team_member_id', mapped.teamMemberId); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson(listTeamMemberWagesResponseSchema, requestOptions); - } - - /** - * Returns a single `TeamMemberWage` specified by `id`. - * - * @param id The UUID for the `TeamMemberWage` being retrieved. - * @return Response from the API call - */ - async getTeamMemberWage( - id: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ id: [id, string()] }); - req.appendTemplatePath`/v2/labor/team-member-wages/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getTeamMemberWageResponseSchema, requestOptions); - } - - /** - * Returns a list of `WorkweekConfig` instances for a business. - * - * @param limit The maximum number of `WorkweekConfigs` results to return per page. - * @param cursor A pointer to the next page of `WorkweekConfig` results to fetch. - * @return Response from the API call - */ - async listWorkweekConfigs( - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/labor/workweek-configs'); - const mapped = req.prepareArgs({ - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson(listWorkweekConfigsResponseSchema, requestOptions); - } - - /** - * Updates a `WorkweekConfig`. - * - * @param id The UUID for the `WorkweekConfig` object being updated. - * @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 - */ - async updateWorkweekConfig( - id: string, - body: UpdateWorkweekConfigRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - id: [id, string()], - body: [body, updateWorkweekConfigRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/labor/workweek-configs/${mapped.id}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateWorkweekConfigResponseSchema, requestOptions); - } -} diff --git a/src/api/locationCustomAttributesApi.ts b/src/api/locationCustomAttributesApi.ts deleted file mode 100644 index 4f2621c64..000000000 --- a/src/api/locationCustomAttributesApi.ts +++ /dev/null @@ -1,486 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkDeleteLocationCustomAttributesRequest, - bulkDeleteLocationCustomAttributesRequestSchema, -} from '../models/bulkDeleteLocationCustomAttributesRequest'; -import { - BulkDeleteLocationCustomAttributesResponse, - bulkDeleteLocationCustomAttributesResponseSchema, -} from '../models/bulkDeleteLocationCustomAttributesResponse'; -import { - BulkUpsertLocationCustomAttributesRequest, - bulkUpsertLocationCustomAttributesRequestSchema, -} from '../models/bulkUpsertLocationCustomAttributesRequest'; -import { - BulkUpsertLocationCustomAttributesResponse, - bulkUpsertLocationCustomAttributesResponseSchema, -} from '../models/bulkUpsertLocationCustomAttributesResponse'; -import { - CreateLocationCustomAttributeDefinitionRequest, - createLocationCustomAttributeDefinitionRequestSchema, -} from '../models/createLocationCustomAttributeDefinitionRequest'; -import { - CreateLocationCustomAttributeDefinitionResponse, - createLocationCustomAttributeDefinitionResponseSchema, -} from '../models/createLocationCustomAttributeDefinitionResponse'; -import { - DeleteLocationCustomAttributeDefinitionResponse, - deleteLocationCustomAttributeDefinitionResponseSchema, -} from '../models/deleteLocationCustomAttributeDefinitionResponse'; -import { - DeleteLocationCustomAttributeResponse, - deleteLocationCustomAttributeResponseSchema, -} from '../models/deleteLocationCustomAttributeResponse'; -import { - ListLocationCustomAttributeDefinitionsResponse, - listLocationCustomAttributeDefinitionsResponseSchema, -} from '../models/listLocationCustomAttributeDefinitionsResponse'; -import { - ListLocationCustomAttributesResponse, - listLocationCustomAttributesResponseSchema, -} from '../models/listLocationCustomAttributesResponse'; -import { - RetrieveLocationCustomAttributeDefinitionResponse, - retrieveLocationCustomAttributeDefinitionResponseSchema, -} from '../models/retrieveLocationCustomAttributeDefinitionResponse'; -import { - RetrieveLocationCustomAttributeResponse, - retrieveLocationCustomAttributeResponseSchema, -} from '../models/retrieveLocationCustomAttributeResponse'; -import { - UpdateLocationCustomAttributeDefinitionRequest, - updateLocationCustomAttributeDefinitionRequestSchema, -} from '../models/updateLocationCustomAttributeDefinitionRequest'; -import { - UpdateLocationCustomAttributeDefinitionResponse, - updateLocationCustomAttributeDefinitionResponseSchema, -} from '../models/updateLocationCustomAttributeDefinitionResponse'; -import { - UpsertLocationCustomAttributeRequest, - upsertLocationCustomAttributeRequestSchema, -} from '../models/upsertLocationCustomAttributeRequest'; -import { - UpsertLocationCustomAttributeResponse, - upsertLocationCustomAttributeResponseSchema, -} from '../models/upsertLocationCustomAttributeResponse'; -import { boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class LocationCustomAttributesApi extends BaseApi { - /** - * Lists the location-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong - * to a Square seller account. - * When all response pages are retrieved, the results include all custom attribute definitions - * that are visible to the requesting application, including those that are created by other - * applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param visibilityFilter Filters the `CustomAttributeDefinition` results by their `visibility` values. - * @param limit The maximum number of results to return in a single paged response. This limit - * is advisory. The response might contain more or fewer results. The minimum - * value is 1 and the maximum value is 100. The default value is 20. For more - * information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @param cursor The cursor returned in the paged response from the previous call to this - * endpoint. Provide this cursor to retrieve the next page of results for your - * original request. For more information, see [Pagination](https://developer. - * squareup.com/docs/build-basics/common-api-patterns/pagination). - * @return Response from the API call - */ - async listLocationCustomAttributeDefinitions( - visibilityFilter?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/locations/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - visibilityFilter: [visibilityFilter, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('visibility_filter', mapped.visibilityFilter); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson( - listLocationCustomAttributeDefinitionsResponseSchema, - requestOptions - ); - } - - /** - * Creates a location-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square - * seller account. - * Use this endpoint to define a custom attribute that can be associated with locations. - * A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties - * for a custom attribute. After the definition is created, you can call - * [UpsertLocationCustomAttribute]($e/LocationCustomAttributes/UpsertLocationCustomAttribute) or - * [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) - * to set the custom attribute for locations. - * - * @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 - */ - async createLocationCustomAttributeDefinition( - body: CreateLocationCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/locations/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - body: [body, createLocationCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - createLocationCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Deletes a location-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square - * seller account. - * Deleting a custom attribute definition also deletes the corresponding custom attribute from - * all locations. - * Only the definition owner can delete a custom attribute definition. - * - * @param key The key of the custom attribute definition to delete. - * @return Response from the API call - */ - async deleteLocationCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ key: [key, string()] }); - req.appendTemplatePath`/v2/locations/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteLocationCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a location-related [custom attribute definition]($m/CustomAttributeDefinition) from a - * Square seller account. - * To retrieve a custom attribute definition created by another application, the `visibility` - * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param key The key of the custom attribute definition to retrieve. If the requesting application is - * not the definition owner, you must use the qualified key. - * @param version The current version of the custom attribute definition, which is used for strongly - * consistent reads to guarantee that you receive the most up-to-date data. When included in - * the request, Square returns the specified version or a higher version if one exists. If - * the specified version is higher than the current version, Square returns a `BAD_REQUEST` - * error. - * @return Response from the API call - */ - async retrieveLocationCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - key: [key, string()], - version: [version, optional(number())], - }); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/locations/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveLocationCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Updates a location-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square - * seller account. - * Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the - * `schema` for a `Selection` data type. - * Only the definition owner can update a custom attribute definition. - * - * @param key The key of the custom attribute - * definition to update. - * @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 - */ - async updateLocationCustomAttributeDefinition( - key: string, - body: UpdateLocationCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - key: [key, string()], - body: [body, updateLocationCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/locations/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - updateLocationCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Deletes [custom attributes]($m/CustomAttribute) for locations as a bulk operation. - * To delete a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_WRITE_VALUES`. - * - * @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 - */ - async bulkDeleteLocationCustomAttributes( - body: BulkDeleteLocationCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/locations/custom-attributes/bulk-delete' - ); - const mapped = req.prepareArgs({ - body: [body, bulkDeleteLocationCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkDeleteLocationCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates [custom attributes]($m/CustomAttribute) for locations as a bulk operation. - * Use this endpoint to set the value of one or more custom attributes for one or more locations. - * A custom attribute is based on a custom attribute definition in a Square seller account, which is - * created using the - * [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeD - * efinition) endpoint. - * This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert - * requests and returns a map of individual upsert responses. Each upsert request has a unique ID - * and provides a location ID and custom attribute. Each upsert response is returned with the ID - * of the corresponding request. - * To create or update a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. - * - * @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 - */ - async bulkUpsertLocationCustomAttributes( - body: BulkUpsertLocationCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/locations/custom-attributes/bulk-upsert' - ); - const mapped = req.prepareArgs({ - body: [body, bulkUpsertLocationCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkUpsertLocationCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Lists the [custom attributes]($m/CustomAttribute) associated with a location. - * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions - * in the same call. - * When all response pages are retrieved, the results include all custom attributes that are - * visible to the requesting application, including those that are owned by other applications - * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param locationId The ID of the target [location](entity:Location). - * @param visibilityFilter Filters the `CustomAttributeDefinition` results by their `visibility` values. - * @param limit The maximum number of results to return in a single paged response. This - * limit is advisory. The response might contain more or fewer results. The - * minimum value is 1 and the maximum value is 100. The default value is 20. For - * more information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @param cursor The cursor returned in the paged response from the previous call to this - * endpoint. Provide this cursor to retrieve the next page of results for your - * original request. For more information, see [Pagination](https://developer. - * squareup.com/docs/build-basics/common-api-patterns/pagination). - * @param withDefinitions Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of each custom attribute. - * Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @return Response from the API call - */ - async listLocationCustomAttributes( - locationId: string, - visibilityFilter?: string, - limit?: number, - cursor?: string, - withDefinitions?: boolean, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - visibilityFilter: [visibilityFilter, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - withDefinitions: [withDefinitions, optional(boolean())], - }); - req.query('visibility_filter', mapped.visibilityFilter); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.query('with_definitions', mapped.withDefinitions); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/custom-attributes`; - req.authenticate([{ global: true }]); - return req.callAsJson( - listLocationCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Deletes a [custom attribute]($m/CustomAttribute) associated with a location. - * To delete a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_WRITE_VALUES`. - * - * @param locationId The ID of the target [location](entity:Location). - * @param key The key of the custom attribute to delete. This key must match the `key` of a custom - * attribute definition in the Square seller account. If the requesting application is - * not the definition owner, you must use the qualified key. - * @return Response from the API call - */ - async deleteLocationCustomAttribute( - locationId: string, - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - key: [key, string()], - }); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteLocationCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a [custom attribute]($m/CustomAttribute) associated with a location. - * You can use the `with_definition` query parameter to also retrieve the custom attribute definition - * in the same call. - * To retrieve a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param locationId The ID of the target [location](entity:Location). - * @param key The key of the custom attribute to retrieve. This key must match the `key` of a - * custom attribute definition in the Square seller account. If the requesting - * application is not the definition owner, you must use the qualified key. - * @param withDefinition Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of the custom attribute. - * Set this parameter to `true` to get the name and description of the custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @param version The current version of the custom attribute, which is used for strongly - * consistent reads to guarantee that you receive the most up-to-date data. When - * included in the request, Square returns the specified version or a higher - * version if one exists. If the specified version is higher than the current - * version, Square returns a `BAD_REQUEST` error. - * @return Response from the API call - */ - async retrieveLocationCustomAttribute( - locationId: string, - key: string, - withDefinition?: boolean, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - key: [key, string()], - withDefinition: [withDefinition, optional(boolean())], - version: [version, optional(number())], - }); - req.query('with_definition', mapped.withDefinition); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveLocationCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates a [custom attribute]($m/CustomAttribute) for a location. - * Use this endpoint to set the value of a custom attribute for a specified location. - * A custom attribute is based on a custom attribute definition in a Square seller account, which - * is created using the - * [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeD - * efinition) endpoint. - * To create or update a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. - * - * @param locationId The ID of the target [location](entity: - * Location). - * @param key The key of the custom attribute to create or - * update. This key must match the `key` of a - * custom attribute definition in the Square - * seller account. If the requesting application - * is not the definition owner, you must use the - * qualified key. - * @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 - */ - async upsertLocationCustomAttribute( - locationId: string, - key: string, - body: UpsertLocationCustomAttributeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - key: [key, string()], - body: [body, upsertLocationCustomAttributeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - upsertLocationCustomAttributeResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/locationsApi.ts b/src/api/locationsApi.ts deleted file mode 100644 index b704fe207..000000000 --- a/src/api/locationsApi.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateLocationRequest, - createLocationRequestSchema, -} from '../models/createLocationRequest'; -import { - CreateLocationResponse, - createLocationResponseSchema, -} from '../models/createLocationResponse'; -import { - ListLocationsResponse, - listLocationsResponseSchema, -} from '../models/listLocationsResponse'; -import { - RetrieveLocationResponse, - retrieveLocationResponseSchema, -} from '../models/retrieveLocationResponse'; -import { - UpdateLocationRequest, - updateLocationRequestSchema, -} from '../models/updateLocationRequest'; -import { - UpdateLocationResponse, - updateLocationResponseSchema, -} from '../models/updateLocationResponse'; -import { string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class LocationsApi extends BaseApi { - /** - * Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations- - * api), - * including those with an inactive status. Locations are listed alphabetically by `name`. - * - * @return Response from the API call - */ - async listLocations( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/locations'); - req.authenticate([{ global: true }]); - return req.callAsJson(listLocationsResponseSchema, requestOptions); - } - - /** - * Creates a [location](https://developer.squareup.com/docs/locations-api). - * Creating new locations allows for separate configuration of receipt layouts, item prices, - * and sales reports. Developers can use locations to separate sales activity through applications - * that integrate with Square from sales activity elsewhere in a seller's account. - * Locations created programmatically with the Locations API last forever and - * are visible to the seller for their own management. Therefore, ensure that - * each location has a sensible and unique name. - * - * @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 - */ - async createLocation( - body: CreateLocationRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/locations'); - const mapped = req.prepareArgs({ - body: [body, createLocationRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createLocationResponseSchema, requestOptions); - } - - /** - * Retrieves details of a single location. Specify "main" - * as the location ID to retrieve details of the [main location](https://developer.squareup. - * com/docs/locations-api#about-the-main-location). - * - * @param locationId The ID of the location to retrieve. Specify the string "main" to return the main - * location. - * @return Response from the API call - */ - async retrieveLocation( - locationId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ locationId: [locationId, string()] }); - req.appendTemplatePath`/v2/locations/${mapped.locationId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveLocationResponseSchema, requestOptions); - } - - /** - * Updates a [location](https://developer.squareup.com/docs/locations-api). - * - * @param locationId The ID of the location to update. - * @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 - */ - async updateLocation( - locationId: string, - body: UpdateLocationRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - body: [body, updateLocationRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/locations/${mapped.locationId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateLocationResponseSchema, requestOptions); - } -} diff --git a/src/api/loyaltyApi.ts b/src/api/loyaltyApi.ts deleted file mode 100644 index a3018a861..000000000 --- a/src/api/loyaltyApi.ts +++ /dev/null @@ -1,656 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - AccumulateLoyaltyPointsRequest, - accumulateLoyaltyPointsRequestSchema, -} from '../models/accumulateLoyaltyPointsRequest'; -import { - AccumulateLoyaltyPointsResponse, - accumulateLoyaltyPointsResponseSchema, -} from '../models/accumulateLoyaltyPointsResponse'; -import { - AdjustLoyaltyPointsRequest, - adjustLoyaltyPointsRequestSchema, -} from '../models/adjustLoyaltyPointsRequest'; -import { - AdjustLoyaltyPointsResponse, - adjustLoyaltyPointsResponseSchema, -} from '../models/adjustLoyaltyPointsResponse'; -import { - CalculateLoyaltyPointsRequest, - calculateLoyaltyPointsRequestSchema, -} from '../models/calculateLoyaltyPointsRequest'; -import { - CalculateLoyaltyPointsResponse, - calculateLoyaltyPointsResponseSchema, -} from '../models/calculateLoyaltyPointsResponse'; -import { - CancelLoyaltyPromotionResponse, - cancelLoyaltyPromotionResponseSchema, -} from '../models/cancelLoyaltyPromotionResponse'; -import { - CreateLoyaltyAccountRequest, - createLoyaltyAccountRequestSchema, -} from '../models/createLoyaltyAccountRequest'; -import { - CreateLoyaltyAccountResponse, - createLoyaltyAccountResponseSchema, -} from '../models/createLoyaltyAccountResponse'; -import { - CreateLoyaltyPromotionRequest, - createLoyaltyPromotionRequestSchema, -} from '../models/createLoyaltyPromotionRequest'; -import { - CreateLoyaltyPromotionResponse, - createLoyaltyPromotionResponseSchema, -} from '../models/createLoyaltyPromotionResponse'; -import { - CreateLoyaltyRewardRequest, - createLoyaltyRewardRequestSchema, -} from '../models/createLoyaltyRewardRequest'; -import { - CreateLoyaltyRewardResponse, - createLoyaltyRewardResponseSchema, -} from '../models/createLoyaltyRewardResponse'; -import { - DeleteLoyaltyRewardResponse, - deleteLoyaltyRewardResponseSchema, -} from '../models/deleteLoyaltyRewardResponse'; -import { - ListLoyaltyProgramsResponse, - listLoyaltyProgramsResponseSchema, -} from '../models/listLoyaltyProgramsResponse'; -import { - ListLoyaltyPromotionsResponse, - listLoyaltyPromotionsResponseSchema, -} from '../models/listLoyaltyPromotionsResponse'; -import { - RedeemLoyaltyRewardRequest, - redeemLoyaltyRewardRequestSchema, -} from '../models/redeemLoyaltyRewardRequest'; -import { - RedeemLoyaltyRewardResponse, - redeemLoyaltyRewardResponseSchema, -} from '../models/redeemLoyaltyRewardResponse'; -import { - RetrieveLoyaltyAccountResponse, - retrieveLoyaltyAccountResponseSchema, -} from '../models/retrieveLoyaltyAccountResponse'; -import { - RetrieveLoyaltyProgramResponse, - retrieveLoyaltyProgramResponseSchema, -} from '../models/retrieveLoyaltyProgramResponse'; -import { - RetrieveLoyaltyPromotionResponse, - retrieveLoyaltyPromotionResponseSchema, -} from '../models/retrieveLoyaltyPromotionResponse'; -import { - RetrieveLoyaltyRewardResponse, - retrieveLoyaltyRewardResponseSchema, -} from '../models/retrieveLoyaltyRewardResponse'; -import { - SearchLoyaltyAccountsRequest, - searchLoyaltyAccountsRequestSchema, -} from '../models/searchLoyaltyAccountsRequest'; -import { - SearchLoyaltyAccountsResponse, - searchLoyaltyAccountsResponseSchema, -} from '../models/searchLoyaltyAccountsResponse'; -import { - SearchLoyaltyEventsRequest, - searchLoyaltyEventsRequestSchema, -} from '../models/searchLoyaltyEventsRequest'; -import { - SearchLoyaltyEventsResponse, - searchLoyaltyEventsResponseSchema, -} from '../models/searchLoyaltyEventsResponse'; -import { - SearchLoyaltyRewardsRequest, - searchLoyaltyRewardsRequestSchema, -} from '../models/searchLoyaltyRewardsRequest'; -import { - SearchLoyaltyRewardsResponse, - searchLoyaltyRewardsResponseSchema, -} from '../models/searchLoyaltyRewardsResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class LoyaltyApi extends BaseApi { - /** - * Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a - * `mapping` with the `phone_number` of the buyer. - * - * @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 - */ - async createLoyaltyAccount( - body: CreateLoyaltyAccountRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/loyalty/accounts'); - const mapped = req.prepareArgs({ - body: [body, createLoyaltyAccountRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createLoyaltyAccountResponseSchema, requestOptions); - } - - /** - * Searches for loyalty accounts in a loyalty program. - * - * You can search for a loyalty account using the phone number or customer ID associated with the - * account. To return all loyalty accounts, specify an empty `query` object or omit it entirely. - * - * Search results are sorted by `created_at` in ascending order. - * - * @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 - */ - async searchLoyaltyAccounts( - body: SearchLoyaltyAccountsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/loyalty/accounts/search'); - const mapped = req.prepareArgs({ - body: [body, searchLoyaltyAccountsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchLoyaltyAccountsResponseSchema, requestOptions); - } - - /** - * Retrieves a loyalty account. - * - * @param accountId The ID of the [loyalty account](entity:LoyaltyAccount) to retrieve. - * @return Response from the API call - */ - async retrieveLoyaltyAccount( - accountId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ accountId: [accountId, string()] }); - req.appendTemplatePath`/v2/loyalty/accounts/${mapped.accountId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveLoyaltyAccountResponseSchema, requestOptions); - } - - /** - * Adds points earned from a purchase to a [loyalty account]($m/LoyaltyAccount). - * - * - If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order - * to compute the points earned from both the base loyalty program and an associated - * [loyalty promotion]($m/LoyaltyPromotion). For purchases that qualify for multiple accrual - * rules, Square computes points based on the accrual rule that grants the most points. - * For purchases that qualify for multiple promotions, Square computes points based on the most - * recently created promotion. A purchase must first qualify for program points to be eligible for - * promotion points. - * - * - If you are not using the Orders API to manage orders, provide `points` with the number of points - * to add. - * You must first perform a client-side computation of the points earned from the loyalty program and - * loyalty promotion. For spend-based and visit-based programs, you can call - * [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) - * to compute the points earned from the base loyalty program. For information about computing points - * earned from a loyalty promotion, see - * [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty- - * promotions#calculate-promotion-points). - * - * @param accountId The ID of the target [loyalty account](entity: - * LoyaltyAccount). - * @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 - */ - async accumulateLoyaltyPoints( - accountId: string, - body: AccumulateLoyaltyPointsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - accountId: [accountId, string()], - body: [body, accumulateLoyaltyPointsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/loyalty/accounts/${mapped.accountId}/accumulate`; - req.authenticate([{ global: true }]); - return req.callAsJson( - accumulateLoyaltyPointsResponseSchema, - requestOptions - ); - } - - /** - * Adds points to or subtracts points from a buyer's account. - * - * Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, - * you call - * [AccumulateLoyaltyPoints]($e/Loyalty/AccumulateLoyaltyPoints) - * to add points when a buyer pays for the purchase. - * - * @param accountId The ID of the target [loyalty account](entity: - * LoyaltyAccount). - * @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 - */ - async adjustLoyaltyPoints( - accountId: string, - body: AdjustLoyaltyPointsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - accountId: [accountId, string()], - body: [body, adjustLoyaltyPointsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/loyalty/accounts/${mapped.accountId}/adjust`; - req.authenticate([{ global: true }]); - return req.callAsJson(adjustLoyaltyPointsResponseSchema, requestOptions); - } - - /** - * Searches for loyalty events. - * - * A Square loyalty program maintains a ledger of events that occur during the lifetime of a - * buyer's loyalty account. Each change in the point balance - * (for example, points earned, points redeemed, and points expired) is - * recorded in the ledger. Using this endpoint, you can search the ledger for events. - * - * Search results are sorted by `created_at` in descending order. - * - * @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 - */ - async searchLoyaltyEvents( - body: SearchLoyaltyEventsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/loyalty/events/search'); - const mapped = req.prepareArgs({ - body: [body, searchLoyaltyEventsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchLoyaltyEventsResponseSchema, requestOptions); - } - - /** - * Returns a list of loyalty programs in the seller's account. - * Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can - * have only one loyalty program, which is created and managed from the Seller Dashboard. For more - * information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). - * - * - * Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with - * the keyword `main`. - * - * @return Response from the API call - * @deprecated - */ - async listLoyaltyPrograms( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/loyalty/programs'); - req.deprecated('LoyaltyApi.listLoyaltyPrograms'); - req.authenticate([{ global: true }]); - return req.callAsJson(listLoyaltyProgramsResponseSchema, requestOptions); - } - - /** - * Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword - * `main`. - * - * Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can - * have only one loyalty program, which is created and managed from the Seller Dashboard. For more - * information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). - * - * @param programId The ID of the loyalty program or the keyword `main`. Either value can be used to - * retrieve the single loyalty program that belongs to the seller. - * @return Response from the API call - */ - async retrieveLoyaltyProgram( - programId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ programId: [programId, string()] }); - req.appendTemplatePath`/v2/loyalty/programs/${mapped.programId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveLoyaltyProgramResponseSchema, requestOptions); - } - - /** - * Calculates the number of points a buyer can earn from a purchase. Applications might call this - * endpoint - * to display the points to the buyer. - * - * - If you are using the Orders API to manage orders, provide the `order_id` and (optional) - * `loyalty_account_id`. - * Square reads the order to compute the points earned from the base loyalty program and an associated - * [loyalty promotion]($m/LoyaltyPromotion). - * - * - If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the - * purchase amount. Square uses this amount to calculate the points earned from the base loyalty - * program, - * but not points earned from a loyalty promotion. For spend-based and visit-based programs, the - * `tax_mode` - * setting of the accrual rule indicates how taxes should be treated for loyalty points accrual. - * If the purchase qualifies for program points, call - * [ListLoyaltyPromotions]($e/Loyalty/ListLoyaltyPromotions) and perform a client-side computation - * to calculate whether the purchase also qualifies for promotion points. For more information, see - * [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty- - * promotions#calculate-promotion-points). - * - * @param programId The ID of the [loyalty program](entity: - * LoyaltyProgram), which defines the rules for accruing - * points. - * @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 - */ - async calculateLoyaltyPoints( - programId: string, - body: CalculateLoyaltyPointsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - programId: [programId, string()], - body: [body, calculateLoyaltyPointsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/loyalty/programs/${mapped.programId}/calculate`; - req.authenticate([{ global: true }]); - return req.callAsJson(calculateLoyaltyPointsResponseSchema, requestOptions); - } - - /** - * Lists the loyalty promotions associated with a [loyalty program]($m/LoyaltyProgram). - * Results are sorted by the `created_at` date in descending order (newest to oldest). - * - * @param programId The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID, - * call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the - * `main` keyword. - * @param status The status to filter the results by. If a status is provided, only loyalty promotions - * with the specified status are returned. Otherwise, all loyalty promotions associated - * with the loyalty program are returned. - * @param cursor The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. - * For more information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @param limit The maximum number of results to return in a single paged response. The minimum value - * is 1 and the maximum value is 30. The default value is 30. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). - * @return Response from the API call - */ - async listLoyaltyPromotions( - programId: string, - status?: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - programId: [programId, string()], - status: [status, optional(string())], - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('status', mapped.status); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.appendTemplatePath`/v2/loyalty/programs/${mapped.programId}/promotions`; - req.authenticate([{ global: true }]); - return req.callAsJson(listLoyaltyPromotionsResponseSchema, requestOptions); - } - - /** - * Creates a loyalty promotion for a [loyalty program]($m/LoyaltyProgram). A loyalty promotion - * enables buyers to earn points in addition to those earned from the base loyalty program. - * - * This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the - * `available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an - * `ACTIVE` or `SCHEDULED` status. - * - * @param programId The ID of the [loyalty program](entity: - * LoyaltyProgram) to associate with the promotion. To - * get the program ID, call [RetrieveLoyaltyProgram](api- - * endpoint:Loyalty-RetrieveLoyaltyProgram) using the - * `main` keyword. - * @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 - */ - async createLoyaltyPromotion( - programId: string, - body: CreateLoyaltyPromotionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - programId: [programId, string()], - body: [body, createLoyaltyPromotionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/loyalty/programs/${mapped.programId}/promotions`; - req.authenticate([{ global: true }]); - return req.callAsJson(createLoyaltyPromotionResponseSchema, requestOptions); - } - - /** - * Retrieves a loyalty promotion. - * - * @param promotionId The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve. - * @param programId The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID, - * call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the - * `main` keyword. - * @return Response from the API call - */ - async retrieveLoyaltyPromotion( - promotionId: string, - programId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - promotionId: [promotionId, string()], - programId: [programId, string()], - }); - req.appendTemplatePath`/v2/loyalty/programs/${mapped.programId}/promotions/${mapped.promotionId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveLoyaltyPromotionResponseSchema, - requestOptions - ); - } - - /** - * Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the - * end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` - * promotion. - * Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion - * before - * you create a new one. - * - * This endpoint sets the loyalty promotion to the `CANCELED` state - * - * @param promotionId The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can - * cancel a promotion that has an `ACTIVE` or `SCHEDULED` status. - * @param programId The ID of the base [loyalty program](entity:LoyaltyProgram). - * @return Response from the API call - */ - async cancelLoyaltyPromotion( - promotionId: string, - programId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - promotionId: [promotionId, string()], - programId: [programId, string()], - }); - req.appendTemplatePath`/v2/loyalty/programs/${mapped.programId}/promotions/${mapped.promotionId}/cancel`; - req.authenticate([{ global: true }]); - return req.callAsJson(cancelLoyaltyPromotionResponseSchema, requestOptions); - } - - /** - * Creates a loyalty reward. In the process, the endpoint does following: - * - * - Uses the `reward_tier_id` in the request to determine the number of points - * to lock for this reward. - * - If the request includes `order_id`, it adds the reward and related discount to the order. - * - * After a reward is created, the points are locked and - * not available for the buyer to redeem another reward. - * - * @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 - */ - async createLoyaltyReward( - body: CreateLoyaltyRewardRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/loyalty/rewards'); - const mapped = req.prepareArgs({ - body: [body, createLoyaltyRewardRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createLoyaltyRewardResponseSchema, requestOptions); - } - - /** - * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns - * results for all loyalty accounts. - * If you include a `query` object, `loyalty_account_id` is required and `status` is optional. - * - * If you know a reward ID, use the - * [RetrieveLoyaltyReward]($e/Loyalty/RetrieveLoyaltyReward) endpoint. - * - * Search results are sorted by `updated_at` in descending order. - * - * @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 - */ - async searchLoyaltyRewards( - body: SearchLoyaltyRewardsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/loyalty/rewards/search'); - const mapped = req.prepareArgs({ - body: [body, searchLoyaltyRewardsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchLoyaltyRewardsResponseSchema, requestOptions); - } - - /** - * Deletes a loyalty reward by doing the following: - * - * - Returns the loyalty points back to the loyalty account. - * - If an order ID was specified when the reward was created - * (see [CreateLoyaltyReward]($e/Loyalty/CreateLoyaltyReward)), - * it updates the order by removing the reward and related - * discounts. - * - * You cannot delete a reward that has reached the terminal state (REDEEMED). - * - * @param rewardId The ID of the [loyalty reward](entity:LoyaltyReward) to delete. - * @return Response from the API call - */ - async deleteLoyaltyReward( - rewardId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ rewardId: [rewardId, string()] }); - req.appendTemplatePath`/v2/loyalty/rewards/${mapped.rewardId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteLoyaltyRewardResponseSchema, requestOptions); - } - - /** - * Retrieves a loyalty reward. - * - * @param rewardId The ID of the [loyalty reward](entity:LoyaltyReward) to retrieve. - * @return Response from the API call - */ - async retrieveLoyaltyReward( - rewardId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ rewardId: [rewardId, string()] }); - req.appendTemplatePath`/v2/loyalty/rewards/${mapped.rewardId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveLoyaltyRewardResponseSchema, requestOptions); - } - - /** - * Redeems a loyalty reward. - * - * The endpoint sets the reward to the `REDEEMED` terminal state. - * - * If you are using your own order processing system (not using the - * Orders API), you call this endpoint after the buyer paid for the - * purchase. - * - * After the reward reaches the terminal state, it cannot be deleted. - * In other words, points used for the reward cannot be returned - * to the account. - * - * @param rewardId The ID of the [loyalty reward](entity:LoyaltyReward) to - * redeem. - * @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 - */ - async redeemLoyaltyReward( - rewardId: string, - body: RedeemLoyaltyRewardRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - rewardId: [rewardId, string()], - body: [body, redeemLoyaltyRewardRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/loyalty/rewards/${mapped.rewardId}/redeem`; - req.authenticate([{ global: true }]); - return req.callAsJson(redeemLoyaltyRewardResponseSchema, requestOptions); - } -} diff --git a/src/api/merchantCustomAttributesApi.ts b/src/api/merchantCustomAttributesApi.ts deleted file mode 100644 index 208f6ba03..000000000 --- a/src/api/merchantCustomAttributesApi.ts +++ /dev/null @@ -1,487 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkDeleteMerchantCustomAttributesRequest, - bulkDeleteMerchantCustomAttributesRequestSchema, -} from '../models/bulkDeleteMerchantCustomAttributesRequest'; -import { - BulkDeleteMerchantCustomAttributesResponse, - bulkDeleteMerchantCustomAttributesResponseSchema, -} from '../models/bulkDeleteMerchantCustomAttributesResponse'; -import { - BulkUpsertMerchantCustomAttributesRequest, - bulkUpsertMerchantCustomAttributesRequestSchema, -} from '../models/bulkUpsertMerchantCustomAttributesRequest'; -import { - BulkUpsertMerchantCustomAttributesResponse, - bulkUpsertMerchantCustomAttributesResponseSchema, -} from '../models/bulkUpsertMerchantCustomAttributesResponse'; -import { - CreateMerchantCustomAttributeDefinitionRequest, - createMerchantCustomAttributeDefinitionRequestSchema, -} from '../models/createMerchantCustomAttributeDefinitionRequest'; -import { - CreateMerchantCustomAttributeDefinitionResponse, - createMerchantCustomAttributeDefinitionResponseSchema, -} from '../models/createMerchantCustomAttributeDefinitionResponse'; -import { - DeleteMerchantCustomAttributeDefinitionResponse, - deleteMerchantCustomAttributeDefinitionResponseSchema, -} from '../models/deleteMerchantCustomAttributeDefinitionResponse'; -import { - DeleteMerchantCustomAttributeResponse, - deleteMerchantCustomAttributeResponseSchema, -} from '../models/deleteMerchantCustomAttributeResponse'; -import { - ListMerchantCustomAttributeDefinitionsResponse, - listMerchantCustomAttributeDefinitionsResponseSchema, -} from '../models/listMerchantCustomAttributeDefinitionsResponse'; -import { - ListMerchantCustomAttributesResponse, - listMerchantCustomAttributesResponseSchema, -} from '../models/listMerchantCustomAttributesResponse'; -import { - RetrieveMerchantCustomAttributeDefinitionResponse, - retrieveMerchantCustomAttributeDefinitionResponseSchema, -} from '../models/retrieveMerchantCustomAttributeDefinitionResponse'; -import { - RetrieveMerchantCustomAttributeResponse, - retrieveMerchantCustomAttributeResponseSchema, -} from '../models/retrieveMerchantCustomAttributeResponse'; -import { - UpdateMerchantCustomAttributeDefinitionRequest, - updateMerchantCustomAttributeDefinitionRequestSchema, -} from '../models/updateMerchantCustomAttributeDefinitionRequest'; -import { - UpdateMerchantCustomAttributeDefinitionResponse, - updateMerchantCustomAttributeDefinitionResponseSchema, -} from '../models/updateMerchantCustomAttributeDefinitionResponse'; -import { - UpsertMerchantCustomAttributeRequest, - upsertMerchantCustomAttributeRequestSchema, -} from '../models/upsertMerchantCustomAttributeRequest'; -import { - UpsertMerchantCustomAttributeResponse, - upsertMerchantCustomAttributeResponseSchema, -} from '../models/upsertMerchantCustomAttributeResponse'; -import { boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class MerchantCustomAttributesApi extends BaseApi { - /** - * Lists the merchant-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong - * to a Square seller account. - * When all response pages are retrieved, the results include all custom attribute definitions - * that are visible to the requesting application, including those that are created by other - * applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param visibilityFilter Filters the `CustomAttributeDefinition` results by their `visibility` values. - * @param limit The maximum number of results to return in a single paged response. This limit - * is advisory. The response might contain more or fewer results. The minimum - * value is 1 and the maximum value is 100. The default value is 20. For more - * information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @param cursor The cursor returned in the paged response from the previous call to this - * endpoint. Provide this cursor to retrieve the next page of results for your - * original request. For more information, see [Pagination](https://developer. - * squareup.com/docs/build-basics/common-api-patterns/pagination). - * @return Response from the API call - */ - async listMerchantCustomAttributeDefinitions( - visibilityFilter?: string, - limit?: number, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/merchants/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - visibilityFilter: [visibilityFilter, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - }); - req.query('visibility_filter', mapped.visibilityFilter); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson( - listMerchantCustomAttributeDefinitionsResponseSchema, - requestOptions - ); - } - - /** - * Creates a merchant-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square - * seller account. - * Use this endpoint to define a custom attribute that can be associated with a merchant connecting to - * your application. - * A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties - * for a custom attribute. After the definition is created, you can call - * [UpsertMerchantCustomAttribute]($e/MerchantCustomAttributes/UpsertMerchantCustomAttribute) or - * [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) - * to set the custom attribute for a merchant. - * - * @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 - */ - async createMerchantCustomAttributeDefinition( - body: CreateMerchantCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/merchants/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - body: [body, createMerchantCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - createMerchantCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Deletes a merchant-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square - * seller account. - * Deleting a custom attribute definition also deletes the corresponding custom attribute from - * the merchant. - * Only the definition owner can delete a custom attribute definition. - * - * @param key The key of the custom attribute definition to delete. - * @return Response from the API call - */ - async deleteMerchantCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ key: [key, string()] }); - req.appendTemplatePath`/v2/merchants/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteMerchantCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a merchant-related [custom attribute definition]($m/CustomAttributeDefinition) from a - * Square seller account. - * To retrieve a custom attribute definition created by another application, the `visibility` - * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param key The key of the custom attribute definition to retrieve. If the requesting application is - * not the definition owner, you must use the qualified key. - * @param version The current version of the custom attribute definition, which is used for strongly - * consistent reads to guarantee that you receive the most up-to-date data. When included in - * the request, Square returns the specified version or a higher version if one exists. If - * the specified version is higher than the current version, Square returns a `BAD_REQUEST` - * error. - * @return Response from the API call - */ - async retrieveMerchantCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - key: [key, string()], - version: [version, optional(number())], - }); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/merchants/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveMerchantCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Updates a merchant-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square - * seller account. - * Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the - * `schema` for a `Selection` data type. - * Only the definition owner can update a custom attribute definition. - * - * @param key The key of the custom attribute - * definition to update. - * @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 - */ - async updateMerchantCustomAttributeDefinition( - key: string, - body: UpdateMerchantCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - key: [key, string()], - body: [body, updateMerchantCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/merchants/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - updateMerchantCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Deletes [custom attributes]($m/CustomAttribute) for a merchant as a bulk operation. - * To delete a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_WRITE_VALUES`. - * - * @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 - */ - async bulkDeleteMerchantCustomAttributes( - body: BulkDeleteMerchantCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/merchants/custom-attributes/bulk-delete' - ); - const mapped = req.prepareArgs({ - body: [body, bulkDeleteMerchantCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkDeleteMerchantCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates [custom attributes]($m/CustomAttribute) for a merchant as a bulk operation. - * Use this endpoint to set the value of one or more custom attributes for a merchant. - * A custom attribute is based on a custom attribute definition in a Square seller account, which is - * created using the - * [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/CreateMerchantCustomAttributeD - * efinition) endpoint. - * This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert - * requests and returns a map of individual upsert responses. Each upsert request has a unique ID - * and provides a merchant ID and custom attribute. Each upsert response is returned with the ID - * of the corresponding request. - * To create or update a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. - * - * @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 - */ - async bulkUpsertMerchantCustomAttributes( - body: BulkUpsertMerchantCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/merchants/custom-attributes/bulk-upsert' - ); - const mapped = req.prepareArgs({ - body: [body, bulkUpsertMerchantCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkUpsertMerchantCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Lists the [custom attributes]($m/CustomAttribute) associated with a merchant. - * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions - * in the same call. - * When all response pages are retrieved, the results include all custom attributes that are - * visible to the requesting application, including those that are owned by other applications - * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param merchantId The ID of the target [merchant](entity:Merchant). - * @param visibilityFilter Filters the `CustomAttributeDefinition` results by their `visibility` values. - * @param limit The maximum number of results to return in a single paged response. This - * limit is advisory. The response might contain more or fewer results. The - * minimum value is 1 and the maximum value is 100. The default value is 20. For - * more information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @param cursor The cursor returned in the paged response from the previous call to this - * endpoint. Provide this cursor to retrieve the next page of results for your - * original request. For more information, see [Pagination](https://developer. - * squareup.com/docs/build-basics/common-api-patterns/pagination). - * @param withDefinitions Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of each custom attribute. - * Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @return Response from the API call - */ - async listMerchantCustomAttributes( - merchantId: string, - visibilityFilter?: string, - limit?: number, - cursor?: string, - withDefinitions?: boolean, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - merchantId: [merchantId, string()], - visibilityFilter: [visibilityFilter, optional(string())], - limit: [limit, optional(number())], - cursor: [cursor, optional(string())], - withDefinitions: [withDefinitions, optional(boolean())], - }); - req.query('visibility_filter', mapped.visibilityFilter); - req.query('limit', mapped.limit); - req.query('cursor', mapped.cursor); - req.query('with_definitions', mapped.withDefinitions); - req.appendTemplatePath`/v2/merchants/${mapped.merchantId}/custom-attributes`; - req.authenticate([{ global: true }]); - return req.callAsJson( - listMerchantCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Deletes a [custom attribute]($m/CustomAttribute) associated with a merchant. - * To delete a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_WRITE_VALUES`. - * - * @param merchantId The ID of the target [merchant](entity:Merchant). - * @param key The key of the custom attribute to delete. This key must match the `key` of a custom - * attribute definition in the Square seller account. If the requesting application is - * not the definition owner, you must use the qualified key. - * @return Response from the API call - */ - async deleteMerchantCustomAttribute( - merchantId: string, - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - merchantId: [merchantId, string()], - key: [key, string()], - }); - req.appendTemplatePath`/v2/merchants/${mapped.merchantId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteMerchantCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a [custom attribute]($m/CustomAttribute) associated with a merchant. - * You can use the `with_definition` query parameter to also retrieve the custom attribute definition - * in the same call. - * To retrieve a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param merchantId The ID of the target [merchant](entity:Merchant). - * @param key The key of the custom attribute to retrieve. This key must match the `key` of a - * custom attribute definition in the Square seller account. If the requesting - * application is not the definition owner, you must use the qualified key. - * @param withDefinition Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of the custom attribute. - * Set this parameter to `true` to get the name and description of the custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @param version The current version of the custom attribute, which is used for strongly - * consistent reads to guarantee that you receive the most up-to-date data. When - * included in the request, Square returns the specified version or a higher - * version if one exists. If the specified version is higher than the current - * version, Square returns a `BAD_REQUEST` error. - * @return Response from the API call - */ - async retrieveMerchantCustomAttribute( - merchantId: string, - key: string, - withDefinition?: boolean, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - merchantId: [merchantId, string()], - key: [key, string()], - withDefinition: [withDefinition, optional(boolean())], - version: [version, optional(number())], - }); - req.query('with_definition', mapped.withDefinition); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/merchants/${mapped.merchantId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveMerchantCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates a [custom attribute]($m/CustomAttribute) for a merchant. - * Use this endpoint to set the value of a custom attribute for a specified merchant. - * A custom attribute is based on a custom attribute definition in a Square seller account, which - * is created using the - * [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/CreateMerchantCustomAttributeD - * efinition) endpoint. - * To create or update a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. - * - * @param merchantId The ID of the target [merchant](entity: - * Merchant). - * @param key The key of the custom attribute to create or - * update. This key must match the `key` of a - * custom attribute definition in the Square - * seller account. If the requesting application - * is not the definition owner, you must use the - * qualified key. - * @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 - */ - async upsertMerchantCustomAttribute( - merchantId: string, - key: string, - body: UpsertMerchantCustomAttributeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - merchantId: [merchantId, string()], - key: [key, string()], - body: [body, upsertMerchantCustomAttributeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/merchants/${mapped.merchantId}/custom-attributes/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - upsertMerchantCustomAttributeResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/merchantsApi.ts b/src/api/merchantsApi.ts deleted file mode 100644 index dd8a90fa0..000000000 --- a/src/api/merchantsApi.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - ListMerchantsResponse, - listMerchantsResponseSchema, -} from '../models/listMerchantsResponse'; -import { - RetrieveMerchantResponse, - retrieveMerchantResponseSchema, -} from '../models/retrieveMerchantResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class MerchantsApi extends BaseApi { - /** - * Provides details about the merchant associated with a given access token. - * - * The access token used to connect your application to a Square seller is associated - * with a single merchant. That means that `ListMerchants` returns a list - * with a single `Merchant` object. You can specify your personal access token - * to get your own merchant information or specify an OAuth token to get the - * information for the merchant that granted your application access. - * - * If you know the merchant ID, you can also use the [RetrieveMerchant]($e/Merchants/RetrieveMerchant) - * endpoint to retrieve the merchant information. - * - * @param cursor The cursor generated by the previous response. - * @return Response from the API call - */ - async listMerchants( - cursor?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/merchants'); - const mapped = req.prepareArgs({ cursor: [cursor, optional(number())] }); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson(listMerchantsResponseSchema, requestOptions); - } - - /** - * Retrieves the `Merchant` object for the given `merchant_id`. - * - * @param merchantId The ID of the merchant to retrieve. If the string "me" is supplied as the ID, then - * retrieve the merchant that is currently accessible to this call. - * @return Response from the API call - */ - async retrieveMerchant( - merchantId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ merchantId: [merchantId, string()] }); - req.appendTemplatePath`/v2/merchants/${mapped.merchantId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveMerchantResponseSchema, requestOptions); - } -} diff --git a/src/api/mobileAuthorizationApi.ts b/src/api/mobileAuthorizationApi.ts deleted file mode 100644 index 5b321b0d3..000000000 --- a/src/api/mobileAuthorizationApi.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateMobileAuthorizationCodeRequest, - createMobileAuthorizationCodeRequestSchema, -} from '../models/createMobileAuthorizationCodeRequest'; -import { - CreateMobileAuthorizationCodeResponse, - createMobileAuthorizationCodeResponseSchema, -} from '../models/createMobileAuthorizationCodeResponse'; -import { BaseApi } from './baseApi'; - -export class MobileAuthorizationApi extends BaseApi { - /** - * Generates code to authorize a mobile application to connect to a Square card reader. - * - * Authorization codes are one-time-use codes and expire 60 minutes after being issued. - * - * __Important:__ The `Authorization` header you provide to this endpoint must have the following - * format: - * - * ``` - * Authorization: Bearer ACCESS_TOKEN - * ``` - * - * Replace `ACCESS_TOKEN` with a - * [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access- - * tokens). - * - * @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 - */ - async createMobileAuthorizationCode( - body: CreateMobileAuthorizationCodeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/mobile/authorization-code'); - const mapped = req.prepareArgs({ - body: [body, createMobileAuthorizationCodeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - createMobileAuthorizationCodeResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/oAuthApi.ts b/src/api/oAuthApi.ts deleted file mode 100644 index 309b6bcc0..000000000 --- a/src/api/oAuthApi.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - ObtainTokenRequest, - obtainTokenRequestSchema, -} from '../models/obtainTokenRequest'; -import { - ObtainTokenResponse, - obtainTokenResponseSchema, -} from '../models/obtainTokenResponse'; -import { - RetrieveTokenStatusResponse, - retrieveTokenStatusResponseSchema, -} from '../models/retrieveTokenStatusResponse'; -import { - RevokeTokenRequest, - revokeTokenRequestSchema, -} from '../models/revokeTokenRequest'; -import { - RevokeTokenResponse, - revokeTokenResponseSchema, -} from '../models/revokeTokenResponse'; -import { string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class OAuthApi extends BaseApi { - /** - * Revokes an access token generated with the OAuth flow. - * - * If an account has more than one OAuth access token for your application, this - * endpoint revokes all of them, regardless of which token you specify. - * - * __Important:__ The `Authorization` header for this endpoint must have the - * following format: - * - * ``` - * Authorization: Client APPLICATION_SECRET - * ``` - * - * Replace `APPLICATION_SECRET` with the application secret on the **OAuth** - * page for your application in the Developer Dashboard. - * - * @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 - * @return Response from the API call - */ - async revokeToken( - body: RevokeTokenRequest, - authorization: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/oauth2/revoke'); - const mapped = req.prepareArgs({ - body: [body, revokeTokenRequestSchema], - authorization: [authorization, string()], - }); - req.header('Content-Type', 'application/json'); - req.header('Authorization', mapped.authorization); - req.json(mapped.body); - req.authenticate(false); - return req.callAsJson(revokeTokenResponseSchema, requestOptions); - } - - /** - * Returns an OAuth access token and a refresh token unless the - * `short_lived` parameter is set to `true`, in which case the endpoint - * 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'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. - * - * You can use the `scopes` parameter to limit the set of permissions granted - * to the access token and refresh token. You can use the `short_lived` parameter - * to create an access token that expires in 24 hours. - * - * __Note:__ OAuth tokens should be encrypted and stored on a secure server. - * Application clients should never interact directly with OAuth tokens. - * - * @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 - */ - async obtainToken( - body: ObtainTokenRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/oauth2/token'); - const mapped = req.prepareArgs({ body: [body, obtainTokenRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate(false); - return req.callAsJson(obtainTokenResponseSchema, requestOptions); - } - - /** - * Returns information about an [OAuth access token](https://developer.squareup.com/docs/build- - * basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https: - * //developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token). - * - * Add the access token to the Authorization header of the request. - * - * __Important:__ The `Authorization` header you provide to this endpoint must have the following - * format: - * - * ``` - * Authorization: Bearer ACCESS_TOKEN - * ``` - * - * where `ACCESS_TOKEN` is a - * [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access- - * tokens). - * - * If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` - * error. - * - * @return Response from the API call - */ - async retrieveTokenStatus( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/oauth2/token/status'); - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveTokenStatusResponseSchema, requestOptions); - } -} diff --git a/src/api/orderCustomAttributesApi.ts b/src/api/orderCustomAttributesApi.ts deleted file mode 100644 index 7901bd7b6..000000000 --- a/src/api/orderCustomAttributesApi.ts +++ /dev/null @@ -1,509 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkDeleteOrderCustomAttributesRequest, - bulkDeleteOrderCustomAttributesRequestSchema, -} from '../models/bulkDeleteOrderCustomAttributesRequest'; -import { - BulkDeleteOrderCustomAttributesResponse, - bulkDeleteOrderCustomAttributesResponseSchema, -} from '../models/bulkDeleteOrderCustomAttributesResponse'; -import { - BulkUpsertOrderCustomAttributesRequest, - bulkUpsertOrderCustomAttributesRequestSchema, -} from '../models/bulkUpsertOrderCustomAttributesRequest'; -import { - BulkUpsertOrderCustomAttributesResponse, - bulkUpsertOrderCustomAttributesResponseSchema, -} from '../models/bulkUpsertOrderCustomAttributesResponse'; -import { - CreateOrderCustomAttributeDefinitionRequest, - createOrderCustomAttributeDefinitionRequestSchema, -} from '../models/createOrderCustomAttributeDefinitionRequest'; -import { - CreateOrderCustomAttributeDefinitionResponse, - createOrderCustomAttributeDefinitionResponseSchema, -} from '../models/createOrderCustomAttributeDefinitionResponse'; -import { - DeleteOrderCustomAttributeDefinitionResponse, - deleteOrderCustomAttributeDefinitionResponseSchema, -} from '../models/deleteOrderCustomAttributeDefinitionResponse'; -import { - DeleteOrderCustomAttributeResponse, - deleteOrderCustomAttributeResponseSchema, -} from '../models/deleteOrderCustomAttributeResponse'; -import { - ListOrderCustomAttributeDefinitionsResponse, - listOrderCustomAttributeDefinitionsResponseSchema, -} from '../models/listOrderCustomAttributeDefinitionsResponse'; -import { - ListOrderCustomAttributesResponse, - listOrderCustomAttributesResponseSchema, -} from '../models/listOrderCustomAttributesResponse'; -import { - RetrieveOrderCustomAttributeDefinitionResponse, - retrieveOrderCustomAttributeDefinitionResponseSchema, -} from '../models/retrieveOrderCustomAttributeDefinitionResponse'; -import { - RetrieveOrderCustomAttributeResponse, - retrieveOrderCustomAttributeResponseSchema, -} from '../models/retrieveOrderCustomAttributeResponse'; -import { - UpdateOrderCustomAttributeDefinitionRequest, - updateOrderCustomAttributeDefinitionRequestSchema, -} from '../models/updateOrderCustomAttributeDefinitionRequest'; -import { - UpdateOrderCustomAttributeDefinitionResponse, - updateOrderCustomAttributeDefinitionResponseSchema, -} from '../models/updateOrderCustomAttributeDefinitionResponse'; -import { - UpsertOrderCustomAttributeRequest, - upsertOrderCustomAttributeRequestSchema, -} from '../models/upsertOrderCustomAttributeRequest'; -import { - UpsertOrderCustomAttributeResponse, - upsertOrderCustomAttributeResponseSchema, -} from '../models/upsertOrderCustomAttributeResponse'; -import { boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class OrderCustomAttributesApi extends BaseApi { - /** - * Lists the order-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong to - * a Square seller account. - * - * When all response pages are retrieved, the results include all custom attribute definitions - * that are visible to the requesting application, including those that are created by other - * applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that - * seller-defined custom attributes (also known as custom fields) are always set to - * `VISIBILITY_READ_WRITE_VALUES`. - * - * @param visibilityFilter Requests that all of the custom attributes be returned, or only those that are - * read-only or read-write. - * @param cursor The cursor returned in the paged response from the previous call to this - * endpoint. Provide this cursor to retrieve the next page of results for your - * original request. For more information, see [Pagination](https://developer. - * squareup.com/docs/working-with-apis/pagination). - * @param limit The maximum number of results to return in a single paged response. This limit - * is advisory. The response might contain more or fewer results. The minimum - * value is 1 and the maximum value is 100. The default value is 20. For more - * information, see [Pagination](https://developer.squareup.com/docs/working-with- - * apis/pagination). - * @return Response from the API call - */ - async listOrderCustomAttributeDefinitions( - visibilityFilter?: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'GET', - '/v2/orders/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - visibilityFilter: [visibilityFilter, optional(string())], - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('visibility_filter', mapped.visibilityFilter); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.authenticate([{ global: true }]); - return req.callAsJson( - listOrderCustomAttributeDefinitionsResponseSchema, - requestOptions - ); - } - - /** - * Creates an order-related custom attribute definition. Use this endpoint to - * define a custom attribute that can be associated with orders. - * - * After creating a custom attribute definition, you can set the custom attribute for orders - * in the Square seller account. - * - * @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 - */ - async createOrderCustomAttributeDefinition( - body: CreateOrderCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/orders/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - body: [body, createOrderCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - createOrderCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Deletes an order-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square - * seller account. - * - * Only the definition owner can delete a custom attribute definition. - * - * @param key The key of the custom attribute definition to delete. - * @return Response from the API call - */ - async deleteOrderCustomAttributeDefinition( - key: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ key: [key, string()] }); - req.appendTemplatePath`/v2/orders/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteOrderCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Retrieves an order-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square - * seller account. - * - * To retrieve a custom attribute definition created by another application, the `visibility` - * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined - * custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @param key The key of the custom attribute definition to retrieve. - * @param version To enable [optimistic concurrency](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/optimistic-concurrency) control, include this optional field - * and specify the current version of the custom attribute. - * @return Response from the API call - */ - async retrieveOrderCustomAttributeDefinition( - key: string, - version?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - key: [key, string()], - version: [version, optional(number())], - }); - req.query('version', mapped.version); - req.appendTemplatePath`/v2/orders/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveOrderCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Updates an order-related custom attribute definition for a Square seller account. - * - * Only the definition owner can update a custom attribute definition. Note that sellers can view all - * custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. - * - * @param key The key of the custom attribute - * definition to update. - * @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 - */ - async updateOrderCustomAttributeDefinition( - key: string, - body: UpdateOrderCustomAttributeDefinitionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - key: [key, string()], - body: [body, updateOrderCustomAttributeDefinitionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/orders/custom-attribute-definitions/${mapped.key}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - updateOrderCustomAttributeDefinitionResponseSchema, - requestOptions - ); - } - - /** - * Deletes order [custom attributes]($m/CustomAttribute) as a bulk operation. - * - * Use this endpoint to delete one or more custom attributes from one or more orders. - * A custom attribute is based on a custom attribute definition in a Square seller account. (To create - * a - * custom attribute definition, use the - * [CreateOrderCustomAttributeDefinition]($e/OrderCustomAttributes/CreateOrderCustomAttributeDefinition - * ) endpoint.) - * - * This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete - * requests and returns a map of individual delete responses. Each delete request has a unique ID - * and provides an order ID and custom attribute. Each delete response is returned with the ID - * of the corresponding request. - * - * To delete a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @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 - */ - async bulkDeleteOrderCustomAttributes( - body: BulkDeleteOrderCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/orders/custom-attributes/bulk-delete' - ); - const mapped = req.prepareArgs({ - body: [body, bulkDeleteOrderCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkDeleteOrderCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates order [custom attributes]($m/CustomAttribute) as a bulk operation. - * - * Use this endpoint to delete one or more custom attributes from one or more orders. - * A custom attribute is based on a custom attribute definition in a Square seller account. (To create - * a - * custom attribute definition, use the - * [CreateOrderCustomAttributeDefinition]($e/OrderCustomAttributes/CreateOrderCustomAttributeDefinition - * ) endpoint.) - * - * This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert - * requests and returns a map of individual upsert responses. Each upsert request has a unique ID - * and provides an order ID and custom attribute. Each upsert response is returned with the ID - * of the corresponding request. - * - * To create or update a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @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 - */ - async bulkUpsertOrderCustomAttributes( - body: BulkUpsertOrderCustomAttributesRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest( - 'POST', - '/v2/orders/custom-attributes/bulk-upsert' - ); - const mapped = req.prepareArgs({ - body: [body, bulkUpsertOrderCustomAttributesRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - bulkUpsertOrderCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Lists the [custom attributes]($m/CustomAttribute) associated with an order. - * - * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions - * in the same call. - * - * When all response pages are retrieved, the results include all custom attributes that are - * visible to the requesting application, including those that are owned by other applications - * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - * - * @param orderId The ID of the target [order](entity:Order). - * @param visibilityFilter Requests that all of the custom attributes be returned, or only those that - * are read-only or read-write. - * @param cursor The cursor returned in the paged response from the previous call to this - * endpoint. Provide this cursor to retrieve the next page of results for your - * original request. For more information, see [Pagination](https://developer. - * squareup.com/docs/working-with-apis/pagination). - * @param limit The maximum number of results to return in a single paged response. This - * limit is advisory. The response might contain more or fewer results. The - * minimum value is 1 and the maximum value is 100. The default value is 20. For - * more information, see [Pagination](https://developer.squareup.com/docs/working- - * with-apis/pagination). - * @param withDefinitions Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of each custom attribute. - * Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The - * default value is `false`. - * @return Response from the API call - */ - async listOrderCustomAttributes( - orderId: string, - visibilityFilter?: string, - cursor?: string, - limit?: number, - withDefinitions?: boolean, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - orderId: [orderId, string()], - visibilityFilter: [visibilityFilter, optional(string())], - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - withDefinitions: [withDefinitions, optional(boolean())], - }); - req.query('visibility_filter', mapped.visibilityFilter); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.query('with_definitions', mapped.withDefinitions); - req.appendTemplatePath`/v2/orders/${mapped.orderId}/custom-attributes`; - req.authenticate([{ global: true }]); - return req.callAsJson( - listOrderCustomAttributesResponseSchema, - requestOptions - ); - } - - /** - * Deletes a [custom attribute]($m/CustomAttribute) associated with a customer profile. - * - * To delete a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @param orderId The ID of the target [order](entity:Order). - * @param customAttributeKey The key of the custom attribute to delete. This key must match the key of - * an existing custom attribute definition. - * @return Response from the API call - */ - async deleteOrderCustomAttribute( - orderId: string, - customAttributeKey: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - orderId: [orderId, string()], - customAttributeKey: [customAttributeKey, string()], - }); - req.appendTemplatePath`/v2/orders/${mapped.orderId}/custom-attributes/${mapped.customAttributeKey}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteOrderCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a [custom attribute]($m/CustomAttribute) associated with an order. - * - * You can use the `with_definition` query parameter to also retrieve the custom attribute definition - * in the same call. - * - * To retrieve a custom attribute owned by another application, the `visibility` setting must be - * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom - * attributes - * also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @param orderId The ID of the target [order](entity:Order). - * @param customAttributeKey The key of the custom attribute to retrieve. This key must match the key - * of an existing custom attribute definition. - * @param version To enable [optimistic concurrency](https://developer.squareup. - * com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, - * include this optional field and specify the current version of the custom - * attribute. - * @param withDefinition Indicates whether to return the [custom attribute definition](entity: - * CustomAttributeDefinition) in the `definition` field of each custom - * attribute. Set this parameter to `true` to get the name and description of - * each custom attribute, information about the data type, or other - * definition details. The default value is `false`. - * @return Response from the API call - */ - async retrieveOrderCustomAttribute( - orderId: string, - customAttributeKey: string, - version?: number, - withDefinition?: boolean, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - orderId: [orderId, string()], - customAttributeKey: [customAttributeKey, string()], - version: [version, optional(number())], - withDefinition: [withDefinition, optional(boolean())], - }); - req.query('version', mapped.version); - req.query('with_definition', mapped.withDefinition); - req.appendTemplatePath`/v2/orders/${mapped.orderId}/custom-attributes/${mapped.customAttributeKey}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveOrderCustomAttributeResponseSchema, - requestOptions - ); - } - - /** - * Creates or updates a [custom attribute]($m/CustomAttribute) for an order. - * - * Use this endpoint to set the value of a custom attribute for a specific order. - * A custom attribute is based on a custom attribute definition in a Square seller account. (To create - * a - * custom attribute definition, use the - * [CreateOrderCustomAttributeDefinition]($e/OrderCustomAttributes/CreateOrderCustomAttributeDefinition - * ) endpoint.) - * - * To create or update a custom attribute owned by another application, the `visibility` setting - * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes - * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. - * - * @param orderId The ID of the target [order](entity: - * Order). - * @param customAttributeKey The key of the custom attribute to create - * or update. This key must match the key - * of an existing custom attribute definition. - * @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 - */ - async upsertOrderCustomAttribute( - orderId: string, - customAttributeKey: string, - body: UpsertOrderCustomAttributeRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - orderId: [orderId, string()], - customAttributeKey: [customAttributeKey, string()], - body: [body, upsertOrderCustomAttributeRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/orders/${mapped.orderId}/custom-attributes/${mapped.customAttributeKey}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - upsertOrderCustomAttributeResponseSchema, - requestOptions - ); - } -} diff --git a/src/api/ordersApi.ts b/src/api/ordersApi.ts deleted file mode 100644 index 015c2582a..000000000 --- a/src/api/ordersApi.ts +++ /dev/null @@ -1,289 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BatchRetrieveOrdersRequest, - batchRetrieveOrdersRequestSchema, -} from '../models/batchRetrieveOrdersRequest'; -import { - BatchRetrieveOrdersResponse, - batchRetrieveOrdersResponseSchema, -} from '../models/batchRetrieveOrdersResponse'; -import { - CalculateOrderRequest, - calculateOrderRequestSchema, -} from '../models/calculateOrderRequest'; -import { - CalculateOrderResponse, - calculateOrderResponseSchema, -} from '../models/calculateOrderResponse'; -import { - CloneOrderRequest, - cloneOrderRequestSchema, -} from '../models/cloneOrderRequest'; -import { - CloneOrderResponse, - cloneOrderResponseSchema, -} from '../models/cloneOrderResponse'; -import { - CreateOrderRequest, - createOrderRequestSchema, -} from '../models/createOrderRequest'; -import { - CreateOrderResponse, - createOrderResponseSchema, -} from '../models/createOrderResponse'; -import { - PayOrderRequest, - payOrderRequestSchema, -} from '../models/payOrderRequest'; -import { - PayOrderResponse, - payOrderResponseSchema, -} from '../models/payOrderResponse'; -import { - RetrieveOrderResponse, - retrieveOrderResponseSchema, -} from '../models/retrieveOrderResponse'; -import { - SearchOrdersRequest, - searchOrdersRequestSchema, -} from '../models/searchOrdersRequest'; -import { - SearchOrdersResponse, - searchOrdersResponseSchema, -} from '../models/searchOrdersResponse'; -import { - UpdateOrderRequest, - updateOrderRequestSchema, -} from '../models/updateOrderRequest'; -import { - UpdateOrderResponse, - updateOrderResponseSchema, -} from '../models/updateOrderResponse'; -import { string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class OrdersApi extends BaseApi { - /** - * Creates a new [order]($m/Order) that can include information about products for - * purchase and settings to apply to the purchase. - * - * To pay for a created order, see - * [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). - * - * You can modify open orders using the [UpdateOrder]($e/Orders/UpdateOrder) endpoint. - * - * @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 - */ - async createOrder( - body: CreateOrderRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/orders'); - const mapped = req.prepareArgs({ body: [body, createOrderRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createOrderResponseSchema, requestOptions); - } - - /** - * Retrieves a set of [orders]($m/Order) by their IDs. - * - * If a given order ID does not exist, the ID is ignored instead of generating an error. - * - * @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 - */ - async batchRetrieveOrders( - body: BatchRetrieveOrdersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/orders/batch-retrieve'); - const mapped = req.prepareArgs({ - body: [body, batchRetrieveOrdersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(batchRetrieveOrdersResponseSchema, requestOptions); - } - - /** - * Enables applications to preview order pricing without creating an order. - * - * @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 - */ - async calculateOrder( - body: CalculateOrderRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/orders/calculate'); - const mapped = req.prepareArgs({ - body: [body, calculateOrderRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(calculateOrderResponseSchema, requestOptions); - } - - /** - * Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order - * has - * only the core fields (such as line items, taxes, and discounts) copied from the original order. - * - * @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 - */ - async cloneOrder( - body: CloneOrderRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/orders/clone'); - const mapped = req.prepareArgs({ body: [body, cloneOrderRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(cloneOrderResponseSchema, requestOptions); - } - - /** - * Search all orders for one or more locations. Orders include all sales, - * returns, and exchanges regardless of how or when they entered the Square - * ecosystem (such as Point of Sale, Invoices, and Connect APIs). - * - * `SearchOrders` requests need to specify which locations to search and define a - * [SearchOrdersQuery]($m/SearchOrdersQuery) object that controls - * how to sort or filter the results. Your `SearchOrdersQuery` can: - * - * Set filter criteria. - * Set the sort order. - * Determine whether to return results as complete `Order` objects or as - * [OrderEntry]($m/OrderEntry) objects. - * - * Note that details for orders processed with Square Point of Sale while in - * offline mode might not be transmitted to Square for up to 72 hours. Offline - * orders have a `created_at` value that reflects the time the order was created, - * not the time it was subsequently transmitted to Square. - * - * @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 - */ - async searchOrders( - body: SearchOrdersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/orders/search'); - const mapped = req.prepareArgs({ body: [body, searchOrdersRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchOrdersResponseSchema, requestOptions); - } - - /** - * Retrieves an [Order]($m/Order) by ID. - * - * @param orderId The ID of the order to retrieve. - * @return Response from the API call - */ - async retrieveOrder( - orderId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ orderId: [orderId, string()] }); - req.appendTemplatePath`/v2/orders/${mapped.orderId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveOrderResponseSchema, requestOptions); - } - - /** - * Updates an open [order]($m/Order) by adding, replacing, or deleting - * fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. - * - * An `UpdateOrder` request requires the following: - * - * - The `order_id` in the endpoint path, identifying the order to update. - * - The latest `version` of the order to update. - * - The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update- - * orders#sparse-order-objects) - * containing only the fields to update and the version to which the update is - * being applied. - * - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage- - * orders/update-orders#identifying-fields-to-delete) - * identifying the fields to clear. - * - * To pay for an order, see - * [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). - * - * @param orderId The ID of the order to update. - * @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 - */ - async updateOrder( - orderId: string, - body: UpdateOrderRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - orderId: [orderId, string()], - body: [body, updateOrderRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/orders/${mapped.orderId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateOrderResponseSchema, requestOptions); - } - - /** - * Pay for an [order]($m/Order) using one or more approved [payments]($m/Payment) - * or settle an order with a total of `0`. - * - * The total of the `payment_ids` listed in the request must be equal to the order - * total. Orders with a total amount of `0` can be marked as paid by specifying an empty - * array of `payment_ids` in the request. - * - * To be used with `PayOrder`, a payment must: - * - * - Reference the order by specifying the `order_id` when [creating the - * payment]($e/Payments/CreatePayment). - * Any approved payments that reference the same `order_id` not specified in the - * `payment_ids` is canceled. - * - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take- - * payments/card-payments/delayed-capture). - * Using a delayed capture payment with `PayOrder` completes the approved payment. - * - * @param orderId The ID of the order being paid. - * @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 - */ - async payOrder( - orderId: string, - body: PayOrderRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - orderId: [orderId, string()], - body: [body, payOrderRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/orders/${mapped.orderId}/pay`; - req.authenticate([{ global: true }]); - return req.callAsJson(payOrderResponseSchema, requestOptions); - } -} diff --git a/src/api/paymentsApi.ts b/src/api/paymentsApi.ts deleted file mode 100644 index 852d12f7c..000000000 --- a/src/api/paymentsApi.ts +++ /dev/null @@ -1,309 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CancelPaymentByIdempotencyKeyRequest, - cancelPaymentByIdempotencyKeyRequestSchema, -} from '../models/cancelPaymentByIdempotencyKeyRequest'; -import { - CancelPaymentByIdempotencyKeyResponse, - cancelPaymentByIdempotencyKeyResponseSchema, -} from '../models/cancelPaymentByIdempotencyKeyResponse'; -import { - CancelPaymentResponse, - cancelPaymentResponseSchema, -} from '../models/cancelPaymentResponse'; -import { - CompletePaymentRequest, - completePaymentRequestSchema, -} from '../models/completePaymentRequest'; -import { - CompletePaymentResponse, - completePaymentResponseSchema, -} from '../models/completePaymentResponse'; -import { - CreatePaymentRequest, - createPaymentRequestSchema, -} from '../models/createPaymentRequest'; -import { - CreatePaymentResponse, - createPaymentResponseSchema, -} from '../models/createPaymentResponse'; -import { - GetPaymentResponse, - getPaymentResponseSchema, -} from '../models/getPaymentResponse'; -import { - ListPaymentsResponse, - listPaymentsResponseSchema, -} from '../models/listPaymentsResponse'; -import { - UpdatePaymentRequest, - updatePaymentRequestSchema, -} from '../models/updatePaymentRequest'; -import { - UpdatePaymentResponse, - updatePaymentResponseSchema, -} from '../models/updatePaymentResponse'; -import { bigint, boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class PaymentsApi extends BaseApi { - /** - * Retrieves a list of payments taken by the account making the request. - * - * Results are eventually consistent, and new payments or changes to payments might take several - * seconds to appear. - * - * The maximum results per page is 100. - * - * @param beginTime Indicates the start of the time range to retrieve payments for, in RFC - * 3339 format. The range is determined using the `created_at` field for - * each Payment. Inclusive. Default: The current time minus one year. - * @param endTime Indicates the end of the time range to retrieve payments for, in RFC 3339 - * format. The range is determined using the `created_at` field for each - * Payment. Default: The current time. - * @param sortOrder The order in which results are listed by `ListPaymentsRequest.sort_field`: - * - `ASC` - Oldest to newest. - `DESC` - Newest to oldest (default). - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide - * this cursor to retrieve the next set of results for the original query. - * For more information, see [Pagination](https://developer.squareup. - * com/docs/build-basics/common-api-patterns/pagination). - * @param locationId Limit results to the location supplied. By default, results are returned - * for the default (main) location associated with the seller. - * @param total The exact amount in the `total_money` for a payment. - * @param last4 The last four digits of a payment card. - * @param cardBrand The brand of the payment card (for example, VISA). - * @param limit The maximum number of results to be returned in a single page. It is - * possible to receive fewer results than the specified limit on a given page. - * The default value of 100 is also the maximum allowed value. If the - * provided value is greater than 100, it is ignored and the default value - * is used instead. Default: `100` - * @param isOfflinePayment Whether the payment was taken offline or not. - * @param offlineBeginTime Indicates the start of the time range for which to retrieve offline - * payments, in RFC 3339 format for timestamps. The range is determined using - * the `offline_payment_details.client_created_at` field for each Payment. If - * set, payments without a value set in `offline_payment_details. - * client_created_at` will not be returned. Default: The current time. - * @param offlineEndTime Indicates the end of the time range for which to retrieve offline - * payments, in RFC 3339 format for timestamps. The range is determined using - * the `offline_payment_details.client_created_at` field for each Payment. If - * set, payments without a value set in `offline_payment_details. - * client_created_at` will not be returned. Default: The current time. - * @param updatedAtBeginTime Indicates the start of the time range to retrieve payments for, in RFC - * 3339 format. The range is determined using the `updated_at` field for - * each Payment. - * @param updatedAtEndTime Indicates the end of the time range to retrieve payments for, in RFC 3339 - * format. The range is determined using the `updated_at` field for each - * Payment. - * @param sortField The field used to sort results by. The default is `CREATED_AT`. - * @return Response from the API call - */ - async listPayments( - beginTime?: string, - endTime?: string, - sortOrder?: string, - cursor?: string, - locationId?: string, - total?: bigint, - last4?: string, - cardBrand?: string, - limit?: number, - isOfflinePayment?: boolean, - offlineBeginTime?: string, - offlineEndTime?: string, - updatedAtBeginTime?: string, - updatedAtEndTime?: string, - sortField?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/payments'); - const mapped = req.prepareArgs({ - beginTime: [beginTime, optional(string())], - endTime: [endTime, optional(string())], - sortOrder: [sortOrder, optional(string())], - cursor: [cursor, optional(string())], - locationId: [locationId, optional(string())], - total: [total, optional(bigint())], - last4: [last4, optional(string())], - cardBrand: [cardBrand, optional(string())], - limit: [limit, optional(number())], - isOfflinePayment: [isOfflinePayment, optional(boolean())], - offlineBeginTime: [offlineBeginTime, optional(string())], - offlineEndTime: [offlineEndTime, optional(string())], - updatedAtBeginTime: [updatedAtBeginTime, optional(string())], - updatedAtEndTime: [updatedAtEndTime, optional(string())], - sortField: [sortField, optional(string())], - }); - req.query('begin_time', mapped.beginTime); - req.query('end_time', mapped.endTime); - req.query('sort_order', mapped.sortOrder); - req.query('cursor', mapped.cursor); - req.query('location_id', mapped.locationId); - req.query('total', mapped.total); - req.query('last_4', mapped.last4); - req.query('card_brand', mapped.cardBrand); - req.query('limit', mapped.limit); - req.query('is_offline_payment', mapped.isOfflinePayment); - req.query('offline_begin_time', mapped.offlineBeginTime); - req.query('offline_end_time', mapped.offlineEndTime); - req.query('updated_at_begin_time', mapped.updatedAtBeginTime); - req.query('updated_at_end_time', mapped.updatedAtEndTime); - req.query('sort_field', mapped.sortField); - req.authenticate([{ global: true }]); - return req.callAsJson(listPaymentsResponseSchema, requestOptions); - } - - /** - * Creates a payment using the provided source. You can use this endpoint - * to charge a card (credit/debit card or - * Square gift card) or record a payment that the seller received outside of Square - * (cash payment from a buyer or a payment that an external entity - * processed on behalf of the seller). - * - * The endpoint creates a - * `Payment` object and returns it in the response. - * - * @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 - */ - async createPayment( - body: CreatePaymentRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/payments'); - const mapped = req.prepareArgs({ - body: [body, createPaymentRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createPaymentResponseSchema, requestOptions); - } - - /** - * Cancels (voids) a payment identified by the idempotency key that is specified in the - * request. - * - * Use this method when the status of a `CreatePayment` request is unknown (for example, after you send - * a - * `CreatePayment` request, a network error occurs and you do not get a response). In this case, you - * can - * direct Square to cancel the payment using this endpoint. In the request, you provide the same - * idempotency key that you provided in your `CreatePayment` request that you want to cancel. After - * canceling the payment, you can submit your `CreatePayment` request again. - * - * Note that if no payment with the specified idempotency key is found, no action is taken and the - * endpoint - * returns successfully. - * - * @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 - */ - async cancelPaymentByIdempotencyKey( - body: CancelPaymentByIdempotencyKeyRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/payments/cancel'); - const mapped = req.prepareArgs({ - body: [body, cancelPaymentByIdempotencyKeyRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - cancelPaymentByIdempotencyKeyResponseSchema, - requestOptions - ); - } - - /** - * Retrieves details for a specific payment. - * - * @param paymentId A unique ID for the desired payment. - * @return Response from the API call - */ - async getPayment( - paymentId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ paymentId: [paymentId, string()] }); - req.appendTemplatePath`/v2/payments/${mapped.paymentId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getPaymentResponseSchema, requestOptions); - } - - /** - * Updates a payment with the APPROVED status. - * You can update the `amount_money` and `tip_money` using this endpoint. - * - * @param paymentId The ID of the payment to update. - * @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 - */ - async updatePayment( - paymentId: string, - body: UpdatePaymentRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - paymentId: [paymentId, string()], - body: [body, updatePaymentRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/payments/${mapped.paymentId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updatePaymentResponseSchema, requestOptions); - } - - /** - * Cancels (voids) a payment. You can use this endpoint to cancel a payment with - * the APPROVED `status`. - * - * @param paymentId The ID of the payment to cancel. - * @return Response from the API call - */ - async cancelPayment( - paymentId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ paymentId: [paymentId, string()] }); - req.appendTemplatePath`/v2/payments/${mapped.paymentId}/cancel`; - req.authenticate([{ global: true }]); - return req.callAsJson(cancelPaymentResponseSchema, requestOptions); - } - - /** - * Completes (captures) a payment. - * By default, payments are set to complete immediately after they are created. - * - * You can use this endpoint to complete a payment with the APPROVED `status`. - * - * @param paymentId The unique ID identifying the payment to be completed. - * @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 - */ - async completePayment( - paymentId: string, - body: CompletePaymentRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - paymentId: [paymentId, string()], - body: [body, completePaymentRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/payments/${mapped.paymentId}/complete`; - req.authenticate([{ global: true }]); - return req.callAsJson(completePaymentResponseSchema, requestOptions); - } -} diff --git a/src/api/payoutsApi.ts b/src/api/payoutsApi.ts deleted file mode 100644 index 885620efe..000000000 --- a/src/api/payoutsApi.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - GetPayoutResponse, - getPayoutResponseSchema, -} from '../models/getPayoutResponse'; -import { - ListPayoutEntriesResponse, - listPayoutEntriesResponseSchema, -} from '../models/listPayoutEntriesResponse'; -import { - ListPayoutsResponse, - listPayoutsResponseSchema, -} from '../models/listPayoutsResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class PayoutsApi extends BaseApi { - /** - * Retrieves a list of all payouts for the default location. - * You can filter payouts by location ID, status, time range, and order them in ascending or descending - * order. - * To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. - * - * @param locationId The ID of the location for which to list the payouts. By default, payouts are - * returned for the default (main) location associated with the seller. - * @param status If provided, only payouts with the given status are returned. - * @param beginTime The timestamp for the beginning of the payout creation time, in RFC 3339 format. - * Inclusive. Default: The current time minus one year. - * @param endTime The timestamp for the end of the payout creation time, in RFC 3339 format. Default: - * The current time. - * @param sortOrder The order in which payouts are listed. - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * cursor to retrieve the next set of results for the original query. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common- - * api-patterns/pagination). If request parameters change between requests, subsequent - * results may contain duplicates or missing records. - * @param limit The maximum number of results to be returned in a single page. It is possible to - * receive fewer results than the specified limit on a given page. The default value of - * 100 is also the maximum allowed value. If the provided value is greater than 100, it - * is ignored and the default value is used instead. Default: `100` - * @return Response from the API call - */ - async listPayouts( - locationId?: string, - status?: string, - beginTime?: string, - endTime?: string, - sortOrder?: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/payouts'); - const mapped = req.prepareArgs({ - locationId: [locationId, optional(string())], - status: [status, optional(string())], - beginTime: [beginTime, optional(string())], - endTime: [endTime, optional(string())], - sortOrder: [sortOrder, optional(string())], - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('location_id', mapped.locationId); - req.query('status', mapped.status); - req.query('begin_time', mapped.beginTime); - req.query('end_time', mapped.endTime); - req.query('sort_order', mapped.sortOrder); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.authenticate([{ global: true }]); - return req.callAsJson(listPayoutsResponseSchema, requestOptions); - } - - /** - * Retrieves details of a specific payout identified by a payout ID. - * To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. - * - * @param payoutId The ID of the payout to retrieve the information for. - * @return Response from the API call - */ - async getPayout( - payoutId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ payoutId: [payoutId, string()] }); - req.appendTemplatePath`/v2/payouts/${mapped.payoutId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getPayoutResponseSchema, requestOptions); - } - - /** - * Retrieves a list of all payout entries for a specific payout. - * To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. - * - * @param payoutId The ID of the payout to retrieve the information for. - * @param sortOrder The order in which payout entries are listed. - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this cursor - * to retrieve the next set of results for the original query. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). If request parameters change between requests, subsequent - * results may contain duplicates or missing records. - * @param limit The maximum number of results to be returned in a single page. It is possible to - * receive fewer results than the specified limit on a given page. The default value of - * 100 is also the maximum allowed value. If the provided value is greater than 100, it - * is ignored and the default value is used instead. Default: `100` - * @return Response from the API call - */ - async listPayoutEntries( - payoutId: string, - sortOrder?: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - payoutId: [payoutId, string()], - sortOrder: [sortOrder, optional(string())], - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('sort_order', mapped.sortOrder); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.appendTemplatePath`/v2/payouts/${mapped.payoutId}/payout-entries`; - req.authenticate([{ global: true }]); - return req.callAsJson(listPayoutEntriesResponseSchema, requestOptions); - } -} diff --git a/src/api/refundsApi.ts b/src/api/refundsApi.ts deleted file mode 100644 index 0f62b7ab2..000000000 --- a/src/api/refundsApi.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - GetPaymentRefundResponse, - getPaymentRefundResponseSchema, -} from '../models/getPaymentRefundResponse'; -import { - ListPaymentRefundsResponse, - listPaymentRefundsResponseSchema, -} from '../models/listPaymentRefundsResponse'; -import { - RefundPaymentRequest, - refundPaymentRequestSchema, -} from '../models/refundPaymentRequest'; -import { - RefundPaymentResponse, - refundPaymentResponseSchema, -} from '../models/refundPaymentResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class RefundsApi extends BaseApi { - /** - * Retrieves a list of refunds for the account making the request. - * - * Results are eventually consistent, and new refunds or changes to refunds might take several - * seconds to appear. - * - * The maximum results per page is 100. - * - * @param beginTime Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC - * 3339 format. The range is determined using the `created_at` field for each - * `PaymentRefund`. Default: The current time minus one year. - * @param endTime Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC - * 3339 format. The range is determined using the `created_at` field for each - * `PaymentRefund`. Default: The current time. - * @param sortOrder The order in which results are listed by `PaymentRefund.created_at`: - `ASC` - - * Oldest to newest. - `DESC` - Newest to oldest (default). - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * cursor to retrieve the next set of results for the original query. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common- - * api-patterns/pagination). - * @param locationId Limit results to the location supplied. By default, results are returned for all - * locations associated with the seller. - * @param status If provided, only refunds with the given status are returned. For a list of refund - * status values, see [PaymentRefund](entity:PaymentRefund). Default: If omitted, - * refunds are returned regardless of their status. - * @param sourceType If provided, only returns refunds whose payments have the indicated source type. - * Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`. For - * information about these payment source types, see [Take Payments](https://developer. - * squareup.com/docs/payments-api/take-payments). Default: If omitted, refunds are - * returned regardless of the source type. - * @param limit The maximum number of results to be returned in a single page. It is possible to - * receive fewer results than the specified limit on a given page. If the supplied - * value is greater than 100, no more than 100 results are returned. Default: 100 - * @return Response from the API call - */ - async listPaymentRefunds( - beginTime?: string, - endTime?: string, - sortOrder?: string, - cursor?: string, - locationId?: string, - status?: string, - sourceType?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/refunds'); - const mapped = req.prepareArgs({ - beginTime: [beginTime, optional(string())], - endTime: [endTime, optional(string())], - sortOrder: [sortOrder, optional(string())], - cursor: [cursor, optional(string())], - locationId: [locationId, optional(string())], - status: [status, optional(string())], - sourceType: [sourceType, optional(string())], - limit: [limit, optional(number())], - }); - req.query('begin_time', mapped.beginTime); - req.query('end_time', mapped.endTime); - req.query('sort_order', mapped.sortOrder); - req.query('cursor', mapped.cursor); - req.query('location_id', mapped.locationId); - req.query('status', mapped.status); - req.query('source_type', mapped.sourceType); - req.query('limit', mapped.limit); - req.authenticate([{ global: true }]); - return req.callAsJson(listPaymentRefundsResponseSchema, requestOptions); - } - - /** - * Refunds a payment. You can refund the entire payment amount or a - * portion of it. You can use this endpoint to refund a card payment or record a - * refund of a cash or external payment. For more information, see - * [Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments). - * - * @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 - */ - async refundPayment( - body: RefundPaymentRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/refunds'); - const mapped = req.prepareArgs({ - body: [body, refundPaymentRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(refundPaymentResponseSchema, requestOptions); - } - - /** - * Retrieves a specific refund using the `refund_id`. - * - * @param refundId The unique ID for the desired `PaymentRefund`. - * @return Response from the API call - */ - async getPaymentRefund( - refundId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ refundId: [refundId, string()] }); - req.appendTemplatePath`/v2/refunds/${mapped.refundId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getPaymentRefundResponseSchema, requestOptions); - } -} diff --git a/src/api/resources/applePay/client/Client.ts b/src/api/resources/applePay/client/Client.ts new file mode 100644 index 000000000..4c642535f --- /dev/null +++ b/src/api/resources/applePay/client/Client.ts @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace ApplePay { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class ApplePay { + constructor(protected readonly _options: ApplePay.Options = {}) {} + + /** + * Activates a domain for use with Apple Pay on the Web and Square. A validation + * is performed on this domain by Apple to ensure that it is properly set up as + * an Apple Pay enabled domain. + * + * This endpoint provides an easy way for platform developers to bulk activate + * Apple Pay on the Web with Square for merchants using their platform. + * + * Note: You will need to host a valid domain verification file on your domain to support Apple Pay. The + * current version of this file is always available at https://app.squareup.com/digital-wallets/apple-pay/apple-developer-merchantid-domain-association, + * and should be hosted at `.well_known/apple-developer-merchantid-domain-association` on your + * domain. This file is subject to change; we strongly recommend checking for updates regularly and avoiding + * long-lived caches that might not keep in sync with the correct file version. + * + * To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an Apple Pay Payment](https://developer.squareup.com/docs/web-payments/apple-pay). + * + * @param {Square.RegisterDomainRequest} request + * @param {ApplePay.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.applePay.registerDomain({ + * domainName: "example.com" + * }) + */ + public async registerDomain( + request: Square.RegisterDomainRequest, + requestOptions?: ApplePay.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/apple-pay/domains", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.RegisterDomainRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RegisterDomainResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/apple-pay/domains."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/applePay/client/index.ts b/src/api/resources/applePay/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/applePay/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/applePay/client/requests/RegisterDomainRequest.ts b/src/api/resources/applePay/client/requests/RegisterDomainRequest.ts new file mode 100644 index 000000000..d2aa825f6 --- /dev/null +++ b/src/api/resources/applePay/client/requests/RegisterDomainRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * domainName: "example.com" + * } + */ +export interface RegisterDomainRequest { + /** A domain name as described in RFC-1034 that will be registered with ApplePay. */ + domainName: string; +} diff --git a/src/api/resources/applePay/client/requests/index.ts b/src/api/resources/applePay/client/requests/index.ts new file mode 100644 index 000000000..11c98648b --- /dev/null +++ b/src/api/resources/applePay/client/requests/index.ts @@ -0,0 +1 @@ +export { type RegisterDomainRequest } from "./RegisterDomainRequest"; diff --git a/src/api/resources/applePay/index.ts b/src/api/resources/applePay/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/applePay/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/bankAccounts/client/Client.ts b/src/api/resources/bankAccounts/client/Client.ts new file mode 100644 index 000000000..6f91ce9e7 --- /dev/null +++ b/src/api/resources/bankAccounts/client/Client.ts @@ -0,0 +1,289 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace BankAccounts { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class BankAccounts { + constructor(protected readonly _options: BankAccounts.Options = {}) {} + + /** + * Returns a list of [BankAccount](entity:BankAccount) objects linked to a Square account. + * + * @param {Square.BankAccountsListRequest} request + * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bankAccounts.list() + */ + public async list( + request: Square.BankAccountsListRequest = {}, + requestOptions?: BankAccounts.RequestOptions, + ): Promise> { + const list = async (request: Square.BankAccountsListRequest): Promise => { + const { cursor, limit, locationId } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bank-accounts", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListBankAccountsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/bank-accounts."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.bankAccounts ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank account ID. + * + * @param {Square.BankAccountsGetByV1IdRequest} request + * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bankAccounts.getByV1Id({ + * v1BankAccountId: "v1_bank_account_id" + * }) + */ + public async getByV1Id( + request: Square.BankAccountsGetByV1IdRequest, + requestOptions?: BankAccounts.RequestOptions, + ): Promise { + const { v1BankAccountId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bank-accounts/by-v1-id/${encodeURIComponent(v1BankAccountId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetBankAccountByV1IdResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bank-accounts/by-v1-id/{v1_bank_account_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns details of a [BankAccount](entity:BankAccount) + * linked to a Square account. + * + * @param {Square.BankAccountsGetRequest} request + * @param {BankAccounts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bankAccounts.get({ + * bankAccountId: "bank_account_id" + * }) + */ + public async get( + request: Square.BankAccountsGetRequest, + requestOptions?: BankAccounts.RequestOptions, + ): Promise { + const { bankAccountId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bank-accounts/${encodeURIComponent(bankAccountId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetBankAccountResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bank-accounts/{bank_account_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/bankAccounts/client/index.ts b/src/api/resources/bankAccounts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/bankAccounts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/bankAccounts/client/requests/BankAccountsGetByV1IdRequest.ts b/src/api/resources/bankAccounts/client/requests/BankAccountsGetByV1IdRequest.ts new file mode 100644 index 000000000..eb068077d --- /dev/null +++ b/src/api/resources/bankAccounts/client/requests/BankAccountsGetByV1IdRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * v1BankAccountId: "v1_bank_account_id" + * } + */ +export interface BankAccountsGetByV1IdRequest { + /** + * Connect V1 ID of the desired `BankAccount`. For more information, see + * [Retrieve a bank account by using an ID issued by V1 Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api#retrieve-a-bank-account-by-using-an-id-issued-by-v1-bank-accounts-api). + */ + v1BankAccountId: string; +} diff --git a/src/api/resources/bankAccounts/client/requests/BankAccountsGetRequest.ts b/src/api/resources/bankAccounts/client/requests/BankAccountsGetRequest.ts new file mode 100644 index 000000000..9417e230b --- /dev/null +++ b/src/api/resources/bankAccounts/client/requests/BankAccountsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * bankAccountId: "bank_account_id" + * } + */ +export interface BankAccountsGetRequest { + /** + * Square-issued ID of the desired `BankAccount`. + */ + bankAccountId: string; +} diff --git a/src/api/resources/bankAccounts/client/requests/BankAccountsListRequest.ts b/src/api/resources/bankAccounts/client/requests/BankAccountsListRequest.ts new file mode 100644 index 000000000..68c2eb8ad --- /dev/null +++ b/src/api/resources/bankAccounts/client/requests/BankAccountsListRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface BankAccountsListRequest { + /** + * The pagination cursor returned by a previous call to this endpoint. + * Use it in the next `ListBankAccounts` request to retrieve the next set + * of results. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string | null; + /** + * Upper limit on the number of bank accounts to return in the response. + * Currently, 1000 is the largest supported limit. You can specify a limit + * of up to 1000 bank accounts. This is also the default limit. + */ + limit?: number | null; + /** + * Location ID. You can specify this optional filter + * to retrieve only the linked bank accounts belonging to a specific location. + */ + locationId?: string | null; +} diff --git a/src/api/resources/bankAccounts/client/requests/index.ts b/src/api/resources/bankAccounts/client/requests/index.ts new file mode 100644 index 000000000..46d9d9987 --- /dev/null +++ b/src/api/resources/bankAccounts/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type BankAccountsListRequest } from "./BankAccountsListRequest"; +export { type BankAccountsGetByV1IdRequest } from "./BankAccountsGetByV1IdRequest"; +export { type BankAccountsGetRequest } from "./BankAccountsGetRequest"; diff --git a/src/api/resources/bankAccounts/index.ts b/src/api/resources/bankAccounts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/bankAccounts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/bookings/client/Client.ts b/src/api/resources/bookings/client/Client.ts new file mode 100644 index 000000000..2993da360 --- /dev/null +++ b/src/api/resources/bookings/client/Client.ts @@ -0,0 +1,899 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client"; +import { CustomAttributes } from "../resources/customAttributes/client/Client"; +import { LocationProfiles } from "../resources/locationProfiles/client/Client"; +import { TeamMemberProfiles } from "../resources/teamMemberProfiles/client/Client"; + +export declare namespace Bookings { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Bookings { + protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; + protected _customAttributes: CustomAttributes | undefined; + protected _locationProfiles: LocationProfiles | undefined; + protected _teamMemberProfiles: TeamMemberProfiles | undefined; + + constructor(protected readonly _options: Bookings.Options = {}) {} + + public get customAttributeDefinitions(): CustomAttributeDefinitions { + return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); + } + + public get customAttributes(): CustomAttributes { + return (this._customAttributes ??= new CustomAttributes(this._options)); + } + + public get locationProfiles(): LocationProfiles { + return (this._locationProfiles ??= new LocationProfiles(this._options)); + } + + public get teamMemberProfiles(): TeamMemberProfiles { + return (this._teamMemberProfiles ??= new TeamMemberProfiles(this._options)); + } + + /** + * Retrieve a collection of bookings. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + * + * @param {Square.BookingsListRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.list() + */ + public async list( + request: Square.BookingsListRequest = {}, + requestOptions?: Bookings.RequestOptions, + ): Promise> { + const list = async (request: Square.BookingsListRequest): Promise => { + const { limit, cursor, customerId, teamMemberId, locationId, startAtMin, startAtMax } = request; + const _queryParams: Record = {}; + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (customerId !== undefined) { + _queryParams["customer_id"] = customerId; + } + if (teamMemberId !== undefined) { + _queryParams["team_member_id"] = teamMemberId; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (startAtMin !== undefined) { + _queryParams["start_at_min"] = startAtMin; + } + if (startAtMax !== undefined) { + _queryParams["start_at_max"] = startAtMax; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListBookingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/bookings."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.bookings ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a booking. + * + * The required input must include the following: + * - `Booking.location_id` + * - `Booking.start_at` + * - `Booking.AppointmentSegment.team_member_id` + * - `Booking.AppointmentSegment.service_variation_id` + * - `Booking.AppointmentSegment.service_variation_version` + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.CreateBookingRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.create({ + * booking: {} + * }) + */ + public async create( + request: Square.CreateBookingRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateBookingRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateBookingResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/bookings."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Searches for availabilities for booking. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + * + * @param {Square.SearchAvailabilityRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.searchAvailability({ + * query: { + * filter: { + * startAtRange: {} + * } + * } + * }) + */ + public async searchAvailability( + request: Square.SearchAvailabilityRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/availability/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchAvailabilityRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchAvailabilityResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/bookings/availability/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Bulk-Retrieves a list of bookings by booking IDs. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + * + * @param {Square.BulkRetrieveBookingsRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.bulkRetrieveBookings({ + * bookingIds: ["booking_ids"] + * }) + */ + public async bulkRetrieveBookings( + request: Square.BulkRetrieveBookingsRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/bulk-retrieve", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BulkRetrieveBookingsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkRetrieveBookingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/bookings/bulk-retrieve."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a seller's booking profile. + * + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.getBusinessProfile() + */ + public async getBusinessProfile( + requestOptions?: Bookings.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/business-booking-profile", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetBusinessBookingProfileResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/business-booking-profile.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a seller's location booking profile. + * + * @param {Square.RetrieveLocationBookingProfileRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.retrieveLocationBookingProfile({ + * locationId: "location_id" + * }) + */ + public async retrieveLocationBookingProfile( + request: Square.RetrieveLocationBookingProfileRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise { + const { locationId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/location-booking-profiles/${encodeURIComponent(locationId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveLocationBookingProfileResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/location-booking-profiles/{location_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves one or more team members' booking profiles. + * + * @param {Square.BulkRetrieveTeamMemberBookingProfilesRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.bulkRetrieveTeamMemberBookingProfiles({ + * teamMemberIds: ["team_member_ids"] + * }) + */ + public async bulkRetrieveTeamMemberBookingProfiles( + request: Square.BulkRetrieveTeamMemberBookingProfilesRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/team-member-booking-profiles/bulk-retrieve", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BulkRetrieveTeamMemberBookingProfilesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkRetrieveTeamMemberBookingProfilesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/bookings/team-member-booking-profiles/bulk-retrieve.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a booking. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + * + * @param {Square.BookingsGetRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.get({ + * bookingId: "booking_id" + * }) + */ + public async get( + request: Square.BookingsGetRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise { + const { bookingId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/${encodeURIComponent(bookingId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetBookingResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/bookings/{booking_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a booking. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.UpdateBookingRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.update({ + * bookingId: "booking_id", + * booking: {} + * }) + */ + public async update( + request: Square.UpdateBookingRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise { + const { bookingId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/${encodeURIComponent(bookingId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateBookingRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateBookingResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/bookings/{booking_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels an existing booking. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.CancelBookingRequest} request + * @param {Bookings.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.cancel({ + * bookingId: "booking_id" + * }) + */ + public async cancel( + request: Square.CancelBookingRequest, + requestOptions?: Bookings.RequestOptions, + ): Promise { + const { bookingId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/${encodeURIComponent(bookingId)}/cancel`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CancelBookingRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelBookingResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/bookings/{booking_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/bookings/client/index.ts b/src/api/resources/bookings/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/bookings/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/bookings/client/requests/BookingsGetRequest.ts b/src/api/resources/bookings/client/requests/BookingsGetRequest.ts new file mode 100644 index 000000000..e151a50b9 --- /dev/null +++ b/src/api/resources/bookings/client/requests/BookingsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * bookingId: "booking_id" + * } + */ +export interface BookingsGetRequest { + /** + * The ID of the [Booking](entity:Booking) object representing the to-be-retrieved booking. + */ + bookingId: string; +} diff --git a/src/api/resources/bookings/client/requests/BookingsListRequest.ts b/src/api/resources/bookings/client/requests/BookingsListRequest.ts new file mode 100644 index 000000000..c20fdb2ed --- /dev/null +++ b/src/api/resources/bookings/client/requests/BookingsListRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface BookingsListRequest { + /** + * The maximum number of results per page to return in a paged response. + */ + limit?: number | null; + /** + * The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. + */ + cursor?: string | null; + /** + * The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all customers are retrieved. + */ + customerId?: string | null; + /** + * The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved. + */ + teamMemberId?: string | null; + /** + * The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved. + */ + locationId?: string | null; + /** + * The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used. + */ + startAtMin?: string | null; + /** + * The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days after `start_at_min` is used. + */ + startAtMax?: string | null; +} diff --git a/src/api/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts b/src/api/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts new file mode 100644 index 000000000..fb06a42b6 --- /dev/null +++ b/src/api/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * bookingIds: ["booking_ids"] + * } + */ +export interface BulkRetrieveBookingsRequest { + /** A non-empty list of [Booking](entity:Booking) IDs specifying bookings to retrieve. */ + bookingIds: string[]; +} diff --git a/src/api/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts b/src/api/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts new file mode 100644 index 000000000..f0d8d22fe --- /dev/null +++ b/src/api/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * teamMemberIds: ["team_member_ids"] + * } + */ +export interface BulkRetrieveTeamMemberBookingProfilesRequest { + /** A non-empty list of IDs of team members whose booking profiles you want to retrieve. */ + teamMemberIds: string[]; +} diff --git a/src/api/resources/bookings/client/requests/CancelBookingRequest.ts b/src/api/resources/bookings/client/requests/CancelBookingRequest.ts new file mode 100644 index 000000000..df9e2f50c --- /dev/null +++ b/src/api/resources/bookings/client/requests/CancelBookingRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * bookingId: "booking_id" + * } + */ +export interface CancelBookingRequest { + /** + * The ID of the [Booking](entity:Booking) object representing the to-be-cancelled booking. + */ + bookingId: string; + /** A unique key to make this request an idempotent operation. */ + idempotencyKey?: string | null; + /** The revision number for the booking used for optimistic concurrency. */ + bookingVersion?: number | null; +} diff --git a/src/api/resources/bookings/client/requests/CreateBookingRequest.ts b/src/api/resources/bookings/client/requests/CreateBookingRequest.ts new file mode 100644 index 000000000..f02b87e0c --- /dev/null +++ b/src/api/resources/bookings/client/requests/CreateBookingRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * booking: {} + * } + */ +export interface CreateBookingRequest { + /** A unique key to make this request an idempotent operation. */ + idempotencyKey?: string; + /** The details of the booking to be created. */ + booking: Square.Booking; +} diff --git a/src/api/resources/bookings/client/requests/RetrieveLocationBookingProfileRequest.ts b/src/api/resources/bookings/client/requests/RetrieveLocationBookingProfileRequest.ts new file mode 100644 index 000000000..c53c91d78 --- /dev/null +++ b/src/api/resources/bookings/client/requests/RetrieveLocationBookingProfileRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id" + * } + */ +export interface RetrieveLocationBookingProfileRequest { + /** + * The ID of the location to retrieve the booking profile. + */ + locationId: string; +} diff --git a/src/api/resources/bookings/client/requests/SearchAvailabilityRequest.ts b/src/api/resources/bookings/client/requests/SearchAvailabilityRequest.ts new file mode 100644 index 000000000..50bc2efd8 --- /dev/null +++ b/src/api/resources/bookings/client/requests/SearchAvailabilityRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * startAtRange: {} + * } + * } + * } + */ +export interface SearchAvailabilityRequest { + /** Query conditions used to filter buyer-accessible booking availabilities. */ + query: Square.SearchAvailabilityQuery; +} diff --git a/src/api/resources/bookings/client/requests/UpdateBookingRequest.ts b/src/api/resources/bookings/client/requests/UpdateBookingRequest.ts new file mode 100644 index 000000000..3ed17fbab --- /dev/null +++ b/src/api/resources/bookings/client/requests/UpdateBookingRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * bookingId: "booking_id", + * booking: {} + * } + */ +export interface UpdateBookingRequest { + /** + * The ID of the [Booking](entity:Booking) object representing the to-be-updated booking. + */ + bookingId: string; + /** A unique key to make this request an idempotent operation. */ + idempotencyKey?: string | null; + /** The booking to be updated. Individual attributes explicitly specified here override the corresponding values of the existing booking. */ + booking: Square.Booking; +} diff --git a/src/api/resources/bookings/client/requests/index.ts b/src/api/resources/bookings/client/requests/index.ts new file mode 100644 index 000000000..95d0a1c13 --- /dev/null +++ b/src/api/resources/bookings/client/requests/index.ts @@ -0,0 +1,9 @@ +export { type BookingsListRequest } from "./BookingsListRequest"; +export { type CreateBookingRequest } from "./CreateBookingRequest"; +export { type SearchAvailabilityRequest } from "./SearchAvailabilityRequest"; +export { type BulkRetrieveBookingsRequest } from "./BulkRetrieveBookingsRequest"; +export { type RetrieveLocationBookingProfileRequest } from "./RetrieveLocationBookingProfileRequest"; +export { type BulkRetrieveTeamMemberBookingProfilesRequest } from "./BulkRetrieveTeamMemberBookingProfilesRequest"; +export { type BookingsGetRequest } from "./BookingsGetRequest"; +export { type UpdateBookingRequest } from "./UpdateBookingRequest"; +export { type CancelBookingRequest } from "./CancelBookingRequest"; diff --git a/src/api/resources/bookings/index.ts b/src/api/resources/bookings/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/bookings/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts new file mode 100644 index 000000000..bcbf0c3f4 --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/Client.ts @@ -0,0 +1,480 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributeDefinitions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributeDefinitions { + constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + + /** + * Get all bookings custom attribute definitions. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + * + * @param {Square.bookings.CustomAttributeDefinitionsListRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributeDefinitions.list() + */ + public async list( + request: Square.bookings.CustomAttributeDefinitionsListRequest = {}, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { + const list = async ( + request: Square.bookings.CustomAttributeDefinitionsListRequest, + ): Promise => { + const { limit, cursor } = request; + const _queryParams: Record = {}; + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/custom-attribute-definitions", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListBookingCustomAttributeDefinitionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable< + Square.ListBookingCustomAttributeDefinitionsResponse, + Square.CustomAttributeDefinition + >({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributeDefinitions ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a bookings custom attribute definition. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.bookings.CreateBookingCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributeDefinitions.create({ + * customAttributeDefinition: {} + * }) + */ + public async create( + request: Square.bookings.CreateBookingCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/custom-attribute-definitions", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.bookings.CreateBookingCustomAttributeDefinitionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateBookingCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/bookings/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a bookings custom attribute definition. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + * + * @param {Square.bookings.CustomAttributeDefinitionsGetRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributeDefinitions.get({ + * key: "key" + * }) + */ + public async get( + request: Square.bookings.CustomAttributeDefinitionsGetRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, version } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveBookingCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a bookings custom attribute definition. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.bookings.UpdateBookingCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributeDefinitions.update({ + * key: "key", + * customAttributeDefinition: {} + * }) + */ + public async update( + request: Square.bookings.UpdateBookingCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.bookings.UpdateBookingCustomAttributeDefinitionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateBookingCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/bookings/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a bookings custom attribute definition. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.bookings.CustomAttributeDefinitionsDeleteRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributeDefinitions.delete({ + * key: "key" + * }) + */ + public async delete( + request: Square.bookings.CustomAttributeDefinitionsDeleteRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteBookingCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/bookings/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..9ca4428e5 --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * customAttributeDefinition: {} + * } + */ +export interface CreateBookingCustomAttributeDefinitionRequest { + /** + * The custom attribute definition to create, with the following fields: + * + * - `key` + * + * - `name`. If provided, `name` must be unique (case-sensitive) across all visible booking-related custom attribute + * definitions for the seller. + * + * - `description` + * + * - `visibility`. Note that all custom attributes are visible in exported booking data, including those set to + * `VISIBILITY_HIDDEN`. + * + * - `schema`. With the exception of the `Selection` data type, the `schema` is specified as a + * simple URL to the JSON schema definition hosted on the Square CDN. For more information, see + * [Specifying the schema](https://developer.squareup.com/docs/booking-custom-attributes-api/custom-attribute-definitions#specify-schema). + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string; +} diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts new file mode 100644 index 000000000..860f57efe --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsDeleteRequest { + /** + * The key of the custom attribute definition to delete. + */ + key: string; +} diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts new file mode 100644 index 000000000..4fe9ca10a --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsGetRequest { + /** + * The key of the custom attribute definition to retrieve. If the requesting application + * is not the definition owner, you must use the qualified key. + */ + key: string; + /** + * The current version of the custom attribute definition, which is used for strongly consistent + * reads to guarantee that you receive the most up-to-date data. When included in the request, + * Square returns the specified version or a higher version if one exists. If the specified version + * is higher than the current version, Square returns a `BAD_REQUEST` error. + */ + version?: number | null; +} diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts new file mode 100644 index 000000000..932817271 --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface CustomAttributeDefinitionsListRequest { + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; +} diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..ec3f3cb5a --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * key: "key", + * customAttributeDefinition: {} + * } + */ +export interface UpdateBookingCustomAttributeDefinitionRequest { + /** + * The key of the custom attribute definition to update. + */ + key: string; + /** + * The custom attribute definition that contains the fields to update. Only the following fields can be updated: + * - `name` + * - `description` + * - `visibility` + * - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed + * selections are supported. + * + * For more information, see + * [Updatable definition fields](https://developer.squareup.com/docs/booking-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields). + * + * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control, include the optional `version` field and specify the current version of the custom attribute definition. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..5275388bc --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type CustomAttributeDefinitionsListRequest } from "./CustomAttributeDefinitionsListRequest"; +export { type CreateBookingCustomAttributeDefinitionRequest } from "./CreateBookingCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsGetRequest } from "./CustomAttributeDefinitionsGetRequest"; +export { type UpdateBookingCustomAttributeDefinitionRequest } from "./UpdateBookingCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsDeleteRequest } from "./CustomAttributeDefinitionsDeleteRequest"; diff --git a/src/api/resources/bookings/resources/customAttributeDefinitions/index.ts b/src/api/resources/bookings/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/bookings/resources/customAttributes/client/Client.ts b/src/api/resources/bookings/resources/customAttributes/client/Client.ts new file mode 100644 index 000000000..8421b274c --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/Client.ts @@ -0,0 +1,583 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributes { + constructor(protected readonly _options: CustomAttributes.Options = {}) {} + + /** + * Bulk deletes bookings custom attributes. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.bookings.BulkDeleteBookingCustomAttributesRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributes.batchDelete({ + * values: { + * "key": { + * bookingId: "booking_id", + * key: "key" + * } + * } + * }) + */ + public async batchDelete( + request: Square.bookings.BulkDeleteBookingCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/custom-attributes/bulk-delete", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.bookings.BulkDeleteBookingCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkDeleteBookingCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/bookings/custom-attributes/bulk-delete.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Bulk upserts bookings custom attributes. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.bookings.BulkUpsertBookingCustomAttributesRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributes.batchUpsert({ + * values: { + * "key": { + * bookingId: "booking_id", + * customAttribute: {} + * } + * } + * }) + */ + public async batchUpsert( + request: Square.bookings.BulkUpsertBookingCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/custom-attributes/bulk-upsert", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.bookings.BulkUpsertBookingCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkUpsertBookingCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/bookings/custom-attributes/bulk-upsert.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Lists a booking's custom attributes. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + * + * @param {Square.bookings.CustomAttributesListRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributes.list({ + * bookingId: "booking_id" + * }) + */ + public async list( + request: Square.bookings.CustomAttributesListRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const list = async ( + request: Square.bookings.CustomAttributesListRequest, + ): Promise => { + const { bookingId, limit, cursor, withDefinitions } = request; + const _queryParams: Record = {}; + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (withDefinitions !== undefined) { + _queryParams["with_definitions"] = withDefinitions?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/${encodeURIComponent(bookingId)}/custom-attributes`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListBookingCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/{booking_id}/custom-attributes.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves a bookings custom attribute. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + * + * @param {Square.bookings.CustomAttributesGetRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributes.get({ + * bookingId: "booking_id", + * key: "key" + * }) + */ + public async get( + request: Square.bookings.CustomAttributesGetRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { bookingId, key, withDefinition, version } = request; + const _queryParams: Record = {}; + if (withDefinition !== undefined) { + _queryParams["with_definition"] = withDefinition?.toString() ?? null; + } + + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/${encodeURIComponent(bookingId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveBookingCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/{booking_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Upserts a bookings custom attribute. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.bookings.UpsertBookingCustomAttributeRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributes.upsert({ + * bookingId: "booking_id", + * key: "key", + * customAttribute: {} + * }) + */ + public async upsert( + request: Square.bookings.UpsertBookingCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { bookingId, key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/${encodeURIComponent(bookingId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.bookings.UpsertBookingCustomAttributeRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpsertBookingCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/bookings/{booking_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a bookings custom attribute. + * + * To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + * To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + * + * For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + * or *Appointments Premium*. + * + * @param {Square.bookings.CustomAttributesDeleteRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.customAttributes.delete({ + * bookingId: "booking_id", + * key: "key" + * }) + */ + public async delete( + request: Square.bookings.CustomAttributesDeleteRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { bookingId, key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/${encodeURIComponent(bookingId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteBookingCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/bookings/{booking_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/bookings/resources/customAttributes/client/index.ts b/src/api/resources/bookings/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts new file mode 100644 index 000000000..dd626b7a9 --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "key": { + * bookingId: "booking_id", + * key: "key" + * } + * } + * } + */ +export interface BulkDeleteBookingCustomAttributesRequest { + /** + * A map containing 1 to 25 individual Delete requests. For each request, provide an + * arbitrary ID that is unique for this `BulkDeleteBookingCustomAttributes` request and the + * information needed to delete a custom attribute. + */ + values: Record; +} diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts new file mode 100644 index 000000000..fca36bbb3 --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "key": { + * bookingId: "booking_id", + * customAttribute: {} + * } + * } + * } + */ +export interface BulkUpsertBookingCustomAttributesRequest { + /** + * A map containing 1 to 25 individual upsert requests. For each request, provide an + * arbitrary ID that is unique for this `BulkUpsertBookingCustomAttributes` request and the + * information needed to create or update a custom attribute. + */ + values: Record; +} diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts new file mode 100644 index 000000000..4ac85246b --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * bookingId: "booking_id", + * key: "key" + * } + */ +export interface CustomAttributesDeleteRequest { + /** + * The ID of the target [booking](entity:Booking). + */ + bookingId: string; + /** + * The key of the custom attribute to delete. This key must match the `key` of a custom + * attribute definition in the Square seller account. If the requesting application is not the + * definition owner, you must use the qualified key. + */ + key: string; +} diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts new file mode 100644 index 000000000..af68d8e29 --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * bookingId: "booking_id", + * key: "key" + * } + */ +export interface CustomAttributesGetRequest { + /** + * The ID of the target [booking](entity:Booking). + */ + bookingId: string; + /** + * The key of the custom attribute to retrieve. This key must match the `key` of a custom + * attribute definition in the Square seller account. If the requesting application is not the + * definition owner, you must use the qualified key. + */ + key: string; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of + * the custom attribute. Set this parameter to `true` to get the name and description of the custom + * attribute, information about the data type, or other definition details. The default value is `false`. + */ + withDefinition?: boolean | null; + /** + * The current version of the custom attribute, which is used for strongly consistent reads to + * guarantee that you receive the most up-to-date data. When included in the request, Square + * returns the specified version or a higher version if one exists. If the specified version is + * higher than the current version, Square returns a `BAD_REQUEST` error. + */ + version?: number | null; +} diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesListRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesListRequest.ts new file mode 100644 index 000000000..00bec62ce --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/CustomAttributesListRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * bookingId: "booking_id" + * } + */ +export interface CustomAttributesListRequest { + /** + * The ID of the target [booking](entity:Booking). + */ + bookingId: string; + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. For more + * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom + * attribute, information about the data type, or other definition details. The default value is `false`. + */ + withDefinitions?: boolean | null; +} diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts new file mode 100644 index 000000000..b65cfb25c --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * bookingId: "booking_id", + * key: "key", + * customAttribute: {} + * } + */ +export interface UpsertBookingCustomAttributeRequest { + /** + * The ID of the target [booking](entity:Booking). + */ + bookingId: string; + /** + * The key of the custom attribute to create or update. This key must match the `key` of a + * custom attribute definition in the Square seller account. If the requesting application is not + * the definition owner, you must use the qualified key. + */ + key: string; + /** + * The custom attribute to create or update, with the following fields: + * + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Value data types](https://developer.squareup.com/docs/booking-custom-attributes-api/custom-attributes#value-data-types). + * + * - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control for an update operation, include this optional field and specify the current version + * of the custom attribute. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/bookings/resources/customAttributes/client/requests/index.ts b/src/api/resources/bookings/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..1029078b3 --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,6 @@ +export { type BulkDeleteBookingCustomAttributesRequest } from "./BulkDeleteBookingCustomAttributesRequest"; +export { type BulkUpsertBookingCustomAttributesRequest } from "./BulkUpsertBookingCustomAttributesRequest"; +export { type CustomAttributesListRequest } from "./CustomAttributesListRequest"; +export { type CustomAttributesGetRequest } from "./CustomAttributesGetRequest"; +export { type UpsertBookingCustomAttributeRequest } from "./UpsertBookingCustomAttributeRequest"; +export { type CustomAttributesDeleteRequest } from "./CustomAttributesDeleteRequest"; diff --git a/src/api/resources/bookings/resources/customAttributes/index.ts b/src/api/resources/bookings/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/bookings/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/bookings/resources/index.ts b/src/api/resources/bookings/resources/index.ts new file mode 100644 index 000000000..f4f82dee8 --- /dev/null +++ b/src/api/resources/bookings/resources/index.ts @@ -0,0 +1,8 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * as customAttributes from "./customAttributes"; +export * as locationProfiles from "./locationProfiles"; +export * as teamMemberProfiles from "./teamMemberProfiles"; +export * from "./customAttributeDefinitions/client/requests"; +export * from "./customAttributes/client/requests"; +export * from "./locationProfiles/client/requests"; +export * from "./teamMemberProfiles/client/requests"; diff --git a/src/api/resources/bookings/resources/locationProfiles/client/Client.ts b/src/api/resources/bookings/resources/locationProfiles/client/Client.ts new file mode 100644 index 000000000..4dbaf7ab6 --- /dev/null +++ b/src/api/resources/bookings/resources/locationProfiles/client/Client.ts @@ -0,0 +1,139 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace LocationProfiles { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class LocationProfiles { + constructor(protected readonly _options: LocationProfiles.Options = {}) {} + + /** + * Lists location booking profiles of a seller. + * + * @param {Square.bookings.LocationProfilesListRequest} request + * @param {LocationProfiles.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.locationProfiles.list() + */ + public async list( + request: Square.bookings.LocationProfilesListRequest = {}, + requestOptions?: LocationProfiles.RequestOptions, + ): Promise> { + const list = async ( + request: Square.bookings.LocationProfilesListRequest, + ): Promise => { + const { limit, cursor } = request; + const _queryParams: Record = {}; + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/location-booking-profiles", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListLocationBookingProfilesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/location-booking-profiles.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.locationBookingProfiles ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/bookings/resources/locationProfiles/client/index.ts b/src/api/resources/bookings/resources/locationProfiles/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/bookings/resources/locationProfiles/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/bookings/resources/locationProfiles/client/requests/LocationProfilesListRequest.ts b/src/api/resources/bookings/resources/locationProfiles/client/requests/LocationProfilesListRequest.ts new file mode 100644 index 000000000..f9007e56e --- /dev/null +++ b/src/api/resources/bookings/resources/locationProfiles/client/requests/LocationProfilesListRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface LocationProfilesListRequest { + /** + * The maximum number of results to return in a paged response. + */ + limit?: number | null; + /** + * The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. + */ + cursor?: string | null; +} diff --git a/src/api/resources/bookings/resources/locationProfiles/client/requests/index.ts b/src/api/resources/bookings/resources/locationProfiles/client/requests/index.ts new file mode 100644 index 000000000..ab79a72d5 --- /dev/null +++ b/src/api/resources/bookings/resources/locationProfiles/client/requests/index.ts @@ -0,0 +1 @@ +export { type LocationProfilesListRequest } from "./LocationProfilesListRequest"; diff --git a/src/api/resources/bookings/resources/locationProfiles/index.ts b/src/api/resources/bookings/resources/locationProfiles/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/bookings/resources/locationProfiles/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts new file mode 100644 index 000000000..4e2131902 --- /dev/null +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/Client.ts @@ -0,0 +1,220 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace TeamMemberProfiles { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class TeamMemberProfiles { + constructor(protected readonly _options: TeamMemberProfiles.Options = {}) {} + + /** + * Lists booking profiles for team members. + * + * @param {Square.bookings.TeamMemberProfilesListRequest} request + * @param {TeamMemberProfiles.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.teamMemberProfiles.list() + */ + public async list( + request: Square.bookings.TeamMemberProfilesListRequest = {}, + requestOptions?: TeamMemberProfiles.RequestOptions, + ): Promise> { + const list = async ( + request: Square.bookings.TeamMemberProfilesListRequest, + ): Promise => { + const { bookableOnly, limit, cursor, locationId } = request; + const _queryParams: Record = {}; + if (bookableOnly !== undefined) { + _queryParams["bookable_only"] = bookableOnly?.toString() ?? null; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/bookings/team-member-booking-profiles", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListTeamMemberBookingProfilesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/team-member-booking-profiles.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.teamMemberBookingProfiles ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves a team member's booking profile. + * + * @param {Square.bookings.TeamMemberProfilesGetRequest} request + * @param {TeamMemberProfiles.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.bookings.teamMemberProfiles.get({ + * teamMemberId: "team_member_id" + * }) + */ + public async get( + request: Square.bookings.TeamMemberProfilesGetRequest, + requestOptions?: TeamMemberProfiles.RequestOptions, + ): Promise { + const { teamMemberId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/bookings/team-member-booking-profiles/${encodeURIComponent(teamMemberId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTeamMemberBookingProfileResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/bookings/team-member-booking-profiles/{team_member_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/index.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/TeamMemberProfilesGetRequest.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/TeamMemberProfilesGetRequest.ts new file mode 100644 index 000000000..14f1f396a --- /dev/null +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/TeamMemberProfilesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * teamMemberId: "team_member_id" + * } + */ +export interface TeamMemberProfilesGetRequest { + /** + * The ID of the team member to retrieve. + */ + teamMemberId: string; +} diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/TeamMemberProfilesListRequest.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/TeamMemberProfilesListRequest.ts new file mode 100644 index 000000000..de5548b2e --- /dev/null +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/TeamMemberProfilesListRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface TeamMemberProfilesListRequest { + /** + * Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`). + */ + bookableOnly?: boolean | null; + /** + * The maximum number of results to return in a paged response. + */ + limit?: number | null; + /** + * The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. + */ + cursor?: string | null; + /** + * Indicates whether to include only team members enabled at the given location in the returned result. + */ + locationId?: string | null; +} diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/index.ts b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/index.ts new file mode 100644 index 000000000..2ba9f214d --- /dev/null +++ b/src/api/resources/bookings/resources/teamMemberProfiles/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type TeamMemberProfilesListRequest } from "./TeamMemberProfilesListRequest"; +export { type TeamMemberProfilesGetRequest } from "./TeamMemberProfilesGetRequest"; diff --git a/src/api/resources/bookings/resources/teamMemberProfiles/index.ts b/src/api/resources/bookings/resources/teamMemberProfiles/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/bookings/resources/teamMemberProfiles/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/cards/client/Client.ts b/src/api/resources/cards/client/Client.ts new file mode 100644 index 000000000..0f86f3151 --- /dev/null +++ b/src/api/resources/cards/client/Client.ts @@ -0,0 +1,385 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Cards { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Cards { + constructor(protected readonly _options: Cards.Options = {}) {} + + /** + * Retrieves a list of cards owned by the account making the request. + * A max of 25 cards will be returned. + * + * @param {Square.CardsListRequest} request + * @param {Cards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.cards.list() + */ + public async list( + request: Square.CardsListRequest = {}, + requestOptions?: Cards.RequestOptions, + ): Promise> { + const list = async (request: Square.CardsListRequest): Promise => { + const { cursor, customerId, includeDisabled, referenceId, sortOrder } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (customerId !== undefined) { + _queryParams["customer_id"] = customerId; + } + if (includeDisabled !== undefined) { + _queryParams["include_disabled"] = includeDisabled?.toString() ?? null; + } + if (referenceId !== undefined) { + _queryParams["reference_id"] = referenceId; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/cards", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCardsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/cards."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.cards ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Adds a card on file to an existing merchant. + * + * @param {Square.CreateCardRequest} request + * @param {Cards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.cards.create({ + * idempotencyKey: "4935a656-a929-4792-b97c-8848be85c27c", + * sourceId: "cnon:uIbfJXhXETSP197M3GB", + * 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" + * } + * }) + */ + public async create( + request: Square.CreateCardRequest, + requestOptions?: Cards.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/cards", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateCardRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/cards."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves details for a specific Card. + * + * @param {Square.CardsGetRequest} request + * @param {Cards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.cards.get({ + * cardId: "card_id" + * }) + */ + public async get( + request: Square.CardsGetRequest, + requestOptions?: Cards.RequestOptions, + ): Promise { + const { cardId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/cards/${encodeURIComponent(cardId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/cards/{card_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Disables the card, preventing any further updates or charges. + * Disabling an already disabled card is allowed but has no effect. + * + * @param {Square.CardsDisableRequest} request + * @param {Cards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.cards.disable({ + * cardId: "card_id" + * }) + */ + public async disable( + request: Square.CardsDisableRequest, + requestOptions?: Cards.RequestOptions, + ): Promise { + const { cardId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/cards/${encodeURIComponent(cardId)}/disable`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DisableCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/cards/{card_id}/disable."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/cards/client/index.ts b/src/api/resources/cards/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/cards/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/cards/client/requests/CardsDisableRequest.ts b/src/api/resources/cards/client/requests/CardsDisableRequest.ts new file mode 100644 index 000000000..326233436 --- /dev/null +++ b/src/api/resources/cards/client/requests/CardsDisableRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * cardId: "card_id" + * } + */ +export interface CardsDisableRequest { + /** + * Unique ID for the desired Card. + */ + cardId: string; +} diff --git a/src/api/resources/cards/client/requests/CardsGetRequest.ts b/src/api/resources/cards/client/requests/CardsGetRequest.ts new file mode 100644 index 000000000..a36c6148f --- /dev/null +++ b/src/api/resources/cards/client/requests/CardsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * cardId: "card_id" + * } + */ +export interface CardsGetRequest { + /** + * Unique ID for the desired Card. + */ + cardId: string; +} diff --git a/src/api/resources/cards/client/requests/CardsListRequest.ts b/src/api/resources/cards/client/requests/CardsListRequest.ts new file mode 100644 index 000000000..d5b157d91 --- /dev/null +++ b/src/api/resources/cards/client/requests/CardsListRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface CardsListRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for your original query. + * + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string | null; + /** + * Limit results to cards associated with the customer supplied. + * By default, all cards owned by the merchant are returned. + */ + customerId?: string | null; + /** + * Includes disabled cards. + * By default, all enabled cards owned by the merchant are returned. + */ + includeDisabled?: boolean | null; + /** + * Limit results to cards associated with the reference_id supplied. + */ + referenceId?: string | null; + /** + * Sorts the returned list by when the card was created with the specified order. + * This field defaults to ASC. + */ + sortOrder?: Square.SortOrder | null; +} diff --git a/src/api/resources/cards/client/requests/CreateCardRequest.ts b/src/api/resources/cards/client/requests/CreateCardRequest.ts new file mode 100644 index 000000000..54ac6b9bf --- /dev/null +++ b/src/api/resources/cards/client/requests/CreateCardRequest.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * idempotencyKey: "4935a656-a929-4792-b97c-8848be85c27c", + * sourceId: "cnon:uIbfJXhXETSP197M3GB", + * 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" + * } + * } + */ +export interface CreateCardRequest { + /** + * A unique string that identifies this CreateCard request. Keys can be + * any valid string and must be unique for every request. + * + * Max: 45 characters + * + * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + */ + idempotencyKey: string; + /** The ID of the source which represents the card information to be stored. This can be a card nonce or a payment id. */ + sourceId: string; + /** + * An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer). + * Verification tokens encapsulate customer device information and 3-D Secure + * challenge results to indicate that Square has verified the buyer identity. + * + * See the [SCA Overview](https://developer.squareup.com/docs/sca-overview). + */ + verificationToken?: string; + /** Payment details associated with the card to be stored. */ + card: Square.Card; +} diff --git a/src/api/resources/cards/client/requests/index.ts b/src/api/resources/cards/client/requests/index.ts new file mode 100644 index 000000000..68e9d706b --- /dev/null +++ b/src/api/resources/cards/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type CardsListRequest } from "./CardsListRequest"; +export { type CreateCardRequest } from "./CreateCardRequest"; +export { type CardsGetRequest } from "./CardsGetRequest"; +export { type CardsDisableRequest } from "./CardsDisableRequest"; diff --git a/src/api/resources/cards/index.ts b/src/api/resources/cards/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/cards/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/cashDrawers/client/Client.ts b/src/api/resources/cashDrawers/client/Client.ts new file mode 100644 index 000000000..66343f1c7 --- /dev/null +++ b/src/api/resources/cashDrawers/client/Client.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import { Shifts } from "../resources/shifts/client/Client"; + +export declare namespace CashDrawers { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CashDrawers { + protected _shifts: Shifts | undefined; + + constructor(protected readonly _options: CashDrawers.Options = {}) {} + + public get shifts(): Shifts { + return (this._shifts ??= new Shifts(this._options)); + } +} diff --git a/src/api/resources/cashDrawers/client/index.ts b/src/api/resources/cashDrawers/client/index.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/src/api/resources/cashDrawers/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/cashDrawers/index.ts b/src/api/resources/cashDrawers/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/cashDrawers/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/cashDrawers/resources/index.ts b/src/api/resources/cashDrawers/resources/index.ts new file mode 100644 index 000000000..1e7da9b44 --- /dev/null +++ b/src/api/resources/cashDrawers/resources/index.ts @@ -0,0 +1,2 @@ +export * as shifts from "./shifts"; +export * from "./shifts/client/requests"; diff --git a/src/api/resources/cashDrawers/resources/shifts/client/Client.ts b/src/api/resources/cashDrawers/resources/shifts/client/Client.ts new file mode 100644 index 000000000..11b911a6f --- /dev/null +++ b/src/api/resources/cashDrawers/resources/shifts/client/Client.ts @@ -0,0 +1,328 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Shifts { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Shifts { + constructor(protected readonly _options: Shifts.Options = {}) {} + + /** + * Provides the details for all of the cash drawer shifts for a location + * in a date range. + * + * @param {Square.cashDrawers.ShiftsListRequest} request + * @param {Shifts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.cashDrawers.shifts.list({ + * locationId: "location_id" + * }) + */ + public async list( + request: Square.cashDrawers.ShiftsListRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise> { + const list = async ( + request: Square.cashDrawers.ShiftsListRequest, + ): Promise => { + const { locationId, sortOrder, beginTime, endTime, limit, cursor } = request; + const _queryParams: Record = {}; + _queryParams["location_id"] = locationId; + if (sortOrder !== undefined) { + _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (beginTime !== undefined) { + _queryParams["begin_time"] = beginTime; + } + if (endTime !== undefined) { + _queryParams["end_time"] = endTime; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/cash-drawers/shifts", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCashDrawerShiftsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/cash-drawers/shifts."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.cashDrawerShifts ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Provides the summary details for a single cash drawer shift. See + * [ListCashDrawerShiftEvents](api-endpoint:CashDrawers-ListCashDrawerShiftEvents) for a list of cash drawer shift events. + * + * @param {Square.cashDrawers.ShiftsGetRequest} request + * @param {Shifts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.cashDrawers.shifts.get({ + * shiftId: "shift_id", + * locationId: "location_id" + * }) + */ + public async get( + request: Square.cashDrawers.ShiftsGetRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise { + const { shiftId, locationId } = request; + const _queryParams: Record = {}; + _queryParams["location_id"] = locationId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/cash-drawers/shifts/${encodeURIComponent(shiftId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCashDrawerShiftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/cash-drawers/shifts/{shift_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Provides a paginated list of events for a single cash drawer shift. + * + * @param {Square.cashDrawers.ShiftsListEventsRequest} request + * @param {Shifts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.cashDrawers.shifts.listEvents({ + * shiftId: "shift_id", + * locationId: "location_id" + * }) + */ + public async listEvents( + request: Square.cashDrawers.ShiftsListEventsRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise> { + const list = async ( + request: Square.cashDrawers.ShiftsListEventsRequest, + ): Promise => { + const { shiftId, locationId, limit, cursor } = request; + const _queryParams: Record = {}; + _queryParams["location_id"] = locationId; + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/cash-drawers/shifts/${encodeURIComponent(shiftId)}/events`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCashDrawerShiftEventsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/cash-drawers/shifts/{shift_id}/events.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.cashDrawerShiftEvents ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/cashDrawers/resources/shifts/client/index.ts b/src/api/resources/cashDrawers/resources/shifts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/cashDrawers/resources/shifts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsGetRequest.ts b/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsGetRequest.ts new file mode 100644 index 000000000..6c512eb3b --- /dev/null +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsGetRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * shiftId: "shift_id", + * locationId: "location_id" + * } + */ +export interface ShiftsGetRequest { + /** + * The shift ID. + */ + shiftId: string; + /** + * The ID of the location to retrieve cash drawer shifts from. + */ + locationId: string; +} diff --git a/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsListEventsRequest.ts b/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsListEventsRequest.ts new file mode 100644 index 000000000..d4cd42352 --- /dev/null +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsListEventsRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * shiftId: "shift_id", + * locationId: "location_id" + * } + */ +export interface ShiftsListEventsRequest { + /** + * The shift ID. + */ + shiftId: string; + /** + * The ID of the location to list cash drawer shifts for. + */ + locationId: string; + /** + * Number of resources to be returned in a page of results (200 by + * default, 1000 max). + */ + limit?: number | null; + /** + * Opaque cursor for fetching the next page of results. + */ + cursor?: string | null; +} diff --git a/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsListRequest.ts b/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsListRequest.ts new file mode 100644 index 000000000..98531357b --- /dev/null +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/ShiftsListRequest.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * locationId: "location_id" + * } + */ +export interface ShiftsListRequest { + /** + * The ID of the location to query for a list of cash drawer shifts. + */ + locationId: string; + /** + * The order in which cash drawer shifts are listed in the response, + * based on their opened_at field. Default value: ASC + */ + sortOrder?: Square.SortOrder | null; + /** + * The inclusive start time of the query on opened_at, in ISO 8601 format. + */ + beginTime?: string | null; + /** + * The exclusive end date of the query on opened_at, in ISO 8601 format. + */ + endTime?: string | null; + /** + * Number of cash drawer shift events in a page of results (200 by + * default, 1000 max). + */ + limit?: number | null; + /** + * Opaque cursor for fetching the next page of results. + */ + cursor?: string | null; +} diff --git a/src/api/resources/cashDrawers/resources/shifts/client/requests/index.ts b/src/api/resources/cashDrawers/resources/shifts/client/requests/index.ts new file mode 100644 index 000000000..fe57b25b5 --- /dev/null +++ b/src/api/resources/cashDrawers/resources/shifts/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type ShiftsListRequest } from "./ShiftsListRequest"; +export { type ShiftsGetRequest } from "./ShiftsGetRequest"; +export { type ShiftsListEventsRequest } from "./ShiftsListEventsRequest"; diff --git a/src/api/resources/cashDrawers/resources/shifts/index.ts b/src/api/resources/cashDrawers/resources/shifts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/cashDrawers/resources/shifts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/catalog/client/Client.ts b/src/api/resources/catalog/client/Client.ts new file mode 100644 index 000000000..aaeefea40 --- /dev/null +++ b/src/api/resources/catalog/client/Client.ts @@ -0,0 +1,867 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; +import { Images } from "../resources/images/client/Client"; +import { Object_ } from "../resources/object/client/Client"; + +export declare namespace Catalog { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Catalog { + protected _images: Images | undefined; + protected _object: Object_ | undefined; + + constructor(protected readonly _options: Catalog.Options = {}) {} + + public get images(): Images { + return (this._images ??= new Images(this._options)); + } + + public get object(): Object_ { + return (this._object ??= new Object_(this._options)); + } + + /** + * Deletes a set of [CatalogItem](entity:CatalogItem)s based on the + * provided list of target IDs and returns a set of successfully deleted IDs in + * the response. Deletion is a cascading event such that all children of the + * targeted object are also deleted. For example, deleting a CatalogItem will + * also delete all of its [CatalogItemVariation](entity:CatalogItemVariation) + * children. + * + * `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted + * IDs can be deleted. The response will only include IDs that were + * actually deleted. + * + * To ensure consistency, only one delete request is processed at a time per seller account. + * While one (batch or non-batch) delete request is being processed, other (batched and non-batched) + * delete requests are rejected with the `429` error code. + * + * @param {Square.BatchDeleteCatalogObjectsRequest} request + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.batchDelete({ + * objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"] + * }) + */ + public async batchDelete( + request: Square.BatchDeleteCatalogObjectsRequest = {}, + requestOptions?: Catalog.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/batch-delete", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchDeleteCatalogObjectsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchDeleteCatalogObjectsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/batch-delete."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns a set of objects based on the provided ID. + * Each [CatalogItem](entity:CatalogItem) returned in the set includes all of its + * child information including: all of its + * [CatalogItemVariation](entity:CatalogItemVariation) objects, references to + * its [CatalogModifierList](entity:CatalogModifierList) objects, and the ids of + * any [CatalogTax](entity:CatalogTax) objects that apply to it. + * + * @param {Square.BatchGetCatalogObjectsRequest} request + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.batchGet({ + * objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + * includeRelatedObjects: true + * }) + */ + public async batchGet( + request: Square.BatchGetCatalogObjectsRequest, + requestOptions?: Catalog.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/batch-retrieve", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchGetCatalogObjectsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchGetCatalogObjectsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/batch-retrieve."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates up to 10,000 target objects based on the provided + * list of objects. The target objects are grouped into batches and each batch is + * inserted/updated in an all-or-nothing manner. If an object within a batch is + * malformed in some way, or violates a database constraint, the entire batch + * containing that item will be disregarded. However, other batches in the same + * request may still succeed. Each batch may contain up to 1,000 objects, and + * batches will be processed in order as long as the total object count for the + * request (items, variations, modifier lists, discounts, and taxes) is no more + * than 10,000. + * + * To ensure consistency, only one update request is processed at a time per seller account. + * While one (batch or non-batch) update request is being processed, other (batched and non-batched) + * update requests are rejected with the `429` error code. + * + * @param {Square.BatchUpsertCatalogObjectsRequest} request + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.batchUpsert({ + * idempotencyKey: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", + * batches: [{ + * objects: [{ + * type: "SUBSCRIPTION_PRODUCT", + * id: "#Tea", + * presentAtAllLocations: true + * }, { + * type: "SUBSCRIPTION_PRODUCT", + * id: "#Coffee", + * presentAtAllLocations: true + * }, { + * type: "SUBSCRIPTION_PRODUCT", + * id: "#Beverages", + * presentAtAllLocations: true + * }, { + * type: "SUBSCRIPTION_PRODUCT", + * id: "#SalesTax", + * presentAtAllLocations: true + * }] + * }] + * }) + */ + public async batchUpsert( + request: Square.BatchUpsertCatalogObjectsRequest, + requestOptions?: Catalog.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/batch-upsert", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchUpsertCatalogObjectsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchUpsertCatalogObjectsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/batch-upsert."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves information about the Square Catalog API, such as batch size + * limits that can be used by the `BatchUpsertCatalogObjects` endpoint. + * + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.info() + */ + public async info(requestOptions?: Catalog.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/info", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CatalogInfoResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/catalog/info."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns a list of all [CatalogObject](entity:CatalogObject)s of the specified types in the catalog. + * + * The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values, + * for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`". + * + * __Important:__ ListCatalog does not return deleted catalog items. To retrieve + * deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects) + * and set the `include_deleted_objects` attribute value to `true`. + * + * @param {Square.CatalogListRequest} request + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.list() + */ + public async list( + request: Square.CatalogListRequest = {}, + requestOptions?: Catalog.RequestOptions, + ): Promise> { + const list = async (request: Square.CatalogListRequest): Promise => { + const { cursor, types, catalogVersion } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (types !== undefined) { + _queryParams["types"] = types; + } + if (catalogVersion !== undefined) { + _queryParams["catalog_version"] = catalogVersion?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/list", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCatalogResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/catalog/list."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.objects ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Searches for [CatalogObject](entity:CatalogObject) of any type by matching supported search attribute values, + * excluding custom attribute values on items or item variations, against one or more of the specified query filters. + * + * This (`SearchCatalogObjects`) endpoint differs from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) + * endpoint in the following aspects: + * + * - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. + * - `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not. + * - `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does. + * - The both endpoints have different call conventions, including the query filter formats. + * + * @param {Square.SearchCatalogObjectsRequest} request + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.search({ + * objectTypes: ["ITEM"], + * query: { + * prefixQuery: { + * attributeName: "name", + * attributePrefix: "tea" + * } + * }, + * limit: 100 + * }) + */ + public async search( + request: Square.SearchCatalogObjectsRequest = {}, + requestOptions?: Catalog.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchCatalogObjectsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchCatalogObjectsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Searches for catalog items or item variations by matching supported search attribute values, including + * custom attribute values, against one or more of the specified query filters. + * + * This (`SearchCatalogItems`) endpoint differs from the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects) + * endpoint in the following aspects: + * + * - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. + * - `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not. + * - `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does. + * - The both endpoints use different call conventions, including the query filter formats. + * + * @param {Square.SearchCatalogItemsRequest} request + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.searchItems({ + * 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: "min", + * max: "max" + * } + * }, { + * customAttributeDefinitionId: "VARIETAL_DEFINITION_ID" + * }] + * }) + */ + public async searchItems( + request: Square.SearchCatalogItemsRequest = {}, + requestOptions?: Catalog.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/search-catalog-items", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchCatalogItemsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchCatalogItemsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/catalog/search-catalog-items.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates the [CatalogModifierList](entity:CatalogModifierList) objects + * that apply to the targeted [CatalogItem](entity:CatalogItem) without having + * to perform an upsert on the entire item. + * + * @param {Square.UpdateItemModifierListsRequest} request + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.updateItemModifierLists({ + * itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * modifierListsToEnable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * modifierListsToDisable: ["7WRC16CJZDVLSNDQ35PP6YAD"] + * }) + */ + public async updateItemModifierLists( + request: Square.UpdateItemModifierListsRequest, + requestOptions?: Catalog.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/update-item-modifier-lists", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateItemModifierListsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateItemModifierListsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/catalog/update-item-modifier-lists.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates the [CatalogTax](entity:CatalogTax) objects that apply to the + * targeted [CatalogItem](entity:CatalogItem) without having to perform an + * upsert on the entire item. + * + * @param {Square.UpdateItemTaxesRequest} request + * @param {Catalog.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.updateItemTaxes({ + * itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * taxesToEnable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], + * taxesToDisable: ["AQCEGCEBBQONINDOHRGZISEX"] + * }) + */ + public async updateItemTaxes( + request: Square.UpdateItemTaxesRequest, + requestOptions?: Catalog.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/update-item-taxes", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateItemTaxesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateItemTaxesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/catalog/update-item-taxes.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/catalog/client/index.ts b/src/api/resources/catalog/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/catalog/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts b/src/api/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts new file mode 100644 index 000000000..1ab61ebc3 --- /dev/null +++ b/src/api/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"] + * } + */ +export interface BatchDeleteCatalogObjectsRequest { + /** + * The IDs of the CatalogObjects to be deleted. When an object is deleted, other objects + * in the graph that depend on that object will be deleted as well (for example, deleting a + * CatalogItem will delete its CatalogItemVariation. + */ + objectIds?: string[] | null; +} diff --git a/src/api/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts b/src/api/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts new file mode 100644 index 000000000..be6a46943 --- /dev/null +++ b/src/api/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * objectIds: ["W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK"], + * includeRelatedObjects: true + * } + */ +export interface BatchGetCatalogObjectsRequest { + /** The IDs of the CatalogObjects to be retrieved. */ + objectIds: string[]; + /** + * If `true`, the response will include additional objects that are related to the + * requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field + * of the response. These objects are put in the `related_objects` field. Setting this to `true` is + * helpful when the objects are needed for immediate display to a user. + * This process only goes one level deep. Objects referenced by the related objects will not be included. For example, + * + * if the `objects` field of the response contains a CatalogItem, its associated + * CatalogCategory objects, CatalogTax objects, CatalogImage objects and + * CatalogModifierLists will be returned in the `related_objects` field of the + * response. If the `objects` field of the response contains a CatalogItemVariation, + * its parent CatalogItem will be returned in the `related_objects` field of + * the response. + * + * Default value: `false` + */ + includeRelatedObjects?: boolean | null; + /** + * The specific version of the catalog objects to be included in the response. + * This allows you to retrieve historical versions of objects. The specified version value is matched against + * the [CatalogObject](entity:CatalogObject)s' `version` attribute. If not included, results will + * be from the current version of the catalog. + */ + catalogVersion?: bigint | null; + /** Indicates whether to include (`true`) or not (`false`) in the response deleted objects, namely, those with the `is_deleted` attribute set to `true`. */ + includeDeletedObjects?: boolean | null; + /** + * Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists + * of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category + * and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned + * in the response payload. + */ + includeCategoryPathToRoot?: boolean | null; +} diff --git a/src/api/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts b/src/api/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts new file mode 100644 index 000000000..939d61c18 --- /dev/null +++ b/src/api/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * idempotencyKey: "789ff020-f723-43a9-b4b5-43b5dc1fa3dc", + * batches: [{ + * objects: [{ + * type: "SUBSCRIPTION_PRODUCT", + * id: "#Tea", + * presentAtAllLocations: true + * }, { + * type: "SUBSCRIPTION_PRODUCT", + * id: "#Coffee", + * presentAtAllLocations: true + * }, { + * type: "SUBSCRIPTION_PRODUCT", + * id: "#Beverages", + * presentAtAllLocations: true + * }, { + * type: "SUBSCRIPTION_PRODUCT", + * id: "#SalesTax", + * presentAtAllLocations: true + * }] + * }] + * } + */ +export interface BatchUpsertCatalogObjectsRequest { + /** + * A value you specify that uniquely identifies this + * request among all your requests. A common way to create + * a valid idempotency key is to use a Universally unique + * identifier (UUID). + * + * If you're unsure whether a particular request was successful, + * you can reattempt it with the same idempotency key without + * worrying about creating duplicate objects. + * + * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + */ + idempotencyKey: string; + /** + * A batch of CatalogObjects to be inserted/updated atomically. + * The objects within a batch will be inserted in an all-or-nothing fashion, i.e., if an error occurs + * attempting to insert or update an object within a batch, the entire batch will be rejected. However, an error + * in one batch will not affect other batches within the same request. + * + * For each object, its `updated_at` field is ignored and replaced with a current [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), and its + * `is_deleted` field must not be set to `true`. + * + * To modify an existing object, supply its ID. To create a new object, use an ID starting + * with `#`. These IDs may be used to create relationships between an object and attributes of + * other objects that reference it. For example, you can create a CatalogItem with + * ID `#ABC` and a CatalogItemVariation with its `item_id` attribute set to + * `#ABC` in order to associate the CatalogItemVariation with its parent + * CatalogItem. + * + * Any `#`-prefixed IDs are valid only within a single atomic batch, and will be replaced by server-generated IDs. + * + * Each batch may contain up to 1,000 objects. The total number of objects across all batches for a single request + * may not exceed 10,000. If either of these limits is violated, an error will be returned and no objects will + * be inserted or updated. + */ + batches: Square.CatalogObjectBatch[]; +} diff --git a/src/api/resources/catalog/client/requests/CatalogListRequest.ts b/src/api/resources/catalog/client/requests/CatalogListRequest.ts new file mode 100644 index 000000000..7b1fbf316 --- /dev/null +++ b/src/api/resources/catalog/client/requests/CatalogListRequest.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface CatalogListRequest { + /** + * The pagination cursor returned in the previous response. Leave unset for an initial request. + * The page size is currently set to be 100. + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string | null; + /** + * An optional case-insensitive, comma-separated list of object types to retrieve. + * + * The valid values are defined in the [CatalogObjectType](entity:CatalogObjectType) enum, for example, + * `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, + * `MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc. + * + * If this is unspecified, the operation returns objects of all the top level types at the version + * of the Square API used to make the request. Object types that are nested onto other object types + * are not included in the defaults. + * + * At the current API version the default object types are: + * ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, + * PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, + * SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. + */ + types?: string | null; + /** + * The specific version of the catalog objects to be included in the response. + * This allows you to retrieve historical versions of objects. The specified version value is matched against + * the [CatalogObject](entity:CatalogObject)s' `version` attribute. If not included, results will be from the + * current version of the catalog. + */ + catalogVersion?: bigint | null; +} diff --git a/src/api/resources/catalog/client/requests/SearchCatalogItemsRequest.ts b/src/api/resources/catalog/client/requests/SearchCatalogItemsRequest.ts new file mode 100644 index 000000000..040e6a65f --- /dev/null +++ b/src/api/resources/catalog/client/requests/SearchCatalogItemsRequest.ts @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * 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: "min", + * max: "max" + * } + * }, { + * customAttributeDefinitionId: "VARIETAL_DEFINITION_ID" + * }] + * } + */ +export interface SearchCatalogItemsRequest { + /** + * The text filter expression to return items or item variations containing specified text in + * the `name`, `description`, or `abbreviation` attribute value of an item, or in + * the `name`, `sku`, or `upc` attribute value of an item variation. + */ + textFilter?: string; + /** The category id query expression to return items containing the specified category IDs. */ + categoryIds?: string[]; + /** + * The stock-level query expression to return item variations with the specified stock levels. + * See [SearchCatalogItemsRequestStockLevel](#type-searchcatalogitemsrequeststocklevel) for possible values + */ + stockLevels?: Square.SearchCatalogItemsRequestStockLevel[]; + /** The enabled-location query expression to return items and item variations having specified enabled locations. */ + enabledLocationIds?: string[]; + /** The pagination token, returned in the previous response, used to fetch the next batch of pending results. */ + cursor?: string; + /** The maximum number of results to return per page. The default value is 100. */ + limit?: number; + /** + * The order to sort the results by item names. The default sort order is ascending (`ASC`). + * See [SortOrder](#type-sortorder) for possible values + */ + sortOrder?: Square.SortOrder; + /** The product types query expression to return items or item variations having the specified product types. */ + productTypes?: Square.CatalogItemProductType[]; + /** + * The customer-attribute filter to return items or item variations matching the specified + * custom attribute expressions. A maximum number of 10 custom attribute expressions are supported in + * a single call to the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint. + */ + customAttributeFilters?: Square.CustomAttributeFilter[]; + /** The query filter to return not archived (`ARCHIVED_STATE_NOT_ARCHIVED`), archived (`ARCHIVED_STATE_ARCHIVED`), or either type (`ARCHIVED_STATE_ALL`) of items. */ + archivedState?: Square.ArchivedState; +} diff --git a/src/api/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts b/src/api/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts new file mode 100644 index 000000000..93c4054a5 --- /dev/null +++ b/src/api/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * objectTypes: ["ITEM"], + * query: { + * prefixQuery: { + * attributeName: "name", + * attributePrefix: "tea" + * } + * }, + * limit: 100 + * } + */ +export interface SearchCatalogObjectsRequest { + /** + * The pagination cursor returned in the previous response. Leave unset for an initial request. + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string; + /** + * The desired set of object types to appear in the search results. + * + * If this is unspecified, the operation returns objects of all the top level types at the version + * of the Square API used to make the request. Object types that are nested onto other object types + * are not included in the defaults. + * + * At the current API version the default object types are: + * ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, + * PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, + * SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. + * + * Note that if you wish for the query to return objects belonging to nested types (i.e., COMPONENT, IMAGE, + * ITEM_OPTION_VAL, ITEM_VARIATION, or MODIFIER), you must explicitly include all the types of interest + * in this field. + */ + objectTypes?: Square.CatalogObjectType[]; + /** If `true`, deleted objects will be included in the results. Defaults to `false`. Deleted objects will have their `is_deleted` field set to `true`. If `include_deleted_objects` is `true`, then the `include_category_path_to_root` request parameter must be `false`. Both properties cannot be `true` at the same time. */ + includeDeletedObjects?: boolean; + /** + * If `true`, the response will include additional objects that are related to the + * requested objects. Related objects are objects that are referenced by object ID by the objects + * in the response. This is helpful if the objects are being fetched for immediate display to a user. + * This process only goes one level deep. Objects referenced by the related objects will not be included. + * For example: + * + * If the `objects` field of the response contains a CatalogItem, its associated + * CatalogCategory objects, CatalogTax objects, CatalogImage objects and + * CatalogModifierLists will be returned in the `related_objects` field of the + * response. If the `objects` field of the response contains a CatalogItemVariation, + * its parent CatalogItem will be returned in the `related_objects` field of + * the response. + * + * Default value: `false` + */ + includeRelatedObjects?: boolean; + /** + * Return objects modified after this [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), in RFC 3339 + * format, e.g., `2016-09-04T23:59:33.123Z`. The timestamp is exclusive - objects with a + * timestamp equal to `begin_time` will not be included in the response. + */ + beginTime?: string; + /** A query to be used to filter or sort the results. If no query is specified, the entire catalog will be returned. */ + query?: Square.CatalogQuery; + /** + * A limit on the number of results to be returned in a single page. The limit is advisory - + * the implementation may return more or fewer results. If the supplied limit is negative, zero, or + * is higher than the maximum limit of 1,000, it will be ignored. + */ + limit?: number; + /** Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned in the response payload. If `include_category_path_to_root` is `true`, then the `include_deleted_objects` request parameter must be `false`. Both properties cannot be `true` at the same time. */ + includeCategoryPathToRoot?: boolean; +} diff --git a/src/api/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts b/src/api/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts new file mode 100644 index 000000000..993504615 --- /dev/null +++ b/src/api/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * modifierListsToEnable: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * modifierListsToDisable: ["7WRC16CJZDVLSNDQ35PP6YAD"] + * } + */ +export interface UpdateItemModifierListsRequest { + /** The IDs of the catalog items associated with the CatalogModifierList objects being updated. */ + itemIds: string[]; + /** + * The IDs of the CatalogModifierList objects to enable for the CatalogItem. + * At least one of `modifier_lists_to_enable` or `modifier_lists_to_disable` must be specified. + */ + modifierListsToEnable?: string[] | null; + /** + * The IDs of the CatalogModifierList objects to disable for the CatalogItem. + * At least one of `modifier_lists_to_enable` or `modifier_lists_to_disable` must be specified. + */ + modifierListsToDisable?: string[] | null; +} diff --git a/src/api/resources/catalog/client/requests/UpdateItemTaxesRequest.ts b/src/api/resources/catalog/client/requests/UpdateItemTaxesRequest.ts new file mode 100644 index 000000000..45b6420c6 --- /dev/null +++ b/src/api/resources/catalog/client/requests/UpdateItemTaxesRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * itemIds: ["H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6"], + * taxesToEnable: ["4WRCNHCJZDVLSNDQ35PP6YAD"], + * taxesToDisable: ["AQCEGCEBBQONINDOHRGZISEX"] + * } + */ +export interface UpdateItemTaxesRequest { + /** + * IDs for the CatalogItems associated with the CatalogTax objects being updated. + * No more than 1,000 IDs may be provided. + */ + itemIds: string[]; + /** + * IDs of the CatalogTax objects to enable. + * At least one of `taxes_to_enable` or `taxes_to_disable` must be specified. + */ + taxesToEnable?: string[] | null; + /** + * IDs of the CatalogTax objects to disable. + * At least one of `taxes_to_enable` or `taxes_to_disable` must be specified. + */ + taxesToDisable?: string[] | null; +} diff --git a/src/api/resources/catalog/client/requests/index.ts b/src/api/resources/catalog/client/requests/index.ts new file mode 100644 index 000000000..1308442f1 --- /dev/null +++ b/src/api/resources/catalog/client/requests/index.ts @@ -0,0 +1,8 @@ +export { type BatchDeleteCatalogObjectsRequest } from "./BatchDeleteCatalogObjectsRequest"; +export { type BatchGetCatalogObjectsRequest } from "./BatchGetCatalogObjectsRequest"; +export { type BatchUpsertCatalogObjectsRequest } from "./BatchUpsertCatalogObjectsRequest"; +export { type CatalogListRequest } from "./CatalogListRequest"; +export { type SearchCatalogObjectsRequest } from "./SearchCatalogObjectsRequest"; +export { type SearchCatalogItemsRequest } from "./SearchCatalogItemsRequest"; +export { type UpdateItemModifierListsRequest } from "./UpdateItemModifierListsRequest"; +export { type UpdateItemTaxesRequest } from "./UpdateItemTaxesRequest"; diff --git a/src/api/resources/catalog/index.ts b/src/api/resources/catalog/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/catalog/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/catalog/resources/images/client/Client.ts b/src/api/resources/catalog/resources/images/client/Client.ts new file mode 100644 index 000000000..ae7892ee0 --- /dev/null +++ b/src/api/resources/catalog/resources/images/client/Client.ts @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import { toJson } from "../../../../../../core/json"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Images { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Images { + constructor(protected readonly _options: Images.Options = {}) {} + + /** + * Uploads an image file to be represented by a [CatalogImage](entity:CatalogImage) object that can be linked to an existing + * [CatalogObject](entity:CatalogObject) instance. The resulting `CatalogImage` is unattached to any `CatalogObject` if the `object_id` + * is not specified. + * + * This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in + * JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. + * + * @param {Square.catalog.ImagesCreateRequest} request + * @param {Images.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.images.create({}) + */ + public async create( + request: Square.catalog.ImagesCreateRequest, + requestOptions?: Images.RequestOptions, + ): Promise { + const _request = await core.newFormData(); + if (request.request != null) { + _request.append( + "request", + toJson( + serializers.CreateCatalogImageRequest.jsonOrThrow(request.request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + ), + ); + } + + if (request.imageFile != null) { + await _request.appendFile("image_file", request.imageFile); + } + + const _maybeEncodedRequest = await _request.getRequest(); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/images", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ..._maybeEncodedRequest.headers, + ...requestOptions?.headers, + }, + requestType: "file", + duplex: _maybeEncodedRequest.duplex, + body: _maybeEncodedRequest.body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCatalogImageResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/images."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Uploads a new image file to replace the existing one in the specified [CatalogImage](entity:CatalogImage) object. + * + * This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in + * JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. + * + * @param {Square.catalog.ImagesUpdateRequest} request + * @param {Images.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.images.update({ + * imageId: "image_id" + * }) + */ + public async update( + request: Square.catalog.ImagesUpdateRequest, + requestOptions?: Images.RequestOptions, + ): Promise { + const _request = await core.newFormData(); + if (request.request != null) { + _request.append( + "request", + toJson( + serializers.UpdateCatalogImageRequest.jsonOrThrow(request.request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + ), + ); + } + + if (request.imageFile != null) { + await _request.appendFile("image_file", request.imageFile); + } + + const _maybeEncodedRequest = await _request.getRequest(); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/catalog/images/${encodeURIComponent(request.imageId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ..._maybeEncodedRequest.headers, + ...requestOptions?.headers, + }, + requestType: "file", + duplex: _maybeEncodedRequest.duplex, + body: _maybeEncodedRequest.body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateCatalogImageResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/catalog/images/{image_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/catalog/resources/images/client/index.ts b/src/api/resources/catalog/resources/images/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/catalog/resources/images/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/catalog/resources/images/client/requests/ImagesCreateRequest.ts b/src/api/resources/catalog/resources/images/client/requests/ImagesCreateRequest.ts new file mode 100644 index 000000000..bae33b4aa --- /dev/null +++ b/src/api/resources/catalog/resources/images/client/requests/ImagesCreateRequest.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; +import * as fs from "fs"; + +/** + * @example + * {} + */ +export interface ImagesCreateRequest { + request?: Square.CreateCatalogImageRequest; + imageFile?: File | fs.ReadStream | Blob | undefined; +} diff --git a/src/api/resources/catalog/resources/images/client/requests/ImagesUpdateRequest.ts b/src/api/resources/catalog/resources/images/client/requests/ImagesUpdateRequest.ts new file mode 100644 index 000000000..fdd5a6e11 --- /dev/null +++ b/src/api/resources/catalog/resources/images/client/requests/ImagesUpdateRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; +import * as fs from "fs"; + +/** + * @example + * { + * imageId: "image_id" + * } + */ +export interface ImagesUpdateRequest { + /** + * The ID of the `CatalogImage` object to update the encapsulated image file. + */ + imageId: string; + request?: Square.UpdateCatalogImageRequest; + imageFile?: File | fs.ReadStream | Blob | undefined; +} diff --git a/src/api/resources/catalog/resources/images/client/requests/index.ts b/src/api/resources/catalog/resources/images/client/requests/index.ts new file mode 100644 index 000000000..a33746277 --- /dev/null +++ b/src/api/resources/catalog/resources/images/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type ImagesCreateRequest } from "./ImagesCreateRequest"; +export { type ImagesUpdateRequest } from "./ImagesUpdateRequest"; diff --git a/src/api/resources/catalog/resources/images/index.ts b/src/api/resources/catalog/resources/images/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/catalog/resources/images/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/catalog/resources/index.ts b/src/api/resources/catalog/resources/index.ts new file mode 100644 index 000000000..cbcd61155 --- /dev/null +++ b/src/api/resources/catalog/resources/index.ts @@ -0,0 +1,4 @@ +export * as images from "./images"; +export * as object from "./object"; +export * from "./images/client/requests"; +export * from "./object/client/requests"; diff --git a/src/api/resources/catalog/resources/object/client/Client.ts b/src/api/resources/catalog/resources/object/client/Client.ts new file mode 100644 index 000000000..bdca1770c --- /dev/null +++ b/src/api/resources/catalog/resources/object/client/Client.ts @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Object_ { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Object_ { + constructor(protected readonly _options: Object_.Options = {}) {} + + /** + * Creates a new or updates the specified [CatalogObject](entity:CatalogObject). + * + * To ensure consistency, only one update request is processed at a time per seller account. + * While one (batch or non-batch) update request is being processed, other (batched and non-batched) + * update requests are rejected with the `429` error code. + * + * @param {Square.catalog.UpsertCatalogObjectRequest} request + * @param {Object_.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.object.upsert({ + * idempotencyKey: "af3d1afc-7212-4300-b463-0bfc5314a5ae", + * object: { + * type: "SUBSCRIPTION_PRODUCT", + * id: "#Cocoa" + * } + * }) + */ + public async upsert( + request: Square.catalog.UpsertCatalogObjectRequest, + requestOptions?: Object_.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/catalog/object", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.catalog.UpsertCatalogObjectRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpsertCatalogObjectResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/catalog/object."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns a single [CatalogItem](entity:CatalogItem) as a + * [CatalogObject](entity:CatalogObject) based on the provided ID. The returned + * object includes all of the relevant [CatalogItem](entity:CatalogItem) + * information including: [CatalogItemVariation](entity:CatalogItemVariation) + * children, references to its + * [CatalogModifierList](entity:CatalogModifierList) objects, and the ids of + * any [CatalogTax](entity:CatalogTax) objects that apply to it. + * + * @param {Square.catalog.ObjectGetRequest} request + * @param {Object_.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.object.get({ + * objectId: "object_id" + * }) + */ + public async get( + request: Square.catalog.ObjectGetRequest, + requestOptions?: Object_.RequestOptions, + ): Promise { + const { objectId, includeRelatedObjects, catalogVersion, includeCategoryPathToRoot } = request; + const _queryParams: Record = {}; + if (includeRelatedObjects !== undefined) { + _queryParams["include_related_objects"] = includeRelatedObjects?.toString() ?? null; + } + + if (catalogVersion !== undefined) { + _queryParams["catalog_version"] = catalogVersion?.toString() ?? null; + } + + if (includeCategoryPathToRoot !== undefined) { + _queryParams["include_category_path_to_root"] = includeCategoryPathToRoot?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/catalog/object/${encodeURIComponent(objectId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCatalogObjectResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/catalog/object/{object_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a single [CatalogObject](entity:CatalogObject) based on the + * provided ID and returns the set of successfully deleted IDs in the response. + * Deletion is a cascading event such that all children of the targeted object + * are also deleted. For example, deleting a [CatalogItem](entity:CatalogItem) + * will also delete all of its + * [CatalogItemVariation](entity:CatalogItemVariation) children. + * + * To ensure consistency, only one delete request is processed at a time per seller account. + * While one (batch or non-batch) delete request is being processed, other (batched and non-batched) + * delete requests are rejected with the `429` error code. + * + * @param {Square.catalog.ObjectDeleteRequest} request + * @param {Object_.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.catalog.object.delete({ + * objectId: "object_id" + * }) + */ + public async delete( + request: Square.catalog.ObjectDeleteRequest, + requestOptions?: Object_.RequestOptions, + ): Promise { + const { objectId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/catalog/object/${encodeURIComponent(objectId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteCatalogObjectResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/catalog/object/{object_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/catalog/resources/object/client/index.ts b/src/api/resources/catalog/resources/object/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/catalog/resources/object/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/catalog/resources/object/client/requests/ObjectDeleteRequest.ts b/src/api/resources/catalog/resources/object/client/requests/ObjectDeleteRequest.ts new file mode 100644 index 000000000..437309e27 --- /dev/null +++ b/src/api/resources/catalog/resources/object/client/requests/ObjectDeleteRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * objectId: "object_id" + * } + */ +export interface ObjectDeleteRequest { + /** + * The ID of the catalog object to be deleted. When an object is deleted, other + * objects in the graph that depend on that object will be deleted as well (for example, deleting a + * catalog item will delete its catalog item variations). + */ + objectId: string; +} diff --git a/src/api/resources/catalog/resources/object/client/requests/ObjectGetRequest.ts b/src/api/resources/catalog/resources/object/client/requests/ObjectGetRequest.ts new file mode 100644 index 000000000..d0f1434c8 --- /dev/null +++ b/src/api/resources/catalog/resources/object/client/requests/ObjectGetRequest.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * objectId: "object_id" + * } + */ +export interface ObjectGetRequest { + /** + * The object ID of any type of catalog objects to be retrieved. + */ + objectId: string; + /** + * If `true`, the response will include additional objects that are related to the + * requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field + * of the response. These objects are put in the `related_objects` field. Setting this to `true` is + * helpful when the objects are needed for immediate display to a user. + * This process only goes one level deep. Objects referenced by the related objects will not be included. For example, + * + * if the `objects` field of the response contains a CatalogItem, its associated + * CatalogCategory objects, CatalogTax objects, CatalogImage objects and + * CatalogModifierLists will be returned in the `related_objects` field of the + * response. If the `objects` field of the response contains a CatalogItemVariation, + * its parent CatalogItem will be returned in the `related_objects` field of + * the response. + * + * Default value: `false` + */ + includeRelatedObjects?: boolean | null; + /** + * Requests objects as of a specific version of the catalog. This allows you to retrieve historical + * versions of objects. The value to retrieve a specific version of an object can be found + * in the version field of [CatalogObject](entity:CatalogObject)s. If not included, results will + * be from the current version of the catalog. + */ + catalogVersion?: bigint | null; + /** + * Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists + * of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category + * and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned + * in the response payload. + */ + includeCategoryPathToRoot?: boolean | null; +} diff --git a/src/api/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts b/src/api/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts new file mode 100644 index 000000000..86c3645b4 --- /dev/null +++ b/src/api/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "af3d1afc-7212-4300-b463-0bfc5314a5ae", + * object: { + * type: "SUBSCRIPTION_PRODUCT", + * id: "#Cocoa" + * } + * } + */ +export interface UpsertCatalogObjectRequest { + /** + * A value you specify that uniquely identifies this + * request among all your requests. A common way to create + * a valid idempotency key is to use a Universally unique + * identifier (UUID). + * + * If you're unsure whether a particular request was successful, + * you can reattempt it with the same idempotency key without + * worrying about creating duplicate objects. + * + * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + */ + idempotencyKey: string; + /** + * A CatalogObject to be created or updated. + * + * - For updates, the object must be active (the `is_deleted` field is not `true`). + * - For creates, the object ID must start with `#`. The provided ID is replaced with a server-generated ID. + */ + object: Square.CatalogObject; +} diff --git a/src/api/resources/catalog/resources/object/client/requests/index.ts b/src/api/resources/catalog/resources/object/client/requests/index.ts new file mode 100644 index 000000000..fa3afc988 --- /dev/null +++ b/src/api/resources/catalog/resources/object/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type UpsertCatalogObjectRequest } from "./UpsertCatalogObjectRequest"; +export { type ObjectGetRequest } from "./ObjectGetRequest"; +export { type ObjectDeleteRequest } from "./ObjectDeleteRequest"; diff --git a/src/api/resources/catalog/resources/object/index.ts b/src/api/resources/catalog/resources/object/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/catalog/resources/object/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/checkout/client/Client.ts b/src/api/resources/checkout/client/Client.ts new file mode 100644 index 000000000..ad34faa07 --- /dev/null +++ b/src/api/resources/checkout/client/Client.ts @@ -0,0 +1,358 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; +import { PaymentLinks } from "../resources/paymentLinks/client/Client"; + +export declare namespace Checkout { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Checkout { + protected _paymentLinks: PaymentLinks | undefined; + + constructor(protected readonly _options: Checkout.Options = {}) {} + + public get paymentLinks(): PaymentLinks { + return (this._paymentLinks ??= new PaymentLinks(this._options)); + } + + /** + * Retrieves the location-level settings for a Square-hosted checkout page. + * + * @param {Square.RetrieveLocationSettingsRequest} request + * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.retrieveLocationSettings({ + * locationId: "location_id" + * }) + */ + public async retrieveLocationSettings( + request: Square.RetrieveLocationSettingsRequest, + requestOptions?: Checkout.RequestOptions, + ): Promise { + const { locationId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/online-checkout/location-settings/${encodeURIComponent(locationId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveLocationSettingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/online-checkout/location-settings/{location_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates the location-level settings for a Square-hosted checkout page. + * + * @param {Square.UpdateLocationSettingsRequest} request + * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.updateLocationSettings({ + * locationId: "location_id", + * locationSettings: {} + * }) + */ + public async updateLocationSettings( + request: Square.UpdateLocationSettingsRequest, + requestOptions?: Checkout.RequestOptions, + ): Promise { + const { locationId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/online-checkout/location-settings/${encodeURIComponent(locationId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateLocationSettingsRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateLocationSettingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/online-checkout/location-settings/{location_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves the merchant-level settings for a Square-hosted checkout page. + * + * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.retrieveMerchantSettings() + */ + public async retrieveMerchantSettings( + requestOptions?: Checkout.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/online-checkout/merchant-settings", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveMerchantSettingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/online-checkout/merchant-settings.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates the merchant-level settings for a Square-hosted checkout page. + * + * @param {Square.UpdateMerchantSettingsRequest} request + * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.updateMerchantSettings({ + * merchantSettings: {} + * }) + */ + public async updateMerchantSettings( + request: Square.UpdateMerchantSettingsRequest, + requestOptions?: Checkout.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/online-checkout/merchant-settings", + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateMerchantSettingsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateMerchantSettingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/online-checkout/merchant-settings.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/checkout/client/index.ts b/src/api/resources/checkout/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/checkout/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/checkout/client/requests/RetrieveLocationSettingsRequest.ts b/src/api/resources/checkout/client/requests/RetrieveLocationSettingsRequest.ts new file mode 100644 index 000000000..71ce84a90 --- /dev/null +++ b/src/api/resources/checkout/client/requests/RetrieveLocationSettingsRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id" + * } + */ +export interface RetrieveLocationSettingsRequest { + /** + * The ID of the location for which to retrieve settings. + */ + locationId: string; +} diff --git a/src/api/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts b/src/api/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts new file mode 100644 index 000000000..e94cf5f0c --- /dev/null +++ b/src/api/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * locationId: "location_id", + * locationSettings: {} + * } + */ +export interface UpdateLocationSettingsRequest { + /** + * The ID of the location for which to retrieve settings. + */ + locationId: string; + /** Describe your updates using the `location_settings` object. Make sure it contains only the fields that have changed. */ + locationSettings: Square.CheckoutLocationSettings; +} diff --git a/src/api/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts b/src/api/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts new file mode 100644 index 000000000..d46b43bda --- /dev/null +++ b/src/api/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * merchantSettings: {} + * } + */ +export interface UpdateMerchantSettingsRequest { + /** Describe your updates using the `merchant_settings` object. Make sure it contains only the fields that have changed. */ + merchantSettings: Square.CheckoutMerchantSettings; +} diff --git a/src/api/resources/checkout/client/requests/index.ts b/src/api/resources/checkout/client/requests/index.ts new file mode 100644 index 000000000..ff86d69a5 --- /dev/null +++ b/src/api/resources/checkout/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type RetrieveLocationSettingsRequest } from "./RetrieveLocationSettingsRequest"; +export { type UpdateLocationSettingsRequest } from "./UpdateLocationSettingsRequest"; +export { type UpdateMerchantSettingsRequest } from "./UpdateMerchantSettingsRequest"; diff --git a/src/api/resources/checkout/index.ts b/src/api/resources/checkout/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/checkout/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/checkout/resources/index.ts b/src/api/resources/checkout/resources/index.ts new file mode 100644 index 000000000..5f3efa0d0 --- /dev/null +++ b/src/api/resources/checkout/resources/index.ts @@ -0,0 +1,2 @@ +export * as paymentLinks from "./paymentLinks"; +export * from "./paymentLinks/client/requests"; diff --git a/src/api/resources/checkout/resources/paymentLinks/client/Client.ts b/src/api/resources/checkout/resources/paymentLinks/client/Client.ts new file mode 100644 index 000000000..eb94a6f56 --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/client/Client.ts @@ -0,0 +1,462 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace PaymentLinks { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class PaymentLinks { + constructor(protected readonly _options: PaymentLinks.Options = {}) {} + + /** + * Lists all payment links. + * + * @param {Square.checkout.PaymentLinksListRequest} request + * @param {PaymentLinks.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.paymentLinks.list() + */ + public async list( + request: Square.checkout.PaymentLinksListRequest = {}, + requestOptions?: PaymentLinks.RequestOptions, + ): Promise> { + const list = async ( + request: Square.checkout.PaymentLinksListRequest, + ): Promise => { + const { cursor, limit } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/online-checkout/payment-links", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListPaymentLinksResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/online-checkout/payment-links.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.paymentLinks ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. + * + * @param {Square.checkout.CreatePaymentLinkRequest} request + * @param {PaymentLinks.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.paymentLinks.create({ + * idempotencyKey: "cd9e25dc-d9f2-4430-aedb-61605070e95f", + * quickPay: { + * name: "Auto Detailing", + * priceMoney: { + * amount: 10000, + * currency: "USD" + * }, + * locationId: "A9Y43N9ABXZBP" + * } + * }) + */ + public async create( + request: Square.checkout.CreatePaymentLinkRequest = {}, + requestOptions?: PaymentLinks.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/online-checkout/payment-links", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.checkout.CreatePaymentLinkRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreatePaymentLinkResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/online-checkout/payment-links.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a payment link. + * + * @param {Square.checkout.PaymentLinksGetRequest} request + * @param {PaymentLinks.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.paymentLinks.get({ + * id: "id" + * }) + */ + public async get( + request: Square.checkout.PaymentLinksGetRequest, + requestOptions?: PaymentLinks.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/online-checkout/payment-links/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetPaymentLinkResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/online-checkout/payment-links/{id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a payment link. You can update the `payment_link` fields such as + * `description`, `checkout_options`, and `pre_populated_data`. + * You cannot update other fields such as the `order_id`, `version`, `URL`, or `timestamp` field. + * + * @param {Square.checkout.UpdatePaymentLinkRequest} request + * @param {PaymentLinks.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.paymentLinks.update({ + * id: "id", + * paymentLink: { + * version: 1, + * checkoutOptions: { + * askForShippingAddress: true + * } + * } + * }) + */ + public async update( + request: Square.checkout.UpdatePaymentLinkRequest, + requestOptions?: PaymentLinks.RequestOptions, + ): Promise { + const { id, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/online-checkout/payment-links/${encodeURIComponent(id)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.checkout.UpdatePaymentLinkRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdatePaymentLinkResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/online-checkout/payment-links/{id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a payment link. + * + * @param {Square.checkout.PaymentLinksDeleteRequest} request + * @param {PaymentLinks.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.checkout.paymentLinks.delete({ + * id: "id" + * }) + */ + public async delete( + request: Square.checkout.PaymentLinksDeleteRequest, + requestOptions?: PaymentLinks.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/online-checkout/payment-links/${encodeURIComponent(id)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeletePaymentLinkResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/online-checkout/payment-links/{id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/checkout/resources/paymentLinks/client/index.ts b/src/api/resources/checkout/resources/paymentLinks/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts new file mode 100644 index 000000000..042082f59 --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "cd9e25dc-d9f2-4430-aedb-61605070e95f", + * quickPay: { + * name: "Auto Detailing", + * priceMoney: { + * amount: 10000, + * currency: "USD" + * }, + * locationId: "A9Y43N9ABXZBP" + * } + * } + */ +export interface CreatePaymentLinkRequest { + /** + * A unique string that identifies this `CreatePaymentLinkRequest` 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](https://developer.squareup.com/docs/working-with-apis/idempotency). + */ + idempotencyKey?: string; + /** + * A description of the payment link. You provide this optional description that is useful in your + * application context. It is not used anywhere. + */ + description?: string; + /** + * Describes an ad hoc item and price for which to generate a quick pay checkout link. + * For more information, + * see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). + */ + quickPay?: Square.QuickPay; + /** + * Describes the `Order` for which to create a checkout link. + * For more information, + * see [Square Order Checkout](https://developer.squareup.com/docs/checkout-api/square-order-checkout). + */ + order?: Square.Order; + /** + * Describes optional fields to add to the resulting checkout page. + * For more information, + * see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). + */ + checkoutOptions?: Square.CheckoutOptions; + /** + * Describes fields to prepopulate in the resulting checkout page. + * For more information, see [Prepopulate the shipping address](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#prepopulate-the-shipping-address). + */ + prePopulatedData?: Square.PrePopulatedData; + /** A note for the payment. After processing the payment, Square adds this note to the resulting `Payment`. */ + paymentNote?: string; +} diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksDeleteRequest.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksDeleteRequest.ts new file mode 100644 index 000000000..84b9692fa --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface PaymentLinksDeleteRequest { + /** + * The ID of the payment link to delete. + */ + id: string; +} diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksGetRequest.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksGetRequest.ts new file mode 100644 index 000000000..4f69bff20 --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface PaymentLinksGetRequest { + /** + * The ID of link to retrieve. + */ + id: string; +} diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksListRequest.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksListRequest.ts new file mode 100644 index 000000000..f015095ff --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/PaymentLinksListRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface PaymentLinksListRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * If a cursor is not provided, the endpoint returns the first page of the results. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * A limit on the number of results to return per page. The limit is advisory and + * the implementation might return more or less results. If the supplied limit is negative, zero, or + * greater than the maximum limit of 1000, it is ignored. + * + * Default value: `100` + */ + limit?: number | null; +} diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts new file mode 100644 index 000000000..52118ba6c --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * id: "id", + * paymentLink: { + * version: 1, + * checkoutOptions: { + * askForShippingAddress: true + * } + * } + * } + */ +export interface UpdatePaymentLinkRequest { + /** + * The ID of the payment link to update. + */ + id: string; + /** + * The `payment_link` object describing the updates to apply. + * For more information, see [Update a payment link](https://developer.squareup.com/docs/checkout-api/manage-checkout#update-a-payment-link). + */ + paymentLink: Square.PaymentLink; +} diff --git a/src/api/resources/checkout/resources/paymentLinks/client/requests/index.ts b/src/api/resources/checkout/resources/paymentLinks/client/requests/index.ts new file mode 100644 index 000000000..8189ad7b7 --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type PaymentLinksListRequest } from "./PaymentLinksListRequest"; +export { type CreatePaymentLinkRequest } from "./CreatePaymentLinkRequest"; +export { type PaymentLinksGetRequest } from "./PaymentLinksGetRequest"; +export { type UpdatePaymentLinkRequest } from "./UpdatePaymentLinkRequest"; +export { type PaymentLinksDeleteRequest } from "./PaymentLinksDeleteRequest"; diff --git a/src/api/resources/checkout/resources/paymentLinks/index.ts b/src/api/resources/checkout/resources/paymentLinks/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/checkout/resources/paymentLinks/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/customers/client/Client.ts b/src/api/resources/customers/client/Client.ts new file mode 100644 index 000000000..b9642e305 --- /dev/null +++ b/src/api/resources/customers/client/Client.ts @@ -0,0 +1,992 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client"; +import { Groups } from "../resources/groups/client/Client"; +import { Segments } from "../resources/segments/client/Client"; +import { Cards } from "../resources/cards/client/Client"; +import { CustomAttributes } from "../resources/customAttributes/client/Client"; + +export declare namespace Customers { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Customers { + protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; + protected _groups: Groups | undefined; + protected _segments: Segments | undefined; + protected _cards: Cards | undefined; + protected _customAttributes: CustomAttributes | undefined; + + constructor(protected readonly _options: Customers.Options = {}) {} + + public get customAttributeDefinitions(): CustomAttributeDefinitions { + return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); + } + + public get groups(): Groups { + return (this._groups ??= new Groups(this._options)); + } + + public get segments(): Segments { + return (this._segments ??= new Segments(this._options)); + } + + public get cards(): Cards { + return (this._cards ??= new Cards(this._options)); + } + + public get customAttributes(): CustomAttributes { + return (this._customAttributes ??= new CustomAttributes(this._options)); + } + + /** + * Lists customer profiles associated with a Square account. + * + * Under normal operating conditions, newly created or updated customer profiles become available + * for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages. + * + * @param {Square.CustomersListRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.list() + */ + public async list( + request: Square.CustomersListRequest = {}, + requestOptions?: Customers.RequestOptions, + ): Promise> { + const list = async (request: Square.CustomersListRequest): Promise => { + const { cursor, limit, sortField, sortOrder, count } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (sortField !== undefined) { + _queryParams["sort_field"] = serializers.CustomerSortField.jsonOrThrow(sortField, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (count !== undefined) { + _queryParams["count"] = count?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCustomersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/customers."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customers ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a new customer for a business. + * + * You must provide at least one of the following values in your request to this + * endpoint: + * + * - `given_name` + * - `family_name` + * - `company_name` + * - `email_address` + * - `phone_number` + * + * @param {Square.CreateCustomerRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.create({ + * 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" + * }) + */ + public async create( + request: Square.CreateCustomerRequest = {}, + requestOptions?: Customers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateCustomerRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCustomerResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates multiple [customer profiles](entity:Customer) for a business. + * + * This endpoint takes a map of individual create requests and returns a map of responses. + * + * You must provide at least one of the following values in each create request: + * + * - `given_name` + * - `family_name` + * - `company_name` + * - `email_address` + * - `phone_number` + * + * @param {Square.BulkCreateCustomersRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.batchCreate({ + * customers: { + * "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { + * 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" + * }, + * "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + * givenName: "Marie", + * familyName: "Curie", + * emailAddress: "Marie.Curie@example.com", + * address: { + * addressLine1: "500 Electric Ave", + * addressLine2: "Suite 601", + * locality: "New York", + * administrativeDistrictLevel1: "NY", + * postalCode: "10003", + * country: "US" + * }, + * phoneNumber: "+1-212-444-4240", + * referenceId: "YOUR_REFERENCE_ID", + * note: "another customer" + * } + * } + * }) + */ + public async batchCreate( + request: Square.BulkCreateCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/bulk-create", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BulkCreateCustomersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkCreateCustomersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers/bulk-create."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes multiple customer profiles. + * + * The endpoint takes a list of customer IDs and returns a map of responses. + * + * @param {Square.BulkDeleteCustomersRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.bulkDeleteCustomers({ + * customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] + * }) + */ + public async bulkDeleteCustomers( + request: Square.BulkDeleteCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/bulk-delete", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BulkDeleteCustomersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkDeleteCustomersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers/bulk-delete."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves multiple customer profiles. + * + * This endpoint takes a list of customer IDs and returns a map of responses. + * + * @param {Square.BulkRetrieveCustomersRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.bulkRetrieveCustomers({ + * customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] + * }) + */ + public async bulkRetrieveCustomers( + request: Square.BulkRetrieveCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/bulk-retrieve", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BulkRetrieveCustomersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkRetrieveCustomersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers/bulk-retrieve."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates multiple customer profiles. + * + * This endpoint takes a map of individual update requests and returns a map of responses. + * + * @param {Square.BulkUpdateCustomersRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.bulkUpdateCustomers({ + * customers: { + * "8DDA5NZVBZFGAX0V3HPF81HHE0": { + * emailAddress: "New.Amelia.Earhart@example.com", + * note: "updated customer note", + * version: 2 + * }, + * "N18CPRVXR5214XPBBA6BZQWF3C": { + * givenName: "Marie", + * familyName: "Curie", + * version: 0 + * } + * } + * }) + */ + public async bulkUpdateCustomers( + request: Square.BulkUpdateCustomersRequest, + requestOptions?: Customers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/bulk-update", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BulkUpdateCustomersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkUpdateCustomersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers/bulk-update."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Searches the customer profiles associated with a Square account using one or more supported query filters. + * + * Calling `SearchCustomers` without any explicit query filter returns all + * customer profiles ordered alphabetically based on `given_name` and + * `family_name`. + * + * Under normal operating conditions, newly created or updated customer profiles become available + * for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages. + * + * @param {Square.SearchCustomersRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.search({ + * limit: 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" + * } + * } + * }) + */ + public async search( + request: Square.SearchCustomersRequest = {}, + requestOptions?: Customers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchCustomersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchCustomersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns details for a single customer. + * + * @param {Square.CustomersGetRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.get({ + * customerId: "customer_id" + * }) + */ + public async get( + request: Square.CustomersGetRequest, + requestOptions?: Customers.RequestOptions, + ): Promise { + const { customerId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCustomerResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/customers/{customer_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. + * To add or update a field, specify the new value. To remove a field, specify `null`. + * + * To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. + * + * @param {Square.UpdateCustomerRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.update({ + * customerId: "customer_id", + * emailAddress: "New.Amelia.Earhart@example.com", + * note: "updated customer note", + * version: 2 + * }) + */ + public async update( + request: Square.UpdateCustomerRequest, + requestOptions?: Customers.RequestOptions, + ): Promise { + const { customerId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateCustomerRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateCustomerResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/customers/{customer_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a customer profile from a business. + * + * To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. + * + * @param {Square.CustomersDeleteRequest} request + * @param {Customers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.delete({ + * customerId: "customer_id" + * }) + */ + public async delete( + request: Square.CustomersDeleteRequest, + requestOptions?: Customers.RequestOptions, + ): Promise { + const { customerId, version } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteCustomerResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/customers/{customer_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/customers/client/index.ts b/src/api/resources/customers/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/customers/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/customers/client/requests/BulkCreateCustomersRequest.ts b/src/api/resources/customers/client/requests/BulkCreateCustomersRequest.ts new file mode 100644 index 000000000..95a024d18 --- /dev/null +++ b/src/api/resources/customers/client/requests/BulkCreateCustomersRequest.ts @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * customers: { + * "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": { + * 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" + * }, + * "d1689f23-b25d-4932-b2f0-aed00f5e2029": { + * givenName: "Marie", + * familyName: "Curie", + * emailAddress: "Marie.Curie@example.com", + * address: { + * addressLine1: "500 Electric Ave", + * addressLine2: "Suite 601", + * locality: "New York", + * administrativeDistrictLevel1: "NY", + * postalCode: "10003", + * country: "US" + * }, + * phoneNumber: "+1-212-444-4240", + * referenceId: "YOUR_REFERENCE_ID", + * note: "another customer" + * } + * } + * } + */ +export interface BulkCreateCustomersRequest { + /** + * A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }` + * key-value pairs. + * + * Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) + * that uniquely identifies the create request. Each value contains the customer data used to create the + * customer profile. + */ + customers: Record; +} diff --git a/src/api/resources/customers/client/requests/BulkDeleteCustomersRequest.ts b/src/api/resources/customers/client/requests/BulkDeleteCustomersRequest.ts new file mode 100644 index 000000000..125111848 --- /dev/null +++ b/src/api/resources/customers/client/requests/BulkDeleteCustomersRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] + * } + */ +export interface BulkDeleteCustomersRequest { + /** The IDs of the [customer profiles](entity:Customer) to delete. */ + customerIds: string[]; +} diff --git a/src/api/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts b/src/api/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts new file mode 100644 index 000000000..99a7568c7 --- /dev/null +++ b/src/api/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerIds: ["8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8"] + * } + */ +export interface BulkRetrieveCustomersRequest { + /** The IDs of the [customer profiles](entity:Customer) to retrieve. */ + customerIds: string[]; +} diff --git a/src/api/resources/customers/client/requests/BulkUpdateCustomersRequest.ts b/src/api/resources/customers/client/requests/BulkUpdateCustomersRequest.ts new file mode 100644 index 000000000..7cfa8b1a8 --- /dev/null +++ b/src/api/resources/customers/client/requests/BulkUpdateCustomersRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * customers: { + * "8DDA5NZVBZFGAX0V3HPF81HHE0": { + * emailAddress: "New.Amelia.Earhart@example.com", + * note: "updated customer note", + * version: 2 + * }, + * "N18CPRVXR5214XPBBA6BZQWF3C": { + * givenName: "Marie", + * familyName: "Curie", + * version: 0 + * } + * } + * } + */ +export interface BulkUpdateCustomersRequest { + /** + * A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }` + * key-value pairs. + * + * Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile + * that was created by merging existing profiles, provide the ID of the newly created profile. + * + * Each value contains the updated customer data. Only new or changed fields are required. To add or + * update a field, specify the new value. To remove a field, specify `null`. + */ + customers: Record; +} diff --git a/src/api/resources/customers/client/requests/CreateCustomerRequest.ts b/src/api/resources/customers/client/requests/CreateCustomerRequest.ts new file mode 100644 index 000000000..3aeb62979 --- /dev/null +++ b/src/api/resources/customers/client/requests/CreateCustomerRequest.ts @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * 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" + * } + */ +export interface CreateCustomerRequest { + /** + * The idempotency key for the request. For more information, see + * [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string; + /** + * The given name (that is, the first name) associated with the customer profile. + * + * The maximum length for this value is 300 characters. + */ + givenName?: string; + /** + * The family name (that is, the last name) associated with the customer profile. + * + * The maximum length for this value is 300 characters. + */ + familyName?: string; + /** + * A business name associated with the customer profile. + * + * The maximum length for this value is 500 characters. + */ + companyName?: string; + /** + * A nickname for the customer profile. + * + * The maximum length for this value is 100 characters. + */ + nickname?: string; + /** + * The email address associated with the customer profile. + * + * The maximum length for this value is 254 characters. + */ + emailAddress?: string; + /** + * The physical address associated with the customer profile. For maximum length constraints, see + * [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address). + * The `first_name` and `last_name` fields are ignored if they are present in the request. + */ + address?: Square.Address; + /** + * The phone number associated with the customer profile. The phone number must be valid and can contain + * 9–16 digits, with an optional `+` prefix and country code. For more information, see + * [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). + */ + phoneNumber?: string; + /** + * An optional second ID used to associate the customer profile with an + * entity in another system. + * + * The maximum length for this value is 100 characters. + */ + referenceId?: string; + /** A custom note associated with the customer profile. */ + note?: string; + /** + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example, + * specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD` + * format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified. + */ + birthday?: string; + /** + * The tax ID associated with the customer profile. This field is available only for customers of sellers + * in EU countries or the United Kingdom. For more information, + * see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). + */ + taxIds?: Square.CustomerTaxIds; +} diff --git a/src/api/resources/customers/client/requests/CustomersDeleteRequest.ts b/src/api/resources/customers/client/requests/CustomersDeleteRequest.ts new file mode 100644 index 000000000..bf66f855b --- /dev/null +++ b/src/api/resources/customers/client/requests/CustomersDeleteRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerId: "customer_id" + * } + */ +export interface CustomersDeleteRequest { + /** + * The ID of the customer to delete. + */ + customerId: string; + /** + * The current version of the customer profile. + * + * As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). + */ + version?: bigint | null; +} diff --git a/src/api/resources/customers/client/requests/CustomersGetRequest.ts b/src/api/resources/customers/client/requests/CustomersGetRequest.ts new file mode 100644 index 000000000..639257bc0 --- /dev/null +++ b/src/api/resources/customers/client/requests/CustomersGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerId: "customer_id" + * } + */ +export interface CustomersGetRequest { + /** + * The ID of the customer to retrieve. + */ + customerId: string; +} diff --git a/src/api/resources/customers/client/requests/CustomersListRequest.ts b/src/api/resources/customers/client/requests/CustomersListRequest.ts new file mode 100644 index 000000000..859907af8 --- /dev/null +++ b/src/api/resources/customers/client/requests/CustomersListRequest.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface CustomersListRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for your original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. + * If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * Indicates how customers should be sorted. + * + * The default value is `DEFAULT`. + */ + sortField?: Square.CustomerSortField | null; + /** + * Indicates whether customers should be sorted in ascending (`ASC`) or + * descending (`DESC`) order. + * + * The default value is `ASC`. + */ + sortOrder?: Square.SortOrder | null; + /** + * Indicates whether to return the total count of customers in the `count` field of the response. + * + * The default value is `false`. + */ + count?: boolean | null; +} diff --git a/src/api/resources/customers/client/requests/SearchCustomersRequest.ts b/src/api/resources/customers/client/requests/SearchCustomersRequest.ts new file mode 100644 index 000000000..4b583487e --- /dev/null +++ b/src/api/resources/customers/client/requests/SearchCustomersRequest.ts @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * limit: 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" + * } + * } + * } + */ +export interface SearchCustomersRequest { + /** + * Include the pagination cursor in subsequent calls to this endpoint to retrieve + * the next set of results associated with the original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** + * The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. + * If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: bigint; + /** + * The filtering and sorting criteria for the search request. If a query is not specified, + * Square returns all customer profiles ordered alphabetically by `given_name` and `family_name`. + */ + query?: Square.CustomerQuery; + /** + * Indicates whether to return the total count of matching customers in the `count` field of the response. + * + * The default value is `false`. + */ + count?: boolean; +} diff --git a/src/api/resources/customers/client/requests/UpdateCustomerRequest.ts b/src/api/resources/customers/client/requests/UpdateCustomerRequest.ts new file mode 100644 index 000000000..634ee8d34 --- /dev/null +++ b/src/api/resources/customers/client/requests/UpdateCustomerRequest.ts @@ -0,0 +1,91 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * customerId: "customer_id", + * emailAddress: "New.Amelia.Earhart@example.com", + * note: "updated customer note", + * version: 2 + * } + */ +export interface UpdateCustomerRequest { + /** + * The ID of the customer to update. + */ + customerId: string; + /** + * The given name (that is, the first name) associated with the customer profile. + * + * The maximum length for this value is 300 characters. + */ + givenName?: string | null; + /** + * The family name (that is, the last name) associated with the customer profile. + * + * The maximum length for this value is 300 characters. + */ + familyName?: string | null; + /** + * A business name associated with the customer profile. + * + * The maximum length for this value is 500 characters. + */ + companyName?: string | null; + /** + * A nickname for the customer profile. + * + * The maximum length for this value is 100 characters. + */ + nickname?: string | null; + /** + * The email address associated with the customer profile. + * + * The maximum length for this value is 254 characters. + */ + emailAddress?: string | null; + /** + * The physical address associated with the customer profile. Only new or changed fields are required in the request. + * + * For maximum length constraints, see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address). + * The `first_name` and `last_name` fields are ignored if they are present in the request. + */ + address?: Square.Address; + /** + * The phone number associated with the customer profile. The phone number must be valid and can contain + * 9–16 digits, with an optional `+` prefix and country code. For more information, see + * [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). + */ + phoneNumber?: string | null; + /** + * An optional second ID used to associate the customer profile with an + * entity in another system. + * + * The maximum length for this value is 100 characters. + */ + referenceId?: string | null; + /** A custom note associated with the customer profile. */ + note?: string | null; + /** + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example, + * specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD` + * format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified. + */ + birthday?: string | null; + /** + * The current version of the customer profile. + * + * As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile). + */ + version?: bigint; + /** + * The tax ID associated with the customer profile. This field is available only for customers of sellers + * in EU countries or the United Kingdom. For more information, + * see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). + */ + taxIds?: Square.CustomerTaxIds; +} diff --git a/src/api/resources/customers/client/requests/index.ts b/src/api/resources/customers/client/requests/index.ts new file mode 100644 index 000000000..8d677223f --- /dev/null +++ b/src/api/resources/customers/client/requests/index.ts @@ -0,0 +1,10 @@ +export { type CustomersListRequest } from "./CustomersListRequest"; +export { type CreateCustomerRequest } from "./CreateCustomerRequest"; +export { type BulkCreateCustomersRequest } from "./BulkCreateCustomersRequest"; +export { type BulkDeleteCustomersRequest } from "./BulkDeleteCustomersRequest"; +export { type BulkRetrieveCustomersRequest } from "./BulkRetrieveCustomersRequest"; +export { type BulkUpdateCustomersRequest } from "./BulkUpdateCustomersRequest"; +export { type SearchCustomersRequest } from "./SearchCustomersRequest"; +export { type CustomersGetRequest } from "./CustomersGetRequest"; +export { type UpdateCustomerRequest } from "./UpdateCustomerRequest"; +export { type CustomersDeleteRequest } from "./CustomersDeleteRequest"; diff --git a/src/api/resources/customers/index.ts b/src/api/resources/customers/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/customers/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/customers/resources/cards/client/Client.ts b/src/api/resources/customers/resources/cards/client/Client.ts new file mode 100644 index 000000000..5bb41e85e --- /dev/null +++ b/src/api/resources/customers/resources/cards/client/Client.ts @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Cards { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Cards { + constructor(protected readonly _options: Cards.Options = {}) {} + + /** + * Adds a card on file to an existing customer. + * + * As with charges, calls to `CreateCustomerCard` are idempotent. Multiple + * calls with the same card nonce return the same card record that was created + * with the provided nonce during the _first_ call. + * + * @param {Square.customers.CreateCustomerCardRequest} request + * @param {Cards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.cards.create({ + * customerId: "customer_id", + * cardNonce: "YOUR_CARD_NONCE", + * billingAddress: { + * addressLine1: "500 Electric Ave", + * addressLine2: "Suite 600", + * locality: "New York", + * administrativeDistrictLevel1: "NY", + * postalCode: "10003", + * country: "US" + * }, + * cardholderName: "Amelia Earhart" + * }) + */ + public async create( + request: Square.customers.CreateCustomerCardRequest, + requestOptions?: Cards.RequestOptions, + ): Promise { + const { customerId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}/cards`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.customers.CreateCustomerCardRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCustomerCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/customers/{customer_id}/cards.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Removes a card on file from a customer. + * + * @param {Square.customers.CardsDeleteRequest} request + * @param {Cards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.cards.delete({ + * customerId: "customer_id", + * cardId: "card_id" + * }) + */ + public async delete( + request: Square.customers.CardsDeleteRequest, + requestOptions?: Cards.RequestOptions, + ): Promise { + const { customerId, cardId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}/cards/${encodeURIComponent(cardId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteCustomerCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/customers/{customer_id}/cards/{card_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/customers/resources/cards/client/index.ts b/src/api/resources/customers/resources/cards/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/customers/resources/cards/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/customers/resources/cards/client/requests/CardsDeleteRequest.ts b/src/api/resources/customers/resources/cards/client/requests/CardsDeleteRequest.ts new file mode 100644 index 000000000..db490c140 --- /dev/null +++ b/src/api/resources/customers/resources/cards/client/requests/CardsDeleteRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerId: "customer_id", + * cardId: "card_id" + * } + */ +export interface CardsDeleteRequest { + /** + * The ID of the customer that the card on file belongs to. + */ + customerId: string; + /** + * The ID of the card on file to delete. + */ + cardId: string; +} diff --git a/src/api/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts b/src/api/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts new file mode 100644 index 000000000..05226b95c --- /dev/null +++ b/src/api/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * customerId: "customer_id", + * cardNonce: "YOUR_CARD_NONCE", + * billingAddress: { + * addressLine1: "500 Electric Ave", + * addressLine2: "Suite 600", + * locality: "New York", + * administrativeDistrictLevel1: "NY", + * postalCode: "10003", + * country: "US" + * }, + * cardholderName: "Amelia Earhart" + * } + */ +export interface CreateCustomerCardRequest { + /** + * The Square ID of the customer profile the card is linked to. + */ + customerId: string; + /** + * A card nonce representing the credit card to link to the customer. + * + * Card nonces are generated by the Square payment form when customers enter + * their card information. For more information, see + * [Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment). + * + * __NOTE:__ Card nonces generated by digital wallets (such as Apple Pay) + * cannot be used to create a customer card. + */ + cardNonce: string; + /** + * Address information for the card on file. + * + * __NOTE:__ If a billing address is provided in the request, the + * `CreateCustomerCardRequest.billing_address.postal_code` must match + * the postal code encoded in the card nonce. + */ + billingAddress?: Square.Address; + /** The full name printed on the credit card. */ + cardholderName?: string; + /** + * An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer). + * Verification tokens encapsulate customer device information and 3-D Secure + * challenge results to indicate that Square has verified the buyer identity. + */ + verificationToken?: string; +} diff --git a/src/api/resources/customers/resources/cards/client/requests/index.ts b/src/api/resources/customers/resources/cards/client/requests/index.ts new file mode 100644 index 000000000..cd90cda56 --- /dev/null +++ b/src/api/resources/customers/resources/cards/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type CreateCustomerCardRequest } from "./CreateCustomerCardRequest"; +export { type CardsDeleteRequest } from "./CardsDeleteRequest"; diff --git a/src/api/resources/customers/resources/cards/index.ts b/src/api/resources/customers/resources/cards/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/customers/resources/cards/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts new file mode 100644 index 000000000..75cc6b732 --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/Client.ts @@ -0,0 +1,624 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributeDefinitions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributeDefinitions { + constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + + /** + * Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + * + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that + * seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.customers.CustomAttributeDefinitionsListRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributeDefinitions.list() + */ + public async list( + request: Square.customers.CustomAttributeDefinitionsListRequest = {}, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { + const list = async ( + request: Square.customers.CustomAttributeDefinitionsListRequest, + ): Promise => { + const { limit, cursor } = request; + const _queryParams: Record = {}; + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/custom-attribute-definitions", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCustomerCustomAttributeDefinitionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/customers/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable< + Square.ListCustomerCustomAttributeDefinitionsResponse, + Square.CustomAttributeDefinition + >({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributeDefinitions ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + * Use this endpoint to define a custom attribute that can be associated with customer profiles. + * + * A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties + * for a custom attribute. After the definition is created, you can call + * [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) or + * [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) + * to set the custom attribute for customer profiles in the seller's Customer Directory. + * + * Sellers can view all custom attributes in exported customer data, including those set to + * `VISIBILITY_HIDDEN`. + * + * @param {Square.customers.CreateCustomerCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributeDefinitions.create({ + * customAttributeDefinition: { + * key: "favoritemovie", + * schema: { + * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" + * }, + * name: "Favorite Movie", + * description: "The favorite movie of the customer.", + * visibility: "VISIBILITY_HIDDEN" + * } + * }) + */ + public async create( + request: Square.customers.CreateCustomerCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/custom-attribute-definitions", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.customers.CreateCustomerCustomAttributeDefinitionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCustomerCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/customers/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + * + * To retrieve a custom attribute definition created by another application, the `visibility` + * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.customers.CustomAttributeDefinitionsGetRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributeDefinitions.get({ + * key: "key" + * }) + */ + public async get( + request: Square.customers.CustomAttributeDefinitionsGetRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, version } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCustomerCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/customers/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + * + * Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the + * `schema` for a `Selection` data type. + * + * Only the definition owner can update a custom attribute definition. Note that sellers can view + * all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. + * + * @param {Square.customers.UpdateCustomerCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributeDefinitions.update({ + * key: "key", + * customAttributeDefinition: { + * description: "Update the description as desired.", + * visibility: "VISIBILITY_READ_ONLY" + * } + * }) + */ + public async update( + request: Square.customers.UpdateCustomerCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.customers.UpdateCustomerCustomAttributeDefinitionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateCustomerCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/customers/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + * + * Deleting a custom attribute definition also deletes the corresponding custom attribute from + * all customer profiles in the seller's Customer Directory. + * + * Only the definition owner can delete a custom attribute definition. + * + * @param {Square.customers.CustomAttributeDefinitionsDeleteRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributeDefinitions.delete({ + * key: "key" + * }) + */ + public async delete( + request: Square.customers.CustomAttributeDefinitionsDeleteRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteCustomerCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/customers/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates [custom attributes](entity:CustomAttribute) for customer profiles as a bulk operation. + * + * Use this endpoint to set the value of one or more custom attributes for one or more customer profiles. + * A custom attribute is based on a custom attribute definition in a Square seller account, which is + * created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint. + * + * This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + * requests and returns a map of individual upsert responses. Each upsert request has a unique ID + * and provides a customer ID and custom attribute. Each upsert response is returned with the ID + * of the corresponding request. + * + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.customers.BatchUpsertCustomerCustomAttributesRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributeDefinitions.batchUpsert({ + * values: { + * "id1": { + * customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", + * customAttribute: { + * key: "favoritemovie", + * value: "Dune" + * } + * }, + * "id2": { + * customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + * customAttribute: { + * key: "ownsmovie", + * value: false + * } + * }, + * "id3": { + * customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + * customAttribute: { + * key: "favoritemovie", + * value: "Star Wars" + * } + * }, + * "id4": { + * customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", + * customAttribute: { + * key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", + * value: "10.5" + * } + * }, + * "id5": { + * customerId: "70548QG1HN43B05G0KCZ4MMC1G", + * customAttribute: { + * key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", + * value: "fake-email@squareup.com" + * } + * } + * } + * }) + */ + public async batchUpsert( + request: Square.customers.BatchUpsertCustomerCustomAttributesRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/custom-attributes/bulk-upsert", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.customers.BatchUpsertCustomerCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchUpsertCustomerCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/customers/custom-attributes/bulk-upsert.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts new file mode 100644 index 000000000..a4550a3fe --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "id1": { + * customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", + * customAttribute: { + * key: "favoritemovie", + * value: "Dune" + * } + * }, + * "id2": { + * customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + * customAttribute: { + * key: "ownsmovie", + * value: false + * } + * }, + * "id3": { + * customerId: "SY8EMWRNDN3TQDP2H4KS1QWMMM", + * customAttribute: { + * key: "favoritemovie", + * value: "Star Wars" + * } + * }, + * "id4": { + * customerId: "N3NCVYY3WS27HF0HKANA3R9FP8", + * customAttribute: { + * key: "square:a0f1505a-2aa1-490d-91a8-8d31ff181808", + * value: "10.5" + * } + * }, + * "id5": { + * customerId: "70548QG1HN43B05G0KCZ4MMC1G", + * customAttribute: { + * key: "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail", + * value: "fake-email@squareup.com" + * } + * } + * } + * } + */ +export interface BatchUpsertCustomerCustomAttributesRequest { + /** + * A map containing 1 to 25 individual upsert requests. For each request, provide an + * arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the + * information needed to create or update a custom attribute. + */ + values: Record; +} diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..f433f19ae --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * customAttributeDefinition: { + * key: "favoritemovie", + * schema: { + * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" + * }, + * name: "Favorite Movie", + * description: "The favorite movie of the customer.", + * visibility: "VISIBILITY_HIDDEN" + * } + * } + */ +export interface CreateCustomerCustomAttributeDefinitionRequest { + /** + * The custom attribute definition to create. Note the following: + * - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema + * definition hosted on the Square CDN. For more information, including supported values and constraints, see + * [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema). + * - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. + * - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string; +} diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts new file mode 100644 index 000000000..860f57efe --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsDeleteRequest { + /** + * The key of the custom attribute definition to delete. + */ + key: string; +} diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts new file mode 100644 index 000000000..4fe9ca10a --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsGetRequest { + /** + * The key of the custom attribute definition to retrieve. If the requesting application + * is not the definition owner, you must use the qualified key. + */ + key: string; + /** + * The current version of the custom attribute definition, which is used for strongly consistent + * reads to guarantee that you receive the most up-to-date data. When included in the request, + * Square returns the specified version or a higher version if one exists. If the specified version + * is higher than the current version, Square returns a `BAD_REQUEST` error. + */ + version?: number | null; +} diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts new file mode 100644 index 000000000..932817271 --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface CustomAttributeDefinitionsListRequest { + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; +} diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..1a6d65104 --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * key: "key", + * customAttributeDefinition: { + * description: "Update the description as desired.", + * visibility: "VISIBILITY_READ_ONLY" + * } + * } + */ +export interface UpdateCustomerCustomAttributeDefinitionRequest { + /** + * The key of the custom attribute definition to update. + */ + key: string; + /** + * The custom attribute definition that contains the fields to update. This endpoint + * supports sparse updates, so only new or changed fields need to be included in the request. + * Only the following fields can be updated: + * + * - `name` + * - `description` + * - `visibility` + * - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed + * selections are supported. + * + * For more information, see + * [Updatable definition fields](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields). + * + * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control, include the optional `version` field and specify the current version of the custom attribute definition. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..470e9d196 --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,6 @@ +export { type CustomAttributeDefinitionsListRequest } from "./CustomAttributeDefinitionsListRequest"; +export { type CreateCustomerCustomAttributeDefinitionRequest } from "./CreateCustomerCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsGetRequest } from "./CustomAttributeDefinitionsGetRequest"; +export { type UpdateCustomerCustomAttributeDefinitionRequest } from "./UpdateCustomerCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsDeleteRequest } from "./CustomAttributeDefinitionsDeleteRequest"; +export { type BatchUpsertCustomerCustomAttributesRequest } from "./BatchUpsertCustomerCustomAttributesRequest"; diff --git a/src/api/resources/customers/resources/customAttributeDefinitions/index.ts b/src/api/resources/customers/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/customers/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/customers/resources/customAttributes/client/Client.ts b/src/api/resources/customers/resources/customAttributes/client/Client.ts new file mode 100644 index 000000000..4024d330f --- /dev/null +++ b/src/api/resources/customers/resources/customAttributes/client/Client.ts @@ -0,0 +1,415 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributes { + constructor(protected readonly _options: CustomAttributes.Options = {}) {} + + /** + * Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile. + * + * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + * in the same call. + * + * When all response pages are retrieved, the results include all custom attributes that are + * visible to the requesting application, including those that are owned by other applications + * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.customers.CustomAttributesListRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributes.list({ + * customerId: "customer_id" + * }) + */ + public async list( + request: Square.customers.CustomAttributesListRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const list = async ( + request: Square.customers.CustomAttributesListRequest, + ): Promise => { + const { customerId, limit, cursor, withDefinitions } = request; + const _queryParams: Record = {}; + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (withDefinitions !== undefined) { + _queryParams["with_definitions"] = withDefinitions?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}/custom-attributes`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCustomerCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/customers/{customer_id}/custom-attributes.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves a [custom attribute](entity:CustomAttribute) associated with a customer profile. + * + * You can use the `with_definition` query parameter to also retrieve the custom attribute definition + * in the same call. + * + * To retrieve a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.customers.CustomAttributesGetRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributes.get({ + * customerId: "customer_id", + * key: "key" + * }) + */ + public async get( + request: Square.customers.CustomAttributesGetRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { customerId, key, withDefinition, version } = request; + const _queryParams: Record = {}; + if (withDefinition !== undefined) { + _queryParams["with_definition"] = withDefinition?.toString() ?? null; + } + + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCustomerCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/customers/{customer_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates a [custom attribute](entity:CustomAttribute) for a customer profile. + * + * Use this endpoint to set the value of a custom attribute for a specified customer profile. + * A custom attribute is based on a custom attribute definition in a Square seller account, which + * is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint. + * + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.customers.UpsertCustomerCustomAttributeRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributes.upsert({ + * customerId: "customer_id", + * key: "key", + * customAttribute: { + * value: "Dune" + * } + * }) + */ + public async upsert( + request: Square.customers.UpsertCustomerCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { customerId, key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.customers.UpsertCustomerCustomAttributeRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpsertCustomerCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/customers/{customer_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile. + * + * To delete a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.customers.CustomAttributesDeleteRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.customAttributes.delete({ + * customerId: "customer_id", + * key: "key" + * }) + */ + public async delete( + request: Square.customers.CustomAttributesDeleteRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { customerId, key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteCustomerCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/customers/{customer_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/customers/resources/customAttributes/client/index.ts b/src/api/resources/customers/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/customers/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts b/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts new file mode 100644 index 000000000..7a008b6a1 --- /dev/null +++ b/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerId: "customer_id", + * key: "key" + * } + */ +export interface CustomAttributesDeleteRequest { + /** + * The ID of the target [customer profile](entity:Customer). + */ + customerId: string; + /** + * The key of the custom attribute to delete. This key must match the `key` of a custom + * attribute definition in the Square seller account. If the requesting application is not the + * definition owner, you must use the qualified key. + */ + key: string; +} diff --git a/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts b/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts new file mode 100644 index 000000000..8915993a6 --- /dev/null +++ b/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerId: "customer_id", + * key: "key" + * } + */ +export interface CustomAttributesGetRequest { + /** + * The ID of the target [customer profile](entity:Customer). + */ + customerId: string; + /** + * The key of the custom attribute to retrieve. This key must match the `key` of a custom + * attribute definition in the Square seller account. If the requesting application is not the + * definition owner, you must use the qualified key. + */ + key: string; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of + * the custom attribute. Set this parameter to `true` to get the name and description of the custom + * attribute, information about the data type, or other definition details. The default value is `false`. + */ + withDefinition?: boolean | null; + /** + * The current version of the custom attribute, which is used for strongly consistent reads to + * guarantee that you receive the most up-to-date data. When included in the request, Square + * returns the specified version or a higher version if one exists. If the specified version is + * higher than the current version, Square returns a `BAD_REQUEST` error. + */ + version?: number | null; +} diff --git a/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesListRequest.ts b/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesListRequest.ts new file mode 100644 index 000000000..83009bd83 --- /dev/null +++ b/src/api/resources/customers/resources/customAttributes/client/requests/CustomAttributesListRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerId: "customer_id" + * } + */ +export interface CustomAttributesListRequest { + /** + * The ID of the target [customer profile](entity:Customer). + */ + customerId: string; + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. For more + * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom + * attribute, information about the data type, or other definition details. The default value is `false`. + */ + withDefinitions?: boolean | null; +} diff --git a/src/api/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts b/src/api/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts new file mode 100644 index 000000000..c9728624d --- /dev/null +++ b/src/api/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * customerId: "customer_id", + * key: "key", + * customAttribute: { + * value: "Dune" + * } + * } + */ +export interface UpsertCustomerCustomAttributeRequest { + /** + * The ID of the target [customer profile](entity:Customer). + */ + customerId: string; + /** + * The key of the custom attribute to create or update. This key must match the `key` of a + * custom attribute definition in the Square seller account. If the requesting application is not + * the definition owner, you must use the qualified key. + */ + key: string; + /** + * The custom attribute to create or update, with the following fields: + * + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types). + * + * - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control for an update operation, include this optional field and specify the current version + * of the custom attribute. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/customers/resources/customAttributes/client/requests/index.ts b/src/api/resources/customers/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..f3278b901 --- /dev/null +++ b/src/api/resources/customers/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type CustomAttributesListRequest } from "./CustomAttributesListRequest"; +export { type CustomAttributesGetRequest } from "./CustomAttributesGetRequest"; +export { type UpsertCustomerCustomAttributeRequest } from "./UpsertCustomerCustomAttributeRequest"; +export { type CustomAttributesDeleteRequest } from "./CustomAttributesDeleteRequest"; diff --git a/src/api/resources/customers/resources/customAttributes/index.ts b/src/api/resources/customers/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/customers/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/customers/resources/groups/client/Client.ts b/src/api/resources/customers/resources/groups/client/Client.ts new file mode 100644 index 000000000..cc6755597 --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/Client.ts @@ -0,0 +1,607 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Groups { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Groups { + constructor(protected readonly _options: Groups.Options = {}) {} + + /** + * Retrieves the list of customer groups of a business. + * + * @param {Square.customers.GroupsListRequest} request + * @param {Groups.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.groups.list() + */ + public async list( + request: Square.customers.GroupsListRequest = {}, + requestOptions?: Groups.RequestOptions, + ): Promise> { + const list = async ( + request: Square.customers.GroupsListRequest, + ): Promise => { + const { cursor, limit } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/groups", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCustomerGroupsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/customers/groups."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.groups ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a new customer group for a business. + * + * The request must include the `name` value of the group. + * + * @param {Square.customers.CreateCustomerGroupRequest} request + * @param {Groups.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.groups.create({ + * group: { + * name: "Loyal Customers" + * } + * }) + */ + public async create( + request: Square.customers.CreateCustomerGroupRequest, + requestOptions?: Groups.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/groups", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.customers.CreateCustomerGroupRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCustomerGroupResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/customers/groups."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a specific customer group as identified by the `group_id` value. + * + * @param {Square.customers.GroupsGetRequest} request + * @param {Groups.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.groups.get({ + * groupId: "group_id" + * }) + */ + public async get( + request: Square.customers.GroupsGetRequest, + requestOptions?: Groups.RequestOptions, + ): Promise { + const { groupId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/groups/${encodeURIComponent(groupId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCustomerGroupResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/customers/groups/{group_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a customer group as identified by the `group_id` value. + * + * @param {Square.customers.UpdateCustomerGroupRequest} request + * @param {Groups.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.groups.update({ + * groupId: "group_id", + * group: { + * name: "Loyal Customers" + * } + * }) + */ + public async update( + request: Square.customers.UpdateCustomerGroupRequest, + requestOptions?: Groups.RequestOptions, + ): Promise { + const { groupId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/groups/${encodeURIComponent(groupId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.customers.UpdateCustomerGroupRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateCustomerGroupResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/customers/groups/{group_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a customer group as identified by the `group_id` value. + * + * @param {Square.customers.GroupsDeleteRequest} request + * @param {Groups.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.groups.delete({ + * groupId: "group_id" + * }) + */ + public async delete( + request: Square.customers.GroupsDeleteRequest, + requestOptions?: Groups.RequestOptions, + ): Promise { + const { groupId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/groups/${encodeURIComponent(groupId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteCustomerGroupResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/customers/groups/{group_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Adds a group membership to a customer. + * + * The customer is identified by the `customer_id` value + * and the customer group is identified by the `group_id` value. + * + * @param {Square.customers.GroupsAddRequest} request + * @param {Groups.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.groups.add({ + * customerId: "customer_id", + * groupId: "group_id" + * }) + */ + public async add( + request: Square.customers.GroupsAddRequest, + requestOptions?: Groups.RequestOptions, + ): Promise { + const { customerId, groupId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}/groups/${encodeURIComponent(groupId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.AddGroupToCustomerResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/customers/{customer_id}/groups/{group_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Removes a group membership from a customer. + * + * The customer is identified by the `customer_id` value + * and the customer group is identified by the `group_id` value. + * + * @param {Square.customers.GroupsRemoveRequest} request + * @param {Groups.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.groups.remove({ + * customerId: "customer_id", + * groupId: "group_id" + * }) + */ + public async remove( + request: Square.customers.GroupsRemoveRequest, + requestOptions?: Groups.RequestOptions, + ): Promise { + const { customerId, groupId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/${encodeURIComponent(customerId)}/groups/${encodeURIComponent(groupId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RemoveGroupFromCustomerResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/customers/{customer_id}/groups/{group_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/customers/resources/groups/client/index.ts b/src/api/resources/customers/resources/groups/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts b/src/api/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts new file mode 100644 index 000000000..4bbad8d1a --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * group: { + * name: "Loyal Customers" + * } + * } + */ +export interface CreateCustomerGroupRequest { + /** The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ + idempotencyKey?: string; + /** The customer group to create. */ + group: Square.CustomerGroup; +} diff --git a/src/api/resources/customers/resources/groups/client/requests/GroupsAddRequest.ts b/src/api/resources/customers/resources/groups/client/requests/GroupsAddRequest.ts new file mode 100644 index 000000000..9032a5ee9 --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/requests/GroupsAddRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerId: "customer_id", + * groupId: "group_id" + * } + */ +export interface GroupsAddRequest { + /** + * The ID of the customer to add to a group. + */ + customerId: string; + /** + * The ID of the customer group to add the customer to. + */ + groupId: string; +} diff --git a/src/api/resources/customers/resources/groups/client/requests/GroupsDeleteRequest.ts b/src/api/resources/customers/resources/groups/client/requests/GroupsDeleteRequest.ts new file mode 100644 index 000000000..1b9f149a1 --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/requests/GroupsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * groupId: "group_id" + * } + */ +export interface GroupsDeleteRequest { + /** + * The ID of the customer group to delete. + */ + groupId: string; +} diff --git a/src/api/resources/customers/resources/groups/client/requests/GroupsGetRequest.ts b/src/api/resources/customers/resources/groups/client/requests/GroupsGetRequest.ts new file mode 100644 index 000000000..b67a03f5c --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/requests/GroupsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * groupId: "group_id" + * } + */ +export interface GroupsGetRequest { + /** + * The ID of the customer group to retrieve. + */ + groupId: string; +} diff --git a/src/api/resources/customers/resources/groups/client/requests/GroupsListRequest.ts b/src/api/resources/customers/resources/groups/client/requests/GroupsListRequest.ts new file mode 100644 index 000000000..8c1b80d2f --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/requests/GroupsListRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface GroupsListRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for your original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. + * If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; +} diff --git a/src/api/resources/customers/resources/groups/client/requests/GroupsRemoveRequest.ts b/src/api/resources/customers/resources/groups/client/requests/GroupsRemoveRequest.ts new file mode 100644 index 000000000..d1e4c5594 --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/requests/GroupsRemoveRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * customerId: "customer_id", + * groupId: "group_id" + * } + */ +export interface GroupsRemoveRequest { + /** + * The ID of the customer to remove from the group. + */ + customerId: string; + /** + * The ID of the customer group to remove the customer from. + */ + groupId: string; +} diff --git a/src/api/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts b/src/api/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts new file mode 100644 index 000000000..d1655a132 --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * groupId: "group_id", + * group: { + * name: "Loyal Customers" + * } + * } + */ +export interface UpdateCustomerGroupRequest { + /** + * The ID of the customer group to update. + */ + groupId: string; + /** The `CustomerGroup` object including all the updates you want to make. */ + group: Square.CustomerGroup; +} diff --git a/src/api/resources/customers/resources/groups/client/requests/index.ts b/src/api/resources/customers/resources/groups/client/requests/index.ts new file mode 100644 index 000000000..811df7e11 --- /dev/null +++ b/src/api/resources/customers/resources/groups/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type GroupsListRequest } from "./GroupsListRequest"; +export { type CreateCustomerGroupRequest } from "./CreateCustomerGroupRequest"; +export { type GroupsGetRequest } from "./GroupsGetRequest"; +export { type UpdateCustomerGroupRequest } from "./UpdateCustomerGroupRequest"; +export { type GroupsDeleteRequest } from "./GroupsDeleteRequest"; +export { type GroupsAddRequest } from "./GroupsAddRequest"; +export { type GroupsRemoveRequest } from "./GroupsRemoveRequest"; diff --git a/src/api/resources/customers/resources/groups/index.ts b/src/api/resources/customers/resources/groups/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/customers/resources/groups/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/customers/resources/index.ts b/src/api/resources/customers/resources/index.ts new file mode 100644 index 000000000..7cd096b80 --- /dev/null +++ b/src/api/resources/customers/resources/index.ts @@ -0,0 +1,10 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * as groups from "./groups"; +export * as segments from "./segments"; +export * as cards from "./cards"; +export * as customAttributes from "./customAttributes"; +export * from "./customAttributeDefinitions/client/requests"; +export * from "./groups/client/requests"; +export * from "./segments/client/requests"; +export * from "./cards/client/requests"; +export * from "./customAttributes/client/requests"; diff --git a/src/api/resources/customers/resources/segments/client/Client.ts b/src/api/resources/customers/resources/segments/client/Client.ts new file mode 100644 index 000000000..b1be17876 --- /dev/null +++ b/src/api/resources/customers/resources/segments/client/Client.ts @@ -0,0 +1,212 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Segments { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Segments { + constructor(protected readonly _options: Segments.Options = {}) {} + + /** + * Retrieves the list of customer segments of a business. + * + * @param {Square.customers.SegmentsListRequest} request + * @param {Segments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.segments.list() + */ + public async list( + request: Square.customers.SegmentsListRequest = {}, + requestOptions?: Segments.RequestOptions, + ): Promise> { + const list = async ( + request: Square.customers.SegmentsListRequest, + ): Promise => { + const { cursor, limit } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/customers/segments", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListCustomerSegmentsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/customers/segments."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.segments ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves a specific customer segment as identified by the `segment_id` value. + * + * @param {Square.customers.SegmentsGetRequest} request + * @param {Segments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.customers.segments.get({ + * segmentId: "segment_id" + * }) + */ + public async get( + request: Square.customers.SegmentsGetRequest, + requestOptions?: Segments.RequestOptions, + ): Promise { + const { segmentId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/customers/segments/${encodeURIComponent(segmentId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetCustomerSegmentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/customers/segments/{segment_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/customers/resources/segments/client/index.ts b/src/api/resources/customers/resources/segments/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/customers/resources/segments/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/customers/resources/segments/client/requests/SegmentsGetRequest.ts b/src/api/resources/customers/resources/segments/client/requests/SegmentsGetRequest.ts new file mode 100644 index 000000000..8aabc79db --- /dev/null +++ b/src/api/resources/customers/resources/segments/client/requests/SegmentsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * segmentId: "segment_id" + * } + */ +export interface SegmentsGetRequest { + /** + * The Square-issued ID of the customer segment. + */ + segmentId: string; +} diff --git a/src/api/resources/customers/resources/segments/client/requests/SegmentsListRequest.ts b/src/api/resources/customers/resources/segments/client/requests/SegmentsListRequest.ts new file mode 100644 index 000000000..ba237b49b --- /dev/null +++ b/src/api/resources/customers/resources/segments/client/requests/SegmentsListRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface SegmentsListRequest { + /** + * A pagination cursor returned by previous calls to `ListCustomerSegments`. + * This cursor is used to retrieve the next set of query results. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. + * If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; +} diff --git a/src/api/resources/customers/resources/segments/client/requests/index.ts b/src/api/resources/customers/resources/segments/client/requests/index.ts new file mode 100644 index 000000000..e24b0f457 --- /dev/null +++ b/src/api/resources/customers/resources/segments/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type SegmentsListRequest } from "./SegmentsListRequest"; +export { type SegmentsGetRequest } from "./SegmentsGetRequest"; diff --git a/src/api/resources/customers/resources/segments/index.ts b/src/api/resources/customers/resources/segments/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/customers/resources/segments/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/devices/client/Client.ts b/src/api/resources/devices/client/Client.ts new file mode 100644 index 000000000..3d644ebf4 --- /dev/null +++ b/src/api/resources/devices/client/Client.ts @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; +import { Codes } from "../resources/codes/client/Client"; + +export declare namespace Devices { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Devices { + protected _codes: Codes | undefined; + + constructor(protected readonly _options: Devices.Options = {}) {} + + public get codes(): Codes { + return (this._codes ??= new Codes(this._options)); + } + + /** + * List devices associated with the merchant. Currently, only Terminal API + * devices are supported. + * + * @param {Square.DevicesListRequest} request + * @param {Devices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.devices.list() + */ + public async list( + request: Square.DevicesListRequest = {}, + requestOptions?: Devices.RequestOptions, + ): Promise> { + const list = async (request: Square.DevicesListRequest): Promise => { + const { cursor, sortOrder, limit, locationId } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/devices", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListDevicesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/devices."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.devices ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves Device with the associated `device_id`. + * + * @param {Square.DevicesGetRequest} request + * @param {Devices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.devices.get({ + * deviceId: "device_id" + * }) + */ + public async get( + request: Square.DevicesGetRequest, + requestOptions?: Devices.RequestOptions, + ): Promise { + const { deviceId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/devices/${encodeURIComponent(deviceId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetDeviceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/devices/{device_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/devices/client/index.ts b/src/api/resources/devices/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/devices/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/devices/client/requests/DevicesGetRequest.ts b/src/api/resources/devices/client/requests/DevicesGetRequest.ts new file mode 100644 index 000000000..9d99af239 --- /dev/null +++ b/src/api/resources/devices/client/requests/DevicesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * deviceId: "device_id" + * } + */ +export interface DevicesGetRequest { + /** + * The unique ID for the desired `Device`. + */ + deviceId: string; +} diff --git a/src/api/resources/devices/client/requests/DevicesListRequest.ts b/src/api/resources/devices/client/requests/DevicesListRequest.ts new file mode 100644 index 000000000..3259d6305 --- /dev/null +++ b/src/api/resources/devices/client/requests/DevicesListRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface DevicesListRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string | null; + /** + * The order in which results are listed. + * - `ASC` - Oldest to newest. + * - `DESC` - Newest to oldest (default). + */ + sortOrder?: Square.SortOrder | null; + /** + * The number of results to return in a single page. + */ + limit?: number | null; + /** + * If present, only returns devices at the target location. + */ + locationId?: string | null; +} diff --git a/src/api/resources/devices/client/requests/index.ts b/src/api/resources/devices/client/requests/index.ts new file mode 100644 index 000000000..018ff650a --- /dev/null +++ b/src/api/resources/devices/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type DevicesListRequest } from "./DevicesListRequest"; +export { type DevicesGetRequest } from "./DevicesGetRequest"; diff --git a/src/api/resources/devices/index.ts b/src/api/resources/devices/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/devices/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/devices/resources/codes/client/Client.ts b/src/api/resources/devices/resources/codes/client/Client.ts new file mode 100644 index 000000000..27ba89425 --- /dev/null +++ b/src/api/resources/devices/resources/codes/client/Client.ts @@ -0,0 +1,302 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Codes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Codes { + constructor(protected readonly _options: Codes.Options = {}) {} + + /** + * Lists all DeviceCodes associated with the merchant. + * + * @param {Square.devices.CodesListRequest} request + * @param {Codes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.devices.codes.list() + */ + public async list( + request: Square.devices.CodesListRequest = {}, + requestOptions?: Codes.RequestOptions, + ): Promise> { + const list = async (request: Square.devices.CodesListRequest): Promise => { + const { cursor, locationId, productType, status } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (productType !== undefined) { + _queryParams["product_type"] = serializers.ProductType.jsonOrThrow(productType, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (status !== undefined) { + _queryParams["status"] = serializers.DeviceCodeStatus.jsonOrThrow(status, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/devices/codes", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListDeviceCodesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/devices/codes."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.deviceCodes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected + * terminal mode. + * + * @param {Square.devices.CreateDeviceCodeRequest} request + * @param {Codes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.devices.codes.create({ + * idempotencyKey: "01bb00a6-0c86-4770-94ed-f5fca973cd56", + * deviceCode: { + * name: "Counter 1", + * productType: "TERMINAL_API", + * locationId: "B5E4484SHHNYH" + * } + * }) + */ + public async create( + request: Square.devices.CreateDeviceCodeRequest, + requestOptions?: Codes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/devices/codes", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.devices.CreateDeviceCodeRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateDeviceCodeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/devices/codes."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves DeviceCode with the associated ID. + * + * @param {Square.devices.CodesGetRequest} request + * @param {Codes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.devices.codes.get({ + * id: "id" + * }) + */ + public async get( + request: Square.devices.CodesGetRequest, + requestOptions?: Codes.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/devices/codes/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetDeviceCodeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/devices/codes/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/devices/resources/codes/client/index.ts b/src/api/resources/devices/resources/codes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/devices/resources/codes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/devices/resources/codes/client/requests/CodesGetRequest.ts b/src/api/resources/devices/resources/codes/client/requests/CodesGetRequest.ts new file mode 100644 index 000000000..c2eed83b2 --- /dev/null +++ b/src/api/resources/devices/resources/codes/client/requests/CodesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface CodesGetRequest { + /** + * The unique identifier for the device code. + */ + id: string; +} diff --git a/src/api/resources/devices/resources/codes/client/requests/CodesListRequest.ts b/src/api/resources/devices/resources/codes/client/requests/CodesListRequest.ts new file mode 100644 index 000000000..461f654d7 --- /dev/null +++ b/src/api/resources/devices/resources/codes/client/requests/CodesListRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * {} + */ +export interface CodesListRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for your original query. + * + * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + */ + cursor?: string | null; + /** + * If specified, only returns DeviceCodes of the specified location. + * Returns DeviceCodes of all locations if empty. + */ + locationId?: string | null; + /** + * If specified, only returns DeviceCodes targeting the specified product type. + * Returns DeviceCodes of all product types if empty. + */ + productType?: Square.ProductType | null; + /** + * If specified, returns DeviceCodes with the specified statuses. + * Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. + */ + status?: Square.DeviceCodeStatus | null; +} diff --git a/src/api/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts b/src/api/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts new file mode 100644 index 000000000..2e6a6d4fe --- /dev/null +++ b/src/api/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "01bb00a6-0c86-4770-94ed-f5fca973cd56", + * deviceCode: { + * name: "Counter 1", + * productType: "TERMINAL_API", + * locationId: "B5E4484SHHNYH" + * } + * } + */ +export interface CreateDeviceCodeRequest { + /** + * A unique string that identifies this CreateDeviceCode request. Keys can + * be any valid string but must be unique for every CreateDeviceCode request. + * + * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + */ + idempotencyKey: string; + /** The device code to create. */ + deviceCode: Square.DeviceCode; +} diff --git a/src/api/resources/devices/resources/codes/client/requests/index.ts b/src/api/resources/devices/resources/codes/client/requests/index.ts new file mode 100644 index 000000000..9711bbe82 --- /dev/null +++ b/src/api/resources/devices/resources/codes/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type CodesListRequest } from "./CodesListRequest"; +export { type CreateDeviceCodeRequest } from "./CreateDeviceCodeRequest"; +export { type CodesGetRequest } from "./CodesGetRequest"; diff --git a/src/api/resources/devices/resources/codes/index.ts b/src/api/resources/devices/resources/codes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/devices/resources/codes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/devices/resources/index.ts b/src/api/resources/devices/resources/index.ts new file mode 100644 index 000000000..b75af3b53 --- /dev/null +++ b/src/api/resources/devices/resources/index.ts @@ -0,0 +1,2 @@ +export * as codes from "./codes"; +export * from "./codes/client/requests"; diff --git a/src/api/resources/disputes/client/Client.ts b/src/api/resources/disputes/client/Client.ts new file mode 100644 index 000000000..88c4307a4 --- /dev/null +++ b/src/api/resources/disputes/client/Client.ts @@ -0,0 +1,559 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; +import { toJson } from "../../../../core/json"; +import { Evidence } from "../resources/evidence/client/Client"; + +export declare namespace Disputes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Disputes { + protected _evidence: Evidence | undefined; + + constructor(protected readonly _options: Disputes.Options = {}) {} + + public get evidence(): Evidence { + return (this._evidence ??= new Evidence(this._options)); + } + + /** + * Returns a list of disputes associated with a particular account. + * + * @param {Square.DisputesListRequest} request + * @param {Disputes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.list() + */ + public async list( + request: Square.DisputesListRequest = {}, + requestOptions?: Disputes.RequestOptions, + ): Promise> { + const list = async (request: Square.DisputesListRequest): Promise => { + const { cursor, states, locationId } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (states !== undefined) { + _queryParams["states"] = serializers.DisputeState.jsonOrThrow(states, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/disputes", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListDisputesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/disputes."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.disputes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Returns details about a specific dispute. + * + * @param {Square.DisputesGetRequest} request + * @param {Disputes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.get({ + * disputeId: "dispute_id" + * }) + */ + public async get( + request: Square.DisputesGetRequest, + requestOptions?: Disputes.RequestOptions, + ): Promise { + const { disputeId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/disputes/${encodeURIComponent(disputeId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetDisputeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/disputes/{dispute_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and + * updates the dispute state to ACCEPTED. + * + * Square debits the disputed amount from the seller’s Square account. If the Square account + * does not have sufficient funds, Square debits the associated bank account. + * + * @param {Square.DisputesAcceptRequest} request + * @param {Disputes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.accept({ + * disputeId: "dispute_id" + * }) + */ + public async accept( + request: Square.DisputesAcceptRequest, + requestOptions?: Disputes.RequestOptions, + ): Promise { + const { disputeId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/disputes/${encodeURIComponent(disputeId)}/accept`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.AcceptDisputeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/disputes/{dispute_id}/accept.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP + * multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats. + * + * @param {Square.DisputesCreateEvidenceFileRequest} request + * @param {Disputes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.createEvidenceFile({ + * disputeId: "dispute_id" + * }) + */ + public async createEvidenceFile( + request: Square.DisputesCreateEvidenceFileRequest, + requestOptions?: Disputes.RequestOptions, + ): Promise { + const _request = await core.newFormData(); + if (request.request != null) { + _request.append( + "request", + toJson( + serializers.CreateDisputeEvidenceFileRequest.jsonOrThrow(request.request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + ), + ); + } + + if (request.imageFile != null) { + await _request.appendFile("image_file", request.imageFile); + } + + const _maybeEncodedRequest = await _request.getRequest(); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/disputes/${encodeURIComponent(request.disputeId)}/evidence-files`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ..._maybeEncodedRequest.headers, + ...requestOptions?.headers, + }, + requestType: "file", + duplex: _maybeEncodedRequest.duplex, + body: _maybeEncodedRequest.body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateDisputeEvidenceFileResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/disputes/{dispute_id}/evidence-files.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Uploads text to use as evidence for a dispute challenge. + * + * @param {Square.CreateDisputeEvidenceTextRequest} request + * @param {Disputes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.createEvidenceText({ + * disputeId: "dispute_id", + * idempotencyKey: "ed3ee3933d946f1514d505d173c82648", + * evidenceType: "TRACKING_NUMBER", + * evidenceText: "1Z8888888888888888" + * }) + */ + public async createEvidenceText( + request: Square.CreateDisputeEvidenceTextRequest, + requestOptions?: Disputes.RequestOptions, + ): Promise { + const { disputeId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/disputes/${encodeURIComponent(disputeId)}/evidence-text`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateDisputeEvidenceTextRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateDisputeEvidenceTextResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/disputes/{dispute_id}/evidence-text.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Submits evidence to the cardholder's bank. + * + * The evidence submitted by this endpoint includes evidence uploaded + * using the [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) and + * [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText) endpoints and + * evidence automatically provided by Square, when available. Evidence cannot be removed from + * a dispute after submission. + * + * @param {Square.DisputesSubmitEvidenceRequest} request + * @param {Disputes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.submitEvidence({ + * disputeId: "dispute_id" + * }) + */ + public async submitEvidence( + request: Square.DisputesSubmitEvidenceRequest, + requestOptions?: Disputes.RequestOptions, + ): Promise { + const { disputeId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/disputes/${encodeURIComponent(disputeId)}/submit-evidence`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SubmitEvidenceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/disputes/{dispute_id}/submit-evidence.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/disputes/client/index.ts b/src/api/resources/disputes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/disputes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts b/src/api/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts new file mode 100644 index 000000000..dd6bf19e1 --- /dev/null +++ b/src/api/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * disputeId: "dispute_id", + * idempotencyKey: "ed3ee3933d946f1514d505d173c82648", + * evidenceType: "TRACKING_NUMBER", + * evidenceText: "1Z8888888888888888" + * } + */ +export interface CreateDisputeEvidenceTextRequest { + /** + * The ID of the dispute for which you want to upload evidence. + */ + disputeId: string; + /** A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ + idempotencyKey: string; + /** + * The type of evidence you are uploading. + * See [DisputeEvidenceType](#type-disputeevidencetype) for possible values + */ + evidenceType?: Square.DisputeEvidenceType; + /** The evidence string. */ + evidenceText: string; +} diff --git a/src/api/resources/disputes/client/requests/DisputesAcceptRequest.ts b/src/api/resources/disputes/client/requests/DisputesAcceptRequest.ts new file mode 100644 index 000000000..168b18e13 --- /dev/null +++ b/src/api/resources/disputes/client/requests/DisputesAcceptRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * disputeId: "dispute_id" + * } + */ +export interface DisputesAcceptRequest { + /** + * The ID of the dispute you want to accept. + */ + disputeId: string; +} diff --git a/src/api/resources/disputes/client/requests/DisputesCreateEvidenceFileRequest.ts b/src/api/resources/disputes/client/requests/DisputesCreateEvidenceFileRequest.ts new file mode 100644 index 000000000..caef2b466 --- /dev/null +++ b/src/api/resources/disputes/client/requests/DisputesCreateEvidenceFileRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; +import * as fs from "fs"; + +/** + * @example + * { + * disputeId: "dispute_id" + * } + */ +export interface DisputesCreateEvidenceFileRequest { + /** + * The ID of the dispute for which you want to upload evidence. + */ + disputeId: string; + request?: Square.CreateDisputeEvidenceFileRequest; + imageFile?: File | fs.ReadStream | Blob | undefined; +} diff --git a/src/api/resources/disputes/client/requests/DisputesGetRequest.ts b/src/api/resources/disputes/client/requests/DisputesGetRequest.ts new file mode 100644 index 000000000..2066f0b6b --- /dev/null +++ b/src/api/resources/disputes/client/requests/DisputesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * disputeId: "dispute_id" + * } + */ +export interface DisputesGetRequest { + /** + * The ID of the dispute you want more details about. + */ + disputeId: string; +} diff --git a/src/api/resources/disputes/client/requests/DisputesListRequest.ts b/src/api/resources/disputes/client/requests/DisputesListRequest.ts new file mode 100644 index 000000000..90c1a5df8 --- /dev/null +++ b/src/api/resources/disputes/client/requests/DisputesListRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface DisputesListRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * The dispute states used to filter the result. If not specified, the endpoint returns all disputes. + */ + states?: Square.DisputeState | null; + /** + * The ID of the location for which to return a list of disputes. + * If not specified, the endpoint returns disputes associated with all locations. + */ + locationId?: string | null; +} diff --git a/src/api/resources/disputes/client/requests/DisputesSubmitEvidenceRequest.ts b/src/api/resources/disputes/client/requests/DisputesSubmitEvidenceRequest.ts new file mode 100644 index 000000000..1f8f67cfa --- /dev/null +++ b/src/api/resources/disputes/client/requests/DisputesSubmitEvidenceRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * disputeId: "dispute_id" + * } + */ +export interface DisputesSubmitEvidenceRequest { + /** + * The ID of the dispute for which you want to submit evidence. + */ + disputeId: string; +} diff --git a/src/api/resources/disputes/client/requests/index.ts b/src/api/resources/disputes/client/requests/index.ts new file mode 100644 index 000000000..d1b097066 --- /dev/null +++ b/src/api/resources/disputes/client/requests/index.ts @@ -0,0 +1,6 @@ +export { type DisputesListRequest } from "./DisputesListRequest"; +export { type DisputesGetRequest } from "./DisputesGetRequest"; +export { type DisputesAcceptRequest } from "./DisputesAcceptRequest"; +export { type DisputesCreateEvidenceFileRequest } from "./DisputesCreateEvidenceFileRequest"; +export { type CreateDisputeEvidenceTextRequest } from "./CreateDisputeEvidenceTextRequest"; +export { type DisputesSubmitEvidenceRequest } from "./DisputesSubmitEvidenceRequest"; diff --git a/src/api/resources/disputes/index.ts b/src/api/resources/disputes/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/disputes/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/disputes/resources/evidence/client/Client.ts b/src/api/resources/disputes/resources/evidence/client/Client.ts new file mode 100644 index 000000000..4da22f1d5 --- /dev/null +++ b/src/api/resources/disputes/resources/evidence/client/Client.ts @@ -0,0 +1,293 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Evidence { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Evidence { + constructor(protected readonly _options: Evidence.Options = {}) {} + + /** + * Returns a list of evidence associated with a dispute. + * + * @param {Square.disputes.EvidenceListRequest} request + * @param {Evidence.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.evidence.list({ + * disputeId: "dispute_id" + * }) + */ + public async list( + request: Square.disputes.EvidenceListRequest, + requestOptions?: Evidence.RequestOptions, + ): Promise> { + const list = async ( + request: Square.disputes.EvidenceListRequest, + ): Promise => { + const { disputeId, cursor } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/disputes/${encodeURIComponent(disputeId)}/evidence`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListDisputeEvidenceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/disputes/{dispute_id}/evidence.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.evidence ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Returns the metadata for the evidence specified in the request URL path. + * + * You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it. + * + * @param {Square.disputes.EvidenceGetRequest} request + * @param {Evidence.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.evidence.get({ + * disputeId: "dispute_id", + * evidenceId: "evidence_id" + * }) + */ + public async get( + request: Square.disputes.EvidenceGetRequest, + requestOptions?: Evidence.RequestOptions, + ): Promise { + const { disputeId, evidenceId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/disputes/${encodeURIComponent(disputeId)}/evidence/${encodeURIComponent(evidenceId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetDisputeEvidenceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/disputes/{dispute_id}/evidence/{evidence_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Removes specified evidence from a dispute. + * Square does not send the bank any evidence that is removed. + * + * @param {Square.disputes.EvidenceDeleteRequest} request + * @param {Evidence.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.disputes.evidence.delete({ + * disputeId: "dispute_id", + * evidenceId: "evidence_id" + * }) + */ + public async delete( + request: Square.disputes.EvidenceDeleteRequest, + requestOptions?: Evidence.RequestOptions, + ): Promise { + const { disputeId, evidenceId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/disputes/${encodeURIComponent(disputeId)}/evidence/${encodeURIComponent(evidenceId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteDisputeEvidenceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/disputes/{dispute_id}/evidence/{evidence_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/disputes/resources/evidence/client/index.ts b/src/api/resources/disputes/resources/evidence/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/disputes/resources/evidence/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/disputes/resources/evidence/client/requests/EvidenceDeleteRequest.ts b/src/api/resources/disputes/resources/evidence/client/requests/EvidenceDeleteRequest.ts new file mode 100644 index 000000000..08c2293e1 --- /dev/null +++ b/src/api/resources/disputes/resources/evidence/client/requests/EvidenceDeleteRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * disputeId: "dispute_id", + * evidenceId: "evidence_id" + * } + */ +export interface EvidenceDeleteRequest { + /** + * The ID of the dispute from which you want to remove evidence. + */ + disputeId: string; + /** + * The ID of the evidence you want to remove. + */ + evidenceId: string; +} diff --git a/src/api/resources/disputes/resources/evidence/client/requests/EvidenceGetRequest.ts b/src/api/resources/disputes/resources/evidence/client/requests/EvidenceGetRequest.ts new file mode 100644 index 000000000..696dbe80f --- /dev/null +++ b/src/api/resources/disputes/resources/evidence/client/requests/EvidenceGetRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * disputeId: "dispute_id", + * evidenceId: "evidence_id" + * } + */ +export interface EvidenceGetRequest { + /** + * The ID of the dispute from which you want to retrieve evidence metadata. + */ + disputeId: string; + /** + * The ID of the evidence to retrieve. + */ + evidenceId: string; +} diff --git a/src/api/resources/disputes/resources/evidence/client/requests/EvidenceListRequest.ts b/src/api/resources/disputes/resources/evidence/client/requests/EvidenceListRequest.ts new file mode 100644 index 000000000..ec72b3248 --- /dev/null +++ b/src/api/resources/disputes/resources/evidence/client/requests/EvidenceListRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * disputeId: "dispute_id" + * } + */ +export interface EvidenceListRequest { + /** + * The ID of the dispute. + */ + disputeId: string; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; +} diff --git a/src/api/resources/disputes/resources/evidence/client/requests/index.ts b/src/api/resources/disputes/resources/evidence/client/requests/index.ts new file mode 100644 index 000000000..a3653481b --- /dev/null +++ b/src/api/resources/disputes/resources/evidence/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type EvidenceListRequest } from "./EvidenceListRequest"; +export { type EvidenceGetRequest } from "./EvidenceGetRequest"; +export { type EvidenceDeleteRequest } from "./EvidenceDeleteRequest"; diff --git a/src/api/resources/disputes/resources/evidence/index.ts b/src/api/resources/disputes/resources/evidence/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/disputes/resources/evidence/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/disputes/resources/index.ts b/src/api/resources/disputes/resources/index.ts new file mode 100644 index 000000000..bbb817c3d --- /dev/null +++ b/src/api/resources/disputes/resources/index.ts @@ -0,0 +1,2 @@ +export * as evidence from "./evidence"; +export * from "./evidence/client/requests"; diff --git a/src/api/resources/employees/client/Client.ts b/src/api/resources/employees/client/Client.ts new file mode 100644 index 000000000..807e2de95 --- /dev/null +++ b/src/api/resources/employees/client/Client.ts @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Employees { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Employees { + constructor(protected readonly _options: Employees.Options = {}) {} + + /** + * + * + * @param {Square.EmployeesListRequest} request + * @param {Employees.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.employees.list() + */ + public async list( + request: Square.EmployeesListRequest = {}, + requestOptions?: Employees.RequestOptions, + ): Promise> { + const list = async (request: Square.EmployeesListRequest): Promise => { + const { locationId, status, limit, cursor } = request; + const _queryParams: Record = {}; + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (status !== undefined) { + _queryParams["status"] = serializers.EmployeeStatus.jsonOrThrow(status, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/employees", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListEmployeesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/employees."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.employees ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * + * + * @param {Square.EmployeesGetRequest} request + * @param {Employees.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.employees.get({ + * id: "id" + * }) + */ + public async get( + request: Square.EmployeesGetRequest, + requestOptions?: Employees.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/employees/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetEmployeeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/employees/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/employees/client/index.ts b/src/api/resources/employees/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/employees/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/employees/client/requests/EmployeesGetRequest.ts b/src/api/resources/employees/client/requests/EmployeesGetRequest.ts new file mode 100644 index 000000000..4a9150d79 --- /dev/null +++ b/src/api/resources/employees/client/requests/EmployeesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface EmployeesGetRequest { + /** + * UUID for the employee that was requested. + */ + id: string; +} diff --git a/src/api/resources/employees/client/requests/EmployeesListRequest.ts b/src/api/resources/employees/client/requests/EmployeesListRequest.ts new file mode 100644 index 000000000..2acb3505a --- /dev/null +++ b/src/api/resources/employees/client/requests/EmployeesListRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface EmployeesListRequest { + /** + * + */ + locationId?: string | null; + /** + * Specifies the EmployeeStatus to filter the employee by. + */ + status?: Square.EmployeeStatus | null; + /** + * The number of employees to be returned on each page. + */ + limit?: number | null; + /** + * The token required to retrieve the specified page of results. + */ + cursor?: string | null; +} diff --git a/src/api/resources/employees/client/requests/index.ts b/src/api/resources/employees/client/requests/index.ts new file mode 100644 index 000000000..7e25b3508 --- /dev/null +++ b/src/api/resources/employees/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type EmployeesListRequest } from "./EmployeesListRequest"; +export { type EmployeesGetRequest } from "./EmployeesGetRequest"; diff --git a/src/api/resources/employees/index.ts b/src/api/resources/employees/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/employees/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/events/client/Client.ts b/src/api/resources/events/client/Client.ts new file mode 100644 index 000000000..7634c09e4 --- /dev/null +++ b/src/api/resources/events/client/Client.ts @@ -0,0 +1,333 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Events { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Events { + constructor(protected readonly _options: Events.Options = {}) {} + + /** + * Search for Square API events that occur within a 28-day timeframe. + * + * @param {Square.SearchEventsRequest} request + * @param {Events.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.events.searchEvents() + */ + public async searchEvents( + request: Square.SearchEventsRequest = {}, + requestOptions?: Events.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/events", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchEventsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchEventsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/events."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Disables events to prevent them from being searchable. + * All events are disabled by default. You must enable events to make them searchable. + * Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later. + * + * @param {Events.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.events.disableEvents() + */ + public async disableEvents(requestOptions?: Events.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/events/disable", + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DisableEventsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/events/disable."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Enables events to make them searchable. Only events that occur while in the enabled state are searchable. + * + * @param {Events.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.events.enableEvents() + */ + public async enableEvents(requestOptions?: Events.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/events/enable", + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.EnableEventsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/events/enable."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Lists all event types that you can subscribe to as webhooks or query using the Events API. + * + * @param {Square.ListEventTypesRequest} request + * @param {Events.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.events.listEventTypes() + */ + public async listEventTypes( + request: Square.ListEventTypesRequest = {}, + requestOptions?: Events.RequestOptions, + ): Promise { + const { apiVersion } = request; + const _queryParams: Record = {}; + if (apiVersion !== undefined) { + _queryParams["api_version"] = apiVersion; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/events/types", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListEventTypesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/events/types."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/events/client/index.ts b/src/api/resources/events/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/events/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/events/client/requests/ListEventTypesRequest.ts b/src/api/resources/events/client/requests/ListEventTypesRequest.ts new file mode 100644 index 000000000..58176164e --- /dev/null +++ b/src/api/resources/events/client/requests/ListEventTypesRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ListEventTypesRequest { + /** + * The API version for which to list event types. Setting this field overrides the default version used by the application. + */ + apiVersion?: string | null; +} diff --git a/src/api/resources/events/client/requests/SearchEventsRequest.ts b/src/api/resources/events/client/requests/SearchEventsRequest.ts new file mode 100644 index 000000000..e63d21d15 --- /dev/null +++ b/src/api/resources/events/client/requests/SearchEventsRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface SearchEventsRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of events for your original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** + * The maximum number of events to return in a single page. The response might contain fewer events. The default value is 100, which is also the maximum allowed value. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + * + * Default: 100 + */ + limit?: number; + /** The filtering and sorting criteria for the search request. To retrieve additional pages using a cursor, you must use the original query. */ + query?: Square.SearchEventsQuery; +} diff --git a/src/api/resources/events/client/requests/index.ts b/src/api/resources/events/client/requests/index.ts new file mode 100644 index 000000000..d6a20d449 --- /dev/null +++ b/src/api/resources/events/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type SearchEventsRequest } from "./SearchEventsRequest"; +export { type ListEventTypesRequest } from "./ListEventTypesRequest"; diff --git a/src/api/resources/events/index.ts b/src/api/resources/events/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/events/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/giftCards/client/Client.ts b/src/api/resources/giftCards/client/Client.ts new file mode 100644 index 000000000..707234ea1 --- /dev/null +++ b/src/api/resources/giftCards/client/Client.ts @@ -0,0 +1,621 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; +import { Activities } from "../resources/activities/client/Client"; + +export declare namespace GiftCards { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class GiftCards { + protected _activities: Activities | undefined; + + constructor(protected readonly _options: GiftCards.Options = {}) {} + + public get activities(): Activities { + return (this._activities ??= new Activities(this._options)); + } + + /** + * Lists all gift cards. You can specify optional filters to retrieve + * a subset of the gift cards. Results are sorted by `created_at` in ascending order. + * + * @param {Square.GiftCardsListRequest} request + * @param {GiftCards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.list() + */ + public async list( + request: Square.GiftCardsListRequest = {}, + requestOptions?: GiftCards.RequestOptions, + ): Promise> { + const list = async (request: Square.GiftCardsListRequest): Promise => { + const { type: type_, state, limit, cursor, customerId } = request; + const _queryParams: Record = {}; + if (type_ !== undefined) { + _queryParams["type"] = type_; + } + if (state !== undefined) { + _queryParams["state"] = state; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (customerId !== undefined) { + _queryParams["customer_id"] = customerId; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/gift-cards", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListGiftCardsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/gift-cards."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.giftCards ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card + * has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call + * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) and create an `ACTIVATE` + * activity with the initial balance. Alternatively, you can use [RefundPayment](api-endpoint:Refunds-RefundPayment) + * to refund a payment to the new gift card. + * + * @param {Square.CreateGiftCardRequest} request + * @param {GiftCards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.create({ + * idempotencyKey: "NC9Tm69EjbjtConu", + * locationId: "81FN9BNFZTKS4", + * giftCard: { + * type: "DIGITAL" + * } + * }) + */ + public async create( + request: Square.CreateGiftCardRequest, + requestOptions?: GiftCards.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/gift-cards", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateGiftCardRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateGiftCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/gift-cards."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a gift card using the gift card account number (GAN). + * + * @param {Square.GetGiftCardFromGanRequest} request + * @param {GiftCards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.getFromGan({ + * gan: "7783320001001635" + * }) + */ + public async getFromGan( + request: Square.GetGiftCardFromGanRequest, + requestOptions?: GiftCards.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/gift-cards/from-gan", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.GetGiftCardFromGanRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetGiftCardFromGanResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/gift-cards/from-gan."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a gift card using a secure payment token that represents the gift card. + * + * @param {Square.GetGiftCardFromNonceRequest} request + * @param {GiftCards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.getFromNonce({ + * nonce: "cnon:7783322135245171" + * }) + */ + public async getFromNonce( + request: Square.GetGiftCardFromNonceRequest, + requestOptions?: GiftCards.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/gift-cards/from-nonce", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.GetGiftCardFromNonceRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetGiftCardFromNonceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/gift-cards/from-nonce."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Links a customer to a gift card, which is also referred to as adding a card on file. + * + * @param {Square.LinkCustomerToGiftCardRequest} request + * @param {GiftCards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.linkCustomer({ + * giftCardId: "gift_card_id", + * customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW" + * }) + */ + public async linkCustomer( + request: Square.LinkCustomerToGiftCardRequest, + requestOptions?: GiftCards.RequestOptions, + ): Promise { + const { giftCardId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/gift-cards/${encodeURIComponent(giftCardId)}/link-customer`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.LinkCustomerToGiftCardRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.LinkCustomerToGiftCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/gift-cards/{gift_card_id}/link-customer.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Unlinks a customer from a gift card, which is also referred to as removing a card on file. + * + * @param {Square.UnlinkCustomerFromGiftCardRequest} request + * @param {GiftCards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.unlinkCustomer({ + * giftCardId: "gift_card_id", + * customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW" + * }) + */ + public async unlinkCustomer( + request: Square.UnlinkCustomerFromGiftCardRequest, + requestOptions?: GiftCards.RequestOptions, + ): Promise { + const { giftCardId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/gift-cards/${encodeURIComponent(giftCardId)}/unlink-customer`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UnlinkCustomerFromGiftCardRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UnlinkCustomerFromGiftCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/gift-cards/{gift_card_id}/unlink-customer.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a gift card using the gift card ID. + * + * @param {Square.GiftCardsGetRequest} request + * @param {GiftCards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.get({ + * id: "id" + * }) + */ + public async get( + request: Square.GiftCardsGetRequest, + requestOptions?: GiftCards.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/gift-cards/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetGiftCardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/gift-cards/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/giftCards/client/index.ts b/src/api/resources/giftCards/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/giftCards/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/giftCards/client/requests/CreateGiftCardRequest.ts b/src/api/resources/giftCards/client/requests/CreateGiftCardRequest.ts new file mode 100644 index 000000000..a31b388cc --- /dev/null +++ b/src/api/resources/giftCards/client/requests/CreateGiftCardRequest.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * idempotencyKey: "NC9Tm69EjbjtConu", + * locationId: "81FN9BNFZTKS4", + * giftCard: { + * type: "DIGITAL" + * } + * } + */ +export interface CreateGiftCardRequest { + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey: string; + /** + * The ID of the [location](entity:Location) where the gift card should be registered for + * reporting purposes. Gift cards can be redeemed at any of the seller's locations. + */ + locationId: string; + /** + * The gift card to create. The `type` field is required for this request. The `gan_source` + * and `gan` fields are included as follows: + * + * To direct Square to generate a 16-digit GAN, omit `gan_source` and `gan`. + * + * To provide a custom GAN, include `gan_source` and `gan`. + * - For `gan_source`, specify `OTHER`. + * - For `gan`, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be + * unique for the seller and cannot start with the same bank identification number (BIN) as major + * credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly + * increase the risk of fraud. It is the responsibility of the developer to ensure the security + * of their custom GANs. For more information, see + * [Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans). + * + * To register an unused, physical gift card that the seller previously ordered from Square, + * include `gan` and provide the GAN that is printed on the gift card. + */ + giftCard: Square.GiftCard; +} diff --git a/src/api/resources/giftCards/client/requests/GetGiftCardFromGanRequest.ts b/src/api/resources/giftCards/client/requests/GetGiftCardFromGanRequest.ts new file mode 100644 index 000000000..2685a3d48 --- /dev/null +++ b/src/api/resources/giftCards/client/requests/GetGiftCardFromGanRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * gan: "7783320001001635" + * } + */ +export interface GetGiftCardFromGanRequest { + /** + * The gift card account number (GAN) of the gift card to retrieve. + * The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported. + * Square-issued gift cards have 16-digit GANs. + */ + gan: string; +} diff --git a/src/api/resources/giftCards/client/requests/GetGiftCardFromNonceRequest.ts b/src/api/resources/giftCards/client/requests/GetGiftCardFromNonceRequest.ts new file mode 100644 index 000000000..ee98164d0 --- /dev/null +++ b/src/api/resources/giftCards/client/requests/GetGiftCardFromNonceRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * nonce: "cnon:7783322135245171" + * } + */ +export interface GetGiftCardFromNonceRequest { + /** + * The payment token of the gift card to retrieve. Payment tokens are generated by the + * Web Payments SDK or In-App Payments SDK. + */ + nonce: string; +} diff --git a/src/api/resources/giftCards/client/requests/GiftCardsGetRequest.ts b/src/api/resources/giftCards/client/requests/GiftCardsGetRequest.ts new file mode 100644 index 000000000..4cf9cebea --- /dev/null +++ b/src/api/resources/giftCards/client/requests/GiftCardsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface GiftCardsGetRequest { + /** + * The ID of the gift card to retrieve. + */ + id: string; +} diff --git a/src/api/resources/giftCards/client/requests/GiftCardsListRequest.ts b/src/api/resources/giftCards/client/requests/GiftCardsListRequest.ts new file mode 100644 index 000000000..5e7a44f7d --- /dev/null +++ b/src/api/resources/giftCards/client/requests/GiftCardsListRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface GiftCardsListRequest { + /** + * If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type. + * Otherwise, the endpoint returns gift cards of all types. + */ + type?: string | null; + /** + * If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state. + * Otherwise, the endpoint returns the gift cards of all states. + */ + state?: string | null; + /** + * If a limit is provided, the endpoint returns only the specified number of results per page. + * The maximum value is 200. The default value is 30. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + limit?: number | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * If a cursor is not provided, the endpoint returns the first page of the results. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string | null; + /** + * If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer. + */ + customerId?: string | null; +} diff --git a/src/api/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts b/src/api/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts new file mode 100644 index 000000000..65406b42f --- /dev/null +++ b/src/api/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * giftCardId: "gift_card_id", + * customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW" + * } + */ +export interface LinkCustomerToGiftCardRequest { + /** + * The ID of the gift card to be linked. + */ + giftCardId: string; + /** The ID of the customer to link to the gift card. */ + customerId: string; +} diff --git a/src/api/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts b/src/api/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts new file mode 100644 index 000000000..b4c49c798 --- /dev/null +++ b/src/api/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * giftCardId: "gift_card_id", + * customerId: "GKY0FZ3V717AH8Q2D821PNT2ZW" + * } + */ +export interface UnlinkCustomerFromGiftCardRequest { + /** + * The ID of the gift card to be unlinked. + */ + giftCardId: string; + /** The ID of the customer to unlink from the gift card. */ + customerId: string; +} diff --git a/src/api/resources/giftCards/client/requests/index.ts b/src/api/resources/giftCards/client/requests/index.ts new file mode 100644 index 000000000..9e8ca215b --- /dev/null +++ b/src/api/resources/giftCards/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type GiftCardsListRequest } from "./GiftCardsListRequest"; +export { type CreateGiftCardRequest } from "./CreateGiftCardRequest"; +export { type GetGiftCardFromGanRequest } from "./GetGiftCardFromGanRequest"; +export { type GetGiftCardFromNonceRequest } from "./GetGiftCardFromNonceRequest"; +export { type LinkCustomerToGiftCardRequest } from "./LinkCustomerToGiftCardRequest"; +export { type UnlinkCustomerFromGiftCardRequest } from "./UnlinkCustomerFromGiftCardRequest"; +export { type GiftCardsGetRequest } from "./GiftCardsGetRequest"; diff --git a/src/api/resources/giftCards/index.ts b/src/api/resources/giftCards/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/giftCards/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/giftCards/resources/activities/client/Client.ts b/src/api/resources/giftCards/resources/activities/client/Client.ts new file mode 100644 index 000000000..d0c4c38d6 --- /dev/null +++ b/src/api/resources/giftCards/resources/activities/client/Client.ts @@ -0,0 +1,244 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Activities { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Activities { + constructor(protected readonly _options: Activities.Options = {}) {} + + /** + * Lists gift card activities. By default, you get gift card activities for all + * gift cards in the seller's account. You can optionally specify query parameters to + * filter the list. For example, you can get a list of gift card activities for a gift card, + * for all gift cards in a specific region, or for activities within a time window. + * + * @param {Square.giftCards.ActivitiesListRequest} request + * @param {Activities.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.activities.list() + */ + public async list( + request: Square.giftCards.ActivitiesListRequest = {}, + requestOptions?: Activities.RequestOptions, + ): Promise> { + const list = async ( + request: Square.giftCards.ActivitiesListRequest, + ): Promise => { + const { giftCardId, type: type_, locationId, beginTime, endTime, limit, cursor, sortOrder } = request; + const _queryParams: Record = {}; + if (giftCardId !== undefined) { + _queryParams["gift_card_id"] = giftCardId; + } + if (type_ !== undefined) { + _queryParams["type"] = type_; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (beginTime !== undefined) { + _queryParams["begin_time"] = beginTime; + } + if (endTime !== undefined) { + _queryParams["end_time"] = endTime; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = sortOrder; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/gift-cards/activities", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListGiftCardActivitiesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/gift-cards/activities."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.giftCardActivities ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a gift card activity to manage the balance or state of a [gift card](entity:GiftCard). + * For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use. + * + * @param {Square.giftCards.CreateGiftCardActivityRequest} request + * @param {Activities.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.giftCards.activities.create({ + * idempotencyKey: "U16kfr-kA70er-q4Rsym-7U7NnY", + * giftCardActivity: { + * type: "ACTIVATE", + * locationId: "81FN9BNFZTKS4", + * giftCardId: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + * activateActivityDetails: { + * orderId: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + * lineItemUid: "eIWl7X0nMuO9Ewbh0ChIx" + * } + * } + * }) + */ + public async create( + request: Square.giftCards.CreateGiftCardActivityRequest, + requestOptions?: Activities.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/gift-cards/activities", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.giftCards.CreateGiftCardActivityRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateGiftCardActivityResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/gift-cards/activities."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/giftCards/resources/activities/client/index.ts b/src/api/resources/giftCards/resources/activities/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/giftCards/resources/activities/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/giftCards/resources/activities/client/requests/ActivitiesListRequest.ts b/src/api/resources/giftCards/resources/activities/client/requests/ActivitiesListRequest.ts new file mode 100644 index 000000000..d8df99059 --- /dev/null +++ b/src/api/resources/giftCards/resources/activities/client/requests/ActivitiesListRequest.ts @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ActivitiesListRequest { + /** + * If a gift card ID is provided, the endpoint returns activities related + * to the specified gift card. Otherwise, the endpoint returns all gift card activities for + * the seller. + */ + giftCardId?: string | null; + /** + * If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type. + * Otherwise, the endpoint returns all types of gift card activities. + */ + type?: string | null; + /** + * If a location ID is provided, the endpoint returns gift card activities for the specified location. + * Otherwise, the endpoint returns gift card activities for all locations. + */ + locationId?: string | null; + /** + * The timestamp for the beginning of the reporting period, in RFC 3339 format. + * This start time is inclusive. The default value is the current time minus one year. + */ + beginTime?: string | null; + /** + * The timestamp for the end of the reporting period, in RFC 3339 format. + * This end time is inclusive. The default value is the current time. + */ + endTime?: string | null; + /** + * If a limit is provided, the endpoint returns the specified number + * of results (or fewer) per page. The maximum value is 100. The default value is 50. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + limit?: number | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * If a cursor is not provided, the endpoint returns the first page of the results. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string | null; + /** + * The order in which the endpoint returns the activities, based on `created_at`. + * - `ASC` - Oldest to newest. + * - `DESC` - Newest to oldest (default). + */ + sortOrder?: string | null; +} diff --git a/src/api/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts b/src/api/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts new file mode 100644 index 000000000..dba2fc080 --- /dev/null +++ b/src/api/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "U16kfr-kA70er-q4Rsym-7U7NnY", + * giftCardActivity: { + * type: "ACTIVATE", + * locationId: "81FN9BNFZTKS4", + * giftCardId: "gftc:6d55a72470d940c6ba09c0ab8ad08d20", + * activateActivityDetails: { + * orderId: "jJNGHm4gLI6XkFbwtiSLqK72KkAZY", + * lineItemUid: "eIWl7X0nMuO9Ewbh0ChIx" + * } + * } + * } + */ +export interface CreateGiftCardActivityRequest { + /** A unique string that identifies the `CreateGiftCardActivity` request. */ + idempotencyKey: string; + /** + * The activity to create for the gift card. This activity must specify `gift_card_id` or `gift_card_gan` for the target + * gift card, the `location_id` where the activity occurred, and the activity `type` along with the corresponding activity details. + */ + giftCardActivity: Square.GiftCardActivity; +} diff --git a/src/api/resources/giftCards/resources/activities/client/requests/index.ts b/src/api/resources/giftCards/resources/activities/client/requests/index.ts new file mode 100644 index 000000000..32ef89d56 --- /dev/null +++ b/src/api/resources/giftCards/resources/activities/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type ActivitiesListRequest } from "./ActivitiesListRequest"; +export { type CreateGiftCardActivityRequest } from "./CreateGiftCardActivityRequest"; diff --git a/src/api/resources/giftCards/resources/activities/index.ts b/src/api/resources/giftCards/resources/activities/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/giftCards/resources/activities/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/giftCards/resources/index.ts b/src/api/resources/giftCards/resources/index.ts new file mode 100644 index 000000000..b1095905e --- /dev/null +++ b/src/api/resources/giftCards/resources/index.ts @@ -0,0 +1,2 @@ +export * as activities from "./activities"; +export * from "./activities/client/requests"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts new file mode 100644 index 000000000..c189a5dd8 --- /dev/null +++ b/src/api/resources/index.ts @@ -0,0 +1,64 @@ +export * as mobile from "./mobile"; +export * as oAuth from "./oAuth"; +export * as v1Transactions from "./v1Transactions"; +export * as applePay from "./applePay"; +export * as bankAccounts from "./bankAccounts"; +export * as bookings from "./bookings"; +export * as cards from "./cards"; +export * as catalog from "./catalog"; +export * as customers from "./customers"; +export * as devices from "./devices"; +export * as disputes from "./disputes"; +export * as employees from "./employees"; +export * as events from "./events"; +export * as giftCards from "./giftCards"; +export * as inventory from "./inventory"; +export * as invoices from "./invoices"; +export * as locations from "./locations"; +export * as loyalty from "./loyalty"; +export * as merchants from "./merchants"; +export * as checkout from "./checkout"; +export * as orders from "./orders"; +export * as payments from "./payments"; +export * as payouts from "./payouts"; +export * as refunds from "./refunds"; +export * as sites from "./sites"; +export * as snippets from "./snippets"; +export * as subscriptions from "./subscriptions"; +export * as teamMembers from "./teamMembers"; +export * as team from "./team"; +export * as terminal from "./terminal"; +export * as vendors from "./vendors"; +export * as cashDrawers from "./cashDrawers"; +export * as labor from "./labor"; +export * as webhooks from "./webhooks"; +export * from "./mobile/client/requests"; +export * from "./oAuth/client/requests"; +export * from "./v1Transactions/client/requests"; +export * from "./applePay/client/requests"; +export * from "./bankAccounts/client/requests"; +export * from "./bookings/client/requests"; +export * from "./cards/client/requests"; +export * from "./catalog/client/requests"; +export * from "./customers/client/requests"; +export * from "./devices/client/requests"; +export * from "./disputes/client/requests"; +export * from "./employees/client/requests"; +export * from "./events/client/requests"; +export * from "./giftCards/client/requests"; +export * from "./inventory/client/requests"; +export * from "./invoices/client/requests"; +export * from "./locations/client/requests"; +export * from "./loyalty/client/requests"; +export * from "./merchants/client/requests"; +export * from "./checkout/client/requests"; +export * from "./orders/client/requests"; +export * from "./payments/client/requests"; +export * from "./payouts/client/requests"; +export * from "./refunds/client/requests"; +export * from "./snippets/client/requests"; +export * from "./subscriptions/client/requests"; +export * from "./teamMembers/client/requests"; +export * from "./team/client/requests"; +export * from "./terminal/client/requests"; +export * from "./vendors/client/requests"; diff --git a/src/api/resources/inventory/client/Client.ts b/src/api/resources/inventory/client/Client.ts new file mode 100644 index 000000000..6c64104e8 --- /dev/null +++ b/src/api/resources/inventory/client/Client.ts @@ -0,0 +1,1175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Inventory { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Inventory { + constructor(protected readonly _options: Inventory.Options = {}) {} + + /** + * Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL + * is updated to conform to the standard convention. + * + * @param {Square.InventoryDeprecatedGetAdjustmentRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.deprecatedGetAdjustment({ + * adjustmentId: "adjustment_id" + * }) + */ + public async deprecatedGetAdjustment( + request: Square.InventoryDeprecatedGetAdjustmentRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const { adjustmentId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/inventory/adjustment/${encodeURIComponent(adjustmentId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetInventoryAdjustmentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/inventory/adjustment/{adjustment_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns the [InventoryAdjustment](entity:InventoryAdjustment) object + * with the provided `adjustment_id`. + * + * @param {Square.InventoryGetAdjustmentRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.getAdjustment({ + * adjustmentId: "adjustment_id" + * }) + */ + public async getAdjustment( + request: Square.InventoryGetAdjustmentRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const { adjustmentId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/inventory/adjustments/${encodeURIComponent(adjustmentId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetInventoryAdjustmentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/inventory/adjustments/{adjustment_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL + * is updated to conform to the standard convention. + * + * @param {Square.BatchChangeInventoryRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.deprecatedBatchChange({ + * 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 + * }) + */ + public async deprecatedBatchChange( + request: Square.BatchChangeInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/inventory/batch-change", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchChangeInventoryRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchChangeInventoryResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/inventory/batch-change."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL + * is updated to conform to the standard convention. + * + * @param {Square.BatchRetrieveInventoryChangesRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.deprecatedBatchGetChanges({ + * catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + * locationIds: ["C6W5YS5QM06F5"], + * types: ["PHYSICAL_COUNT"], + * states: ["IN_STOCK"], + * updatedAfter: "2016-11-01T00:00:00.000Z", + * updatedBefore: "2016-12-01T00:00:00.000Z" + * }) + */ + public async deprecatedBatchGetChanges( + request: Square.BatchRetrieveInventoryChangesRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/inventory/batch-retrieve-changes", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchRetrieveInventoryChangesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchGetInventoryChangesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/inventory/batch-retrieve-changes.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL + * is updated to conform to the standard convention. + * + * @param {Square.BatchGetInventoryCountsRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.deprecatedBatchGetCounts({ + * catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + * locationIds: ["59TNP9SA8VGDA"], + * updatedAfter: "2016-11-16T00:00:00.000Z" + * }) + */ + public async deprecatedBatchGetCounts( + request: Square.BatchGetInventoryCountsRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/inventory/batch-retrieve-counts", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchGetInventoryCountsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchGetInventoryCountsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/inventory/batch-retrieve-counts.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Applies adjustments and counts to the provided item quantities. + * + * On success: returns the current calculated counts for all objects + * referenced in the request. + * On failure: returns a list of related errors. + * + * @param {Square.BatchChangeInventoryRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.batchCreateChanges({ + * 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 + * }) + */ + public async batchCreateChanges( + request: Square.BatchChangeInventoryRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/inventory/changes/batch-create", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchChangeInventoryRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchChangeInventoryResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/inventory/changes/batch-create.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns historical physical counts and adjustments based on the + * provided filter criteria. + * + * Results are paginated and sorted in ascending order according their + * `occurred_at` timestamp (oldest first). + * + * BatchRetrieveInventoryChanges is a catch-all query endpoint for queries + * that cannot be handled by other, simpler endpoints. + * + * @param {Square.BatchRetrieveInventoryChangesRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.batchGetChanges({ + * catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + * locationIds: ["C6W5YS5QM06F5"], + * types: ["PHYSICAL_COUNT"], + * states: ["IN_STOCK"], + * updatedAfter: "2016-11-01T00:00:00.000Z", + * updatedBefore: "2016-12-01T00:00:00.000Z" + * }) + */ + public async batchGetChanges( + request: Square.BatchRetrieveInventoryChangesRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise> { + const list = async ( + request: Square.BatchRetrieveInventoryChangesRequest, + ): Promise => { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/inventory/changes/batch-retrieve", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchRetrieveInventoryChangesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchGetInventoryChangesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/inventory/changes/batch-retrieve.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.changes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Returns current counts for the provided + * [CatalogObject](entity:CatalogObject)s at the requested + * [Location](entity:Location)s. + * + * Results are paginated and sorted in descending order according to their + * `calculated_at` timestamp (newest first). + * + * When `updated_after` is specified, only counts that have changed since that + * time (based on the server timestamp for the most recent change) are + * returned. This allows clients to perform a "sync" operation, for example + * in response to receiving a Webhook notification. + * + * @param {Square.BatchGetInventoryCountsRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.batchGetCounts({ + * catalogObjectIds: ["W62UWFY35CWMYGVWK6TWJDNI"], + * locationIds: ["59TNP9SA8VGDA"], + * updatedAfter: "2016-11-16T00:00:00.000Z" + * }) + */ + public async batchGetCounts( + request: Square.BatchGetInventoryCountsRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise> { + const list = async ( + request: Square.BatchGetInventoryCountsRequest, + ): Promise => { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/inventory/counts/batch-retrieve", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchGetInventoryCountsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchGetInventoryCountsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/inventory/counts/batch-retrieve.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.counts ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL + * is updated to conform to the standard convention. + * + * @param {Square.InventoryDeprecatedGetPhysicalCountRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.deprecatedGetPhysicalCount({ + * physicalCountId: "physical_count_id" + * }) + */ + public async deprecatedGetPhysicalCount( + request: Square.InventoryDeprecatedGetPhysicalCountRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const { physicalCountId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/inventory/physical-count/${encodeURIComponent(physicalCountId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetInventoryPhysicalCountResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/inventory/physical-count/{physical_count_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount) + * object with the provided `physical_count_id`. + * + * @param {Square.InventoryGetPhysicalCountRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.getPhysicalCount({ + * physicalCountId: "physical_count_id" + * }) + */ + public async getPhysicalCount( + request: Square.InventoryGetPhysicalCountRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const { physicalCountId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/inventory/physical-counts/${encodeURIComponent(physicalCountId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetInventoryPhysicalCountResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/inventory/physical-counts/{physical_count_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns the [InventoryTransfer](entity:InventoryTransfer) object + * with the provided `transfer_id`. + * + * @param {Square.InventoryGetTransferRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.getTransfer({ + * transferId: "transfer_id" + * }) + */ + public async getTransfer( + request: Square.InventoryGetTransferRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise { + const { transferId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/inventory/transfers/${encodeURIComponent(transferId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetInventoryTransferResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/inventory/transfers/{transfer_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves the current calculated stock count for a given + * [CatalogObject](entity:CatalogObject) at a given set of + * [Location](entity:Location)s. Responses are paginated and unsorted. + * For more sophisticated queries, use a batch endpoint. + * + * @param {Square.InventoryGetRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.get({ + * catalogObjectId: "catalog_object_id" + * }) + */ + public async get( + request: Square.InventoryGetRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise> { + const list = async (request: Square.InventoryGetRequest): Promise => { + const { catalogObjectId, locationIds, cursor } = request; + const _queryParams: Record = {}; + if (locationIds !== undefined) { + _queryParams["location_ids"] = locationIds; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/inventory/${encodeURIComponent(catalogObjectId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetInventoryCountResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/inventory/{catalog_object_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.counts ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Returns a set of physical counts and inventory adjustments for the + * provided [CatalogObject](entity:CatalogObject) at the requested + * [Location](entity:Location)s. + * + * You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) + * and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID. + * + * Results are paginated and sorted in descending order according to their + * `occurred_at` timestamp (newest first). + * + * There are no limits on how far back the caller can page. This endpoint can be + * used to display recent changes for a specific item. For more + * sophisticated queries, use a batch endpoint. + * + * @param {Square.InventoryChangesRequest} request + * @param {Inventory.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.inventory.changes({ + * catalogObjectId: "catalog_object_id" + * }) + */ + public async changes( + request: Square.InventoryChangesRequest, + requestOptions?: Inventory.RequestOptions, + ): Promise> { + const list = async (request: Square.InventoryChangesRequest): Promise => { + const { catalogObjectId, locationIds, cursor } = request; + const _queryParams: Record = {}; + if (locationIds !== undefined) { + _queryParams["location_ids"] = locationIds; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/inventory/${encodeURIComponent(catalogObjectId)}/changes`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetInventoryChangesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/inventory/{catalog_object_id}/changes.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.changes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/inventory/client/index.ts b/src/api/resources/inventory/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/inventory/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/inventory/client/requests/InventoryChangesRequest.ts b/src/api/resources/inventory/client/requests/InventoryChangesRequest.ts new file mode 100644 index 000000000..227258082 --- /dev/null +++ b/src/api/resources/inventory/client/requests/InventoryChangesRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * catalogObjectId: "catalog_object_id" + * } + */ +export interface InventoryChangesRequest { + /** + * ID of the [CatalogObject](entity:CatalogObject) to retrieve. + */ + catalogObjectId: string; + /** + * The [Location](entity:Location) IDs to look up as a comma-separated + * list. An empty list queries all locations. + */ + locationIds?: string | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for the original query. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string | null; +} diff --git a/src/api/resources/inventory/client/requests/InventoryDeprecatedGetAdjustmentRequest.ts b/src/api/resources/inventory/client/requests/InventoryDeprecatedGetAdjustmentRequest.ts new file mode 100644 index 000000000..900f35ff5 --- /dev/null +++ b/src/api/resources/inventory/client/requests/InventoryDeprecatedGetAdjustmentRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * adjustmentId: "adjustment_id" + * } + */ +export interface InventoryDeprecatedGetAdjustmentRequest { + /** + * ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve. + */ + adjustmentId: string; +} diff --git a/src/api/resources/inventory/client/requests/InventoryDeprecatedGetPhysicalCountRequest.ts b/src/api/resources/inventory/client/requests/InventoryDeprecatedGetPhysicalCountRequest.ts new file mode 100644 index 000000000..9334c8a3b --- /dev/null +++ b/src/api/resources/inventory/client/requests/InventoryDeprecatedGetPhysicalCountRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * physicalCountId: "physical_count_id" + * } + */ +export interface InventoryDeprecatedGetPhysicalCountRequest { + /** + * ID of the + * [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve. + */ + physicalCountId: string; +} diff --git a/src/api/resources/inventory/client/requests/InventoryGetAdjustmentRequest.ts b/src/api/resources/inventory/client/requests/InventoryGetAdjustmentRequest.ts new file mode 100644 index 000000000..5bbbc9f5e --- /dev/null +++ b/src/api/resources/inventory/client/requests/InventoryGetAdjustmentRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * adjustmentId: "adjustment_id" + * } + */ +export interface InventoryGetAdjustmentRequest { + /** + * ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve. + */ + adjustmentId: string; +} diff --git a/src/api/resources/inventory/client/requests/InventoryGetPhysicalCountRequest.ts b/src/api/resources/inventory/client/requests/InventoryGetPhysicalCountRequest.ts new file mode 100644 index 000000000..cdfdd5104 --- /dev/null +++ b/src/api/resources/inventory/client/requests/InventoryGetPhysicalCountRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * physicalCountId: "physical_count_id" + * } + */ +export interface InventoryGetPhysicalCountRequest { + /** + * ID of the + * [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve. + */ + physicalCountId: string; +} diff --git a/src/api/resources/inventory/client/requests/InventoryGetRequest.ts b/src/api/resources/inventory/client/requests/InventoryGetRequest.ts new file mode 100644 index 000000000..b5914e1d0 --- /dev/null +++ b/src/api/resources/inventory/client/requests/InventoryGetRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * catalogObjectId: "catalog_object_id" + * } + */ +export interface InventoryGetRequest { + /** + * ID of the [CatalogObject](entity:CatalogObject) to retrieve. + */ + catalogObjectId: string; + /** + * The [Location](entity:Location) IDs to look up as a comma-separated + * list. An empty list queries all locations. + */ + locationIds?: string | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for the original query. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string | null; +} diff --git a/src/api/resources/inventory/client/requests/InventoryGetTransferRequest.ts b/src/api/resources/inventory/client/requests/InventoryGetTransferRequest.ts new file mode 100644 index 000000000..463d35ebf --- /dev/null +++ b/src/api/resources/inventory/client/requests/InventoryGetTransferRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * transferId: "transfer_id" + * } + */ +export interface InventoryGetTransferRequest { + /** + * ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve. + */ + transferId: string; +} diff --git a/src/api/resources/inventory/client/requests/index.ts b/src/api/resources/inventory/client/requests/index.ts new file mode 100644 index 000000000..953b6d7f4 --- /dev/null +++ b/src/api/resources/inventory/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type InventoryDeprecatedGetAdjustmentRequest } from "./InventoryDeprecatedGetAdjustmentRequest"; +export { type InventoryGetAdjustmentRequest } from "./InventoryGetAdjustmentRequest"; +export { type InventoryDeprecatedGetPhysicalCountRequest } from "./InventoryDeprecatedGetPhysicalCountRequest"; +export { type InventoryGetPhysicalCountRequest } from "./InventoryGetPhysicalCountRequest"; +export { type InventoryGetTransferRequest } from "./InventoryGetTransferRequest"; +export { type InventoryGetRequest } from "./InventoryGetRequest"; +export { type InventoryChangesRequest } from "./InventoryChangesRequest"; diff --git a/src/api/resources/inventory/index.ts b/src/api/resources/inventory/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/inventory/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/invoices/client/Client.ts b/src/api/resources/invoices/client/Client.ts new file mode 100644 index 000000000..75cb37ef8 --- /dev/null +++ b/src/api/resources/invoices/client/Client.ts @@ -0,0 +1,942 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; +import { toJson } from "../../../../core/json"; + +export declare namespace Invoices { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Invoices { + constructor(protected readonly _options: Invoices.Options = {}) {} + + /** + * Returns a list of invoices for a given location. The response + * is paginated. If truncated, the response includes a `cursor` that you + * use in a subsequent request to retrieve the next set of invoices. + * + * @param {Square.InvoicesListRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.list({ + * locationId: "location_id" + * }) + */ + public async list( + request: Square.InvoicesListRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise> { + const list = async (request: Square.InvoicesListRequest): Promise => { + const { locationId, cursor, limit } = request; + const _queryParams: Record = {}; + _queryParams["location_id"] = locationId; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/invoices", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListInvoicesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/invoices."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.invoices ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a draft [invoice](entity:Invoice) + * for an order created using the Orders API. + * + * A draft invoice remains in your account and no action is taken. + * You must publish the invoice before Square can process it (send it to the customer's email address or charge the customer’s card on file). + * + * @param {Square.CreateInvoiceRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.create({ + * 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, + * cashAppPay: 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" + * }) + */ + public async create( + request: Square.CreateInvoiceRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/invoices", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateInvoiceRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateInvoiceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/invoices."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Searches for invoices from a location specified in + * the filter. You can optionally specify customers in the filter for whom to + * retrieve invoices. In the current implementation, you can only specify one location and + * optionally one customer. + * + * The response is paginated. If truncated, the response includes a `cursor` + * that you use in a subsequent request to retrieve the next set of invoices. + * + * @param {Square.SearchInvoicesRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.search({ + * query: { + * filter: { + * locationIds: ["ES0RJRZYEC39A"], + * customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"] + * }, + * sort: { + * field: "INVOICE_SORT_DATE", + * order: "DESC" + * } + * } + * }) + */ + public async search( + request: Square.SearchInvoicesRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/invoices/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchInvoicesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchInvoicesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/invoices/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves an invoice by invoice ID. + * + * @param {Square.InvoicesGetRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.get({ + * invoiceId: "invoice_id" + * }) + */ + public async get( + request: Square.InvoicesGetRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const { invoiceId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/invoices/${encodeURIComponent(invoiceId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetInvoiceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/invoices/{invoice_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates an invoice. This endpoint supports sparse updates, so you only need + * to specify the fields you want to change along with the required `version` field. + * Some restrictions apply to updating invoices. For example, you cannot change the + * `order_id` or `location_id` field. + * + * @param {Square.UpdateInvoiceRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.update({ + * invoiceId: "invoice_id", + * invoice: { + * version: 1, + * paymentRequests: [{ + * uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + * tippingEnabled: false + * }] + * }, + * idempotencyKey: "4ee82288-0910-499e-ab4c-5d0071dad1be" + * }) + */ + public async update( + request: Square.UpdateInvoiceRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const { invoiceId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/invoices/${encodeURIComponent(invoiceId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateInvoiceRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateInvoiceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/invoices/{invoice_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes the specified invoice. When an invoice is deleted, the + * associated order status changes to CANCELED. You can only delete a draft + * invoice (you cannot delete a published invoice, including one that is scheduled for processing). + * + * @param {Square.InvoicesDeleteRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.delete({ + * invoiceId: "invoice_id" + * }) + */ + public async delete( + request: Square.InvoicesDeleteRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const { invoiceId, version } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/invoices/${encodeURIComponent(invoiceId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteInvoiceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling DELETE /v2/invoices/{invoice_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads + * with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file + * in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF. + * + * Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices + * in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + * + * @param {Square.CreateInvoiceAttachmentRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.createInvoiceAttachment({ + * invoiceId: "invoice_id" + * }) + */ + public async createInvoiceAttachment( + request: Square.CreateInvoiceAttachmentRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const _request = await core.newFormData(); + if (request.request != null) { + if (Array.isArray(request.request) || request.request instanceof Set) + for (const _item of request.request) { + _request.append("request", typeof _item === "string" ? _item : toJson(_item)); + } + } + + if (request.imageFile != null) { + await _request.appendFile("image_file", request.imageFile); + } + + const _maybeEncodedRequest = await _request.getRequest(); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/invoices/${encodeURIComponent(request.invoiceId)}/attachments`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ..._maybeEncodedRequest.headers, + ...requestOptions?.headers, + }, + requestType: "file", + duplex: _maybeEncodedRequest.duplex, + body: _maybeEncodedRequest.body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateInvoiceAttachmentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/invoices/{invoice_id}/attachments.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only + * from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + * + * @param {Square.DeleteInvoiceAttachmentRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.deleteInvoiceAttachment({ + * invoiceId: "invoice_id", + * attachmentId: "attachment_id" + * }) + */ + public async deleteInvoiceAttachment( + request: Square.DeleteInvoiceAttachmentRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const { invoiceId, attachmentId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/invoices/${encodeURIComponent(invoiceId)}/attachments/${encodeURIComponent(attachmentId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteInvoiceAttachmentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/invoices/{invoice_id}/attachments/{attachment_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels an invoice. The seller cannot collect payments for + * the canceled invoice. + * + * You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`. + * + * @param {Square.CancelInvoiceRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.cancel({ + * invoiceId: "invoice_id", + * version: 0 + * }) + */ + public async cancel( + request: Square.CancelInvoiceRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const { invoiceId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/invoices/${encodeURIComponent(invoiceId)}/cancel`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CancelInvoiceRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelInvoiceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/invoices/{invoice_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Publishes the specified draft invoice. + * + * After an invoice is published, Square + * follows up based on the invoice configuration. For example, Square + * sends the invoice to the customer's email address, charges the customer's card on file, or does + * nothing. Square also makes the invoice available on a Square-hosted invoice page. + * + * The invoice `status` also changes from `DRAFT` to a status + * based on the invoice configuration. For example, the status changes to `UNPAID` if + * Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the + * invoice amount. + * + * In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ` + * and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments. + * + * @param {Square.PublishInvoiceRequest} request + * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.invoices.publish({ + * invoiceId: "invoice_id", + * version: 1, + * idempotencyKey: "32da42d0-1997-41b0-826b-f09464fc2c2e" + * }) + */ + public async publish( + request: Square.PublishInvoiceRequest, + requestOptions?: Invoices.RequestOptions, + ): Promise { + const { invoiceId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/invoices/${encodeURIComponent(invoiceId)}/publish`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.PublishInvoiceRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.PublishInvoiceResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/invoices/{invoice_id}/publish.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/invoices/client/index.ts b/src/api/resources/invoices/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/invoices/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/invoices/client/requests/CancelInvoiceRequest.ts b/src/api/resources/invoices/client/requests/CancelInvoiceRequest.ts new file mode 100644 index 000000000..57766ffa7 --- /dev/null +++ b/src/api/resources/invoices/client/requests/CancelInvoiceRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * invoiceId: "invoice_id", + * version: 0 + * } + */ +export interface CancelInvoiceRequest { + /** + * The ID of the [invoice](entity:Invoice) to cancel. + */ + invoiceId: string; + /** + * The version of the [invoice](entity:Invoice) to cancel. + * If you do not know the version, you can call + * [GetInvoice](api-endpoint:Invoices-GetInvoice) or [ListInvoices](api-endpoint:Invoices-ListInvoices). + */ + version: number; +} diff --git a/src/api/resources/invoices/client/requests/CreateInvoiceAttachmentRequest.ts b/src/api/resources/invoices/client/requests/CreateInvoiceAttachmentRequest.ts new file mode 100644 index 000000000..0c45a0f5e --- /dev/null +++ b/src/api/resources/invoices/client/requests/CreateInvoiceAttachmentRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as fs from "fs"; + +/** + * @example + * { + * invoiceId: "invoice_id" + * } + */ +export interface CreateInvoiceAttachmentRequest { + /** + * The ID of the [invoice](entity:Invoice) to attach the file to. + */ + invoiceId: string; + request?: unknown; + imageFile?: File | fs.ReadStream | Blob | undefined; +} diff --git a/src/api/resources/invoices/client/requests/CreateInvoiceRequest.ts b/src/api/resources/invoices/client/requests/CreateInvoiceRequest.ts new file mode 100644 index 000000000..32296308a --- /dev/null +++ b/src/api/resources/invoices/client/requests/CreateInvoiceRequest.ts @@ -0,0 +1,64 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * 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, + * cashAppPay: 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" + * } + */ +export interface CreateInvoiceRequest { + /** The invoice to create. */ + invoice: Square.Invoice; + /** + * A unique string that identifies the `CreateInvoice` request. If you do not + * provide `idempotency_key` (or provide an empty string as the value), the endpoint + * treats each request as independent. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string; +} diff --git a/src/api/resources/invoices/client/requests/DeleteInvoiceAttachmentRequest.ts b/src/api/resources/invoices/client/requests/DeleteInvoiceAttachmentRequest.ts new file mode 100644 index 000000000..56926b013 --- /dev/null +++ b/src/api/resources/invoices/client/requests/DeleteInvoiceAttachmentRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * invoiceId: "invoice_id", + * attachmentId: "attachment_id" + * } + */ +export interface DeleteInvoiceAttachmentRequest { + /** + * The ID of the [invoice](entity:Invoice) to delete the attachment from. + */ + invoiceId: string; + /** + * The ID of the [attachment](entity:InvoiceAttachment) to delete. + */ + attachmentId: string; +} diff --git a/src/api/resources/invoices/client/requests/InvoicesDeleteRequest.ts b/src/api/resources/invoices/client/requests/InvoicesDeleteRequest.ts new file mode 100644 index 000000000..c69f37327 --- /dev/null +++ b/src/api/resources/invoices/client/requests/InvoicesDeleteRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * invoiceId: "invoice_id" + * } + */ +export interface InvoicesDeleteRequest { + /** + * The ID of the invoice to delete. + */ + invoiceId: string; + /** + * The version of the [invoice](entity:Invoice) to delete. + * If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or + * [ListInvoices](api-endpoint:Invoices-ListInvoices). + */ + version?: number | null; +} diff --git a/src/api/resources/invoices/client/requests/InvoicesGetRequest.ts b/src/api/resources/invoices/client/requests/InvoicesGetRequest.ts new file mode 100644 index 000000000..48e334616 --- /dev/null +++ b/src/api/resources/invoices/client/requests/InvoicesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * invoiceId: "invoice_id" + * } + */ +export interface InvoicesGetRequest { + /** + * The ID of the invoice to retrieve. + */ + invoiceId: string; +} diff --git a/src/api/resources/invoices/client/requests/InvoicesListRequest.ts b/src/api/resources/invoices/client/requests/InvoicesListRequest.ts new file mode 100644 index 000000000..2a43702e9 --- /dev/null +++ b/src/api/resources/invoices/client/requests/InvoicesListRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id" + * } + */ +export interface InvoicesListRequest { + /** + * The ID of the location for which to list invoices. + */ + locationId: string; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for your original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * The maximum number of invoices to return (200 is the maximum `limit`). + * If not provided, the server uses a default limit of 100 invoices. + */ + limit?: number | null; +} diff --git a/src/api/resources/invoices/client/requests/PublishInvoiceRequest.ts b/src/api/resources/invoices/client/requests/PublishInvoiceRequest.ts new file mode 100644 index 000000000..d6c52757a --- /dev/null +++ b/src/api/resources/invoices/client/requests/PublishInvoiceRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * invoiceId: "invoice_id", + * version: 1, + * idempotencyKey: "32da42d0-1997-41b0-826b-f09464fc2c2e" + * } + */ +export interface PublishInvoiceRequest { + /** + * The ID of the invoice to publish. + */ + invoiceId: string; + /** + * The version of the [invoice](entity:Invoice) to publish. + * This must match the current version of the invoice; otherwise, the request is rejected. + */ + version: number; + /** + * A unique string that identifies the `PublishInvoice` request. If you do not + * provide `idempotency_key` (or provide an empty string as the value), the endpoint + * treats each request as independent. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/invoices/client/requests/SearchInvoicesRequest.ts b/src/api/resources/invoices/client/requests/SearchInvoicesRequest.ts new file mode 100644 index 000000000..60404ba09 --- /dev/null +++ b/src/api/resources/invoices/client/requests/SearchInvoicesRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * locationIds: ["ES0RJRZYEC39A"], + * customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"] + * }, + * sort: { + * field: "INVOICE_SORT_DATE", + * order: "DESC" + * } + * } + * } + */ +export interface SearchInvoicesRequest { + /** Describes the query criteria for searching invoices. */ + query: Square.InvoiceQuery; + /** + * The maximum number of invoices to return (200 is the maximum `limit`). + * If not provided, the server uses a default limit of 100 invoices. + */ + limit?: number; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for your original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/resources/invoices/client/requests/UpdateInvoiceRequest.ts b/src/api/resources/invoices/client/requests/UpdateInvoiceRequest.ts new file mode 100644 index 000000000..a84529af0 --- /dev/null +++ b/src/api/resources/invoices/client/requests/UpdateInvoiceRequest.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * invoiceId: "invoice_id", + * invoice: { + * version: 1, + * paymentRequests: [{ + * uid: "2da7964f-f3d2-4f43-81e8-5aa220bf3355", + * tippingEnabled: false + * }] + * }, + * idempotencyKey: "4ee82288-0910-499e-ab4c-5d0071dad1be" + * } + */ +export interface UpdateInvoiceRequest { + /** + * The ID of the invoice to update. + */ + invoiceId: string; + /** + * The invoice fields to add, change, or clear. Fields can be cleared using + * null values or the `remove` field (for individual payment requests or reminders). + * The current invoice `version` is also required. For more information, including requirements, + * limitations, and more examples, see [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices). + */ + invoice: Square.Invoice; + /** + * A unique string that identifies the `UpdateInvoice` request. If you do not + * provide `idempotency_key` (or provide an empty string as the value), the endpoint + * treats each request as independent. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; + /** + * The list of fields to clear. Although this field is currently supported, we + * recommend using null values or the `remove` field when possible. For examples, see + * [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices). + */ + fieldsToClear?: string[] | null; +} diff --git a/src/api/resources/invoices/client/requests/index.ts b/src/api/resources/invoices/client/requests/index.ts new file mode 100644 index 000000000..48ce322ea --- /dev/null +++ b/src/api/resources/invoices/client/requests/index.ts @@ -0,0 +1,10 @@ +export { type InvoicesListRequest } from "./InvoicesListRequest"; +export { type CreateInvoiceRequest } from "./CreateInvoiceRequest"; +export { type SearchInvoicesRequest } from "./SearchInvoicesRequest"; +export { type InvoicesGetRequest } from "./InvoicesGetRequest"; +export { type UpdateInvoiceRequest } from "./UpdateInvoiceRequest"; +export { type InvoicesDeleteRequest } from "./InvoicesDeleteRequest"; +export { type CreateInvoiceAttachmentRequest } from "./CreateInvoiceAttachmentRequest"; +export { type DeleteInvoiceAttachmentRequest } from "./DeleteInvoiceAttachmentRequest"; +export { type CancelInvoiceRequest } from "./CancelInvoiceRequest"; +export { type PublishInvoiceRequest } from "./PublishInvoiceRequest"; diff --git a/src/api/resources/invoices/index.ts b/src/api/resources/invoices/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/invoices/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/labor/client/Client.ts b/src/api/resources/labor/client/Client.ts new file mode 100644 index 000000000..aa7902632 --- /dev/null +++ b/src/api/resources/labor/client/Client.ts @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import { BreakTypes } from "../resources/breakTypes/client/Client"; +import { EmployeeWages } from "../resources/employeeWages/client/Client"; +import { Shifts } from "../resources/shifts/client/Client"; +import { TeamMemberWages } from "../resources/teamMemberWages/client/Client"; +import { WorkweekConfigs } from "../resources/workweekConfigs/client/Client"; + +export declare namespace Labor { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Labor { + protected _breakTypes: BreakTypes | undefined; + protected _employeeWages: EmployeeWages | undefined; + protected _shifts: Shifts | undefined; + protected _teamMemberWages: TeamMemberWages | undefined; + protected _workweekConfigs: WorkweekConfigs | undefined; + + constructor(protected readonly _options: Labor.Options = {}) {} + + public get breakTypes(): BreakTypes { + return (this._breakTypes ??= new BreakTypes(this._options)); + } + + public get employeeWages(): EmployeeWages { + return (this._employeeWages ??= new EmployeeWages(this._options)); + } + + public get shifts(): Shifts { + return (this._shifts ??= new Shifts(this._options)); + } + + public get teamMemberWages(): TeamMemberWages { + return (this._teamMemberWages ??= new TeamMemberWages(this._options)); + } + + public get workweekConfigs(): WorkweekConfigs { + return (this._workweekConfigs ??= new WorkweekConfigs(this._options)); + } +} diff --git a/src/api/resources/labor/client/index.ts b/src/api/resources/labor/client/index.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/src/api/resources/labor/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/labor/index.ts b/src/api/resources/labor/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/labor/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/labor/resources/breakTypes/client/Client.ts b/src/api/resources/labor/resources/breakTypes/client/Client.ts new file mode 100644 index 000000000..c22c48db2 --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/client/Client.ts @@ -0,0 +1,465 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace BreakTypes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class BreakTypes { + constructor(protected readonly _options: BreakTypes.Options = {}) {} + + /** + * Returns a paginated list of `BreakType` instances for a business. + * + * @param {Square.labor.BreakTypesListRequest} request + * @param {BreakTypes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.breakTypes.list() + */ + public async list( + request: Square.labor.BreakTypesListRequest = {}, + requestOptions?: BreakTypes.RequestOptions, + ): Promise> { + const list = async (request: Square.labor.BreakTypesListRequest): Promise => { + const { locationId, limit, cursor } = request; + const _queryParams: Record = {}; + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/break-types", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListBreakTypesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/labor/break-types."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.breakTypes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a new `BreakType`. + * + * A `BreakType` is a template for creating `Break` objects. + * You must provide the following values in your request to this + * endpoint: + * + * - `location_id` + * - `break_name` + * - `expected_duration` + * - `is_paid` + * + * You can only have three `BreakType` instances per location. If you attempt to add a fourth + * `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location." + * is returned. + * + * @param {Square.labor.CreateBreakTypeRequest} request + * @param {BreakTypes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.breakTypes.create({ + * idempotencyKey: "PAD3NG5KSN2GL", + * breakType: { + * locationId: "CGJN03P1D08GF", + * breakName: "Lunch Break", + * expectedDuration: "PT30M", + * isPaid: true + * } + * }) + */ + public async create( + request: Square.labor.CreateBreakTypeRequest, + requestOptions?: BreakTypes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/break-types", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.labor.CreateBreakTypeRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateBreakTypeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/labor/break-types."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns a single `BreakType` specified by `id`. + * + * @param {Square.labor.BreakTypesGetRequest} request + * @param {BreakTypes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.breakTypes.get({ + * id: "id" + * }) + */ + public async get( + request: Square.labor.BreakTypesGetRequest, + requestOptions?: BreakTypes.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/break-types/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetBreakTypeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/labor/break-types/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates an existing `BreakType`. + * + * @param {Square.labor.UpdateBreakTypeRequest} request + * @param {BreakTypes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.breakTypes.update({ + * id: "id", + * breakType: { + * locationId: "26M7H24AZ9N6R", + * breakName: "Lunch", + * expectedDuration: "PT50M", + * isPaid: true, + * version: 1 + * } + * }) + */ + public async update( + request: Square.labor.UpdateBreakTypeRequest, + requestOptions?: BreakTypes.RequestOptions, + ): Promise { + const { id, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/break-types/${encodeURIComponent(id)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.labor.UpdateBreakTypeRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateBreakTypeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/labor/break-types/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes an existing `BreakType`. + * + * A `BreakType` can be deleted even if it is referenced from a `Shift`. + * + * @param {Square.labor.BreakTypesDeleteRequest} request + * @param {BreakTypes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.breakTypes.delete({ + * id: "id" + * }) + */ + public async delete( + request: Square.labor.BreakTypesDeleteRequest, + requestOptions?: BreakTypes.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/break-types/${encodeURIComponent(id)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteBreakTypeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling DELETE /v2/labor/break-types/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/labor/resources/breakTypes/client/index.ts b/src/api/resources/labor/resources/breakTypes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesDeleteRequest.ts b/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesDeleteRequest.ts new file mode 100644 index 000000000..d2f8ad72c --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface BreakTypesDeleteRequest { + /** + * The UUID for the `BreakType` being deleted. + */ + id: string; +} diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesGetRequest.ts b/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesGetRequest.ts new file mode 100644 index 000000000..0099e7731 --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface BreakTypesGetRequest { + /** + * The UUID for the `BreakType` being retrieved. + */ + id: string; +} diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesListRequest.ts b/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesListRequest.ts new file mode 100644 index 000000000..b6f89a58e --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/client/requests/BreakTypesListRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface BreakTypesListRequest { + /** + * Filter the returned `BreakType` results to only those that are associated with the + * specified location. + */ + locationId?: string | null; + /** + * The maximum number of `BreakType` results to return per page. The number can range between 1 + * and 200. The default is 200. + */ + limit?: number | null; + /** + * A pointer to the next page of `BreakType` results to fetch. + */ + cursor?: string | null; +} diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts b/src/api/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts new file mode 100644 index 000000000..f79298188 --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "PAD3NG5KSN2GL", + * breakType: { + * locationId: "CGJN03P1D08GF", + * breakName: "Lunch Break", + * expectedDuration: "PT30M", + * isPaid: true + * } + * } + */ +export interface CreateBreakTypeRequest { + /** A unique string value to ensure the idempotency of the operation. */ + idempotencyKey?: string; + /** The `BreakType` to be created. */ + breakType: Square.BreakType; +} diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts b/src/api/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts new file mode 100644 index 000000000..57ed0b0f5 --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * id: "id", + * breakType: { + * locationId: "26M7H24AZ9N6R", + * breakName: "Lunch", + * expectedDuration: "PT50M", + * isPaid: true, + * version: 1 + * } + * } + */ +export interface UpdateBreakTypeRequest { + /** + * The UUID for the `BreakType` being updated. + */ + id: string; + /** The updated `BreakType`. */ + breakType: Square.BreakType; +} diff --git a/src/api/resources/labor/resources/breakTypes/client/requests/index.ts b/src/api/resources/labor/resources/breakTypes/client/requests/index.ts new file mode 100644 index 000000000..494b7cccf --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type BreakTypesListRequest } from "./BreakTypesListRequest"; +export { type CreateBreakTypeRequest } from "./CreateBreakTypeRequest"; +export { type BreakTypesGetRequest } from "./BreakTypesGetRequest"; +export { type UpdateBreakTypeRequest } from "./UpdateBreakTypeRequest"; +export { type BreakTypesDeleteRequest } from "./BreakTypesDeleteRequest"; diff --git a/src/api/resources/labor/resources/breakTypes/index.ts b/src/api/resources/labor/resources/breakTypes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/labor/resources/breakTypes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/labor/resources/employeeWages/client/Client.ts b/src/api/resources/labor/resources/employeeWages/client/Client.ts new file mode 100644 index 000000000..30fe89bf4 --- /dev/null +++ b/src/api/resources/labor/resources/employeeWages/client/Client.ts @@ -0,0 +1,213 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace EmployeeWages { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class EmployeeWages { + constructor(protected readonly _options: EmployeeWages.Options = {}) {} + + /** + * Returns a paginated list of `EmployeeWage` instances for a business. + * + * @param {Square.labor.EmployeeWagesListRequest} request + * @param {EmployeeWages.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.employeeWages.list() + */ + public async list( + request: Square.labor.EmployeeWagesListRequest = {}, + requestOptions?: EmployeeWages.RequestOptions, + ): Promise> { + const list = async ( + request: Square.labor.EmployeeWagesListRequest, + ): Promise => { + const { employeeId, limit, cursor } = request; + const _queryParams: Record = {}; + if (employeeId !== undefined) { + _queryParams["employee_id"] = employeeId; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/employee-wages", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListEmployeeWagesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/labor/employee-wages."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.employeeWages ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Returns a single `EmployeeWage` specified by `id`. + * + * @param {Square.labor.EmployeeWagesGetRequest} request + * @param {EmployeeWages.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.employeeWages.get({ + * id: "id" + * }) + */ + public async get( + request: Square.labor.EmployeeWagesGetRequest, + requestOptions?: EmployeeWages.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/employee-wages/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetEmployeeWageResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/labor/employee-wages/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/labor/resources/employeeWages/client/index.ts b/src/api/resources/labor/resources/employeeWages/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/labor/resources/employeeWages/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/labor/resources/employeeWages/client/requests/EmployeeWagesGetRequest.ts b/src/api/resources/labor/resources/employeeWages/client/requests/EmployeeWagesGetRequest.ts new file mode 100644 index 000000000..61b3cbe5e --- /dev/null +++ b/src/api/resources/labor/resources/employeeWages/client/requests/EmployeeWagesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface EmployeeWagesGetRequest { + /** + * The UUID for the `EmployeeWage` being retrieved. + */ + id: string; +} diff --git a/src/api/resources/labor/resources/employeeWages/client/requests/EmployeeWagesListRequest.ts b/src/api/resources/labor/resources/employeeWages/client/requests/EmployeeWagesListRequest.ts new file mode 100644 index 000000000..540ebd20e --- /dev/null +++ b/src/api/resources/labor/resources/employeeWages/client/requests/EmployeeWagesListRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface EmployeeWagesListRequest { + /** + * Filter the returned wages to only those that are associated with the specified employee. + */ + employeeId?: string | null; + /** + * The maximum number of `EmployeeWage` results to return per page. The number can range between + * 1 and 200. The default is 200. + */ + limit?: number | null; + /** + * A pointer to the next page of `EmployeeWage` results to fetch. + */ + cursor?: string | null; +} diff --git a/src/api/resources/labor/resources/employeeWages/client/requests/index.ts b/src/api/resources/labor/resources/employeeWages/client/requests/index.ts new file mode 100644 index 000000000..ec6a50af7 --- /dev/null +++ b/src/api/resources/labor/resources/employeeWages/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type EmployeeWagesListRequest } from "./EmployeeWagesListRequest"; +export { type EmployeeWagesGetRequest } from "./EmployeeWagesGetRequest"; diff --git a/src/api/resources/labor/resources/employeeWages/index.ts b/src/api/resources/labor/resources/employeeWages/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/labor/resources/employeeWages/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/labor/resources/index.ts b/src/api/resources/labor/resources/index.ts new file mode 100644 index 000000000..e0b60d0eb --- /dev/null +++ b/src/api/resources/labor/resources/index.ts @@ -0,0 +1,10 @@ +export * as breakTypes from "./breakTypes"; +export * as employeeWages from "./employeeWages"; +export * as shifts from "./shifts"; +export * as teamMemberWages from "./teamMemberWages"; +export * as workweekConfigs from "./workweekConfigs"; +export * from "./breakTypes/client/requests"; +export * from "./employeeWages/client/requests"; +export * from "./shifts/client/requests"; +export * from "./teamMemberWages/client/requests"; +export * from "./workweekConfigs/client/requests"; diff --git a/src/api/resources/labor/resources/shifts/client/Client.ts b/src/api/resources/labor/resources/shifts/client/Client.ts new file mode 100644 index 000000000..6437f2c42 --- /dev/null +++ b/src/api/resources/labor/resources/shifts/client/Client.ts @@ -0,0 +1,525 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Shifts { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Shifts { + constructor(protected readonly _options: Shifts.Options = {}) {} + + /** + * Creates a new `Shift`. + * + * A `Shift` represents a complete workday for a single team member. + * You must provide the following values in your request to this + * endpoint: + * + * - `location_id` + * - `team_member_id` + * - `start_at` + * + * An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when: + * - The `status` of the new `Shift` is `OPEN` and the team member has another + * shift with an `OPEN` status. + * - The `start_at` date is in the future. + * - The `start_at` or `end_at` date overlaps another shift for the same team member. + * - The `Break` instances are set in the request and a break `start_at` + * is before the `Shift.start_at`, a break `end_at` is after + * the `Shift.end_at`, or both. + * + * @param {Square.labor.CreateShiftRequest} request + * @param {Shifts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.shifts.create({ + * idempotencyKey: "HIDSNG5KS478L", + * shift: { + * locationId: "PAA1RJZZKXBFG", + * startAt: "2019-01-25T03:11:00-05:00", + * endAt: "2019-01-25T13:11:00-05:00", + * wage: { + * title: "Barista", + * hourlyRate: { + * amount: 1100, + * currency: "USD" + * }, + * tipEligible: true + * }, + * breaks: [{ + * startAt: "2019-01-25T06:11:00-05:00", + * endAt: "2019-01-25T06:16:00-05:00", + * breakTypeId: "REGS1EQR1TPZ5", + * name: "Tea Break", + * expectedDuration: "PT5M", + * isPaid: true + * }], + * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", + * declaredCashTipMoney: { + * amount: 500, + * currency: "USD" + * } + * } + * }) + */ + public async create( + request: Square.labor.CreateShiftRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/shifts", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.labor.CreateShiftRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateShiftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/labor/shifts."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns a paginated list of `Shift` records for a business. + * The list to be returned can be filtered by: + * - Location IDs + * - Team member IDs + * - Shift status (`OPEN` or `CLOSED`) + * - Shift start + * - Shift end + * - Workday details + * + * The list can be sorted by: + * - `START_AT` + * - `END_AT` + * - `CREATED_AT` + * - `UPDATED_AT` + * + * @param {Square.labor.SearchShiftsRequest} request + * @param {Shifts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.shifts.search({ + * query: { + * filter: { + * workday: { + * dateRange: { + * startDate: "2019-01-20", + * endDate: "2019-02-03" + * }, + * matchShiftsBy: "START_AT", + * defaultTimezone: "America/Los_Angeles" + * } + * } + * }, + * limit: 100 + * }) + */ + public async search( + request: Square.labor.SearchShiftsRequest = {}, + requestOptions?: Shifts.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/shifts/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.labor.SearchShiftsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchShiftsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/labor/shifts/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns a single `Shift` specified by `id`. + * + * @param {Square.labor.ShiftsGetRequest} request + * @param {Shifts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.shifts.get({ + * id: "id" + * }) + */ + public async get( + request: Square.labor.ShiftsGetRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/shifts/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetShiftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/labor/shifts/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates an existing `Shift`. + * + * When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have + * the `end_at` property set to a valid RFC-3339 datetime string. + * + * When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at` + * set on each `Break`. + * + * @param {Square.labor.UpdateShiftRequest} request + * @param {Shifts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.shifts.update({ + * id: "id", + * shift: { + * locationId: "PAA1RJZZKXBFG", + * startAt: "2019-01-25T03:11:00-05:00", + * endAt: "2019-01-25T13:11:00-05:00", + * wage: { + * title: "Bartender", + * hourlyRate: { + * amount: 1500, + * currency: "USD" + * }, + * tipEligible: true + * }, + * breaks: [{ + * id: "X7GAQYVVRRG6P", + * startAt: "2019-01-25T06:11:00-05:00", + * endAt: "2019-01-25T06:16:00-05:00", + * breakTypeId: "REGS1EQR1TPZ5", + * name: "Tea Break", + * expectedDuration: "PT5M", + * isPaid: true + * }], + * version: 1, + * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", + * declaredCashTipMoney: { + * amount: 500, + * currency: "USD" + * } + * } + * }) + */ + public async update( + request: Square.labor.UpdateShiftRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise { + const { id, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/shifts/${encodeURIComponent(id)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.labor.UpdateShiftRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateShiftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/labor/shifts/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a `Shift`. + * + * @param {Square.labor.ShiftsDeleteRequest} request + * @param {Shifts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.shifts.delete({ + * id: "id" + * }) + */ + public async delete( + request: Square.labor.ShiftsDeleteRequest, + requestOptions?: Shifts.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/shifts/${encodeURIComponent(id)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteShiftResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling DELETE /v2/labor/shifts/{id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/labor/resources/shifts/client/index.ts b/src/api/resources/labor/resources/shifts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/labor/resources/shifts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts b/src/api/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts new file mode 100644 index 000000000..c887a2938 --- /dev/null +++ b/src/api/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "HIDSNG5KS478L", + * shift: { + * locationId: "PAA1RJZZKXBFG", + * startAt: "2019-01-25T03:11:00-05:00", + * endAt: "2019-01-25T13:11:00-05:00", + * wage: { + * title: "Barista", + * hourlyRate: { + * amount: 1100, + * currency: "USD" + * }, + * tipEligible: true + * }, + * breaks: [{ + * startAt: "2019-01-25T06:11:00-05:00", + * endAt: "2019-01-25T06:16:00-05:00", + * breakTypeId: "REGS1EQR1TPZ5", + * name: "Tea Break", + * expectedDuration: "PT5M", + * isPaid: true + * }], + * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", + * declaredCashTipMoney: { + * amount: 500, + * currency: "USD" + * } + * } + * } + */ +export interface CreateShiftRequest { + /** A unique string value to ensure the idempotency of the operation. */ + idempotencyKey?: string; + /** The `Shift` to be created. */ + shift: Square.Shift; +} diff --git a/src/api/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts b/src/api/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts new file mode 100644 index 000000000..17caa5167 --- /dev/null +++ b/src/api/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * workday: { + * dateRange: { + * startDate: "2019-01-20", + * endDate: "2019-02-03" + * }, + * matchShiftsBy: "START_AT", + * defaultTimezone: "America/Los_Angeles" + * } + * } + * }, + * limit: 100 + * } + */ +export interface SearchShiftsRequest { + /** Query filters. */ + query?: Square.ShiftQuery; + /** The number of resources in a page (200 by default). */ + limit?: number; + /** An opaque cursor for fetching the next page. */ + cursor?: string; +} diff --git a/src/api/resources/labor/resources/shifts/client/requests/ShiftsDeleteRequest.ts b/src/api/resources/labor/resources/shifts/client/requests/ShiftsDeleteRequest.ts new file mode 100644 index 000000000..ee98ee53e --- /dev/null +++ b/src/api/resources/labor/resources/shifts/client/requests/ShiftsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface ShiftsDeleteRequest { + /** + * The UUID for the `Shift` being deleted. + */ + id: string; +} diff --git a/src/api/resources/labor/resources/shifts/client/requests/ShiftsGetRequest.ts b/src/api/resources/labor/resources/shifts/client/requests/ShiftsGetRequest.ts new file mode 100644 index 000000000..f81d8a17b --- /dev/null +++ b/src/api/resources/labor/resources/shifts/client/requests/ShiftsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface ShiftsGetRequest { + /** + * The UUID for the `Shift` being retrieved. + */ + id: string; +} diff --git a/src/api/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts b/src/api/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts new file mode 100644 index 000000000..cb078e7b0 --- /dev/null +++ b/src/api/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * id: "id", + * shift: { + * locationId: "PAA1RJZZKXBFG", + * startAt: "2019-01-25T03:11:00-05:00", + * endAt: "2019-01-25T13:11:00-05:00", + * wage: { + * title: "Bartender", + * hourlyRate: { + * amount: 1500, + * currency: "USD" + * }, + * tipEligible: true + * }, + * breaks: [{ + * id: "X7GAQYVVRRG6P", + * startAt: "2019-01-25T06:11:00-05:00", + * endAt: "2019-01-25T06:16:00-05:00", + * breakTypeId: "REGS1EQR1TPZ5", + * name: "Tea Break", + * expectedDuration: "PT5M", + * isPaid: true + * }], + * version: 1, + * teamMemberId: "ormj0jJJZ5OZIzxrZYJI", + * declaredCashTipMoney: { + * amount: 500, + * currency: "USD" + * } + * } + * } + */ +export interface UpdateShiftRequest { + /** + * The ID of the object being updated. + */ + id: string; + /** The updated `Shift` object. */ + shift: Square.Shift; +} diff --git a/src/api/resources/labor/resources/shifts/client/requests/index.ts b/src/api/resources/labor/resources/shifts/client/requests/index.ts new file mode 100644 index 000000000..a55928072 --- /dev/null +++ b/src/api/resources/labor/resources/shifts/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type CreateShiftRequest } from "./CreateShiftRequest"; +export { type SearchShiftsRequest } from "./SearchShiftsRequest"; +export { type ShiftsGetRequest } from "./ShiftsGetRequest"; +export { type UpdateShiftRequest } from "./UpdateShiftRequest"; +export { type ShiftsDeleteRequest } from "./ShiftsDeleteRequest"; diff --git a/src/api/resources/labor/resources/shifts/index.ts b/src/api/resources/labor/resources/shifts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/labor/resources/shifts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/labor/resources/teamMemberWages/client/Client.ts b/src/api/resources/labor/resources/teamMemberWages/client/Client.ts new file mode 100644 index 000000000..c02712da6 --- /dev/null +++ b/src/api/resources/labor/resources/teamMemberWages/client/Client.ts @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace TeamMemberWages { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class TeamMemberWages { + constructor(protected readonly _options: TeamMemberWages.Options = {}) {} + + /** + * Returns a paginated list of `TeamMemberWage` instances for a business. + * + * @param {Square.labor.TeamMemberWagesListRequest} request + * @param {TeamMemberWages.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.teamMemberWages.list() + */ + public async list( + request: Square.labor.TeamMemberWagesListRequest = {}, + requestOptions?: TeamMemberWages.RequestOptions, + ): Promise> { + const list = async ( + request: Square.labor.TeamMemberWagesListRequest, + ): Promise => { + const { teamMemberId, limit, cursor } = request; + const _queryParams: Record = {}; + if (teamMemberId !== undefined) { + _queryParams["team_member_id"] = teamMemberId; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/team-member-wages", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListTeamMemberWagesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/labor/team-member-wages.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.teamMemberWages ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Returns a single `TeamMemberWage` specified by `id`. + * + * @param {Square.labor.TeamMemberWagesGetRequest} request + * @param {TeamMemberWages.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.teamMemberWages.get({ + * id: "id" + * }) + */ + public async get( + request: Square.labor.TeamMemberWagesGetRequest, + requestOptions?: TeamMemberWages.RequestOptions, + ): Promise { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/team-member-wages/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTeamMemberWageResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/labor/team-member-wages/{id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/labor/resources/teamMemberWages/client/index.ts b/src/api/resources/labor/resources/teamMemberWages/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/labor/resources/teamMemberWages/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/labor/resources/teamMemberWages/client/requests/TeamMemberWagesGetRequest.ts b/src/api/resources/labor/resources/teamMemberWages/client/requests/TeamMemberWagesGetRequest.ts new file mode 100644 index 000000000..ca36db8fd --- /dev/null +++ b/src/api/resources/labor/resources/teamMemberWages/client/requests/TeamMemberWagesGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface TeamMemberWagesGetRequest { + /** + * The UUID for the `TeamMemberWage` being retrieved. + */ + id: string; +} diff --git a/src/api/resources/labor/resources/teamMemberWages/client/requests/TeamMemberWagesListRequest.ts b/src/api/resources/labor/resources/teamMemberWages/client/requests/TeamMemberWagesListRequest.ts new file mode 100644 index 000000000..28adc36d6 --- /dev/null +++ b/src/api/resources/labor/resources/teamMemberWages/client/requests/TeamMemberWagesListRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface TeamMemberWagesListRequest { + /** + * Filter the returned wages to only those that are associated with the + * specified team member. + */ + teamMemberId?: string | null; + /** + * The maximum number of `TeamMemberWage` results to return per page. The number can range between + * 1 and 200. The default is 200. + */ + limit?: number | null; + /** + * A pointer to the next page of `EmployeeWage` results to fetch. + */ + cursor?: string | null; +} diff --git a/src/api/resources/labor/resources/teamMemberWages/client/requests/index.ts b/src/api/resources/labor/resources/teamMemberWages/client/requests/index.ts new file mode 100644 index 000000000..110fe587e --- /dev/null +++ b/src/api/resources/labor/resources/teamMemberWages/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type TeamMemberWagesListRequest } from "./TeamMemberWagesListRequest"; +export { type TeamMemberWagesGetRequest } from "./TeamMemberWagesGetRequest"; diff --git a/src/api/resources/labor/resources/teamMemberWages/index.ts b/src/api/resources/labor/resources/teamMemberWages/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/labor/resources/teamMemberWages/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/labor/resources/workweekConfigs/client/Client.ts b/src/api/resources/labor/resources/workweekConfigs/client/Client.ts new file mode 100644 index 000000000..a8f35748e --- /dev/null +++ b/src/api/resources/labor/resources/workweekConfigs/client/Client.ts @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace WorkweekConfigs { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class WorkweekConfigs { + constructor(protected readonly _options: WorkweekConfigs.Options = {}) {} + + /** + * Returns a list of `WorkweekConfig` instances for a business. + * + * @param {Square.labor.WorkweekConfigsListRequest} request + * @param {WorkweekConfigs.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.workweekConfigs.list() + */ + public async list( + request: Square.labor.WorkweekConfigsListRequest = {}, + requestOptions?: WorkweekConfigs.RequestOptions, + ): Promise> { + const list = async ( + request: Square.labor.WorkweekConfigsListRequest, + ): Promise => { + const { limit, cursor } = request; + const _queryParams: Record = {}; + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/labor/workweek-configs", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListWorkweekConfigsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/labor/workweek-configs.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.workweekConfigs ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Updates a `WorkweekConfig`. + * + * @param {Square.labor.UpdateWorkweekConfigRequest} request + * @param {WorkweekConfigs.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.labor.workweekConfigs.get({ + * id: "id", + * workweekConfig: { + * startOfWeek: "MON", + * startOfDayLocalTime: "10:00", + * version: 10 + * } + * }) + */ + public async get( + request: Square.labor.UpdateWorkweekConfigRequest, + requestOptions?: WorkweekConfigs.RequestOptions, + ): Promise { + const { id, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/labor/workweek-configs/${encodeURIComponent(id)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.labor.UpdateWorkweekConfigRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateWorkweekConfigResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/labor/workweek-configs/{id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/labor/resources/workweekConfigs/client/index.ts b/src/api/resources/labor/resources/workweekConfigs/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/labor/resources/workweekConfigs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts b/src/api/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts new file mode 100644 index 000000000..b9a85bb7c --- /dev/null +++ b/src/api/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * id: "id", + * workweekConfig: { + * startOfWeek: "MON", + * startOfDayLocalTime: "10:00", + * version: 10 + * } + * } + */ +export interface UpdateWorkweekConfigRequest { + /** + * The UUID for the `WorkweekConfig` object being updated. + */ + id: string; + /** The updated `WorkweekConfig` object. */ + workweekConfig: Square.WorkweekConfig; +} diff --git a/src/api/resources/labor/resources/workweekConfigs/client/requests/WorkweekConfigsListRequest.ts b/src/api/resources/labor/resources/workweekConfigs/client/requests/WorkweekConfigsListRequest.ts new file mode 100644 index 000000000..1be6c5828 --- /dev/null +++ b/src/api/resources/labor/resources/workweekConfigs/client/requests/WorkweekConfigsListRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface WorkweekConfigsListRequest { + /** + * The maximum number of `WorkweekConfigs` results to return per page. + */ + limit?: number | null; + /** + * A pointer to the next page of `WorkweekConfig` results to fetch. + */ + cursor?: string | null; +} diff --git a/src/api/resources/labor/resources/workweekConfigs/client/requests/index.ts b/src/api/resources/labor/resources/workweekConfigs/client/requests/index.ts new file mode 100644 index 000000000..0e7c19353 --- /dev/null +++ b/src/api/resources/labor/resources/workweekConfigs/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type WorkweekConfigsListRequest } from "./WorkweekConfigsListRequest"; +export { type UpdateWorkweekConfigRequest } from "./UpdateWorkweekConfigRequest"; diff --git a/src/api/resources/labor/resources/workweekConfigs/index.ts b/src/api/resources/labor/resources/workweekConfigs/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/labor/resources/workweekConfigs/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/locations/client/Client.ts b/src/api/resources/locations/client/Client.ts new file mode 100644 index 000000000..215c43fd6 --- /dev/null +++ b/src/api/resources/locations/client/Client.ts @@ -0,0 +1,553 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client"; +import { CustomAttributes } from "../resources/customAttributes/client/Client"; +import { Transactions } from "../resources/transactions/client/Client"; + +export declare namespace Locations { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Locations { + protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; + protected _customAttributes: CustomAttributes | undefined; + protected _transactions: Transactions | undefined; + + constructor(protected readonly _options: Locations.Options = {}) {} + + public get customAttributeDefinitions(): CustomAttributeDefinitions { + return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); + } + + public get customAttributes(): CustomAttributes { + return (this._customAttributes ??= new CustomAttributes(this._options)); + } + + public get transactions(): Transactions { + return (this._transactions ??= new Transactions(this._options)); + } + + /** + * Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api), + * including those with an inactive status. Locations are listed alphabetically by `name`. + * + * @param {Locations.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.list() + */ + public async list(requestOptions?: Locations.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/locations", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListLocationsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/locations."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates a [location](https://developer.squareup.com/docs/locations-api). + * Creating new locations allows for separate configuration of receipt layouts, item prices, + * and sales reports. Developers can use locations to separate sales activity through applications + * that integrate with Square from sales activity elsewhere in a seller's account. + * Locations created programmatically with the Locations API last forever and + * are visible to the seller for their own management. Therefore, ensure that + * each location has a sensible and unique name. + * + * @param {Square.CreateLocationRequest} request + * @param {Locations.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.create({ + * location: { + * name: "Midtown", + * address: { + * addressLine1: "1234 Peachtree St. NE", + * locality: "Atlanta", + * administrativeDistrictLevel1: "GA", + * postalCode: "30309" + * }, + * description: "Midtown Atlanta store" + * } + * }) + */ + public async create( + request: Square.CreateLocationRequest = {}, + requestOptions?: Locations.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/locations", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateLocationRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateLocationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/locations."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves details of a single location. Specify "main" + * as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location). + * + * @param {Square.LocationsGetRequest} request + * @param {Locations.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.get({ + * locationId: "location_id" + * }) + */ + public async get( + request: Square.LocationsGetRequest, + requestOptions?: Locations.RequestOptions, + ): Promise { + const { locationId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetLocationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/locations/{location_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a [location](https://developer.squareup.com/docs/locations-api). + * + * @param {Square.UpdateLocationRequest} request + * @param {Locations.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.update({ + * locationId: "location_id", + * 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" + * } + * }) + */ + public async update( + request: Square.UpdateLocationRequest, + requestOptions?: Locations.RequestOptions, + ): Promise { + const { locationId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateLocationRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateLocationResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/locations/{location_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Links a `checkoutId` to a `checkout_page_url` that customers are + * directed to in order to provide their payment information using a + * payment processing workflow hosted on connect.squareup.com. + * + * + * NOTE: The Checkout API has been updated with new features. + * For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights). + * + * @param {Square.CreateCheckoutRequest} request + * @param {Locations.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.checkouts({ + * locationId: "location_id", + * idempotencyKey: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", + * order: { + * order: { + * locationId: "location_id", + * referenceId: "reference_id", + * customerId: "customer_id", + * lineItems: [{ + * name: "Printed T Shirt", + * quantity: "2", + * appliedTaxes: [{ + * taxUid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3" + * }], + * appliedDiscounts: [{ + * discountUid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4" + * }], + * basePriceMoney: { + * amount: 1500, + * currency: "USD" + * } + * }, { + * name: "Slim Jeans", + * quantity: "1", + * basePriceMoney: { + * amount: 2500, + * currency: "USD" + * } + * }, { + * name: "Woven Sweater", + * quantity: "3", + * basePriceMoney: { + * amount: 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: 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: 60, + * currency: "USD" + * } + * }] + * }) + */ + public async checkouts( + request: Square.CreateCheckoutRequest, + requestOptions?: Locations.RequestOptions, + ): Promise { + const { locationId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/checkouts`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateCheckoutRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateCheckoutResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/locations/{location_id}/checkouts.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/locations/client/index.ts b/src/api/resources/locations/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/locations/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/locations/client/requests/CreateCheckoutRequest.ts b/src/api/resources/locations/client/requests/CreateCheckoutRequest.ts new file mode 100644 index 000000000..cd6a62f0a --- /dev/null +++ b/src/api/resources/locations/client/requests/CreateCheckoutRequest.ts @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * locationId: "location_id", + * idempotencyKey: "86ae1696-b1e3-4328-af6d-f1e04d947ad6", + * order: { + * order: { + * locationId: "location_id", + * referenceId: "reference_id", + * customerId: "customer_id", + * lineItems: [{ + * name: "Printed T Shirt", + * quantity: "2", + * appliedTaxes: [{ + * taxUid: "38ze1696-z1e3-5628-af6d-f1e04d947fg3" + * }], + * appliedDiscounts: [{ + * discountUid: "56ae1696-z1e3-9328-af6d-f1e04d947gd4" + * }], + * basePriceMoney: { + * amount: 1500, + * currency: "USD" + * } + * }, { + * name: "Slim Jeans", + * quantity: "1", + * basePriceMoney: { + * amount: 2500, + * currency: "USD" + * } + * }, { + * name: "Woven Sweater", + * quantity: "3", + * basePriceMoney: { + * amount: 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: 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: 60, + * currency: "USD" + * } + * }] + * } + */ +export interface CreateCheckoutRequest { + /** + * The ID of the business location to associate the checkout with. + */ + locationId: string; + /** + * A unique string that identifies this checkout among others you have created. It can be + * any valid string but must be unique for every order sent to Square Checkout for a given location ID. + * + * The idempotency key is used to avoid processing the same order more than once. If you are + * unsure whether a particular checkout was created successfully, you can attempt it again with + * the same idempotency key and all the same other parameters without worrying about creating duplicates. + * + * You should use a random number/string generator native to the language + * you are working in to generate strings for your idempotency keys. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + */ + idempotencyKey: string; + /** The order including line items to be checked out. */ + order: Square.CreateOrderRequest; + /** + * If `true`, Square Checkout collects shipping information on your behalf and stores + * that information with the transaction information in the Square Seller Dashboard. + * + * Default: `false`. + */ + askForShippingAddress?: boolean; + /** + * The email address to display on the Square Checkout confirmation page + * and confirmation email that the buyer can use to contact the seller. + * + * If this value is not set, the confirmation page and email display the + * primary email address associated with the seller's Square account. + * + * Default: none; only exists if explicitly set. + */ + merchantSupportEmail?: string; + /** + * If provided, the buyer's email is prepopulated on the checkout page + * as an editable text field. + * + * Default: none; only exists if explicitly set. + */ + prePopulateBuyerEmail?: string; + /** + * If provided, the buyer's shipping information is prepopulated on the + * checkout page as editable text fields. + * + * Default: none; only exists if explicitly set. + */ + prePopulateShippingAddress?: Square.Address; + /** + * The URL to redirect to after the checkout is completed with `checkoutId`, + * `transactionId`, and `referenceId` appended as URL parameters. For example, + * if the provided redirect URL is `http://www.example.com/order-complete`, a + * successful transaction redirects the customer to: + * + * `http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx` + * + * If you do not provide a redirect URL, Square Checkout displays an order + * confirmation page on your behalf; however, it is strongly recommended that + * you provide a redirect URL so you can verify the transaction results and + * finalize the order through your existing/normal confirmation workflow. + * + * Default: none; only exists if explicitly set. + */ + redirectUrl?: string; + /** + * The basic primitive of a multi-party transaction. The value is optional. + * The transaction facilitated by you can be split from here. + * + * If you provide this value, the `amount_money` value in your `additional_recipients` field + * cannot be more than 90% of the `total_money` calculated by Square for your order. + * The `location_id` must be a valid seller location where the checkout is occurring. + * + * This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission. + * + * This field is currently not supported in the Square Sandbox. + */ + additionalRecipients?: Square.ChargeRequestAdditionalRecipient[]; + /** + * An optional note to associate with the `checkout` object. + * + * This value cannot exceed 60 characters. + */ + note?: string; +} diff --git a/src/api/resources/locations/client/requests/CreateLocationRequest.ts b/src/api/resources/locations/client/requests/CreateLocationRequest.ts new file mode 100644 index 000000000..d51a6483b --- /dev/null +++ b/src/api/resources/locations/client/requests/CreateLocationRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * location: { + * name: "Midtown", + * address: { + * addressLine1: "1234 Peachtree St. NE", + * locality: "Atlanta", + * administrativeDistrictLevel1: "GA", + * postalCode: "30309" + * }, + * description: "Midtown Atlanta store" + * } + * } + */ +export interface CreateLocationRequest { + /** + * The initial values of the location being created. The `name` field is required and must be unique within a seller account. + * All other fields are optional, but any information you care about for the location should be included. + * The remaining fields are automatically added based on the data from the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location). + */ + location?: Square.Location; +} diff --git a/src/api/resources/locations/client/requests/LocationsGetRequest.ts b/src/api/resources/locations/client/requests/LocationsGetRequest.ts new file mode 100644 index 000000000..8b7e59a51 --- /dev/null +++ b/src/api/resources/locations/client/requests/LocationsGetRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id" + * } + */ +export interface LocationsGetRequest { + /** + * The ID of the location to retrieve. Specify the string + * "main" to return the main location. + */ + locationId: string; +} diff --git a/src/api/resources/locations/client/requests/UpdateLocationRequest.ts b/src/api/resources/locations/client/requests/UpdateLocationRequest.ts new file mode 100644 index 000000000..328c18b39 --- /dev/null +++ b/src/api/resources/locations/client/requests/UpdateLocationRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * locationId: "location_id", + * 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" + * } + * } + */ +export interface UpdateLocationRequest { + /** + * The ID of the location to update. + */ + locationId: string; + /** The `Location` object with only the fields to update. */ + location?: Square.Location; +} diff --git a/src/api/resources/locations/client/requests/index.ts b/src/api/resources/locations/client/requests/index.ts new file mode 100644 index 000000000..c23c0b004 --- /dev/null +++ b/src/api/resources/locations/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type CreateLocationRequest } from "./CreateLocationRequest"; +export { type LocationsGetRequest } from "./LocationsGetRequest"; +export { type UpdateLocationRequest } from "./UpdateLocationRequest"; +export { type CreateCheckoutRequest } from "./CreateCheckoutRequest"; diff --git a/src/api/resources/locations/index.ts b/src/api/resources/locations/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/locations/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts new file mode 100644 index 000000000..b0b9d8d2a --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/Client.ts @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributeDefinitions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributeDefinitions { + constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + + /** + * Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.locations.CustomAttributeDefinitionsListRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributeDefinitions.list() + */ + public async list( + request: Square.locations.CustomAttributeDefinitionsListRequest = {}, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { + const list = async ( + request: Square.locations.CustomAttributeDefinitionsListRequest, + ): Promise => { + const { visibilityFilter, limit, cursor } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = serializers.VisibilityFilter.jsonOrThrow(visibilityFilter, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/locations/custom-attribute-definitions", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListLocationCustomAttributeDefinitionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/locations/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable< + Square.ListLocationCustomAttributeDefinitionsResponse, + Square.CustomAttributeDefinition + >({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributeDefinitions ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + * Use this endpoint to define a custom attribute that can be associated with locations. + * A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties + * for a custom attribute. After the definition is created, you can call + * [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) or + * [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) + * to set the custom attribute for locations. + * + * @param {Square.locations.CreateLocationCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributeDefinitions.create({ + * customAttributeDefinition: { + * key: "bestseller", + * schema: { + * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" + * }, + * name: "Bestseller", + * description: "Bestselling item at location", + * visibility: "VISIBILITY_READ_WRITE_VALUES" + * } + * }) + */ + public async create( + request: Square.locations.CreateLocationCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/locations/custom-attribute-definitions", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.locations.CreateLocationCustomAttributeDefinitionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateLocationCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/locations/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + * To retrieve a custom attribute definition created by another application, the `visibility` + * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.locations.CustomAttributeDefinitionsGetRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributeDefinitions.get({ + * key: "key" + * }) + */ + public async get( + request: Square.locations.CustomAttributeDefinitionsGetRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, version } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveLocationCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/locations/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + * Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the + * `schema` for a `Selection` data type. + * Only the definition owner can update a custom attribute definition. + * + * @param {Square.locations.UpdateLocationCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributeDefinitions.update({ + * key: "key", + * customAttributeDefinition: { + * description: "Update the description as desired.", + * visibility: "VISIBILITY_READ_ONLY" + * } + * }) + */ + public async update( + request: Square.locations.UpdateLocationCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.locations.UpdateLocationCustomAttributeDefinitionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateLocationCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/locations/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + * Deleting a custom attribute definition also deletes the corresponding custom attribute from + * all locations. + * Only the definition owner can delete a custom attribute definition. + * + * @param {Square.locations.CustomAttributeDefinitionsDeleteRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributeDefinitions.delete({ + * key: "key" + * }) + */ + public async delete( + request: Square.locations.CustomAttributeDefinitionsDeleteRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteLocationCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/locations/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..10231ace2 --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * customAttributeDefinition: { + * key: "bestseller", + * schema: { + * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" + * }, + * name: "Bestseller", + * description: "Bestselling item at location", + * visibility: "VISIBILITY_READ_WRITE_VALUES" + * } + * } + */ +export interface CreateLocationCustomAttributeDefinitionRequest { + /** + * The custom attribute definition to create. Note the following: + * - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema + * definition hosted on the Square CDN. For more information, including supported values and constraints, see + * [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types). + * - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string; +} diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts new file mode 100644 index 000000000..860f57efe --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsDeleteRequest { + /** + * The key of the custom attribute definition to delete. + */ + key: string; +} diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts new file mode 100644 index 000000000..4fe9ca10a --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsGetRequest { + /** + * The key of the custom attribute definition to retrieve. If the requesting application + * is not the definition owner, you must use the qualified key. + */ + key: string; + /** + * The current version of the custom attribute definition, which is used for strongly consistent + * reads to guarantee that you receive the most up-to-date data. When included in the request, + * Square returns the specified version or a higher version if one exists. If the specified version + * is higher than the current version, Square returns a `BAD_REQUEST` error. + */ + version?: number | null; +} diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts new file mode 100644 index 000000000..1f6083094 --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * {} + */ +export interface CustomAttributeDefinitionsListRequest { + /** + * Filters the `CustomAttributeDefinition` results by their `visibility` values. + */ + visibilityFilter?: Square.VisibilityFilter | null; + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; +} diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..b1178a8df --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * key: "key", + * customAttributeDefinition: { + * description: "Update the description as desired.", + * visibility: "VISIBILITY_READ_ONLY" + * } + * } + */ +export interface UpdateLocationCustomAttributeDefinitionRequest { + /** + * The key of the custom attribute definition to update. + */ + key: string; + /** + * The custom attribute definition that contains the fields to update. This endpoint + * supports sparse updates, so only new or changed fields need to be included in the request. + * Only the following fields can be updated: + * - `name` + * - `description` + * - `visibility` + * - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed + * selections are supported. + * + * For more information, see + * [Update a location custom attribute definition](https://developer.squareup.com/docs/location-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition). + * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control, specify the current version of the custom attribute definition. + * If this is not important for your application, `version` can be set to -1. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..107727fcf --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type CustomAttributeDefinitionsListRequest } from "./CustomAttributeDefinitionsListRequest"; +export { type CreateLocationCustomAttributeDefinitionRequest } from "./CreateLocationCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsGetRequest } from "./CustomAttributeDefinitionsGetRequest"; +export { type UpdateLocationCustomAttributeDefinitionRequest } from "./UpdateLocationCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsDeleteRequest } from "./CustomAttributeDefinitionsDeleteRequest"; diff --git a/src/api/resources/locations/resources/customAttributeDefinitions/index.ts b/src/api/resources/locations/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/locations/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/locations/resources/customAttributes/client/Client.ts b/src/api/resources/locations/resources/customAttributes/client/Client.ts new file mode 100644 index 000000000..de9d83cfc --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/Client.ts @@ -0,0 +1,610 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributes { + constructor(protected readonly _options: CustomAttributes.Options = {}) {} + + /** + * Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation. + * To delete a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.locations.BulkDeleteLocationCustomAttributesRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributes.batchDelete({ + * values: { + * "id1": { + * key: "bestseller" + * }, + * "id2": { + * key: "bestseller" + * }, + * "id3": { + * key: "phone-number" + * } + * } + * }) + */ + public async batchDelete( + request: Square.locations.BulkDeleteLocationCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/locations/custom-attributes/bulk-delete", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.locations.BulkDeleteLocationCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkDeleteLocationCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/locations/custom-attributes/bulk-delete.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates [custom attributes](entity:CustomAttribute) for locations as a bulk operation. + * Use this endpoint to set the value of one or more custom attributes for one or more locations. + * A custom attribute is based on a custom attribute definition in a Square seller account, which is + * created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint. + * This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + * requests and returns a map of individual upsert responses. Each upsert request has a unique ID + * and provides a location ID and custom attribute. Each upsert response is returned with the ID + * of the corresponding request. + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.locations.BulkUpsertLocationCustomAttributesRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributes.batchUpsert({ + * values: { + * "id1": { + * locationId: "L0TBCBTB7P8RQ", + * customAttribute: { + * key: "bestseller", + * value: "hot cocoa" + * } + * }, + * "id2": { + * locationId: "L9XMD04V3STJX", + * customAttribute: { + * key: "bestseller", + * value: "berry smoothie" + * } + * }, + * "id3": { + * locationId: "L0TBCBTB7P8RQ", + * customAttribute: { + * key: "phone-number", + * value: "+12223334444" + * } + * } + * } + * }) + */ + public async batchUpsert( + request: Square.locations.BulkUpsertLocationCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/locations/custom-attributes/bulk-upsert", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.locations.BulkUpsertLocationCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkUpsertLocationCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/locations/custom-attributes/bulk-upsert.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Lists the [custom attributes](entity:CustomAttribute) associated with a location. + * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + * in the same call. + * When all response pages are retrieved, the results include all custom attributes that are + * visible to the requesting application, including those that are owned by other applications + * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.locations.CustomAttributesListRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributes.list({ + * locationId: "location_id" + * }) + */ + public async list( + request: Square.locations.CustomAttributesListRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const list = async ( + request: Square.locations.CustomAttributesListRequest, + ): Promise => { + const { locationId, visibilityFilter, limit, cursor, withDefinitions } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = serializers.VisibilityFilter.jsonOrThrow(visibilityFilter, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (withDefinitions !== undefined) { + _queryParams["with_definitions"] = withDefinitions?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/custom-attributes`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListLocationCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/locations/{location_id}/custom-attributes.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves a [custom attribute](entity:CustomAttribute) associated with a location. + * You can use the `with_definition` query parameter to also retrieve the custom attribute definition + * in the same call. + * To retrieve a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.locations.CustomAttributesGetRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributes.get({ + * locationId: "location_id", + * key: "key" + * }) + */ + public async get( + request: Square.locations.CustomAttributesGetRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { locationId, key, withDefinition, version } = request; + const _queryParams: Record = {}; + if (withDefinition !== undefined) { + _queryParams["with_definition"] = withDefinition?.toString() ?? null; + } + + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveLocationCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/locations/{location_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates a [custom attribute](entity:CustomAttribute) for a location. + * Use this endpoint to set the value of a custom attribute for a specified location. + * A custom attribute is based on a custom attribute definition in a Square seller account, which + * is created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint. + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.locations.UpsertLocationCustomAttributeRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributes.upsert({ + * locationId: "location_id", + * key: "key", + * customAttribute: { + * value: "hot cocoa" + * } + * }) + */ + public async upsert( + request: Square.locations.UpsertLocationCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { locationId, key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.locations.UpsertLocationCustomAttributeRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpsertLocationCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/locations/{location_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a [custom attribute](entity:CustomAttribute) associated with a location. + * To delete a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.locations.CustomAttributesDeleteRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.customAttributes.delete({ + * locationId: "location_id", + * key: "key" + * }) + */ + public async delete( + request: Square.locations.CustomAttributesDeleteRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { locationId, key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteLocationCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/locations/{location_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/locations/resources/customAttributes/client/index.ts b/src/api/resources/locations/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts new file mode 100644 index 000000000..b7bca236d --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "id1": { + * key: "bestseller" + * }, + * "id2": { + * key: "bestseller" + * }, + * "id3": { + * key: "phone-number" + * } + * } + * } + */ +export interface BulkDeleteLocationCustomAttributesRequest { + /** + * The data used to update the `CustomAttribute` objects. + * The keys must be unique and are used to map to the corresponding response. + */ + values: Record; +} diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts new file mode 100644 index 000000000..c45d120fb --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "id1": { + * locationId: "L0TBCBTB7P8RQ", + * customAttribute: { + * key: "bestseller", + * value: "hot cocoa" + * } + * }, + * "id2": { + * locationId: "L9XMD04V3STJX", + * customAttribute: { + * key: "bestseller", + * value: "berry smoothie" + * } + * }, + * "id3": { + * locationId: "L0TBCBTB7P8RQ", + * customAttribute: { + * key: "phone-number", + * value: "+12223334444" + * } + * } + * } + * } + */ +export interface BulkUpsertLocationCustomAttributesRequest { + /** + * A map containing 1 to 25 individual upsert requests. For each request, provide an + * arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the + * information needed to create or update a custom attribute. + */ + values: Record; +} diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts new file mode 100644 index 000000000..1d0e7bf77 --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id", + * key: "key" + * } + */ +export interface CustomAttributesDeleteRequest { + /** + * The ID of the target [location](entity:Location). + */ + locationId: string; + /** + * The key of the custom attribute to delete. This key must match the `key` of a custom + * attribute definition in the Square seller account. If the requesting application is not the + * definition owner, you must use the qualified key. + */ + key: string; +} diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts new file mode 100644 index 000000000..6947693b8 --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id", + * key: "key" + * } + */ +export interface CustomAttributesGetRequest { + /** + * The ID of the target [location](entity:Location). + */ + locationId: string; + /** + * The key of the custom attribute to retrieve. This key must match the `key` of a custom + * attribute definition in the Square seller account. If the requesting application is not the + * definition owner, you must use the qualified key. + */ + key: string; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of + * the custom attribute. Set this parameter to `true` to get the name and description of the custom + * attribute, information about the data type, or other definition details. The default value is `false`. + */ + withDefinition?: boolean | null; + /** + * The current version of the custom attribute, which is used for strongly consistent reads to + * guarantee that you receive the most up-to-date data. When included in the request, Square + * returns the specified version or a higher version if one exists. If the specified version is + * higher than the current version, Square returns a `BAD_REQUEST` error. + */ + version?: number | null; +} diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesListRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesListRequest.ts new file mode 100644 index 000000000..fd3958b1b --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/requests/CustomAttributesListRequest.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * locationId: "location_id" + * } + */ +export interface CustomAttributesListRequest { + /** + * The ID of the target [location](entity:Location). + */ + locationId: string; + /** + * Filters the `CustomAttributeDefinition` results by their `visibility` values. + */ + visibilityFilter?: Square.VisibilityFilter | null; + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. For more + * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom + * attribute, information about the data type, or other definition details. The default value is `false`. + */ + withDefinitions?: boolean | null; +} diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts b/src/api/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts new file mode 100644 index 000000000..fd3393039 --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * locationId: "location_id", + * key: "key", + * customAttribute: { + * value: "hot cocoa" + * } + * } + */ +export interface UpsertLocationCustomAttributeRequest { + /** + * The ID of the target [location](entity:Location). + */ + locationId: string; + /** + * The key of the custom attribute to create or update. This key must match the `key` of a + * custom attribute definition in the Square seller account. If the requesting application is not + * the definition owner, you must use the qualified key. + */ + key: string; + /** + * The custom attribute to create or update, with the following fields: + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types). + * - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control for an update operation, include the current version of the custom attribute. + * If this is not important for your application, version can be set to -1. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/locations/resources/customAttributes/client/requests/index.ts b/src/api/resources/locations/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..3684e1fcf --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,6 @@ +export { type BulkDeleteLocationCustomAttributesRequest } from "./BulkDeleteLocationCustomAttributesRequest"; +export { type BulkUpsertLocationCustomAttributesRequest } from "./BulkUpsertLocationCustomAttributesRequest"; +export { type CustomAttributesListRequest } from "./CustomAttributesListRequest"; +export { type CustomAttributesGetRequest } from "./CustomAttributesGetRequest"; +export { type UpsertLocationCustomAttributeRequest } from "./UpsertLocationCustomAttributeRequest"; +export { type CustomAttributesDeleteRequest } from "./CustomAttributesDeleteRequest"; diff --git a/src/api/resources/locations/resources/customAttributes/index.ts b/src/api/resources/locations/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/locations/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/locations/resources/index.ts b/src/api/resources/locations/resources/index.ts new file mode 100644 index 000000000..6322f4066 --- /dev/null +++ b/src/api/resources/locations/resources/index.ts @@ -0,0 +1,6 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * as customAttributes from "./customAttributes"; +export * as transactions from "./transactions"; +export * from "./customAttributeDefinitions/client/requests"; +export * from "./customAttributes/client/requests"; +export * from "./transactions/client/requests"; diff --git a/src/api/resources/locations/resources/transactions/client/Client.ts b/src/api/resources/locations/resources/transactions/client/Client.ts new file mode 100644 index 000000000..d573c4b09 --- /dev/null +++ b/src/api/resources/locations/resources/transactions/client/Client.ts @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Transactions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Transactions { + constructor(protected readonly _options: Transactions.Options = {}) {} + + /** + * Lists transactions for a particular location. + * + * Transactions include payment information from sales and exchanges and refund + * information from returns and exchanges. + * + * Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50 + * + * @param {Square.locations.TransactionsListRequest} request + * @param {Transactions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.transactions.list({ + * locationId: "location_id" + * }) + */ + public async list( + request: Square.locations.TransactionsListRequest, + requestOptions?: Transactions.RequestOptions, + ): Promise { + const { locationId, beginTime, endTime, sortOrder, cursor } = request; + const _queryParams: Record = {}; + if (beginTime !== undefined) { + _queryParams["begin_time"] = beginTime; + } + + if (endTime !== undefined) { + _queryParams["end_time"] = endTime; + } + + if (sortOrder !== undefined) { + _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/transactions`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListTransactionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/locations/{location_id}/transactions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves details for a single transaction. + * + * @param {Square.locations.TransactionsGetRequest} request + * @param {Transactions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.transactions.get({ + * locationId: "location_id", + * transactionId: "transaction_id" + * }) + */ + public async get( + request: Square.locations.TransactionsGetRequest, + requestOptions?: Transactions.RequestOptions, + ): Promise { + const { locationId, transactionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/transactions/${encodeURIComponent(transactionId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTransactionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/locations/{location_id}/transactions/{transaction_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) + * endpoint with a `delay_capture` value of `true`. + * + * + * See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture) + * for more information. + * + * @param {Square.locations.TransactionsCaptureRequest} request + * @param {Transactions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.transactions.capture({ + * locationId: "location_id", + * transactionId: "transaction_id" + * }) + */ + public async capture( + request: Square.locations.TransactionsCaptureRequest, + requestOptions?: Transactions.RequestOptions, + ): Promise { + const { locationId, transactionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/transactions/${encodeURIComponent(transactionId)}/capture`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CaptureTransactionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/locations/{location_id}/transactions/{transaction_id}/capture.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) + * endpoint with a `delay_capture` value of `true`. + * + * + * See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture) + * for more information. + * + * @param {Square.locations.TransactionsVoidRequest} request + * @param {Transactions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.locations.transactions.void({ + * locationId: "location_id", + * transactionId: "transaction_id" + * }) + */ + public async void( + request: Square.locations.TransactionsVoidRequest, + requestOptions?: Transactions.RequestOptions, + ): Promise { + const { locationId, transactionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/locations/${encodeURIComponent(locationId)}/transactions/${encodeURIComponent(transactionId)}/void`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.VoidTransactionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/locations/{location_id}/transactions/{transaction_id}/void.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/locations/resources/transactions/client/index.ts b/src/api/resources/locations/resources/transactions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/locations/resources/transactions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/locations/resources/transactions/client/requests/TransactionsCaptureRequest.ts b/src/api/resources/locations/resources/transactions/client/requests/TransactionsCaptureRequest.ts new file mode 100644 index 000000000..c62553fd8 --- /dev/null +++ b/src/api/resources/locations/resources/transactions/client/requests/TransactionsCaptureRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id", + * transactionId: "transaction_id" + * } + */ +export interface TransactionsCaptureRequest { + /** + * + */ + locationId: string; + /** + * + */ + transactionId: string; +} diff --git a/src/api/resources/locations/resources/transactions/client/requests/TransactionsGetRequest.ts b/src/api/resources/locations/resources/transactions/client/requests/TransactionsGetRequest.ts new file mode 100644 index 000000000..a572a42f2 --- /dev/null +++ b/src/api/resources/locations/resources/transactions/client/requests/TransactionsGetRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id", + * transactionId: "transaction_id" + * } + */ +export interface TransactionsGetRequest { + /** + * The ID of the transaction's associated location. + */ + locationId: string; + /** + * The ID of the transaction to retrieve. + */ + transactionId: string; +} diff --git a/src/api/resources/locations/resources/transactions/client/requests/TransactionsListRequest.ts b/src/api/resources/locations/resources/transactions/client/requests/TransactionsListRequest.ts new file mode 100644 index 000000000..e613a1bfb --- /dev/null +++ b/src/api/resources/locations/resources/transactions/client/requests/TransactionsListRequest.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * locationId: "location_id" + * } + */ +export interface TransactionsListRequest { + /** + * The ID of the location to list transactions for. + */ + locationId: string; + /** + * The beginning of the requested reporting period, in RFC 3339 format. + * + * See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. + * + * Default value: The current time minus one year. + */ + beginTime?: string | null; + /** + * The end of the requested reporting period, in RFC 3339 format. + * + * See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. + * + * Default value: The current time. + */ + endTime?: string | null; + /** + * The order in which results are listed in the response (`ASC` for + * oldest first, `DESC` for newest first). + * + * Default value: `DESC` + */ + sortOrder?: Square.SortOrder | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for your original query. + * + * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + */ + cursor?: string | null; +} diff --git a/src/api/resources/locations/resources/transactions/client/requests/TransactionsVoidRequest.ts b/src/api/resources/locations/resources/transactions/client/requests/TransactionsVoidRequest.ts new file mode 100644 index 000000000..4196a49e9 --- /dev/null +++ b/src/api/resources/locations/resources/transactions/client/requests/TransactionsVoidRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id", + * transactionId: "transaction_id" + * } + */ +export interface TransactionsVoidRequest { + /** + * + */ + locationId: string; + /** + * + */ + transactionId: string; +} diff --git a/src/api/resources/locations/resources/transactions/client/requests/index.ts b/src/api/resources/locations/resources/transactions/client/requests/index.ts new file mode 100644 index 000000000..1449259d8 --- /dev/null +++ b/src/api/resources/locations/resources/transactions/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type TransactionsListRequest } from "./TransactionsListRequest"; +export { type TransactionsGetRequest } from "./TransactionsGetRequest"; +export { type TransactionsCaptureRequest } from "./TransactionsCaptureRequest"; +export { type TransactionsVoidRequest } from "./TransactionsVoidRequest"; diff --git a/src/api/resources/locations/resources/transactions/index.ts b/src/api/resources/locations/resources/transactions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/locations/resources/transactions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/loyalty/client/Client.ts b/src/api/resources/loyalty/client/Client.ts new file mode 100644 index 000000000..3572ba555 --- /dev/null +++ b/src/api/resources/loyalty/client/Client.ts @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; +import { Accounts } from "../resources/accounts/client/Client"; +import { Programs } from "../resources/programs/client/Client"; +import { Rewards } from "../resources/rewards/client/Client"; + +export declare namespace Loyalty { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Loyalty { + protected _accounts: Accounts | undefined; + protected _programs: Programs | undefined; + protected _rewards: Rewards | undefined; + + constructor(protected readonly _options: Loyalty.Options = {}) {} + + public get accounts(): Accounts { + return (this._accounts ??= new Accounts(this._options)); + } + + public get programs(): Programs { + return (this._programs ??= new Programs(this._options)); + } + + public get rewards(): Rewards { + return (this._rewards ??= new Rewards(this._options)); + } + + /** + * Searches for loyalty events. + * + * A Square loyalty program maintains a ledger of events that occur during the lifetime of a + * buyer's loyalty account. Each change in the point balance + * (for example, points earned, points redeemed, and points expired) is + * recorded in the ledger. Using this endpoint, you can search the ledger for events. + * + * Search results are sorted by `created_at` in descending order. + * + * @param {Square.SearchLoyaltyEventsRequest} request + * @param {Loyalty.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.searchEvents({ + * query: { + * filter: { + * orderFilter: { + * orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY" + * } + * } + * }, + * limit: 30 + * }) + */ + public async searchEvents( + request: Square.SearchLoyaltyEventsRequest = {}, + requestOptions?: Loyalty.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/loyalty/events/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchLoyaltyEventsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchLoyaltyEventsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/loyalty/events/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/loyalty/client/index.ts b/src/api/resources/loyalty/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/loyalty/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts b/src/api/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts new file mode 100644 index 000000000..2b1bc0f10 --- /dev/null +++ b/src/api/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * orderFilter: { + * orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY" + * } + * } + * }, + * limit: 30 + * } + */ +export interface SearchLoyaltyEventsRequest { + /** + * A set of one or more predefined query filters to apply when + * searching for loyalty events. The endpoint performs a logical AND to + * evaluate multiple filters and performs a logical OR on arrays + * that specifies multiple field values. + */ + query?: Square.LoyaltyEventQuery; + /** + * The maximum number of results to include in the response. + * The last page might contain fewer events. + * The default is 30 events. + */ + limit?: number; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for your original query. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/resources/loyalty/client/requests/index.ts b/src/api/resources/loyalty/client/requests/index.ts new file mode 100644 index 000000000..119b5f36e --- /dev/null +++ b/src/api/resources/loyalty/client/requests/index.ts @@ -0,0 +1 @@ +export { type SearchLoyaltyEventsRequest } from "./SearchLoyaltyEventsRequest"; diff --git a/src/api/resources/loyalty/index.ts b/src/api/resources/loyalty/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/loyalty/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/loyalty/resources/accounts/client/Client.ts b/src/api/resources/loyalty/resources/accounts/client/Client.ts new file mode 100644 index 000000000..ae1d7e732 --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/client/Client.ts @@ -0,0 +1,475 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Accounts { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Accounts { + constructor(protected readonly _options: Accounts.Options = {}) {} + + /** + * Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer. + * + * @param {Square.loyalty.CreateLoyaltyAccountRequest} request + * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.accounts.create({ + * loyaltyAccount: { + * programId: "d619f755-2d17-41f3-990d-c04ecedd64dd", + * mapping: { + * phoneNumber: "+14155551234" + * } + * }, + * idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996" + * }) + */ + public async create( + request: Square.loyalty.CreateLoyaltyAccountRequest, + requestOptions?: Accounts.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/loyalty/accounts", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.CreateLoyaltyAccountRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateLoyaltyAccountResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/loyalty/accounts."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Searches for loyalty accounts in a loyalty program. + * + * You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty `query` object or omit it entirely. + * + * Search results are sorted by `created_at` in ascending order. + * + * @param {Square.loyalty.SearchLoyaltyAccountsRequest} request + * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.accounts.search({ + * query: { + * mappings: [{ + * phoneNumber: "+14155551234" + * }] + * }, + * limit: 10 + * }) + */ + public async search( + request: Square.loyalty.SearchLoyaltyAccountsRequest = {}, + requestOptions?: Accounts.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/loyalty/accounts/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.SearchLoyaltyAccountsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchLoyaltyAccountsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/loyalty/accounts/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a loyalty account. + * + * @param {Square.loyalty.AccountsGetRequest} request + * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.accounts.get({ + * accountId: "account_id" + * }) + */ + public async get( + request: Square.loyalty.AccountsGetRequest, + requestOptions?: Accounts.RequestOptions, + ): Promise { + const { accountId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/accounts/${encodeURIComponent(accountId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetLoyaltyAccountResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/loyalty/accounts/{account_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount). + * + * - If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order + * to compute the points earned from both the base loyalty program and an associated + * [loyalty promotion](entity:LoyaltyPromotion). For purchases that qualify for multiple accrual + * rules, Square computes points based on the accrual rule that grants the most points. + * For purchases that qualify for multiple promotions, Square computes points based on the most + * recently created promotion. A purchase must first qualify for program points to be eligible for promotion points. + * + * - If you are not using the Orders API to manage orders, provide `points` with the number of points to add. + * You must first perform a client-side computation of the points earned from the loyalty program and + * loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) + * to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see + * [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). + * + * @param {Square.loyalty.AccumulateLoyaltyPointsRequest} request + * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.accounts.accumulatePoints({ + * accountId: "account_id", + * accumulatePoints: { + * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" + * }, + * idempotencyKey: "58b90739-c3e8-4b11-85f7-e636d48d72cb", + * locationId: "P034NEENMD09F" + * }) + */ + public async accumulatePoints( + request: Square.loyalty.AccumulateLoyaltyPointsRequest, + requestOptions?: Accounts.RequestOptions, + ): Promise { + const { accountId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/accounts/${encodeURIComponent(accountId)}/accumulate`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.AccumulateLoyaltyPointsRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.AccumulateLoyaltyPointsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/loyalty/accounts/{account_id}/accumulate.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Adds points to or subtracts points from a buyer's account. + * + * Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call + * [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) + * to add points when a buyer pays for the purchase. + * + * @param {Square.loyalty.AdjustLoyaltyPointsRequest} request + * @param {Accounts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.accounts.adjust({ + * accountId: "account_id", + * idempotencyKey: "bc29a517-3dc9-450e-aa76-fae39ee849d1", + * adjustPoints: { + * points: 10, + * reason: "Complimentary points" + * } + * }) + */ + public async adjust( + request: Square.loyalty.AdjustLoyaltyPointsRequest, + requestOptions?: Accounts.RequestOptions, + ): Promise { + const { accountId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/accounts/${encodeURIComponent(accountId)}/adjust`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.AdjustLoyaltyPointsRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.AdjustLoyaltyPointsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/loyalty/accounts/{account_id}/adjust.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/loyalty/resources/accounts/client/index.ts b/src/api/resources/loyalty/resources/accounts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/AccountsGetRequest.ts b/src/api/resources/loyalty/resources/accounts/client/requests/AccountsGetRequest.ts new file mode 100644 index 000000000..a7c912899 --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/client/requests/AccountsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * accountId: "account_id" + * } + */ +export interface AccountsGetRequest { + /** + * The ID of the [loyalty account](entity:LoyaltyAccount) to retrieve. + */ + accountId: string; +} diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts b/src/api/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts new file mode 100644 index 000000000..88c4285f2 --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * accountId: "account_id", + * accumulatePoints: { + * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" + * }, + * idempotencyKey: "58b90739-c3e8-4b11-85f7-e636d48d72cb", + * locationId: "P034NEENMD09F" + * } + */ +export interface AccumulateLoyaltyPointsRequest { + /** + * The ID of the target [loyalty account](entity:LoyaltyAccount). + */ + accountId: string; + /** + * The points to add to the account. + * If you are using the Orders API to manage orders, specify the order ID. + * Otherwise, specify the points to add. + */ + accumulatePoints: Square.LoyaltyEventAccumulatePoints; + /** + * A unique string that identifies the `AccumulateLoyaltyPoints` request. + * Keys can be any valid string but must be unique for every request. + */ + idempotencyKey: string; + /** The [location](entity:Location) where the purchase was made. */ + locationId: string; +} diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts b/src/api/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts new file mode 100644 index 000000000..6243e046b --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * accountId: "account_id", + * idempotencyKey: "bc29a517-3dc9-450e-aa76-fae39ee849d1", + * adjustPoints: { + * points: 10, + * reason: "Complimentary points" + * } + * } + */ +export interface AdjustLoyaltyPointsRequest { + /** + * The ID of the target [loyalty account](entity:LoyaltyAccount). + */ + accountId: string; + /** + * A unique string that identifies this `AdjustLoyaltyPoints` request. + * Keys can be any valid string, but must be unique for every request. + */ + idempotencyKey: string; + /** + * The points to add or subtract and the reason for the adjustment. To add points, specify a positive integer. + * To subtract points, specify a negative integer. + */ + adjustPoints: Square.LoyaltyEventAdjustPoints; + /** + * Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative + * balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting + * the specified number of points would result in a negative balance. The default value is `false`. + */ + allowNegativeBalance?: boolean | null; +} diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts b/src/api/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts new file mode 100644 index 000000000..b9301ffc1 --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * loyaltyAccount: { + * programId: "d619f755-2d17-41f3-990d-c04ecedd64dd", + * mapping: { + * phoneNumber: "+14155551234" + * } + * }, + * idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996" + * } + */ +export interface CreateLoyaltyAccountRequest { + /** The loyalty account to create. */ + loyaltyAccount: Square.LoyaltyAccount; + /** + * A unique string that identifies this `CreateLoyaltyAccount` request. + * Keys can be any valid string, but must be unique for every request. + */ + idempotencyKey: string; +} diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts b/src/api/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts new file mode 100644 index 000000000..b5b095842 --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * query: { + * mappings: [{ + * phoneNumber: "+14155551234" + * }] + * }, + * limit: 10 + * } + */ +export interface SearchLoyaltyAccountsRequest { + /** The search criteria for the request. */ + query?: Square.SearchLoyaltyAccountsRequestLoyaltyAccountQuery; + /** The maximum number of results to include in the response. The default value is 30. */ + limit?: number; + /** + * A pagination cursor returned by a previous call to + * this endpoint. Provide this to retrieve the next set of + * results for the original query. + * + * For more information, + * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/resources/loyalty/resources/accounts/client/requests/index.ts b/src/api/resources/loyalty/resources/accounts/client/requests/index.ts new file mode 100644 index 000000000..a8bc01bf8 --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type CreateLoyaltyAccountRequest } from "./CreateLoyaltyAccountRequest"; +export { type SearchLoyaltyAccountsRequest } from "./SearchLoyaltyAccountsRequest"; +export { type AccountsGetRequest } from "./AccountsGetRequest"; +export { type AccumulateLoyaltyPointsRequest } from "./AccumulateLoyaltyPointsRequest"; +export { type AdjustLoyaltyPointsRequest } from "./AdjustLoyaltyPointsRequest"; diff --git a/src/api/resources/loyalty/resources/accounts/index.ts b/src/api/resources/loyalty/resources/accounts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/loyalty/resources/accounts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/loyalty/resources/index.ts b/src/api/resources/loyalty/resources/index.ts new file mode 100644 index 000000000..e335fa8c9 --- /dev/null +++ b/src/api/resources/loyalty/resources/index.ts @@ -0,0 +1,6 @@ +export * as accounts from "./accounts"; +export * as programs from "./programs"; +export * as rewards from "./rewards"; +export * from "./accounts/client/requests"; +export * from "./programs/client/requests"; +export * from "./rewards/client/requests"; diff --git a/src/api/resources/loyalty/resources/programs/client/Client.ts b/src/api/resources/loyalty/resources/programs/client/Client.ts new file mode 100644 index 000000000..e2a605eaf --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/client/Client.ts @@ -0,0 +1,297 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; +import { Promotions } from "../resources/promotions/client/Client"; + +export declare namespace Programs { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Programs { + protected _promotions: Promotions | undefined; + + constructor(protected readonly _options: Programs.Options = {}) {} + + public get promotions(): Promotions { + return (this._promotions ??= new Promotions(this._options)); + } + + /** + * Returns a list of loyalty programs in the seller's account. + * Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). + * + * + * Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword `main`. + * + * @param {Programs.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.programs.list() + */ + public async list(requestOptions?: Programs.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/loyalty/programs", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListLoyaltyProgramsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/loyalty/programs."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`. + * + * Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). + * + * @param {Square.loyalty.ProgramsGetRequest} request + * @param {Programs.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.programs.get({ + * programId: "program_id" + * }) + */ + public async get( + request: Square.loyalty.ProgramsGetRequest, + requestOptions?: Programs.RequestOptions, + ): Promise { + const { programId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/programs/${encodeURIComponent(programId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetLoyaltyProgramResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/loyalty/programs/{program_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint + * to display the points to the buyer. + * + * - If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`. + * Square reads the order to compute the points earned from the base loyalty program and an associated + * [loyalty promotion](entity:LoyaltyPromotion). + * + * - If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the + * purchase amount. Square uses this amount to calculate the points earned from the base loyalty program, + * but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode` + * setting of the accrual rule indicates how taxes should be treated for loyalty points accrual. + * If the purchase qualifies for program points, call + * [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) and perform a client-side computation + * to calculate whether the purchase also qualifies for promotion points. For more information, see + * [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). + * + * @param {Square.loyalty.CalculateLoyaltyPointsRequest} request + * @param {Programs.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.programs.calculate({ + * programId: "program_id", + * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + * loyaltyAccountId: "79b807d2-d786-46a9-933b-918028d7a8c5" + * }) + */ + public async calculate( + request: Square.loyalty.CalculateLoyaltyPointsRequest, + requestOptions?: Programs.RequestOptions, + ): Promise { + const { programId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/programs/${encodeURIComponent(programId)}/calculate`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.CalculateLoyaltyPointsRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CalculateLoyaltyPointsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/loyalty/programs/{program_id}/calculate.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/loyalty/resources/programs/client/index.ts b/src/api/resources/loyalty/resources/programs/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts b/src/api/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts new file mode 100644 index 000000000..ce71619a8 --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * programId: "program_id", + * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY", + * loyaltyAccountId: "79b807d2-d786-46a9-933b-918028d7a8c5" + * } + */ +export interface CalculateLoyaltyPointsRequest { + /** + * The ID of the [loyalty program](entity:LoyaltyProgram), which defines the rules for accruing points. + */ + programId: string; + /** + * The [order](entity:Order) ID for which to calculate the points. + * Specify this field if your application uses the Orders API to process orders. + * Otherwise, specify the `transaction_amount_money`. + */ + orderId?: string | null; + /** + * The purchase amount for which to calculate the points. + * Specify this field if your application does not use the Orders API to process orders. + * Otherwise, specify the `order_id`. + */ + transactionAmountMoney?: Square.Money; + /** + * The ID of the target [loyalty account](entity:LoyaltyAccount). Optionally specify this field + * if your application uses the Orders API to process orders. + * + * If specified, the `promotion_points` field in the response shows the number of points the buyer would + * earn from the purchase. In this case, Square uses the account ID to determine whether the promotion's + * `trigger_limit` (the maximum number of times that a buyer can trigger the promotion) has been reached. + * If not specified, the `promotion_points` field shows the number of points the purchase qualifies + * for regardless of the trigger limit. + */ + loyaltyAccountId?: string | null; +} diff --git a/src/api/resources/loyalty/resources/programs/client/requests/ProgramsGetRequest.ts b/src/api/resources/loyalty/resources/programs/client/requests/ProgramsGetRequest.ts new file mode 100644 index 000000000..491ca17ec --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/client/requests/ProgramsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * programId: "program_id" + * } + */ +export interface ProgramsGetRequest { + /** + * The ID of the loyalty program or the keyword `main`. Either value can be used to retrieve the single loyalty program that belongs to the seller. + */ + programId: string; +} diff --git a/src/api/resources/loyalty/resources/programs/client/requests/index.ts b/src/api/resources/loyalty/resources/programs/client/requests/index.ts new file mode 100644 index 000000000..1aad00224 --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type ProgramsGetRequest } from "./ProgramsGetRequest"; +export { type CalculateLoyaltyPointsRequest } from "./CalculateLoyaltyPointsRequest"; diff --git a/src/api/resources/loyalty/resources/programs/index.ts b/src/api/resources/loyalty/resources/programs/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/loyalty/resources/programs/resources/index.ts b/src/api/resources/loyalty/resources/programs/resources/index.ts new file mode 100644 index 000000000..0da7d5f94 --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/index.ts @@ -0,0 +1,2 @@ +export * as promotions from "./promotions"; +export * from "./promotions/client/requests"; diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/Client.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/Client.ts new file mode 100644 index 000000000..b91fb9c81 --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/Client.ts @@ -0,0 +1,411 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../../../environments"; +import * as core from "../../../../../../../../core"; +import * as Square from "../../../../../../../index"; +import * as serializers from "../../../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../../../errors/index"; + +export declare namespace Promotions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Promotions { + constructor(protected readonly _options: Promotions.Options = {}) {} + + /** + * Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram). + * Results are sorted by the `created_at` date in descending order (newest to oldest). + * + * @param {Square.loyalty.programs.PromotionsListRequest} request + * @param {Promotions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.programs.promotions.list({ + * programId: "program_id" + * }) + */ + public async list( + request: Square.loyalty.programs.PromotionsListRequest, + requestOptions?: Promotions.RequestOptions, + ): Promise> { + const list = async ( + request: Square.loyalty.programs.PromotionsListRequest, + ): Promise => { + const { programId, status, cursor, limit } = request; + const _queryParams: Record = {}; + if (status !== undefined) { + _queryParams["status"] = serializers.LoyaltyPromotionStatus.jsonOrThrow(status, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/programs/${encodeURIComponent(programId)}/promotions`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListLoyaltyPromotionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/loyalty/programs/{program_id}/promotions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.loyaltyPromotions ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion + * enables buyers to earn points in addition to those earned from the base loyalty program. + * + * This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the + * `available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an + * `ACTIVE` or `SCHEDULED` status. + * + * @param {Square.loyalty.programs.CreateLoyaltyPromotionRequest} request + * @param {Promotions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.programs.promotions.create({ + * programId: "program_id", + * loyaltyPromotion: { + * name: "Tuesday Happy Hour Promo", + * incentive: { + * type: "POINTS_MULTIPLIER", + * pointsMultiplierData: { + * multiplier: "3.0" + * } + * }, + * availableTime: { + * timePeriods: ["BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT"] + * }, + * triggerLimit: { + * times: 1, + * interval: "DAY" + * }, + * minimumSpendAmountMoney: { + * amount: 2000, + * currency: "USD" + * }, + * qualifyingCategoryIds: ["XTQPYLR3IIU9C44VRCB3XD12"] + * }, + * idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996" + * }) + */ + public async create( + request: Square.loyalty.programs.CreateLoyaltyPromotionRequest, + requestOptions?: Promotions.RequestOptions, + ): Promise { + const { programId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/programs/${encodeURIComponent(programId)}/promotions`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.programs.CreateLoyaltyPromotionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateLoyaltyPromotionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/loyalty/programs/{program_id}/promotions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a loyalty promotion. + * + * @param {Square.loyalty.programs.PromotionsGetRequest} request + * @param {Promotions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.programs.promotions.get({ + * promotionId: "promotion_id", + * programId: "program_id" + * }) + */ + public async get( + request: Square.loyalty.programs.PromotionsGetRequest, + requestOptions?: Promotions.RequestOptions, + ): Promise { + const { promotionId, programId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/programs/${encodeURIComponent(programId)}/promotions/${encodeURIComponent(promotionId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetLoyaltyPromotionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/loyalty/programs/{program_id}/promotions/{promotion_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the + * end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion. + * Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before + * you create a new one. + * + * This endpoint sets the loyalty promotion to the `CANCELED` state + * + * @param {Square.loyalty.programs.PromotionsCancelRequest} request + * @param {Promotions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.programs.promotions.cancel({ + * promotionId: "promotion_id", + * programId: "program_id" + * }) + */ + public async cancel( + request: Square.loyalty.programs.PromotionsCancelRequest, + requestOptions?: Promotions.RequestOptions, + ): Promise { + const { promotionId, programId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/programs/${encodeURIComponent(programId)}/promotions/${encodeURIComponent(promotionId)}/cancel`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelLoyaltyPromotionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/loyalty/programs/{program_id}/promotions/{promotion_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/index.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/CreateLoyaltyPromotionRequest.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/CreateLoyaltyPromotionRequest.ts new file mode 100644 index 000000000..fb8e389ed --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/CreateLoyaltyPromotionRequest.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../../../index"; + +/** + * @example + * { + * programId: "program_id", + * loyaltyPromotion: { + * name: "Tuesday Happy Hour Promo", + * incentive: { + * type: "POINTS_MULTIPLIER", + * pointsMultiplierData: { + * multiplier: "3.0" + * } + * }, + * availableTime: { + * timePeriods: ["BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT"] + * }, + * triggerLimit: { + * times: 1, + * interval: "DAY" + * }, + * minimumSpendAmountMoney: { + * amount: 2000, + * currency: "USD" + * }, + * qualifyingCategoryIds: ["XTQPYLR3IIU9C44VRCB3XD12"] + * }, + * idempotencyKey: "ec78c477-b1c3-4899-a209-a4e71337c996" + * } + */ +export interface CreateLoyaltyPromotionRequest { + /** + * The ID of the [loyalty program](entity:LoyaltyProgram) to associate with the promotion. + * To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) + * using the `main` keyword. + */ + programId: string; + /** The loyalty promotion to create. */ + loyaltyPromotion: Square.LoyaltyPromotion; + /** + * A unique identifier for this request, which is used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey: string; +} diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsCancelRequest.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsCancelRequest.ts new file mode 100644 index 000000000..72b2af3c8 --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsCancelRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * promotionId: "promotion_id", + * programId: "program_id" + * } + */ +export interface PromotionsCancelRequest { + /** + * The ID of the [loyalty promotion](entity:LoyaltyPromotion) to cancel. You can cancel a + * promotion that has an `ACTIVE` or `SCHEDULED` status. + */ + promotionId: string; + /** + * The ID of the base [loyalty program](entity:LoyaltyProgram). + */ + programId: string; +} diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsGetRequest.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsGetRequest.ts new file mode 100644 index 000000000..562330e9a --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsGetRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * promotionId: "promotion_id", + * programId: "program_id" + * } + */ +export interface PromotionsGetRequest { + /** + * The ID of the [loyalty promotion](entity:LoyaltyPromotion) to retrieve. + */ + promotionId: string; + /** + * The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID, + * call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword. + */ + programId: string; +} diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsListRequest.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsListRequest.ts new file mode 100644 index 000000000..d9483060d --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/PromotionsListRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../../../index"; + +/** + * @example + * { + * programId: "program_id" + * } + */ +export interface PromotionsListRequest { + /** + * The ID of the base [loyalty program](entity:LoyaltyProgram). To get the program ID, + * call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword. + */ + programId: string; + /** + * The status to filter the results by. If a status is provided, only loyalty promotions + * with the specified status are returned. Otherwise, all loyalty promotions associated with + * the loyalty program are returned. + */ + status?: Square.LoyaltyPromotionStatus | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * The maximum number of results to return in a single paged response. + * The minimum value is 1 and the maximum value is 30. The default value is 30. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; +} diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/index.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/index.ts new file mode 100644 index 000000000..c14fc7a0b --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type PromotionsListRequest } from "./PromotionsListRequest"; +export { type CreateLoyaltyPromotionRequest } from "./CreateLoyaltyPromotionRequest"; +export { type PromotionsGetRequest } from "./PromotionsGetRequest"; +export { type PromotionsCancelRequest } from "./PromotionsCancelRequest"; diff --git a/src/api/resources/loyalty/resources/programs/resources/promotions/index.ts b/src/api/resources/loyalty/resources/programs/resources/promotions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/loyalty/resources/programs/resources/promotions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/loyalty/resources/rewards/client/Client.ts b/src/api/resources/loyalty/resources/rewards/client/Client.ts new file mode 100644 index 000000000..e222dfa70 --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/client/Client.ts @@ -0,0 +1,470 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Rewards { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Rewards { + constructor(protected readonly _options: Rewards.Options = {}) {} + + /** + * Creates a loyalty reward. In the process, the endpoint does following: + * + * - Uses the `reward_tier_id` in the request to determine the number of points + * to lock for this reward. + * - If the request includes `order_id`, it adds the reward and related discount to the order. + * + * After a reward is created, the points are locked and + * not available for the buyer to redeem another reward. + * + * @param {Square.loyalty.CreateLoyaltyRewardRequest} request + * @param {Rewards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.rewards.create({ + * reward: { + * loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + * rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" + * }, + * idempotencyKey: "18c2e5ea-a620-4b1f-ad60-7b167285e451" + * }) + */ + public async create( + request: Square.loyalty.CreateLoyaltyRewardRequest, + requestOptions?: Rewards.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/loyalty/rewards", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.CreateLoyaltyRewardRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateLoyaltyRewardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/loyalty/rewards."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. + * If you include a `query` object, `loyalty_account_id` is required and `status` is optional. + * + * If you know a reward ID, use the + * [RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint. + * + * Search results are sorted by `updated_at` in descending order. + * + * @param {Square.loyalty.SearchLoyaltyRewardsRequest} request + * @param {Rewards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.rewards.search({ + * query: { + * loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd" + * }, + * limit: 10 + * }) + */ + public async search( + request: Square.loyalty.SearchLoyaltyRewardsRequest = {}, + requestOptions?: Rewards.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/loyalty/rewards/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.SearchLoyaltyRewardsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchLoyaltyRewardsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/loyalty/rewards/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a loyalty reward. + * + * @param {Square.loyalty.RewardsGetRequest} request + * @param {Rewards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.rewards.get({ + * rewardId: "reward_id" + * }) + */ + public async get( + request: Square.loyalty.RewardsGetRequest, + requestOptions?: Rewards.RequestOptions, + ): Promise { + const { rewardId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/rewards/${encodeURIComponent(rewardId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetLoyaltyRewardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/loyalty/rewards/{reward_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a loyalty reward by doing the following: + * + * - Returns the loyalty points back to the loyalty account. + * - If an order ID was specified when the reward was created + * (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)), + * it updates the order by removing the reward and related + * discounts. + * + * You cannot delete a reward that has reached the terminal state (REDEEMED). + * + * @param {Square.loyalty.RewardsDeleteRequest} request + * @param {Rewards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.rewards.delete({ + * rewardId: "reward_id" + * }) + */ + public async delete( + request: Square.loyalty.RewardsDeleteRequest, + requestOptions?: Rewards.RequestOptions, + ): Promise { + const { rewardId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/rewards/${encodeURIComponent(rewardId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteLoyaltyRewardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/loyalty/rewards/{reward_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Redeems a loyalty reward. + * + * The endpoint sets the reward to the `REDEEMED` terminal state. + * + * If you are using your own order processing system (not using the + * Orders API), you call this endpoint after the buyer paid for the + * purchase. + * + * After the reward reaches the terminal state, it cannot be deleted. + * In other words, points used for the reward cannot be returned + * to the account. + * + * @param {Square.loyalty.RedeemLoyaltyRewardRequest} request + * @param {Rewards.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.loyalty.rewards.redeem({ + * rewardId: "reward_id", + * idempotencyKey: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", + * locationId: "P034NEENMD09F" + * }) + */ + public async redeem( + request: Square.loyalty.RedeemLoyaltyRewardRequest, + requestOptions?: Rewards.RequestOptions, + ): Promise { + const { rewardId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/loyalty/rewards/${encodeURIComponent(rewardId)}/redeem`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.loyalty.RedeemLoyaltyRewardRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RedeemLoyaltyRewardResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/loyalty/rewards/{reward_id}/redeem.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/loyalty/resources/rewards/client/index.ts b/src/api/resources/loyalty/resources/rewards/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts b/src/api/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts new file mode 100644 index 000000000..ae271caac --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * reward: { + * loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd", + * rewardTierId: "e1b39225-9da5-43d1-a5db-782cdd8ad94f", + * orderId: "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY" + * }, + * idempotencyKey: "18c2e5ea-a620-4b1f-ad60-7b167285e451" + * } + */ +export interface CreateLoyaltyRewardRequest { + /** The reward to create. */ + reward: Square.LoyaltyReward; + /** + * A unique string that identifies this `CreateLoyaltyReward` request. + * Keys can be any valid string, but must be unique for every request. + */ + idempotencyKey: string; +} diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts b/src/api/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts new file mode 100644 index 000000000..ee713cc43 --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * rewardId: "reward_id", + * idempotencyKey: "98adc7f7-6963-473b-b29c-f3c9cdd7d994", + * locationId: "P034NEENMD09F" + * } + */ +export interface RedeemLoyaltyRewardRequest { + /** + * The ID of the [loyalty reward](entity:LoyaltyReward) to redeem. + */ + rewardId: string; + /** + * A unique string that identifies this `RedeemLoyaltyReward` request. + * Keys can be any valid string, but must be unique for every request. + */ + idempotencyKey: string; + /** The ID of the [location](entity:Location) where the reward is redeemed. */ + locationId: string; +} diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/RewardsDeleteRequest.ts b/src/api/resources/loyalty/resources/rewards/client/requests/RewardsDeleteRequest.ts new file mode 100644 index 000000000..bc2de971b --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/client/requests/RewardsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * rewardId: "reward_id" + * } + */ +export interface RewardsDeleteRequest { + /** + * The ID of the [loyalty reward](entity:LoyaltyReward) to delete. + */ + rewardId: string; +} diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/RewardsGetRequest.ts b/src/api/resources/loyalty/resources/rewards/client/requests/RewardsGetRequest.ts new file mode 100644 index 000000000..51321c2a3 --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/client/requests/RewardsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * rewardId: "reward_id" + * } + */ +export interface RewardsGetRequest { + /** + * The ID of the [loyalty reward](entity:LoyaltyReward) to retrieve. + */ + rewardId: string; +} diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts b/src/api/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts new file mode 100644 index 000000000..17ef09df2 --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * query: { + * loyaltyAccountId: "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd" + * }, + * limit: 10 + * } + */ +export interface SearchLoyaltyRewardsRequest { + /** + * The search criteria for the request. + * If empty, the endpoint retrieves all loyalty rewards in the loyalty program. + */ + query?: Square.SearchLoyaltyRewardsRequestLoyaltyRewardQuery; + /** The maximum number of results to return in the response. The default value is 30. */ + limit?: number; + /** + * A pagination cursor returned by a previous call to + * this endpoint. Provide this to retrieve the next set of + * results for the original query. + * For more information, + * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/resources/loyalty/resources/rewards/client/requests/index.ts b/src/api/resources/loyalty/resources/rewards/client/requests/index.ts new file mode 100644 index 000000000..a56a6b75b --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type CreateLoyaltyRewardRequest } from "./CreateLoyaltyRewardRequest"; +export { type SearchLoyaltyRewardsRequest } from "./SearchLoyaltyRewardsRequest"; +export { type RewardsGetRequest } from "./RewardsGetRequest"; +export { type RewardsDeleteRequest } from "./RewardsDeleteRequest"; +export { type RedeemLoyaltyRewardRequest } from "./RedeemLoyaltyRewardRequest"; diff --git a/src/api/resources/loyalty/resources/rewards/index.ts b/src/api/resources/loyalty/resources/rewards/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/loyalty/resources/rewards/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/merchants/client/Client.ts b/src/api/resources/merchants/client/Client.ts new file mode 100644 index 000000000..5c80b93a4 --- /dev/null +++ b/src/api/resources/merchants/client/Client.ts @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client"; +import { CustomAttributes } from "../resources/customAttributes/client/Client"; + +export declare namespace Merchants { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Merchants { + protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; + protected _customAttributes: CustomAttributes | undefined; + + constructor(protected readonly _options: Merchants.Options = {}) {} + + public get customAttributeDefinitions(): CustomAttributeDefinitions { + return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); + } + + public get customAttributes(): CustomAttributes { + return (this._customAttributes ??= new CustomAttributes(this._options)); + } + + /** + * Provides details about the merchant associated with a given access token. + * + * The access token used to connect your application to a Square seller is associated + * with a single merchant. That means that `ListMerchants` returns a list + * with a single `Merchant` object. You can specify your personal access token + * to get your own merchant information or specify an OAuth token to get the + * information for the merchant that granted your application access. + * + * If you know the merchant ID, you can also use the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) + * endpoint to retrieve the merchant information. + * + * @param {Square.MerchantsListRequest} request + * @param {Merchants.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.list() + */ + public async list( + request: Square.MerchantsListRequest = {}, + requestOptions?: Merchants.RequestOptions, + ): Promise> { + const list = async (request: Square.MerchantsListRequest): Promise => { + const { cursor } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/merchants", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListMerchantsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/merchants."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.merchant ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves the `Merchant` object for the given `merchant_id`. + * + * @param {Square.MerchantsGetRequest} request + * @param {Merchants.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.get({ + * merchantId: "merchant_id" + * }) + */ + public async get( + request: Square.MerchantsGetRequest, + requestOptions?: Merchants.RequestOptions, + ): Promise { + const { merchantId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/merchants/${encodeURIComponent(merchantId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetMerchantResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/merchants/{merchant_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/merchants/client/index.ts b/src/api/resources/merchants/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/merchants/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/merchants/client/requests/MerchantsGetRequest.ts b/src/api/resources/merchants/client/requests/MerchantsGetRequest.ts new file mode 100644 index 000000000..fb486ff9e --- /dev/null +++ b/src/api/resources/merchants/client/requests/MerchantsGetRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * merchantId: "merchant_id" + * } + */ +export interface MerchantsGetRequest { + /** + * The ID of the merchant to retrieve. If the string "me" is supplied as the ID, + * then retrieve the merchant that is currently accessible to this call. + */ + merchantId: string; +} diff --git a/src/api/resources/merchants/client/requests/MerchantsListRequest.ts b/src/api/resources/merchants/client/requests/MerchantsListRequest.ts new file mode 100644 index 000000000..314d8b267 --- /dev/null +++ b/src/api/resources/merchants/client/requests/MerchantsListRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface MerchantsListRequest { + /** + * The cursor generated by the previous response. + */ + cursor?: number | null; +} diff --git a/src/api/resources/merchants/client/requests/index.ts b/src/api/resources/merchants/client/requests/index.ts new file mode 100644 index 000000000..6240d56ff --- /dev/null +++ b/src/api/resources/merchants/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type MerchantsListRequest } from "./MerchantsListRequest"; +export { type MerchantsGetRequest } from "./MerchantsGetRequest"; diff --git a/src/api/resources/merchants/index.ts b/src/api/resources/merchants/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/merchants/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts new file mode 100644 index 000000000..317b5cf6a --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/Client.ts @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributeDefinitions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributeDefinitions { + constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + + /** + * Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.merchants.CustomAttributeDefinitionsListRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributeDefinitions.list() + */ + public async list( + request: Square.merchants.CustomAttributeDefinitionsListRequest = {}, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { + const list = async ( + request: Square.merchants.CustomAttributeDefinitionsListRequest, + ): Promise => { + const { visibilityFilter, limit, cursor } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = serializers.VisibilityFilter.jsonOrThrow(visibilityFilter, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/merchants/custom-attribute-definitions", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListMerchantCustomAttributeDefinitionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/merchants/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable< + Square.ListMerchantCustomAttributeDefinitionsResponse, + Square.CustomAttributeDefinition + >({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributeDefinitions ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + * Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application. + * A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties + * for a custom attribute. After the definition is created, you can call + * [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) or + * [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) + * to set the custom attribute for a merchant. + * + * @param {Square.merchants.CreateMerchantCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributeDefinitions.create({ + * customAttributeDefinition: { + * key: "alternative_seller_name", + * schema: { + * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" + * }, + * name: "Alternative Merchant Name", + * description: "This is the other name this merchant goes by.", + * visibility: "VISIBILITY_READ_ONLY" + * } + * }) + */ + public async create( + request: Square.merchants.CreateMerchantCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/merchants/custom-attribute-definitions", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.merchants.CreateMerchantCustomAttributeDefinitionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateMerchantCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/merchants/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + * To retrieve a custom attribute definition created by another application, the `visibility` + * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.merchants.CustomAttributeDefinitionsGetRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributeDefinitions.get({ + * key: "key" + * }) + */ + public async get( + request: Square.merchants.CustomAttributeDefinitionsGetRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, version } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/merchants/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveMerchantCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/merchants/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + * Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the + * `schema` for a `Selection` data type. + * Only the definition owner can update a custom attribute definition. + * + * @param {Square.merchants.UpdateMerchantCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributeDefinitions.update({ + * key: "key", + * customAttributeDefinition: { + * description: "Update the description as desired.", + * visibility: "VISIBILITY_READ_ONLY" + * } + * }) + */ + public async update( + request: Square.merchants.UpdateMerchantCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/merchants/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.merchants.UpdateMerchantCustomAttributeDefinitionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateMerchantCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/merchants/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + * Deleting a custom attribute definition also deletes the corresponding custom attribute from + * the merchant. + * Only the definition owner can delete a custom attribute definition. + * + * @param {Square.merchants.CustomAttributeDefinitionsDeleteRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributeDefinitions.delete({ + * key: "key" + * }) + */ + public async delete( + request: Square.merchants.CustomAttributeDefinitionsDeleteRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/merchants/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteMerchantCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/merchants/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..023957369 --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * customAttributeDefinition: { + * key: "alternative_seller_name", + * schema: { + * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String" + * }, + * name: "Alternative Merchant Name", + * description: "This is the other name this merchant goes by.", + * visibility: "VISIBILITY_READ_ONLY" + * } + * } + */ +export interface CreateMerchantCustomAttributeDefinitionRequest { + /** + * The custom attribute definition to create. Note the following: + * - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema + * definition hosted on the Square CDN. For more information, including supported values and constraints, see + * [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types). + * - `name` is required unless `visibility` is set to `VISIBILITY_HIDDEN`. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string; +} diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts new file mode 100644 index 000000000..860f57efe --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsDeleteRequest { + /** + * The key of the custom attribute definition to delete. + */ + key: string; +} diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts new file mode 100644 index 000000000..4fe9ca10a --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsGetRequest { + /** + * The key of the custom attribute definition to retrieve. If the requesting application + * is not the definition owner, you must use the qualified key. + */ + key: string; + /** + * The current version of the custom attribute definition, which is used for strongly consistent + * reads to guarantee that you receive the most up-to-date data. When included in the request, + * Square returns the specified version or a higher version if one exists. If the specified version + * is higher than the current version, Square returns a `BAD_REQUEST` error. + */ + version?: number | null; +} diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts new file mode 100644 index 000000000..1f6083094 --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * {} + */ +export interface CustomAttributeDefinitionsListRequest { + /** + * Filters the `CustomAttributeDefinition` results by their `visibility` values. + */ + visibilityFilter?: Square.VisibilityFilter | null; + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; +} diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..16bfd1215 --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * key: "key", + * customAttributeDefinition: { + * description: "Update the description as desired.", + * visibility: "VISIBILITY_READ_ONLY" + * } + * } + */ +export interface UpdateMerchantCustomAttributeDefinitionRequest { + /** + * The key of the custom attribute definition to update. + */ + key: string; + /** + * The custom attribute definition that contains the fields to update. This endpoint + * supports sparse updates, so only new or changed fields need to be included in the request. + * Only the following fields can be updated: + * - `name` + * - `description` + * - `visibility` + * - `schema` for a `Selection` data type. Only changes to the named options or the maximum number of allowed + * selections are supported. + * For more information, see + * [Update a merchant custom attribute definition](https://developer.squareup.com/docs/merchant-custom-attributes-api/custom-attribute-definitions#update-custom-attribute-definition). + * The version field must match the current version of the custom attribute definition to enable + * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..4215d30fd --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type CustomAttributeDefinitionsListRequest } from "./CustomAttributeDefinitionsListRequest"; +export { type CreateMerchantCustomAttributeDefinitionRequest } from "./CreateMerchantCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsGetRequest } from "./CustomAttributeDefinitionsGetRequest"; +export { type UpdateMerchantCustomAttributeDefinitionRequest } from "./UpdateMerchantCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsDeleteRequest } from "./CustomAttributeDefinitionsDeleteRequest"; diff --git a/src/api/resources/merchants/resources/customAttributeDefinitions/index.ts b/src/api/resources/merchants/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/merchants/resources/customAttributes/client/Client.ts b/src/api/resources/merchants/resources/customAttributes/client/Client.ts new file mode 100644 index 000000000..41049fb44 --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/Client.ts @@ -0,0 +1,600 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributes { + constructor(protected readonly _options: CustomAttributes.Options = {}) {} + + /** + * Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. + * To delete a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.merchants.BulkDeleteMerchantCustomAttributesRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributes.batchDelete({ + * values: { + * "id1": { + * key: "alternative_seller_name" + * }, + * "id2": { + * key: "has_seen_tutorial" + * } + * } + * }) + */ + public async batchDelete( + request: Square.merchants.BulkDeleteMerchantCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/merchants/custom-attributes/bulk-delete", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.merchants.BulkDeleteMerchantCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkDeleteMerchantCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/merchants/custom-attributes/bulk-delete.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. + * Use this endpoint to set the value of one or more custom attributes for a merchant. + * A custom attribute is based on a custom attribute definition in a Square seller account, which is + * created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint. + * This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + * requests and returns a map of individual upsert responses. Each upsert request has a unique ID + * and provides a merchant ID and custom attribute. Each upsert response is returned with the ID + * of the corresponding request. + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.merchants.BulkUpsertMerchantCustomAttributesRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributes.batchUpsert({ + * values: { + * "id1": { + * merchantId: "DM7VKY8Q63GNP", + * customAttribute: { + * key: "alternative_seller_name", + * value: "Ultimate Sneaker Store" + * } + * }, + * "id2": { + * merchantId: "DM7VKY8Q63GNP", + * customAttribute: { + * key: "has_seen_tutorial", + * value: true + * } + * } + * } + * }) + */ + public async batchUpsert( + request: Square.merchants.BulkUpsertMerchantCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/merchants/custom-attributes/bulk-upsert", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.merchants.BulkUpsertMerchantCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkUpsertMerchantCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/merchants/custom-attributes/bulk-upsert.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Lists the [custom attributes](entity:CustomAttribute) associated with a merchant. + * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + * in the same call. + * When all response pages are retrieved, the results include all custom attributes that are + * visible to the requesting application, including those that are owned by other applications + * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.merchants.CustomAttributesListRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributes.list({ + * merchantId: "merchant_id" + * }) + */ + public async list( + request: Square.merchants.CustomAttributesListRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const list = async ( + request: Square.merchants.CustomAttributesListRequest, + ): Promise => { + const { merchantId, visibilityFilter, limit, cursor, withDefinitions } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = serializers.VisibilityFilter.jsonOrThrow(visibilityFilter, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (withDefinitions !== undefined) { + _queryParams["with_definitions"] = withDefinitions?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/merchants/${encodeURIComponent(merchantId)}/custom-attributes`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListMerchantCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/merchants/{merchant_id}/custom-attributes.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves a [custom attribute](entity:CustomAttribute) associated with a merchant. + * You can use the `with_definition` query parameter to also retrieve the custom attribute definition + * in the same call. + * To retrieve a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.merchants.CustomAttributesGetRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributes.get({ + * merchantId: "merchant_id", + * key: "key" + * }) + */ + public async get( + request: Square.merchants.CustomAttributesGetRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { merchantId, key, withDefinition, version } = request; + const _queryParams: Record = {}; + if (withDefinition !== undefined) { + _queryParams["with_definition"] = withDefinition?.toString() ?? null; + } + + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/merchants/${encodeURIComponent(merchantId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveMerchantCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/merchants/{merchant_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates a [custom attribute](entity:CustomAttribute) for a merchant. + * Use this endpoint to set the value of a custom attribute for a specified merchant. + * A custom attribute is based on a custom attribute definition in a Square seller account, which + * is created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint. + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.merchants.UpsertMerchantCustomAttributeRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributes.upsert({ + * merchantId: "merchant_id", + * key: "key", + * customAttribute: { + * value: "Ultimate Sneaker Store" + * } + * }) + */ + public async upsert( + request: Square.merchants.UpsertMerchantCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { merchantId, key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/merchants/${encodeURIComponent(merchantId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.merchants.UpsertMerchantCustomAttributeRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpsertMerchantCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/merchants/{merchant_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a [custom attribute](entity:CustomAttribute) associated with a merchant. + * To delete a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.merchants.CustomAttributesDeleteRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.merchants.customAttributes.delete({ + * merchantId: "merchant_id", + * key: "key" + * }) + */ + public async delete( + request: Square.merchants.CustomAttributesDeleteRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { merchantId, key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/merchants/${encodeURIComponent(merchantId)}/custom-attributes/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteMerchantCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/merchants/{merchant_id}/custom-attributes/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/merchants/resources/customAttributes/client/index.ts b/src/api/resources/merchants/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts new file mode 100644 index 000000000..08cb2ddaf --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "id1": { + * key: "alternative_seller_name" + * }, + * "id2": { + * key: "has_seen_tutorial" + * } + * } + * } + */ +export interface BulkDeleteMerchantCustomAttributesRequest { + /** + * The data used to update the `CustomAttribute` objects. + * The keys must be unique and are used to map to the corresponding response. + */ + values: Record; +} diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts new file mode 100644 index 000000000..2c267173d --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "id1": { + * merchantId: "DM7VKY8Q63GNP", + * customAttribute: { + * key: "alternative_seller_name", + * value: "Ultimate Sneaker Store" + * } + * }, + * "id2": { + * merchantId: "DM7VKY8Q63GNP", + * customAttribute: { + * key: "has_seen_tutorial", + * value: true + * } + * } + * } + * } + */ +export interface BulkUpsertMerchantCustomAttributesRequest { + /** + * A map containing 1 to 25 individual upsert requests. For each request, provide an + * arbitrary ID that is unique for this `BulkUpsertMerchantCustomAttributes` request and the + * information needed to create or update a custom attribute. + */ + values: Record; +} diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts new file mode 100644 index 000000000..bc585a3c3 --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * merchantId: "merchant_id", + * key: "key" + * } + */ +export interface CustomAttributesDeleteRequest { + /** + * The ID of the target [merchant](entity:Merchant). + */ + merchantId: string; + /** + * The key of the custom attribute to delete. This key must match the `key` of a custom + * attribute definition in the Square seller account. If the requesting application is not the + * definition owner, you must use the qualified key. + */ + key: string; +} diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts new file mode 100644 index 000000000..b17b638ac --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * merchantId: "merchant_id", + * key: "key" + * } + */ +export interface CustomAttributesGetRequest { + /** + * The ID of the target [merchant](entity:Merchant). + */ + merchantId: string; + /** + * The key of the custom attribute to retrieve. This key must match the `key` of a custom + * attribute definition in the Square seller account. If the requesting application is not the + * definition owner, you must use the qualified key. + */ + key: string; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of + * the custom attribute. Set this parameter to `true` to get the name and description of the custom + * attribute, information about the data type, or other definition details. The default value is `false`. + */ + withDefinition?: boolean | null; + /** + * The current version of the custom attribute, which is used for strongly consistent reads to + * guarantee that you receive the most up-to-date data. When included in the request, Square + * returns the specified version or a higher version if one exists. If the specified version is + * higher than the current version, Square returns a `BAD_REQUEST` error. + */ + version?: number | null; +} diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesListRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesListRequest.ts new file mode 100644 index 000000000..a7e1de2f3 --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/CustomAttributesListRequest.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * merchantId: "merchant_id" + * } + */ +export interface CustomAttributesListRequest { + /** + * The ID of the target [merchant](entity:Merchant). + */ + merchantId: string; + /** + * Filters the `CustomAttributeDefinition` results by their `visibility` values. + */ + visibilityFilter?: Square.VisibilityFilter | null; + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + limit?: number | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. For more + * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom + * attribute, information about the data type, or other definition details. The default value is `false`. + */ + withDefinitions?: boolean | null; +} diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts new file mode 100644 index 000000000..b798742bf --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * merchantId: "merchant_id", + * key: "key", + * customAttribute: { + * value: "Ultimate Sneaker Store" + * } + * } + */ +export interface UpsertMerchantCustomAttributeRequest { + /** + * The ID of the target [merchant](entity:Merchant). + */ + merchantId: string; + /** + * The key of the custom attribute to create or update. This key must match the `key` of a + * custom attribute definition in the Square seller account. If the requesting application is not + * the definition owner, you must use the qualified key. + */ + key: string; + /** + * The custom attribute to create or update, with the following fields: + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types). + * - The version field must match the current version of the custom attribute definition to enable + * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this request, used to ensure idempotency. For more information, + * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/merchants/resources/customAttributes/client/requests/index.ts b/src/api/resources/merchants/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..243a69bfe --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,6 @@ +export { type BulkDeleteMerchantCustomAttributesRequest } from "./BulkDeleteMerchantCustomAttributesRequest"; +export { type BulkUpsertMerchantCustomAttributesRequest } from "./BulkUpsertMerchantCustomAttributesRequest"; +export { type CustomAttributesListRequest } from "./CustomAttributesListRequest"; +export { type CustomAttributesGetRequest } from "./CustomAttributesGetRequest"; +export { type UpsertMerchantCustomAttributeRequest } from "./UpsertMerchantCustomAttributeRequest"; +export { type CustomAttributesDeleteRequest } from "./CustomAttributesDeleteRequest"; diff --git a/src/api/resources/merchants/resources/customAttributes/index.ts b/src/api/resources/merchants/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/merchants/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/merchants/resources/index.ts b/src/api/resources/merchants/resources/index.ts new file mode 100644 index 000000000..bfa7c90b7 --- /dev/null +++ b/src/api/resources/merchants/resources/index.ts @@ -0,0 +1,4 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * as customAttributes from "./customAttributes"; +export * from "./customAttributeDefinitions/client/requests"; +export * from "./customAttributes/client/requests"; diff --git a/src/api/resources/mobile/client/Client.ts b/src/api/resources/mobile/client/Client.ts new file mode 100644 index 000000000..df253d6cd --- /dev/null +++ b/src/api/resources/mobile/client/Client.ts @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Mobile { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Mobile { + constructor(protected readonly _options: Mobile.Options = {}) {} + + /** + * Generates code to authorize a mobile application to connect to a Square card reader. + * + * Authorization codes are one-time-use codes and expire 60 minutes after being issued. + * + * __Important:__ The `Authorization` header you provide to this endpoint must have the following format: + * + * ``` + * Authorization: Bearer ACCESS_TOKEN + * ``` + * + * Replace `ACCESS_TOKEN` with a + * [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). + * + * @param {Square.CreateMobileAuthorizationCodeRequest} request + * @param {Mobile.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.mobile.authorizationCode({ + * locationId: "YOUR_LOCATION_ID" + * }) + */ + public async authorizationCode( + request: Square.CreateMobileAuthorizationCodeRequest = {}, + requestOptions?: Mobile.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "mobile/authorization-code", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateMobileAuthorizationCodeRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateMobileAuthorizationCodeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /mobile/authorization-code."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/mobile/client/index.ts b/src/api/resources/mobile/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/mobile/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts b/src/api/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts new file mode 100644 index 000000000..3620d5786 --- /dev/null +++ b/src/api/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "YOUR_LOCATION_ID" + * } + */ +export interface CreateMobileAuthorizationCodeRequest { + /** The Square location ID that the authorization code should be tied to. */ + locationId?: string; +} diff --git a/src/api/resources/mobile/client/requests/index.ts b/src/api/resources/mobile/client/requests/index.ts new file mode 100644 index 000000000..1d310fdf0 --- /dev/null +++ b/src/api/resources/mobile/client/requests/index.ts @@ -0,0 +1 @@ +export { type CreateMobileAuthorizationCodeRequest } from "./CreateMobileAuthorizationCodeRequest"; diff --git a/src/api/resources/mobile/index.ts b/src/api/resources/mobile/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/mobile/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/oAuth/client/Client.ts b/src/api/resources/oAuth/client/Client.ts new file mode 100644 index 000000000..5c21f9b5b --- /dev/null +++ b/src/api/resources/oAuth/client/Client.ts @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace OAuth { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class OAuth { + constructor(protected readonly _options: OAuth.Options = {}) {} + + /** + * Revokes an access token generated with the OAuth flow. + * + * If an account has more than one OAuth access token for your application, this + * endpoint revokes all of them, regardless of which token you specify. + * + * __Important:__ The `Authorization` header for this endpoint must have the + * following format: + * + * ``` + * Authorization: Client APPLICATION_SECRET + * ``` + * + * Replace `APPLICATION_SECRET` with the application secret on the **OAuth** + * page for your application in the Developer Dashboard. + * + * @param {Square.RevokeTokenRequest} request + * @param {OAuth.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.oAuth.revokeToken({ + * clientId: "CLIENT_ID", + * accessToken: "ACCESS_TOKEN" + * }) + */ + public async revokeToken( + request: Square.RevokeTokenRequest = {}, + requestOptions?: OAuth.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "oauth2/revoke", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.RevokeTokenRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RevokeTokenResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /oauth2/revoke."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns an OAuth access token and a refresh token unless the + * `short_lived` parameter is set to `true`, in which case the endpoint + * 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'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. + * + * You can use the `scopes` parameter to limit the set of permissions granted + * to the access token and refresh token. You can use the `short_lived` parameter + * to create an access token that expires in 24 hours. + * + * __Note:__ OAuth tokens should be encrypted and stored on a secure server. + * Application clients should never interact directly with OAuth tokens. + * + * @param {Square.ObtainTokenRequest} request + * @param {OAuth.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.oAuth.obtainToken({ + * clientId: "APPLICATION_ID", + * clientSecret: "APPLICATION_SECRET", + * code: "CODE_FROM_AUTHORIZE", + * grantType: "authorization_code" + * }) + */ + public async obtainToken( + request: Square.ObtainTokenRequest, + requestOptions?: OAuth.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "oauth2/token", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.ObtainTokenRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ObtainTokenResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /oauth2/token."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token). + * + * Add the access token to the Authorization header of the request. + * + * __Important:__ The `Authorization` header you provide to this endpoint must have the following format: + * + * ``` + * Authorization: Bearer ACCESS_TOKEN + * ``` + * + * where `ACCESS_TOKEN` is a + * [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). + * + * If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error. + * + * @param {OAuth.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.oAuth.retrieveTokenStatus() + */ + public async retrieveTokenStatus( + requestOptions?: OAuth.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "oauth2/token/status", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveTokenStatusResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /oauth2/token/status."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * @param {OAuth.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.oAuth.authorize() + */ + public async authorize(requestOptions?: OAuth.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "oauth2/authorize", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /oauth2/authorize."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/oAuth/client/index.ts b/src/api/resources/oAuth/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/oAuth/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/oAuth/client/requests/ObtainTokenRequest.ts b/src/api/resources/oAuth/client/requests/ObtainTokenRequest.ts new file mode 100644 index 000000000..ae48505df --- /dev/null +++ b/src/api/resources/oAuth/client/requests/ObtainTokenRequest.ts @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * clientId: "APPLICATION_ID", + * clientSecret: "APPLICATION_SECRET", + * code: "CODE_FROM_AUTHORIZE", + * grantType: "authorization_code" + * } + */ +export interface ObtainTokenRequest { + /** + * 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 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; + /** + * 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. + */ + code?: string | null; + /** 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. + * Valid values are `authorization_code`, `refresh_token`, and `migration_token`. + */ + grantType: string; + /** + * 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. + */ + refreshToken?: string | null; + /** + * 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). + */ + migrationToken?: string | null; + /** + * 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. + */ + scopes?: string[] | null; + /** + * A Boolean indicating a request for a short-lived access token. + * + * The short-lived access token returned in the response expires in 24 hours. + */ + shortLived?: boolean | null; + /** + * 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/api/resources/oAuth/client/requests/RevokeTokenRequest.ts b/src/api/resources/oAuth/client/requests/RevokeTokenRequest.ts new file mode 100644 index 000000000..206891192 --- /dev/null +++ b/src/api/resources/oAuth/client/requests/RevokeTokenRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * clientId: "CLIENT_ID", + * accessToken: "ACCESS_TOKEN" + * } + */ +export interface RevokeTokenRequest { + /** + * 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; + /** + * 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. + */ + accessToken?: string | null; + /** + * The ID of the merchant whose token you want to revoke. + * Do not provide a value for `access_token` if you provide this parameter. + */ + merchantId?: string | null; + /** + * If `true`, terminate the given single access token, but do not + * terminate the entire authorization. + * Default: `false` + */ + revokeOnlyAccessToken?: boolean | null; +} diff --git a/src/api/resources/oAuth/client/requests/index.ts b/src/api/resources/oAuth/client/requests/index.ts new file mode 100644 index 000000000..b92160be5 --- /dev/null +++ b/src/api/resources/oAuth/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type RevokeTokenRequest } from "./RevokeTokenRequest"; +export { type ObtainTokenRequest } from "./ObtainTokenRequest"; diff --git a/src/api/resources/oAuth/index.ts b/src/api/resources/oAuth/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/oAuth/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/orders/client/Client.ts b/src/api/resources/orders/client/Client.ts new file mode 100644 index 000000000..e9da0425a --- /dev/null +++ b/src/api/resources/orders/client/Client.ts @@ -0,0 +1,826 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; +import { CustomAttributeDefinitions } from "../resources/customAttributeDefinitions/client/Client"; +import { CustomAttributes } from "../resources/customAttributes/client/Client"; + +export declare namespace Orders { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Orders { + protected _customAttributeDefinitions: CustomAttributeDefinitions | undefined; + protected _customAttributes: CustomAttributes | undefined; + + constructor(protected readonly _options: Orders.Options = {}) {} + + public get customAttributeDefinitions(): CustomAttributeDefinitions { + return (this._customAttributeDefinitions ??= new CustomAttributeDefinitions(this._options)); + } + + public get customAttributes(): CustomAttributes { + return (this._customAttributes ??= new CustomAttributes(this._options)); + } + + /** + * Creates a new [order](entity:Order) that can include information about products for + * purchase and settings to apply to the purchase. + * + * To pay for a created order, see + * [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). + * + * You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint. + * + * @param {Square.CreateOrderRequest} request + * @param {Orders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.create({ + * order: { + * locationId: "057P5VYJ4A5X1", + * referenceId: "my-order-001", + * lineItems: [{ + * name: "New York Strip Steak", + * quantity: "1", + * basePriceMoney: { + * amount: 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: 100, + * currency: "USD" + * }, + * scope: "LINE_ITEM" + * }] + * }, + * idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf" + * }) + */ + public async create( + request: Square.CreateOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateOrderRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a set of [orders](entity:Order) by their IDs. + * + * If a given order ID does not exist, the ID is ignored instead of generating an error. + * + * @param {Square.BatchGetOrdersRequest} request + * @param {Orders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.batchGet({ + * locationId: "057P5VYJ4A5X1", + * orderIds: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"] + * }) + */ + public async batchGet( + request: Square.BatchGetOrdersRequest, + requestOptions?: Orders.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders/batch-retrieve", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchGetOrdersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchGetOrdersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders/batch-retrieve."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Enables applications to preview order pricing without creating an order. + * + * @param {Square.CalculateOrderRequest} request + * @param {Orders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.calculate({ + * order: { + * locationId: "D7AVYMEAPJ3A3", + * lineItems: [{ + * name: "Item 1", + * quantity: "1", + * basePriceMoney: { + * amount: 500, + * currency: "USD" + * } + * }, { + * name: "Item 2", + * quantity: "2", + * basePriceMoney: { + * amount: 300, + * currency: "USD" + * } + * }], + * discounts: [{ + * name: "50% Off", + * percentage: "50", + * scope: "ORDER" + * }] + * } + * }) + */ + public async calculate( + request: Square.CalculateOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders/calculate", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CalculateOrderRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CalculateOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders/calculate."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has + * only the core fields (such as line items, taxes, and discounts) copied from the original order. + * + * @param {Square.CloneOrderRequest} request + * @param {Orders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.clone({ + * orderId: "ZAISEM52YcpmcWAzERDOyiWS123", + * version: 3, + * idempotencyKey: "UNIQUE_STRING" + * }) + */ + public async clone( + request: Square.CloneOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders/clone", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CloneOrderRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CloneOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders/clone."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Search all orders for one or more locations. Orders include all sales, + * returns, and exchanges regardless of how or when they entered the Square + * ecosystem (such as Point of Sale, Invoices, and Connect APIs). + * + * `SearchOrders` requests need to specify which locations to search and define a + * [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls + * how to sort or filter the results. Your `SearchOrdersQuery` can: + * + * Set filter criteria. + * Set the sort order. + * Determine whether to return results as complete `Order` objects or as + * [OrderEntry](entity:OrderEntry) objects. + * + * Note that details for orders processed with Square Point of Sale while in + * offline mode might not be transmitted to Square for up to 72 hours. Offline + * orders have a `created_at` value that reflects the time the order was created, + * not the time it was subsequently transmitted to Square. + * + * @param {Square.SearchOrdersRequest} request + * @param {Orders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.search({ + * 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 + * }) + */ + public async search( + request: Square.SearchOrdersRequest = {}, + requestOptions?: Orders.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchOrdersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchOrdersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves an [Order](entity:Order) by ID. + * + * @param {Square.OrdersGetRequest} request + * @param {Orders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.get({ + * orderId: "order_id" + * }) + */ + public async get( + request: Square.OrdersGetRequest, + requestOptions?: Orders.RequestOptions, + ): Promise { + const { orderId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/${encodeURIComponent(orderId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/orders/{order_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates an open [order](entity:Order) by adding, replacing, or deleting + * fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. + * + * An `UpdateOrder` request requires the following: + * + * - The `order_id` in the endpoint path, identifying the order to update. + * - The latest `version` of the order to update. + * - The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects) + * containing only the fields to update and the version to which the update is + * being applied. + * - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete) + * identifying the fields to clear. + * + * To pay for an order, see + * [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). + * + * @param {Square.UpdateOrderRequest} request + * @param {Orders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.update({ + * orderId: "order_id", + * order: { + * locationId: "location_id", + * lineItems: [{ + * uid: "cookie_uid", + * name: "COOKIE", + * quantity: "2", + * basePriceMoney: { + * amount: 200, + * currency: "USD" + * } + * }], + * version: 1 + * }, + * fieldsToClear: ["discounts"], + * idempotencyKey: "UNIQUE_STRING" + * }) + */ + public async update( + request: Square.UpdateOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise { + const { orderId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/${encodeURIComponent(orderId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateOrderRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/orders/{order_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment) + * or settle an order with a total of `0`. + * + * The total of the `payment_ids` listed in the request must be equal to the order + * total. Orders with a total amount of `0` can be marked as paid by specifying an empty + * array of `payment_ids` in the request. + * + * To be used with `PayOrder`, a payment must: + * + * - Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment). + * Any approved payments that reference the same `order_id` not specified in the + * `payment_ids` is canceled. + * - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture). + * Using a delayed capture payment with `PayOrder` completes the approved payment. + * + * @param {Square.PayOrderRequest} request + * @param {Orders.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.pay({ + * orderId: "order_id", + * idempotencyKey: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", + * paymentIds: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"] + * }) + */ + public async pay( + request: Square.PayOrderRequest, + requestOptions?: Orders.RequestOptions, + ): Promise { + const { orderId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/${encodeURIComponent(orderId)}/pay`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.PayOrderRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.PayOrderResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/orders/{order_id}/pay."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/orders/client/index.ts b/src/api/resources/orders/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/orders/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/orders/client/requests/BatchGetOrdersRequest.ts b/src/api/resources/orders/client/requests/BatchGetOrdersRequest.ts new file mode 100644 index 000000000..96c31a8df --- /dev/null +++ b/src/api/resources/orders/client/requests/BatchGetOrdersRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "057P5VYJ4A5X1", + * orderIds: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"] + * } + */ +export interface BatchGetOrdersRequest { + /** + * The ID of the location for these orders. This field is optional: omit it to retrieve + * orders within the scope of the current authorization's merchant ID. + */ + locationId?: string | null; + /** The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request. */ + orderIds: string[]; +} diff --git a/src/api/resources/orders/client/requests/CalculateOrderRequest.ts b/src/api/resources/orders/client/requests/CalculateOrderRequest.ts new file mode 100644 index 000000000..416893d0b --- /dev/null +++ b/src/api/resources/orders/client/requests/CalculateOrderRequest.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * order: { + * locationId: "D7AVYMEAPJ3A3", + * lineItems: [{ + * name: "Item 1", + * quantity: "1", + * basePriceMoney: { + * amount: 500, + * currency: "USD" + * } + * }, { + * name: "Item 2", + * quantity: "2", + * basePriceMoney: { + * amount: 300, + * currency: "USD" + * } + * }], + * discounts: [{ + * name: "50% Off", + * percentage: "50", + * scope: "ORDER" + * }] + * } + * } + */ +export interface CalculateOrderRequest { + /** The order to be calculated. Expects the entire order, not a sparse update. */ + order: Square.Order; + /** + * Identifies one or more loyalty reward tiers to apply during the order calculation. + * The discounts defined by the reward tiers are added to the order only to preview the + * effect of applying the specified rewards. The rewards do not correspond to actual + * redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are + * random strings used only to reference the reward tier. + */ + proposedRewards?: Square.OrderReward[] | null; +} diff --git a/src/api/resources/orders/client/requests/CloneOrderRequest.ts b/src/api/resources/orders/client/requests/CloneOrderRequest.ts new file mode 100644 index 000000000..e246451d0 --- /dev/null +++ b/src/api/resources/orders/client/requests/CloneOrderRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * orderId: "ZAISEM52YcpmcWAzERDOyiWS123", + * version: 3, + * idempotencyKey: "UNIQUE_STRING" + * } + */ +export interface CloneOrderRequest { + /** The ID of the order to clone. */ + orderId: string; + /** + * An optional order version for concurrency protection. + * + * If a version is provided, it must match the latest stored version of the order to clone. + * If a version is not provided, the API clones the latest version. + */ + version?: number; + /** + * A value you specify that uniquely identifies this clone request. + * + * If you are unsure whether a particular order was cloned successfully, + * you can reattempt the call with the same idempotency key without + * worrying about creating duplicate cloned orders. + * The originally cloned order is returned. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/orders/client/requests/OrdersGetRequest.ts b/src/api/resources/orders/client/requests/OrdersGetRequest.ts new file mode 100644 index 000000000..0812c48f4 --- /dev/null +++ b/src/api/resources/orders/client/requests/OrdersGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * orderId: "order_id" + * } + */ +export interface OrdersGetRequest { + /** + * The ID of the order to retrieve. + */ + orderId: string; +} diff --git a/src/api/resources/orders/client/requests/PayOrderRequest.ts b/src/api/resources/orders/client/requests/PayOrderRequest.ts new file mode 100644 index 000000000..3d74c7950 --- /dev/null +++ b/src/api/resources/orders/client/requests/PayOrderRequest.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * orderId: "order_id", + * idempotencyKey: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", + * paymentIds: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"] + * } + */ +export interface PayOrderRequest { + /** + * The ID of the order being paid. + */ + orderId: string; + /** + * A value you specify that uniquely identifies this request among requests you have sent. If + * you are unsure whether a particular payment request was completed successfully, you can reattempt + * it with the same idempotency key without worrying about duplicate payments. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + */ + idempotencyKey: string; + /** The version of the order being paid. If not supplied, the latest version will be paid. */ + orderVersion?: number | null; + /** + * The IDs of the [payments](entity:Payment) to collect. + * The payment total must match the order total. + */ + paymentIds?: string[] | null; +} diff --git a/src/api/resources/orders/client/requests/SearchOrdersRequest.ts b/src/api/resources/orders/client/requests/SearchOrdersRequest.ts new file mode 100644 index 000000000..5313f9d5d --- /dev/null +++ b/src/api/resources/orders/client/requests/SearchOrdersRequest.ts @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * 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 + * } + */ +export interface SearchOrdersRequest { + /** + * The location IDs for the orders to query. All locations must belong to + * the same merchant. + * + * Max: 10 location IDs. + */ + locationIds?: string[]; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for your original query. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** + * Query conditions used to filter or sort the results. Note that when + * retrieving additional pages using a cursor, you must use the original query. + */ + query?: Square.SearchOrdersQuery; + /** + * The maximum number of results to be returned in a single page. + * + * Default: `500` + * Max: `1000` + */ + limit?: number; + /** + * A Boolean that controls the format of the search results. If `true`, + * `SearchOrders` returns [OrderEntry](entity:OrderEntry) objects. If `false`, `SearchOrders` + * returns complete order objects. + * + * Default: `false`. + */ + returnEntries?: boolean; +} diff --git a/src/api/resources/orders/client/requests/UpdateOrderRequest.ts b/src/api/resources/orders/client/requests/UpdateOrderRequest.ts new file mode 100644 index 000000000..ae35505ad --- /dev/null +++ b/src/api/resources/orders/client/requests/UpdateOrderRequest.ts @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * orderId: "order_id", + * order: { + * locationId: "location_id", + * lineItems: [{ + * uid: "cookie_uid", + * name: "COOKIE", + * quantity: "2", + * basePriceMoney: { + * amount: 200, + * currency: "USD" + * } + * }], + * version: 1 + * }, + * fieldsToClear: ["discounts"], + * idempotencyKey: "UNIQUE_STRING" + * } + */ +export interface UpdateOrderRequest { + /** + * The ID of the order to update. + */ + orderId: string; + /** + * The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects) + * containing only the fields to update and the version to which the update is + * being applied. + */ + order?: Square.Order; + /** + * The [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete) + * fields to clear. For example, `line_items[uid].note`. + * For more information, see [Deleting fields](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#deleting-fields). + */ + fieldsToClear?: string[] | null; + /** + * A value you specify that uniquely identifies this update request. + * + * If you are unsure whether a particular update was applied to an order successfully, + * you can reattempt it with the same idempotency key without + * worrying about creating duplicate updates to the order. + * The latest order version is returned. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/orders/client/requests/index.ts b/src/api/resources/orders/client/requests/index.ts new file mode 100644 index 000000000..5d728a480 --- /dev/null +++ b/src/api/resources/orders/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type BatchGetOrdersRequest } from "./BatchGetOrdersRequest"; +export { type CalculateOrderRequest } from "./CalculateOrderRequest"; +export { type CloneOrderRequest } from "./CloneOrderRequest"; +export { type SearchOrdersRequest } from "./SearchOrdersRequest"; +export { type OrdersGetRequest } from "./OrdersGetRequest"; +export { type UpdateOrderRequest } from "./UpdateOrderRequest"; +export { type PayOrderRequest } from "./PayOrderRequest"; diff --git a/src/api/resources/orders/index.ts b/src/api/resources/orders/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/orders/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts new file mode 100644 index 000000000..16e0a236a --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/Client.ts @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributeDefinitions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributeDefinitions { + constructor(protected readonly _options: CustomAttributeDefinitions.Options = {}) {} + + /** + * Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + * + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that + * seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.orders.CustomAttributeDefinitionsListRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributeDefinitions.list() + */ + public async list( + request: Square.orders.CustomAttributeDefinitionsListRequest = {}, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise> { + const list = async ( + request: Square.orders.CustomAttributeDefinitionsListRequest, + ): Promise => { + const { visibilityFilter, cursor, limit } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = serializers.VisibilityFilter.jsonOrThrow(visibilityFilter, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders/custom-attribute-definitions", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListOrderCustomAttributeDefinitionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/orders/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributeDefinitions ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates an order-related custom attribute definition. Use this endpoint to + * define a custom attribute that can be associated with orders. + * + * After creating a custom attribute definition, you can set the custom attribute for orders + * in the Square seller account. + * + * @param {Square.orders.CreateOrderCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributeDefinitions.create({ + * customAttributeDefinition: { + * key: "cover-count", + * schema: { + * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number" + * }, + * name: "Cover count", + * description: "The number of people seated at a table", + * visibility: "VISIBILITY_READ_WRITE_VALUES" + * }, + * idempotencyKey: "IDEMPOTENCY_KEY" + * }) + */ + public async create( + request: Square.orders.CreateOrderCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders/custom-attribute-definitions", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.orders.CreateOrderCustomAttributeDefinitionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateOrderCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/orders/custom-attribute-definitions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + * + * To retrieve a custom attribute definition created by another application, the `visibility` + * setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.orders.CustomAttributeDefinitionsGetRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributeDefinitions.get({ + * key: "key" + * }) + */ + public async get( + request: Square.orders.CustomAttributeDefinitionsGetRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, version } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveOrderCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/orders/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates an order-related custom attribute definition for a Square seller account. + * + * Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. + * + * @param {Square.orders.UpdateOrderCustomAttributeDefinitionRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributeDefinitions.update({ + * key: "key", + * customAttributeDefinition: { + * key: "cover-count", + * visibility: "VISIBILITY_READ_ONLY", + * version: 1 + * }, + * idempotencyKey: "IDEMPOTENCY_KEY" + * }) + */ + public async update( + request: Square.orders.UpdateOrderCustomAttributeDefinitionRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.orders.UpdateOrderCustomAttributeDefinitionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateOrderCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/orders/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + * + * Only the definition owner can delete a custom attribute definition. + * + * @param {Square.orders.CustomAttributeDefinitionsDeleteRequest} request + * @param {CustomAttributeDefinitions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributeDefinitions.delete({ + * key: "key" + * }) + */ + public async delete( + request: Square.orders.CustomAttributeDefinitionsDeleteRequest, + requestOptions?: CustomAttributeDefinitions.RequestOptions, + ): Promise { + const { key } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/custom-attribute-definitions/${encodeURIComponent(key)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteOrderCustomAttributeDefinitionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/orders/custom-attribute-definitions/{key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/index.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..7dd420311 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * customAttributeDefinition: { + * key: "cover-count", + * schema: { + * "ref": "https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.Number" + * }, + * name: "Cover count", + * description: "The number of people seated at a table", + * visibility: "VISIBILITY_READ_WRITE_VALUES" + * }, + * idempotencyKey: "IDEMPOTENCY_KEY" + * } + */ +export interface CreateOrderCustomAttributeDefinitionRequest { + /** + * The custom attribute definition to create. Note the following: + * - With the exception of the `Selection` data type, the `schema` is specified as a simple URL to the JSON schema + * definition hosted on the Square CDN. For more information, including supported values and constraints, see + * [Specifying the schema](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attribute-definitions#specify-schema). + * - If provided, `name` must be unique (case-sensitive) across all visible customer-related custom attribute definitions for the seller. + * - All custom attributes are visible in exported customer data, including those set to `VISIBILITY_HIDDEN`. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string; +} diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts new file mode 100644 index 000000000..860f57efe --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsDeleteRequest { + /** + * The key of the custom attribute definition to delete. + */ + key: string; +} diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts new file mode 100644 index 000000000..40e7a2e75 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsGetRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * key: "key" + * } + */ +export interface CustomAttributeDefinitionsGetRequest { + /** + * The key of the custom attribute definition to retrieve. + */ + key: string; + /** + * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control, include this optional field and specify the current version of the custom attribute. + */ + version?: number | null; +} diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts new file mode 100644 index 000000000..fbe413a4c --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/CustomAttributeDefinitionsListRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * {} + */ +export interface CustomAttributeDefinitionsListRequest { + /** + * Requests that all of the custom attributes be returned, or only those that are read-only or read-write. + */ + visibilityFilter?: Square.VisibilityFilter | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string | null; + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + limit?: number | null; +} diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..3eaac2d78 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * key: "key", + * customAttributeDefinition: { + * key: "cover-count", + * visibility: "VISIBILITY_READ_ONLY", + * version: 1 + * }, + * idempotencyKey: "IDEMPOTENCY_KEY" + * } + */ +export interface UpdateOrderCustomAttributeDefinitionRequest { + /** + * The key of the custom attribute definition to update. + */ + key: string; + /** + * The custom attribute definition that contains the fields to update. This endpoint supports sparse updates, + * so only new or changed fields need to be included in the request. For more information, see + * [Updatable definition fields](https://developer.squareup.com/docs/orders-custom-attributes-api/custom-attribute-definitions#updatable-definition-fields). + * + * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control, include the optional `version` field and specify the current version of the custom attribute definition. + */ + customAttributeDefinition: Square.CustomAttributeDefinition; + /** + * A unique identifier for this request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..8e435f1c5 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type CustomAttributeDefinitionsListRequest } from "./CustomAttributeDefinitionsListRequest"; +export { type CreateOrderCustomAttributeDefinitionRequest } from "./CreateOrderCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsGetRequest } from "./CustomAttributeDefinitionsGetRequest"; +export { type UpdateOrderCustomAttributeDefinitionRequest } from "./UpdateOrderCustomAttributeDefinitionRequest"; +export { type CustomAttributeDefinitionsDeleteRequest } from "./CustomAttributeDefinitionsDeleteRequest"; diff --git a/src/api/resources/orders/resources/customAttributeDefinitions/index.ts b/src/api/resources/orders/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/orders/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/orders/resources/customAttributes/client/Client.ts b/src/api/resources/orders/resources/customAttributes/client/Client.ts new file mode 100644 index 000000000..e4c77a528 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/Client.ts @@ -0,0 +1,631 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace CustomAttributes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class CustomAttributes { + constructor(protected readonly _options: CustomAttributes.Options = {}) {} + + /** + * Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation. + * + * Use this endpoint to delete one or more custom attributes from one or more orders. + * A custom attribute is based on a custom attribute definition in a Square seller account. (To create a + * custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + * + * This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete + * requests and returns a map of individual delete responses. Each delete request has a unique ID + * and provides an order ID and custom attribute. Each delete response is returned with the ID + * of the corresponding request. + * + * To delete a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.orders.BulkDeleteOrderCustomAttributesRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributes.batchDelete({ + * values: { + * "cover-count": { + * key: "cover-count", + * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * }, + * "table-number": { + * key: "table-number", + * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * } + * } + * }) + */ + public async batchDelete( + request: Square.orders.BulkDeleteOrderCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders/custom-attributes/bulk-delete", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.orders.BulkDeleteOrderCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkDeleteOrderCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/orders/custom-attributes/bulk-delete.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates order [custom attributes](entity:CustomAttribute) as a bulk operation. + * + * Use this endpoint to delete one or more custom attributes from one or more orders. + * A custom attribute is based on a custom attribute definition in a Square seller account. (To create a + * custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + * + * This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + * requests and returns a map of individual upsert responses. Each upsert request has a unique ID + * and provides an order ID and custom attribute. Each upsert response is returned with the ID + * of the corresponding request. + * + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.orders.BulkUpsertOrderCustomAttributesRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributes.batchUpsert({ + * values: { + * "cover-count": { + * customAttribute: { + * key: "cover-count", + * value: "6", + * version: 2 + * }, + * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * }, + * "table-number": { + * customAttribute: { + * key: "table-number", + * value: "11", + * version: 4 + * }, + * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * } + * } + * }) + */ + public async batchUpsert( + request: Square.orders.BulkUpsertOrderCustomAttributesRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/orders/custom-attributes/bulk-upsert", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.orders.BulkUpsertOrderCustomAttributesRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkUpsertOrderCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/orders/custom-attributes/bulk-upsert.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Lists the [custom attributes](entity:CustomAttribute) associated with an order. + * + * You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + * in the same call. + * + * When all response pages are retrieved, the results include all custom attributes that are + * visible to the requesting application, including those that are owned by other applications + * and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.orders.CustomAttributesListRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributes.list({ + * orderId: "order_id" + * }) + */ + public async list( + request: Square.orders.CustomAttributesListRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise> { + const list = async ( + request: Square.orders.CustomAttributesListRequest, + ): Promise => { + const { orderId, visibilityFilter, cursor, limit, withDefinitions } = request; + const _queryParams: Record = {}; + if (visibilityFilter !== undefined) { + _queryParams["visibility_filter"] = serializers.VisibilityFilter.jsonOrThrow(visibilityFilter, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (withDefinitions !== undefined) { + _queryParams["with_definitions"] = withDefinitions?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/${encodeURIComponent(orderId)}/custom-attributes`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListOrderCustomAttributesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/orders/{order_id}/custom-attributes.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.customAttributes ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves a [custom attribute](entity:CustomAttribute) associated with an order. + * + * You can use the `with_definition` query parameter to also retrieve the custom attribute definition + * in the same call. + * + * To retrieve a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.orders.CustomAttributesGetRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributes.get({ + * orderId: "order_id", + * customAttributeKey: "custom_attribute_key" + * }) + */ + public async get( + request: Square.orders.CustomAttributesGetRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { orderId, customAttributeKey, version, withDefinition } = request; + const _queryParams: Record = {}; + if (version !== undefined) { + _queryParams["version"] = version?.toString() ?? null; + } + + if (withDefinition !== undefined) { + _queryParams["with_definition"] = withDefinition?.toString() ?? null; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/${encodeURIComponent(orderId)}/custom-attributes/${encodeURIComponent(customAttributeKey)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveOrderCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/orders/{order_id}/custom-attributes/{custom_attribute_key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates a [custom attribute](entity:CustomAttribute) for an order. + * + * Use this endpoint to set the value of a custom attribute for a specific order. + * A custom attribute is based on a custom attribute definition in a Square seller account. (To create a + * custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + * + * To create or update a custom attribute owned by another application, the `visibility` setting + * must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.orders.UpsertOrderCustomAttributeRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributes.upsert({ + * orderId: "order_id", + * customAttributeKey: "custom_attribute_key", + * customAttribute: { + * key: "table-number", + * value: "42", + * version: 1 + * } + * }) + */ + public async upsert( + request: Square.orders.UpsertOrderCustomAttributeRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { orderId, customAttributeKey, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/${encodeURIComponent(orderId)}/custom-attributes/${encodeURIComponent(customAttributeKey)}`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.orders.UpsertOrderCustomAttributeRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpsertOrderCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/orders/{order_id}/custom-attributes/{custom_attribute_key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile. + * + * To delete a custom attribute owned by another application, the `visibility` setting must be + * `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + * (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + * + * @param {Square.orders.CustomAttributesDeleteRequest} request + * @param {CustomAttributes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.orders.customAttributes.delete({ + * orderId: "order_id", + * customAttributeKey: "custom_attribute_key" + * }) + */ + public async delete( + request: Square.orders.CustomAttributesDeleteRequest, + requestOptions?: CustomAttributes.RequestOptions, + ): Promise { + const { orderId, customAttributeKey } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/orders/${encodeURIComponent(orderId)}/custom-attributes/${encodeURIComponent(customAttributeKey)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteOrderCustomAttributeResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/orders/{order_id}/custom-attributes/{custom_attribute_key}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/orders/resources/customAttributes/client/index.ts b/src/api/resources/orders/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts new file mode 100644 index 000000000..c179f4272 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "cover-count": { + * key: "cover-count", + * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * }, + * "table-number": { + * key: "table-number", + * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * } + * } + * } + */ +export interface BulkDeleteOrderCustomAttributesRequest { + /** A map of requests that correspond to individual delete operations for custom attributes. */ + values: Record; +} diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts new file mode 100644 index 000000000..049e4a5fc --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * values: { + * "cover-count": { + * customAttribute: { + * key: "cover-count", + * value: "6", + * version: 2 + * }, + * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * }, + * "table-number": { + * customAttribute: { + * key: "table-number", + * value: "11", + * version: 4 + * }, + * orderId: "7BbXGEIWNldxAzrtGf9GPVZTwZ4F" + * } + * } + * } + */ +export interface BulkUpsertOrderCustomAttributesRequest { + /** A map of requests that correspond to individual upsert operations for custom attributes. */ + values: Record; +} diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts new file mode 100644 index 000000000..12dbe5054 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesDeleteRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * orderId: "order_id", + * customAttributeKey: "custom_attribute_key" + * } + */ +export interface CustomAttributesDeleteRequest { + /** + * The ID of the target [order](entity:Order). + */ + orderId: string; + /** + * The key of the custom attribute to delete. This key must match the key of an + * existing custom attribute definition. + */ + customAttributeKey: string; +} diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts new file mode 100644 index 000000000..30d132916 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesGetRequest.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * orderId: "order_id", + * customAttributeKey: "custom_attribute_key" + * } + */ +export interface CustomAttributesGetRequest { + /** + * The ID of the target [order](entity:Order). + */ + orderId: string; + /** + * The key of the custom attribute to retrieve. This key must match the key of an + * existing custom attribute definition. + */ + customAttributeKey: string; + /** + * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control, include this optional field and specify the current version of the custom attribute. + */ + version?: number | null; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom attribute, + * information about the data type, or other definition details. The default value is `false`. + */ + withDefinition?: boolean | null; +} diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesListRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesListRequest.ts new file mode 100644 index 000000000..d4ebafcdb --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/requests/CustomAttributesListRequest.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * orderId: "order_id" + * } + */ +export interface CustomAttributesListRequest { + /** + * The ID of the target [order](entity:Order). + */ + orderId: string; + /** + * Requests that all of the custom attributes be returned, or only those that are read-only or read-write. + */ + visibilityFilter?: Square.VisibilityFilter | null; + /** + * The cursor returned in the paged response from the previous call to this endpoint. + * Provide this cursor to retrieve the next page of results for your original request. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string | null; + /** + * The maximum number of results to return in a single paged response. This limit is advisory. + * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. + * The default value is 20. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + limit?: number | null; + /** + * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each + * custom attribute. Set this parameter to `true` to get the name and description of each custom attribute, + * information about the data type, or other definition details. The default value is `false`. + */ + withDefinitions?: boolean | null; +} diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts b/src/api/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts new file mode 100644 index 000000000..d8edbbc12 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * orderId: "order_id", + * customAttributeKey: "custom_attribute_key", + * customAttribute: { + * key: "table-number", + * value: "42", + * version: 1 + * } + * } + */ +export interface UpsertOrderCustomAttributeRequest { + /** + * The ID of the target [order](entity:Order). + */ + orderId: string; + /** + * The key of the custom attribute to create or update. This key must match the key + * of an existing custom attribute definition. + */ + customAttributeKey: string; + /** + * The custom attribute to create or update, with the following fields: + * + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types). + * + * - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control, include this optional field and specify the current version of the custom attribute. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/orders/resources/customAttributes/client/requests/index.ts b/src/api/resources/orders/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..c9ebc8356 --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,6 @@ +export { type BulkDeleteOrderCustomAttributesRequest } from "./BulkDeleteOrderCustomAttributesRequest"; +export { type BulkUpsertOrderCustomAttributesRequest } from "./BulkUpsertOrderCustomAttributesRequest"; +export { type CustomAttributesListRequest } from "./CustomAttributesListRequest"; +export { type CustomAttributesGetRequest } from "./CustomAttributesGetRequest"; +export { type UpsertOrderCustomAttributeRequest } from "./UpsertOrderCustomAttributeRequest"; +export { type CustomAttributesDeleteRequest } from "./CustomAttributesDeleteRequest"; diff --git a/src/api/resources/orders/resources/customAttributes/index.ts b/src/api/resources/orders/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/orders/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/orders/resources/index.ts b/src/api/resources/orders/resources/index.ts new file mode 100644 index 000000000..bfa7c90b7 --- /dev/null +++ b/src/api/resources/orders/resources/index.ts @@ -0,0 +1,4 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * as customAttributes from "./customAttributes"; +export * from "./customAttributeDefinitions/client/requests"; +export * from "./customAttributes/client/requests"; diff --git a/src/api/resources/payments/client/Client.ts b/src/api/resources/payments/client/Client.ts new file mode 100644 index 000000000..3400f8798 --- /dev/null +++ b/src/api/resources/payments/client/Client.ts @@ -0,0 +1,702 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Payments { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Payments { + constructor(protected readonly _options: Payments.Options = {}) {} + + /** + * Retrieves a list of payments taken by the account making the request. + * + * Results are eventually consistent, and new payments or changes to payments might take several + * seconds to appear. + * + * The maximum results per page is 100. + * + * @param {Square.PaymentsListRequest} request + * @param {Payments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payments.list() + */ + public async list( + request: Square.PaymentsListRequest = {}, + requestOptions?: Payments.RequestOptions, + ): Promise> { + const list = async (request: Square.PaymentsListRequest): Promise => { + const { + beginTime, + endTime, + sortOrder, + cursor, + locationId, + total, + last4, + cardBrand, + limit, + isOfflinePayment, + offlineBeginTime, + offlineEndTime, + updatedAtBeginTime, + updatedAtEndTime, + sortField, + } = request; + const _queryParams: Record = {}; + if (beginTime !== undefined) { + _queryParams["begin_time"] = beginTime; + } + if (endTime !== undefined) { + _queryParams["end_time"] = endTime; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = sortOrder; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (total !== undefined) { + _queryParams["total"] = total?.toString() ?? null; + } + if (last4 !== undefined) { + _queryParams["last_4"] = last4; + } + if (cardBrand !== undefined) { + _queryParams["card_brand"] = cardBrand; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + if (isOfflinePayment !== undefined) { + _queryParams["is_offline_payment"] = isOfflinePayment?.toString() ?? null; + } + if (offlineBeginTime !== undefined) { + _queryParams["offline_begin_time"] = offlineBeginTime; + } + if (offlineEndTime !== undefined) { + _queryParams["offline_end_time"] = offlineEndTime; + } + if (updatedAtBeginTime !== undefined) { + _queryParams["updated_at_begin_time"] = updatedAtBeginTime; + } + if (updatedAtEndTime !== undefined) { + _queryParams["updated_at_end_time"] = updatedAtEndTime; + } + if (sortField !== undefined) { + _queryParams["sort_field"] = serializers.PaymentSortField.jsonOrThrow(sortField, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/payments", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListPaymentsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/payments."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.payments ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a payment using the provided source. You can use this endpoint + * to charge a card (credit/debit card or + * Square gift card) or record a payment that the seller received outside of Square + * (cash payment from a buyer or a payment that an external entity + * processed on behalf of the seller). + * + * The endpoint creates a + * `Payment` object and returns it in the response. + * + * @param {Square.CreatePaymentRequest} request + * @param {Payments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payments.create({ + * sourceId: "ccof:GaJGNaZa8x4OgDJn4GB", + * idempotencyKey: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + * amountMoney: { + * amount: 1000, + * currency: "USD" + * }, + * appFeeMoney: { + * amount: 10, + * currency: "USD" + * }, + * autocomplete: true, + * customerId: "W92WH6P11H4Z77CTET0RNTGFW8", + * locationId: "L88917AVBK2S5", + * referenceId: "123456", + * note: "Brief description" + * }) + */ + public async create( + request: Square.CreatePaymentRequest, + requestOptions?: Payments.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/payments", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreatePaymentRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreatePaymentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/payments."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels (voids) a payment identified by the idempotency key that is specified in the + * request. + * + * Use this method when the status of a `CreatePayment` request is unknown (for example, after you send a + * `CreatePayment` request, a network error occurs and you do not get a response). In this case, you can + * direct Square to cancel the payment using this endpoint. In the request, you provide the same + * idempotency key that you provided in your `CreatePayment` request that you want to cancel. After + * canceling the payment, you can submit your `CreatePayment` request again. + * + * Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint + * returns successfully. + * + * @param {Square.CancelPaymentByIdempotencyKeyRequest} request + * @param {Payments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payments.cancelByIdempotencyKey({ + * idempotencyKey: "a7e36d40-d24b-11e8-b568-0800200c9a66" + * }) + */ + public async cancelByIdempotencyKey( + request: Square.CancelPaymentByIdempotencyKeyRequest, + requestOptions?: Payments.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/payments/cancel", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CancelPaymentByIdempotencyKeyRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelPaymentByIdempotencyKeyResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/payments/cancel."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves details for a specific payment. + * + * @param {Square.PaymentsGetRequest} request + * @param {Payments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payments.get({ + * paymentId: "payment_id" + * }) + */ + public async get( + request: Square.PaymentsGetRequest, + requestOptions?: Payments.RequestOptions, + ): Promise { + const { paymentId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/payments/${encodeURIComponent(paymentId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetPaymentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/payments/{payment_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a payment with the APPROVED status. + * You can update the `amount_money` and `tip_money` using this endpoint. + * + * @param {Square.UpdatePaymentRequest} request + * @param {Payments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payments.update({ + * paymentId: "payment_id", + * payment: { + * amountMoney: { + * amount: 1000, + * currency: "USD" + * }, + * tipMoney: { + * amount: 100, + * currency: "USD" + * }, + * versionToken: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o" + * }, + * idempotencyKey: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de" + * }) + */ + public async update( + request: Square.UpdatePaymentRequest, + requestOptions?: Payments.RequestOptions, + ): Promise { + const { paymentId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/payments/${encodeURIComponent(paymentId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdatePaymentRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdatePaymentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/payments/{payment_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels (voids) a payment. You can use this endpoint to cancel a payment with + * the APPROVED `status`. + * + * @param {Square.PaymentsCancelRequest} request + * @param {Payments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payments.cancel({ + * paymentId: "payment_id" + * }) + */ + public async cancel( + request: Square.PaymentsCancelRequest, + requestOptions?: Payments.RequestOptions, + ): Promise { + const { paymentId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/payments/${encodeURIComponent(paymentId)}/cancel`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelPaymentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/payments/{payment_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Completes (captures) a payment. + * By default, payments are set to complete immediately after they are created. + * + * You can use this endpoint to complete a payment with the APPROVED `status`. + * + * @param {Square.CompletePaymentRequest} request + * @param {Payments.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payments.complete({ + * paymentId: "payment_id" + * }) + */ + public async complete( + request: Square.CompletePaymentRequest, + requestOptions?: Payments.RequestOptions, + ): Promise { + const { paymentId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/payments/${encodeURIComponent(paymentId)}/complete`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CompletePaymentRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CompletePaymentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/payments/{payment_id}/complete.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/payments/client/index.ts b/src/api/resources/payments/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/payments/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts b/src/api/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts new file mode 100644 index 000000000..7929437cc --- /dev/null +++ b/src/api/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * idempotencyKey: "a7e36d40-d24b-11e8-b568-0800200c9a66" + * } + */ +export interface CancelPaymentByIdempotencyKeyRequest { + /** The `idempotency_key` identifying the payment to be canceled. */ + idempotencyKey: string; +} diff --git a/src/api/resources/payments/client/requests/CompletePaymentRequest.ts b/src/api/resources/payments/client/requests/CompletePaymentRequest.ts new file mode 100644 index 000000000..c75e332e9 --- /dev/null +++ b/src/api/resources/payments/client/requests/CompletePaymentRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * paymentId: "payment_id" + * } + */ +export interface CompletePaymentRequest { + /** + * The unique ID identifying the payment to be completed. + */ + paymentId: string; + /** + * Used for optimistic concurrency. This opaque token identifies the current `Payment` + * version that the caller expects. If the server has a different version of the Payment, + * the update fails and a response with a VERSION_MISMATCH error is returned. + */ + versionToken?: string | null; +} diff --git a/src/api/resources/payments/client/requests/CreatePaymentRequest.ts b/src/api/resources/payments/client/requests/CreatePaymentRequest.ts new file mode 100644 index 000000000..8c7756897 --- /dev/null +++ b/src/api/resources/payments/client/requests/CreatePaymentRequest.ts @@ -0,0 +1,209 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * sourceId: "ccof:GaJGNaZa8x4OgDJn4GB", + * idempotencyKey: "7b0f3ec5-086a-4871-8f13-3c81b3875218", + * amountMoney: { + * amount: 1000, + * currency: "USD" + * }, + * appFeeMoney: { + * amount: 10, + * currency: "USD" + * }, + * autocomplete: true, + * customerId: "W92WH6P11H4Z77CTET0RNTGFW8", + * locationId: "L88917AVBK2S5", + * referenceId: "123456", + * note: "Brief description" + * } + */ +export interface CreatePaymentRequest { + /** + * The ID for the source of funds for this payment. + * This could be a payment token generated by the Web Payments SDK for any of its + * [supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods), + * including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment + * that the seller received outside of Square, specify either "CASH" or "EXTERNAL". + * For more information, see + * [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). + */ + sourceId: string; + /** + * A unique string that identifies this `CreatePayment` request. Keys can be any valid string + * but must be unique for every `CreatePayment` request. + * + * Note: The number of allowed characters might be less than the stated maximum, if multi-byte + * characters are used. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + */ + idempotencyKey: string; + /** + * The amount of money to accept for this payment, not including `tip_money`. + * + * The amount must be specified in the smallest denomination of the applicable currency + * (for example, US dollar amounts are specified in cents). For more information, see + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + * + * The currency code must match the currency associated with the business + * that is accepting the payment. + */ + amountMoney?: Square.Money; + /** + * The amount designated as a tip, in addition to `amount_money`. + * + * The amount must be specified in the smallest denomination of the applicable currency + * (for example, US dollar amounts are specified in cents). For more information, see + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + * + * The currency code must match the currency associated with the business + * that is accepting the payment. + */ + tipMoney?: Square.Money; + /** + * The amount of money that the developer is taking as a fee + * for facilitating the payment on behalf of the seller. + * + * The amount cannot be more than 90% of the total amount of the payment. + * + * The amount must be specified in the smallest denomination of the applicable currency + * (for example, US dollar amounts are specified in cents). For more information, see + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + * + * The fee currency code must match the currency associated with the seller + * that is accepting the payment. The application must be from a developer + * account in the same country and using the same currency code as the seller. + * + * For more information about the application fee scenario, see + * [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). + * + * To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. + * For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). + */ + appFeeMoney?: Square.Money; + /** + * The duration of time after the payment's creation when Square automatically + * either completes or cancels the payment depending on the `delay_action` field value. + * For more information, see + * [Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold). + * + * This parameter should be specified as a time duration, in RFC 3339 format. + * + * Note: This feature is only supported for card payments. This parameter can only be set for a delayed + * capture payment (`autocomplete=false`). + * + * Default: + * + * - Card-present payments: "PT36H" (36 hours) from the creation time. + * - Card-not-present payments: "P7D" (7 days) from the creation time. + */ + delayDuration?: string; + /** + * The action to be applied to the payment when the `delay_duration` has elapsed. The action must be + * CANCEL or COMPLETE. For more information, see + * [Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold). + * + * Default: CANCEL + */ + delayAction?: string; + /** + * If set to `true`, this payment will be completed when possible. If + * set to `false`, this payment is held in an approved state until either + * explicitly completed (captured) or canceled (voided). For more information, see + * [Delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment). + * + * Default: true + */ + autocomplete?: boolean; + /** Associates a previously created order with this payment. */ + orderId?: string; + /** + * The [Customer](entity:Customer) ID of the customer associated with the payment. + * + * This is required if the `source_id` refers to a card on file created using the Cards API. + */ + customerId?: string; + /** + * The location ID to associate with the payment. If not specified, the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location) is + * used. + */ + locationId?: string; + /** + * An optional [TeamMember](entity:TeamMember) ID to associate with + * this payment. + */ + teamMemberId?: string; + /** + * A user-defined ID to associate with the payment. + * + * You can use this field to associate the payment to an entity in an external system + * (for example, you might specify an order ID that is generated by a third-party shopping cart). + */ + referenceId?: string; + /** + * An identifying token generated by [payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer). + * Verification tokens encapsulate customer device information and 3-D Secure + * challenge results to indicate that Square has verified the buyer identity. + * + * For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview). + */ + verificationToken?: string; + /** + * If set to `true` and charging a Square Gift Card, a payment might be returned with + * `amount_money` equal to less than what was requested. For example, a request for $20 when charging + * a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose + * to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card + * payment. This field cannot be `true` when `autocomplete = true`. + * + * For more information, see + * [Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card). + * + * Default: false + */ + acceptPartialAuthorization?: boolean; + /** The buyer's email address. */ + buyerEmailAddress?: string; + /** + * The buyer's phone number. + * Must follow the following format: + * 1. A leading + symbol (followed by a country code) + * 2. The phone number can contain spaces and the special characters `(` , `)` , `-` , and `.`. + * Alphabetical characters aren't allowed. + * 3. The phone number must contain between 9 and 16 digits. + */ + buyerPhoneNumber?: string; + /** The buyer's billing address. */ + billingAddress?: Square.Address; + /** The buyer's shipping address. */ + shippingAddress?: Square.Address; + /** An optional note to be entered by the developer when creating a payment. */ + note?: string; + /** + * Optional additional payment information to include on the customer's card statement + * as part of the statement description. This can be, for example, an invoice number, ticket number, + * or short description that uniquely identifies the purchase. + * + * Note that the `statement_description_identifier` might get truncated on the statement description + * to fit the required information including the Square identifier (SQ *) and name of the + * seller taking the payment. + */ + statementDescriptionIdentifier?: string; + /** Additional details required when recording a cash payment (`source_id` is CASH). */ + cashDetails?: Square.CashPaymentDetails; + /** Additional details required when recording an external payment (`source_id` is EXTERNAL). */ + externalDetails?: Square.ExternalPaymentDetails; + /** Details about the customer making the payment. */ + customerDetails?: Square.CustomerDetails; + /** + * An optional field for specifying the offline payment details. This is intended for + * internal 1st-party callers only. + */ + offlinePaymentDetails?: Square.OfflinePaymentDetails; +} diff --git a/src/api/resources/payments/client/requests/PaymentsCancelRequest.ts b/src/api/resources/payments/client/requests/PaymentsCancelRequest.ts new file mode 100644 index 000000000..83bc2221c --- /dev/null +++ b/src/api/resources/payments/client/requests/PaymentsCancelRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * paymentId: "payment_id" + * } + */ +export interface PaymentsCancelRequest { + /** + * The ID of the payment to cancel. + */ + paymentId: string; +} diff --git a/src/api/resources/payments/client/requests/PaymentsGetRequest.ts b/src/api/resources/payments/client/requests/PaymentsGetRequest.ts new file mode 100644 index 000000000..52d164480 --- /dev/null +++ b/src/api/resources/payments/client/requests/PaymentsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * paymentId: "payment_id" + * } + */ +export interface PaymentsGetRequest { + /** + * A unique ID for the desired payment. + */ + paymentId: string; +} diff --git a/src/api/resources/payments/client/requests/PaymentsListRequest.ts b/src/api/resources/payments/client/requests/PaymentsListRequest.ts new file mode 100644 index 000000000..f6592df27 --- /dev/null +++ b/src/api/resources/payments/client/requests/PaymentsListRequest.ts @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface PaymentsListRequest { + /** + * Indicates the start of the time range to retrieve payments for, in RFC 3339 format. + * The range is determined using the `created_at` field for each Payment. + * Inclusive. Default: The current time minus one year. + */ + beginTime?: string | null; + /** + * Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The + * range is determined using the `created_at` field for each Payment. + * + * Default: The current time. + */ + endTime?: string | null; + /** + * The order in which results are listed by `ListPaymentsRequest.sort_field`: + * - `ASC` - Oldest to newest. + * - `DESC` - Newest to oldest (default). + */ + sortOrder?: string | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * Limit results to the location supplied. By default, results are returned + * for the default (main) location associated with the seller. + */ + locationId?: string | null; + /** + * The exact amount in the `total_money` for a payment. + */ + total?: bigint | null; + /** + * The last four digits of a payment card. + */ + last4?: string | null; + /** + * The brand of the payment card (for example, VISA). + */ + cardBrand?: string | null; + /** + * The maximum number of results to be returned in a single page. + * It is possible to receive fewer results than the specified limit on a given page. + * + * The default value of 100 is also the maximum allowed value. If the provided value is + * greater than 100, it is ignored and the default value is used instead. + * + * Default: `100` + */ + limit?: number | null; + /** + * Whether the payment was taken offline or not. + */ + isOfflinePayment?: boolean | null; + /** + * Indicates the start of the time range for which to retrieve offline payments, in RFC 3339 + * format for timestamps. The range is determined using the + * `offline_payment_details.client_created_at` field for each Payment. If set, payments without a + * value set in `offline_payment_details.client_created_at` will not be returned. + * + * Default: The current time. + */ + offlineBeginTime?: string | null; + /** + * Indicates the end of the time range for which to retrieve offline payments, in RFC 3339 + * format for timestamps. The range is determined using the + * `offline_payment_details.client_created_at` field for each Payment. If set, payments without a + * value set in `offline_payment_details.client_created_at` will not be returned. + * + * Default: The current time. + */ + offlineEndTime?: string | null; + /** + * Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The + * range is determined using the `updated_at` field for each Payment. + */ + updatedAtBeginTime?: string | null; + /** + * Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The + * range is determined using the `updated_at` field for each Payment. + */ + updatedAtEndTime?: string | null; + /** + * The field used to sort results by. The default is `CREATED_AT`. + */ + sortField?: Square.PaymentSortField | null; +} diff --git a/src/api/resources/payments/client/requests/UpdatePaymentRequest.ts b/src/api/resources/payments/client/requests/UpdatePaymentRequest.ts new file mode 100644 index 000000000..62e6078ab --- /dev/null +++ b/src/api/resources/payments/client/requests/UpdatePaymentRequest.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * paymentId: "payment_id", + * payment: { + * amountMoney: { + * amount: 1000, + * currency: "USD" + * }, + * tipMoney: { + * amount: 100, + * currency: "USD" + * }, + * versionToken: "ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o" + * }, + * idempotencyKey: "956f8b13-e4ec-45d6-85e8-d1d95ef0c5de" + * } + */ +export interface UpdatePaymentRequest { + /** + * The ID of the payment to update. + */ + paymentId: string; + /** The updated `Payment` object. */ + payment?: Square.Payment; + /** + * A unique string that identifies this `UpdatePayment` request. Keys can be any valid string + * but must be unique for every `UpdatePayment` request. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey: string; +} diff --git a/src/api/resources/payments/client/requests/index.ts b/src/api/resources/payments/client/requests/index.ts new file mode 100644 index 000000000..345fd5a5c --- /dev/null +++ b/src/api/resources/payments/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type PaymentsListRequest } from "./PaymentsListRequest"; +export { type CreatePaymentRequest } from "./CreatePaymentRequest"; +export { type CancelPaymentByIdempotencyKeyRequest } from "./CancelPaymentByIdempotencyKeyRequest"; +export { type PaymentsGetRequest } from "./PaymentsGetRequest"; +export { type UpdatePaymentRequest } from "./UpdatePaymentRequest"; +export { type PaymentsCancelRequest } from "./PaymentsCancelRequest"; +export { type CompletePaymentRequest } from "./CompletePaymentRequest"; diff --git a/src/api/resources/payments/index.ts b/src/api/resources/payments/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/payments/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/payouts/client/Client.ts b/src/api/resources/payouts/client/Client.ts new file mode 100644 index 000000000..47c322a42 --- /dev/null +++ b/src/api/resources/payouts/client/Client.ts @@ -0,0 +1,330 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Payouts { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Payouts { + constructor(protected readonly _options: Payouts.Options = {}) {} + + /** + * Retrieves a list of all payouts for the default location. + * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. + * To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + * + * @param {Square.PayoutsListRequest} request + * @param {Payouts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payouts.list() + */ + public async list( + request: Square.PayoutsListRequest = {}, + requestOptions?: Payouts.RequestOptions, + ): Promise> { + const list = async (request: Square.PayoutsListRequest): Promise => { + const { locationId, status, beginTime, endTime, sortOrder, cursor, limit } = request; + const _queryParams: Record = {}; + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (status !== undefined) { + _queryParams["status"] = serializers.PayoutStatus.jsonOrThrow(status, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (beginTime !== undefined) { + _queryParams["begin_time"] = beginTime; + } + if (endTime !== undefined) { + _queryParams["end_time"] = endTime; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/payouts", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListPayoutsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/payouts."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.payouts ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Retrieves details of a specific payout identified by a payout ID. + * To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + * + * @param {Square.PayoutsGetRequest} request + * @param {Payouts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payouts.get({ + * payoutId: "payout_id" + * }) + */ + public async get( + request: Square.PayoutsGetRequest, + requestOptions?: Payouts.RequestOptions, + ): Promise { + const { payoutId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/payouts/${encodeURIComponent(payoutId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetPayoutResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/payouts/{payout_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a list of all payout entries for a specific payout. + * To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + * + * @param {Square.PayoutsListEntriesRequest} request + * @param {Payouts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.payouts.listEntries({ + * payoutId: "payout_id" + * }) + */ + public async listEntries( + request: Square.PayoutsListEntriesRequest, + requestOptions?: Payouts.RequestOptions, + ): Promise> { + const list = async (request: Square.PayoutsListEntriesRequest): Promise => { + const { payoutId, sortOrder, cursor, limit } = request; + const _queryParams: Record = {}; + if (sortOrder !== undefined) { + _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/payouts/${encodeURIComponent(payoutId)}/payout-entries`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListPayoutEntriesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/payouts/{payout_id}/payout-entries.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.payoutEntries ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/payouts/client/index.ts b/src/api/resources/payouts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/payouts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/payouts/client/requests/PayoutsGetRequest.ts b/src/api/resources/payouts/client/requests/PayoutsGetRequest.ts new file mode 100644 index 000000000..07b57b6c1 --- /dev/null +++ b/src/api/resources/payouts/client/requests/PayoutsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * payoutId: "payout_id" + * } + */ +export interface PayoutsGetRequest { + /** + * The ID of the payout to retrieve the information for. + */ + payoutId: string; +} diff --git a/src/api/resources/payouts/client/requests/PayoutsListEntriesRequest.ts b/src/api/resources/payouts/client/requests/PayoutsListEntriesRequest.ts new file mode 100644 index 000000000..fa7e8c095 --- /dev/null +++ b/src/api/resources/payouts/client/requests/PayoutsListEntriesRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * payoutId: "payout_id" + * } + */ +export interface PayoutsListEntriesRequest { + /** + * The ID of the payout to retrieve the information for. + */ + payoutId: string; + /** + * The order in which payout entries are listed. + */ + sortOrder?: Square.SortOrder | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + * If request parameters change between requests, subsequent results may contain duplicates or missing records. + */ + cursor?: string | null; + /** + * The maximum number of results to be returned in a single page. + * It is possible to receive fewer results than the specified limit on a given page. + * The default value of 100 is also the maximum allowed value. If the provided value is + * greater than 100, it is ignored and the default value is used instead. + * Default: `100` + */ + limit?: number | null; +} diff --git a/src/api/resources/payouts/client/requests/PayoutsListRequest.ts b/src/api/resources/payouts/client/requests/PayoutsListRequest.ts new file mode 100644 index 000000000..615c16fa4 --- /dev/null +++ b/src/api/resources/payouts/client/requests/PayoutsListRequest.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface PayoutsListRequest { + /** + * The ID of the location for which to list the payouts. + * By default, payouts are returned for the default (main) location associated with the seller. + */ + locationId?: string | null; + /** + * If provided, only payouts with the given status are returned. + */ + status?: Square.PayoutStatus | null; + /** + * The timestamp for the beginning of the payout creation time, in RFC 3339 format. + * Inclusive. Default: The current time minus one year. + */ + beginTime?: string | null; + /** + * The timestamp for the end of the payout creation time, in RFC 3339 format. + * Default: The current time. + */ + endTime?: string | null; + /** + * The order in which payouts are listed. + */ + sortOrder?: Square.SortOrder | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + * If request parameters change between requests, subsequent results may contain duplicates or missing records. + */ + cursor?: string | null; + /** + * The maximum number of results to be returned in a single page. + * It is possible to receive fewer results than the specified limit on a given page. + * The default value of 100 is also the maximum allowed value. If the provided value is + * greater than 100, it is ignored and the default value is used instead. + * Default: `100` + */ + limit?: number | null; +} diff --git a/src/api/resources/payouts/client/requests/index.ts b/src/api/resources/payouts/client/requests/index.ts new file mode 100644 index 000000000..1a61bd4b9 --- /dev/null +++ b/src/api/resources/payouts/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type PayoutsListRequest } from "./PayoutsListRequest"; +export { type PayoutsGetRequest } from "./PayoutsGetRequest"; +export { type PayoutsListEntriesRequest } from "./PayoutsListEntriesRequest"; diff --git a/src/api/resources/payouts/index.ts b/src/api/resources/payouts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/payouts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/refunds/client/Client.ts b/src/api/resources/refunds/client/Client.ts new file mode 100644 index 000000000..05c8867b8 --- /dev/null +++ b/src/api/resources/refunds/client/Client.ts @@ -0,0 +1,320 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Refunds { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Refunds { + constructor(protected readonly _options: Refunds.Options = {}) {} + + /** + * Retrieves a list of refunds for the account making the request. + * + * Results are eventually consistent, and new refunds or changes to refunds might take several + * seconds to appear. + * + * The maximum results per page is 100. + * + * @param {Square.RefundsListRequest} request + * @param {Refunds.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.refunds.list() + */ + public async list( + request: Square.RefundsListRequest = {}, + requestOptions?: Refunds.RequestOptions, + ): Promise> { + const list = async (request: Square.RefundsListRequest): Promise => { + const { beginTime, endTime, sortOrder, cursor, locationId, status, sourceType, limit } = request; + const _queryParams: Record = {}; + if (beginTime !== undefined) { + _queryParams["begin_time"] = beginTime; + } + if (endTime !== undefined) { + _queryParams["end_time"] = endTime; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = sortOrder; + } + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (locationId !== undefined) { + _queryParams["location_id"] = locationId; + } + if (status !== undefined) { + _queryParams["status"] = status; + } + if (sourceType !== undefined) { + _queryParams["source_type"] = sourceType; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/refunds", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListPaymentRefundsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/refunds."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.refunds ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Refunds a payment. You can refund the entire payment amount or a + * portion of it. You can use this endpoint to refund a card payment or record a + * refund of a cash or external payment. For more information, see + * [Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments). + * + * @param {Square.RefundPaymentRequest} request + * @param {Refunds.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.refunds.refundPayment({ + * idempotencyKey: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", + * amountMoney: { + * amount: 1000, + * currency: "USD" + * }, + * appFeeMoney: { + * amount: 10, + * currency: "USD" + * }, + * paymentId: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + * reason: "Example" + * }) + */ + public async refundPayment( + request: Square.RefundPaymentRequest, + requestOptions?: Refunds.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/refunds", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.RefundPaymentRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RefundPaymentResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/refunds."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a specific refund using the `refund_id`. + * + * @param {Square.RefundsGetRequest} request + * @param {Refunds.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.refunds.get({ + * refundId: "refund_id" + * }) + */ + public async get( + request: Square.RefundsGetRequest, + requestOptions?: Refunds.RequestOptions, + ): Promise { + const { refundId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/refunds/${encodeURIComponent(refundId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetPaymentRefundResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/refunds/{refund_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/refunds/client/index.ts b/src/api/resources/refunds/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/refunds/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/refunds/client/requests/RefundPaymentRequest.ts b/src/api/resources/refunds/client/requests/RefundPaymentRequest.ts new file mode 100644 index 000000000..bc21d1716 --- /dev/null +++ b/src/api/resources/refunds/client/requests/RefundPaymentRequest.ts @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * idempotencyKey: "9b7f2dcf-49da-4411-b23e-a2d6af21333a", + * amountMoney: { + * amount: 1000, + * currency: "USD" + * }, + * appFeeMoney: { + * amount: 10, + * currency: "USD" + * }, + * paymentId: "R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY", + * reason: "Example" + * } + */ +export interface RefundPaymentRequest { + /** + * A unique string that identifies this `RefundPayment` request. The key can be any valid string + * but must be unique for every `RefundPayment` request. + * + * Keys are limited to a max of 45 characters - however, the number of allowed characters might be + * less than 45, if multi-byte characters are used. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + */ + idempotencyKey: string; + /** + * The amount of money to refund. + * + * This amount cannot be more than the `total_money` value of the payment minus the total + * amount of all previously completed refunds for this payment. + * + * This amount must be specified in the smallest denomination of the applicable currency + * (for example, US dollar amounts are specified in cents). For more information, see + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + * + * The currency code must match the currency associated with the business + * that is charging the card. + */ + amountMoney: Square.Money; + /** + * The amount of money the developer contributes to help cover the refunded amount. + * This amount is specified in the smallest denomination of the applicable currency (for example, + * US dollar amounts are specified in cents). + * + * The value cannot be more than the `amount_money`. + * + * You can specify this parameter in a refund request only if the same parameter was also included + * when taking the payment. This is part of the application fee scenario the API supports. For more + * information, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). + * + * To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. + * For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). + */ + appFeeMoney?: Square.Money; + /** + * The unique ID of the payment being refunded. + * Required when unlinked=false, otherwise must not be set. + */ + paymentId?: string | null; + /** + * The ID indicating where funds will be refunded to. Required for unlinked refunds. For more + * information, see [Process an Unlinked Refund](https://developer.squareup.com/docs/refunds-api/unlinked-refunds). + * + * For refunds linked to Square payments, `destination_id` is usually omitted; in this case, funds + * will be returned to the original payment source. The field may be specified in order to request + * a cross-method refund to a gift card. For more information, + * see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards). + */ + destinationId?: string | null; + /** + * Indicates that the refund is not linked to a Square payment. + * If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not + * be provided. + */ + unlinked?: boolean | null; + /** + * The location ID associated with the unlinked refund. + * Required for requests specifying `unlinked=true`. + * Otherwise, if included when `unlinked=false`, will throw an error. + */ + locationId?: string | null; + /** + * The [Customer](entity:Customer) ID of the customer associated with the refund. + * This is required if the `destination_id` refers to a card on file created using the Cards + * API. Only allowed when `unlinked=true`. + */ + customerId?: string | null; + /** A description of the reason for the refund. */ + reason?: string | null; + /** + * Used for optimistic concurrency. This opaque token identifies the current `Payment` + * version that the caller expects. If the server has a different version of the Payment, + * the update fails and a response with a VERSION_MISMATCH error is returned. + * If the versions match, or the field is not provided, the refund proceeds as normal. + */ + paymentVersionToken?: string | null; + /** An optional [TeamMember](entity:TeamMember) ID to associate with this refund. */ + teamMemberId?: string | null; + /** Additional details required when recording an unlinked cash refund (`destination_id` is CASH). */ + cashDetails?: Square.DestinationDetailsCashRefundDetails; + /** + * Additional details required when recording an unlinked external refund + * (`destination_id` is EXTERNAL). + */ + externalDetails?: Square.DestinationDetailsExternalRefundDetails; +} diff --git a/src/api/resources/refunds/client/requests/RefundsGetRequest.ts b/src/api/resources/refunds/client/requests/RefundsGetRequest.ts new file mode 100644 index 000000000..3220b90c8 --- /dev/null +++ b/src/api/resources/refunds/client/requests/RefundsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * refundId: "refund_id" + * } + */ +export interface RefundsGetRequest { + /** + * The unique ID for the desired `PaymentRefund`. + */ + refundId: string; +} diff --git a/src/api/resources/refunds/client/requests/RefundsListRequest.ts b/src/api/resources/refunds/client/requests/RefundsListRequest.ts new file mode 100644 index 000000000..9d3ef913c --- /dev/null +++ b/src/api/resources/refunds/client/requests/RefundsListRequest.ts @@ -0,0 +1,68 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface RefundsListRequest { + /** + * Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339 + * format. The range is determined using the `created_at` field for each `PaymentRefund`. + * + * Default: The current time minus one year. + */ + beginTime?: string | null; + /** + * Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339 + * format. The range is determined using the `created_at` field for each `PaymentRefund`. + * + * Default: The current time. + */ + endTime?: string | null; + /** + * The order in which results are listed by `PaymentRefund.created_at`: + * - `ASC` - Oldest to newest. + * - `DESC` - Newest to oldest (default). + */ + sortOrder?: string | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * Limit results to the location supplied. By default, results are returned + * for all locations associated with the seller. + */ + locationId?: string | null; + /** + * If provided, only refunds with the given status are returned. + * For a list of refund status values, see [PaymentRefund](entity:PaymentRefund). + * + * Default: If omitted, refunds are returned regardless of their status. + */ + status?: string | null; + /** + * If provided, only returns refunds whose payments have the indicated source type. + * Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`. + * For information about these payment source types, see + * [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). + * + * Default: If omitted, refunds are returned regardless of the source type. + */ + sourceType?: string | null; + /** + * The maximum number of results to be returned in a single page. + * + * It is possible to receive fewer results than the specified limit on a given page. + * + * If the supplied value is greater than 100, no more than 100 results are returned. + * + * Default: 100 + */ + limit?: number | null; +} diff --git a/src/api/resources/refunds/client/requests/index.ts b/src/api/resources/refunds/client/requests/index.ts new file mode 100644 index 000000000..0a56f8ac0 --- /dev/null +++ b/src/api/resources/refunds/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type RefundsListRequest } from "./RefundsListRequest"; +export { type RefundPaymentRequest } from "./RefundPaymentRequest"; +export { type RefundsGetRequest } from "./RefundsGetRequest"; diff --git a/src/api/resources/refunds/index.ts b/src/api/resources/refunds/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/refunds/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/sites/client/Client.ts b/src/api/resources/sites/client/Client.ts new file mode 100644 index 000000000..02c8d4c1d --- /dev/null +++ b/src/api/resources/sites/client/Client.ts @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Sites { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Sites { + constructor(protected readonly _options: Sites.Options = {}) {} + + /** + * Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date. + * + * + * __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + * + * @param {Sites.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.sites.list() + */ + public async list(requestOptions?: Sites.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/sites", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListSitesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/sites."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/sites/client/index.ts b/src/api/resources/sites/client/index.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/src/api/resources/sites/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/sites/index.ts b/src/api/resources/sites/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/sites/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/snippets/client/Client.ts b/src/api/resources/snippets/client/Client.ts new file mode 100644 index 000000000..32e8f9e14 --- /dev/null +++ b/src/api/resources/snippets/client/Client.ts @@ -0,0 +1,292 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Snippets { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Snippets { + constructor(protected readonly _options: Snippets.Options = {}) {} + + /** + * Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application. + * + * You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + * + * + * __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + * + * @param {Square.SnippetsGetRequest} request + * @param {Snippets.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.snippets.get({ + * siteId: "site_id" + * }) + */ + public async get( + request: Square.SnippetsGetRequest, + requestOptions?: Snippets.RequestOptions, + ): Promise { + const { siteId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/sites/${encodeURIComponent(siteId)}/snippet`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetSnippetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/sites/{site_id}/snippet."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Adds a snippet to a Square Online site or updates the existing snippet on the site. + * The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site. + * + * You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + * + * + * __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + * + * @param {Square.UpsertSnippetRequest} request + * @param {Snippets.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.snippets.upsert({ + * siteId: "site_id", + * snippet: { + * content: "" + * } + * }) + */ + public async upsert( + request: Square.UpsertSnippetRequest, + requestOptions?: Snippets.RequestOptions, + ): Promise { + const { siteId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/sites/${encodeURIComponent(siteId)}/snippet`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpsertSnippetRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpsertSnippetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/sites/{site_id}/snippet."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Removes your snippet from a Square Online site. + * + * You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + * + * + * __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + * + * @param {Square.SnippetsDeleteRequest} request + * @param {Snippets.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.snippets.delete({ + * siteId: "site_id" + * }) + */ + public async delete( + request: Square.SnippetsDeleteRequest, + requestOptions?: Snippets.RequestOptions, + ): Promise { + const { siteId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/sites/${encodeURIComponent(siteId)}/snippet`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteSnippetResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/sites/{site_id}/snippet.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/snippets/client/index.ts b/src/api/resources/snippets/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/snippets/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/snippets/client/requests/SnippetsDeleteRequest.ts b/src/api/resources/snippets/client/requests/SnippetsDeleteRequest.ts new file mode 100644 index 000000000..8607b18f9 --- /dev/null +++ b/src/api/resources/snippets/client/requests/SnippetsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * siteId: "site_id" + * } + */ +export interface SnippetsDeleteRequest { + /** + * The ID of the site that contains the snippet. + */ + siteId: string; +} diff --git a/src/api/resources/snippets/client/requests/SnippetsGetRequest.ts b/src/api/resources/snippets/client/requests/SnippetsGetRequest.ts new file mode 100644 index 000000000..a16435cd4 --- /dev/null +++ b/src/api/resources/snippets/client/requests/SnippetsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * siteId: "site_id" + * } + */ +export interface SnippetsGetRequest { + /** + * The ID of the site that contains the snippet. + */ + siteId: string; +} diff --git a/src/api/resources/snippets/client/requests/UpsertSnippetRequest.ts b/src/api/resources/snippets/client/requests/UpsertSnippetRequest.ts new file mode 100644 index 000000000..28d2100a3 --- /dev/null +++ b/src/api/resources/snippets/client/requests/UpsertSnippetRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * siteId: "site_id", + * snippet: { + * content: "" + * } + * } + */ +export interface UpsertSnippetRequest { + /** + * The ID of the site where you want to add or update the snippet. + */ + siteId: string; + /** The snippet for the site. */ + snippet: Square.Snippet; +} diff --git a/src/api/resources/snippets/client/requests/index.ts b/src/api/resources/snippets/client/requests/index.ts new file mode 100644 index 000000000..0b17b45c3 --- /dev/null +++ b/src/api/resources/snippets/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type SnippetsGetRequest } from "./SnippetsGetRequest"; +export { type UpsertSnippetRequest } from "./UpsertSnippetRequest"; +export { type SnippetsDeleteRequest } from "./SnippetsDeleteRequest"; diff --git a/src/api/resources/snippets/index.ts b/src/api/resources/snippets/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/snippets/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/subscriptions/client/Client.ts b/src/api/resources/subscriptions/client/Client.ts new file mode 100644 index 000000000..ceaa0561f --- /dev/null +++ b/src/api/resources/subscriptions/client/Client.ts @@ -0,0 +1,1054 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Subscriptions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Subscriptions { + constructor(protected readonly _options: Subscriptions.Options = {}) {} + + /** + * 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 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 {Square.CreateSubscriptionRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.create({ + * idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf", + * locationId: "S8GWD5R9QB376", + * planVariationId: "6JHXF3B2CW3YKHDV4XEM674H", + * customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", + * startDate: "2023-06-20", + * cardId: "ccof:qy5x8hHGYsgLrp4Q4GB", + * timezone: "America/Los_Angeles", + * source: { + * name: "My Application" + * }, + * phases: [{ + * ordinal: 0, + * orderTemplateId: "U2NaowWxzXwpsZU697x7ZHOAnCNZY" + * }] + * }) + */ + public async create( + request: Square.CreateSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/subscriptions", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateSubscriptionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/subscriptions."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Schedules a plan variation change for all active subscriptions under a given plan + * variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations). + * + * @param {Square.BulkSwapPlanRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.bulkSwapPlan({ + * newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + * oldPlanVariationId: "6JHXF3B2CW3YKHDV4XEM674H", + * locationId: "S8GWD5R9QB376" + * }) + */ + public async bulkSwapPlan( + request: Square.BulkSwapPlanRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/subscriptions/bulk-swap-plan", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BulkSwapPlanRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BulkSwapPlanResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/subscriptions/bulk-swap-plan.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Searches for subscriptions. + * + * Results are ordered chronologically by subscription creation date. If + * the request specifies more than one location ID, + * the endpoint orders the result + * by location ID, and then by creation date within each location. If no locations are given + * in the query, all locations are searched. + * + * You can also optionally specify `customer_ids` to search by customer. + * If left unset, all customers + * associated with the specified locations are returned. + * If the request specifies customer IDs, the endpoint orders results + * first by location, within location by customer ID, and within + * customer by subscription creation date. + * + * @param {Square.SearchSubscriptionsRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.search({ + * query: { + * filter: { + * customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + * locationIds: ["S8GWD5R9QB376"], + * sourceNames: ["My App"] + * } + * } + * }) + */ + public async search( + request: Square.SearchSubscriptionsRequest = {}, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/subscriptions/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchSubscriptionsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchSubscriptionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/subscriptions/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a specific subscription. + * + * @param {Square.SubscriptionsGetRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.get({ + * subscriptionId: "subscription_id" + * }) + */ + public async get( + request: Square.SubscriptionsGetRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, include } = request; + const _queryParams: Record = {}; + if (include !== undefined) { + _queryParams["include"] = include; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/subscriptions/{subscription_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a subscription by modifying or clearing `subscription` field values. + * To clear a field, set its value to `null`. + * + * @param {Square.UpdateSubscriptionRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.update({ + * subscriptionId: "subscription_id", + * subscription: { + * cardId: "{NEW CARD ID}" + * } + * }) + */ + public async update( + request: Square.UpdateSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateSubscriptionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/subscriptions/{subscription_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a scheduled action for a subscription. + * + * @param {Square.SubscriptionsDeleteActionRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.deleteAction({ + * subscriptionId: "subscription_id", + * actionId: "action_id" + * }) + */ + public async deleteAction( + request: Square.SubscriptionsDeleteActionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, actionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}/actions/${encodeURIComponent(actionId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteSubscriptionActionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/subscriptions/{subscription_id}/actions/{action_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates) + * for a subscription. + * + * @param {Square.ChangeBillingAnchorDateRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.changeBillingAnchorDate({ + * subscriptionId: "subscription_id", + * monthlyBillingAnchorDate: 1 + * }) + */ + public async changeBillingAnchorDate( + request: Square.ChangeBillingAnchorDateRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}/billing-anchor`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.ChangeBillingAnchorDateRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ChangeBillingAnchorDateResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/subscriptions/{subscription_id}/billing-anchor.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * 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 {Square.SubscriptionsCancelRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.cancel({ + * subscriptionId: "subscription_id" + * }) + */ + public async cancel( + request: Square.SubscriptionsCancelRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/subscriptions/{subscription_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription. + * + * @param {Square.SubscriptionsListEventsRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.listEvents({ + * subscriptionId: "subscription_id" + * }) + */ + public async listEvents( + request: Square.SubscriptionsListEventsRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const list = async ( + request: Square.SubscriptionsListEventsRequest, + ): Promise => { + const { subscriptionId, cursor, limit } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}/events`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListSubscriptionEventsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/subscriptions/{subscription_id}/events.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.subscriptionEvents ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Schedules a `PAUSE` action to pause an active subscription. + * + * @param {Square.PauseSubscriptionRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.pause({ + * subscriptionId: "subscription_id" + * }) + */ + public async pause( + request: Square.PauseSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}/pause`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.PauseSubscriptionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.PauseSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/subscriptions/{subscription_id}/pause.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Schedules a `RESUME` action to resume a paused or a deactivated subscription. + * + * @param {Square.ResumeSubscriptionRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.resume({ + * subscriptionId: "subscription_id" + * }) + */ + public async resume( + request: Square.ResumeSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.ResumeSubscriptionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ResumeSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/subscriptions/{subscription_id}/resume.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * 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 {Square.SwapPlanRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.subscriptions.swapPlan({ + * subscriptionId: "subscription_id", + * newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + * phases: [{ + * ordinal: 0, + * orderTemplateId: "uhhnjH9osVv3shUADwaC0b3hNxQZY" + * }] + * }) + */ + public async swapPlan( + request: Square.SwapPlanRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/subscriptions/${encodeURIComponent(subscriptionId)}/swap-plan`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SwapPlanRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SwapPlanResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/subscriptions/{subscription_id}/swap-plan.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/subscriptions/client/index.ts b/src/api/resources/subscriptions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/subscriptions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts b/src/api/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts new file mode 100644 index 000000000..b282183e2 --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + * oldPlanVariationId: "6JHXF3B2CW3YKHDV4XEM674H", + * locationId: "S8GWD5R9QB376" + * } + */ +export interface BulkSwapPlanRequest { + /** + * The ID of the new subscription plan variation. + * + * This field is required. + */ + newPlanVariationId: string; + /** + * The ID of the plan variation whose subscriptions should be swapped. Active subscriptions + * using this plan variation will be subscribed to the new plan variation on their next billing + * day. + */ + oldPlanVariationId: string; + /** The ID of the location to associate with the swapped subscriptions. */ + locationId: string; +} diff --git a/src/api/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts b/src/api/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts new file mode 100644 index 000000000..9c715ee5f --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id", + * monthlyBillingAnchorDate: 1 + * } + */ +export interface ChangeBillingAnchorDateRequest { + /** + * The ID of the subscription to update the billing anchor date. + */ + subscriptionId: string; + /** The anchor day for the billing cycle. */ + monthlyBillingAnchorDate?: number | null; + /** + * The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes + * place on the subscription. + * + * When this date is unspecified or falls within the current billing cycle, the billing anchor date + * is changed immediately. + */ + effectiveDate?: string | null; +} diff --git a/src/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts b/src/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts new file mode 100644 index 000000000..027cf2e8c --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts @@ -0,0 +1,89 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf", + * locationId: "S8GWD5R9QB376", + * planVariationId: "6JHXF3B2CW3YKHDV4XEM674H", + * customerId: "CHFGVKYY8RSV93M5KCYTG4PN0G", + * startDate: "2023-06-20", + * cardId: "ccof:qy5x8hHGYsgLrp4Q4GB", + * timezone: "America/Los_Angeles", + * source: { + * name: "My Application" + * }, + * phases: [{ + * ordinal: 0, + * orderTemplateId: "U2NaowWxzXwpsZU697x7ZHOAnCNZY" + * }] + * } + */ +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/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 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. + * If it is unspecified, the subscription starts immediately. + */ + 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 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. + */ + canceledDate?: string; + /** + * 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%. + */ + taxPercentage?: string; + /** + * A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing. + * This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead, + * you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates). + */ + priceOverrideMoney?: Square.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 with a link to pay for their subscription. + */ + cardId?: string; + /** + * 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). + */ + timezone?: string; + /** The origination details of the subscription. */ + source?: Square.SubscriptionSource; + /** The day-of-the-month to change the billing date to. */ + monthlyBillingAnchorDate?: number; + /** array of phases for this subscription */ + phases?: Square.Phase[]; +} diff --git a/src/api/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts b/src/api/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts new file mode 100644 index 000000000..1b7358f4f --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * subscriptionId: "subscription_id" + * } + */ +export interface PauseSubscriptionRequest { + /** + * The ID of the subscription to pause. + */ + subscriptionId: string; + /** + * The `YYYY-MM-DD`-formatted date when the scheduled `PAUSE` action takes place on the subscription. + * + * When this date is unspecified or falls within the current billing cycle, the subscription is paused + * on the starting date of the next billing cycle. + */ + pauseEffectiveDate?: string | null; + /** + * The number of billing cycles the subscription will be paused before it is reactivated. + * + * When this is set, a `RESUME` action is also scheduled to take place on the subscription at + * the end of the specified pause cycle duration. In this case, neither `resume_effective_date` + * nor `resume_change_timing` may be specified. + */ + pauseCycleDuration?: bigint | null; + /** + * The date when the subscription is reactivated by a scheduled `RESUME` action. + * This date must be at least one billing cycle ahead of `pause_effective_date`. + */ + resumeEffectiveDate?: string | null; + /** + * The timing whether the subscription is reactivated immediately or at the end of the billing cycle, relative to + * `resume_effective_date`. + * See [ChangeTiming](#type-changetiming) for possible values + */ + resumeChangeTiming?: Square.ChangeTiming; + /** The user-provided reason to pause the subscription. */ + pauseReason?: string | null; +} diff --git a/src/api/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts b/src/api/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts new file mode 100644 index 000000000..b0c1e5f91 --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * subscriptionId: "subscription_id" + * } + */ +export interface ResumeSubscriptionRequest { + /** + * The ID of the subscription to resume. + */ + subscriptionId: string; + /** The `YYYY-MM-DD`-formatted date when the subscription reactivated. */ + resumeEffectiveDate?: string | null; + /** + * The timing to resume a subscription, relative to the specified + * `resume_effective_date` attribute value. + * See [ChangeTiming](#type-changetiming) for possible values + */ + resumeChangeTiming?: Square.ChangeTiming; +} diff --git a/src/api/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts b/src/api/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts new file mode 100644 index 000000000..cf4de613c --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * customerIds: ["CHFGVKYY8RSV93M5KCYTG4PN0G"], + * locationIds: ["S8GWD5R9QB376"], + * sourceNames: ["My App"] + * } + * } + * } + */ +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/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** + * The upper limit on the number of subscriptions to return + * in a paged response. + */ + limit?: number; + /** + * A subscription query consisting of specified filtering conditions. + * + * If this `query` field is unspecified, the `SearchSubscriptions` call will return all subscriptions. + */ + query?: Square.SearchSubscriptionsQuery; + /** + * An option to include related information in the response. + * + * The supported values are: + * + * - `actions`: to include scheduled actions on the targeted subscriptions. + */ + include?: string[]; +} diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsCancelRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsCancelRequest.ts new file mode 100644 index 000000000..3cae58a24 --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsCancelRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id" + * } + */ +export interface SubscriptionsCancelRequest { + /** + * The ID of the subscription to cancel. + */ + subscriptionId: string; +} diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsDeleteActionRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsDeleteActionRequest.ts new file mode 100644 index 000000000..cb9565e42 --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsDeleteActionRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id", + * actionId: "action_id" + * } + */ +export interface SubscriptionsDeleteActionRequest { + /** + * The ID of the subscription the targeted action is to act upon. + */ + subscriptionId: string; + /** + * The ID of the targeted action to be deleted. + */ + actionId: string; +} diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts new file mode 100644 index 000000000..4146f185b --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id" + * } + */ +export interface SubscriptionsGetRequest { + /** + * The ID of the subscription to retrieve. + */ + subscriptionId: string; + /** + * A query parameter to specify related information to be included in the response. + * + * The supported query parameter values are: + * + * - `actions`: to include scheduled actions on the targeted subscription. + */ + include?: string | null; +} diff --git a/src/api/resources/subscriptions/client/requests/SubscriptionsListEventsRequest.ts b/src/api/resources/subscriptions/client/requests/SubscriptionsListEventsRequest.ts new file mode 100644 index 000000000..e59e0d4ec --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/SubscriptionsListEventsRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id" + * } + */ +export interface SubscriptionsListEventsRequest { + /** + * The ID of the subscription to retrieve the events for. + */ + subscriptionId: string; + /** + * 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). + */ + cursor?: string | null; + /** + * The upper limit on the number of subscription events to return + * in a paged response. + */ + limit?: number | null; +} diff --git a/src/api/resources/subscriptions/client/requests/SwapPlanRequest.ts b/src/api/resources/subscriptions/client/requests/SwapPlanRequest.ts new file mode 100644 index 000000000..56fede5b6 --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/SwapPlanRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * subscriptionId: "subscription_id", + * newPlanVariationId: "FQ7CDXXWSLUJRPM3GFJSJGZ7", + * phases: [{ + * ordinal: 0, + * orderTemplateId: "uhhnjH9osVv3shUADwaC0b3hNxQZY" + * }] + * } + */ +export interface SwapPlanRequest { + /** + * The ID of the subscription to swap the subscription plan for. + */ + subscriptionId: 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?: Square.PhaseInput[] | null; +} diff --git a/src/api/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts b/src/api/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts new file mode 100644 index 000000000..2f2e513e5 --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * subscriptionId: "subscription_id", + * subscription: { + * cardId: "{NEW CARD ID}" + * } + * } + */ +export interface UpdateSubscriptionRequest { + /** + * The ID of the subscription to update. + */ + subscriptionId: string; + /** + * The subscription object containing the current version, and fields to update. + * Unset fields will be left at their current server values, and JSON `null` values will + * be treated as a request to clear the relevant data. + */ + subscription?: Square.Subscription; +} diff --git a/src/api/resources/subscriptions/client/requests/index.ts b/src/api/resources/subscriptions/client/requests/index.ts new file mode 100644 index 000000000..655ad9472 --- /dev/null +++ b/src/api/resources/subscriptions/client/requests/index.ts @@ -0,0 +1,12 @@ +export { type CreateSubscriptionRequest } from "./CreateSubscriptionRequest"; +export { type BulkSwapPlanRequest } from "./BulkSwapPlanRequest"; +export { type SearchSubscriptionsRequest } from "./SearchSubscriptionsRequest"; +export { type SubscriptionsGetRequest } from "./SubscriptionsGetRequest"; +export { type UpdateSubscriptionRequest } from "./UpdateSubscriptionRequest"; +export { type SubscriptionsDeleteActionRequest } from "./SubscriptionsDeleteActionRequest"; +export { type ChangeBillingAnchorDateRequest } from "./ChangeBillingAnchorDateRequest"; +export { type SubscriptionsCancelRequest } from "./SubscriptionsCancelRequest"; +export { type SubscriptionsListEventsRequest } from "./SubscriptionsListEventsRequest"; +export { type PauseSubscriptionRequest } from "./PauseSubscriptionRequest"; +export { type ResumeSubscriptionRequest } from "./ResumeSubscriptionRequest"; +export { type SwapPlanRequest } from "./SwapPlanRequest"; diff --git a/src/api/resources/subscriptions/index.ts b/src/api/resources/subscriptions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/subscriptions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/team/client/Client.ts b/src/api/resources/team/client/Client.ts new file mode 100644 index 000000000..9afd19fc4 --- /dev/null +++ b/src/api/resources/team/client/Client.ts @@ -0,0 +1,366 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; + +export declare namespace Team { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Team { + constructor(protected readonly _options: Team.Options = {}) {} + + /** + * Lists jobs in a seller account. Results are sorted by title in ascending order. + * + * @param {Square.ListJobsRequest} request + * @param {Team.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.team.listJobs() + */ + public async listJobs( + request: Square.ListJobsRequest = {}, + requestOptions?: Team.RequestOptions, + ): Promise { + const { cursor } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/team-members/jobs", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListJobsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/team-members/jobs."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates a job in a seller account. A job defines a title and tip eligibility. Note that + * compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting. + * + * @param {Square.CreateJobRequest} request + * @param {Team.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.team.createJob({ + * job: { + * title: "Cashier", + * isTipEligible: true + * }, + * idempotencyKey: "idempotency-key-0" + * }) + */ + public async createJob( + request: Square.CreateJobRequest, + requestOptions?: Team.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/team-members/jobs", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateJobRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateJobResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/team-members/jobs."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a specified job. + * + * @param {Square.RetrieveJobRequest} request + * @param {Team.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.team.retrieveJob({ + * jobId: "job_id" + * }) + */ + public async retrieveJob( + request: Square.RetrieveJobRequest, + requestOptions?: Team.RequestOptions, + ): Promise { + const { jobId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/team-members/jobs/${encodeURIComponent(jobId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.RetrieveJobResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/team-members/jobs/{job_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates the title or tip eligibility of a job. Changes to the title propagate to all + * `JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to + * tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID. + * + * @param {Square.UpdateJobRequest} request + * @param {Team.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.team.updateJob({ + * jobId: "job_id", + * job: { + * title: "Cashier 1", + * isTipEligible: true + * } + * }) + */ + public async updateJob( + request: Square.UpdateJobRequest, + requestOptions?: Team.RequestOptions, + ): Promise { + const { jobId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/team-members/jobs/${encodeURIComponent(jobId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateJobRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateJobResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/team-members/jobs/{job_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/team/client/index.ts b/src/api/resources/team/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/team/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/team/client/requests/CreateJobRequest.ts b/src/api/resources/team/client/requests/CreateJobRequest.ts new file mode 100644 index 000000000..168657c5b --- /dev/null +++ b/src/api/resources/team/client/requests/CreateJobRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * job: { + * title: "Cashier", + * isTipEligible: true + * }, + * idempotencyKey: "idempotency-key-0" + * } + */ +export interface CreateJobRequest { + /** The job to create. The `title` field is required and `is_tip_eligible` defaults to true. */ + job: Square.Job; + /** + * A unique identifier for the `CreateJob` request. Keys can be any valid string, + * but must be unique for each request. For more information, see + * [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey: string; +} diff --git a/src/api/resources/team/client/requests/ListJobsRequest.ts b/src/api/resources/team/client/requests/ListJobsRequest.ts new file mode 100644 index 000000000..ac21e815f --- /dev/null +++ b/src/api/resources/team/client/requests/ListJobsRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ListJobsRequest { + /** + * The pagination cursor returned by the previous call to this endpoint. Provide this + * cursor to retrieve the next page of results for your original request. For more information, + * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; +} diff --git a/src/api/resources/team/client/requests/RetrieveJobRequest.ts b/src/api/resources/team/client/requests/RetrieveJobRequest.ts new file mode 100644 index 000000000..a4b709eb1 --- /dev/null +++ b/src/api/resources/team/client/requests/RetrieveJobRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * jobId: "job_id" + * } + */ +export interface RetrieveJobRequest { + /** + * The ID of the job to retrieve. + */ + jobId: string; +} diff --git a/src/api/resources/team/client/requests/UpdateJobRequest.ts b/src/api/resources/team/client/requests/UpdateJobRequest.ts new file mode 100644 index 000000000..2889c5bab --- /dev/null +++ b/src/api/resources/team/client/requests/UpdateJobRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * jobId: "job_id", + * job: { + * title: "Cashier 1", + * isTipEligible: true + * } + * } + */ +export interface UpdateJobRequest { + /** + * The ID of the job to update. + */ + jobId: string; + /** + * The job with the updated fields, either `title`, `is_tip_eligible`, or both. Only changed fields need + * to be included in the request. Optionally include `version` to enable optimistic concurrency control. + */ + job: Square.Job; +} diff --git a/src/api/resources/team/client/requests/index.ts b/src/api/resources/team/client/requests/index.ts new file mode 100644 index 000000000..1ade5cbcb --- /dev/null +++ b/src/api/resources/team/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type ListJobsRequest } from "./ListJobsRequest"; +export { type CreateJobRequest } from "./CreateJobRequest"; +export { type RetrieveJobRequest } from "./RetrieveJobRequest"; +export { type UpdateJobRequest } from "./UpdateJobRequest"; diff --git a/src/api/resources/team/index.ts b/src/api/resources/team/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/team/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/teamMembers/client/Client.ts b/src/api/resources/teamMembers/client/Client.ts new file mode 100644 index 000000000..2fcbf23fd --- /dev/null +++ b/src/api/resources/teamMembers/client/Client.ts @@ -0,0 +1,638 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; +import { WageSetting } from "../resources/wageSetting/client/Client"; + +export declare namespace TeamMembers { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class TeamMembers { + protected _wageSetting: WageSetting | undefined; + + constructor(protected readonly _options: TeamMembers.Options = {}) {} + + public get wageSetting(): WageSetting { + return (this._wageSetting ??= new WageSetting(this._options)); + } + + /** + * Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates. + * You must provide the following values in your request to this endpoint: + * - `given_name` + * - `family_name` + * + * Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteammember). + * + * @param {Square.CreateTeamMemberRequest} request + * @param {TeamMembers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.teamMembers.create({ + * 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"] + * }, + * wageSetting: { + * jobAssignments: [{ + * payType: "SALARY", + * annualRate: { + * amount: 3000000, + * currency: "USD" + * }, + * weeklyHours: 40, + * jobId: "FjS8x95cqHiMenw4f1NAUH4P" + * }, { + * payType: "HOURLY", + * hourlyRate: { + * amount: 2000, + * currency: "USD" + * }, + * jobId: "VDNpRv8da51NU8qZFC5zDWpF" + * }], + * isOvertimeExempt: true + * } + * } + * }) + */ + public async create( + request: Square.CreateTeamMemberRequest, + requestOptions?: TeamMembers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/team-members", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateTeamMemberRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateTeamMemberResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/team-members."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful creates. + * This process is non-transactional and processes as much of the request as possible. If one of the creates in + * the request cannot be successfully processed, the request is not marked as failed, but the body of the response + * contains explicit error information for the failed create. + * + * Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-team-members). + * + * @param {Square.BatchCreateTeamMembersRequest} request + * @param {TeamMembers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.teamMembers.batchCreate({ + * 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" + * } + * } + * } + * } + * }) + */ + public async batchCreate( + request: Square.BatchCreateTeamMembersRequest, + requestOptions?: TeamMembers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/team-members/bulk-create", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchCreateTeamMembersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchCreateTeamMembersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/team-members/bulk-create."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates. + * This process is non-transactional and processes as much of the request as possible. If one of the updates in + * the request cannot be successfully processed, the request is not marked as failed, but the body of the response + * contains explicit error information for the failed update. + * Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members). + * + * @param {Square.BatchUpdateTeamMembersRequest} request + * @param {TeamMembers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.teamMembers.batchUpdate({ + * 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"] + * } + * } + * } + * } + * }) + */ + public async batchUpdate( + request: Square.BatchUpdateTeamMembersRequest, + requestOptions?: TeamMembers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/team-members/bulk-update", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchUpdateTeamMembersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchUpdateTeamMembersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/team-members/bulk-update."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns a paginated list of `TeamMember` objects for a business. + * The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether + * the team member is the Square account owner. + * + * @param {Square.SearchTeamMembersRequest} request + * @param {TeamMembers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.teamMembers.search({ + * query: { + * filter: { + * locationIds: ["0G5P3VGACMMQZ"], + * status: "ACTIVE" + * } + * }, + * limit: 10 + * }) + */ + public async search( + request: Square.SearchTeamMembersRequest = {}, + requestOptions?: TeamMembers.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/team-members/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchTeamMembersRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchTeamMembersResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/team-members/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a `TeamMember` object for the given `TeamMember.id`. + * Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member). + * + * @param {Square.TeamMembersGetRequest} request + * @param {TeamMembers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.teamMembers.get({ + * teamMemberId: "team_member_id" + * }) + */ + public async get( + request: Square.TeamMembersGetRequest, + requestOptions?: TeamMembers.RequestOptions, + ): Promise { + const { teamMemberId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/team-members/${encodeURIComponent(teamMemberId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTeamMemberResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/team-members/{team_member_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates. + * Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member). + * + * @param {Square.TeamMembersUpdateRequest} request + * @param {TeamMembers.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.teamMembers.update({ + * teamMemberId: "team_member_id", + * body: { + * 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"] + * } + * } + * } + * }) + */ + public async update( + request: Square.TeamMembersUpdateRequest, + requestOptions?: TeamMembers.RequestOptions, + ): Promise { + const { teamMemberId, body: _body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/team-members/${encodeURIComponent(teamMemberId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateTeamMemberRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateTeamMemberResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/team-members/{team_member_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/teamMembers/client/index.ts b/src/api/resources/teamMembers/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/teamMembers/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts b/src/api/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts new file mode 100644 index 000000000..b14d89bb5 --- /dev/null +++ b/src/api/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * 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" + * } + * } + * } + * } + * } + */ +export interface BatchCreateTeamMembersRequest { + /** + * The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. + * The maximum number of create objects is 25. + * + * If you include a team member's `wage_setting`, you must provide `job_id` for each job assignment. To get job IDs, + * call [ListJobs](api-endpoint:Team-ListJobs). + */ + teamMembers: Record; +} diff --git a/src/api/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts b/src/api/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts new file mode 100644 index 000000000..a29378d92 --- /dev/null +++ b/src/api/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * 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"] + * } + * } + * } + * } + * } + */ +export interface BatchUpdateTeamMembersRequest { + /** + * The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. + * The maximum number of update objects is 25. + * + * For each team member, include the fields to add, change, or clear. Fields can be cleared using a null value. + * To update `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, + * call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values. + */ + teamMembers: Record; +} diff --git a/src/api/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts b/src/api/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts new file mode 100644 index 000000000..2e097261d --- /dev/null +++ b/src/api/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * locationIds: ["0G5P3VGACMMQZ"], + * status: "ACTIVE" + * } + * }, + * limit: 10 + * } + */ +export interface SearchTeamMembersRequest { + /** The query parameters. */ + query?: Square.SearchTeamMembersQuery; + /** The maximum number of `TeamMember` objects in a page (100 by default). */ + limit?: number; + /** + * The opaque cursor for fetching the next page. For more information, see + * [pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string; +} diff --git a/src/api/resources/teamMembers/client/requests/TeamMembersGetRequest.ts b/src/api/resources/teamMembers/client/requests/TeamMembersGetRequest.ts new file mode 100644 index 000000000..8f3780449 --- /dev/null +++ b/src/api/resources/teamMembers/client/requests/TeamMembersGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * teamMemberId: "team_member_id" + * } + */ +export interface TeamMembersGetRequest { + /** + * The ID of the team member to retrieve. + */ + teamMemberId: string; +} diff --git a/src/api/resources/teamMembers/client/requests/TeamMembersUpdateRequest.ts b/src/api/resources/teamMembers/client/requests/TeamMembersUpdateRequest.ts new file mode 100644 index 000000000..443507085 --- /dev/null +++ b/src/api/resources/teamMembers/client/requests/TeamMembersUpdateRequest.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * teamMemberId: "team_member_id", + * body: { + * 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"] + * } + * } + * } + * } + */ +export interface TeamMembersUpdateRequest { + /** + * The ID of the team member to update. + */ + teamMemberId: string; + body: Square.UpdateTeamMemberRequest; +} diff --git a/src/api/resources/teamMembers/client/requests/index.ts b/src/api/resources/teamMembers/client/requests/index.ts new file mode 100644 index 000000000..5f2f5af35 --- /dev/null +++ b/src/api/resources/teamMembers/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type BatchCreateTeamMembersRequest } from "./BatchCreateTeamMembersRequest"; +export { type BatchUpdateTeamMembersRequest } from "./BatchUpdateTeamMembersRequest"; +export { type SearchTeamMembersRequest } from "./SearchTeamMembersRequest"; +export { type TeamMembersGetRequest } from "./TeamMembersGetRequest"; +export { type TeamMembersUpdateRequest } from "./TeamMembersUpdateRequest"; diff --git a/src/api/resources/teamMembers/index.ts b/src/api/resources/teamMembers/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/teamMembers/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/teamMembers/resources/index.ts b/src/api/resources/teamMembers/resources/index.ts new file mode 100644 index 000000000..921a5bbe9 --- /dev/null +++ b/src/api/resources/teamMembers/resources/index.ts @@ -0,0 +1,2 @@ +export * as wageSetting from "./wageSetting"; +export * from "./wageSetting/client/requests"; diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts b/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts new file mode 100644 index 000000000..a5ff7c31a --- /dev/null +++ b/src/api/resources/teamMembers/resources/wageSetting/client/Client.ts @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace WageSetting { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class WageSetting { + constructor(protected readonly _options: WageSetting.Options = {}) {} + + /** + * Retrieves a `WageSetting` object for a team member specified + * by `TeamMember.id`. For more information, see + * [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrievewagesetting). + * + * Square recommends using [RetrieveTeamMember](api-endpoint:Team-RetrieveTeamMember) or [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) + * to get this information directly from the `TeamMember.wage_setting` field. + * + * @param {Square.teamMembers.WageSettingGetRequest} request + * @param {WageSetting.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.teamMembers.wageSetting.get({ + * teamMemberId: "team_member_id" + * }) + */ + public async get( + request: Square.teamMembers.WageSettingGetRequest, + requestOptions?: WageSetting.RequestOptions, + ): Promise { + const { teamMemberId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/team-members/${encodeURIComponent(teamMemberId)}/wage-setting`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetWageSettingResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/team-members/{team_member_id}/wage-setting.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates or updates a `WageSetting` object. The object is created if a + * `WageSetting` with the specified `team_member_id` doesn't exist. Otherwise, + * it fully replaces the `WageSetting` object for the team member. + * The `WageSetting` is returned on a successful update. For more information, see + * [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting). + * + * Square recommends using [CreateTeamMember](api-endpoint:Team-CreateTeamMember) or [UpdateTeamMember](api-endpoint:Team-UpdateTeamMember) + * to manage the `TeamMember.wage_setting` field directly. + * + * @param {Square.teamMembers.UpdateWageSettingRequest} request + * @param {WageSetting.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.teamMembers.wageSetting.update({ + * teamMemberId: "team_member_id", + * wageSetting: { + * jobAssignments: [{ + * jobTitle: "Manager", + * payType: "SALARY", + * annualRate: { + * amount: 3000000, + * currency: "USD" + * }, + * weeklyHours: 40 + * }, { + * jobTitle: "Cashier", + * payType: "HOURLY", + * hourlyRate: { + * amount: 2000, + * currency: "USD" + * } + * }], + * isOvertimeExempt: true + * } + * }) + */ + public async update( + request: Square.teamMembers.UpdateWageSettingRequest, + requestOptions?: WageSetting.RequestOptions, + ): Promise { + const { teamMemberId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/team-members/${encodeURIComponent(teamMemberId)}/wage-setting`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.teamMembers.UpdateWageSettingRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateWageSettingResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/team-members/{team_member_id}/wage-setting.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/index.ts b/src/api/resources/teamMembers/resources/wageSetting/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/teamMembers/resources/wageSetting/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts b/src/api/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts new file mode 100644 index 000000000..2714623e6 --- /dev/null +++ b/src/api/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * teamMemberId: "team_member_id", + * wageSetting: { + * jobAssignments: [{ + * jobTitle: "Manager", + * payType: "SALARY", + * annualRate: { + * amount: 3000000, + * currency: "USD" + * }, + * weeklyHours: 40 + * }, { + * jobTitle: "Cashier", + * payType: "HOURLY", + * hourlyRate: { + * amount: 2000, + * currency: "USD" + * } + * }], + * isOvertimeExempt: true + * } + * } + */ +export interface UpdateWageSettingRequest { + /** + * The ID of the team member for which to update the `WageSetting` object. + */ + teamMemberId: string; + /** + * The complete `WageSetting` object. For all job assignments, specify one of the following: + * - `job_id` (recommended) - If needed, call [ListJobs](api-endpoint:Team-ListJobs) to get a list of all jobs. + * Requires Square API version 2024-12-18 or later. + * - `job_title` - Use the exact, case-sensitive spelling of an existing title unless you want to create a new job. + * This value is ignored if `job_id` is also provided. + */ + wageSetting: Square.WageSetting; +} diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/requests/WageSettingGetRequest.ts b/src/api/resources/teamMembers/resources/wageSetting/client/requests/WageSettingGetRequest.ts new file mode 100644 index 000000000..d7cc7cc13 --- /dev/null +++ b/src/api/resources/teamMembers/resources/wageSetting/client/requests/WageSettingGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * teamMemberId: "team_member_id" + * } + */ +export interface WageSettingGetRequest { + /** + * The ID of the team member for which to retrieve the wage setting. + */ + teamMemberId: string; +} diff --git a/src/api/resources/teamMembers/resources/wageSetting/client/requests/index.ts b/src/api/resources/teamMembers/resources/wageSetting/client/requests/index.ts new file mode 100644 index 000000000..9db8b1d9f --- /dev/null +++ b/src/api/resources/teamMembers/resources/wageSetting/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type WageSettingGetRequest } from "./WageSettingGetRequest"; +export { type UpdateWageSettingRequest } from "./UpdateWageSettingRequest"; diff --git a/src/api/resources/teamMembers/resources/wageSetting/index.ts b/src/api/resources/teamMembers/resources/wageSetting/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/teamMembers/resources/wageSetting/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/terminal/client/Client.ts b/src/api/resources/terminal/client/Client.ts new file mode 100644 index 000000000..2d81f0897 --- /dev/null +++ b/src/api/resources/terminal/client/Client.ts @@ -0,0 +1,294 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../serialization/index"; +import * as errors from "../../../../errors/index"; +import { Actions } from "../resources/actions/client/Client"; +import { Checkouts } from "../resources/checkouts/client/Client"; +import { Refunds } from "../resources/refunds/client/Client"; + +export declare namespace Terminal { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Terminal { + protected _actions: Actions | undefined; + protected _checkouts: Checkouts | undefined; + protected _refunds: Refunds | undefined; + + constructor(protected readonly _options: Terminal.Options = {}) {} + + public get actions(): Actions { + return (this._actions ??= new Actions(this._options)); + } + + public get checkouts(): Checkouts { + return (this._checkouts ??= new Checkouts(this._options)); + } + + public get refunds(): Refunds { + return (this._refunds ??= new Refunds(this._options)); + } + + /** + * 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 {Square.DismissTerminalActionRequest} request + * @param {Terminal.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.dismissTerminalAction({ + * actionId: "action_id" + * }) + */ + public async dismissTerminalAction( + request: Square.DismissTerminalActionRequest, + requestOptions?: Terminal.RequestOptions, + ): Promise { + const { actionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/actions/${encodeURIComponent(actionId)}/dismiss`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DismissTerminalActionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/terminals/actions/{action_id}/dismiss.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Dismisses a Terminal checkout request if the status and type of the request permits it. + * + * @param {Square.DismissTerminalCheckoutRequest} request + * @param {Terminal.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.dismissTerminalCheckout({ + * checkoutId: "checkout_id" + * }) + */ + public async dismissTerminalCheckout( + request: Square.DismissTerminalCheckoutRequest, + requestOptions?: Terminal.RequestOptions, + ): Promise { + const { checkoutId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/checkouts/${encodeURIComponent(checkoutId)}/dismiss`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DismissTerminalCheckoutResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/terminals/checkouts/{checkout_id}/dismiss.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Dismisses a Terminal refund request if the status and type of the request permits it. + * + * @param {Square.DismissTerminalRefundRequest} request + * @param {Terminal.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.dismissTerminalRefund({ + * terminalRefundId: "terminal_refund_id" + * }) + */ + public async dismissTerminalRefund( + request: Square.DismissTerminalRefundRequest, + requestOptions?: Terminal.RequestOptions, + ): Promise { + const { terminalRefundId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/refunds/${encodeURIComponent(terminalRefundId)}/dismiss`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DismissTerminalRefundResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/terminals/refunds/{terminal_refund_id}/dismiss.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/terminal/client/index.ts b/src/api/resources/terminal/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/terminal/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/terminal/client/requests/DismissTerminalActionRequest.ts b/src/api/resources/terminal/client/requests/DismissTerminalActionRequest.ts new file mode 100644 index 000000000..950b3ab0c --- /dev/null +++ b/src/api/resources/terminal/client/requests/DismissTerminalActionRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * actionId: "action_id" + * } + */ +export interface DismissTerminalActionRequest { + /** + * Unique ID for the `TerminalAction` associated with the action to be dismissed. + */ + actionId: string; +} diff --git a/src/api/resources/terminal/client/requests/DismissTerminalCheckoutRequest.ts b/src/api/resources/terminal/client/requests/DismissTerminalCheckoutRequest.ts new file mode 100644 index 000000000..3ff7298a2 --- /dev/null +++ b/src/api/resources/terminal/client/requests/DismissTerminalCheckoutRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * checkoutId: "checkout_id" + * } + */ +export interface DismissTerminalCheckoutRequest { + /** + * Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed. + */ + checkoutId: string; +} diff --git a/src/api/resources/terminal/client/requests/DismissTerminalRefundRequest.ts b/src/api/resources/terminal/client/requests/DismissTerminalRefundRequest.ts new file mode 100644 index 000000000..699bf5b40 --- /dev/null +++ b/src/api/resources/terminal/client/requests/DismissTerminalRefundRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * terminalRefundId: "terminal_refund_id" + * } + */ +export interface DismissTerminalRefundRequest { + /** + * Unique ID for the `TerminalRefund` associated with the refund to be dismissed. + */ + terminalRefundId: string; +} diff --git a/src/api/resources/terminal/client/requests/index.ts b/src/api/resources/terminal/client/requests/index.ts new file mode 100644 index 000000000..f3e44661a --- /dev/null +++ b/src/api/resources/terminal/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type DismissTerminalActionRequest } from "./DismissTerminalActionRequest"; +export { type DismissTerminalCheckoutRequest } from "./DismissTerminalCheckoutRequest"; +export { type DismissTerminalRefundRequest } from "./DismissTerminalRefundRequest"; diff --git a/src/api/resources/terminal/index.ts b/src/api/resources/terminal/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/terminal/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/terminal/resources/actions/client/Client.ts b/src/api/resources/terminal/resources/actions/client/Client.ts new file mode 100644 index 000000000..39d7bff2b --- /dev/null +++ b/src/api/resources/terminal/resources/actions/client/Client.ts @@ -0,0 +1,369 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Actions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Actions { + constructor(protected readonly _options: Actions.Options = {}) {} + + /** + * Creates a Terminal action request and sends it to the specified device. + * + * @param {Square.terminal.CreateTerminalActionRequest} request + * @param {Actions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.actions.create({ + * idempotencyKey: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", + * action: { + * deviceId: "{{DEVICE_ID}}", + * deadlineDuration: "PT5M", + * type: "SAVE_CARD", + * saveCardOptions: { + * customerId: "{{CUSTOMER_ID}}", + * referenceId: "user-id-1" + * } + * } + * }) + */ + public async create( + request: Square.terminal.CreateTerminalActionRequest, + requestOptions?: Actions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/terminals/actions", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.terminal.CreateTerminalActionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateTerminalActionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/terminals/actions."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. + * + * @param {Square.terminal.SearchTerminalActionsRequest} request + * @param {Actions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.actions.search({ + * query: { + * filter: { + * createdAt: { + * startAt: "2022-04-01T00:00:00.000Z" + * } + * }, + * sort: { + * sortOrder: "DESC" + * } + * }, + * limit: 2 + * }) + */ + public async search( + request: Square.terminal.SearchTerminalActionsRequest = {}, + requestOptions?: Actions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/terminals/actions/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.terminal.SearchTerminalActionsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchTerminalActionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/terminals/actions/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days. + * + * @param {Square.terminal.ActionsGetRequest} request + * @param {Actions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.actions.get({ + * actionId: "action_id" + * }) + */ + public async get( + request: Square.terminal.ActionsGetRequest, + requestOptions?: Actions.RequestOptions, + ): Promise { + const { actionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/actions/${encodeURIComponent(actionId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTerminalActionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/terminals/actions/{action_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels a Terminal action request if the status of the request permits it. + * + * @param {Square.terminal.ActionsCancelRequest} request + * @param {Actions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.actions.cancel({ + * actionId: "action_id" + * }) + */ + public async cancel( + request: Square.terminal.ActionsCancelRequest, + requestOptions?: Actions.RequestOptions, + ): Promise { + const { actionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/actions/${encodeURIComponent(actionId)}/cancel`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelTerminalActionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/terminals/actions/{action_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/terminal/resources/actions/client/index.ts b/src/api/resources/terminal/resources/actions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/terminal/resources/actions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/terminal/resources/actions/client/requests/ActionsCancelRequest.ts b/src/api/resources/terminal/resources/actions/client/requests/ActionsCancelRequest.ts new file mode 100644 index 000000000..720831cc0 --- /dev/null +++ b/src/api/resources/terminal/resources/actions/client/requests/ActionsCancelRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * actionId: "action_id" + * } + */ +export interface ActionsCancelRequest { + /** + * Unique ID for the desired `TerminalAction`. + */ + actionId: string; +} diff --git a/src/api/resources/terminal/resources/actions/client/requests/ActionsGetRequest.ts b/src/api/resources/terminal/resources/actions/client/requests/ActionsGetRequest.ts new file mode 100644 index 000000000..30057de94 --- /dev/null +++ b/src/api/resources/terminal/resources/actions/client/requests/ActionsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * actionId: "action_id" + * } + */ +export interface ActionsGetRequest { + /** + * Unique ID for the desired `TerminalAction`. + */ + actionId: string; +} diff --git a/src/api/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts b/src/api/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts new file mode 100644 index 000000000..95d1c87d1 --- /dev/null +++ b/src/api/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e", + * action: { + * deviceId: "{{DEVICE_ID}}", + * deadlineDuration: "PT5M", + * type: "SAVE_CARD", + * saveCardOptions: { + * customerId: "{{CUSTOMER_ID}}", + * referenceId: "user-id-1" + * } + * } + * } + */ +export interface CreateTerminalActionRequest { + /** + * A unique string that identifies this `CreateAction` request. Keys can be any valid string + * but must be unique for every `CreateAction` request. + * + * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more + * information. + */ + idempotencyKey: string; + /** The Action to create. */ + action: Square.TerminalAction; +} diff --git a/src/api/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts b/src/api/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts new file mode 100644 index 000000000..7b4697a8e --- /dev/null +++ b/src/api/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * createdAt: { + * startAt: "2022-04-01T00:00:00.000Z" + * } + * }, + * sort: { + * sortOrder: "DESC" + * } + * }, + * limit: 2 + * } + */ +export interface SearchTerminalActionsRequest { + /** + * Queries terminal actions based on given conditions and sort order. + * Leaving this unset will return all actions with the default sort order. + */ + query?: Square.TerminalActionQuery; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for the original query. + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more + * information. + */ + cursor?: string; + /** Limit the number of results returned for a single request. */ + limit?: number; +} diff --git a/src/api/resources/terminal/resources/actions/client/requests/index.ts b/src/api/resources/terminal/resources/actions/client/requests/index.ts new file mode 100644 index 000000000..90ac13f82 --- /dev/null +++ b/src/api/resources/terminal/resources/actions/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type CreateTerminalActionRequest } from "./CreateTerminalActionRequest"; +export { type SearchTerminalActionsRequest } from "./SearchTerminalActionsRequest"; +export { type ActionsGetRequest } from "./ActionsGetRequest"; +export { type ActionsCancelRequest } from "./ActionsCancelRequest"; diff --git a/src/api/resources/terminal/resources/actions/index.ts b/src/api/resources/terminal/resources/actions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/terminal/resources/actions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/terminal/resources/checkouts/client/Client.ts b/src/api/resources/terminal/resources/checkouts/client/Client.ts new file mode 100644 index 000000000..a8eab28e8 --- /dev/null +++ b/src/api/resources/terminal/resources/checkouts/client/Client.ts @@ -0,0 +1,369 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Checkouts { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Checkouts { + constructor(protected readonly _options: Checkouts.Options = {}) {} + + /** + * Creates a Terminal checkout request and sends it to the specified device to take a payment + * for the requested amount. + * + * @param {Square.terminal.CreateTerminalCheckoutRequest} request + * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.checkouts.create({ + * idempotencyKey: "28a0c3bc-7839-11ea-bc55-0242ac130003", + * checkout: { + * amountMoney: { + * amount: 2610, + * currency: "USD" + * }, + * referenceId: "id11572", + * note: "A brief note", + * deviceOptions: { + * deviceId: "dbb5d83a-7838-11ea-bc55-0242ac130003" + * } + * } + * }) + */ + public async create( + request: Square.terminal.CreateTerminalCheckoutRequest, + requestOptions?: Checkouts.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/terminals/checkouts", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.terminal.CreateTerminalCheckoutRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateTerminalCheckoutResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/terminals/checkouts."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. + * + * @param {Square.terminal.SearchTerminalCheckoutsRequest} request + * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.checkouts.search({ + * query: { + * filter: { + * status: "COMPLETED" + * } + * }, + * limit: 2 + * }) + */ + public async search( + request: Square.terminal.SearchTerminalCheckoutsRequest = {}, + requestOptions?: Checkouts.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/terminals/checkouts/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.terminal.SearchTerminalCheckoutsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchTerminalCheckoutsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/terminals/checkouts/search.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days. + * + * @param {Square.terminal.CheckoutsGetRequest} request + * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.checkouts.get({ + * checkoutId: "checkout_id" + * }) + */ + public async get( + request: Square.terminal.CheckoutsGetRequest, + requestOptions?: Checkouts.RequestOptions, + ): Promise { + const { checkoutId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/checkouts/${encodeURIComponent(checkoutId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTerminalCheckoutResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/terminals/checkouts/{checkout_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels a Terminal checkout request if the status of the request permits it. + * + * @param {Square.terminal.CheckoutsCancelRequest} request + * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.checkouts.cancel({ + * checkoutId: "checkout_id" + * }) + */ + public async cancel( + request: Square.terminal.CheckoutsCancelRequest, + requestOptions?: Checkouts.RequestOptions, + ): Promise { + const { checkoutId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/checkouts/${encodeURIComponent(checkoutId)}/cancel`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelTerminalCheckoutResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/terminals/checkouts/{checkout_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/terminal/resources/checkouts/client/index.ts b/src/api/resources/terminal/resources/checkouts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/terminal/resources/checkouts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/CheckoutsCancelRequest.ts b/src/api/resources/terminal/resources/checkouts/client/requests/CheckoutsCancelRequest.ts new file mode 100644 index 000000000..3420dfd34 --- /dev/null +++ b/src/api/resources/terminal/resources/checkouts/client/requests/CheckoutsCancelRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * checkoutId: "checkout_id" + * } + */ +export interface CheckoutsCancelRequest { + /** + * The unique ID for the desired `TerminalCheckout`. + */ + checkoutId: string; +} diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/CheckoutsGetRequest.ts b/src/api/resources/terminal/resources/checkouts/client/requests/CheckoutsGetRequest.ts new file mode 100644 index 000000000..1037469e5 --- /dev/null +++ b/src/api/resources/terminal/resources/checkouts/client/requests/CheckoutsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * checkoutId: "checkout_id" + * } + */ +export interface CheckoutsGetRequest { + /** + * The unique ID for the desired `TerminalCheckout`. + */ + checkoutId: string; +} diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts b/src/api/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts new file mode 100644 index 000000000..7cf248165 --- /dev/null +++ b/src/api/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "28a0c3bc-7839-11ea-bc55-0242ac130003", + * checkout: { + * amountMoney: { + * amount: 2610, + * currency: "USD" + * }, + * referenceId: "id11572", + * note: "A brief note", + * deviceOptions: { + * deviceId: "dbb5d83a-7838-11ea-bc55-0242ac130003" + * } + * } + * } + */ +export interface CreateTerminalCheckoutRequest { + /** + * A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but + * must be unique for every `CreateCheckout` request. + * + * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + */ + idempotencyKey: string; + /** The checkout to create. */ + checkout: Square.TerminalCheckout; +} diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts b/src/api/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts new file mode 100644 index 000000000..06ef4a3d5 --- /dev/null +++ b/src/api/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * status: "COMPLETED" + * } + * }, + * limit: 2 + * } + */ +export interface SearchTerminalCheckoutsRequest { + /** + * Queries Terminal checkouts based on given conditions and the sort order. + * Leaving these unset returns all checkouts with the default sort order. + */ + query?: Square.TerminalCheckoutQuery; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string; + /** Limits the number of results returned for a single request. */ + limit?: number; +} diff --git a/src/api/resources/terminal/resources/checkouts/client/requests/index.ts b/src/api/resources/terminal/resources/checkouts/client/requests/index.ts new file mode 100644 index 000000000..cf530c3a0 --- /dev/null +++ b/src/api/resources/terminal/resources/checkouts/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type CreateTerminalCheckoutRequest } from "./CreateTerminalCheckoutRequest"; +export { type SearchTerminalCheckoutsRequest } from "./SearchTerminalCheckoutsRequest"; +export { type CheckoutsGetRequest } from "./CheckoutsGetRequest"; +export { type CheckoutsCancelRequest } from "./CheckoutsCancelRequest"; diff --git a/src/api/resources/terminal/resources/checkouts/index.ts b/src/api/resources/terminal/resources/checkouts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/terminal/resources/checkouts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/terminal/resources/index.ts b/src/api/resources/terminal/resources/index.ts new file mode 100644 index 000000000..9c6d9980c --- /dev/null +++ b/src/api/resources/terminal/resources/index.ts @@ -0,0 +1,6 @@ +export * as actions from "./actions"; +export * as checkouts from "./checkouts"; +export * as refunds from "./refunds"; +export * from "./actions/client/requests"; +export * from "./checkouts/client/requests"; +export * from "./refunds/client/requests"; diff --git a/src/api/resources/terminal/resources/refunds/client/Client.ts b/src/api/resources/terminal/resources/refunds/client/Client.ts new file mode 100644 index 000000000..349f49315 --- /dev/null +++ b/src/api/resources/terminal/resources/refunds/client/Client.ts @@ -0,0 +1,364 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Refunds { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Refunds { + constructor(protected readonly _options: Refunds.Options = {}) {} + + /** + * Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](api:Refunds). + * + * @param {Square.terminal.CreateTerminalRefundRequest} request + * @param {Refunds.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.refunds.create({ + * idempotencyKey: "402a640b-b26f-401f-b406-46f839590c04", + * refund: { + * paymentId: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + * amountMoney: { + * amount: 111, + * currency: "CAD" + * }, + * reason: "Returning items", + * deviceId: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291" + * } + * }) + */ + public async create( + request: Square.terminal.CreateTerminalRefundRequest, + requestOptions?: Refunds.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/terminals/refunds", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.terminal.CreateTerminalRefundRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateTerminalRefundResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/terminals/refunds."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. + * + * @param {Square.terminal.SearchTerminalRefundsRequest} request + * @param {Refunds.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.refunds.search({ + * query: { + * filter: { + * status: "COMPLETED" + * } + * }, + * limit: 1 + * }) + */ + public async search( + request: Square.terminal.SearchTerminalRefundsRequest = {}, + requestOptions?: Refunds.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/terminals/refunds/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.terminal.SearchTerminalRefundsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchTerminalRefundsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/terminals/refunds/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days. + * + * @param {Square.terminal.RefundsGetRequest} request + * @param {Refunds.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.refunds.get({ + * terminalRefundId: "terminal_refund_id" + * }) + */ + public async get( + request: Square.terminal.RefundsGetRequest, + requestOptions?: Refunds.RequestOptions, + ): Promise { + const { terminalRefundId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/refunds/${encodeURIComponent(terminalRefundId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetTerminalRefundResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/terminals/refunds/{terminal_refund_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it. + * + * @param {Square.terminal.RefundsCancelRequest} request + * @param {Refunds.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.terminal.refunds.cancel({ + * terminalRefundId: "terminal_refund_id" + * }) + */ + public async cancel( + request: Square.terminal.RefundsCancelRequest, + requestOptions?: Refunds.RequestOptions, + ): Promise { + const { terminalRefundId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/terminals/refunds/${encodeURIComponent(terminalRefundId)}/cancel`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CancelTerminalRefundResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/terminals/refunds/{terminal_refund_id}/cancel.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/terminal/resources/refunds/client/index.ts b/src/api/resources/terminal/resources/refunds/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/terminal/resources/refunds/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts b/src/api/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts new file mode 100644 index 000000000..624a728ea --- /dev/null +++ b/src/api/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "402a640b-b26f-401f-b406-46f839590c04", + * refund: { + * paymentId: "5O5OvgkcNUhl7JBuINflcjKqUzXZY", + * amountMoney: { + * amount: 111, + * currency: "CAD" + * }, + * reason: "Returning items", + * deviceId: "f72dfb8e-4d65-4e56-aade-ec3fb8d33291" + * } + * } + */ +export interface CreateTerminalRefundRequest { + /** + * A unique string that identifies this `CreateRefund` request. Keys can be any valid string but + * must be unique for every `CreateRefund` request. + * + * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + */ + idempotencyKey: string; + /** The refund to create. */ + refund?: Square.TerminalRefund; +} diff --git a/src/api/resources/terminal/resources/refunds/client/requests/RefundsCancelRequest.ts b/src/api/resources/terminal/resources/refunds/client/requests/RefundsCancelRequest.ts new file mode 100644 index 000000000..d534e7eda --- /dev/null +++ b/src/api/resources/terminal/resources/refunds/client/requests/RefundsCancelRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * terminalRefundId: "terminal_refund_id" + * } + */ +export interface RefundsCancelRequest { + /** + * The unique ID for the desired `TerminalRefund`. + */ + terminalRefundId: string; +} diff --git a/src/api/resources/terminal/resources/refunds/client/requests/RefundsGetRequest.ts b/src/api/resources/terminal/resources/refunds/client/requests/RefundsGetRequest.ts new file mode 100644 index 000000000..a7f5b317e --- /dev/null +++ b/src/api/resources/terminal/resources/refunds/client/requests/RefundsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * terminalRefundId: "terminal_refund_id" + * } + */ +export interface RefundsGetRequest { + /** + * The unique ID for the desired `TerminalRefund`. + */ + terminalRefundId: string; +} diff --git a/src/api/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts b/src/api/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts new file mode 100644 index 000000000..22f190f62 --- /dev/null +++ b/src/api/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * query: { + * filter: { + * status: "COMPLETED" + * } + * }, + * limit: 1 + * } + */ +export interface SearchTerminalRefundsRequest { + /** + * Queries the Terminal refunds based on given conditions and the sort order. Calling + * `SearchTerminalRefunds` without an explicit query parameter returns all available + * refunds with the default sort order. + */ + query?: Square.TerminalRefundQuery; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this cursor to retrieve the next set of results for the original query. + */ + cursor?: string; + /** Limits the number of results returned for a single request. */ + limit?: number; +} diff --git a/src/api/resources/terminal/resources/refunds/client/requests/index.ts b/src/api/resources/terminal/resources/refunds/client/requests/index.ts new file mode 100644 index 000000000..fc57754bd --- /dev/null +++ b/src/api/resources/terminal/resources/refunds/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type CreateTerminalRefundRequest } from "./CreateTerminalRefundRequest"; +export { type SearchTerminalRefundsRequest } from "./SearchTerminalRefundsRequest"; +export { type RefundsGetRequest } from "./RefundsGetRequest"; +export { type RefundsCancelRequest } from "./RefundsCancelRequest"; diff --git a/src/api/resources/terminal/resources/refunds/index.ts b/src/api/resources/terminal/resources/refunds/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/terminal/resources/refunds/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/v1Transactions/client/Client.ts b/src/api/resources/v1Transactions/client/Client.ts new file mode 100644 index 000000000..00353a561 --- /dev/null +++ b/src/api/resources/v1Transactions/client/Client.ts @@ -0,0 +1,295 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace V1Transactions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class V1Transactions { + constructor(protected readonly _options: V1Transactions.Options = {}) {} + + /** + * Provides summary information for a merchant's online store orders. + * + * @param {Square.V1ListOrdersRequest} request + * @param {V1Transactions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.v1Transactions.v1ListOrders({ + * locationId: "location_id" + * }) + */ + public async v1ListOrders( + request: Square.V1ListOrdersRequest, + requestOptions?: V1Transactions.RequestOptions, + ): Promise { + const { locationId, order, limit, batchToken } = request; + const _queryParams: Record = {}; + if (order !== undefined) { + _queryParams["order"] = serializers.SortOrder.jsonOrThrow(order, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + + if (batchToken !== undefined) { + _queryParams["batch_token"] = batchToken; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v1/${encodeURIComponent(locationId)}/orders`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.v1Transactions.v1ListOrders.Response.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v1/{location_id}/orders."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Provides comprehensive information for a single online store order, including the order's history. + * + * @param {Square.V1RetrieveOrderRequest} request + * @param {V1Transactions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.v1Transactions.v1RetrieveOrder({ + * locationId: "location_id", + * orderId: "order_id" + * }) + */ + public async v1RetrieveOrder( + request: Square.V1RetrieveOrderRequest, + requestOptions?: V1Transactions.RequestOptions, + ): Promise { + const { locationId, orderId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v1/${encodeURIComponent(locationId)}/orders/${encodeURIComponent(orderId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.V1Order.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v1/{location_id}/orders/{order_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: + * + * @param {Square.V1UpdateOrderRequest} request + * @param {V1Transactions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.v1Transactions.v1UpdateOrder({ + * locationId: "location_id", + * orderId: "order_id", + * action: "COMPLETE" + * }) + */ + public async v1UpdateOrder( + request: Square.V1UpdateOrderRequest, + requestOptions?: V1Transactions.RequestOptions, + ): Promise { + const { locationId, orderId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v1/${encodeURIComponent(locationId)}/orders/${encodeURIComponent(orderId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.V1UpdateOrderRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.V1Order.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v1/{location_id}/orders/{order_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/v1Transactions/client/index.ts b/src/api/resources/v1Transactions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/v1Transactions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts b/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts new file mode 100644 index 000000000..ef21b9525 --- /dev/null +++ b/src/api/resources/v1Transactions/client/requests/V1ListOrdersRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * locationId: "location_id" + * } + */ +export interface V1ListOrdersRequest { + /** + * The ID of the location to list online store orders for. + */ + locationId: string; + /** + * The order in which payments are listed in the response. + */ + order?: Square.SortOrder | null; + /** + * The maximum number of payments to return in a single response. This value cannot exceed 200. + */ + limit?: number | null; + /** + * A pagination cursor to retrieve the next set of results for your + * original query to the endpoint. + */ + batchToken?: string | null; +} diff --git a/src/api/resources/v1Transactions/client/requests/V1RetrieveOrderRequest.ts b/src/api/resources/v1Transactions/client/requests/V1RetrieveOrderRequest.ts new file mode 100644 index 000000000..cdc38ad36 --- /dev/null +++ b/src/api/resources/v1Transactions/client/requests/V1RetrieveOrderRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * locationId: "location_id", + * orderId: "order_id" + * } + */ +export interface V1RetrieveOrderRequest { + /** + * The ID of the order's associated location. + */ + locationId: string; + /** + * The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint + */ + orderId: string; +} diff --git a/src/api/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts b/src/api/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts new file mode 100644 index 000000000..29b41dae6 --- /dev/null +++ b/src/api/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * locationId: "location_id", + * orderId: "order_id", + * action: "COMPLETE" + * } + */ +export interface V1UpdateOrderRequest { + /** + * The ID of the order's associated location. + */ + locationId: string; + /** + * The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint + */ + orderId: string; + /** + * The action to perform on the order (COMPLETE, CANCEL, or REFUND). + * See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible values + */ + action: Square.V1UpdateOrderRequestAction; + /** The tracking number of the shipment associated with the order. Only valid if action is COMPLETE. */ + shippedTrackingNumber?: string | null; + /** A merchant-specified note about the completion of the order. Only valid if action is COMPLETE. */ + completedNote?: string | null; + /** A merchant-specified note about the refunding of the order. Only valid if action is REFUND. */ + refundedNote?: string | null; + /** A merchant-specified note about the canceling of the order. Only valid if action is CANCEL. */ + canceledNote?: string | null; +} diff --git a/src/api/resources/v1Transactions/client/requests/index.ts b/src/api/resources/v1Transactions/client/requests/index.ts new file mode 100644 index 000000000..0d77a3125 --- /dev/null +++ b/src/api/resources/v1Transactions/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type V1ListOrdersRequest } from "./V1ListOrdersRequest"; +export { type V1RetrieveOrderRequest } from "./V1RetrieveOrderRequest"; +export { type V1UpdateOrderRequest } from "./V1UpdateOrderRequest"; diff --git a/src/api/resources/v1Transactions/index.ts b/src/api/resources/v1Transactions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/v1Transactions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/vendors/client/Client.ts b/src/api/resources/vendors/client/Client.ts new file mode 100644 index 000000000..ca8689d7d --- /dev/null +++ b/src/api/resources/vendors/client/Client.ts @@ -0,0 +1,631 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Square from "../../../index"; +import * as serializers from "../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Vendors { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Vendors { + constructor(protected readonly _options: Vendors.Options = {}) {} + + /** + * Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller. + * + * @param {Square.BatchCreateVendorsRequest} request + * @param {Vendors.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.vendors.batchCreate({ + * vendors: { + * "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { + * name: "Joe's Fresh Seafood", + * address: { + * addressLine1: "505 Electric Ave", + * addressLine2: "Suite 600", + * locality: "New York", + * administrativeDistrictLevel1: "NY", + * postalCode: "10003", + * country: "US" + * }, + * contacts: [{ + * name: "Joe Burrow", + * emailAddress: "joe@joesfreshseafood.com", + * phoneNumber: "1-212-555-4250", + * ordinal: 1 + * }], + * accountNumber: "4025391", + * note: "a vendor" + * } + * } + * }) + */ + public async batchCreate( + request: Square.BatchCreateVendorsRequest, + requestOptions?: Vendors.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/vendors/bulk-create", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchCreateVendorsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchCreateVendorsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/vendors/bulk-create."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs. + * + * @param {Square.BatchGetVendorsRequest} request + * @param {Vendors.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.vendors.batchGet({ + * vendorIds: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"] + * }) + */ + public async batchGet( + request: Square.BatchGetVendorsRequest = {}, + requestOptions?: Vendors.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/vendors/bulk-retrieve", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchGetVendorsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchGetVendorsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/vendors/bulk-retrieve."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller. + * + * @param {Square.BatchUpdateVendorsRequest} request + * @param {Vendors.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.vendors.batchUpdate({ + * vendors: { + * "FMCYHBWT1TPL8MFH52PBMEN92A": { + * vendor: {} + * }, + * "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4": { + * vendor: {} + * } + * } + * }) + */ + public async batchUpdate( + request: Square.BatchUpdateVendorsRequest, + requestOptions?: Vendors.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/vendors/bulk-update", + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.BatchUpdateVendorsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.BatchUpdateVendorsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/vendors/bulk-update."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller. + * + * @param {Square.CreateVendorRequest} request + * @param {Vendors.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.vendors.create({ + * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * vendor: { + * name: "Joe's Fresh Seafood", + * address: { + * addressLine1: "505 Electric Ave", + * addressLine2: "Suite 600", + * locality: "New York", + * administrativeDistrictLevel1: "NY", + * postalCode: "10003", + * country: "US" + * }, + * contacts: [{ + * name: "Joe Burrow", + * emailAddress: "joe@joesfreshseafood.com", + * phoneNumber: "1-212-555-4250", + * ordinal: 1 + * }], + * accountNumber: "4025391", + * note: "a vendor" + * } + * }) + */ + public async create( + request: Square.CreateVendorRequest, + requestOptions?: Vendors.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/vendors/create", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.CreateVendorRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateVendorResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/vendors/create."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter. + * + * @param {Square.SearchVendorsRequest} request + * @param {Vendors.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.vendors.search() + */ + public async search( + request: Square.SearchVendorsRequest = {}, + requestOptions?: Vendors.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/vendors/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.SearchVendorsRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.SearchVendorsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/vendors/search."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves the vendor of a specified [Vendor](entity:Vendor) ID. + * + * @param {Square.VendorsGetRequest} request + * @param {Vendors.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.vendors.get({ + * vendorId: "vendor_id" + * }) + */ + public async get( + request: Square.VendorsGetRequest, + requestOptions?: Vendors.RequestOptions, + ): Promise { + const { vendorId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/vendors/${encodeURIComponent(vendorId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetVendorResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/vendors/{vendor_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller. + * + * @param {Square.VendorsUpdateRequest} request + * @param {Vendors.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.vendors.update({ + * vendorId: "vendor_id", + * body: { + * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * vendor: { + * id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + * name: "Jack's Chicken Shack", + * version: 1, + * status: "ACTIVE" + * } + * } + * }) + */ + public async update( + request: Square.VendorsUpdateRequest, + requestOptions?: Vendors.RequestOptions, + ): Promise { + const { vendorId, body: _body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/vendors/${encodeURIComponent(vendorId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.UpdateVendorRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateVendorResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling PUT /v2/vendors/{vendor_id}."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/vendors/client/index.ts b/src/api/resources/vendors/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/vendors/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/vendors/client/requests/BatchCreateVendorsRequest.ts b/src/api/resources/vendors/client/requests/BatchCreateVendorsRequest.ts new file mode 100644 index 000000000..7137f0e8e --- /dev/null +++ b/src/api/resources/vendors/client/requests/BatchCreateVendorsRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * vendors: { + * "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": { + * name: "Joe's Fresh Seafood", + * address: { + * addressLine1: "505 Electric Ave", + * addressLine2: "Suite 600", + * locality: "New York", + * administrativeDistrictLevel1: "NY", + * postalCode: "10003", + * country: "US" + * }, + * contacts: [{ + * name: "Joe Burrow", + * emailAddress: "joe@joesfreshseafood.com", + * phoneNumber: "1-212-555-4250", + * ordinal: 1 + * }], + * accountNumber: "4025391", + * note: "a vendor" + * } + * } + * } + */ +export interface BatchCreateVendorsRequest { + /** Specifies a set of new [Vendor](entity:Vendor) objects as represented by a collection of idempotency-key/`Vendor`-object pairs. */ + vendors: Record; +} diff --git a/src/api/resources/vendors/client/requests/BatchGetVendorsRequest.ts b/src/api/resources/vendors/client/requests/BatchGetVendorsRequest.ts new file mode 100644 index 000000000..26dda1865 --- /dev/null +++ b/src/api/resources/vendors/client/requests/BatchGetVendorsRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * vendorIds: ["INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"] + * } + */ +export interface BatchGetVendorsRequest { + /** IDs of the [Vendor](entity:Vendor) objects to retrieve. */ + vendorIds?: string[] | null; +} diff --git a/src/api/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts b/src/api/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts new file mode 100644 index 000000000..9af78e9eb --- /dev/null +++ b/src/api/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * vendors: { + * "FMCYHBWT1TPL8MFH52PBMEN92A": { + * vendor: {} + * }, + * "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4": { + * vendor: {} + * } + * } + * } + */ +export interface BatchUpdateVendorsRequest { + /** + * A set of [UpdateVendorRequest](entity:UpdateVendorRequest) objects encapsulating to-be-updated [Vendor](entity:Vendor) + * objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorRequest`-object pairs. + */ + vendors: Record; +} diff --git a/src/api/resources/vendors/client/requests/CreateVendorRequest.ts b/src/api/resources/vendors/client/requests/CreateVendorRequest.ts new file mode 100644 index 000000000..5af83d983 --- /dev/null +++ b/src/api/resources/vendors/client/requests/CreateVendorRequest.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * vendor: { + * name: "Joe's Fresh Seafood", + * address: { + * addressLine1: "505 Electric Ave", + * addressLine2: "Suite 600", + * locality: "New York", + * administrativeDistrictLevel1: "NY", + * postalCode: "10003", + * country: "US" + * }, + * contacts: [{ + * name: "Joe Burrow", + * emailAddress: "joe@joesfreshseafood.com", + * phoneNumber: "1-212-555-4250", + * ordinal: 1 + * }], + * accountNumber: "4025391", + * note: "a vendor" + * } + * } + */ +export interface CreateVendorRequest { + /** + * A client-supplied, universally unique identifier (UUID) to make this [CreateVendor](api-endpoint:Vendors-CreateVendor) call idempotent. + * + * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the + * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more + * information. + */ + idempotencyKey: string; + /** The requested [Vendor](entity:Vendor) to be created. */ + vendor?: Square.Vendor; +} diff --git a/src/api/resources/vendors/client/requests/SearchVendorsRequest.ts b/src/api/resources/vendors/client/requests/SearchVendorsRequest.ts new file mode 100644 index 000000000..67d1ddc63 --- /dev/null +++ b/src/api/resources/vendors/client/requests/SearchVendorsRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * {} + */ +export interface SearchVendorsRequest { + /** Specifies a filter used to search for vendors. */ + filter?: Square.SearchVendorsRequestFilter; + /** Specifies a sorter used to sort the returned vendors. */ + sort?: Square.SearchVendorsRequestSort; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for the original query. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string; +} diff --git a/src/api/resources/vendors/client/requests/VendorsGetRequest.ts b/src/api/resources/vendors/client/requests/VendorsGetRequest.ts new file mode 100644 index 000000000..22d0f763b --- /dev/null +++ b/src/api/resources/vendors/client/requests/VendorsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * vendorId: "vendor_id" + * } + */ +export interface VendorsGetRequest { + /** + * ID of the [Vendor](entity:Vendor) to retrieve. + */ + vendorId: string; +} diff --git a/src/api/resources/vendors/client/requests/VendorsUpdateRequest.ts b/src/api/resources/vendors/client/requests/VendorsUpdateRequest.ts new file mode 100644 index 000000000..a1bf25b3d --- /dev/null +++ b/src/api/resources/vendors/client/requests/VendorsUpdateRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../index"; + +/** + * @example + * { + * vendorId: "vendor_id", + * body: { + * idempotencyKey: "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe", + * vendor: { + * id: "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4", + * name: "Jack's Chicken Shack", + * version: 1, + * status: "ACTIVE" + * } + * } + * } + */ +export interface VendorsUpdateRequest { + /** + * ID of the [Vendor](entity:Vendor) to retrieve. + */ + vendorId: string; + body: Square.UpdateVendorRequest; +} diff --git a/src/api/resources/vendors/client/requests/index.ts b/src/api/resources/vendors/client/requests/index.ts new file mode 100644 index 000000000..9c6a8a674 --- /dev/null +++ b/src/api/resources/vendors/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type BatchCreateVendorsRequest } from "./BatchCreateVendorsRequest"; +export { type BatchGetVendorsRequest } from "./BatchGetVendorsRequest"; +export { type BatchUpdateVendorsRequest } from "./BatchUpdateVendorsRequest"; +export { type CreateVendorRequest } from "./CreateVendorRequest"; +export { type SearchVendorsRequest } from "./SearchVendorsRequest"; +export { type VendorsGetRequest } from "./VendorsGetRequest"; +export { type VendorsUpdateRequest } from "./VendorsUpdateRequest"; diff --git a/src/api/resources/vendors/index.ts b/src/api/resources/vendors/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/vendors/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts new file mode 100644 index 000000000..410a3053a --- /dev/null +++ b/src/api/resources/webhooks/client/Client.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import { EventTypes } from "../resources/eventTypes/client/Client"; +import { Subscriptions } from "../resources/subscriptions/client/Client"; + +export declare namespace Webhooks { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Webhooks { + protected _eventTypes: EventTypes | undefined; + protected _subscriptions: Subscriptions | undefined; + + constructor(protected readonly _options: Webhooks.Options = {}) {} + + public get eventTypes(): EventTypes { + return (this._eventTypes ??= new EventTypes(this._options)); + } + + public get subscriptions(): Subscriptions { + return (this._subscriptions ??= new Subscriptions(this._options)); + } +} diff --git a/src/api/resources/webhooks/client/index.ts b/src/api/resources/webhooks/client/index.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/src/api/resources/webhooks/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/webhooks/index.ts b/src/api/resources/webhooks/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/api/resources/webhooks/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/api/resources/webhooks/resources/eventTypes/client/Client.ts b/src/api/resources/webhooks/resources/eventTypes/client/Client.ts new file mode 100644 index 000000000..37adcf6ba --- /dev/null +++ b/src/api/resources/webhooks/resources/eventTypes/client/Client.ts @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import urlJoin from "url-join"; +import * as serializers from "../../../../../../serialization/index"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace EventTypes { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class EventTypes { + constructor(protected readonly _options: EventTypes.Options = {}) {} + + /** + * Lists all webhook event types that can be subscribed to. + * + * @param {Square.webhooks.EventTypesListRequest} request + * @param {EventTypes.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.webhooks.eventTypes.list() + */ + public async list( + request: Square.webhooks.EventTypesListRequest = {}, + requestOptions?: EventTypes.RequestOptions, + ): Promise { + const { apiVersion } = request; + const _queryParams: Record = {}; + if (apiVersion !== undefined) { + _queryParams["api_version"] = apiVersion; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/webhooks/event-types", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListWebhookEventTypesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling GET /v2/webhooks/event-types."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/webhooks/resources/eventTypes/client/index.ts b/src/api/resources/webhooks/resources/eventTypes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/webhooks/resources/eventTypes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/webhooks/resources/eventTypes/client/requests/EventTypesListRequest.ts b/src/api/resources/webhooks/resources/eventTypes/client/requests/EventTypesListRequest.ts new file mode 100644 index 000000000..c46a9d1a6 --- /dev/null +++ b/src/api/resources/webhooks/resources/eventTypes/client/requests/EventTypesListRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface EventTypesListRequest { + /** + * The API version for which to list event types. Setting this field overrides the default version used by the application. + */ + apiVersion?: string | null; +} diff --git a/src/api/resources/webhooks/resources/eventTypes/client/requests/index.ts b/src/api/resources/webhooks/resources/eventTypes/client/requests/index.ts new file mode 100644 index 000000000..07d9f9c0b --- /dev/null +++ b/src/api/resources/webhooks/resources/eventTypes/client/requests/index.ts @@ -0,0 +1 @@ +export { type EventTypesListRequest } from "./EventTypesListRequest"; diff --git a/src/api/resources/webhooks/resources/eventTypes/index.ts b/src/api/resources/webhooks/resources/eventTypes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/webhooks/resources/eventTypes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/webhooks/resources/index.ts b/src/api/resources/webhooks/resources/index.ts new file mode 100644 index 000000000..f0cf7982d --- /dev/null +++ b/src/api/resources/webhooks/resources/index.ts @@ -0,0 +1,4 @@ +export * as eventTypes from "./eventTypes"; +export * as subscriptions from "./subscriptions"; +export * from "./eventTypes/client/requests"; +export * from "./subscriptions/client/requests"; diff --git a/src/api/resources/webhooks/resources/subscriptions/client/Client.ts b/src/api/resources/webhooks/resources/subscriptions/client/Client.ts new file mode 100644 index 000000000..45c838753 --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/Client.ts @@ -0,0 +1,623 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Square from "../../../../../index"; +import * as serializers from "../../../../../../serialization/index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Subscriptions { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Square-Version header */ + version?: "2025-01-23"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Override the Square-Version header */ + version?: "2025-01-23"; + /** Additional headers to include in the request. */ + headers?: Record; + } +} + +export class Subscriptions { + constructor(protected readonly _options: Subscriptions.Options = {}) {} + + /** + * Lists all webhook subscriptions owned by your application. + * + * @param {Square.webhooks.SubscriptionsListRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.webhooks.subscriptions.list() + */ + public async list( + request: Square.webhooks.SubscriptionsListRequest = {}, + requestOptions?: Subscriptions.RequestOptions, + ): Promise> { + const list = async ( + request: Square.webhooks.SubscriptionsListRequest, + ): Promise => { + const { cursor, includeDisabled, sortOrder, limit } = request; + const _queryParams: Record = {}; + if (cursor !== undefined) { + _queryParams["cursor"] = cursor; + } + if (includeDisabled !== undefined) { + _queryParams["include_disabled"] = includeDisabled?.toString() ?? null; + } + if (sortOrder !== undefined) { + _queryParams["sort_order"] = serializers.SortOrder.jsonOrThrow(sortOrder, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }); + } + if (limit !== undefined) { + _queryParams["limit"] = limit?.toString() ?? null; + } + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/webhooks/subscriptions", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.ListWebhookSubscriptionsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/webhooks/subscriptions.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + }; + return new core.Pageable({ + response: await list(request), + hasNextPage: (response) => response?.cursor != null, + getItems: (response) => response?.subscriptions ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "cursor", response?.cursor)); + }, + }); + } + + /** + * Creates a webhook subscription. + * + * @param {Square.webhooks.CreateWebhookSubscriptionRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.webhooks.subscriptions.create({ + * idempotencyKey: "63f84c6c-2200-4c99-846c-2670a1311fbf", + * subscription: { + * name: "Example Webhook Subscription", + * eventTypes: ["payment.created", "payment.updated"], + * notificationUrl: "https://example-webhook-url.com", + * apiVersion: "2021-12-15" + * } + * }) + */ + public async create( + request: Square.webhooks.CreateWebhookSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + "v2/webhooks/subscriptions", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.webhooks.CreateWebhookSubscriptionRequest.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.CreateWebhookSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError("Timeout exceeded when calling POST /v2/webhooks/subscriptions."); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Retrieves a webhook subscription identified by its ID. + * + * @param {Square.webhooks.SubscriptionsGetRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.webhooks.subscriptions.get({ + * subscriptionId: "subscription_id" + * }) + */ + public async get( + request: Square.webhooks.SubscriptionsGetRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/webhooks/subscriptions/${encodeURIComponent(subscriptionId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.GetWebhookSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling GET /v2/webhooks/subscriptions/{subscription_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a webhook subscription. + * + * @param {Square.webhooks.UpdateWebhookSubscriptionRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.webhooks.subscriptions.update({ + * subscriptionId: "subscription_id", + * subscription: { + * name: "Updated Example Webhook Subscription", + * enabled: false + * } + * }) + */ + public async update( + request: Square.webhooks.UpdateWebhookSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/webhooks/subscriptions/${encodeURIComponent(subscriptionId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.webhooks.UpdateWebhookSubscriptionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateWebhookSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling PUT /v2/webhooks/subscriptions/{subscription_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Deletes a webhook subscription. + * + * @param {Square.webhooks.SubscriptionsDeleteRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.webhooks.subscriptions.delete({ + * subscriptionId: "subscription_id" + * }) + */ + public async delete( + request: Square.webhooks.SubscriptionsDeleteRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/webhooks/subscriptions/${encodeURIComponent(subscriptionId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.DeleteWebhookSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling DELETE /v2/webhooks/subscriptions/{subscription_id}.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Updates a webhook subscription by replacing the existing signature key with a new one. + * + * @param {Square.webhooks.UpdateWebhookSubscriptionSignatureKeyRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.webhooks.subscriptions.updateSignatureKey({ + * subscriptionId: "subscription_id", + * idempotencyKey: "ed80ae6b-0654-473b-bbab-a39aee89a60d" + * }) + */ + public async updateSignatureKey( + request: Square.webhooks.UpdateWebhookSubscriptionSignatureKeyRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/webhooks/subscriptions/${encodeURIComponent(subscriptionId)}/signature-key`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.webhooks.UpdateWebhookSubscriptionSignatureKeyRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.UpdateWebhookSubscriptionSignatureKeyResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/webhooks/subscriptions/{subscription_id}/signature-key.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + /** + * Tests a webhook subscription by sending a test event to the notification URL. + * + * @param {Square.webhooks.TestWebhookSubscriptionRequest} request + * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.webhooks.subscriptions.test({ + * subscriptionId: "subscription_id", + * eventType: "payment.created" + * }) + */ + public async test( + request: Square.webhooks.TestWebhookSubscriptionRequest, + requestOptions?: Subscriptions.RequestOptions, + ): Promise { + const { subscriptionId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SquareEnvironment.Production, + `v2/webhooks/subscriptions/${encodeURIComponent(subscriptionId)}/test`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "Square-Version": requestOptions?.version ?? this._options?.version ?? "2025-01-23", + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "40.0.0", + "User-Agent": "square/40.0.0", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: serializers.webhooks.TestWebhookSubscriptionRequest.jsonOrThrow(_body, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return serializers.TestWebhookSubscriptionResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }); + } + + if (_response.error.reason === "status-code") { + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.SquareError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.SquareTimeoutError( + "Timeout exceeded when calling POST /v2/webhooks/subscriptions/{subscription_id}/test.", + ); + case "unknown": + throw new errors.SquareError({ + message: _response.error.errorMessage, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["SQUARE_TOKEN"]; + if (bearer != null) { + return `Bearer ${bearer}`; + } + + return undefined; + } +} diff --git a/src/api/resources/webhooks/resources/subscriptions/client/index.ts b/src/api/resources/webhooks/resources/subscriptions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts new file mode 100644 index 000000000..8b5233858 --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * idempotencyKey: "63f84c6c-2200-4c99-846c-2670a1311fbf", + * subscription: { + * name: "Example Webhook Subscription", + * eventTypes: ["payment.created", "payment.updated"], + * notificationUrl: "https://example-webhook-url.com", + * apiVersion: "2021-12-15" + * } + * } + */ +export interface CreateWebhookSubscriptionRequest { + /** A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request. */ + idempotencyKey?: string; + /** The [Subscription](entity:WebhookSubscription) to create. */ + subscription: Square.WebhookSubscription; +} diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsDeleteRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsDeleteRequest.ts new file mode 100644 index 000000000..d7c785cd3 --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id" + * } + */ +export interface SubscriptionsDeleteRequest { + /** + * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to delete. + */ + subscriptionId: string; +} diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts new file mode 100644 index 000000000..04c952906 --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsGetRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id" + * } + */ +export interface SubscriptionsGetRequest { + /** + * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to retrieve. + */ + subscriptionId: string; +} diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsListRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsListRequest.ts new file mode 100644 index 000000000..4357aa736 --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/SubscriptionsListRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * {} + */ +export interface SubscriptionsListRequest { + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for your original query. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string | null; + /** + * Includes disabled [Subscription](entity:WebhookSubscription)s. + * By default, all enabled [Subscription](entity:WebhookSubscription)s are returned. + */ + includeDisabled?: boolean | null; + /** + * Sorts the returned list by when the [Subscription](entity:WebhookSubscription) was created with the specified order. + * This field defaults to ASC. + */ + sortOrder?: Square.SortOrder | null; + /** + * The maximum number of results to be returned in a single page. + * It is possible to receive fewer results than the specified limit on a given page. + * The default value of 100 is also the maximum allowed value. + * + * Default: 100 + */ + limit?: number | null; +} diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts new file mode 100644 index 000000000..2d08b14bb --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id", + * eventType: "payment.created" + * } + */ +export interface TestWebhookSubscriptionRequest { + /** + * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to test. + */ + subscriptionId: string; + /** + * The event type that will be used to test the [Subscription](entity:WebhookSubscription). The event type must be + * contained in the list of event types in the [Subscription](entity:WebhookSubscription). + */ + eventType?: string | null; +} diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts new file mode 100644 index 000000000..379f9f4e9 --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../../../../../../index"; + +/** + * @example + * { + * subscriptionId: "subscription_id", + * subscription: { + * name: "Updated Example Webhook Subscription", + * enabled: false + * } + * } + */ +export interface UpdateWebhookSubscriptionRequest { + /** + * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update. + */ + subscriptionId: string; + /** The [Subscription](entity:WebhookSubscription) to update. */ + subscription?: Square.WebhookSubscription; +} diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts new file mode 100644 index 000000000..3a61969f4 --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * subscriptionId: "subscription_id", + * idempotencyKey: "ed80ae6b-0654-473b-bbab-a39aee89a60d" + * } + */ +export interface UpdateWebhookSubscriptionSignatureKeyRequest { + /** + * [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to update. + */ + subscriptionId: string; + /** A unique string that identifies the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) request. */ + idempotencyKey?: string | null; +} diff --git a/src/api/resources/webhooks/resources/subscriptions/client/requests/index.ts b/src/api/resources/webhooks/resources/subscriptions/client/requests/index.ts new file mode 100644 index 000000000..e2e5df141 --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/client/requests/index.ts @@ -0,0 +1,7 @@ +export { type SubscriptionsListRequest } from "./SubscriptionsListRequest"; +export { type CreateWebhookSubscriptionRequest } from "./CreateWebhookSubscriptionRequest"; +export { type SubscriptionsGetRequest } from "./SubscriptionsGetRequest"; +export { type UpdateWebhookSubscriptionRequest } from "./UpdateWebhookSubscriptionRequest"; +export { type SubscriptionsDeleteRequest } from "./SubscriptionsDeleteRequest"; +export { type UpdateWebhookSubscriptionSignatureKeyRequest } from "./UpdateWebhookSubscriptionSignatureKeyRequest"; +export { type TestWebhookSubscriptionRequest } from "./TestWebhookSubscriptionRequest"; diff --git a/src/api/resources/webhooks/resources/subscriptions/index.ts b/src/api/resources/webhooks/resources/subscriptions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/api/resources/webhooks/resources/subscriptions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/sitesApi.ts b/src/api/sitesApi.ts deleted file mode 100644 index c4469dd28..000000000 --- a/src/api/sitesApi.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - ListSitesResponse, - listSitesResponseSchema, -} from '../models/listSitesResponse'; -import { BaseApi } from './baseApi'; - -export class SitesApi extends BaseApi { - /** - * Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the - * `created_at` date. - * - * - * __Note:__ Square Online APIs are publicly available as part of an early access program. For more - * information, see [Early access program for Square Online APIs](https://developer.squareup. - * com/docs/online-api#early-access-program-for-square-online-apis). - * - * @return Response from the API call - */ - async listSites( - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/sites'); - req.authenticate([{ global: true }]); - return req.callAsJson(listSitesResponseSchema, requestOptions); - } -} diff --git a/src/api/snippetsApi.ts b/src/api/snippetsApi.ts deleted file mode 100644 index f878fa96c..000000000 --- a/src/api/snippetsApi.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - DeleteSnippetResponse, - deleteSnippetResponseSchema, -} from '../models/deleteSnippetResponse'; -import { - RetrieveSnippetResponse, - retrieveSnippetResponseSchema, -} from '../models/retrieveSnippetResponse'; -import { - UpsertSnippetRequest, - upsertSnippetRequestSchema, -} from '../models/upsertSnippetRequest'; -import { - UpsertSnippetResponse, - upsertSnippetResponseSchema, -} from '../models/upsertSnippetResponse'; -import { string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class SnippetsApi extends BaseApi { - /** - * Removes your snippet from a Square Online site. - * - * You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites that belong to a seller. - * - * - * __Note:__ Square Online APIs are publicly available as part of an early access program. For more - * information, see [Early access program for Square Online APIs](https://developer.squareup. - * com/docs/online-api#early-access-program-for-square-online-apis). - * - * @param siteId The ID of the site that contains the snippet. - * @return Response from the API call - */ - async deleteSnippet( - siteId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ siteId: [siteId, string()] }); - req.appendTemplatePath`/v2/sites/${mapped.siteId}/snippet`; - req.authenticate([{ global: true }]); - return req.callAsJson(deleteSnippetResponseSchema, requestOptions); - } - - /** - * Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet - * applications, but you can retrieve only the snippet that was added by your application. - * - * You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites that belong to a seller. - * - * - * __Note:__ Square Online APIs are publicly available as part of an early access program. For more - * information, see [Early access program for Square Online APIs](https://developer.squareup. - * com/docs/online-api#early-access-program-for-square-online-apis). - * - * @param siteId The ID of the site that contains the snippet. - * @return Response from the API call - */ - async retrieveSnippet( - siteId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ siteId: [siteId, string()] }); - req.appendTemplatePath`/v2/sites/${mapped.siteId}/snippet`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveSnippetResponseSchema, requestOptions); - } - - /** - * Adds a snippet to a Square Online site or updates the existing snippet on the site. - * The snippet code is appended to the end of the `head` element on every page of the site, except - * checkout pages. A snippet application can add one snippet to a given site. - * - * You can call [ListSites]($e/Sites/ListSites) to get the IDs of the sites that belong to a seller. - * - * - * __Note:__ Square Online APIs are publicly available as part of an early access program. For more - * information, see [Early access program for Square Online APIs](https://developer.squareup. - * com/docs/online-api#early-access-program-for-square-online-apis). - * - * @param siteId The ID of the site where you want to add or update the snippet. - * @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 - */ - async upsertSnippet( - siteId: string, - body: UpsertSnippetRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - siteId: [siteId, string()], - body: [body, upsertSnippetRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/sites/${mapped.siteId}/snippet`; - req.authenticate([{ global: true }]); - return req.callAsJson(upsertSnippetResponseSchema, requestOptions); - } -} diff --git a/src/api/subscriptionsApi.ts b/src/api/subscriptionsApi.ts deleted file mode 100644 index 4b6d76bfd..000000000 --- a/src/api/subscriptionsApi.ts +++ /dev/null @@ -1,412 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkSwapPlanRequest, - bulkSwapPlanRequestSchema, -} from '../models/bulkSwapPlanRequest'; -import { - BulkSwapPlanResponse, - bulkSwapPlanResponseSchema, -} from '../models/bulkSwapPlanResponse'; -import { - CancelSubscriptionResponse, - cancelSubscriptionResponseSchema, -} from '../models/cancelSubscriptionResponse'; -import { - ChangeBillingAnchorDateRequest, - changeBillingAnchorDateRequestSchema, -} from '../models/changeBillingAnchorDateRequest'; -import { - ChangeBillingAnchorDateResponse, - changeBillingAnchorDateResponseSchema, -} from '../models/changeBillingAnchorDateResponse'; -import { - CreateSubscriptionRequest, - createSubscriptionRequestSchema, -} from '../models/createSubscriptionRequest'; -import { - CreateSubscriptionResponse, - createSubscriptionResponseSchema, -} from '../models/createSubscriptionResponse'; -import { - DeleteSubscriptionActionResponse, - deleteSubscriptionActionResponseSchema, -} from '../models/deleteSubscriptionActionResponse'; -import { - ListSubscriptionEventsResponse, - listSubscriptionEventsResponseSchema, -} from '../models/listSubscriptionEventsResponse'; -import { - PauseSubscriptionRequest, - pauseSubscriptionRequestSchema, -} from '../models/pauseSubscriptionRequest'; -import { - PauseSubscriptionResponse, - pauseSubscriptionResponseSchema, -} from '../models/pauseSubscriptionResponse'; -import { - ResumeSubscriptionRequest, - resumeSubscriptionRequestSchema, -} from '../models/resumeSubscriptionRequest'; -import { - ResumeSubscriptionResponse, - resumeSubscriptionResponseSchema, -} from '../models/resumeSubscriptionResponse'; -import { - RetrieveSubscriptionResponse, - retrieveSubscriptionResponseSchema, -} from '../models/retrieveSubscriptionResponse'; -import { - SearchSubscriptionsRequest, - searchSubscriptionsRequestSchema, -} from '../models/searchSubscriptionsRequest'; -import { - SearchSubscriptionsResponse, - searchSubscriptionsResponseSchema, -} from '../models/searchSubscriptionsResponse'; -import { - SwapPlanRequest, - swapPlanRequestSchema, -} from '../models/swapPlanRequest'; -import { - SwapPlanResponse, - swapPlanResponseSchema, -} from '../models/swapPlanResponse'; -import { - UpdateSubscriptionRequest, - updateSubscriptionRequestSchema, -} from '../models/updateSubscriptionRequest'; -import { - UpdateSubscriptionResponse, - updateSubscriptionResponseSchema, -} from '../models/updateSubscriptionResponse'; -import { number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class SubscriptionsApi extends BaseApi { - /** - * 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 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 - */ - async createSubscription( - body: CreateSubscriptionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/subscriptions'); - const mapped = req.prepareArgs({ - body: [body, createSubscriptionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createSubscriptionResponseSchema, requestOptions); - } - - /** - * Schedules a plan variation change for all active subscriptions under a given plan - * variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup. - * com/docs/subscriptions-api/swap-plan-variations). - * - * @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 - */ - async bulkSwapPlan( - body: BulkSwapPlanRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/subscriptions/bulk-swap-plan'); - const mapped = req.prepareArgs({ body: [body, bulkSwapPlanRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkSwapPlanResponseSchema, requestOptions); - } - - /** - * Searches for subscriptions. - * - * Results are ordered chronologically by subscription creation date. If - * the request specifies more than one location ID, - * the endpoint orders the result - * by location ID, and then by creation date within each location. If no locations are given - * in the query, all locations are searched. - * - * You can also optionally specify `customer_ids` to search by customer. - * If left unset, all customers - * associated with the specified locations are returned. - * If the request specifies customer IDs, the endpoint orders results - * first by location, within location by customer ID, and within - * customer by subscription creation date. - * - * @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 - */ - async searchSubscriptions( - body: SearchSubscriptionsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/subscriptions/search'); - const mapped = req.prepareArgs({ - body: [body, searchSubscriptionsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchSubscriptionsResponseSchema, requestOptions); - } - - /** - * 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. - * The supported query parameter values are: - `actions`: to include scheduled - * actions on the targeted subscription. - * @return Response from the API call - */ - async retrieveSubscription( - subscriptionId: string, - include?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - include: [include, optional(string())], - }); - req.query('include', mapped.include); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveSubscriptionResponseSchema, requestOptions); - } - - /** - * 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 - * request. See the corresponding object definition for - * field details. - * @return Response from the API call - */ - async updateSubscription( - subscriptionId: string, - body: UpdateSubscriptionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - body: [body, updateSubscriptionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateSubscriptionResponseSchema, requestOptions); - } - - /** - * Deletes a scheduled action for a subscription. - * - * @param subscriptionId The ID of the subscription the targeted action is to act upon. - * @param actionId The ID of the targeted action to be deleted. - * @return Response from the API call - */ - async deleteSubscriptionAction( - subscriptionId: string, - actionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - actionId: [actionId, string()], - }); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}/actions/${mapped.actionId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteSubscriptionActionResponseSchema, - requestOptions - ); - } - - /** - * Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription- - * billing#billing-dates) - * for a subscription. - * - * @param subscriptionId The ID of the subscription to update the billing - * anchor date. - * @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 - */ - async changeBillingAnchorDate( - subscriptionId: string, - body: ChangeBillingAnchorDateRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - body: [body, changeBillingAnchorDateRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}/billing-anchor`; - req.authenticate([{ global: true }]); - return req.callAsJson( - changeBillingAnchorDateResponseSchema, - requestOptions - ); - } - - /** - * 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 - */ - async cancelSubscription( - subscriptionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - }); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}/cancel`; - req.authenticate([{ global: true }]); - return req.callAsJson(cancelSubscriptionResponseSchema, requestOptions); - } - - /** - * 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/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 - */ - async listSubscriptionEvents( - subscriptionId: string, - cursor?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - cursor: [cursor, optional(string())], - limit: [limit, optional(number())], - }); - req.query('cursor', mapped.cursor); - req.query('limit', mapped.limit); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}/events`; - req.authenticate([{ global: true }]); - return req.callAsJson(listSubscriptionEventsResponseSchema, requestOptions); - } - - /** - * Schedules a `PAUSE` action to pause an active subscription. - * - * @param subscriptionId The ID of the subscription to pause. - * @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 - */ - async pauseSubscription( - subscriptionId: string, - body: PauseSubscriptionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - body: [body, pauseSubscriptionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}/pause`; - req.authenticate([{ global: true }]); - return req.callAsJson(pauseSubscriptionResponseSchema, requestOptions); - } - - /** - * Schedules a `RESUME` action to resume a paused or a deactivated subscription. - * - * @param subscriptionId The ID of the subscription to resume. - * @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 - */ - async resumeSubscription( - subscriptionId: string, - body: ResumeSubscriptionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - body: [body, resumeSubscriptionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}/resume`; - req.authenticate([{ global: true }]); - return req.callAsJson(resumeSubscriptionResponseSchema, requestOptions); - } - - /** - * 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 - * the corresponding object definition for field details. - * @return Response from the API call - */ - async swapPlan( - subscriptionId: string, - body: SwapPlanRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - body: [body, swapPlanRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/subscriptions/${mapped.subscriptionId}/swap-plan`; - req.authenticate([{ global: true }]); - return req.callAsJson(swapPlanResponseSchema, requestOptions); - } -} diff --git a/src/api/teamApi.ts b/src/api/teamApi.ts deleted file mode 100644 index 543aa5e16..000000000 --- a/src/api/teamApi.ts +++ /dev/null @@ -1,386 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkCreateTeamMembersRequest, - bulkCreateTeamMembersRequestSchema, -} from '../models/bulkCreateTeamMembersRequest'; -import { - BulkCreateTeamMembersResponse, - bulkCreateTeamMembersResponseSchema, -} from '../models/bulkCreateTeamMembersResponse'; -import { - BulkUpdateTeamMembersRequest, - bulkUpdateTeamMembersRequestSchema, -} from '../models/bulkUpdateTeamMembersRequest'; -import { - BulkUpdateTeamMembersResponse, - bulkUpdateTeamMembersResponseSchema, -} from '../models/bulkUpdateTeamMembersResponse'; -import { - CreateJobRequest, - createJobRequestSchema, -} from '../models/createJobRequest'; -import { - CreateJobResponse, - createJobResponseSchema, -} from '../models/createJobResponse'; -import { - CreateTeamMemberRequest, - createTeamMemberRequestSchema, -} from '../models/createTeamMemberRequest'; -import { - CreateTeamMemberResponse, - createTeamMemberResponseSchema, -} from '../models/createTeamMemberResponse'; -import { - ListJobsResponse, - listJobsResponseSchema, -} from '../models/listJobsResponse'; -import { - RetrieveJobResponse, - retrieveJobResponseSchema, -} from '../models/retrieveJobResponse'; -import { - RetrieveTeamMemberResponse, - retrieveTeamMemberResponseSchema, -} from '../models/retrieveTeamMemberResponse'; -import { - RetrieveWageSettingResponse, - retrieveWageSettingResponseSchema, -} from '../models/retrieveWageSettingResponse'; -import { - SearchTeamMembersRequest, - searchTeamMembersRequestSchema, -} from '../models/searchTeamMembersRequest'; -import { - SearchTeamMembersResponse, - searchTeamMembersResponseSchema, -} from '../models/searchTeamMembersResponse'; -import { - UpdateJobRequest, - updateJobRequestSchema, -} from '../models/updateJobRequest'; -import { - UpdateJobResponse, - updateJobResponseSchema, -} from '../models/updateJobResponse'; -import { - UpdateTeamMemberRequest, - updateTeamMemberRequestSchema, -} from '../models/updateTeamMemberRequest'; -import { - UpdateTeamMemberResponse, - updateTeamMemberResponseSchema, -} from '../models/updateTeamMemberResponse'; -import { - UpdateWageSettingRequest, - updateWageSettingRequestSchema, -} from '../models/updateWageSettingRequest'; -import { - UpdateWageSettingResponse, - updateWageSettingResponseSchema, -} from '../models/updateWageSettingResponse'; -import { optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class TeamApi extends BaseApi { - /** - * Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates. - * You must provide the following values in your request to this endpoint: - * - `given_name` - * - `family_name` - * - * Learn about [Troubleshooting the Team API](https://developer.squareup. - * com/docs/team/troubleshooting#createteammember). - * - * @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 - */ - async createTeamMember( - body: CreateTeamMemberRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/team-members'); - const mapped = req.prepareArgs({ - body: [body, createTeamMemberRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createTeamMemberResponseSchema, requestOptions); - } - - /** - * Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful - * creates. - * This process is non-transactional and processes as much of the request as possible. If one of the - * creates in - * the request cannot be successfully processed, the request is not marked as failed, but the body of - * the response - * contains explicit error information for the failed create. - * - * Learn about [Troubleshooting the Team API](https://developer.squareup. - * com/docs/team/troubleshooting#bulk-create-team-members). - * - * @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 - */ - async bulkCreateTeamMembers( - body: BulkCreateTeamMembersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/team-members/bulk-create'); - const mapped = req.prepareArgs({ - body: [body, bulkCreateTeamMembersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkCreateTeamMembersResponseSchema, requestOptions); - } - - /** - * Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful - * updates. - * This process is non-transactional and processes as much of the request as possible. If one of the - * updates in - * the request cannot be successfully processed, the request is not marked as failed, but the body of - * the response - * contains explicit error information for the failed update. - * Learn about [Troubleshooting the Team API](https://developer.squareup. - * com/docs/team/troubleshooting#bulk-update-team-members). - * - * @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 - */ - async bulkUpdateTeamMembers( - body: BulkUpdateTeamMembersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/team-members/bulk-update'); - const mapped = req.prepareArgs({ - body: [body, bulkUpdateTeamMembersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkUpdateTeamMembersResponseSchema, requestOptions); - } - - /** - * Lists jobs in a seller account. Results are sorted by title in ascending order. - * - * @param cursor The pagination cursor returned by the previous call to this endpoint. Provide this cursor - * to retrieve the next page of results for your original request. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api- - * patterns/pagination). - * @return Response from the API call - */ - async listJobs( - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/team-members/jobs'); - const mapped = req.prepareArgs({ cursor: [cursor, optional(string())] }); - req.query('cursor', mapped.cursor); - req.authenticate([{ global: true }]); - return req.callAsJson(listJobsResponseSchema, requestOptions); - } - - /** - * Creates a job in a seller account. A job defines a title and tip eligibility. Note that - * compensation is defined in a [job assignment]($m/JobAssignment) in a team member's wage setting. - * - * @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 - */ - async createJob( - body: CreateJobRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/team-members/jobs'); - const mapped = req.prepareArgs({ body: [body, createJobRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createJobResponseSchema, requestOptions); - } - - /** - * Retrieves a specified job. - * - * @param jobId The ID of the job to retrieve. - * @return Response from the API call - */ - async retrieveJob( - jobId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ jobId: [jobId, string()] }); - req.appendTemplatePath`/v2/team-members/jobs/${mapped.jobId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveJobResponseSchema, requestOptions); - } - - /** - * Updates the title or tip eligibility of a job. Changes to the title propagate to all - * `JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to - * tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID. - * - * @param jobId The ID of the job to update. - * @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 - */ - async updateJob( - jobId: string, - body: UpdateJobRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - jobId: [jobId, string()], - body: [body, updateJobRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/team-members/jobs/${mapped.jobId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateJobResponseSchema, requestOptions); - } - - /** - * Returns a paginated list of `TeamMember` objects for a business. - * The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether - * the team member is the Square account owner. - * - * @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 - */ - async searchTeamMembers( - body: SearchTeamMembersRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/team-members/search'); - const mapped = req.prepareArgs({ - body: [body, searchTeamMembersRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchTeamMembersResponseSchema, requestOptions); - } - - /** - * Retrieves a `TeamMember` object for the given `TeamMember.id`. - * Learn about [Troubleshooting the Team API](https://developer.squareup. - * com/docs/team/troubleshooting#retrieve-a-team-member). - * - * @param teamMemberId The ID of the team member to retrieve. - * @return Response from the API call - */ - async retrieveTeamMember( - teamMemberId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ teamMemberId: [teamMemberId, string()] }); - req.appendTemplatePath`/v2/team-members/${mapped.teamMemberId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveTeamMemberResponseSchema, requestOptions); - } - - /** - * Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates. - * Learn about [Troubleshooting the Team API](https://developer.squareup. - * com/docs/team/troubleshooting#update-a-team-member). - * - * @param teamMemberId The ID of the team member to update. - * @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 - */ - async updateTeamMember( - teamMemberId: string, - body: UpdateTeamMemberRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - teamMemberId: [teamMemberId, string()], - body: [body, updateTeamMemberRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/team-members/${mapped.teamMemberId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateTeamMemberResponseSchema, requestOptions); - } - - /** - * Retrieves a `WageSetting` object for a team member specified - * by `TeamMember.id`. For more information, see - * [Troubleshooting the Team API](https://developer.squareup. - * com/docs/team/troubleshooting#retrievewagesetting). - * - * Square recommends using [RetrieveTeamMember]($e/Team/RetrieveTeamMember) or - * [SearchTeamMembers]($e/Team/SearchTeamMembers) - * to get this information directly from the `TeamMember.wage_setting` field. - * - * @param teamMemberId The ID of the team member for which to retrieve the wage setting. - * @return Response from the API call - */ - async retrieveWageSetting( - teamMemberId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ teamMemberId: [teamMemberId, string()] }); - req.appendTemplatePath`/v2/team-members/${mapped.teamMemberId}/wage-setting`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveWageSettingResponseSchema, requestOptions); - } - - /** - * Creates or updates a `WageSetting` object. The object is created if a - * `WageSetting` with the specified `team_member_id` doesn't exist. Otherwise, - * it fully replaces the `WageSetting` object for the team member. - * The `WageSetting` is returned on a successful update. For more information, see - * [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or- - * update-a-wage-setting). - * - * Square recommends using [CreateTeamMember]($e/Team/CreateTeamMember) or - * [UpdateTeamMember]($e/Team/UpdateTeamMember) - * to manage the `TeamMember.wage_setting` field directly. - * - * @param teamMemberId The ID of the team member for which to update the - * `WageSetting` object. - * @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 - */ - async updateWageSetting( - teamMemberId: string, - body: UpdateWageSettingRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - teamMemberId: [teamMemberId, string()], - body: [body, updateWageSettingRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/team-members/${mapped.teamMemberId}/wage-setting`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateWageSettingResponseSchema, requestOptions); - } -} diff --git a/src/api/terminalApi.ts b/src/api/terminalApi.ts deleted file mode 100644 index 5f70b9daf..000000000 --- a/src/api/terminalApi.ts +++ /dev/null @@ -1,400 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CancelTerminalActionResponse, - cancelTerminalActionResponseSchema, -} from '../models/cancelTerminalActionResponse'; -import { - CancelTerminalCheckoutResponse, - cancelTerminalCheckoutResponseSchema, -} from '../models/cancelTerminalCheckoutResponse'; -import { - CancelTerminalRefundResponse, - cancelTerminalRefundResponseSchema, -} from '../models/cancelTerminalRefundResponse'; -import { - CreateTerminalActionRequest, - createTerminalActionRequestSchema, -} from '../models/createTerminalActionRequest'; -import { - CreateTerminalActionResponse, - createTerminalActionResponseSchema, -} from '../models/createTerminalActionResponse'; -import { - CreateTerminalCheckoutRequest, - createTerminalCheckoutRequestSchema, -} from '../models/createTerminalCheckoutRequest'; -import { - CreateTerminalCheckoutResponse, - createTerminalCheckoutResponseSchema, -} from '../models/createTerminalCheckoutResponse'; -import { - CreateTerminalRefundRequest, - createTerminalRefundRequestSchema, -} from '../models/createTerminalRefundRequest'; -import { - CreateTerminalRefundResponse, - createTerminalRefundResponseSchema, -} from '../models/createTerminalRefundResponse'; -import { - DismissTerminalActionResponse, - dismissTerminalActionResponseSchema, -} from '../models/dismissTerminalActionResponse'; -import { - DismissTerminalCheckoutResponse, - dismissTerminalCheckoutResponseSchema, -} from '../models/dismissTerminalCheckoutResponse'; -import { - DismissTerminalRefundResponse, - dismissTerminalRefundResponseSchema, -} from '../models/dismissTerminalRefundResponse'; -import { - GetTerminalActionResponse, - getTerminalActionResponseSchema, -} from '../models/getTerminalActionResponse'; -import { - GetTerminalCheckoutResponse, - getTerminalCheckoutResponseSchema, -} from '../models/getTerminalCheckoutResponse'; -import { - GetTerminalRefundResponse, - getTerminalRefundResponseSchema, -} from '../models/getTerminalRefundResponse'; -import { - SearchTerminalActionsRequest, - searchTerminalActionsRequestSchema, -} from '../models/searchTerminalActionsRequest'; -import { - SearchTerminalActionsResponse, - searchTerminalActionsResponseSchema, -} from '../models/searchTerminalActionsResponse'; -import { - SearchTerminalCheckoutsRequest, - searchTerminalCheckoutsRequestSchema, -} from '../models/searchTerminalCheckoutsRequest'; -import { - SearchTerminalCheckoutsResponse, - searchTerminalCheckoutsResponseSchema, -} from '../models/searchTerminalCheckoutsResponse'; -import { - SearchTerminalRefundsRequest, - searchTerminalRefundsRequestSchema, -} from '../models/searchTerminalRefundsRequest'; -import { - SearchTerminalRefundsResponse, - searchTerminalRefundsResponseSchema, -} from '../models/searchTerminalRefundsResponse'; -import { string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class TerminalApi extends BaseApi { - /** - * Creates a Terminal action request and sends it to the specified device. - * - * @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 - */ - async createTerminalAction( - body: CreateTerminalActionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/terminals/actions'); - const mapped = req.prepareArgs({ - body: [body, createTerminalActionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createTerminalActionResponseSchema, requestOptions); - } - - /** - * Retrieves a filtered list of Terminal action requests created by the account making the request. - * Terminal action requests are available for 30 days. - * - * @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 - */ - async searchTerminalActions( - body: SearchTerminalActionsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/terminals/actions/search'); - const mapped = req.prepareArgs({ - body: [body, searchTerminalActionsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchTerminalActionsResponseSchema, requestOptions); - } - - /** - * Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 - * days. - * - * @param actionId Unique ID for the desired `TerminalAction`. - * @return Response from the API call - */ - async getTerminalAction( - actionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ actionId: [actionId, string()] }); - req.appendTemplatePath`/v2/terminals/actions/${mapped.actionId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getTerminalActionResponseSchema, requestOptions); - } - - /** - * Cancels a Terminal action request if the status of the request permits it. - * - * @param actionId Unique ID for the desired `TerminalAction`. - * @return Response from the API call - */ - async cancelTerminalAction( - actionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ actionId: [actionId, string()] }); - req.appendTemplatePath`/v2/terminals/actions/${mapped.actionId}/cancel`; - req.authenticate([{ global: true }]); - 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 action 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`; - req.authenticate([{ global: true }]); - 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. - * - * @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 - */ - async createTerminalCheckout( - body: CreateTerminalCheckoutRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/terminals/checkouts'); - const mapped = req.prepareArgs({ - body: [body, createTerminalCheckoutRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createTerminalCheckoutResponseSchema, requestOptions); - } - - /** - * Returns a filtered list of Terminal checkout requests created by the application making the request. - * Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. - * Terminal checkout requests are available for 30 days. - * - * @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 - */ - async searchTerminalCheckouts( - body: SearchTerminalCheckoutsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/terminals/checkouts/search'); - const mapped = req.prepareArgs({ - body: [body, searchTerminalCheckoutsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - searchTerminalCheckoutsResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for - * 30 days. - * - * @param checkoutId The unique ID for the desired `TerminalCheckout`. - * @return Response from the API call - */ - async getTerminalCheckout( - checkoutId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ checkoutId: [checkoutId, string()] }); - req.appendTemplatePath`/v2/terminals/checkouts/${mapped.checkoutId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getTerminalCheckoutResponseSchema, requestOptions); - } - - /** - * Cancels a Terminal checkout request if the status of the request permits it. - * - * @param checkoutId The unique ID for the desired `TerminalCheckout`. - * @return Response from the API call - */ - async cancelTerminalCheckout( - checkoutId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ checkoutId: [checkoutId, string()] }); - req.appendTemplatePath`/v2/terminals/checkouts/${mapped.checkoutId}/cancel`; - req.authenticate([{ global: true }]); - return req.callAsJson(cancelTerminalCheckoutResponseSchema, requestOptions); - } - - /** - * Dismisses a Terminal checkout request if the status and type of the request permits it. - * - * @param checkoutId Unique ID for the `TerminalCheckout` associated with the checkout to be dismissed. - * @return Response from the API call - */ - async dismissTerminalCheckout( - checkoutId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ checkoutId: [checkoutId, string()] }); - req.appendTemplatePath`/v2/terminals/checkouts/${mapped.checkoutId}/dismiss`; - req.authenticate([{ global: true }]); - return req.callAsJson( - dismissTerminalCheckoutResponseSchema, - requestOptions - ); - } - - /** - * Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac - * payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds - * for Terminal payments should use the Refunds API. For more information, see [Refunds - * API]($e/Refunds). - * - * @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 - */ - async createTerminalRefund( - body: CreateTerminalRefundRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/terminals/refunds'); - const mapped = req.prepareArgs({ - body: [body, createTerminalRefundRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createTerminalRefundResponseSchema, requestOptions); - } - - /** - * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the - * request. Terminal refund requests are available for 30 days. - * - * @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 - */ - async searchTerminalRefunds( - body: SearchTerminalRefundsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/terminals/refunds/search'); - const mapped = req.prepareArgs({ - body: [body, searchTerminalRefundsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchTerminalRefundsResponseSchema, requestOptions); - } - - /** - * Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days. - * - * @param terminalRefundId The unique ID for the desired `TerminalRefund`. - * @return Response from the API call - */ - async getTerminalRefund( - terminalRefundId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - terminalRefundId: [terminalRefundId, string()], - }); - req.appendTemplatePath`/v2/terminals/refunds/${mapped.terminalRefundId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(getTerminalRefundResponseSchema, requestOptions); - } - - /** - * Cancels an Interac Terminal refund request by refund request ID if the status of the request permits - * it. - * - * @param terminalRefundId The unique ID for the desired `TerminalRefund`. - * @return Response from the API call - */ - async cancelTerminalRefund( - terminalRefundId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - terminalRefundId: [terminalRefundId, string()], - }); - req.appendTemplatePath`/v2/terminals/refunds/${mapped.terminalRefundId}/cancel`; - req.authenticate([{ global: true }]); - return req.callAsJson(cancelTerminalRefundResponseSchema, requestOptions); - } - - /** - * Dismisses a Terminal refund request if the status and type of the request permits it. - * - * @param terminalRefundId Unique ID for the `TerminalRefund` associated with the refund to be dismissed. - * @return Response from the API call - */ - async dismissTerminalRefund( - terminalRefundId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - terminalRefundId: [terminalRefundId, string()], - }); - req.appendTemplatePath`/v2/terminals/refunds/${mapped.terminalRefundId}/dismiss`; - req.authenticate([{ global: true }]); - return req.callAsJson(dismissTerminalRefundResponseSchema, requestOptions); - } -} diff --git a/src/api/transactionsApi.ts b/src/api/transactionsApi.ts deleted file mode 100644 index cc74541a5..000000000 --- a/src/api/transactionsApi.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CaptureTransactionResponse, - captureTransactionResponseSchema, -} from '../models/captureTransactionResponse'; -import { - ListTransactionsResponse, - listTransactionsResponseSchema, -} from '../models/listTransactionsResponse'; -import { - RetrieveTransactionResponse, - retrieveTransactionResponseSchema, -} from '../models/retrieveTransactionResponse'; -import { - VoidTransactionResponse, - voidTransactionResponseSchema, -} from '../models/voidTransactionResponse'; -import { optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class TransactionsApi extends BaseApi { - /** - * Lists transactions for a particular location. - * - * Transactions include payment information from sales and exchanges and refund - * information from returns and exchanges. - * - * Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50 - * - * @param locationId The ID of the location to list transactions for. - * @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date - * ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for - * details on date inclusivity/exclusivity. Default value: The current time minus one - * year. - * @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date - * ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for - * details on date inclusivity/exclusivity. Default value: The current time. - * @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, - * `DESC` for newest first). Default value: `DESC` - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to - * retrieve the next set of results for your original query. See [Paginating - * results](https://developer.squareup.com/docs/working-with-apis/pagination) for more - * information. - * @return Response from the API call - * @deprecated - */ - async listTransactions( - locationId: string, - beginTime?: string, - endTime?: string, - sortOrder?: string, - cursor?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - beginTime: [beginTime, optional(string())], - endTime: [endTime, optional(string())], - sortOrder: [sortOrder, optional(string())], - cursor: [cursor, optional(string())], - }); - req.query('begin_time', mapped.beginTime); - req.query('end_time', mapped.endTime); - req.query('sort_order', mapped.sortOrder); - req.query('cursor', mapped.cursor); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/transactions`; - req.deprecated('TransactionsApi.listTransactions'); - req.authenticate([{ global: true }]); - return req.callAsJson(listTransactionsResponseSchema, requestOptions); - } - - /** - * Retrieves details for a single transaction. - * - * @param locationId The ID of the transaction's associated location. - * @param transactionId The ID of the transaction to retrieve. - * @return Response from the API call - * @deprecated - */ - async retrieveTransaction( - locationId: string, - transactionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - transactionId: [transactionId, string()], - }); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/transactions/${mapped.transactionId}`; - req.deprecated('TransactionsApi.retrieveTransaction'); - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveTransactionResponseSchema, requestOptions); - } - - /** - * Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) - * endpoint with a `delay_capture` value of `true`. - * - * - * See [Delayed capture transactions](https://developer.squareup. - * com/docs/payments/transactions/overview#delayed-capture) - * for more information. - * - * @param locationId - * @param transactionId - * @return Response from the API call - * @deprecated - */ - async captureTransaction( - locationId: string, - transactionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - transactionId: [transactionId, string()], - }); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/transactions/${mapped.transactionId}/capture`; - req.deprecated('TransactionsApi.captureTransaction'); - req.authenticate([{ global: true }]); - return req.callAsJson(captureTransactionResponseSchema, requestOptions); - } - - /** - * Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) - * endpoint with a `delay_capture` value of `true`. - * - * - * See [Delayed capture transactions](https://developer.squareup. - * com/docs/payments/transactions/overview#delayed-capture) - * for more information. - * - * @param locationId - * @param transactionId - * @return Response from the API call - * @deprecated - */ - async voidTransaction( - locationId: string, - transactionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - transactionId: [transactionId, string()], - }); - req.appendTemplatePath`/v2/locations/${mapped.locationId}/transactions/${mapped.transactionId}/void`; - req.deprecated('TransactionsApi.voidTransaction'); - req.authenticate([{ global: true }]); - return req.callAsJson(voidTransactionResponseSchema, requestOptions); - } -} diff --git a/src/api/types/AcceptDisputeResponse.ts b/src/api/types/AcceptDisputeResponse.ts new file mode 100644 index 000000000..5cf8036d7 --- /dev/null +++ b/src/api/types/AcceptDisputeResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields in an `AcceptDispute` response. + */ +export interface AcceptDisputeResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** Details about the accepted dispute. */ + dispute?: Square.Dispute; +} diff --git a/src/api/types/AcceptedPaymentMethods.ts b/src/api/types/AcceptedPaymentMethods.ts new file mode 100644 index 000000000..0c05ee8f3 --- /dev/null +++ b/src/api/types/AcceptedPaymentMethods.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface AcceptedPaymentMethods { + /** Whether Apple Pay is accepted at checkout. */ + applePay?: boolean | null; + /** Whether Google Pay is accepted at checkout. */ + googlePay?: boolean | null; + /** Whether Cash App Pay is accepted at checkout. */ + cashAppPay?: boolean | null; + /** Whether Afterpay/Clearpay is accepted at checkout. */ + afterpayClearpay?: boolean | null; +} diff --git a/src/api/types/AccumulateLoyaltyPointsResponse.ts b/src/api/types/AccumulateLoyaltyPointsResponse.ts new file mode 100644 index 000000000..524ee73d3 --- /dev/null +++ b/src/api/types/AccumulateLoyaltyPointsResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) response. + */ +export interface AccumulateLoyaltyPointsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The resulting loyalty event. Starting in Square version 2022-08-17, this field is no longer returned. */ + event?: Square.LoyaltyEvent; + /** + * The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event + * is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included + * if the purchase also qualifies for a loyalty promotion. + */ + events?: Square.LoyaltyEvent[]; +} diff --git a/src/api/types/AchDetails.ts b/src/api/types/AchDetails.ts new file mode 100644 index 000000000..cdf932f07 --- /dev/null +++ b/src/api/types/AchDetails.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`. + */ +export interface AchDetails { + /** The routing number for the bank account. */ + routingNumber?: string | null; + /** The last few digits of the bank account number. */ + accountNumberSuffix?: string | null; + /** + * The type of the bank account performing the transfer. The account type can be `CHECKING`, + * `SAVINGS`, or `UNKNOWN`. + */ + accountType?: string | null; +} diff --git a/src/api/types/ActionCancelReason.ts b/src/api/types/ActionCancelReason.ts new file mode 100644 index 000000000..1d1653a63 --- /dev/null +++ b/src/api/types/ActionCancelReason.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ActionCancelReason = "BUYER_CANCELED" | "SELLER_CANCELED" | "TIMED_OUT"; +export const ActionCancelReason = { + BuyerCanceled: "BUYER_CANCELED", + SellerCanceled: "SELLER_CANCELED", + TimedOut: "TIMED_OUT", +} as const; diff --git a/src/api/types/ActivityType.ts b/src/api/types/ActivityType.ts new file mode 100644 index 000000000..e31d2abb1 --- /dev/null +++ b/src/api/types/ActivityType.ts @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ActivityType = + | "ADJUSTMENT" + | "APP_FEE_REFUND" + | "APP_FEE_REVENUE" + | "AUTOMATIC_SAVINGS" + | "AUTOMATIC_SAVINGS_REVERSED" + | "CHARGE" + | "DEPOSIT_FEE" + | "DEPOSIT_FEE_REVERSED" + | "DISPUTE" + | "ESCHEATMENT" + | "FEE" + | "FREE_PROCESSING" + | "HOLD_ADJUSTMENT" + | "INITIAL_BALANCE_CHANGE" + | "MONEY_TRANSFER" + | "MONEY_TRANSFER_REVERSAL" + | "OPEN_DISPUTE" + | "OTHER" + | "OTHER_ADJUSTMENT" + | "PAID_SERVICE_FEE" + | "PAID_SERVICE_FEE_REFUND" + | "REDEMPTION_CODE" + | "REFUND" + | "RELEASE_ADJUSTMENT" + | "RESERVE_HOLD" + | "RESERVE_RELEASE" + | "RETURNED_PAYOUT" + | "SQUARE_CAPITAL_PAYMENT" + | "SQUARE_CAPITAL_REVERSED_PAYMENT" + | "SUBSCRIPTION_FEE" + | "SUBSCRIPTION_FEE_PAID_REFUND" + | "SUBSCRIPTION_FEE_REFUND" + | "TAX_ON_FEE" + | "THIRD_PARTY_FEE" + | "THIRD_PARTY_FEE_REFUND" + | "PAYOUT" + | "AUTOMATIC_BITCOIN_CONVERSIONS" + | "AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED" + | "CREDIT_CARD_REPAYMENT" + | "CREDIT_CARD_REPAYMENT_REVERSED" + | "LOCAL_OFFERS_CASHBACK" + | "LOCAL_OFFERS_FEE" + | "PERCENTAGE_PROCESSING_ENROLLMENT" + | "PERCENTAGE_PROCESSING_DEACTIVATION" + | "PERCENTAGE_PROCESSING_REPAYMENT" + | "PERCENTAGE_PROCESSING_REPAYMENT_REVERSED" + | "PROCESSING_FEE" + | "PROCESSING_FEE_REFUND" + | "UNDO_PROCESSING_FEE_REFUND" + | "GIFT_CARD_LOAD_FEE" + | "GIFT_CARD_LOAD_FEE_REFUND" + | "UNDO_GIFT_CARD_LOAD_FEE_REFUND" + | "BALANCE_FOLDERS_TRANSFER" + | "BALANCE_FOLDERS_TRANSFER_REVERSED" + | "GIFT_CARD_POOL_TRANSFER" + | "GIFT_CARD_POOL_TRANSFER_REVERSED" + | "SQUARE_PAYROLL_TRANSFER" + | "SQUARE_PAYROLL_TRANSFER_REVERSED"; +export const ActivityType = { + Adjustment: "ADJUSTMENT", + AppFeeRefund: "APP_FEE_REFUND", + AppFeeRevenue: "APP_FEE_REVENUE", + AutomaticSavings: "AUTOMATIC_SAVINGS", + AutomaticSavingsReversed: "AUTOMATIC_SAVINGS_REVERSED", + Charge: "CHARGE", + DepositFee: "DEPOSIT_FEE", + DepositFeeReversed: "DEPOSIT_FEE_REVERSED", + Dispute: "DISPUTE", + Escheatment: "ESCHEATMENT", + Fee: "FEE", + FreeProcessing: "FREE_PROCESSING", + HoldAdjustment: "HOLD_ADJUSTMENT", + InitialBalanceChange: "INITIAL_BALANCE_CHANGE", + MoneyTransfer: "MONEY_TRANSFER", + MoneyTransferReversal: "MONEY_TRANSFER_REVERSAL", + OpenDispute: "OPEN_DISPUTE", + Other: "OTHER", + OtherAdjustment: "OTHER_ADJUSTMENT", + PaidServiceFee: "PAID_SERVICE_FEE", + PaidServiceFeeRefund: "PAID_SERVICE_FEE_REFUND", + RedemptionCode: "REDEMPTION_CODE", + Refund: "REFUND", + ReleaseAdjustment: "RELEASE_ADJUSTMENT", + ReserveHold: "RESERVE_HOLD", + ReserveRelease: "RESERVE_RELEASE", + ReturnedPayout: "RETURNED_PAYOUT", + SquareCapitalPayment: "SQUARE_CAPITAL_PAYMENT", + SquareCapitalReversedPayment: "SQUARE_CAPITAL_REVERSED_PAYMENT", + SubscriptionFee: "SUBSCRIPTION_FEE", + SubscriptionFeePaidRefund: "SUBSCRIPTION_FEE_PAID_REFUND", + SubscriptionFeeRefund: "SUBSCRIPTION_FEE_REFUND", + TaxOnFee: "TAX_ON_FEE", + ThirdPartyFee: "THIRD_PARTY_FEE", + ThirdPartyFeeRefund: "THIRD_PARTY_FEE_REFUND", + Payout: "PAYOUT", + AutomaticBitcoinConversions: "AUTOMATIC_BITCOIN_CONVERSIONS", + AutomaticBitcoinConversionsReversed: "AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED", + CreditCardRepayment: "CREDIT_CARD_REPAYMENT", + CreditCardRepaymentReversed: "CREDIT_CARD_REPAYMENT_REVERSED", + LocalOffersCashback: "LOCAL_OFFERS_CASHBACK", + LocalOffersFee: "LOCAL_OFFERS_FEE", + PercentageProcessingEnrollment: "PERCENTAGE_PROCESSING_ENROLLMENT", + PercentageProcessingDeactivation: "PERCENTAGE_PROCESSING_DEACTIVATION", + PercentageProcessingRepayment: "PERCENTAGE_PROCESSING_REPAYMENT", + PercentageProcessingRepaymentReversed: "PERCENTAGE_PROCESSING_REPAYMENT_REVERSED", + ProcessingFee: "PROCESSING_FEE", + ProcessingFeeRefund: "PROCESSING_FEE_REFUND", + UndoProcessingFeeRefund: "UNDO_PROCESSING_FEE_REFUND", + GiftCardLoadFee: "GIFT_CARD_LOAD_FEE", + GiftCardLoadFeeRefund: "GIFT_CARD_LOAD_FEE_REFUND", + UndoGiftCardLoadFeeRefund: "UNDO_GIFT_CARD_LOAD_FEE_REFUND", + BalanceFoldersTransfer: "BALANCE_FOLDERS_TRANSFER", + BalanceFoldersTransferReversed: "BALANCE_FOLDERS_TRANSFER_REVERSED", + GiftCardPoolTransfer: "GIFT_CARD_POOL_TRANSFER", + GiftCardPoolTransferReversed: "GIFT_CARD_POOL_TRANSFER_REVERSED", + SquarePayrollTransfer: "SQUARE_PAYROLL_TRANSFER", + SquarePayrollTransferReversed: "SQUARE_PAYROLL_TRANSFER_REVERSED", +} as const; diff --git a/src/api/types/AddGroupToCustomerResponse.ts b/src/api/types/AddGroupToCustomerResponse.ts new file mode 100644 index 000000000..064a809ed --- /dev/null +++ b/src/api/types/AddGroupToCustomerResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [AddGroupToCustomer](api-endpoint:Customers-AddGroupToCustomer) endpoint. + */ +export interface AddGroupToCustomerResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/AdditionalRecipient.ts b/src/api/types/AdditionalRecipient.ts new file mode 100644 index 000000000..35b50da40 --- /dev/null +++ b/src/api/types/AdditionalRecipient.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an additional recipient (other than the merchant) receiving a portion of this tender. + */ +export interface AdditionalRecipient { + /** The location ID for a recipient (other than the merchant) receiving a portion of this tender. */ + locationId: string; + /** The description of the additional recipient. */ + description?: string | null; + /** The amount of money distributed to the recipient. */ + amountMoney: Square.Money; + /** The unique ID for the RETIRED `AdditionalRecipientReceivable` object. This field should be empty for any `AdditionalRecipient` objects created after the retirement. */ + receivableId?: string | null; +} diff --git a/src/api/types/Address.ts b/src/api/types/Address.ts new file mode 100644 index 000000000..31ed6e0dd --- /dev/null +++ b/src/api/types/Address.ts @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a postal address in a country. + * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). + */ +export interface Address { + /** + * The first line of the address. + * + * Fields that start with `address_line` provide the address's most specific + * details, like street number, street name, and building name. They do *not* + * provide less specific details like city, state/province, or country (these + * details are provided in other fields). + */ + addressLine1?: string | null; + /** The second line of the address, if any. */ + addressLine2?: string | null; + /** The third line of the address, if any. */ + addressLine3?: string | null; + /** The city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). */ + locality?: string | null; + /** A civil region within the address's `locality`, if any. */ + sublocality?: string | null; + /** A civil region within the address's `sublocality`, if any. */ + sublocality2?: string | null; + /** A civil region within the address's `sublocality_2`, if any. */ + sublocality3?: string | null; + /** + * A civil entity within the address's country. In the US, this + * is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). + */ + administrativeDistrictLevel1?: string | null; + /** + * A civil entity within the address's `administrative_district_level_1`. + * In the US, this is the county. + */ + administrativeDistrictLevel2?: string | null; + /** + * A civil entity within the address's `administrative_district_level_2`, + * if any. + */ + administrativeDistrictLevel3?: string | null; + /** The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). */ + postalCode?: string | null; + /** + * The address's country, in the two-letter format of ISO 3166. For example, `US` or `FR`. + * See [Country](#type-country) for possible values + */ + country?: Square.Country; + /** Optional first name when it's representing recipient. */ + firstName?: string | null; + /** Optional last name when it's representing recipient. */ + lastName?: string | null; +} diff --git a/src/api/types/AdjustLoyaltyPointsResponse.ts b/src/api/types/AdjustLoyaltyPointsResponse.ts new file mode 100644 index 000000000..90365ec62 --- /dev/null +++ b/src/api/types/AdjustLoyaltyPointsResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [AdjustLoyaltyPoints](api-endpoint:Loyalty-AdjustLoyaltyPoints) request. + */ +export interface AdjustLoyaltyPointsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The resulting event data for the adjustment. */ + event?: Square.LoyaltyEvent; +} diff --git a/src/api/types/AfterpayDetails.ts b/src/api/types/AfterpayDetails.ts new file mode 100644 index 000000000..48fbcac19 --- /dev/null +++ b/src/api/types/AfterpayDetails.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Additional details about Afterpay payments. + */ +export interface AfterpayDetails { + /** Email address on the buyer's Afterpay account. */ + emailAddress?: string | null; +} diff --git a/src/api/types/ApplicationDetails.ts b/src/api/types/ApplicationDetails.ts new file mode 100644 index 000000000..af1fb2d46 --- /dev/null +++ b/src/api/types/ApplicationDetails.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Details about the application that took the payment. + */ +export interface ApplicationDetails { + /** + * The Square product, such as Square Point of Sale (POS), + * Square Invoices, or Square Virtual Terminal. + * See [ExternalSquareProduct](#type-externalsquareproduct) for possible values + */ + squareProduct?: Square.ApplicationDetailsExternalSquareProduct; + /** + * The Square ID assigned to the application used to take the payment. + * Application developers can use this information to identify payments that + * their application processed. + * For example, if a developer uses a custom application to process payments, + * this field contains the application ID from the Developer Dashboard. + * If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace) + * application to process payments, the field contains the corresponding application ID. + */ + applicationId?: string | null; +} diff --git a/src/api/types/ApplicationDetailsExternalSquareProduct.ts b/src/api/types/ApplicationDetailsExternalSquareProduct.ts new file mode 100644 index 000000000..f4a156f50 --- /dev/null +++ b/src/api/types/ApplicationDetailsExternalSquareProduct.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A list of products to return to external callers. + */ +export type ApplicationDetailsExternalSquareProduct = + | "APPOINTMENTS" + | "ECOMMERCE_API" + | "INVOICES" + | "ONLINE_STORE" + | "OTHER" + | "RESTAURANTS" + | "RETAIL" + | "SQUARE_POS" + | "TERMINAL_API" + | "VIRTUAL_TERMINAL"; +export const ApplicationDetailsExternalSquareProduct = { + Appointments: "APPOINTMENTS", + EcommerceApi: "ECOMMERCE_API", + Invoices: "INVOICES", + OnlineStore: "ONLINE_STORE", + Other: "OTHER", + Restaurants: "RESTAURANTS", + Retail: "RETAIL", + SquarePos: "SQUARE_POS", + TerminalApi: "TERMINAL_API", + VirtualTerminal: "VIRTUAL_TERMINAL", +} as const; diff --git a/src/api/types/ApplicationType.ts b/src/api/types/ApplicationType.ts new file mode 100644 index 000000000..60d86551d --- /dev/null +++ b/src/api/types/ApplicationType.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ApplicationType = "TERMINAL_API"; diff --git a/src/api/types/AppointmentSegment.ts b/src/api/types/AppointmentSegment.ts new file mode 100644 index 000000000..fd5e7e479 --- /dev/null +++ b/src/api/types/AppointmentSegment.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines an appointment segment of a booking. + */ +export interface AppointmentSegment { + /** The time span in minutes of an appointment segment. */ + durationMinutes?: number | null; + /** The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment. */ + serviceVariationId?: string | null; + /** The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this segment. */ + teamMemberId: string; + /** The current version of the item variation representing the service booked in this segment. */ + serviceVariationVersion?: bigint | null; + /** Time between the end of this segment and the beginning of the subsequent segment. */ + intermissionMinutes?: number; + /** Whether the customer accepts any team member, instead of a specific one, to serve this segment. */ + anyTeamMember?: boolean; + /** The IDs of the seller-accessible resources used for this appointment segment. */ + resourceIds?: string[]; +} diff --git a/src/api/types/ArchivedState.ts b/src/api/types/ArchivedState.ts new file mode 100644 index 000000000..9bdf9cc21 --- /dev/null +++ b/src/api/types/ArchivedState.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines the values for the `archived_state` query expression + * used in [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) + * to return the archived, not archived or either type of catalog items. + */ +export type ArchivedState = "ARCHIVED_STATE_NOT_ARCHIVED" | "ARCHIVED_STATE_ARCHIVED" | "ARCHIVED_STATE_ALL"; +export const ArchivedState = { + ArchivedStateNotArchived: "ARCHIVED_STATE_NOT_ARCHIVED", + ArchivedStateArchived: "ARCHIVED_STATE_ARCHIVED", + ArchivedStateAll: "ARCHIVED_STATE_ALL", +} as const; diff --git a/src/api/types/Availability.ts b/src/api/types/Availability.ts new file mode 100644 index 000000000..3dfd740d8 --- /dev/null +++ b/src/api/types/Availability.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines an appointment slot that encapsulates the appointment segments, location and starting time available for booking. + */ +export interface Availability { + /** The RFC 3339 timestamp specifying the beginning time of the slot available for booking. */ + startAt?: string | null; + /** The ID of the location available for booking. */ + locationId?: string; + /** The list of appointment segments available for booking */ + appointmentSegments?: Square.AppointmentSegment[] | null; +} diff --git a/src/api/types/BankAccount.ts b/src/api/types/BankAccount.ts new file mode 100644 index 000000000..46946a700 --- /dev/null +++ b/src/api/types/BankAccount.ts @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a bank account. For more information about + * linking a bank account to a Square account, see + * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). + */ +export interface BankAccount { + /** The unique, Square-issued identifier for the bank account. */ + id: string; + /** The last few digits of the account number. */ + accountNumberSuffix: string; + /** + * The ISO 3166 Alpha-2 country code where the bank account is based. + * See [Country](#type-country) for possible values + */ + country: Square.Country; + /** + * The 3-character ISO 4217 currency code indicating the operating + * currency of the bank account. For example, the currency code for US dollars + * is `USD`. + * See [Currency](#type-currency) for possible values + */ + currency: Square.Currency; + /** + * The financial purpose of the associated bank account. + * See [BankAccountType](#type-bankaccounttype) for possible values + */ + accountType: Square.BankAccountType; + /** + * Name of the account holder. This name must match the name + * on the targeted bank account record. + */ + holderName: string; + /** + * Primary identifier for the bank. For more information, see + * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). + */ + primaryBankIdentificationNumber: string; + /** + * Secondary identifier for the bank. For more information, see + * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). + */ + secondaryBankIdentificationNumber?: string | null; + /** + * Reference identifier that will be displayed to UK bank account owners + * when collecting direct debit authorization. Only required for UK bank accounts. + */ + debitMandateReferenceId?: string | null; + /** + * Client-provided identifier for linking the banking account to an entity + * in a third-party system (for example, a bank account number or a user identifier). + */ + referenceId?: string | null; + /** The location to which the bank account belongs. */ + locationId?: string | null; + /** + * Read-only. The current verification status of this BankAccount object. + * See [BankAccountStatus](#type-bankaccountstatus) for possible values + */ + status: Square.BankAccountStatus; + /** Indicates whether it is possible for Square to send money to this bank account. */ + creditable: boolean; + /** + * Indicates whether it is possible for Square to take money from this + * bank account. + */ + debitable: boolean; + /** + * A Square-assigned, unique identifier for the bank account based on the + * account information. The account fingerprint can be used to compare account + * entries and determine if the they represent the same real-world bank account. + */ + fingerprint?: string | null; + /** The current version of the `BankAccount`. */ + version?: number; + /** + * Read only. Name of actual financial institution. + * For example "Bank of America". + */ + bankName?: string | null; +} diff --git a/src/api/types/BankAccountPaymentDetails.ts b/src/api/types/BankAccountPaymentDetails.ts new file mode 100644 index 000000000..67c412152 --- /dev/null +++ b/src/api/types/BankAccountPaymentDetails.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Additional details about BANK_ACCOUNT type payments. + */ +export interface BankAccountPaymentDetails { + /** The name of the bank associated with the bank account. */ + bankName?: string | null; + /** The type of the bank transfer. The type can be `ACH` or `UNKNOWN`. */ + transferType?: string | null; + /** + * The ownership type of the bank account performing the transfer. + * The type can be `INDIVIDUAL`, `COMPANY`, or `ACCOUNT_TYPE_UNKNOWN`. + */ + accountOwnershipType?: string | null; + /** + * Uniquely identifies the bank account for this seller and can be used + * to determine if payments are from the same bank account. + */ + fingerprint?: string | null; + /** The two-letter ISO code representing the country the bank account is located in. */ + country?: string | null; + /** The statement description as sent to the bank. */ + statementDescription?: string | null; + /** + * ACH-specific information about the transfer. The information is only populated + * if the `transfer_type` is `ACH`. + */ + achDetails?: Square.AchDetails; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[] | null; +} diff --git a/src/api/types/BankAccountStatus.ts b/src/api/types/BankAccountStatus.ts new file mode 100644 index 000000000..8ffa2f5ec --- /dev/null +++ b/src/api/types/BankAccountStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the current verification status of a `BankAccount` object. + */ +export type BankAccountStatus = "VERIFICATION_IN_PROGRESS" | "VERIFIED" | "DISABLED"; +export const BankAccountStatus = { + VerificationInProgress: "VERIFICATION_IN_PROGRESS", + Verified: "VERIFIED", + Disabled: "DISABLED", +} as const; diff --git a/src/api/types/BankAccountType.ts b/src/api/types/BankAccountType.ts new file mode 100644 index 000000000..fe1a46083 --- /dev/null +++ b/src/api/types/BankAccountType.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the financial purpose of the bank account. + */ +export type BankAccountType = "CHECKING" | "SAVINGS" | "INVESTMENT" | "OTHER" | "BUSINESS_CHECKING"; +export const BankAccountType = { + Checking: "CHECKING", + Savings: "SAVINGS", + Investment: "INVESTMENT", + Other: "OTHER", + BusinessChecking: "BUSINESS_CHECKING", +} as const; diff --git a/src/api/types/BatchChangeInventoryRequest.ts b/src/api/types/BatchChangeInventoryRequest.ts new file mode 100644 index 000000000..1399ddc0d --- /dev/null +++ b/src/api/types/BatchChangeInventoryRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchChangeInventoryRequest { + /** + * A client-supplied, universally unique identifier (UUID) for the + * request. + * + * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the + * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more + * information. + */ + idempotencyKey: string; + /** + * The set of physical counts and inventory adjustments to be made. + * Changes are applied based on the client-supplied timestamp and may be sent + * out of order. + */ + changes?: Square.InventoryChange[] | null; + /** + * Indicates whether the current physical count should be ignored if + * the quantity is unchanged since the last physical count. Default: `true`. + */ + ignoreUnchangedCounts?: boolean | null; +} diff --git a/src/api/types/BatchChangeInventoryResponse.ts b/src/api/types/BatchChangeInventoryResponse.ts new file mode 100644 index 000000000..cbda27c7c --- /dev/null +++ b/src/api/types/BatchChangeInventoryResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchChangeInventoryResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The current counts for all objects referenced in the request. */ + counts?: Square.InventoryCount[]; + /** Changes created for the request. */ + changes?: Square.InventoryChange[]; +} diff --git a/src/api/types/BatchCreateTeamMembersResponse.ts b/src/api/types/BatchCreateTeamMembersResponse.ts new file mode 100644 index 000000000..cdcb977b4 --- /dev/null +++ b/src/api/types/BatchCreateTeamMembersResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a bulk create request containing the created `TeamMember` objects or error messages. + */ +export interface BatchCreateTeamMembersResponse { + /** The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. */ + teamMembers?: Record; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BatchCreateVendorsResponse.ts b/src/api/types/BatchCreateVendorsResponse.ts new file mode 100644 index 000000000..80ac755e2 --- /dev/null +++ b/src/api/types/BatchCreateVendorsResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an output from a call to [BulkCreateVendors](api-endpoint:Vendors-BulkCreateVendors). + */ +export interface BatchCreateVendorsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * A set of [CreateVendorResponse](entity:CreateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor) + * objects or error responses for failed attempts. The set is represented by + * a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The idempotency keys correspond to those specified + * in the input. + */ + responses?: Record; +} diff --git a/src/api/types/BatchDeleteCatalogObjectsResponse.ts b/src/api/types/BatchDeleteCatalogObjectsResponse.ts new file mode 100644 index 000000000..18104eca4 --- /dev/null +++ b/src/api/types/BatchDeleteCatalogObjectsResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchDeleteCatalogObjectsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The IDs of all CatalogObjects deleted by this request. */ + deletedObjectIds?: string[]; + /** The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this deletion in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". */ + deletedAt?: string; +} diff --git a/src/api/types/BatchGetCatalogObjectsResponse.ts b/src/api/types/BatchGetCatalogObjectsResponse.ts new file mode 100644 index 000000000..55ec80255 --- /dev/null +++ b/src/api/types/BatchGetCatalogObjectsResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchGetCatalogObjectsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** A list of [CatalogObject](entity:CatalogObject)s returned. */ + objects?: Square.CatalogObject[]; + /** A list of [CatalogObject](entity:CatalogObject)s referenced by the object in the `objects` field. */ + relatedObjects?: Square.CatalogObject[]; +} diff --git a/src/api/types/BatchGetInventoryChangesResponse.ts b/src/api/types/BatchGetInventoryChangesResponse.ts new file mode 100644 index 000000000..9921d17fe --- /dev/null +++ b/src/api/types/BatchGetInventoryChangesResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchGetInventoryChangesResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The current calculated inventory changes for the requested objects + * and locations. + */ + changes?: Square.InventoryChange[]; + /** + * The pagination cursor to be used in a subsequent request. If unset, + * this is the final response. + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string; +} diff --git a/src/api/types/BatchGetInventoryCountsRequest.ts b/src/api/types/BatchGetInventoryCountsRequest.ts new file mode 100644 index 000000000..2a606e459 --- /dev/null +++ b/src/api/types/BatchGetInventoryCountsRequest.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchGetInventoryCountsRequest { + /** + * The filter to return results by `CatalogObject` ID. + * The filter is applicable only when set. The default is null. + */ + catalogObjectIds?: string[] | null; + /** + * The filter to return results by `Location` ID. + * This filter is applicable only when set. The default is null. + */ + locationIds?: string[] | null; + /** + * The filter to return results with their `calculated_at` value + * after the given time as specified in an RFC 3339 timestamp. + * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). + */ + updatedAfter?: string | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for the original query. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string | null; + /** + * The filter to return results by `InventoryState`. The filter is only applicable when set. + * Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`. + * The default is null. + */ + states?: Square.InventoryState[] | null; + /** The number of [records](entity:InventoryCount) to return. */ + limit?: number | null; +} diff --git a/src/api/types/BatchGetInventoryCountsResponse.ts b/src/api/types/BatchGetInventoryCountsResponse.ts new file mode 100644 index 000000000..3f436778a --- /dev/null +++ b/src/api/types/BatchGetInventoryCountsResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchGetInventoryCountsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The current calculated inventory counts for the requested objects + * and locations. + */ + counts?: Square.InventoryCount[]; + /** + * The pagination cursor to be used in a subsequent request. If unset, + * this is the final response. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string; +} diff --git a/src/api/types/BatchGetOrdersResponse.ts b/src/api/types/BatchGetOrdersResponse.ts new file mode 100644 index 000000000..82b088f50 --- /dev/null +++ b/src/api/types/BatchGetOrdersResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `BatchRetrieveOrders` endpoint. + */ +export interface BatchGetOrdersResponse { + /** The requested orders. This will omit any requested orders that do not exist. */ + orders?: Square.Order[]; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BatchGetVendorsResponse.ts b/src/api/types/BatchGetVendorsResponse.ts new file mode 100644 index 000000000..3c3cb05d1 --- /dev/null +++ b/src/api/types/BatchGetVendorsResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an output from a call to [BulkRetrieveVendors](api-endpoint:Vendors-BulkRetrieveVendors). + */ +export interface BatchGetVendorsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The set of [RetrieveVendorResponse](entity:RetrieveVendorResponse) objects encapsulating successfully retrieved [Vendor](entity:Vendor) + * objects or error responses for failed attempts. The set is represented by + * a collection of `Vendor`-ID/`Vendor`-object or `Vendor`-ID/error-object pairs. + */ + responses?: Record; +} diff --git a/src/api/types/BatchRetrieveInventoryChangesRequest.ts b/src/api/types/BatchRetrieveInventoryChangesRequest.ts new file mode 100644 index 000000000..66c6c1cb7 --- /dev/null +++ b/src/api/types/BatchRetrieveInventoryChangesRequest.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchRetrieveInventoryChangesRequest { + /** + * The filter to return results by `CatalogObject` ID. + * The filter is only applicable when set. The default value is null. + */ + catalogObjectIds?: string[] | null; + /** + * The filter to return results by `Location` ID. + * The filter is only applicable when set. The default value is null. + */ + locationIds?: string[] | null; + /** + * The filter to return results by `InventoryChangeType` values other than `TRANSFER`. + * The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. + */ + types?: Square.InventoryChangeType[] | null; + /** + * The filter to return `ADJUSTMENT` query results by + * `InventoryState`. This filter is only applied when set. + * The default value is null. + */ + states?: Square.InventoryState[] | null; + /** + * The filter to return results with their `calculated_at` value + * after the given time as specified in an RFC 3339 timestamp. + * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). + */ + updatedAfter?: string | null; + /** + * The filter to return results with their `created_at` or `calculated_at` value + * strictly before the given time as specified in an RFC 3339 timestamp. + * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). + */ + updatedBefore?: string | null; + /** + * A pagination cursor returned by a previous call to this endpoint. + * Provide this to retrieve the next set of results for the original query. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string | null; + /** The number of [records](entity:InventoryChange) to return. */ + limit?: number | null; +} diff --git a/src/api/types/BatchUpdateTeamMembersResponse.ts b/src/api/types/BatchUpdateTeamMembersResponse.ts new file mode 100644 index 000000000..c3b6d9cb7 --- /dev/null +++ b/src/api/types/BatchUpdateTeamMembersResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a bulk update request containing the updated `TeamMember` objects or error messages. + */ +export interface BatchUpdateTeamMembersResponse { + /** The successfully updated `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. */ + teamMembers?: Record; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BatchUpdateVendorsResponse.ts b/src/api/types/BatchUpdateVendorsResponse.ts new file mode 100644 index 000000000..e9e88cd75 --- /dev/null +++ b/src/api/types/BatchUpdateVendorsResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an output from a call to [BulkUpdateVendors](api-endpoint:Vendors-BulkUpdateVendors). + */ +export interface BatchUpdateVendorsResponse { + /** Errors encountered when the request fails. */ + errors?: Square.Error_[]; + /** + * A set of [UpdateVendorResponse](entity:UpdateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor) + * objects or error responses for failed attempts. The set is represented by a collection of `Vendor`-ID/`UpdateVendorResponse`-object or + * `Vendor`-ID/error-object pairs. + */ + responses?: Record; +} diff --git a/src/api/types/BatchUpsertCatalogObjectsResponse.ts b/src/api/types/BatchUpsertCatalogObjectsResponse.ts new file mode 100644 index 000000000..96bb78280 --- /dev/null +++ b/src/api/types/BatchUpsertCatalogObjectsResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface BatchUpsertCatalogObjectsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The created successfully created CatalogObjects. */ + objects?: Square.CatalogObject[]; + /** The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". */ + updatedAt?: string; + /** The mapping between client and server IDs for this upsert. */ + idMappings?: Square.CatalogIdMapping[]; +} diff --git a/src/api/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts b/src/api/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts new file mode 100644 index 000000000..ee0132735 --- /dev/null +++ b/src/api/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) + * request. An individual request contains a customer ID, the custom attribute to create or update, + * and an optional idempotency key. + */ +export interface BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest { + /** The ID of the target [customer profile](entity:Customer). */ + customerId: string; + /** + * The custom attribute to create or update, with following fields: + * + * - `key`. This key must match the `key` of a custom attribute definition in the Square seller + * account. If the requesting application is not the definition owner, you must provide the qualified key. + * + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types). + * + * - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control for update operations, include this optional field in the request and set the + * value to the current version of the custom attribute. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this individual upsert request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/types/BatchUpsertCustomerCustomAttributesResponse.ts b/src/api/types/BatchUpsertCustomerCustomAttributesResponse.ts new file mode 100644 index 000000000..800dbb96e --- /dev/null +++ b/src/api/types/BatchUpsertCustomerCustomAttributesResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) response, + * which contains a map of responses that each corresponds to an individual upsert request. + */ +export interface BatchUpsertCustomerCustomAttributesResponse { + /** + * A map of responses that correspond to individual upsert requests. Each response has the + * same ID as the corresponding request and contains either a `customer_id` and `custom_attribute` or an `errors` field. + */ + values?: Record; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts b/src/api/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts new file mode 100644 index 000000000..3436be474 --- /dev/null +++ b/src/api/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) operation. + */ +export interface BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse { + /** The ID of the customer profile associated with the custom attribute. */ + customerId?: string; + /** The new or updated custom attribute. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred while processing the individual request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/Booking.ts b/src/api/types/Booking.ts new file mode 100644 index 000000000..c861453d3 --- /dev/null +++ b/src/api/types/Booking.ts @@ -0,0 +1,62 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service + * at a given location to a requesting customer in one or more appointment segments. + */ +export interface Booking { + /** A unique ID of this object representing a booking. */ + id?: string; + /** The revision number for the booking used for optimistic concurrency. */ + version?: number; + /** + * The status of the booking, describing where the booking stands with respect to the booking state machine. + * See [BookingStatus](#type-bookingstatus) for possible values + */ + status?: Square.BookingStatus; + /** The RFC 3339 timestamp specifying the creation time of this booking. */ + createdAt?: string; + /** The RFC 3339 timestamp specifying the most recent update time of this booking. */ + updatedAt?: string; + /** The RFC 3339 timestamp specifying the starting time of this booking. */ + startAt?: string | null; + /** The ID of the [Location](entity:Location) object representing the location where the booked service is provided. Once set when the booking is created, its value cannot be changed. */ + locationId?: string | null; + /** The ID of the [Customer](entity:Customer) object representing the customer receiving the booked service. */ + customerId?: string | null; + /** The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](entity:CatalogObject) instance. */ + customerNote?: string | null; + /** + * The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](entity:CatalogObject) instance. + * This field should not be visible to customers. + */ + sellerNote?: string | null; + /** A list of appointment segments for this booking. */ + appointmentSegments?: Square.AppointmentSegment[] | null; + /** + * Additional time at the end of a booking. + * Applications should not make this field visible to customers of a seller. + */ + transitionTimeMinutes?: number; + /** Whether the booking is of a full business day. */ + allDay?: boolean; + /** + * The type of location where the booking is held. + * See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values + */ + locationType?: Square.BusinessAppointmentSettingsBookingLocationType; + /** Information about the booking creator. */ + creatorDetails?: Square.BookingCreatorDetails; + /** + * The source of the booking. + * Access to this field requires seller-level permissions. + * See [BookingBookingSource](#type-bookingbookingsource) for possible values + */ + source?: Square.BookingBookingSource; + /** Stores a customer address if the location type is `CUSTOMER_LOCATION`. */ + address?: Square.Address; +} diff --git a/src/api/types/BookingBookingSource.ts b/src/api/types/BookingBookingSource.ts new file mode 100644 index 000000000..6b7febd37 --- /dev/null +++ b/src/api/types/BookingBookingSource.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported sources a booking was created from. + */ +export type BookingBookingSource = "FIRST_PARTY_MERCHANT" | "FIRST_PARTY_BUYER" | "THIRD_PARTY_BUYER" | "API"; +export const BookingBookingSource = { + FirstPartyMerchant: "FIRST_PARTY_MERCHANT", + FirstPartyBuyer: "FIRST_PARTY_BUYER", + ThirdPartyBuyer: "THIRD_PARTY_BUYER", + Api: "API", +} as const; diff --git a/src/api/types/BookingCreatorDetails.ts b/src/api/types/BookingCreatorDetails.ts new file mode 100644 index 000000000..95337d4ca --- /dev/null +++ b/src/api/types/BookingCreatorDetails.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Information about a booking creator. + */ +export interface BookingCreatorDetails { + /** + * The seller-accessible type of the creator of the booking. + * See [BookingCreatorDetailsCreatorType](#type-bookingcreatordetailscreatortype) for possible values + */ + creatorType?: Square.BookingCreatorDetailsCreatorType; + /** + * The ID of the team member who created the booking, when the booking creator is of the `TEAM_MEMBER` type. + * Access to this field requires seller-level permissions. + */ + teamMemberId?: string; + /** + * The ID of the customer who created the booking, when the booking creator is of the `CUSTOMER` type. + * Access to this field requires seller-level permissions. + */ + customerId?: string; +} diff --git a/src/api/types/BookingCreatorDetailsCreatorType.ts b/src/api/types/BookingCreatorDetailsCreatorType.ts new file mode 100644 index 000000000..75b0061c9 --- /dev/null +++ b/src/api/types/BookingCreatorDetailsCreatorType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported types of a booking creator. + */ +export type BookingCreatorDetailsCreatorType = "TEAM_MEMBER" | "CUSTOMER"; +export const BookingCreatorDetailsCreatorType = { + TeamMember: "TEAM_MEMBER", + Customer: "CUSTOMER", +} as const; diff --git a/src/api/types/BookingCustomAttributeDeleteRequest.ts b/src/api/types/BookingCustomAttributeDeleteRequest.ts new file mode 100644 index 000000000..216588d1b --- /dev/null +++ b/src/api/types/BookingCustomAttributeDeleteRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents an individual delete request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) + * request. An individual request contains a booking ID, the custom attribute to delete, and an optional idempotency key. + */ +export interface BookingCustomAttributeDeleteRequest { + /** The ID of the target [booking](entity:Booking). */ + bookingId: string; + /** + * The key of the custom attribute to delete. This key must match the `key` of a + * custom attribute definition in the Square seller account. If the requesting application is not + * the definition owner, you must use the qualified key. + */ + key: string; +} diff --git a/src/api/types/BookingCustomAttributeDeleteResponse.ts b/src/api/types/BookingCustomAttributeDeleteResponse.ts new file mode 100644 index 000000000..fd2712f24 --- /dev/null +++ b/src/api/types/BookingCustomAttributeDeleteResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response for an individual upsert request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) operation. + */ +export interface BookingCustomAttributeDeleteResponse { + /** The ID of the [booking](entity:Booking) associated with the custom attribute. */ + bookingId?: string; + /** Any errors that occurred while processing the individual request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BookingCustomAttributeUpsertRequest.ts b/src/api/types/BookingCustomAttributeUpsertRequest.ts new file mode 100644 index 000000000..1635a8103 --- /dev/null +++ b/src/api/types/BookingCustomAttributeUpsertRequest.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) + * request. An individual request contains a booking ID, the custom attribute to create or update, + * and an optional idempotency key. + */ +export interface BookingCustomAttributeUpsertRequest { + /** The ID of the target [booking](entity:Booking). */ + bookingId: string; + /** + * The custom attribute to create or update, with following fields: + * + * - `key`. This key must match the `key` of a custom attribute definition in the Square seller + * account. If the requesting application is not the definition owner, you must provide the qualified key. + * + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Value data types](https://developer.squareup.com/docs/booking-custom-attributes-api/custom-attributes#value-data-types). + * + * - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control for update operations, include this optional field in the request and set the + * value to the current version of the custom attribute. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this individual upsert request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/types/BookingCustomAttributeUpsertResponse.ts b/src/api/types/BookingCustomAttributeUpsertResponse.ts new file mode 100644 index 000000000..bcd008f99 --- /dev/null +++ b/src/api/types/BookingCustomAttributeUpsertResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response for an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) operation. + */ +export interface BookingCustomAttributeUpsertResponse { + /** The ID of the [booking](entity:Booking) associated with the custom attribute. */ + bookingId?: string; + /** The new or updated custom attribute. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred while processing the individual request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BookingStatus.ts b/src/api/types/BookingStatus.ts new file mode 100644 index 000000000..fd41bf0d3 --- /dev/null +++ b/src/api/types/BookingStatus.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported booking statuses. + */ +export type BookingStatus = + | "PENDING" + | "CANCELLED_BY_CUSTOMER" + | "CANCELLED_BY_SELLER" + | "DECLINED" + | "ACCEPTED" + | "NO_SHOW"; +export const BookingStatus = { + Pending: "PENDING", + CancelledByCustomer: "CANCELLED_BY_CUSTOMER", + CancelledBySeller: "CANCELLED_BY_SELLER", + Declined: "DECLINED", + Accepted: "ACCEPTED", + NoShow: "NO_SHOW", +} as const; diff --git a/src/api/types/Break.ts b/src/api/types/Break.ts new file mode 100644 index 000000000..78ee9df66 --- /dev/null +++ b/src/api/types/Break.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A record of an employee's break during a shift. + */ +export interface Break { + /** The UUID for this object. */ + id?: string; + /** + * RFC 3339; follows the same timezone information as `Shift`. Precision up to + * the minute is respected; seconds are truncated. + */ + startAt: string; + /** + * RFC 3339; follows the same timezone information as `Shift`. Precision up to + * the minute is respected; seconds are truncated. + */ + endAt?: string | null; + /** The `BreakType` that this `Break` was templated on. */ + breakTypeId: string; + /** A human-readable name. */ + name: string; + /** + * Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of + * the break. + */ + expectedDuration: string; + /** + * Whether this break counts towards time worked for compensation + * purposes. + */ + isPaid: boolean; +} diff --git a/src/api/types/BreakType.ts b/src/api/types/BreakType.ts new file mode 100644 index 000000000..80f21a50c --- /dev/null +++ b/src/api/types/BreakType.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A defined break template that sets an expectation for possible `Break` + * instances on a `Shift`. + */ +export interface BreakType { + /** The UUID for this object. */ + id?: string; + /** The ID of the business location this type of break applies to. */ + locationId: string; + /** + * A human-readable name for this type of break. The name is displayed to + * employees in Square products. + */ + breakName: string; + /** + * Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of + * this break. Precision less than minutes is truncated. + * + * Example for break expected duration of 15 minutes: T15M + */ + expectedDuration: string; + /** + * Whether this break counts towards time worked for compensation + * purposes. + */ + isPaid: boolean; + /** + * Used for resolving concurrency issues. The request fails if the version + * provided does not match the server version at the time of the request. If a value is not + * provided, Square's servers execute a "blind" write; potentially + * overwriting another writer's data. + */ + version?: number; + /** A read-only timestamp in RFC 3339 format. */ + createdAt?: string; + /** A read-only timestamp in RFC 3339 format. */ + updatedAt?: string; +} diff --git a/src/api/types/BulkCreateCustomerData.ts b/src/api/types/BulkCreateCustomerData.ts new file mode 100644 index 000000000..855023880 --- /dev/null +++ b/src/api/types/BulkCreateCustomerData.ts @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the customer data provided in individual create requests for a + * [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) operation. + */ +export interface BulkCreateCustomerData { + /** The given name (that is, the first name) associated with the customer profile. */ + givenName?: string | null; + /** The family name (that is, the last name) associated with the customer profile. */ + familyName?: string | null; + /** A business name associated with the customer profile. */ + companyName?: string | null; + /** A nickname for the customer profile. */ + nickname?: string | null; + /** The email address associated with the customer profile. */ + emailAddress?: string | null; + /** + * The physical address associated with the customer profile. For maximum length constraints, + * see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address). + * The `first_name` and `last_name` fields are ignored if they are present in the request. + */ + address?: Square.Address; + /** + * The phone number associated with the customer profile. The phone number must be valid + * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, + * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). + */ + phoneNumber?: string | null; + /** + * An optional second ID used to associate the customer profile with an + * entity in another system. + */ + referenceId?: string | null; + /** A custom note associated with the customer profile. */ + note?: string | null; + /** + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. + * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. + * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or + * `0000` if a birth year is not specified. + */ + birthday?: string | null; + /** + * The tax ID associated with the customer profile. This field is available only for + * customers of sellers in EU countries or the United Kingdom. For more information, see + * [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). + */ + taxIds?: Square.CustomerTaxIds; +} diff --git a/src/api/types/BulkCreateCustomersResponse.ts b/src/api/types/BulkCreateCustomersResponse.ts new file mode 100644 index 000000000..e9c805cb1 --- /dev/null +++ b/src/api/types/BulkCreateCustomersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields included in the response body from the + * [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint. + */ +export interface BulkCreateCustomersResponse { + /** + * A map of responses that correspond to individual create requests, represented by + * key-value pairs. + * + * Each key is the idempotency key that was provided for a create request and each value + * is the corresponding response. + * If the request succeeds, the value is the new customer profile. + * If the request fails, the value contains any errors that occurred during the request. + */ + responses?: Record; + /** Any top-level errors that prevented the bulk operation from running. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkDeleteBookingCustomAttributesResponse.ts b/src/api/types/BulkDeleteBookingCustomAttributesResponse.ts new file mode 100644 index 000000000..74b016507 --- /dev/null +++ b/src/api/types/BulkDeleteBookingCustomAttributesResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) response, + * which contains a map of responses that each corresponds to an individual delete request. + */ +export interface BulkDeleteBookingCustomAttributesResponse { + /** + * A map of responses that correspond to individual delete requests. Each response has the + * same ID as the corresponding request and contains `booking_id` and `errors` field. + */ + values?: Record; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkDeleteCustomersResponse.ts b/src/api/types/BulkDeleteCustomersResponse.ts new file mode 100644 index 000000000..85c1433f0 --- /dev/null +++ b/src/api/types/BulkDeleteCustomersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields included in the response body from the + * [BulkDeleteCustomers](api-endpoint:Customers-BulkDeleteCustomers) endpoint. + */ +export interface BulkDeleteCustomersResponse { + /** + * A map of responses that correspond to individual delete requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for a delete request and each value + * is the corresponding response. + * If the request succeeds, the value is an empty object (`{ }`). + * If the request fails, the value contains any errors that occurred during the request. + */ + responses?: Record; + /** Any top-level errors that prevented the bulk operation from running. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts b/src/api/types/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts new file mode 100644 index 000000000..371975d53 --- /dev/null +++ b/src/api/types/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents an individual delete request in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) + * request. An individual request contains an optional ID of the associated custom attribute definition + * and optional key of the associated custom attribute definition. + */ +export interface BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest { + /** + * The key of the associated custom attribute definition. + * Represented as a qualified key if the requesting app is not the definition owner. + */ + key?: string; +} diff --git a/src/api/types/BulkDeleteLocationCustomAttributesResponse.ts b/src/api/types/BulkDeleteLocationCustomAttributesResponse.ts new file mode 100644 index 000000000..468fdcc14 --- /dev/null +++ b/src/api/types/BulkDeleteLocationCustomAttributesResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) response, + * which contains a map of responses that each corresponds to an individual delete request. + */ +export interface BulkDeleteLocationCustomAttributesResponse { + /** + * A map of responses that correspond to individual delete requests. Each response has the + * same key as the corresponding request. + */ + values: Record; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts b/src/api/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts new file mode 100644 index 000000000..66e4519b1 --- /dev/null +++ b/src/api/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an individual delete response in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) + * request. + */ +export interface BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse { + /** The ID of the location associated with the custom attribute. */ + locationId?: string; + /** Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts b/src/api/types/BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts new file mode 100644 index 000000000..1a31ee29f --- /dev/null +++ b/src/api/types/BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents an individual delete request in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) + * request. An individual request contains an optional ID of the associated custom attribute definition + * and optional key of the associated custom attribute definition. + */ +export interface BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest { + /** + * The key of the associated custom attribute definition. + * Represented as a qualified key if the requesting app is not the definition owner. + */ + key?: string; +} diff --git a/src/api/types/BulkDeleteMerchantCustomAttributesResponse.ts b/src/api/types/BulkDeleteMerchantCustomAttributesResponse.ts new file mode 100644 index 000000000..226851e80 --- /dev/null +++ b/src/api/types/BulkDeleteMerchantCustomAttributesResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) response, + * which contains a map of responses that each corresponds to an individual delete request. + */ +export interface BulkDeleteMerchantCustomAttributesResponse { + /** + * A map of responses that correspond to individual delete requests. Each response has the + * same key as the corresponding request. + */ + values: Record; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts b/src/api/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts new file mode 100644 index 000000000..e2d3355fe --- /dev/null +++ b/src/api/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) + * request. + */ +export interface BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse { + /** Errors that occurred while processing the individual MerchantCustomAttributeDeleteRequest request */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts b/src/api/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts new file mode 100644 index 000000000..ac779af87 --- /dev/null +++ b/src/api/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents one delete within the bulk operation. + */ +export interface BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute { + /** + * The key of the custom attribute to delete. This key must match the key + * of an existing custom attribute definition. + */ + key?: string; + /** The ID of the target [order](entity:Order). */ + orderId: string; +} diff --git a/src/api/types/BulkDeleteOrderCustomAttributesResponse.ts b/src/api/types/BulkDeleteOrderCustomAttributesResponse.ts new file mode 100644 index 000000000..c163ac122 --- /dev/null +++ b/src/api/types/BulkDeleteOrderCustomAttributesResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from deleting one or more order custom attributes. + */ +export interface BulkDeleteOrderCustomAttributesResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * A map of responses that correspond to individual delete requests. Each response has the same ID + * as the corresponding request and contains either a `custom_attribute` or an `errors` field. + */ + values: Record; +} diff --git a/src/api/types/BulkRetrieveBookingsResponse.ts b/src/api/types/BulkRetrieveBookingsResponse.ts new file mode 100644 index 000000000..5f852656a --- /dev/null +++ b/src/api/types/BulkRetrieveBookingsResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response payload for bulk retrieval of bookings. + */ +export interface BulkRetrieveBookingsResponse { + /** Requested bookings returned as a map containing `booking_id` as the key and `RetrieveBookingResponse` as the value. */ + bookings?: Record; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkRetrieveCustomersResponse.ts b/src/api/types/BulkRetrieveCustomersResponse.ts new file mode 100644 index 000000000..3fb4abeca --- /dev/null +++ b/src/api/types/BulkRetrieveCustomersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields included in the response body from the + * [BulkRetrieveCustomers](api-endpoint:Customers-BulkRetrieveCustomers) endpoint. + */ +export interface BulkRetrieveCustomersResponse { + /** + * A map of responses that correspond to individual retrieve requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for a retrieve request and each value + * is the corresponding response. + * If the request succeeds, the value is the requested customer profile. + * If the request fails, the value contains any errors that occurred during the request. + */ + responses?: Record; + /** Any top-level errors that prevented the bulk operation from running. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts b/src/api/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts new file mode 100644 index 000000000..0b7f776e2 --- /dev/null +++ b/src/api/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response payload for the [BulkRetrieveTeamMemberBookingProfiles](api-endpoint:Bookings-BulkRetrieveTeamMemberBookingProfiles) endpoint. + */ +export interface BulkRetrieveTeamMemberBookingProfilesResponse { + /** The returned team members' booking profiles, as a map with `team_member_id` as the key and [TeamMemberBookingProfile](entity:TeamMemberBookingProfile) the value. */ + teamMemberBookingProfiles?: Record; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkSwapPlanResponse.ts b/src/api/types/BulkSwapPlanResponse.ts new file mode 100644 index 000000000..6dcd1f10c --- /dev/null +++ b/src/api/types/BulkSwapPlanResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response of the + * [BulkSwapPlan](api-endpoint:Subscriptions-BulkSwapPlan) endpoint. + */ +export interface BulkSwapPlanResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The number of affected subscriptions. */ + affectedSubscriptions?: number; +} diff --git a/src/api/types/BulkUpdateCustomerData.ts b/src/api/types/BulkUpdateCustomerData.ts new file mode 100644 index 000000000..64c458abb --- /dev/null +++ b/src/api/types/BulkUpdateCustomerData.ts @@ -0,0 +1,62 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the customer data provided in individual update requests for a + * [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) operation. + */ +export interface BulkUpdateCustomerData { + /** The given name (that is, the first name) associated with the customer profile. */ + givenName?: string | null; + /** The family name (that is, the last name) associated with the customer profile. */ + familyName?: string | null; + /** A business name associated with the customer profile. */ + companyName?: string | null; + /** A nickname for the customer profile. */ + nickname?: string | null; + /** The email address associated with the customer profile. */ + emailAddress?: string | null; + /** + * The physical address associated with the customer profile. For maximum length constraints, + * see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address). + * The `first_name` and `last_name` fields are ignored if they are present in the request. + */ + address?: Square.Address; + /** + * The phone number associated with the customer profile. The phone number must be valid + * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, + * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). + */ + phoneNumber?: string | null; + /** + * An optional second ID used to associate the customer profile with an + * entity in another system. + */ + referenceId?: string | null; + /** An custom note associates with the customer profile. */ + note?: string | null; + /** + * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. + * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. + * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or + * `0000` if a birth year is not specified. + */ + birthday?: string | null; + /** + * The tax ID associated with the customer profile. This field is available only for + * customers of sellers in EU countries or the United Kingdom. For more information, see + * [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). + */ + taxIds?: Square.CustomerTaxIds; + /** + * The current version of the customer profile. + * + * As a best practice, you should include this field to enable + * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control. + */ + version?: bigint; +} diff --git a/src/api/types/BulkUpdateCustomersResponse.ts b/src/api/types/BulkUpdateCustomersResponse.ts new file mode 100644 index 000000000..484c88cd0 --- /dev/null +++ b/src/api/types/BulkUpdateCustomersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields included in the response body from the + * [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint. + */ +export interface BulkUpdateCustomersResponse { + /** + * A map of responses that correspond to individual update requests, represented by + * key-value pairs. + * + * Each key is the customer ID that was specified for an update request and each value + * is the corresponding response. + * If the request succeeds, the value is the updated customer profile. + * If the request fails, the value contains any errors that occurred during the request. + */ + responses?: Record; + /** Any top-level errors that prevented the bulk operation from running. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkUpsertBookingCustomAttributesResponse.ts b/src/api/types/BulkUpsertBookingCustomAttributesResponse.ts new file mode 100644 index 000000000..9a7bd6c32 --- /dev/null +++ b/src/api/types/BulkUpsertBookingCustomAttributesResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) response, + * which contains a map of responses that each corresponds to an individual upsert request. + */ +export interface BulkUpsertBookingCustomAttributesResponse { + /** + * A map of responses that correspond to individual upsert requests. Each response has the + * same ID as the corresponding request and contains either a `booking_id` and `custom_attribute` or an `errors` field. + */ + values?: Record; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts b/src/api/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts new file mode 100644 index 000000000..a41ba1c28 --- /dev/null +++ b/src/api/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) + * request. An individual request contains a location ID, the custom attribute to create or update, + * and an optional idempotency key. + */ +export interface BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest { + /** The ID of the target [location](entity:Location). */ + locationId: string; + /** + * The custom attribute to create or update, with following fields: + * - `key`. This key must match the `key` of a custom attribute definition in the Square seller + * account. If the requesting application is not the definition owner, you must provide the qualified key. + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types).. + * - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control, specify the current version of the custom attribute. + * If this is not important for your application, `version` can be set to -1. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this individual upsert request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/types/BulkUpsertLocationCustomAttributesResponse.ts b/src/api/types/BulkUpsertLocationCustomAttributesResponse.ts new file mode 100644 index 000000000..f32c5792c --- /dev/null +++ b/src/api/types/BulkUpsertLocationCustomAttributesResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) response, + * which contains a map of responses that each corresponds to an individual upsert request. + */ +export interface BulkUpsertLocationCustomAttributesResponse { + /** + * A map of responses that correspond to individual upsert requests. Each response has the + * same ID as the corresponding request and contains either a `location_id` and `custom_attribute` or an `errors` field. + */ + values?: Record; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts b/src/api/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts new file mode 100644 index 000000000..29be7dcb1 --- /dev/null +++ b/src/api/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) operation. + */ +export interface BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse { + /** The ID of the location associated with the custom attribute. */ + locationId?: string; + /** The new or updated custom attribute. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred while processing the individual request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts b/src/api/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts new file mode 100644 index 000000000..83382ffe7 --- /dev/null +++ b/src/api/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) + * request. An individual request contains a merchant ID, the custom attribute to create or update, + * and an optional idempotency key. + */ +export interface BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest { + /** The ID of the target [merchant](entity:Merchant). */ + merchantId: string; + /** + * The custom attribute to create or update, with following fields: + * - `key`. This key must match the `key` of a custom attribute definition in the Square seller + * account. If the requesting application is not the definition owner, you must provide the qualified key. + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Supported data types](https://developer.squareup.com/docs/devtools/customattributes/overview#supported-data-types). + * - The version field must match the current version of the custom attribute definition to enable + * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * If this is not important for your application, version can be set to -1. For any other values, the request fails with a BAD_REQUEST error. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this individual upsert request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; +} diff --git a/src/api/types/BulkUpsertMerchantCustomAttributesResponse.ts b/src/api/types/BulkUpsertMerchantCustomAttributesResponse.ts new file mode 100644 index 000000000..6e6845881 --- /dev/null +++ b/src/api/types/BulkUpsertMerchantCustomAttributesResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) response, + * which contains a map of responses that each corresponds to an individual upsert request. + */ +export interface BulkUpsertMerchantCustomAttributesResponse { + /** + * A map of responses that correspond to individual upsert requests. Each response has the + * same ID as the corresponding request and contains either a `merchant_id` and `custom_attribute` or an `errors` field. + */ + values?: Record; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts b/src/api/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts new file mode 100644 index 000000000..50e9680b5 --- /dev/null +++ b/src/api/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response for an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) operation. + */ +export interface BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse { + /** The ID of the merchant associated with the custom attribute. */ + merchantId?: string; + /** The new or updated custom attribute. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred while processing the individual request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts b/src/api/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts new file mode 100644 index 000000000..acf829020 --- /dev/null +++ b/src/api/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents one upsert within the bulk operation. + */ +export interface BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute { + /** + * The custom attribute to create or update, with the following fields: + * + * - `value`. This value must conform to the `schema` specified by the definition. + * For more information, see [Value data types](https://developer.squareup.com/docs/customer-custom-attributes-api/custom-attributes#value-data-types). + * + * - `version`. To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) + * control, include this optional field and specify the current version of the custom attribute. + */ + customAttribute: Square.CustomAttribute; + /** + * A unique identifier for this request, used to ensure idempotency. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string | null; + /** The ID of the target [order](entity:Order). */ + orderId: string; +} diff --git a/src/api/types/BulkUpsertOrderCustomAttributesResponse.ts b/src/api/types/BulkUpsertOrderCustomAttributesResponse.ts new file mode 100644 index 000000000..2cccbde11 --- /dev/null +++ b/src/api/types/BulkUpsertOrderCustomAttributesResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a bulk upsert of order custom attributes. + */ +export interface BulkUpsertOrderCustomAttributesResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** A map of responses that correspond to individual upsert operations for custom attributes. */ + values: Record; +} diff --git a/src/api/types/BusinessAppointmentSettings.ts b/src/api/types/BusinessAppointmentSettings.ts new file mode 100644 index 000000000..f95139f7a --- /dev/null +++ b/src/api/types/BusinessAppointmentSettings.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The service appointment settings, including where and how the service is provided. + */ +export interface BusinessAppointmentSettings { + /** + * Types of the location allowed for bookings. + * See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values + */ + locationTypes?: Square.BusinessAppointmentSettingsBookingLocationType[] | null; + /** + * The time unit of the service duration for bookings. + * See [BusinessAppointmentSettingsAlignmentTime](#type-businessappointmentsettingsalignmenttime) for possible values + */ + alignmentTime?: Square.BusinessAppointmentSettingsAlignmentTime; + /** The minimum lead time in seconds before a service can be booked. A booking must be created at least this amount of time before its starting time. */ + minBookingLeadTimeSeconds?: number | null; + /** The maximum lead time in seconds before a service can be booked. A booking must be created at most this amount of time before its starting time. */ + maxBookingLeadTimeSeconds?: number | null; + /** + * Indicates whether a customer can choose from all available time slots and have a staff member assigned + * automatically (`true`) or not (`false`). + */ + anyTeamMemberBookingEnabled?: boolean | null; + /** Indicates whether a customer can book multiple services in a single online booking. */ + multipleServiceBookingEnabled?: boolean | null; + /** + * Indicates whether the daily appointment limit applies to team members or to + * business locations. + * See [BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType](#type-businessappointmentsettingsmaxappointmentsperdaylimittype) for possible values + */ + maxAppointmentsPerDayLimitType?: Square.BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType; + /** The maximum number of daily appointments per team member or per location. */ + maxAppointmentsPerDayLimit?: number | null; + /** The cut-off time in seconds for allowing clients to cancel or reschedule an appointment. */ + cancellationWindowSeconds?: number | null; + /** The flat-fee amount charged for a no-show booking. */ + cancellationFeeMoney?: Square.Money; + /** + * The cancellation policy adopted by the seller. + * See [BusinessAppointmentSettingsCancellationPolicy](#type-businessappointmentsettingscancellationpolicy) for possible values + */ + cancellationPolicy?: Square.BusinessAppointmentSettingsCancellationPolicy; + /** The free-form text of the seller's cancellation policy. */ + cancellationPolicyText?: string | null; + /** Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`). */ + skipBookingFlowStaffSelection?: boolean | null; +} diff --git a/src/api/types/BusinessAppointmentSettingsAlignmentTime.ts b/src/api/types/BusinessAppointmentSettingsAlignmentTime.ts new file mode 100644 index 000000000..9d9e410be --- /dev/null +++ b/src/api/types/BusinessAppointmentSettingsAlignmentTime.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Time units of a service duration for bookings. + */ +export type BusinessAppointmentSettingsAlignmentTime = "SERVICE_DURATION" | "QUARTER_HOURLY" | "HALF_HOURLY" | "HOURLY"; +export const BusinessAppointmentSettingsAlignmentTime = { + ServiceDuration: "SERVICE_DURATION", + QuarterHourly: "QUARTER_HOURLY", + HalfHourly: "HALF_HOURLY", + Hourly: "HOURLY", +} as const; diff --git a/src/api/types/BusinessAppointmentSettingsBookingLocationType.ts b/src/api/types/BusinessAppointmentSettingsBookingLocationType.ts new file mode 100644 index 000000000..101e1b5d7 --- /dev/null +++ b/src/api/types/BusinessAppointmentSettingsBookingLocationType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported types of location where service is provided. + */ +export type BusinessAppointmentSettingsBookingLocationType = "BUSINESS_LOCATION" | "CUSTOMER_LOCATION" | "PHONE"; +export const BusinessAppointmentSettingsBookingLocationType = { + BusinessLocation: "BUSINESS_LOCATION", + CustomerLocation: "CUSTOMER_LOCATION", + Phone: "PHONE", +} as const; diff --git a/src/api/types/BusinessAppointmentSettingsCancellationPolicy.ts b/src/api/types/BusinessAppointmentSettingsCancellationPolicy.ts new file mode 100644 index 000000000..d72b69834 --- /dev/null +++ b/src/api/types/BusinessAppointmentSettingsCancellationPolicy.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The category of the seller’s cancellation policy. + */ +export type BusinessAppointmentSettingsCancellationPolicy = "CANCELLATION_TREATED_AS_NO_SHOW" | "CUSTOM_POLICY"; +export const BusinessAppointmentSettingsCancellationPolicy = { + CancellationTreatedAsNoShow: "CANCELLATION_TREATED_AS_NO_SHOW", + CustomPolicy: "CUSTOM_POLICY", +} as const; diff --git a/src/api/types/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.ts b/src/api/types/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.ts new file mode 100644 index 000000000..2a915990d --- /dev/null +++ b/src/api/types/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Types of daily appointment limits. + */ +export type BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType = "PER_TEAM_MEMBER" | "PER_LOCATION"; +export const BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType = { + PerTeamMember: "PER_TEAM_MEMBER", + PerLocation: "PER_LOCATION", +} as const; diff --git a/src/api/types/BusinessBookingProfile.ts b/src/api/types/BusinessBookingProfile.ts new file mode 100644 index 000000000..f3ab7bd24 --- /dev/null +++ b/src/api/types/BusinessBookingProfile.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A seller's business booking profile, including booking policy, appointment settings, etc. + */ +export interface BusinessBookingProfile { + /** The ID of the seller, obtainable using the Merchants API. */ + sellerId?: string | null; + /** The RFC 3339 timestamp specifying the booking's creation time. */ + createdAt?: string; + /** Indicates whether the seller is open for booking. */ + bookingEnabled?: boolean | null; + /** + * The choice of customer's time zone information of a booking. + * The Square online booking site and all notifications to customers uses either the seller location’s time zone + * or the time zone the customer chooses at booking. + * See [BusinessBookingProfileCustomerTimezoneChoice](#type-businessbookingprofilecustomertimezonechoice) for possible values + */ + customerTimezoneChoice?: Square.BusinessBookingProfileCustomerTimezoneChoice; + /** + * The policy for the seller to automatically accept booking requests (`ACCEPT_ALL`) or not (`REQUIRES_ACCEPTANCE`). + * See [BusinessBookingProfileBookingPolicy](#type-businessbookingprofilebookingpolicy) for possible values + */ + bookingPolicy?: Square.BusinessBookingProfileBookingPolicy; + /** Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`). */ + allowUserCancel?: boolean | null; + /** Settings for appointment-type bookings. */ + businessAppointmentSettings?: Square.BusinessAppointmentSettings; + /** Indicates whether the seller's subscription to Square Appointments supports creating, updating or canceling an appointment through the API (`true`) or not (`false`) using seller permission. */ + supportSellerLevelWrites?: boolean | null; +} diff --git a/src/api/types/BusinessBookingProfileBookingPolicy.ts b/src/api/types/BusinessBookingProfileBookingPolicy.ts new file mode 100644 index 000000000..7159dc46e --- /dev/null +++ b/src/api/types/BusinessBookingProfileBookingPolicy.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Policies for accepting bookings. + */ +export type BusinessBookingProfileBookingPolicy = "ACCEPT_ALL" | "REQUIRES_ACCEPTANCE"; +export const BusinessBookingProfileBookingPolicy = { + AcceptAll: "ACCEPT_ALL", + RequiresAcceptance: "REQUIRES_ACCEPTANCE", +} as const; diff --git a/src/api/types/BusinessBookingProfileCustomerTimezoneChoice.ts b/src/api/types/BusinessBookingProfileCustomerTimezoneChoice.ts new file mode 100644 index 000000000..15500acd4 --- /dev/null +++ b/src/api/types/BusinessBookingProfileCustomerTimezoneChoice.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Choices of customer-facing time zone used for bookings. + */ +export type BusinessBookingProfileCustomerTimezoneChoice = "BUSINESS_LOCATION_TIMEZONE" | "CUSTOMER_CHOICE"; +export const BusinessBookingProfileCustomerTimezoneChoice = { + BusinessLocationTimezone: "BUSINESS_LOCATION_TIMEZONE", + CustomerChoice: "CUSTOMER_CHOICE", +} as const; diff --git a/src/api/types/BusinessHours.ts b/src/api/types/BusinessHours.ts new file mode 100644 index 000000000..5f2d1a5a5 --- /dev/null +++ b/src/api/types/BusinessHours.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The hours of operation for a location. + */ +export interface BusinessHours { + /** The list of time periods during which the business is open. There can be at most 10 periods per day. */ + periods?: Square.BusinessHoursPeriod[] | null; +} diff --git a/src/api/types/BusinessHoursPeriod.ts b/src/api/types/BusinessHoursPeriod.ts new file mode 100644 index 000000000..3391a95d4 --- /dev/null +++ b/src/api/types/BusinessHoursPeriod.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a period of time during which a business location is open. + */ +export interface BusinessHoursPeriod { + /** + * The day of the week for this time period. + * See [DayOfWeek](#type-dayofweek) for possible values + */ + dayOfWeek?: Square.DayOfWeek; + /** + * The start time of a business hours period, specified in local time using partial-time + * RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning. + * Note that the seconds value is always :00, but it is appended for conformance to the RFC. + */ + startLocalTime?: string | null; + /** + * The end time of a business hours period, specified in local time using partial-time + * RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening. + * Note that the seconds value is always :00, but it is appended for conformance to the RFC. + */ + endLocalTime?: string | null; +} diff --git a/src/api/types/BuyNowPayLaterDetails.ts b/src/api/types/BuyNowPayLaterDetails.ts new file mode 100644 index 000000000..74b151f09 --- /dev/null +++ b/src/api/types/BuyNowPayLaterDetails.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Additional details about a Buy Now Pay Later payment type. + */ +export interface BuyNowPayLaterDetails { + /** + * The brand used for the Buy Now Pay Later payment. + * The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`. + */ + brand?: string | null; + /** + * Details about an Afterpay payment. These details are only populated if the `brand` is + * `AFTERPAY`. + */ + afterpayDetails?: Square.AfterpayDetails; + /** + * Details about a Clearpay payment. These details are only populated if the `brand` is + * `CLEARPAY`. + */ + clearpayDetails?: Square.ClearpayDetails; +} diff --git a/src/api/types/CalculateLoyaltyPointsResponse.ts b/src/api/types/CalculateLoyaltyPointsResponse.ts new file mode 100644 index 000000000..e970b5d91 --- /dev/null +++ b/src/api/types/CalculateLoyaltyPointsResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) response. + */ +export interface CalculateLoyaltyPointsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The number of points that the buyer can earn from the base loyalty program. */ + points?: number; + /** + * The number of points that the buyer can earn from a loyalty promotion. To be eligible + * to earn promotion points, the purchase must first qualify for program points. When `order_id` + * is not provided in the request, this value is always 0. + */ + promotionPoints?: number; +} diff --git a/src/api/types/CalculateOrderResponse.ts b/src/api/types/CalculateOrderResponse.ts new file mode 100644 index 000000000..055766021 --- /dev/null +++ b/src/api/types/CalculateOrderResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CalculateOrderResponse { + /** The calculated version of the order provided in the request. */ + order?: Square.Order; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CancelBookingResponse.ts b/src/api/types/CancelBookingResponse.ts new file mode 100644 index 000000000..ccfb89b2c --- /dev/null +++ b/src/api/types/CancelBookingResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CancelBookingResponse { + /** The booking that was cancelled. */ + booking?: Square.Booking; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CancelInvoiceResponse.ts b/src/api/types/CancelInvoiceResponse.ts new file mode 100644 index 000000000..47bc03cca --- /dev/null +++ b/src/api/types/CancelInvoiceResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response returned by the `CancelInvoice` request. + */ +export interface CancelInvoiceResponse { + /** The canceled invoice. */ + invoice?: Square.Invoice; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CancelLoyaltyPromotionResponse.ts b/src/api/types/CancelLoyaltyPromotionResponse.ts new file mode 100644 index 000000000..720b5817c --- /dev/null +++ b/src/api/types/CancelLoyaltyPromotionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CancelLoyaltyPromotion](api-endpoint:Loyalty-CancelLoyaltyPromotion) response. + * Either `loyalty_promotion` or `errors` is present in the response. + */ +export interface CancelLoyaltyPromotionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The canceled loyalty promotion. */ + loyaltyPromotion?: Square.LoyaltyPromotion; +} diff --git a/src/api/types/CancelPaymentByIdempotencyKeyResponse.ts b/src/api/types/CancelPaymentByIdempotencyKeyResponse.ts new file mode 100644 index 000000000..8df4ee330 --- /dev/null +++ b/src/api/types/CancelPaymentByIdempotencyKeyResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by + * [CancelPaymentByIdempotencyKey](api-endpoint:Payments-CancelPaymentByIdempotencyKey). + * On success, `errors` is empty. + */ +export interface CancelPaymentByIdempotencyKeyResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CancelPaymentResponse.ts b/src/api/types/CancelPaymentResponse.ts new file mode 100644 index 000000000..de09f1426 --- /dev/null +++ b/src/api/types/CancelPaymentResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by [CancelPayment](api-endpoint:Payments-CancelPayment). + */ +export interface CancelPaymentResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The successfully canceled `Payment` object. */ + payment?: Square.Payment; +} diff --git a/src/api/types/CancelSubscriptionResponse.ts b/src/api/types/CancelSubscriptionResponse.ts new file mode 100644 index 000000000..96950aacf --- /dev/null +++ b/src/api/types/CancelSubscriptionResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response from the + * [CancelSubscription](api-endpoint:Subscriptions-CancelSubscription) endpoint. + */ +export interface CancelSubscriptionResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The specified subscription scheduled for cancellation according to the action created by the request. */ + subscription?: Square.Subscription; + /** A list of a single `CANCEL` action scheduled for the subscription. */ + actions?: Square.SubscriptionAction[]; +} diff --git a/src/api/types/CancelTerminalActionResponse.ts b/src/api/types/CancelTerminalActionResponse.ts new file mode 100644 index 000000000..1bae43a82 --- /dev/null +++ b/src/api/types/CancelTerminalActionResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CancelTerminalActionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The canceled `TerminalAction` */ + action?: Square.TerminalAction; +} diff --git a/src/api/types/CancelTerminalCheckoutResponse.ts b/src/api/types/CancelTerminalCheckoutResponse.ts new file mode 100644 index 000000000..280f22b90 --- /dev/null +++ b/src/api/types/CancelTerminalCheckoutResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CancelTerminalCheckoutResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The canceled `TerminalCheckout`. */ + checkout?: Square.TerminalCheckout; +} diff --git a/src/api/types/CancelTerminalRefundResponse.ts b/src/api/types/CancelTerminalRefundResponse.ts new file mode 100644 index 000000000..5929fc431 --- /dev/null +++ b/src/api/types/CancelTerminalRefundResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CancelTerminalRefundResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The updated `TerminalRefund`. */ + refund?: Square.TerminalRefund; +} diff --git a/src/api/types/CaptureTransactionResponse.ts b/src/api/types/CaptureTransactionResponse.ts new file mode 100644 index 000000000..32224c29a --- /dev/null +++ b/src/api/types/CaptureTransactionResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [CaptureTransaction](api-endpoint:Transactions-CaptureTransaction) endpoint. + */ +export interface CaptureTransactionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/Card.ts b/src/api/types/Card.ts new file mode 100644 index 000000000..8e44de226 --- /dev/null +++ b/src/api/types/Card.ts @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the payment details of a card to be used for payments. These + * details are determined by the payment token generated by Web Payments SDK. + */ +export interface Card { + /** Unique ID for this card. Generated by Square. */ + id?: string; + /** + * The card's brand. + * See [CardBrand](#type-cardbrand) for possible values + */ + cardBrand?: Square.CardBrand; + /** The last 4 digits of the card number. */ + last4?: string; + /** The expiration month of the associated card as an integer between 1 and 12. */ + expMonth?: bigint | null; + /** The four-digit year of the card's expiration date. */ + expYear?: bigint | null; + /** The name of the cardholder. */ + cardholderName?: string | null; + /** The billing address for this card. */ + billingAddress?: Square.Address; + /** + * Intended as a Square-assigned identifier, based + * on the card number, to identify the card across multiple locations within a + * single application. + */ + fingerprint?: string; + /** **Required** The ID of a customer created using the Customers API to be associated with the card. */ + customerId?: string | null; + /** The ID of the merchant associated with the card. */ + merchantId?: string; + /** + * An optional user-defined reference ID that associates this card with + * another entity in an external system. For example, a customer ID from an + * external customer management system. + */ + referenceId?: string | null; + /** Indicates whether or not a card can be used for payments. */ + enabled?: boolean; + /** + * The type of the card. + * The Card object includes this field only in response to Payments API calls. + * See [CardType](#type-cardtype) for possible values + */ + cardType?: Square.CardType; + /** + * Indicates whether the Card is prepaid or not. + * The Card object includes this field only in response to Payments API calls. + * See [CardPrepaidType](#type-cardprepaidtype) for possible values + */ + prepaidType?: Square.CardPrepaidType; + /** + * The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API + * returns this field. + */ + bin?: string; + /** + * Current version number of the card. Increments with each card update. Requests to update an + * existing Card object will be rejected unless the version in the request matches the current + * version for the Card. + */ + version?: bigint; + /** + * The card's co-brand if available. For example, an Afterpay virtual card would have a + * co-brand of AFTERPAY. + * See [CardCoBrand](#type-cardcobrand) for possible values + */ + cardCoBrand?: Square.CardCoBrand; +} diff --git a/src/api/types/CardBrand.ts b/src/api/types/CardBrand.ts new file mode 100644 index 000000000..b30410ad7 --- /dev/null +++ b/src/api/types/CardBrand.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates a card's brand, such as `VISA` or `MASTERCARD`. + */ +export type CardBrand = + | "OTHER_BRAND" + | "VISA" + | "MASTERCARD" + | "AMERICAN_EXPRESS" + | "DISCOVER" + | "DISCOVER_DINERS" + | "JCB" + | "CHINA_UNIONPAY" + | "SQUARE_GIFT_CARD" + | "SQUARE_CAPITAL_CARD" + | "INTERAC" + | "EFTPOS" + | "FELICA" + | "EBT"; +export const CardBrand = { + OtherBrand: "OTHER_BRAND", + Visa: "VISA", + Mastercard: "MASTERCARD", + AmericanExpress: "AMERICAN_EXPRESS", + Discover: "DISCOVER", + DiscoverDiners: "DISCOVER_DINERS", + Jcb: "JCB", + ChinaUnionpay: "CHINA_UNIONPAY", + SquareGiftCard: "SQUARE_GIFT_CARD", + SquareCapitalCard: "SQUARE_CAPITAL_CARD", + Interac: "INTERAC", + Eftpos: "EFTPOS", + Felica: "FELICA", + Ebt: "EBT", +} as const; diff --git a/src/api/types/CardCoBrand.ts b/src/api/types/CardCoBrand.ts new file mode 100644 index 000000000..4a196be9a --- /dev/null +++ b/src/api/types/CardCoBrand.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the brand for a co-branded card. + */ +export type CardCoBrand = "UNKNOWN" | "AFTERPAY" | "CLEARPAY"; +export const CardCoBrand = { + Unknown: "UNKNOWN", + Afterpay: "AFTERPAY", + Clearpay: "CLEARPAY", +} as const; diff --git a/src/api/types/CardPaymentDetails.ts b/src/api/types/CardPaymentDetails.ts new file mode 100644 index 000000000..f0bdb9504 --- /dev/null +++ b/src/api/types/CardPaymentDetails.ts @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Reflects the current status of a card payment. Contains only non-confidential information. + */ +export interface CardPaymentDetails { + /** + * The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or + * FAILED. + */ + status?: string | null; + /** The credit card's non-confidential details. */ + card?: Square.Card; + /** + * The method used to enter the card's details for the payment. The method can be + * `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`. + */ + entryMethod?: string | null; + /** + * The status code returned from the Card Verification Value (CVV) check. The code can be + * `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`. + */ + cvvStatus?: string | null; + /** + * The status code returned from the Address Verification System (AVS) check. The code can be + * `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`. + */ + avsStatus?: string | null; + /** + * The status code returned by the card issuer that describes the payment's + * authorization status. + */ + authResultCode?: string | null; + /** For EMV payments, the application ID identifies the EMV application used for the payment. */ + applicationIdentifier?: string | null; + /** For EMV payments, the human-readable name of the EMV application used for the payment. */ + applicationName?: string | null; + /** For EMV payments, the cryptogram generated for the payment. */ + applicationCryptogram?: string | null; + /** + * For EMV payments, the method used to verify the cardholder's identity. The method can be + * `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`. + */ + verificationMethod?: string | null; + /** + * For EMV payments, the results of the cardholder verification. The result can be + * `SUCCESS`, `FAILURE`, or `UNKNOWN`. + */ + verificationResults?: string | null; + /** + * The statement description sent to the card networks. + * + * Note: The actual statement description varies and is likely to be truncated and appended with + * additional information on a per issuer basis. + */ + statementDescription?: string | null; + /** + * __Deprecated__: Use `Payment.device_details` instead. + * + * Details about the device that took the payment. + */ + deviceDetails?: Square.DeviceDetails; + /** The timeline for card payments. */ + cardPaymentTimeline?: Square.CardPaymentTimeline; + /** + * Whether the card must be physically present for the payment to + * be refunded. If set to `true`, the card must be present. + */ + refundRequiresCardPresence?: boolean | null; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[] | null; +} diff --git a/src/api/types/CardPaymentTimeline.ts b/src/api/types/CardPaymentTimeline.ts new file mode 100644 index 000000000..ceb53d0e4 --- /dev/null +++ b/src/api/types/CardPaymentTimeline.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The timeline for card payments. + */ +export interface CardPaymentTimeline { + /** The timestamp when the payment was authorized, in RFC 3339 format. */ + authorizedAt?: string | null; + /** The timestamp when the payment was captured, in RFC 3339 format. */ + capturedAt?: string | null; + /** The timestamp when the payment was voided, in RFC 3339 format. */ + voidedAt?: string | null; +} diff --git a/src/api/types/CardPrepaidType.ts b/src/api/types/CardPrepaidType.ts new file mode 100644 index 000000000..c20fff509 --- /dev/null +++ b/src/api/types/CardPrepaidType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates a card's prepaid type, such as `NOT_PREPAID` or `PREPAID`. + */ +export type CardPrepaidType = "UNKNOWN_PREPAID_TYPE" | "NOT_PREPAID" | "PREPAID"; +export const CardPrepaidType = { + UnknownPrepaidType: "UNKNOWN_PREPAID_TYPE", + NotPrepaid: "NOT_PREPAID", + Prepaid: "PREPAID", +} as const; diff --git a/src/api/types/CardType.ts b/src/api/types/CardType.ts new file mode 100644 index 000000000..b150f1ed1 --- /dev/null +++ b/src/api/types/CardType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates a card's type, such as `CREDIT` or `DEBIT`. + */ +export type CardType = "UNKNOWN_CARD_TYPE" | "CREDIT" | "DEBIT"; +export const CardType = { + UnknownCardType: "UNKNOWN_CARD_TYPE", + Credit: "CREDIT", + Debit: "DEBIT", +} as const; diff --git a/src/api/types/CashAppDetails.ts b/src/api/types/CashAppDetails.ts new file mode 100644 index 000000000..b1b2528b8 --- /dev/null +++ b/src/api/types/CashAppDetails.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Additional details about `WALLET` type payments with the `brand` of `CASH_APP`. + */ +export interface CashAppDetails { + /** The name of the Cash App account holder. */ + buyerFullName?: string | null; + /** + * The country of the Cash App account holder, in ISO 3166-1-alpha-2 format. + * + * For possible values, see [Country](entity:Country). + */ + buyerCountryCode?: string | null; + /** $Cashtag of the Cash App account holder. */ + buyerCashtag?: string; +} diff --git a/src/api/types/CashDrawerDevice.ts b/src/api/types/CashDrawerDevice.ts new file mode 100644 index 000000000..d3015226d --- /dev/null +++ b/src/api/types/CashDrawerDevice.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CashDrawerDevice { + /** The device Square-issued ID */ + id?: string; + /** The device merchant-specified name. */ + name?: string | null; +} diff --git a/src/api/types/CashDrawerEventType.ts b/src/api/types/CashDrawerEventType.ts new file mode 100644 index 000000000..21e07d00d --- /dev/null +++ b/src/api/types/CashDrawerEventType.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The types of events on a CashDrawerShift. + * Each event type represents an employee action on the actual cash drawer + * represented by a CashDrawerShift. + */ +export type CashDrawerEventType = + | "NO_SALE" + | "CASH_TENDER_PAYMENT" + | "OTHER_TENDER_PAYMENT" + | "CASH_TENDER_CANCELLED_PAYMENT" + | "OTHER_TENDER_CANCELLED_PAYMENT" + | "CASH_TENDER_REFUND" + | "OTHER_TENDER_REFUND" + | "PAID_IN" + | "PAID_OUT"; +export const CashDrawerEventType = { + NoSale: "NO_SALE", + CashTenderPayment: "CASH_TENDER_PAYMENT", + OtherTenderPayment: "OTHER_TENDER_PAYMENT", + CashTenderCancelledPayment: "CASH_TENDER_CANCELLED_PAYMENT", + OtherTenderCancelledPayment: "OTHER_TENDER_CANCELLED_PAYMENT", + CashTenderRefund: "CASH_TENDER_REFUND", + OtherTenderRefund: "OTHER_TENDER_REFUND", + PaidIn: "PAID_IN", + PaidOut: "PAID_OUT", +} as const; diff --git a/src/api/types/CashDrawerShift.ts b/src/api/types/CashDrawerShift.ts new file mode 100644 index 000000000..5d8254395 --- /dev/null +++ b/src/api/types/CashDrawerShift.ts @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * This model gives the details of a cash drawer shift. + * The cash_payment_money, cash_refund_money, cash_paid_in_money, + * and cash_paid_out_money fields are all computed by summing their respective + * event types. + */ +export interface CashDrawerShift { + /** The shift unique ID. */ + id?: string; + /** + * The shift current state. + * See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values + */ + state?: Square.CashDrawerShiftState; + /** The time when the shift began, in ISO 8601 format. */ + openedAt?: string | null; + /** The time when the shift ended, in ISO 8601 format. */ + endedAt?: string | null; + /** The time when the shift was closed, in ISO 8601 format. */ + closedAt?: string | null; + /** The free-form text description of a cash drawer by an employee. */ + description?: string | null; + /** + * The amount of money in the cash drawer at the start of the shift. + * The amount must be greater than or equal to zero. + */ + openedCashMoney?: Square.Money; + /** + * The amount of money added to the cash drawer from cash payments. + * This is computed by summing all events with the types CASH_TENDER_PAYMENT and + * CASH_TENDER_CANCELED_PAYMENT. The amount is always greater than or equal to + * zero. + */ + cashPaymentMoney?: Square.Money; + /** + * The amount of money removed from the cash drawer from cash refunds. + * It is computed by summing the events of type CASH_TENDER_REFUND. The amount + * is always greater than or equal to zero. + */ + cashRefundsMoney?: Square.Money; + /** + * The amount of money added to the cash drawer for reasons other than cash + * payments. It is computed by summing the events of type PAID_IN. The amount is + * always greater than or equal to zero. + */ + cashPaidInMoney?: Square.Money; + /** + * The amount of money removed from the cash drawer for reasons other than + * cash refunds. It is computed by summing the events of type PAID_OUT. The amount + * is always greater than or equal to zero. + */ + cashPaidOutMoney?: Square.Money; + /** + * The amount of money that should be in the cash drawer at the end of the + * shift, based on the shift's other money amounts. + * This can be negative if employees have not correctly recorded all the events + * on the cash drawer. + * cash_paid_out_money is a summation of amounts from cash_payment_money (zero + * or positive), cash_refunds_money (zero or negative), cash_paid_in_money (zero + * or positive), and cash_paid_out_money (zero or negative) event types. + */ + expectedCashMoney?: Square.Money; + /** + * The amount of money found in the cash drawer at the end of the shift + * by an auditing employee. The amount should be positive. + */ + closedCashMoney?: Square.Money; + /** The device running Square Point of Sale that was connected to the cash drawer. */ + device?: Square.CashDrawerDevice; + /** The shift start time in RFC 3339 format. */ + createdAt?: string; + /** The shift updated at time in RFC 3339 format. */ + updatedAt?: string; + /** The ID of the location the cash drawer shift belongs to. */ + locationId?: string; + /** + * The IDs of all team members that were logged into Square Point of Sale at any + * point while the cash drawer shift was open. + */ + teamMemberIds?: string[]; + /** The ID of the team member that started the cash drawer shift. */ + openingTeamMemberId?: string; + /** The ID of the team member that ended the cash drawer shift. */ + endingTeamMemberId?: string; + /** + * The ID of the team member that closed the cash drawer shift by auditing + * the cash drawer contents. + */ + closingTeamMemberId?: string; +} diff --git a/src/api/types/CashDrawerShiftEvent.ts b/src/api/types/CashDrawerShiftEvent.ts new file mode 100644 index 000000000..ed6a3bf76 --- /dev/null +++ b/src/api/types/CashDrawerShiftEvent.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CashDrawerShiftEvent { + /** The unique ID of the event. */ + id?: string; + /** + * The type of cash drawer shift event. + * See [CashDrawerEventType](#type-cashdrawereventtype) for possible values + */ + eventType?: Square.CashDrawerEventType; + /** + * The amount of money that was added to or removed from the cash drawer + * in the event. The amount can be positive (for added money) + * or zero (for other tender type payments). The addition or removal of money can be determined by + * by the event type. + */ + eventMoney?: Square.Money; + /** The event time in RFC 3339 format. */ + createdAt?: string; + /** + * An optional description of the event, entered by the employee that + * created the event. + */ + description?: string | null; + /** The ID of the team member that created the event. */ + teamMemberId?: string; +} diff --git a/src/api/types/CashDrawerShiftState.ts b/src/api/types/CashDrawerShiftState.ts new file mode 100644 index 000000000..9c3ac76de --- /dev/null +++ b/src/api/types/CashDrawerShiftState.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The current state of a cash drawer shift. + */ +export type CashDrawerShiftState = "OPEN" | "ENDED" | "CLOSED"; +export const CashDrawerShiftState = { + Open: "OPEN", + Ended: "ENDED", + Closed: "CLOSED", +} as const; diff --git a/src/api/types/CashDrawerShiftSummary.ts b/src/api/types/CashDrawerShiftSummary.ts new file mode 100644 index 000000000..b4053996b --- /dev/null +++ b/src/api/types/CashDrawerShiftSummary.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The summary of a closed cash drawer shift. + * This model contains only the money counted to start a cash drawer shift, counted + * at the end of the shift, and the amount that should be in the drawer at shift + * end based on summing all cash drawer shift events. + */ +export interface CashDrawerShiftSummary { + /** The shift unique ID. */ + id?: string; + /** + * The shift current state. + * See [CashDrawerShiftState](#type-cashdrawershiftstate) for possible values + */ + state?: Square.CashDrawerShiftState; + /** The shift start time in ISO 8601 format. */ + openedAt?: string | null; + /** The shift end time in ISO 8601 format. */ + endedAt?: string | null; + /** The shift close time in ISO 8601 format. */ + closedAt?: string | null; + /** An employee free-text description of a cash drawer shift. */ + description?: string | null; + /** + * The amount of money in the cash drawer at the start of the shift. This + * must be a positive amount. + */ + openedCashMoney?: Square.Money; + /** + * The amount of money that should be in the cash drawer at the end of the + * shift, based on the cash drawer events on the shift. + * The amount is correct if all shift employees accurately recorded their + * cash drawer shift events. Unrecorded events and events with the wrong amount + * result in an incorrect expected_cash_money amount that can be negative. + */ + expectedCashMoney?: Square.Money; + /** + * The amount of money found in the cash drawer at the end of the shift by + * an auditing employee. The amount must be greater than or equal to zero. + */ + closedCashMoney?: Square.Money; + /** The shift start time in RFC 3339 format. */ + createdAt?: string; + /** The shift updated at time in RFC 3339 format. */ + updatedAt?: string; + /** The ID of the location the cash drawer shift belongs to. */ + locationId?: string; +} diff --git a/src/api/types/CashPaymentDetails.ts b/src/api/types/CashPaymentDetails.ts new file mode 100644 index 000000000..baa0bfe5a --- /dev/null +++ b/src/api/types/CashPaymentDetails.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Stores details about a cash payment. Contains only non-confidential information. For more information, see + * [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). + */ +export interface CashPaymentDetails { + /** The amount and currency of the money supplied by the buyer. */ + buyerSuppliedMoney: Square.Money; + /** + * The amount of change due back to the buyer. + * This read-only field is calculated + * from the `amount_money` and `buyer_supplied_money` fields. + */ + changeBackMoney?: Square.Money; +} diff --git a/src/api/types/CatalogCategory.ts b/src/api/types/CatalogCategory.ts new file mode 100644 index 000000000..0abeda8e8 --- /dev/null +++ b/src/api/types/CatalogCategory.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A category to which a `CatalogItem` instance belongs. + */ +export interface CatalogCategory { + /** The category name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. */ + name?: string | null; + /** + * The IDs of images associated with this `CatalogCategory` instance. + * Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications. + */ + imageIds?: string[] | null; + /** + * The type of the category. + * See [CatalogCategoryType](#type-catalogcategorytype) for possible values + */ + categoryType?: Square.CatalogCategoryType; + /** The ID of the parent category of this category instance. */ + parentCategory?: Square.CatalogObjectCategory; + /** Indicates whether a category is a top level category, which does not have any parent_category. */ + isTopLevel?: boolean | null; + /** A list of IDs representing channels, such as a Square Online site, where the category can be made visible. */ + channels?: string[] | null; + /** The IDs of the `CatalogAvailabilityPeriod` objects associated with the category. */ + availabilityPeriodIds?: string[] | null; + /** Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites. */ + onlineVisibility?: boolean | null; + /** The top-level category in a category hierarchy. */ + rootCategory?: string; + /** The SEO data for a seller's Square Online store. */ + ecomSeoData?: Square.CatalogEcomSeoData; + /** + * The path from the category to its root category. The first node of the path is the parent of the category + * and the last is the root category. The path is empty if the category is a root category. + */ + pathToRoot?: Square.CategoryPathToRootNode[] | null; +} diff --git a/src/api/types/CatalogCategoryType.ts b/src/api/types/CatalogCategoryType.ts new file mode 100644 index 000000000..0e86bdb13 --- /dev/null +++ b/src/api/types/CatalogCategoryType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the type of a category. + */ +export type CatalogCategoryType = "REGULAR_CATEGORY" | "MENU_CATEGORY" | "KITCHEN_CATEGORY"; +export const CatalogCategoryType = { + RegularCategory: "REGULAR_CATEGORY", + MenuCategory: "MENU_CATEGORY", + KitchenCategory: "KITCHEN_CATEGORY", +} as const; diff --git a/src/api/types/CatalogCustomAttributeDefinition.ts b/src/api/types/CatalogCustomAttributeDefinition.ts new file mode 100644 index 000000000..550c1c5ae --- /dev/null +++ b/src/api/types/CatalogCustomAttributeDefinition.ts @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * 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) + */ +export interface CatalogCustomAttributeDefinition { + /** + * The type of this custom attribute. Cannot be modified after creation. + * Required. + * See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values + */ + type: Square.CatalogCustomAttributeDefinitionType; + /** + * The name of this definition for API and seller-facing UI purposes. + * The name must be unique within the (merchant, application) pair. Required. + * May not be empty and may not exceed 255 characters. Can be modified after creation. + */ + name: string; + /** + * Seller-oriented description of the meaning of this Custom Attribute, + * any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs. + */ + description?: string | null; + /** + * __Read only.__ Contains information about the application that + * created this custom attribute definition. + */ + sourceApplication?: Square.SourceApplication; + /** + * The set of `CatalogObject` types that this custom atttribute may be applied to. + * Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included. + * See [CatalogObjectType](#type-catalogobjecttype) for possible values + */ + allowedObjectTypes: Square.CatalogObjectType[]; + /** + * The visibility of a custom attribute in seller-facing UIs (including Square Point + * of Sale applications and Square Dashboard). May be modified. + * See [CatalogCustomAttributeDefinitionSellerVisibility](#type-catalogcustomattributedefinitionsellervisibility) for possible values + */ + sellerVisibility?: Square.CatalogCustomAttributeDefinitionSellerVisibility; + /** + * The visibility of a custom attribute to applications other than the application + * that created the attribute. + * See [CatalogCustomAttributeDefinitionAppVisibility](#type-catalogcustomattributedefinitionappvisibility) for possible values + */ + appVisibility?: Square.CatalogCustomAttributeDefinitionAppVisibility; + /** Optionally, populated when `type` = `STRING`, unset otherwise. */ + stringConfig?: Square.CatalogCustomAttributeDefinitionStringConfig; + /** Optionally, populated when `type` = `NUMBER`, unset otherwise. */ + numberConfig?: Square.CatalogCustomAttributeDefinitionNumberConfig; + /** Populated when `type` is set to `SELECTION`, unset otherwise. */ + selectionConfig?: Square.CatalogCustomAttributeDefinitionSelectionConfig; + /** + * The number of custom attributes that reference this + * custom attribute definition. Set by the server in response to a ListCatalog + * request with `include_counts` set to `true`. If the actual count is greater + * than 100, `custom_attribute_usage_count` will be set to `100`. + */ + customAttributeUsageCount?: number; + /** + * The name of the desired custom attribute key that can be used to access + * the custom attribute value on catalog objects. Cannot be modified after the + * custom attribute definition has been created. + * Must be between 1 and 60 characters, and may only contain the characters `[a-zA-Z0-9_-]`. + */ + key?: string | null; +} diff --git a/src/api/types/CatalogCustomAttributeDefinitionAppVisibility.ts b/src/api/types/CatalogCustomAttributeDefinitionAppVisibility.ts new file mode 100644 index 000000000..2ca2aaa09 --- /dev/null +++ b/src/api/types/CatalogCustomAttributeDefinitionAppVisibility.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines the visibility of a custom attribute to applications other than their + * creating application. + */ +export type CatalogCustomAttributeDefinitionAppVisibility = + | "APP_VISIBILITY_HIDDEN" + | "APP_VISIBILITY_READ_ONLY" + | "APP_VISIBILITY_READ_WRITE_VALUES"; +export const CatalogCustomAttributeDefinitionAppVisibility = { + AppVisibilityHidden: "APP_VISIBILITY_HIDDEN", + AppVisibilityReadOnly: "APP_VISIBILITY_READ_ONLY", + AppVisibilityReadWriteValues: "APP_VISIBILITY_READ_WRITE_VALUES", +} as const; diff --git a/src/api/types/CatalogCustomAttributeDefinitionNumberConfig.ts b/src/api/types/CatalogCustomAttributeDefinitionNumberConfig.ts new file mode 100644 index 000000000..417d50970 --- /dev/null +++ b/src/api/types/CatalogCustomAttributeDefinitionNumberConfig.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CatalogCustomAttributeDefinitionNumberConfig { + /** + * An integer between 0 and 5 that represents the maximum number of + * positions allowed after the decimal in number custom attribute values + * For example: + * + * - if the precision is 0, the quantity can be 1, 2, 3, etc. + * - if the precision is 1, the quantity can be 0.1, 0.2, etc. + * - if the precision is 2, the quantity can be 0.01, 0.12, etc. + * + * Default: 5 + */ + precision?: number | null; +} diff --git a/src/api/types/CatalogCustomAttributeDefinitionSelectionConfig.ts b/src/api/types/CatalogCustomAttributeDefinitionSelectionConfig.ts new file mode 100644 index 000000000..46e7f6cba --- /dev/null +++ b/src/api/types/CatalogCustomAttributeDefinitionSelectionConfig.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Configuration associated with `SELECTION`-type custom attribute definitions. + */ +export interface CatalogCustomAttributeDefinitionSelectionConfig { + /** + * The maximum number of selections that can be set. The maximum value for this + * attribute is 100. The default value is 1. The value can be modified, but changing the value will not + * affect existing custom attribute values on objects. Clients need to + * handle custom attributes with more selected values than allowed by this limit. + */ + maxAllowedSelections?: number | null; + /** + * The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100 + * selections can be defined. Can be modified. + */ + allowedSelections?: Square.CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[] | null; +} diff --git a/src/api/types/CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts b/src/api/types/CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts new file mode 100644 index 000000000..84f3d1188 --- /dev/null +++ b/src/api/types/CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A named selection for this `SELECTION`-type custom attribute definition. + */ +export interface CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection { + /** Unique ID set by Square. */ + uid?: string | null; + /** Selection name, unique within `allowed_selections`. */ + name: string; +} diff --git a/src/api/types/CatalogCustomAttributeDefinitionSellerVisibility.ts b/src/api/types/CatalogCustomAttributeDefinitionSellerVisibility.ts new file mode 100644 index 000000000..dc4afe69b --- /dev/null +++ b/src/api/types/CatalogCustomAttributeDefinitionSellerVisibility.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines the visibility of a custom attribute to sellers in Square + * client applications, Square APIs or in Square UIs (including Square Point + * of Sale applications and Square Dashboard). + */ +export type CatalogCustomAttributeDefinitionSellerVisibility = + | "SELLER_VISIBILITY_HIDDEN" + | "SELLER_VISIBILITY_READ_WRITE_VALUES"; +export const CatalogCustomAttributeDefinitionSellerVisibility = { + SellerVisibilityHidden: "SELLER_VISIBILITY_HIDDEN", + SellerVisibilityReadWriteValues: "SELLER_VISIBILITY_READ_WRITE_VALUES", +} as const; diff --git a/src/api/types/CatalogCustomAttributeDefinitionStringConfig.ts b/src/api/types/CatalogCustomAttributeDefinitionStringConfig.ts new file mode 100644 index 000000000..ece421219 --- /dev/null +++ b/src/api/types/CatalogCustomAttributeDefinitionStringConfig.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Configuration associated with Custom Attribute Definitions of type `STRING`. + */ +export interface CatalogCustomAttributeDefinitionStringConfig { + /** + * If true, each Custom Attribute instance associated with this Custom Attribute + * Definition must have a unique value within the seller's catalog. For + * example, this may be used for a value like a SKU that should not be + * duplicated within a seller's catalog. May not be modified after the + * definition has been created. + */ + enforceUniqueness?: boolean | null; +} diff --git a/src/api/types/CatalogCustomAttributeDefinitionType.ts b/src/api/types/CatalogCustomAttributeDefinitionType.ts new file mode 100644 index 000000000..c456271cb --- /dev/null +++ b/src/api/types/CatalogCustomAttributeDefinitionType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines the possible types for a custom attribute. + */ +export type CatalogCustomAttributeDefinitionType = "STRING" | "BOOLEAN" | "NUMBER" | "SELECTION"; +export const CatalogCustomAttributeDefinitionType = { + String: "STRING", + Boolean: "BOOLEAN", + Number: "NUMBER", + Selection: "SELECTION", +} as const; diff --git a/src/api/types/CatalogCustomAttributeValue.ts b/src/api/types/CatalogCustomAttributeValue.ts new file mode 100644 index 000000000..17709bb8a --- /dev/null +++ b/src/api/types/CatalogCustomAttributeValue.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * An instance of a custom attribute. Custom attributes can be defined and + * added to `ITEM` and `ITEM_VARIATION` type catalog objects. + * [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes). + */ +export interface CatalogCustomAttributeValue { + /** The name of the custom attribute. */ + name?: string | null; + /** The string value of the custom attribute. Populated if `type` = `STRING`. */ + stringValue?: string | null; + /** The id of the [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) this value belongs to. */ + customAttributeDefinitionId?: string; + /** + * A copy of type from the associated `CatalogCustomAttributeDefinition`. + * See [CatalogCustomAttributeDefinitionType](#type-catalogcustomattributedefinitiontype) for possible values + */ + type?: Square.CatalogCustomAttributeDefinitionType; + /** + * Populated if `type` = `NUMBER`. Contains a string + * representation of a decimal number, using a `.` as the decimal separator. + */ + numberValue?: string | null; + /** A `true` or `false` value. Populated if `type` = `BOOLEAN`. */ + booleanValue?: boolean | null; + /** One or more choices from `allowed_selections`. Populated if `type` = `SELECTION`. */ + selectionUidValues?: string[] | null; + /** + * If the associated `CatalogCustomAttributeDefinition` object is defined by another application, this key is prefixed by the defining application ID. + * For example, if the CatalogCustomAttributeDefinition has a key attribute of "cocoa_brand" and the defining application ID is "abcd1234", this key is "abcd1234:cocoa_brand" + * when the application making the request is different from the application defining the custom attribute definition. Otherwise, the key is simply "cocoa_brand". + */ + key?: string; +} diff --git a/src/api/types/CatalogDiscount.ts b/src/api/types/CatalogDiscount.ts new file mode 100644 index 000000000..d152f7f98 --- /dev/null +++ b/src/api/types/CatalogDiscount.ts @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A discount applicable to items. + */ +export interface CatalogDiscount { + /** The discount name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. */ + name?: string | null; + /** + * Indicates whether the discount is a fixed amount or percentage, or entered at the time of sale. + * See [CatalogDiscountType](#type-catalogdiscounttype) for possible values + */ + discountType?: Square.CatalogDiscountType; + /** + * The percentage of the discount as a string representation of a decimal number, using a `.` as the decimal + * separator and without a `%` sign. A value of `7.5` corresponds to `7.5%`. Specify a percentage of `0` if `discount_type` + * is `VARIABLE_PERCENTAGE`. + * + * Do not use this field for amount-based or variable discounts. + */ + percentage?: string | null; + /** + * The amount of the discount. Specify an amount of `0` if `discount_type` is `VARIABLE_AMOUNT`. + * + * Do not use this field for percentage-based or variable discounts. + */ + amountMoney?: Square.Money; + /** + * Indicates whether a mobile staff member needs to enter their PIN to apply the + * discount to a payment in the Square Point of Sale app. + */ + pinRequired?: boolean | null; + /** The color of the discount display label in the Square Point of Sale app. This must be a valid hex color code. */ + labelColor?: string | null; + /** + * Indicates whether this discount should reduce the price used to calculate tax. + * + * Most discounts should use `MODIFY_TAX_BASIS`. However, in some circumstances taxes must + * be calculated based on an item's price, ignoring a particular discount. For example, + * in many US jurisdictions, a manufacturer coupon or instant rebate reduces the price a + * customer pays but does not reduce the sale price used to calculate how much sales tax is + * due. In this case, the discount representing that manufacturer coupon should have + * `DO_NOT_MODIFY_TAX_BASIS` for this field. + * + * If you are unsure whether you need to use this field, consult your tax professional. + * See [CatalogDiscountModifyTaxBasis](#type-catalogdiscountmodifytaxbasis) for possible values + */ + modifyTaxBasis?: Square.CatalogDiscountModifyTaxBasis; + /** + * For a percentage discount, the maximum absolute value of the discount. For example, if a + * 50% discount has a `maximum_amount_money` of $20, a $100 purchase will yield a $20 discount, + * not a $50 discount. + */ + maximumAmountMoney?: Square.Money; +} diff --git a/src/api/types/CatalogDiscountModifyTaxBasis.ts b/src/api/types/CatalogDiscountModifyTaxBasis.ts new file mode 100644 index 000000000..eb9a292e7 --- /dev/null +++ b/src/api/types/CatalogDiscountModifyTaxBasis.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type CatalogDiscountModifyTaxBasis = "MODIFY_TAX_BASIS" | "DO_NOT_MODIFY_TAX_BASIS"; +export const CatalogDiscountModifyTaxBasis = { + ModifyTaxBasis: "MODIFY_TAX_BASIS", + DoNotModifyTaxBasis: "DO_NOT_MODIFY_TAX_BASIS", +} as const; diff --git a/src/api/types/CatalogDiscountType.ts b/src/api/types/CatalogDiscountType.ts new file mode 100644 index 000000000..cb163566d --- /dev/null +++ b/src/api/types/CatalogDiscountType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * How to apply a CatalogDiscount to a CatalogItem. + */ +export type CatalogDiscountType = "FIXED_PERCENTAGE" | "FIXED_AMOUNT" | "VARIABLE_PERCENTAGE" | "VARIABLE_AMOUNT"; +export const CatalogDiscountType = { + FixedPercentage: "FIXED_PERCENTAGE", + FixedAmount: "FIXED_AMOUNT", + VariablePercentage: "VARIABLE_PERCENTAGE", + VariableAmount: "VARIABLE_AMOUNT", +} as const; diff --git a/src/api/types/CatalogEcomSeoData.ts b/src/api/types/CatalogEcomSeoData.ts new file mode 100644 index 000000000..a5191e257 --- /dev/null +++ b/src/api/types/CatalogEcomSeoData.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * SEO data for for a seller's Square Online store. + */ +export interface CatalogEcomSeoData { + /** The SEO title used for the Square Online store. */ + pageTitle?: string | null; + /** The SEO description used for the Square Online store. */ + pageDescription?: string | null; + /** The SEO permalink used for the Square Online store. */ + permalink?: string | null; +} diff --git a/src/api/types/CatalogIdMapping.ts b/src/api/types/CatalogIdMapping.ts new file mode 100644 index 000000000..6a64c6733 --- /dev/null +++ b/src/api/types/CatalogIdMapping.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A mapping between a temporary client-supplied ID and a permanent server-generated ID. + * + * When calling [UpsertCatalogObject](api-endpoint:Catalog-UpsertCatalogObject) or + * [BatchUpsertCatalogObjects](api-endpoint:Catalog-BatchUpsertCatalogObjects) to + * create a [CatalogObject](entity:CatalogObject) instance, you can supply + * a temporary ID for the to-be-created object, especially when the object is to be referenced + * elsewhere in the same request body. This temporary ID can be any string unique within + * the call, but must be prefixed by "#". + * + * After the request is submitted and the object created, a permanent server-generated ID is assigned + * to the new object. The permanent ID is unique across the Square catalog. + */ +export interface CatalogIdMapping { + /** The client-supplied temporary `#`-prefixed ID for a new `CatalogObject`. */ + clientObjectId?: string | null; + /** The permanent ID for the CatalogObject created by the server. */ + objectId?: string | null; +} diff --git a/src/api/types/CatalogImage.ts b/src/api/types/CatalogImage.ts new file mode 100644 index 000000000..702f7a63f --- /dev/null +++ b/src/api/types/CatalogImage.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * 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. + */ +export interface CatalogImage { + /** + * The internal name to identify this image in calls to the Square API. + * This is a searchable attribute for use in applicable query filters + * using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). + * It is not unique and should not be shown in a buyer facing context. + */ + name?: string | null; + /** + * The URL of this image, generated by Square after an image is uploaded + * using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint. + * To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field. + */ + url?: string | null; + /** + * A caption that describes what is shown in the image. Displayed in the + * Square Online Store. This is a searchable attribute for use in applicable query filters + * using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). + */ + caption?: string | null; + /** The immutable order ID for this image object created by the Photo Studio service in Square Online Store. */ + photoStudioOrderId?: string | null; +} diff --git a/src/api/types/CatalogInfoResponse.ts b/src/api/types/CatalogInfoResponse.ts new file mode 100644 index 000000000..74498a909 --- /dev/null +++ b/src/api/types/CatalogInfoResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogInfoResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** Limits that apply to this API. */ + limits?: Square.CatalogInfoResponseLimits; + /** Names and abbreviations for standard units. */ + standardUnitDescriptionGroup?: Square.StandardUnitDescriptionGroup; +} diff --git a/src/api/types/CatalogInfoResponseLimits.ts b/src/api/types/CatalogInfoResponseLimits.ts new file mode 100644 index 000000000..882ba531e --- /dev/null +++ b/src/api/types/CatalogInfoResponseLimits.ts @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CatalogInfoResponseLimits { + /** + * The maximum number of objects that may appear within a single batch in a + * `/v2/catalog/batch-upsert` request. + */ + batchUpsertMaxObjectsPerBatch?: number | null; + /** + * The maximum number of objects that may appear across all batches in a + * `/v2/catalog/batch-upsert` request. + */ + batchUpsertMaxTotalObjects?: number | null; + /** + * The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve` + * request. + */ + batchRetrieveMaxObjectIds?: number | null; + /** + * The maximum number of results that may be returned in a page of a + * `/v2/catalog/search` response. + */ + searchMaxPageLimit?: number | null; + /** + * The maximum number of object IDs that may be included in a single + * `/v2/catalog/batch-delete` request. + */ + batchDeleteMaxObjectIds?: number | null; + /** + * The maximum number of item IDs that may be included in a single + * `/v2/catalog/update-item-taxes` request. + */ + updateItemTaxesMaxItemIds?: number | null; + /** + * The maximum number of tax IDs to be enabled that may be included in a single + * `/v2/catalog/update-item-taxes` request. + */ + updateItemTaxesMaxTaxesToEnable?: number | null; + /** + * The maximum number of tax IDs to be disabled that may be included in a single + * `/v2/catalog/update-item-taxes` request. + */ + updateItemTaxesMaxTaxesToDisable?: number | null; + /** + * The maximum number of item IDs that may be included in a single + * `/v2/catalog/update-item-modifier-lists` request. + */ + updateItemModifierListsMaxItemIds?: number | null; + /** + * The maximum number of modifier list IDs to be enabled that may be included in + * a single `/v2/catalog/update-item-modifier-lists` request. + */ + updateItemModifierListsMaxModifierListsToEnable?: number | null; + /** + * The maximum number of modifier list IDs to be disabled that may be included in + * a single `/v2/catalog/update-item-modifier-lists` request. + */ + updateItemModifierListsMaxModifierListsToDisable?: number | null; +} diff --git a/src/api/types/CatalogItem.ts b/src/api/types/CatalogItem.ts new file mode 100644 index 000000000..2855ce6cc --- /dev/null +++ b/src/api/types/CatalogItem.ts @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A [CatalogObject](entity:CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog. + */ +export interface CatalogItem { + /** The item's name. This is a searchable attribute for use in applicable query filters, its value must not be empty, and the length is of Unicode code points. */ + name?: string | null; + /** + * The item's description. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. + * + * Deprecated at 2022-07-20, this field is planned to retire in 6 months. You should migrate to use `description_html` to set the description + * of the [CatalogItem](entity:CatalogItem) instance. The `description` and `description_html` field values are kept in sync. If you try to + * set the both fields, the `description_html` text value overwrites the `description` value. Updates in one field are also reflected in the other, + * except for when you use an early version before Square API 2022-07-20 and `description_html` is set to blank, setting the `description` value to null + * does not nullify `description_html`. + */ + description?: string | null; + /** + * The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. + * This attribute is searchable, and its value length is of Unicode code points. + */ + abbreviation?: string | null; + /** The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code. */ + labelColor?: string | null; + /** Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`. */ + isTaxable?: boolean | null; + /** The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead. */ + categoryId?: string | null; + /** + * A set of IDs indicating the taxes enabled for + * this item. When updating an item, any taxes listed here will be added to the item. + * Taxes may also be added to or deleted from an item using `UpdateItemTaxes`. + */ + taxIds?: string[] | null; + /** + * A set of `CatalogItemModifierListInfo` objects + * representing the modifier lists that apply to this item, along with the overrides and min + * and max limits that are specific to this item. Modifier lists + * may also be added to or deleted from an item using `UpdateItemModifierLists`. + */ + modifierListInfo?: Square.CatalogItemModifierListInfo[] | null; + /** + * A list of [CatalogItemVariation](entity:CatalogItemVariation) objects for this item. An item must have + * at least one variation. + */ + variations?: Square.CatalogObject[] | null; + /** + * The product type of the item. Once set, the `product_type` value cannot be modified. + * + * Items of the `LEGACY_SQUARE_ONLINE_SERVICE` and `LEGACY_SQUARE_ONLINE_MEMBERSHIP` product types can be updated + * but cannot be created using the API. + * See [CatalogItemProductType](#type-catalogitemproducttype) for possible values + */ + productType?: Square.CatalogItemProductType; + /** + * If `false`, the Square Point of Sale app will present the `CatalogItem`'s + * details screen immediately, allowing the merchant to choose `CatalogModifier`s + * before adding the item to the cart. This is the default behavior. + * + * If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected + * modifiers, and merchants can edit modifiers by drilling down onto the item's details. + * + * Third-party clients are encouraged to implement similar behaviors. + */ + skipModifierScreen?: boolean | null; + /** + * List of item options IDs for this item. Used to manage and group item + * variations in a specified order. + * + * Maximum: 6 item options. + */ + itemOptions?: Square.CatalogItemOptionForItem[] | null; + /** + * The IDs of images associated with this `CatalogItem` instance. + * These images will be shown to customers in Square Online Store. + * The first image will show up as the icon for this item in POS. + */ + imageIds?: string[] | null; + /** + * A name to sort the item by. If this name is unspecified, namely, the `sort_name` field is absent, the regular `name` field is used for sorting. + * Its value must not be empty. + * + * It is currently supported for sellers of the Japanese locale only. + */ + sortName?: string | null; + /** The list of categories. */ + categories?: Square.CatalogObjectCategory[] | null; + /** + * The item's description as expressed in valid HTML elements. The length of this field value, including those of HTML tags, + * is of Unicode points. With application query filters, the text values of the HTML elements and attributes are searchable. Invalid or + * unsupported HTML elements or attributes are ignored. + * + * Supported HTML elements include: + * - `a`: Link. Supports linking to website URLs, email address, and telephone numbers. + * - `b`, `strong`: Bold text + * - `br`: Line break + * - `code`: Computer code + * - `div`: Section + * - `h1-h6`: Headings + * - `i`, `em`: Italics + * - `li`: List element + * - `ol`: Numbered list + * - `p`: Paragraph + * - `ul`: Bullet list + * - `u`: Underline + * + * + * Supported HTML attributes include: + * - `align`: Alignment of the text content + * - `href`: Link destination + * - `rel`: Relationship between link's target and source + * - `target`: Place to open the linked document + */ + descriptionHtml?: string | null; + /** A server-generated plaintext version of the `description_html` field, without formatting tags. */ + descriptionPlaintext?: string; + /** + * A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. + * This field is read only and cannot be edited. + */ + channels?: string[] | null; + /** Indicates whether this item is archived (`true`) or not (`false`). */ + isArchived?: boolean | null; + /** The SEO data for a seller's Square Online store. */ + ecomSeoData?: Square.CatalogEcomSeoData; + /** The food and beverage-specific details for the `FOOD_AND_BEV` item. */ + foodAndBeverageDetails?: Square.CatalogItemFoodAndBeverageDetails; + /** The item's reporting category. */ + reportingCategory?: Square.CatalogObjectCategory; +} diff --git a/src/api/types/CatalogItemFoodAndBeverageDetails.ts b/src/api/types/CatalogItemFoodAndBeverageDetails.ts new file mode 100644 index 000000000..eace1998d --- /dev/null +++ b/src/api/types/CatalogItemFoodAndBeverageDetails.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The food and beverage-specific details of a `FOOD_AND_BEV` item. + */ +export interface CatalogItemFoodAndBeverageDetails { + /** The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items. */ + calorieCount?: number | null; + /** The dietary preferences for the `FOOD_AND_BEV` item. */ + dietaryPreferences?: Square.CatalogItemFoodAndBeverageDetailsDietaryPreference[] | null; + /** The ingredients for the `FOOD_AND_BEV` type item. */ + ingredients?: Square.CatalogItemFoodAndBeverageDetailsIngredient[] | null; +} diff --git a/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts b/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts new file mode 100644 index 000000000..9b5123a8b --- /dev/null +++ b/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients. + */ +export interface CatalogItemFoodAndBeverageDetailsDietaryPreference { + /** + * The dietary preference type. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`. + * See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values + */ + type?: Square.CatalogItemFoodAndBeverageDetailsDietaryPreferenceType; + /** + * The name of the dietary preference from a standard pre-defined list. This should be null if it's a custom dietary preference. + * See [StandardDietaryPreference](#type-standarddietarypreference) for possible values + */ + standardName?: Square.CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference; + /** The name of a user-defined custom dietary preference. This should be null if it's a standard dietary preference. */ + customName?: string | null; +} diff --git a/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.ts b/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.ts new file mode 100644 index 000000000..434c7588d --- /dev/null +++ b/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Standard dietary preferences for food and beverage items that are recommended on item creation. + */ +export type CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = + | "DAIRY_FREE" + | "GLUTEN_FREE" + | "HALAL" + | "KOSHER" + | "NUT_FREE" + | "VEGAN" + | "VEGETARIAN"; +export const CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference = { + DairyFree: "DAIRY_FREE", + GlutenFree: "GLUTEN_FREE", + Halal: "HALAL", + Kosher: "KOSHER", + NutFree: "NUT_FREE", + Vegan: "VEGAN", + Vegetarian: "VEGETARIAN", +} as const; diff --git a/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.ts b/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.ts new file mode 100644 index 000000000..31bb4e4f5 --- /dev/null +++ b/src/api/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. + */ +export type CatalogItemFoodAndBeverageDetailsDietaryPreferenceType = "STANDARD" | "CUSTOM"; +export const CatalogItemFoodAndBeverageDetailsDietaryPreferenceType = { + Standard: "STANDARD", + Custom: "CUSTOM", +} as const; diff --git a/src/api/types/CatalogItemFoodAndBeverageDetailsIngredient.ts b/src/api/types/CatalogItemFoodAndBeverageDetailsIngredient.ts new file mode 100644 index 000000000..95e34bd26 --- /dev/null +++ b/src/api/types/CatalogItemFoodAndBeverageDetailsIngredient.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes the ingredient used in a `FOOD_AND_BEV` item. + */ +export interface CatalogItemFoodAndBeverageDetailsIngredient { + /** + * The dietary preference type of the ingredient. Supported values include `STANDARD` and `CUSTOM` as specified in `FoodAndBeverageDetails.DietaryPreferenceType`. + * See [DietaryPreferenceType](#type-dietarypreferencetype) for possible values + */ + type?: Square.CatalogItemFoodAndBeverageDetailsDietaryPreferenceType; + /** + * The name of the ingredient from a standard pre-defined list. This should be null if it's a custom dietary preference. + * See [StandardIngredient](#type-standardingredient) for possible values + */ + standardName?: Square.CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient; + /** The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference. */ + customName?: string | null; +} diff --git a/src/api/types/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.ts b/src/api/types/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.ts new file mode 100644 index 000000000..cef5da03e --- /dev/null +++ b/src/api/types/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Standard ingredients for food and beverage items that are recommended on item creation. + */ +export type CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = + | "CELERY" + | "CRUSTACEANS" + | "EGGS" + | "FISH" + | "GLUTEN" + | "LUPIN" + | "MILK" + | "MOLLUSCS" + | "MUSTARD" + | "PEANUTS" + | "SESAME" + | "SOY" + | "SULPHITES" + | "TREE_NUTS"; +export const CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient = { + Celery: "CELERY", + Crustaceans: "CRUSTACEANS", + Eggs: "EGGS", + Fish: "FISH", + Gluten: "GLUTEN", + Lupin: "LUPIN", + Milk: "MILK", + Molluscs: "MOLLUSCS", + Mustard: "MUSTARD", + Peanuts: "PEANUTS", + Sesame: "SESAME", + Soy: "SOY", + Sulphites: "SULPHITES", + TreeNuts: "TREE_NUTS", +} as const; diff --git a/src/api/types/CatalogItemModifierListInfo.ts b/src/api/types/CatalogItemModifierListInfo.ts new file mode 100644 index 000000000..903c973cc --- /dev/null +++ b/src/api/types/CatalogItemModifierListInfo.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` instance + * and specifies supported behaviors of the application. + */ +export interface CatalogItemModifierListInfo { + /** The ID of the `CatalogModifierList` controlled by this `CatalogModifierListInfo`. */ + modifierListId: string; + /** A set of `CatalogModifierOverride` objects that override whether a given `CatalogModifier` is enabled by default. */ + modifierOverrides?: Square.CatalogModifierOverride[] | null; + /** + * If 0 or larger, the smallest number of `CatalogModifier`s that must be selected from this `CatalogModifierList`. + * The default value is `-1`. + * + * When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` + * and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of + * the `CatalogModifierList` can be selected from the `CatalogModifierList`. + * + * When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` + * and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in + * and can be selected from the `CatalogModifierList` + */ + minSelectedModifiers?: number | null; + /** + * If 0 or larger, the largest number of `CatalogModifier`s that can be selected from this `CatalogModifierList`. + * The default value is `-1`. + * + * When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` + * and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of + * the `CatalogModifierList` can be selected from the `CatalogModifierList`. + * + * When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` + * and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in + * and can be selected from the `CatalogModifierList` + */ + maxSelectedModifiers?: number | null; + /** If `true`, enable this `CatalogModifierList`. The default value is `true`. */ + enabled?: boolean | null; + /** + * The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied + * to a `CatalogItem` instance. + */ + ordinal?: number | null; +} diff --git a/src/api/types/CatalogItemOption.ts b/src/api/types/CatalogItemOption.ts new file mode 100644 index 000000000..fa15b7904 --- /dev/null +++ b/src/api/types/CatalogItemOption.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A group of variations for a `CatalogItem`. + */ +export interface CatalogItemOption { + /** + * The item option's display name for the seller. Must be unique across + * all item options. This is a searchable attribute for use in applicable query filters. + */ + name?: string | null; + /** The item option's display name for the customer. This is a searchable attribute for use in applicable query filters. */ + displayName?: string | null; + /** + * The item option's human-readable description. Displayed in the Square + * Point of Sale app for the seller and in the Online Store or on receipts for + * the buyer. This is a searchable attribute for use in applicable query filters. + */ + description?: string | null; + /** If true, display colors for entries in `values` when present. */ + showColors?: boolean | null; + /** + * A list of CatalogObjects containing the + * `CatalogItemOptionValue`s for this item. + */ + values?: Square.CatalogObject[] | null; +} diff --git a/src/api/types/CatalogItemOptionForItem.ts b/src/api/types/CatalogItemOptionForItem.ts new file mode 100644 index 000000000..1dc6995d2 --- /dev/null +++ b/src/api/types/CatalogItemOptionForItem.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An option that can be assigned to an item. + * For example, a t-shirt item may offer a color option or a size option. + */ +export interface CatalogItemOptionForItem { + /** The unique id of the item option, used to form the dimensions of the item option matrix in a specified order. */ + itemOptionId?: string | null; +} diff --git a/src/api/types/CatalogItemOptionValue.ts b/src/api/types/CatalogItemOptionValue.ts new file mode 100644 index 000000000..3be28f3f6 --- /dev/null +++ b/src/api/types/CatalogItemOptionValue.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enumerated value that can link a + * `CatalogItemVariation` to an item option as one of + * its item option values. + */ +export interface CatalogItemOptionValue { + /** Unique ID of the associated item option. */ + itemOptionId?: string | null; + /** Name of this item option value. This is a searchable attribute for use in applicable query filters. */ + name?: string | null; + /** A human-readable description for the option value. This is a searchable attribute for use in applicable query filters. */ + description?: string | null; + /** + * The HTML-supported hex color for the item option (e.g., "#ff8d4e85"). + * Only displayed if `show_colors` is enabled on the parent `ItemOption`. When + * left unset, `color` defaults to white ("#ffffff") when `show_colors` is + * enabled on the parent `ItemOption`. + */ + color?: string | null; + /** Determines where this option value appears in a list of option values. */ + ordinal?: number | null; +} diff --git a/src/api/types/CatalogItemOptionValueForItemVariation.ts b/src/api/types/CatalogItemOptionValueForItemVariation.ts new file mode 100644 index 000000000..5a23de8aa --- /dev/null +++ b/src/api/types/CatalogItemOptionValueForItemVariation.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A `CatalogItemOptionValue` links an item variation to an item option as + * an item option value. For example, a t-shirt item may offer a color option and + * a size option. An item option value would represent each variation of t-shirt: + * For example, "Color:Red, Size:Small" or "Color:Blue, Size:Medium". + */ +export interface CatalogItemOptionValueForItemVariation { + /** The unique id of an item option. */ + itemOptionId?: string | null; + /** The unique id of the selected value for the item option. */ + itemOptionValueId?: string | null; +} diff --git a/src/api/types/CatalogItemProductType.ts b/src/api/types/CatalogItemProductType.ts new file mode 100644 index 000000000..3fc91902c --- /dev/null +++ b/src/api/types/CatalogItemProductType.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of a CatalogItem. Connect V2 only allows the creation of `REGULAR` or `APPOINTMENTS_SERVICE` items. + */ +export type CatalogItemProductType = + | "REGULAR" + | "GIFT_CARD" + | "APPOINTMENTS_SERVICE" + | "FOOD_AND_BEV" + | "EVENT" + | "DIGITAL" + | "DONATION" + | "LEGACY_SQUARE_ONLINE_SERVICE" + | "LEGACY_SQUARE_ONLINE_MEMBERSHIP"; +export const CatalogItemProductType = { + Regular: "REGULAR", + GiftCard: "GIFT_CARD", + AppointmentsService: "APPOINTMENTS_SERVICE", + FoodAndBev: "FOOD_AND_BEV", + Event: "EVENT", + Digital: "DIGITAL", + Donation: "DONATION", + LegacySquareOnlineService: "LEGACY_SQUARE_ONLINE_SERVICE", + LegacySquareOnlineMembership: "LEGACY_SQUARE_ONLINE_MEMBERSHIP", +} as const; diff --git a/src/api/types/CatalogItemVariation.ts b/src/api/types/CatalogItemVariation.ts new file mode 100644 index 000000000..59b92d315 --- /dev/null +++ b/src/api/types/CatalogItemVariation.ts @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * An item variation, representing a product for sale, in the Catalog object model. Each [item](entity:CatalogItem) must have at least one + * item variation and can have at most 250 item variations. + * + * An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked + * number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both + * stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass + * variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be + * converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes + * the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count + * decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. + */ +export interface CatalogItemVariation { + /** The ID of the `CatalogItem` associated with this item variation. */ + itemId?: string | null; + /** + * The item variation's name. This is a searchable attribute for use in applicable query filters. + * + * Its value has a maximum length of 255 Unicode code points. However, when the parent [item](entity:CatalogItem) + * uses [item options](entity:CatalogItemOption), this attribute is auto-generated, read-only, and can be + * longer than 255 Unicode code points. + */ + name?: string | null; + /** The item variation's SKU, if any. This is a searchable attribute for use in applicable query filters. */ + sku?: string | null; + /** + * The universal product code (UPC) of the item variation, if any. This is a searchable attribute for use in applicable query filters. + * + * The value of this attribute should be a number of 12-14 digits long. This restriction is enforced on the Square Seller Dashboard, + * Square Point of Sale or Retail Point of Sale apps, where this attribute shows in the GTIN field. If a non-compliant UPC value is assigned + * to this attribute using the API, the value is not editable on the Seller Dashboard, Square Point of Sale or Retail Point of Sale apps + * unless it is updated to fit the expected format. + */ + upc?: string | null; + /** + * The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal + * for each item variation within a parent `CatalogItem` is set according to the item variations's + * position. On reads, the value is not guaranteed to be sequential or unique. + */ + ordinal?: number; + /** + * Indicates whether the item variation's price is fixed or determined at the time + * of sale. + * See [CatalogPricingType](#type-catalogpricingtype) for possible values + */ + pricingType?: Square.CatalogPricingType; + /** The item variation's price, if fixed pricing is used. */ + priceMoney?: Square.Money; + /** Per-location price and inventory overrides. */ + locationOverrides?: Square.ItemVariationLocationOverrides[] | null; + /** If `true`, inventory tracking is active for the variation. */ + trackInventory?: boolean | null; + /** + * Indicates whether the item variation displays an alert when its inventory quantity is less than or equal + * to its `inventory_alert_threshold`. + * See [InventoryAlertType](#type-inventoryalerttype) for possible values + */ + inventoryAlertType?: Square.InventoryAlertType; + /** + * If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` + * is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. + * + * This value is always an integer. + */ + inventoryAlertThreshold?: bigint | null; + /** Arbitrary user metadata to associate with the item variation. This attribute value length is of Unicode code points. */ + userData?: string | null; + /** + * If the `CatalogItem` that owns this item variation is of type + * `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For + * example, a 30 minute appointment would have the value `1800000`, which is equal to + * 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second). + */ + serviceDuration?: bigint | null; + /** + * If the `CatalogItem` that owns this item variation is of type + * `APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking. + */ + availableForBooking?: boolean | null; + /** + * List of item option values associated with this item variation. Listed + * in the same order as the item options of the parent item. + */ + itemOptionValues?: Square.CatalogItemOptionValueForItemVariation[] | null; + /** + * ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity + * sold of this item variation. If left unset, the item will be sold in + * whole quantities. + */ + measurementUnitId?: string | null; + /** + * Whether this variation can be sold. The inventory count of a sellable variation indicates + * the number of units available for sale. When a variation is both stockable and sellable, + * its sellable inventory count can be smaller than or equal to its stockable count. + */ + sellable?: boolean | null; + /** + * Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE). + * When a variation is both stockable and sellable, the inventory count of a stockable variation keeps track of the number of units of this variation in stock + * and is not an indicator of the number of units of the variation that can be sold. + */ + stockable?: boolean | null; + /** + * The IDs of images associated with this `CatalogItemVariation` instance. + * These images will be shown to customers in Square Online Store. + */ + imageIds?: string[] | null; + /** + * Tokens of employees that can perform the service represented by this variation. Only valid for + * variations of type `APPOINTMENTS_SERVICE`. + */ + teamMemberIds?: string[] | null; + /** + * The unit conversion rule, as prescribed by the [CatalogStockConversion](entity:CatalogStockConversion) type, + * that describes how this non-stockable (i.e., sellable/receivable) item variation is converted + * to/from the stockable item variation sharing the same parent item. With the stock conversion, + * you can accurately track inventory when an item variation is sold in one unit, but stocked in + * another unit. + */ + stockableConversion?: Square.CatalogStockConversion; +} diff --git a/src/api/types/CatalogMeasurementUnit.ts b/src/api/types/CatalogMeasurementUnit.ts new file mode 100644 index 000000000..9e37e5874 --- /dev/null +++ b/src/api/types/CatalogMeasurementUnit.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the unit used to measure a `CatalogItemVariation` and + * specifies the precision for decimal quantities. + */ +export interface CatalogMeasurementUnit { + /** Indicates the unit used to measure the quantity of a catalog item variation. */ + measurementUnit?: Square.MeasurementUnit; + /** + * An integer between 0 and 5 that represents the maximum number of + * positions allowed after the decimal in quantities measured with this unit. + * For example: + * + * - if the precision is 0, the quantity can be 1, 2, 3, etc. + * - if the precision is 1, the quantity can be 0.1, 0.2, etc. + * - if the precision is 2, the quantity can be 0.01, 0.12, etc. + * + * Default: 3 + */ + precision?: number | null; +} diff --git a/src/api/types/CatalogModifier.ts b/src/api/types/CatalogModifier.ts new file mode 100644 index 000000000..60cab37b3 --- /dev/null +++ b/src/api/types/CatalogModifier.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. + */ +export interface CatalogModifier { + /** The modifier name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. */ + name?: string | null; + /** The modifier price. */ + priceMoney?: Square.Money; + /** Determines where this `CatalogModifier` appears in the `CatalogModifierList`. */ + ordinal?: number | null; + /** The ID of the `CatalogModifierList` associated with this modifier. */ + modifierListId?: string | null; + /** Location-specific price overrides. */ + locationOverrides?: Square.ModifierLocationOverrides[] | null; + /** + * The ID of the image associated with this `CatalogModifier` instance. + * Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications. + */ + imageId?: string | null; +} diff --git a/src/api/types/CatalogModifierList.ts b/src/api/types/CatalogModifierList.ts new file mode 100644 index 000000000..191da19dd --- /dev/null +++ b/src/api/types/CatalogModifierList.ts @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. + * For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied + * text string to be selected for the T-shirt at the time of sale. + * + * For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items + * at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. + * For example, a "Condiments" modifier list applicable to a "Hot Dog" item + * may contain "Ketchup", "Mustard", and "Relish" modifiers. + * + * A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field + * is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item + * only once and the `selection_type` field is always set to `SINGLE`. + */ +export interface CatalogModifierList { + /** + * The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of + * Unicode code points. + */ + name?: string | null; + /** The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. */ + ordinal?: number | null; + /** + * Indicates whether a single (`SINGLE`) or multiple (`MULTIPLE`) modifiers from the list + * can be applied to a single `CatalogItem`. + * + * For text-based modifiers, the `selection_type` attribute is always `SINGLE`. The other value is ignored. + * See [CatalogModifierListSelectionType](#type-catalogmodifierlistselectiontype) for possible values + */ + selectionType?: Square.CatalogModifierListSelectionType; + /** + * A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`, + * for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list + * is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes: + * ``` + * { + * "id": "{{catalog_modifier_id}}", + * "type": "MODIFIER", + * "modifier_data": {{a CatalogModifier instance>}} + * } + * ``` + */ + modifiers?: Square.CatalogObject[] | null; + /** + * The IDs of images associated with this `CatalogModifierList` instance. + * Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications. + */ + imageIds?: string[] | null; + /** + * The type of the modifier. + * + * When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier. + * When this `modifier_type` value is `LIST`, the `CatalogModifierList` contains a list of `CatalogModifier` objects. + * See [CatalogModifierListModifierType](#type-catalogmodifierlistmodifiertype) for possible values + */ + modifierType?: Square.CatalogModifierListModifierType; + /** + * The maximum length, in Unicode points, of the text string of the text-based modifier as represented by + * this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + */ + maxLength?: number | null; + /** + * Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based modifier + * as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. + */ + textRequired?: boolean | null; + /** + * A note for internal use by the business. + * + * For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!" + * is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as + * an instruction for the business to follow. + * + * For non text-based modifiers, this `internal_name` attribute can be + * used to include SKUs, internal codes, or supplemental descriptions for internal use. + */ + internalName?: string | null; +} diff --git a/src/api/types/CatalogModifierListModifierType.ts b/src/api/types/CatalogModifierListModifierType.ts new file mode 100644 index 000000000..3275ff7f8 --- /dev/null +++ b/src/api/types/CatalogModifierListModifierType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines the type of `CatalogModifierList`. + */ +export type CatalogModifierListModifierType = "LIST" | "TEXT"; +export const CatalogModifierListModifierType = { + List: "LIST", + Text: "TEXT", +} as const; diff --git a/src/api/types/CatalogModifierListSelectionType.ts b/src/api/types/CatalogModifierListSelectionType.ts new file mode 100644 index 000000000..ff4aea126 --- /dev/null +++ b/src/api/types/CatalogModifierListSelectionType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether a CatalogModifierList supports multiple selections. + */ +export type CatalogModifierListSelectionType = "SINGLE" | "MULTIPLE"; +export const CatalogModifierListSelectionType = { + Single: "SINGLE", + Multiple: "MULTIPLE", +} as const; diff --git a/src/api/types/CatalogModifierOverride.ts b/src/api/types/CatalogModifierOverride.ts new file mode 100644 index 000000000..2a60396ca --- /dev/null +++ b/src/api/types/CatalogModifierOverride.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Options to control how to override the default behavior of the specified modifier. + */ +export interface CatalogModifierOverride { + /** The ID of the `CatalogModifier` whose default behavior is being overridden. */ + modifierId: string; + /** If `true`, this `CatalogModifier` should be selected by default for this `CatalogItem`. */ + onByDefault?: boolean | null; +} diff --git a/src/api/types/CatalogObject.ts b/src/api/types/CatalogObject.ts new file mode 100644 index 000000000..2cc46864c --- /dev/null +++ b/src/api/types/CatalogObject.ts @@ -0,0 +1,151 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The wrapper object for the catalog entries of a given object type. + * + * Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + * + * For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + * + * In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + * + * For a more detailed discussion of the Catalog data model, please see the + * [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + */ +export type CatalogObject = + | Square.CatalogObject.Item + | Square.CatalogObject.Image + | Square.CatalogObject.Category + | Square.CatalogObject.ItemVariation + | Square.CatalogObject.Tax + | Square.CatalogObject.Discount + | Square.CatalogObject.ModifierList + | Square.CatalogObject.Modifier + | Square.CatalogObject.DiningOption + | Square.CatalogObject.TaxExemption + | Square.CatalogObject.ServiceCharge + | Square.CatalogObject.PricingRule + | Square.CatalogObject.ProductSet + | Square.CatalogObject.TimePeriod + | Square.CatalogObject.MeasurementUnit + | Square.CatalogObject.SubscriptionPlan + | Square.CatalogObject.ItemOption + | Square.CatalogObject.ItemOptionVal + | Square.CatalogObject.CustomAttributeDefinition + | Square.CatalogObject.QuickAmountsSettings + | Square.CatalogObject.Component + | Square.CatalogObject.Composition + | Square.CatalogObject.Resource + | Square.CatalogObject.CheckoutLink + | Square.CatalogObject.Address + | Square.CatalogObject.SubscriptionProduct; + +export namespace CatalogObject { + export interface Item extends Square.CatalogObjectItem { + type: "ITEM"; + } + + export interface Image extends Square.CatalogObjectImage { + type: "IMAGE"; + } + + export interface Category extends Square.CatalogObjectCategory { + type: "CATEGORY"; + } + + export interface ItemVariation extends Square.CatalogObjectItemVariation { + type: "ITEM_VARIATION"; + } + + export interface Tax extends Square.CatalogObjectTax { + type: "TAX"; + } + + export interface Discount extends Square.CatalogObjectDiscount { + type: "DISCOUNT"; + } + + export interface ModifierList extends Square.CatalogObjectModifierList { + type: "MODIFIER_LIST"; + } + + export interface Modifier extends Square.CatalogObjectModifier { + type: "MODIFIER"; + } + + export interface DiningOption extends Square.CatalogObjectDiningOption { + type: "DINING_OPTION"; + } + + export interface TaxExemption extends Square.CatalogObjectTaxExemption { + type: "TAX_EXEMPTION"; + } + + export interface ServiceCharge extends Square.CatalogObjectServiceCharge { + type: "SERVICE_CHARGE"; + } + + export interface PricingRule extends Square.CatalogObjectPricingRule { + type: "PRICING_RULE"; + } + + export interface ProductSet extends Square.CatalogObjectProductSet { + type: "PRODUCT_SET"; + } + + export interface TimePeriod extends Square.CatalogObjectTimePeriod { + type: "TIME_PERIOD"; + } + + export interface MeasurementUnit extends Square.CatalogObjectMeasurementUnit { + type: "MEASUREMENT_UNIT"; + } + + export interface SubscriptionPlan extends Square.CatalogObjectSubscriptionPlan { + type: "SUBSCRIPTION_PLAN"; + } + + export interface ItemOption extends Square.CatalogObjectItemOption { + type: "ITEM_OPTION"; + } + + export interface ItemOptionVal extends Square.CatalogObjectItemOptionValue { + type: "ITEM_OPTION_VAL"; + } + + export interface CustomAttributeDefinition extends Square.CatalogObjectCustomAttributeDefinition { + type: "CUSTOM_ATTRIBUTE_DEFINITION"; + } + + export interface QuickAmountsSettings extends Square.CatalogObjectQuickAmountsSettings { + type: "QUICK_AMOUNTS_SETTINGS"; + } + + export interface Component extends Square.CatalogObjectComponent { + type: "COMPONENT"; + } + + export interface Composition extends Square.CatalogObjectComposition { + type: "COMPOSITION"; + } + + export interface Resource extends Square.CatalogObjectResource { + type: "RESOURCE"; + } + + export interface CheckoutLink extends Square.CatalogObjectCheckoutLink { + type: "CHECKOUT_LINK"; + } + + export interface Address extends Square.CatalogObjectAddress { + type: "ADDRESS"; + } + + export interface SubscriptionProduct extends Square.CatalogObjectSubscriptionProduct { + type: "SUBSCRIPTION_PRODUCT"; + } +} diff --git a/src/api/types/CatalogObjectAddress.ts b/src/api/types/CatalogObjectAddress.ts new file mode 100644 index 000000000..cb58e9e36 --- /dev/null +++ b/src/api/types/CatalogObjectAddress.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectAddress extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectBase.ts b/src/api/types/CatalogObjectBase.ts new file mode 100644 index 000000000..27fea738d --- /dev/null +++ b/src/api/types/CatalogObjectBase.ts @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectBase { + /** + * An identifier to reference this object in the catalog. When a new `CatalogObject` + * is inserted, the client should set the id to a temporary identifier starting with + * a "`#`" character. Other objects being inserted or updated within the same request + * may use this identifier to refer to the new object. + * + * When the server receives the new object, it will supply a unique identifier that + * replaces the temporary identifier for all future references. + */ + id: string; + /** + * Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + * would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + */ + updatedAt?: string; + /** + * The version of the object. When updating an object, the version supplied + * must match the version in the database, otherwise the write will be rejected as conflicting. + */ + version?: bigint; + /** + * If `true`, the object has been deleted from the database. Must be `false` for new objects + * being inserted. When deleted, the `updated_at` field will equal the deletion time. + */ + isDeleted?: boolean; + /** + * A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + * is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + * value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + * object defined by the application making the request. + * + * If the `CatalogCustomAttributeDefinition` object is + * defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + * the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + * `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + * if the application making the request is different from the application defining the custom attribute definition. + * Otherwise, the key used in the map is simply `"cocoa_brand"`. + * + * Application-defined custom attributes are set at a global (location-independent) level. + * Custom attribute values are intended to store additional information about a catalog object + * or associations with an entity in another system. Do not use custom attributes + * to store any sensitive information (personally identifiable information, card details, etc.). + */ + customAttributeValues?: Record; + /** + * The Connect v1 IDs for this object at each location where it is present, where they + * differ from the object's Connect V2 ID. The field will only be present for objects that + * have been created or modified by legacy APIs. + */ + catalogV1Ids?: Square.CatalogV1Id[]; + /** + * If `true`, this object is present at all locations (including future locations), except where specified in + * the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + * except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + */ + presentAtAllLocations?: boolean; + /** + * A list of locations where the object is present, even if `present_at_all_locations` is `false`. + * This can include locations that are deactivated. + */ + presentAtLocationIds?: string[]; + /** + * A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + * This can include locations that are deactivated. + */ + absentAtLocationIds?: string[]; + /** Identifies the `CatalogImage` attached to this `CatalogObject`. */ + imageId?: string; +} diff --git a/src/api/types/CatalogObjectBatch.ts b/src/api/types/CatalogObjectBatch.ts new file mode 100644 index 000000000..e64670b38 --- /dev/null +++ b/src/api/types/CatalogObjectBatch.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A batch of catalog objects. + */ +export interface CatalogObjectBatch { + /** A list of CatalogObjects belonging to this batch. */ + objects: Square.CatalogObject[]; +} diff --git a/src/api/types/CatalogObjectCategory.ts b/src/api/types/CatalogObjectCategory.ts new file mode 100644 index 000000000..1f73ec2e7 --- /dev/null +++ b/src/api/types/CatalogObjectCategory.ts @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A category that can be assigned to an item or a parent category that can be assigned + * to another category. For example, a clothing category can be assigned to a t-shirt item or + * be made as the parent category to the pants category. + */ +export interface CatalogObjectCategory { + /** The ID of the object's category. */ + id?: string; + /** The order of the object within the context of the category. */ + ordinal?: bigint | null; + /** Structured data for a `CatalogCategory`, set for CatalogObjects of type `CATEGORY`. */ + categoryData?: Square.CatalogCategory; + /** + * Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` + * would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. + */ + updatedAt?: string; + /** + * The version of the object. When updating an object, the version supplied + * must match the version in the database, otherwise the write will be rejected as conflicting. + */ + version?: bigint; + /** + * If `true`, the object has been deleted from the database. Must be `false` for new objects + * being inserted. When deleted, the `updated_at` field will equal the deletion time. + */ + isDeleted?: boolean; + /** + * A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair + * is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute + * value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) + * object defined by the application making the request. + * + * If the `CatalogCustomAttributeDefinition` object is + * defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by + * the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of + * `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` + * if the application making the request is different from the application defining the custom attribute definition. + * Otherwise, the key used in the map is simply `"cocoa_brand"`. + * + * Application-defined custom attributes are set at a global (location-independent) level. + * Custom attribute values are intended to store additional information about a catalog object + * or associations with an entity in another system. Do not use custom attributes + * to store any sensitive information (personally identifiable information, card details, etc.). + */ + customAttributeValues?: Record; + /** + * The Connect v1 IDs for this object at each location where it is present, where they + * differ from the object's Connect V2 ID. The field will only be present for objects that + * have been created or modified by legacy APIs. + */ + catalogV1Ids?: Square.CatalogV1Id[]; + /** + * If `true`, this object is present at all locations (including future locations), except where specified in + * the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), + * except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. + */ + presentAtAllLocations?: boolean; + /** + * A list of locations where the object is present, even if `present_at_all_locations` is `false`. + * This can include locations that are deactivated. + */ + presentAtLocationIds?: string[]; + /** + * A list of locations where the object is not present, even if `present_at_all_locations` is `true`. + * This can include locations that are deactivated. + */ + absentAtLocationIds?: string[]; + /** Identifies the `CatalogImage` attached to this `CatalogObject`. */ + imageId?: string; +} diff --git a/src/api/types/CatalogObjectCheckoutLink.ts b/src/api/types/CatalogObjectCheckoutLink.ts new file mode 100644 index 000000000..5cedaec77 --- /dev/null +++ b/src/api/types/CatalogObjectCheckoutLink.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectCheckoutLink extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectComponent.ts b/src/api/types/CatalogObjectComponent.ts new file mode 100644 index 000000000..7c778c47f --- /dev/null +++ b/src/api/types/CatalogObjectComponent.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectComponent extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectComposition.ts b/src/api/types/CatalogObjectComposition.ts new file mode 100644 index 000000000..209d2129d --- /dev/null +++ b/src/api/types/CatalogObjectComposition.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectComposition extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectCustomAttributeDefinition.ts b/src/api/types/CatalogObjectCustomAttributeDefinition.ts new file mode 100644 index 000000000..90777ecf4 --- /dev/null +++ b/src/api/types/CatalogObjectCustomAttributeDefinition.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectCustomAttributeDefinition extends Square.CatalogObjectBase { + /** Structured data for a `CatalogCustomAttributeDefinition`, set for CatalogObjects of type `CUSTOM_ATTRIBUTE_DEFINITION`. */ + customAttributeDefinitionData?: Square.CatalogCustomAttributeDefinition; +} diff --git a/src/api/types/CatalogObjectDiningOption.ts b/src/api/types/CatalogObjectDiningOption.ts new file mode 100644 index 000000000..155d833e8 --- /dev/null +++ b/src/api/types/CatalogObjectDiningOption.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectDiningOption extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectDiscount.ts b/src/api/types/CatalogObjectDiscount.ts new file mode 100644 index 000000000..cd8623cbb --- /dev/null +++ b/src/api/types/CatalogObjectDiscount.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectDiscount extends Square.CatalogObjectBase { + /** Structured data for a `CatalogDiscount`, set for CatalogObjects of type `DISCOUNT`. */ + discountData?: Square.CatalogDiscount; +} diff --git a/src/api/types/CatalogObjectImage.ts b/src/api/types/CatalogObjectImage.ts new file mode 100644 index 000000000..85ee6f5d7 --- /dev/null +++ b/src/api/types/CatalogObjectImage.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectImage extends Square.CatalogObjectBase { + /** Structured data for a `CatalogImage`, set for CatalogObjects of type `IMAGE`. */ + imageData?: Square.CatalogImage; +} diff --git a/src/api/types/CatalogObjectItem.ts b/src/api/types/CatalogObjectItem.ts new file mode 100644 index 000000000..041ad742e --- /dev/null +++ b/src/api/types/CatalogObjectItem.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectItem extends Square.CatalogObjectBase { + /** Structured data for a `CatalogItem`, set for CatalogObjects of type `ITEM`. */ + itemData?: Square.CatalogItem; +} diff --git a/src/api/types/CatalogObjectItemOption.ts b/src/api/types/CatalogObjectItemOption.ts new file mode 100644 index 000000000..aa14a0a27 --- /dev/null +++ b/src/api/types/CatalogObjectItemOption.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectItemOption extends Square.CatalogObjectBase { + /** Structured data for a `CatalogItemOption`, set for CatalogObjects of type `ITEM_OPTION`. */ + itemOptionData?: Square.CatalogItemOption; +} diff --git a/src/api/types/CatalogObjectItemOptionValue.ts b/src/api/types/CatalogObjectItemOptionValue.ts new file mode 100644 index 000000000..e2538bd44 --- /dev/null +++ b/src/api/types/CatalogObjectItemOptionValue.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectItemOptionValue extends Square.CatalogObjectBase { + /** Structured data for a `CatalogItemOptionValue`, set for CatalogObjects of type `ITEM_OPTION_VAL`. */ + itemOptionValueData?: Square.CatalogItemOptionValue; +} diff --git a/src/api/types/CatalogObjectItemVariation.ts b/src/api/types/CatalogObjectItemVariation.ts new file mode 100644 index 000000000..e3db4f88e --- /dev/null +++ b/src/api/types/CatalogObjectItemVariation.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectItemVariation extends Square.CatalogObjectBase { + /** Structured data for a `CatalogItemVariation`, set for CatalogObjects of type `ITEM_VARIATION`. */ + itemVariationData?: Square.CatalogItemVariation; +} diff --git a/src/api/types/CatalogObjectMeasurementUnit.ts b/src/api/types/CatalogObjectMeasurementUnit.ts new file mode 100644 index 000000000..617db0199 --- /dev/null +++ b/src/api/types/CatalogObjectMeasurementUnit.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectMeasurementUnit extends Square.CatalogObjectBase { + /** Structured data for a `CatalogMeasurementUnit`, set for CatalogObjects of type `MEASUREMENT_UNIT`. */ + measurementUnitData?: Square.CatalogMeasurementUnit; +} diff --git a/src/api/types/CatalogObjectModifier.ts b/src/api/types/CatalogObjectModifier.ts new file mode 100644 index 000000000..4035903a2 --- /dev/null +++ b/src/api/types/CatalogObjectModifier.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectModifier extends Square.CatalogObjectBase { + /** Structured data for a `CatalogModifier`, set for CatalogObjects of type `MODIFIER`. */ + modifierData?: Square.CatalogModifier; +} diff --git a/src/api/types/CatalogObjectModifierList.ts b/src/api/types/CatalogObjectModifierList.ts new file mode 100644 index 000000000..ba19d39a3 --- /dev/null +++ b/src/api/types/CatalogObjectModifierList.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectModifierList extends Square.CatalogObjectBase { + /** Structured data for a `CatalogModifierList`, set for CatalogObjects of type `MODIFIER_LIST`. */ + modifierListData?: Square.CatalogModifierList; +} diff --git a/src/api/types/CatalogObjectPricingRule.ts b/src/api/types/CatalogObjectPricingRule.ts new file mode 100644 index 000000000..7ebc2203b --- /dev/null +++ b/src/api/types/CatalogObjectPricingRule.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectPricingRule extends Square.CatalogObjectBase { + /** + * Structured data for a `CatalogPricingRule`, set for CatalogObjects of type `PRICING_RULE`. + * A `CatalogPricingRule` object often works with a `CatalogProductSet` object or a `CatalogTimePeriod` object. + */ + pricingRuleData?: Square.CatalogPricingRule; +} diff --git a/src/api/types/CatalogObjectProductSet.ts b/src/api/types/CatalogObjectProductSet.ts new file mode 100644 index 000000000..8a8ac48d0 --- /dev/null +++ b/src/api/types/CatalogObjectProductSet.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectProductSet extends Square.CatalogObjectBase { + /** Structured data for a `CatalogProductSet`, set for CatalogObjects of type `PRODUCT_SET`. */ + productSetData?: Square.CatalogProductSet; +} diff --git a/src/api/types/CatalogObjectQuickAmountsSettings.ts b/src/api/types/CatalogObjectQuickAmountsSettings.ts new file mode 100644 index 000000000..96dfaae14 --- /dev/null +++ b/src/api/types/CatalogObjectQuickAmountsSettings.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectQuickAmountsSettings extends Square.CatalogObjectBase { + /** Structured data for a `CatalogQuickAmountsSettings`, set for CatalogObjects of type `QUICK_AMOUNTS_SETTINGS`. */ + quickAmountsSettingsData?: Square.CatalogQuickAmountsSettings; +} diff --git a/src/api/types/CatalogObjectReference.ts b/src/api/types/CatalogObjectReference.ts new file mode 100644 index 000000000..bae12f831 --- /dev/null +++ b/src/api/types/CatalogObjectReference.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A reference to a Catalog object at a specific version. In general this is + * used as an entry point into a graph of catalog objects, where the objects exist + * at a specific version. + */ +export interface CatalogObjectReference { + /** The ID of the referenced object. */ + objectId?: string | null; + /** The version of the object. */ + catalogVersion?: bigint | null; +} diff --git a/src/api/types/CatalogObjectResource.ts b/src/api/types/CatalogObjectResource.ts new file mode 100644 index 000000000..ba711885b --- /dev/null +++ b/src/api/types/CatalogObjectResource.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectResource extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectServiceCharge.ts b/src/api/types/CatalogObjectServiceCharge.ts new file mode 100644 index 000000000..6adc924c0 --- /dev/null +++ b/src/api/types/CatalogObjectServiceCharge.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectServiceCharge extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectSubscriptionPlan.ts b/src/api/types/CatalogObjectSubscriptionPlan.ts new file mode 100644 index 000000000..cc8f91f21 --- /dev/null +++ b/src/api/types/CatalogObjectSubscriptionPlan.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectSubscriptionPlan extends Square.CatalogObjectBase { + /** Structured data for a `CatalogSubscriptionPlan`, set for CatalogObjects of type `SUBSCRIPTION_PLAN`. */ + subscriptionPlanData?: Square.CatalogSubscriptionPlan; +} diff --git a/src/api/types/CatalogObjectSubscriptionProduct.ts b/src/api/types/CatalogObjectSubscriptionProduct.ts new file mode 100644 index 000000000..5cfbac881 --- /dev/null +++ b/src/api/types/CatalogObjectSubscriptionProduct.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectSubscriptionProduct extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectTax.ts b/src/api/types/CatalogObjectTax.ts new file mode 100644 index 000000000..9bd1f77c9 --- /dev/null +++ b/src/api/types/CatalogObjectTax.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectTax extends Square.CatalogObjectBase { + /** Structured data for a `CatalogTax`, set for CatalogObjects of type `TAX`. */ + taxData?: Square.CatalogTax; +} diff --git a/src/api/types/CatalogObjectTaxExemption.ts b/src/api/types/CatalogObjectTaxExemption.ts new file mode 100644 index 000000000..24ce54d3f --- /dev/null +++ b/src/api/types/CatalogObjectTaxExemption.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectTaxExemption extends Square.CatalogObjectBase {} diff --git a/src/api/types/CatalogObjectTimePeriod.ts b/src/api/types/CatalogObjectTimePeriod.ts new file mode 100644 index 000000000..7e550db1a --- /dev/null +++ b/src/api/types/CatalogObjectTimePeriod.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CatalogObjectTimePeriod extends Square.CatalogObjectBase { + /** Structured data for a `CatalogTimePeriod`, set for CatalogObjects of type `TIME_PERIOD`. */ + timePeriodData?: Square.CatalogTimePeriod; +} diff --git a/src/api/types/CatalogObjectType.ts b/src/api/types/CatalogObjectType.ts new file mode 100644 index 000000000..65f04fa5d --- /dev/null +++ b/src/api/types/CatalogObjectType.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Possible types of CatalogObjects returned from the catalog, each + * containing type-specific properties in the `*_data` field corresponding to the specified object type. + */ +export type CatalogObjectType = + | "ITEM" + | "IMAGE" + | "CATEGORY" + | "ITEM_VARIATION" + | "TAX" + | "DISCOUNT" + | "MODIFIER_LIST" + | "MODIFIER" + | "PRICING_RULE" + | "PRODUCT_SET" + | "TIME_PERIOD" + | "MEASUREMENT_UNIT" + | "SUBSCRIPTION_PLAN_VARIATION" + | "ITEM_OPTION" + | "ITEM_OPTION_VAL" + | "CUSTOM_ATTRIBUTE_DEFINITION" + | "QUICK_AMOUNTS_SETTINGS" + | "SUBSCRIPTION_PLAN" + | "AVAILABILITY_PERIOD"; +export const CatalogObjectType = { + Item: "ITEM", + Image: "IMAGE", + Category: "CATEGORY", + ItemVariation: "ITEM_VARIATION", + Tax: "TAX", + Discount: "DISCOUNT", + ModifierList: "MODIFIER_LIST", + Modifier: "MODIFIER", + PricingRule: "PRICING_RULE", + ProductSet: "PRODUCT_SET", + TimePeriod: "TIME_PERIOD", + MeasurementUnit: "MEASUREMENT_UNIT", + SubscriptionPlanVariation: "SUBSCRIPTION_PLAN_VARIATION", + ItemOption: "ITEM_OPTION", + ItemOptionVal: "ITEM_OPTION_VAL", + CustomAttributeDefinition: "CUSTOM_ATTRIBUTE_DEFINITION", + QuickAmountsSettings: "QUICK_AMOUNTS_SETTINGS", + SubscriptionPlan: "SUBSCRIPTION_PLAN", + AvailabilityPeriod: "AVAILABILITY_PERIOD", +} as const; diff --git a/src/api/types/CatalogPricingRule.ts b/src/api/types/CatalogPricingRule.ts new file mode 100644 index 000000000..7097f093e --- /dev/null +++ b/src/api/types/CatalogPricingRule.ts @@ -0,0 +1,88 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines how discounts are automatically applied to a set of items that match the pricing rule + * during the active time period. + */ +export interface CatalogPricingRule { + /** + * User-defined name for the pricing rule. For example, "Buy one get one + * free" or "10% off". + */ + name?: string | null; + /** + * A list of unique IDs for the catalog time periods when + * this pricing rule is in effect. If left unset, the pricing rule is always + * in effect. + */ + timePeriodIds?: string[] | null; + /** + * Unique ID for the `CatalogDiscount` to take off + * the price of all matched items. + */ + discountId?: string | null; + /** + * Unique ID for the `CatalogProductSet` that will be matched by this rule. A match rule + * matches within the entire cart, and can match multiple times. This field will always be set. + */ + matchProductsId?: string | null; + /** + * __Deprecated__: Please use the `exclude_products_id` field to apply + * an exclude set instead. Exclude sets allow better control over quantity + * ranges and offer more flexibility for which matched items receive a discount. + * + * `CatalogProductSet` to apply the pricing to. + * An apply rule matches within the subset of the cart that fits the match rules (the match set). + * An apply rule can only match once in the match set. + * If not supplied, the pricing will be applied to all products in the match set. + * Other products retain their base price, or a price generated by other rules. + */ + applyProductsId?: string | null; + /** + * `CatalogProductSet` to exclude from the pricing rule. + * An exclude rule matches within the subset of the cart that fits the match rules (the match set). + * An exclude rule can only match once in the match set. + * If not supplied, the pricing will be applied to all products in the match set. + * Other products retain their base price, or a price generated by other rules. + */ + excludeProductsId?: string | null; + /** Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD). */ + validFromDate?: string | null; + /** + * Represents the local time the pricing rule should be valid from. Represented in RFC 3339 partial-time format + * (HH:MM:SS). Partial seconds will be truncated. + */ + validFromLocalTime?: string | null; + /** Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD). */ + validUntilDate?: string | null; + /** + * Represents the local time the pricing rule should be valid until. Represented in RFC 3339 partial-time format + * (HH:MM:SS). Partial seconds will be truncated. + */ + validUntilLocalTime?: string | null; + /** + * If an `exclude_products_id` was given, controls which subset of matched + * products is excluded from any discounts. + * + * Default value: `LEAST_EXPENSIVE` + * See [ExcludeStrategy](#type-excludestrategy) for possible values + */ + excludeStrategy?: Square.ExcludeStrategy; + /** + * The minimum order subtotal (before discounts or taxes are applied) + * that must be met before this rule may be applied. + */ + minimumOrderSubtotalMoney?: Square.Money; + /** + * A list of IDs of customer groups, the members of which are eligible for discounts specified in this pricing rule. + * Notice that a group ID is generated by the Customers API. + * If this field is not set, the specified discount applies to matched products sold to anyone whether the buyer + * has a customer profile created or not. If this `customer_group_ids_any` field is set, the specified discount + * applies only to matched products sold to customers belonging to the specified customer groups. + */ + customerGroupIdsAny?: string[] | null; +} diff --git a/src/api/types/CatalogPricingType.ts b/src/api/types/CatalogPricingType.ts new file mode 100644 index 000000000..e1fb68180 --- /dev/null +++ b/src/api/types/CatalogPricingType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. + */ +export type CatalogPricingType = "FIXED_PRICING" | "VARIABLE_PRICING"; +export const CatalogPricingType = { + FixedPricing: "FIXED_PRICING", + VariablePricing: "VARIABLE_PRICING", +} as const; diff --git a/src/api/types/CatalogProductSet.ts b/src/api/types/CatalogProductSet.ts new file mode 100644 index 000000000..af45500a6 --- /dev/null +++ b/src/api/types/CatalogProductSet.ts @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a collection of catalog objects for the purpose of applying a + * `PricingRule`. Including a catalog object will include all of its subtypes. + * For example, including a category in a product set will include all of its + * items and associated item variations in the product set. Including an item in + * a product set will also include its item variations. + */ +export interface CatalogProductSet { + /** + * User-defined name for the product set. For example, "Clearance Items" + * or "Winter Sale Items". + */ + name?: string | null; + /** + * Unique IDs for any `CatalogObject` included in this product set. Any + * number of these catalog objects can be in an order for a pricing rule to apply. + * + * This can be used with `product_ids_all` in a parent `CatalogProductSet` to + * match groups of products for a bulk discount, such as a discount for an + * entree and side combo. + * + * Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. + * + * Max: 500 catalog object IDs. + */ + productIdsAny?: string[] | null; + /** + * Unique IDs for any `CatalogObject` included in this product set. + * All objects in this set must be included in an order for a pricing rule to apply. + * + * Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. + * + * Max: 500 catalog object IDs. + */ + productIdsAll?: string[] | null; + /** + * If set, there must be exactly this many items from `products_any` or `products_all` + * in the cart for the discount to apply. + * + * Cannot be combined with either `quantity_min` or `quantity_max`. + */ + quantityExact?: bigint | null; + /** + * If set, there must be at least this many items from `products_any` or `products_all` + * in a cart for the discount to apply. See `quantity_exact`. Defaults to 0 if + * `quantity_exact`, `quantity_min` and `quantity_max` are all unspecified. + */ + quantityMin?: bigint | null; + /** + * If set, the pricing rule will apply to a maximum of this many items from + * `products_any` or `products_all`. + */ + quantityMax?: bigint | null; + /** + * If set to `true`, the product set will include every item in the catalog. + * Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. + */ + allProducts?: boolean | null; +} diff --git a/src/api/types/CatalogQuery.ts b/src/api/types/CatalogQuery.ts new file mode 100644 index 000000000..e4e09f74f --- /dev/null +++ b/src/api/types/CatalogQuery.ts @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint. + * + * Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). + * Any combination of the following types may be used together: + * - [exact_query](entity:CatalogQueryExact) + * - [prefix_query](entity:CatalogQueryPrefix) + * - [range_query](entity:CatalogQueryRange) + * - [sorted_attribute_query](entity:CatalogQuerySortedAttribute) + * - [text_query](entity:CatalogQueryText) + * + * All other query types cannot be combined with any others. + * + * When a query filter is based on an attribute, the attribute must be searchable. + * Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters. + * + * Searchable attribute and objects queryable by searchable attributes: + * - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue` + * - `description`: `CatalogItem`, `CatalogItemOptionValue` + * - `abbreviation`: `CatalogItem` + * - `upc`: `CatalogItemVariation` + * - `sku`: `CatalogItemVariation` + * - `caption`: `CatalogImage` + * - `display_name`: `CatalogItemOption` + * + * For example, to search for [CatalogItem](entity:CatalogItem) objects by searchable attributes, you can use + * the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter. + */ +export interface CatalogQuery { + /** A query expression to sort returned query result by the given attribute. */ + sortedAttributeQuery?: Square.CatalogQuerySortedAttribute; + /** + * An exact query expression to return objects with attribute name and value + * matching the specified attribute name and value exactly. Value matching is case insensitive. + */ + exactQuery?: Square.CatalogQueryExact; + /** + * A set query expression to return objects with attribute name and value + * matching the specified attribute name and any of the specified attribute values exactly. + * Value matching is case insensitive. + */ + setQuery?: Square.CatalogQuerySet; + /** + * A prefix query expression to return objects with attribute values + * that have a prefix matching the specified string value. Value matching is case insensitive. + */ + prefixQuery?: Square.CatalogQueryPrefix; + /** + * A range query expression to return objects with numeric values + * that lie in the specified range. + */ + rangeQuery?: Square.CatalogQueryRange; + /** + * A text query expression to return objects whose searchable attributes contain all of the given + * keywords, irrespective of their order. For example, if a `CatalogItem` contains custom attribute values of + * `{"name": "t-shirt"}` and `{"description": "Small, Purple"}`, the query filter of `{"keywords": ["shirt", "sma", "purp"]}` + * returns this item. + */ + textQuery?: Square.CatalogQueryText; + /** A query expression to return items that have any of the specified taxes (as identified by the corresponding `CatalogTax` object IDs) enabled. */ + itemsForTaxQuery?: Square.CatalogQueryItemsForTax; + /** A query expression to return items that have any of the given modifier list (as identified by the corresponding `CatalogModifierList`s IDs) enabled. */ + itemsForModifierListQuery?: Square.CatalogQueryItemsForModifierList; + /** A query expression to return items that contains the specified item options (as identified the corresponding `CatalogItemOption` IDs). */ + itemsForItemOptionsQuery?: Square.CatalogQueryItemsForItemOptions; + /** + * A query expression to return item variations (of the [CatalogItemVariation](entity:CatalogItemVariation) type) that + * contain all of the specified `CatalogItemOption` IDs. + */ + itemVariationsForItemOptionValuesQuery?: Square.CatalogQueryItemVariationsForItemOptionValues; +} diff --git a/src/api/types/CatalogQueryExact.ts b/src/api/types/CatalogQueryExact.ts new file mode 100644 index 000000000..762749a7d --- /dev/null +++ b/src/api/types/CatalogQueryExact.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the search result by exact match of the specified attribute name and value. + */ +export interface CatalogQueryExact { + /** The name of the attribute to be searched. Matching of the attribute name is exact. */ + attributeName: string; + /** + * The desired value of the search attribute. Matching of the attribute value is case insensitive and can be partial. + * For example, if a specified value of "sma", objects with the named attribute value of "Small", "small" are both matched. + */ + attributeValue: string; +} diff --git a/src/api/types/CatalogQueryItemVariationsForItemOptionValues.ts b/src/api/types/CatalogQueryItemVariationsForItemOptionValues.ts new file mode 100644 index 000000000..9f3a4f122 --- /dev/null +++ b/src/api/types/CatalogQueryItemVariationsForItemOptionValues.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the item variations containing the specified item option value IDs. + */ +export interface CatalogQueryItemVariationsForItemOptionValues { + /** + * A set of `CatalogItemOptionValue` IDs to be used to find associated + * `CatalogItemVariation`s. All ItemVariations that contain all of the given + * Item Option Values (in any order) will be returned. + */ + itemOptionValueIds?: string[] | null; +} diff --git a/src/api/types/CatalogQueryItemsForItemOptions.ts b/src/api/types/CatalogQueryItemsForItemOptions.ts new file mode 100644 index 000000000..39e525afb --- /dev/null +++ b/src/api/types/CatalogQueryItemsForItemOptions.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the items containing the specified item option IDs. + */ +export interface CatalogQueryItemsForItemOptions { + /** + * A set of `CatalogItemOption` IDs to be used to find associated + * `CatalogItem`s. All Items that contain all of the given Item Options (in any order) + * will be returned. + */ + itemOptionIds?: string[] | null; +} diff --git a/src/api/types/CatalogQueryItemsForModifierList.ts b/src/api/types/CatalogQueryItemsForModifierList.ts new file mode 100644 index 000000000..b1b539be4 --- /dev/null +++ b/src/api/types/CatalogQueryItemsForModifierList.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the items containing the specified modifier list IDs. + */ +export interface CatalogQueryItemsForModifierList { + /** A set of `CatalogModifierList` IDs to be used to find associated `CatalogItem`s. */ + modifierListIds: string[]; +} diff --git a/src/api/types/CatalogQueryItemsForTax.ts b/src/api/types/CatalogQueryItemsForTax.ts new file mode 100644 index 000000000..74186305a --- /dev/null +++ b/src/api/types/CatalogQueryItemsForTax.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the items containing the specified tax IDs. + */ +export interface CatalogQueryItemsForTax { + /** A set of `CatalogTax` IDs to be used to find associated `CatalogItem`s. */ + taxIds: string[]; +} diff --git a/src/api/types/CatalogQueryPrefix.ts b/src/api/types/CatalogQueryPrefix.ts new file mode 100644 index 000000000..a834d4c3d --- /dev/null +++ b/src/api/types/CatalogQueryPrefix.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the search result whose named attribute values are prefixed by the specified attribute value. + */ +export interface CatalogQueryPrefix { + /** The name of the attribute to be searched. */ + attributeName: string; + /** The desired prefix of the search attribute value. */ + attributePrefix: string; +} diff --git a/src/api/types/CatalogQueryRange.ts b/src/api/types/CatalogQueryRange.ts new file mode 100644 index 000000000..c1a96a683 --- /dev/null +++ b/src/api/types/CatalogQueryRange.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the search result whose named attribute values fall between the specified range. + */ +export interface CatalogQueryRange { + /** The name of the attribute to be searched. */ + attributeName: string; + /** The desired minimum value for the search attribute (inclusive). */ + attributeMinValue?: bigint | null; + /** The desired maximum value for the search attribute (inclusive). */ + attributeMaxValue?: bigint | null; +} diff --git a/src/api/types/CatalogQuerySet.ts b/src/api/types/CatalogQuerySet.ts new file mode 100644 index 000000000..316819065 --- /dev/null +++ b/src/api/types/CatalogQuerySet.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the search result(s) by exact match of the specified `attribute_name` and any of + * the `attribute_values`. + */ +export interface CatalogQuerySet { + /** The name of the attribute to be searched. Matching of the attribute name is exact. */ + attributeName: string; + /** + * The desired values of the search attribute. Matching of the attribute values is exact and case insensitive. + * A maximum of 250 values may be searched in a request. + */ + attributeValues: string[]; +} diff --git a/src/api/types/CatalogQuerySortedAttribute.ts b/src/api/types/CatalogQuerySortedAttribute.ts new file mode 100644 index 000000000..44807e89f --- /dev/null +++ b/src/api/types/CatalogQuerySortedAttribute.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The query expression to specify the key to sort search results. + */ +export interface CatalogQuerySortedAttribute { + /** The attribute whose value is used as the sort key. */ + attributeName: string; + /** + * The first attribute value to be returned by the query. Ascending sorts will return only + * objects with this value or greater, while descending sorts will return only objects with this value + * or less. If unset, start at the beginning (for ascending sorts) or end (for descending sorts). + */ + initialAttributeValue?: string | null; + /** + * The desired sort order, `"ASC"` (ascending) or `"DESC"` (descending). + * See [SortOrder](#type-sortorder) for possible values + */ + sortOrder?: Square.SortOrder; +} diff --git a/src/api/types/CatalogQueryText.ts b/src/api/types/CatalogQueryText.ts new file mode 100644 index 000000000..166de4c8a --- /dev/null +++ b/src/api/types/CatalogQueryText.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The query filter to return the search result whose searchable attribute values contain all of the specified keywords or tokens, independent of the token order or case. + */ +export interface CatalogQueryText { + /** A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 alphanumeric characters are ignored. */ + keywords: string[]; +} diff --git a/src/api/types/CatalogQuickAmount.ts b/src/api/types/CatalogQuickAmount.ts new file mode 100644 index 000000000..8771b7c83 --- /dev/null +++ b/src/api/types/CatalogQuickAmount.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a Quick Amount in the Catalog. + */ +export interface CatalogQuickAmount { + /** + * Represents the type of the Quick Amount. + * See [CatalogQuickAmountType](#type-catalogquickamounttype) for possible values + */ + type: Square.CatalogQuickAmountType; + /** Represents the actual amount of the Quick Amount with Money type. */ + amount: Square.Money; + /** + * Describes the ranking of the Quick Amount provided by machine learning model, in the range [0, 100]. + * MANUAL type amount will always have score = 100. + */ + score?: bigint | null; + /** The order in which this Quick Amount should be displayed. */ + ordinal?: bigint | null; +} diff --git a/src/api/types/CatalogQuickAmountType.ts b/src/api/types/CatalogQuickAmountType.ts new file mode 100644 index 000000000..5cc618fa9 --- /dev/null +++ b/src/api/types/CatalogQuickAmountType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Determines the type of a specific Quick Amount. + */ +export type CatalogQuickAmountType = "QUICK_AMOUNT_TYPE_MANUAL" | "QUICK_AMOUNT_TYPE_AUTO"; +export const CatalogQuickAmountType = { + QuickAmountTypeManual: "QUICK_AMOUNT_TYPE_MANUAL", + QuickAmountTypeAuto: "QUICK_AMOUNT_TYPE_AUTO", +} as const; diff --git a/src/api/types/CatalogQuickAmountsSettings.ts b/src/api/types/CatalogQuickAmountsSettings.ts new file mode 100644 index 000000000..f10fa63d9 --- /dev/null +++ b/src/api/types/CatalogQuickAmountsSettings.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts. + */ +export interface CatalogQuickAmountsSettings { + /** + * Represents the option seller currently uses on Quick Amounts. + * See [CatalogQuickAmountsSettingsOption](#type-catalogquickamountssettingsoption) for possible values + */ + option: Square.CatalogQuickAmountsSettingsOption; + /** + * Represents location's eligibility for auto amounts + * The boolean should be consistent with whether there are AUTO amounts in the `amounts`. + */ + eligibleForAutoAmounts?: boolean | null; + /** Represents a set of Quick Amounts at this location. */ + amounts?: Square.CatalogQuickAmount[] | null; +} diff --git a/src/api/types/CatalogQuickAmountsSettingsOption.ts b/src/api/types/CatalogQuickAmountsSettingsOption.ts new file mode 100644 index 000000000..e25228ade --- /dev/null +++ b/src/api/types/CatalogQuickAmountsSettingsOption.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Determines a seller's option on Quick Amounts feature. + */ +export type CatalogQuickAmountsSettingsOption = "DISABLED" | "MANUAL" | "AUTO"; +export const CatalogQuickAmountsSettingsOption = { + Disabled: "DISABLED", + Manual: "MANUAL", + Auto: "AUTO", +} as const; diff --git a/src/api/types/CatalogStockConversion.ts b/src/api/types/CatalogStockConversion.ts new file mode 100644 index 000000000..2293c944f --- /dev/null +++ b/src/api/types/CatalogStockConversion.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the rule of conversion between a stockable [CatalogItemVariation](entity:CatalogItemVariation) + * and a non-stockable sell-by or receive-by `CatalogItemVariation` that + * share the same underlying stock. + */ +export interface CatalogStockConversion { + /** + * References to the stockable [CatalogItemVariation](entity:CatalogItemVariation) + * for this stock conversion. Selling, receiving or recounting the non-stockable `CatalogItemVariation` + * defined with a stock conversion results in adjustments of this stockable `CatalogItemVariation`. + * This immutable field must reference a stockable `CatalogItemVariation` + * that shares the parent [CatalogItem](entity:CatalogItem) of the converted `CatalogItemVariation.` + */ + stockableItemVariationId: string; + /** + * The quantity of the stockable item variation (as identified by `stockable_item_variation_id`) + * equivalent to the non-stockable item variation quantity (as specified in `nonstockable_quantity`) + * as defined by this stock conversion. It accepts a decimal number in a string format that can take + * up to 10 digits before the decimal point and up to 5 digits after the decimal point. + */ + stockableQuantity: string; + /** + * The converted equivalent quantity of the non-stockable [CatalogItemVariation](entity:CatalogItemVariation) + * in its measurement unit. The `stockable_quantity` value and this `nonstockable_quantity` value together + * define the conversion ratio between stockable item variation and the non-stockable item variation. + * It accepts a decimal number in a string format that can take up to 10 digits before the decimal point + * and up to 5 digits after the decimal point. + */ + nonstockableQuantity: string; +} diff --git a/src/api/types/CatalogSubscriptionPlan.ts b/src/api/types/CatalogSubscriptionPlan.ts new file mode 100644 index 000000000..a649ce62e --- /dev/null +++ b/src/api/types/CatalogSubscriptionPlan.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * 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. */ + name: string; + /** + * 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 + */ + phases?: Square.SubscriptionPhase[] | null; + /** The list of subscription plan variations available for this product */ + subscriptionPlanVariations?: Square.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; +} diff --git a/src/api/types/CatalogTax.ts b/src/api/types/CatalogTax.ts new file mode 100644 index 000000000..7333f2886 --- /dev/null +++ b/src/api/types/CatalogTax.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A tax applicable to an item. + */ +export interface CatalogTax { + /** The tax's name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. */ + name?: string | null; + /** + * Whether the tax is calculated based on a payment's subtotal or total. + * See [TaxCalculationPhase](#type-taxcalculationphase) for possible values + */ + calculationPhase?: Square.TaxCalculationPhase; + /** + * Whether the tax is `ADDITIVE` or `INCLUSIVE`. + * See [TaxInclusionType](#type-taxinclusiontype) for possible values + */ + inclusionType?: Square.TaxInclusionType; + /** + * The percentage of the tax in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign. + * A value of `7.5` corresponds to 7.5%. For a location-specific tax rate, contact the tax authority of the location or a tax consultant. + */ + percentage?: string | null; + /** + * If `true`, the fee applies to custom amounts entered into the Square Point of Sale + * app that are not associated with a particular `CatalogItem`. + */ + appliesToCustomAmounts?: boolean | null; + /** A Boolean flag to indicate whether the tax is displayed as enabled (`true`) in the Square Point of Sale app or not (`false`). */ + enabled?: boolean | null; + /** The ID of a `CatalogProductSet` object. If set, the tax is applicable to all products in the product set. */ + appliesToProductSetId?: string | null; +} diff --git a/src/api/types/CatalogTimePeriod.ts b/src/api/types/CatalogTimePeriod.ts new file mode 100644 index 000000000..f93d98fa6 --- /dev/null +++ b/src/api/types/CatalogTimePeriod.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a time period - either a single period or a repeating period. + */ +export interface CatalogTimePeriod { + /** + * An iCalendar (RFC 5545) [event](https://tools.ietf.org/html/rfc5545#section-3.6.1), which + * specifies the name, timing, duration and recurrence of this time period. + * + * Example: + * + * ``` + * DTSTART:20190707T180000 + * DURATION:P2H + * RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR + * ``` + * + * Only `SUMMARY`, `DTSTART`, `DURATION` and `RRULE` fields are supported. + * `DTSTART` must be in local (unzoned) time format. Note that while `BEGIN:VEVENT` + * and `END:VEVENT` is not required in the request. The response will always + * include them. + */ + event?: string | null; +} diff --git a/src/api/types/CatalogV1Id.ts b/src/api/types/CatalogV1Id.ts new file mode 100644 index 000000000..7e8e9b68c --- /dev/null +++ b/src/api/types/CatalogV1Id.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A Square API V1 identifier of an item, including the object ID and its associated location ID. + */ +export interface CatalogV1Id { + /** The ID for an object used in the Square API V1, if the object ID differs from the Square API V2 object ID. */ + catalogV1Id?: string | null; + /** The ID of the `Location` this Connect V1 ID is associated with. */ + locationId?: string | null; +} diff --git a/src/api/types/CategoryPathToRootNode.ts b/src/api/types/CategoryPathToRootNode.ts new file mode 100644 index 000000000..3b8994258 --- /dev/null +++ b/src/api/types/CategoryPathToRootNode.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A node in the path from a retrieved category to its root node. + */ +export interface CategoryPathToRootNode { + /** The category's ID. */ + categoryId?: string | null; + /** The category's name. */ + categoryName?: string | null; +} diff --git a/src/api/types/ChangeBillingAnchorDateResponse.ts b/src/api/types/ChangeBillingAnchorDateResponse.ts new file mode 100644 index 000000000..f05bb0771 --- /dev/null +++ b/src/api/types/ChangeBillingAnchorDateResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a request to the + * [ChangeBillingAnchorDate](api-endpoint:Subscriptions-ChangeBillingAnchorDate) endpoint. + */ +export interface ChangeBillingAnchorDateResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The specified subscription for updating billing anchor date. */ + subscription?: Square.Subscription; + /** A list of a single billing anchor date change for the subscription. */ + actions?: Square.SubscriptionAction[]; +} diff --git a/src/api/types/ChangeTiming.ts b/src/api/types/ChangeTiming.ts new file mode 100644 index 000000000..856c8c36f --- /dev/null +++ b/src/api/types/ChangeTiming.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported timings when a pending change, as an action, takes place to a subscription. + */ +export type ChangeTiming = "IMMEDIATE" | "END_OF_BILLING_CYCLE"; +export const ChangeTiming = { + Immediate: "IMMEDIATE", + EndOfBillingCycle: "END_OF_BILLING_CYCLE", +} as const; diff --git a/src/api/types/ChargeRequestAdditionalRecipient.ts b/src/api/types/ChargeRequestAdditionalRecipient.ts new file mode 100644 index 000000000..86f123eca --- /dev/null +++ b/src/api/types/ChargeRequestAdditionalRecipient.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an additional recipient (other than the merchant) entitled to a portion of the tender. + * Support is currently limited to USD, CAD and GBP currencies + */ +export interface ChargeRequestAdditionalRecipient { + /** The location ID for a recipient (other than the merchant) receiving a portion of the tender. */ + locationId: string; + /** The description of the additional recipient. */ + description: string; + /** The amount of money distributed to the recipient. */ + amountMoney: Square.Money; +} diff --git a/src/api/types/Checkout.ts b/src/api/types/Checkout.ts new file mode 100644 index 000000000..377cb8125 --- /dev/null +++ b/src/api/types/Checkout.ts @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Square Checkout lets merchants accept online payments for supported + * payment types using a checkout workflow hosted on squareup.com. + */ +export interface Checkout { + /** ID generated by Square Checkout when a new checkout is requested. */ + id?: string; + /** + * The URL that the buyer's browser should be redirected to after the + * checkout is completed. + */ + checkoutPageUrl?: string | null; + /** + * If `true`, Square Checkout will collect shipping information on your + * behalf and store that information with the transaction information in your + * Square Dashboard. + * + * Default: `false`. + */ + askForShippingAddress?: boolean | null; + /** + * The email address to display on the Square Checkout confirmation page + * and confirmation email that the buyer can use to contact the merchant. + * + * If this value is not set, the confirmation page and email will display the + * primary email address associated with the merchant's Square account. + * + * Default: none; only exists if explicitly set. + */ + merchantSupportEmail?: string | null; + /** + * If provided, the buyer's email is pre-populated on the checkout page + * as an editable text field. + * + * Default: none; only exists if explicitly set. + */ + prePopulateBuyerEmail?: string | null; + /** + * If provided, the buyer's shipping info is pre-populated on the + * checkout page as editable text fields. + * + * Default: none; only exists if explicitly set. + */ + prePopulateShippingAddress?: Square.Address; + /** + * The URL to redirect to after checkout is completed with `checkoutId`, + * Square's `orderId`, `transactionId`, and `referenceId` appended as URL + * parameters. For example, if the provided redirect_url is + * `http://www.example.com/order-complete`, a successful transaction redirects + * the customer to: + * + *
http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx
+ * + * If you do not provide a redirect URL, Square Checkout will display an order + * confirmation page on your behalf; however Square strongly recommends that + * you provide a redirect URL so you can verify the transaction results and + * finalize the order through your existing/normal confirmation workflow. + */ + redirectUrl?: string | null; + /** Order to be checked out. */ + order?: Square.Order; + /** The time when the checkout was created, in RFC 3339 format. */ + createdAt?: string; + /** + * Additional recipients (other than the merchant) receiving a portion of this checkout. + * For example, fees assessed on the purchase by a third party integration. + */ + additionalRecipients?: Square.AdditionalRecipient[] | null; +} diff --git a/src/api/types/CheckoutLocationSettings.ts b/src/api/types/CheckoutLocationSettings.ts new file mode 100644 index 000000000..5f4ddd1a5 --- /dev/null +++ b/src/api/types/CheckoutLocationSettings.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CheckoutLocationSettings { + /** The ID of the location that these settings apply to. */ + locationId?: string | null; + /** Indicates whether customers are allowed to leave notes at checkout. */ + customerNotesEnabled?: boolean | null; + /** + * Policy information is displayed at the bottom of the checkout pages. + * You can set a maximum of two policies. + */ + policies?: Square.CheckoutLocationSettingsPolicy[] | null; + /** The branding settings for this location. */ + branding?: Square.CheckoutLocationSettingsBranding; + /** The tip settings for this location. */ + tipping?: Square.CheckoutLocationSettingsTipping; + /** The coupon settings for this location. */ + coupons?: Square.CheckoutLocationSettingsCoupons; + /** + * The timestamp when the settings were last updated, in RFC 3339 format. + * Examples for January 25th, 2020 6:25:34pm Pacific Standard Time: + * UTC: 2020-01-26T02:25:34Z + * Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00 + */ + updatedAt?: string; +} diff --git a/src/api/types/CheckoutLocationSettingsBranding.ts b/src/api/types/CheckoutLocationSettingsBranding.ts new file mode 100644 index 000000000..1c87ae6c4 --- /dev/null +++ b/src/api/types/CheckoutLocationSettingsBranding.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CheckoutLocationSettingsBranding { + /** + * Show the location logo on the checkout page. + * See [HeaderType](#type-headertype) for possible values + */ + headerType?: Square.CheckoutLocationSettingsBrandingHeaderType; + /** The HTML-supported hex color for the button on the checkout page (for example, "#FFFFFF"). */ + buttonColor?: string | null; + /** + * The shape of the button on the checkout page. + * See [ButtonShape](#type-buttonshape) for possible values + */ + buttonShape?: Square.CheckoutLocationSettingsBrandingButtonShape; +} diff --git a/src/api/types/CheckoutLocationSettingsBrandingButtonShape.ts b/src/api/types/CheckoutLocationSettingsBrandingButtonShape.ts new file mode 100644 index 000000000..524ef6661 --- /dev/null +++ b/src/api/types/CheckoutLocationSettingsBrandingButtonShape.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type CheckoutLocationSettingsBrandingButtonShape = "SQUARED" | "ROUNDED" | "PILL"; +export const CheckoutLocationSettingsBrandingButtonShape = { + Squared: "SQUARED", + Rounded: "ROUNDED", + Pill: "PILL", +} as const; diff --git a/src/api/types/CheckoutLocationSettingsBrandingHeaderType.ts b/src/api/types/CheckoutLocationSettingsBrandingHeaderType.ts new file mode 100644 index 000000000..cea18d8b9 --- /dev/null +++ b/src/api/types/CheckoutLocationSettingsBrandingHeaderType.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type CheckoutLocationSettingsBrandingHeaderType = "BUSINESS_NAME" | "FRAMED_LOGO" | "FULL_WIDTH_LOGO"; +export const CheckoutLocationSettingsBrandingHeaderType = { + BusinessName: "BUSINESS_NAME", + FramedLogo: "FRAMED_LOGO", + FullWidthLogo: "FULL_WIDTH_LOGO", +} as const; diff --git a/src/api/types/CheckoutLocationSettingsCoupons.ts b/src/api/types/CheckoutLocationSettingsCoupons.ts new file mode 100644 index 000000000..5feeca992 --- /dev/null +++ b/src/api/types/CheckoutLocationSettingsCoupons.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CheckoutLocationSettingsCoupons { + /** Indicates whether coupons are enabled for this location. */ + enabled?: boolean | null; +} diff --git a/src/api/types/CheckoutLocationSettingsPolicy.ts b/src/api/types/CheckoutLocationSettingsPolicy.ts new file mode 100644 index 000000000..3ada5c55e --- /dev/null +++ b/src/api/types/CheckoutLocationSettingsPolicy.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CheckoutLocationSettingsPolicy { + /** A unique ID to identify the policy when making changes. You must set the UID for policy updates, but it’s optional when setting new policies. */ + uid?: string | null; + /** The title of the policy. This is required when setting the description, though you can update it in a different request. */ + title?: string | null; + /** The description of the policy. */ + description?: string | null; +} diff --git a/src/api/types/CheckoutLocationSettingsTipping.ts b/src/api/types/CheckoutLocationSettingsTipping.ts new file mode 100644 index 000000000..5f7bb7342 --- /dev/null +++ b/src/api/types/CheckoutLocationSettingsTipping.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CheckoutLocationSettingsTipping { + /** Set three custom percentage amounts that buyers can select at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more. */ + percentages?: number[] | null; + /** + * Enables Smart Tip Amounts. If Smart Tip Amounts is enabled, tipping works as follows: + * If a transaction is less than $10, the available tipping options include No Tip, $1, $2, or $3. + * If a transaction is $10 or more, the available tipping options include No Tip, 15%, 20%, or 25%. + * You can set custom percentage amounts with the `percentages` field. + */ + smartTippingEnabled?: boolean | null; + /** Set the pre-selected percentage amounts that appear at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more. */ + defaultPercent?: number | null; + /** Show the Smart Tip Amounts for this location. */ + smartTips?: Square.Money[] | null; + /** Set the pre-selected whole amount that appears at checkout when Smart Tip is enabled and the transaction amount is less than $10. */ + defaultSmartTip?: Square.Money; +} diff --git a/src/api/types/CheckoutMerchantSettings.ts b/src/api/types/CheckoutMerchantSettings.ts new file mode 100644 index 000000000..1f28f467a --- /dev/null +++ b/src/api/types/CheckoutMerchantSettings.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CheckoutMerchantSettings { + /** The set of payment methods accepted for the merchant's account. */ + paymentMethods?: Square.CheckoutMerchantSettingsPaymentMethods; + /** + * The timestamp when the settings were last updated, in RFC 3339 format. + * Examples for January 25th, 2020 6:25:34pm Pacific Standard Time: + * UTC: 2020-01-26T02:25:34Z + * Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00 + */ + updatedAt?: string; +} diff --git a/src/api/types/CheckoutMerchantSettingsPaymentMethods.ts b/src/api/types/CheckoutMerchantSettingsPaymentMethods.ts new file mode 100644 index 000000000..586a93755 --- /dev/null +++ b/src/api/types/CheckoutMerchantSettingsPaymentMethods.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CheckoutMerchantSettingsPaymentMethods { + applePay?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; + googlePay?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; + cashApp?: Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod; + afterpayClearpay?: Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay; +} diff --git a/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts b/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts new file mode 100644 index 000000000..f485e9053 --- /dev/null +++ b/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The settings allowed for AfterpayClearpay. + */ +export interface CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay { + /** Afterpay is shown as an option for order totals falling within the configured range. */ + orderEligibilityRange?: Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange; + /** Afterpay is shown as an option for item totals falling within the configured range. */ + itemEligibilityRange?: Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange; + /** Indicates whether the payment method is enabled for the account. */ + enabled?: boolean; +} diff --git a/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts b/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts new file mode 100644 index 000000000..d43e503b5 --- /dev/null +++ b/src/api/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A range of purchase price that qualifies. + */ +export interface CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange { + min: Square.Money; + max: Square.Money; +} diff --git a/src/api/types/CheckoutMerchantSettingsPaymentMethodsPaymentMethod.ts b/src/api/types/CheckoutMerchantSettingsPaymentMethodsPaymentMethod.ts new file mode 100644 index 000000000..9d3522728 --- /dev/null +++ b/src/api/types/CheckoutMerchantSettingsPaymentMethodsPaymentMethod.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The settings allowed for a payment method. + */ +export interface CheckoutMerchantSettingsPaymentMethodsPaymentMethod { + /** Indicates whether the payment method is enabled for the account. */ + enabled?: boolean | null; +} diff --git a/src/api/types/CheckoutOptions.ts b/src/api/types/CheckoutOptions.ts new file mode 100644 index 000000000..0a598f295 --- /dev/null +++ b/src/api/types/CheckoutOptions.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CheckoutOptions { + /** Indicates whether the payment allows tipping. */ + allowTipping?: boolean | null; + /** The custom fields requesting information from the buyer. */ + customFields?: Square.CustomField[] | null; + /** + * The ID of the subscription plan for the buyer to pay and subscribe. + * For more information, see [Subscription Plan Checkout](https://developer.squareup.com/docs/checkout-api/subscription-plan-checkout). + */ + subscriptionPlanId?: string | null; + /** The confirmation page URL to redirect the buyer to after Square processes the payment. */ + redirectUrl?: string | null; + /** The email address that buyers can use to contact the seller. */ + merchantSupportEmail?: string | null; + /** Indicates whether to include the address fields in the payment form. */ + askForShippingAddress?: boolean | null; + /** The methods allowed for buyers during checkout. */ + acceptedPaymentMethods?: Square.AcceptedPaymentMethods; + /** + * The amount of money that the developer is taking as a fee for facilitating the payment on behalf of the seller. + * + * The amount cannot be more than 90% of the total amount of the payment. + * + * The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-monetary-amounts). + * + * The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller. For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). + * + * To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/collect-fees/additional-considerations#permissions). + */ + appFeeMoney?: Square.Money; + /** The fee associated with shipping to be applied to the `Order` as a service charge. */ + shippingFee?: Square.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; +} diff --git a/src/api/types/CheckoutOptionsPaymentType.ts b/src/api/types/CheckoutOptionsPaymentType.ts new file mode 100644 index 000000000..aa1e08cdd --- /dev/null +++ b/src/api/types/CheckoutOptionsPaymentType.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type CheckoutOptionsPaymentType = + | "CARD_PRESENT" + | "MANUAL_CARD_ENTRY" + | "FELICA_ID" + | "FELICA_QUICPAY" + | "FELICA_TRANSPORTATION_GROUP" + | "FELICA_ALL" + | "PAYPAY" + | "QR_CODE"; +export const CheckoutOptionsPaymentType = { + CardPresent: "CARD_PRESENT", + ManualCardEntry: "MANUAL_CARD_ENTRY", + FelicaId: "FELICA_ID", + FelicaQuicpay: "FELICA_QUICPAY", + FelicaTransportationGroup: "FELICA_TRANSPORTATION_GROUP", + FelicaAll: "FELICA_ALL", + Paypay: "PAYPAY", + QrCode: "QR_CODE", +} as const; diff --git a/src/api/types/ClearpayDetails.ts b/src/api/types/ClearpayDetails.ts new file mode 100644 index 000000000..f704dcb5a --- /dev/null +++ b/src/api/types/ClearpayDetails.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Additional details about Clearpay payments. + */ +export interface ClearpayDetails { + /** Email address on the buyer's Clearpay account. */ + emailAddress?: string | null; +} diff --git a/src/api/types/CloneOrderResponse.ts b/src/api/types/CloneOrderResponse.ts new file mode 100644 index 000000000..94e715021 --- /dev/null +++ b/src/api/types/CloneOrderResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [CloneOrder](api-endpoint:Orders-CloneOrder) endpoint. + */ +export interface CloneOrderResponse { + /** The cloned order. */ + order?: Square.Order; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CollectedData.ts b/src/api/types/CollectedData.ts new file mode 100644 index 000000000..0c1544f0a --- /dev/null +++ b/src/api/types/CollectedData.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CollectedData { + /** The buyer's input text. */ + inputText?: string; +} diff --git a/src/api/types/CompletePaymentResponse.ts b/src/api/types/CompletePaymentResponse.ts new file mode 100644 index 000000000..0421416db --- /dev/null +++ b/src/api/types/CompletePaymentResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by[CompletePayment](api-endpoint:Payments-CompletePayment). + */ +export interface CompletePaymentResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The successfully completed payment. */ + payment?: Square.Payment; +} diff --git a/src/api/types/Component.ts b/src/api/types/Component.ts new file mode 100644 index 000000000..d6c9ed530 --- /dev/null +++ b/src/api/types/Component.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The wrapper object for the component entries of a given component type. + */ +export interface Component { + /** + * The type of this component. Each component type has expected properties expressed + * in a structured format within its corresponding `*_details` field. + * See [ComponentType](#type-componenttype) for possible values + */ + type: Square.ComponentComponentType; + /** Structured data for an `Application`, set for Components of type `APPLICATION`. */ + applicationDetails?: Square.DeviceComponentDetailsApplicationDetails; + /** Structured data for a `CardReader`, set for Components of type `CARD_READER`. */ + cardReaderDetails?: Square.DeviceComponentDetailsCardReaderDetails; + /** Structured data for a `Battery`, set for Components of type `BATTERY`. */ + batteryDetails?: Square.DeviceComponentDetailsBatteryDetails; + /** Structured data for a `WiFi` interface, set for Components of type `WIFI`. */ + wifiDetails?: Square.DeviceComponentDetailsWiFiDetails; + /** Structured data for an `Ethernet` interface, set for Components of type `ETHERNET`. */ + ethernetDetails?: Square.DeviceComponentDetailsEthernetDetails; +} diff --git a/src/api/types/ComponentComponentType.ts b/src/api/types/ComponentComponentType.ts new file mode 100644 index 000000000..07a975ad1 --- /dev/null +++ b/src/api/types/ComponentComponentType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enum for ComponentType. + */ +export type ComponentComponentType = "APPLICATION" | "CARD_READER" | "BATTERY" | "WIFI" | "ETHERNET" | "PRINTER"; +export const ComponentComponentType = { + Application: "APPLICATION", + CardReader: "CARD_READER", + Battery: "BATTERY", + Wifi: "WIFI", + Ethernet: "ETHERNET", + Printer: "PRINTER", +} as const; diff --git a/src/api/types/ConfirmationDecision.ts b/src/api/types/ConfirmationDecision.ts new file mode 100644 index 000000000..5fe860a59 --- /dev/null +++ b/src/api/types/ConfirmationDecision.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface ConfirmationDecision { + /** The buyer's decision to the displayed terms. */ + hasAgreed?: boolean; +} diff --git a/src/api/types/ConfirmationOptions.ts b/src/api/types/ConfirmationOptions.ts new file mode 100644 index 000000000..8a5614f98 --- /dev/null +++ b/src/api/types/ConfirmationOptions.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +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; + /** The result of the buyer’s actions when presented with the confirmation screen. */ + decision?: Square.ConfirmationDecision; +} diff --git a/src/api/types/Coordinates.ts b/src/api/types/Coordinates.ts new file mode 100644 index 000000000..ecb15a59a --- /dev/null +++ b/src/api/types/Coordinates.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Latitude and longitude coordinates. + */ +export interface Coordinates { + /** The latitude of the coordinate expressed in degrees. */ + latitude?: number | null; + /** The longitude of the coordinate expressed in degrees. */ + longitude?: number | null; +} diff --git a/src/api/types/Country.ts b/src/api/types/Country.ts new file mode 100644 index 000000000..119c2d9e9 --- /dev/null +++ b/src/api/types/Country.ts @@ -0,0 +1,511 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the country associated with another entity, such as a business. + * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). + */ +export type Country = + | "ZZ" + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; +export const Country = { + Zz: "ZZ", + Ad: "AD", + Ae: "AE", + Af: "AF", + Ag: "AG", + Ai: "AI", + Al: "AL", + Am: "AM", + Ao: "AO", + Aq: "AQ", + Ar: "AR", + As: "AS", + At: "AT", + Au: "AU", + Aw: "AW", + Ax: "AX", + Az: "AZ", + Ba: "BA", + Bb: "BB", + Bd: "BD", + Be: "BE", + Bf: "BF", + Bg: "BG", + Bh: "BH", + Bi: "BI", + Bj: "BJ", + Bl: "BL", + Bm: "BM", + Bn: "BN", + Bo: "BO", + Bq: "BQ", + Br: "BR", + Bs: "BS", + Bt: "BT", + Bv: "BV", + Bw: "BW", + By: "BY", + Bz: "BZ", + Ca: "CA", + Cc: "CC", + Cd: "CD", + Cf: "CF", + Cg: "CG", + Ch: "CH", + Ci: "CI", + Ck: "CK", + Cl: "CL", + Cm: "CM", + Cn: "CN", + Co: "CO", + Cr: "CR", + Cu: "CU", + Cv: "CV", + Cw: "CW", + Cx: "CX", + Cy: "CY", + Cz: "CZ", + De: "DE", + Dj: "DJ", + Dk: "DK", + Dm: "DM", + Do: "DO", + Dz: "DZ", + Ec: "EC", + Ee: "EE", + Eg: "EG", + Eh: "EH", + Er: "ER", + Es: "ES", + Et: "ET", + Fi: "FI", + Fj: "FJ", + Fk: "FK", + Fm: "FM", + Fo: "FO", + Fr: "FR", + Ga: "GA", + Gb: "GB", + Gd: "GD", + Ge: "GE", + Gf: "GF", + Gg: "GG", + Gh: "GH", + Gi: "GI", + Gl: "GL", + Gm: "GM", + Gn: "GN", + Gp: "GP", + Gq: "GQ", + Gr: "GR", + Gs: "GS", + Gt: "GT", + Gu: "GU", + Gw: "GW", + Gy: "GY", + Hk: "HK", + Hm: "HM", + Hn: "HN", + Hr: "HR", + Ht: "HT", + Hu: "HU", + Id: "ID", + Ie: "IE", + Il: "IL", + Im: "IM", + In: "IN", + Io: "IO", + Iq: "IQ", + Ir: "IR", + Is: "IS", + It: "IT", + Je: "JE", + Jm: "JM", + Jo: "JO", + Jp: "JP", + Ke: "KE", + Kg: "KG", + Kh: "KH", + Ki: "KI", + Km: "KM", + Kn: "KN", + Kp: "KP", + Kr: "KR", + Kw: "KW", + Ky: "KY", + Kz: "KZ", + La: "LA", + Lb: "LB", + Lc: "LC", + Li: "LI", + Lk: "LK", + Lr: "LR", + Ls: "LS", + Lt: "LT", + Lu: "LU", + Lv: "LV", + Ly: "LY", + Ma: "MA", + Mc: "MC", + Md: "MD", + Me: "ME", + Mf: "MF", + Mg: "MG", + Mh: "MH", + Mk: "MK", + Ml: "ML", + Mm: "MM", + Mn: "MN", + Mo: "MO", + Mp: "MP", + Mq: "MQ", + Mr: "MR", + Ms: "MS", + Mt: "MT", + Mu: "MU", + Mv: "MV", + Mw: "MW", + Mx: "MX", + My: "MY", + Mz: "MZ", + Na: "NA", + Nc: "NC", + Ne: "NE", + Nf: "NF", + Ng: "NG", + Ni: "NI", + Nl: "NL", + No: "NO", + Np: "NP", + Nr: "NR", + Nu: "NU", + Nz: "NZ", + Om: "OM", + Pa: "PA", + Pe: "PE", + Pf: "PF", + Pg: "PG", + Ph: "PH", + Pk: "PK", + Pl: "PL", + Pm: "PM", + Pn: "PN", + Pr: "PR", + Ps: "PS", + Pt: "PT", + Pw: "PW", + Py: "PY", + Qa: "QA", + Re: "RE", + Ro: "RO", + Rs: "RS", + Ru: "RU", + Rw: "RW", + Sa: "SA", + Sb: "SB", + Sc: "SC", + Sd: "SD", + Se: "SE", + Sg: "SG", + Sh: "SH", + Si: "SI", + Sj: "SJ", + Sk: "SK", + Sl: "SL", + Sm: "SM", + Sn: "SN", + So: "SO", + Sr: "SR", + Ss: "SS", + St: "ST", + Sv: "SV", + Sx: "SX", + Sy: "SY", + Sz: "SZ", + Tc: "TC", + Td: "TD", + Tf: "TF", + Tg: "TG", + Th: "TH", + Tj: "TJ", + Tk: "TK", + Tl: "TL", + Tm: "TM", + Tn: "TN", + To: "TO", + Tr: "TR", + Tt: "TT", + Tv: "TV", + Tw: "TW", + Tz: "TZ", + Ua: "UA", + Ug: "UG", + Um: "UM", + Us: "US", + Uy: "UY", + Uz: "UZ", + Va: "VA", + Vc: "VC", + Ve: "VE", + Vg: "VG", + Vi: "VI", + Vn: "VN", + Vu: "VU", + Wf: "WF", + Ws: "WS", + Ye: "YE", + Yt: "YT", + Za: "ZA", + Zm: "ZM", + Zw: "ZW", +} as const; diff --git a/src/api/types/CreateBookingCustomAttributeDefinitionResponse.ts b/src/api/types/CreateBookingCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..9ddf6dc41 --- /dev/null +++ b/src/api/types/CreateBookingCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CreateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-CreateBookingCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface CreateBookingCustomAttributeDefinitionResponse { + /** The newly created custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateBookingResponse.ts b/src/api/types/CreateBookingResponse.ts new file mode 100644 index 000000000..6926c089a --- /dev/null +++ b/src/api/types/CreateBookingResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreateBookingResponse { + /** The booking that was created. */ + booking?: Square.Booking; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateBreakTypeResponse.ts b/src/api/types/CreateBreakTypeResponse.ts new file mode 100644 index 000000000..f63265cca --- /dev/null +++ b/src/api/types/CreateBreakTypeResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to the request to create a `BreakType`. The response contains + * the created `BreakType` object and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface CreateBreakTypeResponse { + /** The `BreakType` that was created by the request. */ + breakType?: Square.BreakType; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateCardResponse.ts b/src/api/types/CreateCardResponse.ts new file mode 100644 index 000000000..dd2f132be --- /dev/null +++ b/src/api/types/CreateCardResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [CreateCard](api-endpoint:Cards-CreateCard) endpoint. + * + * Note: if there are errors processing the request, the card field will not be + * present. + */ +export interface CreateCardResponse { + /** Errors resulting from the request. */ + errors?: Square.Error_[]; + /** The card created by the request. */ + card?: Square.Card; +} diff --git a/src/api/types/CreateCatalogImageRequest.ts b/src/api/types/CreateCatalogImageRequest.ts new file mode 100644 index 000000000..42a34f4db --- /dev/null +++ b/src/api/types/CreateCatalogImageRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreateCatalogImageRequest { + /** + * A unique string that identifies this CreateCatalogImage request. + * Keys can be any valid string but must be unique for every CreateCatalogImage request. + * + * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + */ + idempotencyKey: string; + /** + * Unique ID of the `CatalogObject` to attach this `CatalogImage` object to. Leave this + * field empty to create unattached images, for example if you are building an integration + * where an image can be attached to catalog items at a later time. + */ + objectId?: string; + /** The new `CatalogObject` of the `IMAGE` type, namely, a `CatalogImage` object, to encapsulate the specified image file. */ + image: Square.CatalogObject; + /** + * If this is set to `true`, the image created will be the primary, or first image of the object referenced by `object_id`. + * If the `CatalogObject` already has a primary `CatalogImage`, setting this field to `true` will replace the primary image. + * If this is set to `false` and you use the Square API version 2021-12-15 or later, the image id will be appended to the list of `image_ids` on the object. + * + * With Square API version 2021-12-15 or later, the default value is `false`. Otherwise, the effective default value is `true`. + */ + isPrimary?: boolean; +} diff --git a/src/api/types/CreateCatalogImageResponse.ts b/src/api/types/CreateCatalogImageResponse.ts new file mode 100644 index 000000000..b8bdff543 --- /dev/null +++ b/src/api/types/CreateCatalogImageResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreateCatalogImageResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The newly created `CatalogImage` including a Square-generated + * URL for the encapsulated image file. + */ + image?: Square.CatalogObject; +} diff --git a/src/api/types/CreateCheckoutResponse.ts b/src/api/types/CreateCheckoutResponse.ts new file mode 100644 index 000000000..d2fd0c058 --- /dev/null +++ b/src/api/types/CreateCheckoutResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `CreateCheckout` endpoint. + */ +export interface CreateCheckoutResponse { + /** The newly created `checkout` object associated with the provided idempotency key. */ + checkout?: Square.Checkout; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateCustomerCardResponse.ts b/src/api/types/CreateCustomerCardResponse.ts new file mode 100644 index 000000000..a44fac41c --- /dev/null +++ b/src/api/types/CreateCustomerCardResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `CreateCustomerCard` endpoint. + * + * Either `errors` or `card` is present in a given response (never both). + */ +export interface CreateCustomerCardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The created card on file. */ + card?: Square.Card; +} diff --git a/src/api/types/CreateCustomerCustomAttributeDefinitionResponse.ts b/src/api/types/CreateCustomerCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..ee62749c2 --- /dev/null +++ b/src/api/types/CreateCustomerCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface CreateCustomerCustomAttributeDefinitionResponse { + /** The new custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateCustomerGroupResponse.ts b/src/api/types/CreateCustomerGroupResponse.ts new file mode 100644 index 000000000..4b2a3c26e --- /dev/null +++ b/src/api/types/CreateCustomerGroupResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [CreateCustomerGroup](api-endpoint:CustomerGroups-CreateCustomerGroup) endpoint. + * + * Either `errors` or `group` is present in a given response (never both). + */ +export interface CreateCustomerGroupResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The successfully created customer group. */ + group?: Square.CustomerGroup; +} diff --git a/src/api/types/CreateCustomerResponse.ts b/src/api/types/CreateCustomerResponse.ts new file mode 100644 index 000000000..c4df8272e --- /dev/null +++ b/src/api/types/CreateCustomerResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [CreateCustomer](api-endpoint:Customers-CreateCustomer) or + * [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint. + * + * Either `errors` or `customer` is present in a given response (never both). + */ +export interface CreateCustomerResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The created customer. */ + customer?: Square.Customer; +} diff --git a/src/api/types/CreateDeviceCodeResponse.ts b/src/api/types/CreateDeviceCodeResponse.ts new file mode 100644 index 000000000..81fc1db4d --- /dev/null +++ b/src/api/types/CreateDeviceCodeResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreateDeviceCodeResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The created DeviceCode object containing the device code string. */ + deviceCode?: Square.DeviceCode; +} diff --git a/src/api/types/CreateDisputeEvidenceFileRequest.ts b/src/api/types/CreateDisputeEvidenceFileRequest.ts new file mode 100644 index 000000000..b618a355f --- /dev/null +++ b/src/api/types/CreateDisputeEvidenceFileRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the parameters for a `CreateDisputeEvidenceFile` request. + */ +export interface CreateDisputeEvidenceFileRequest { + /** A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ + idempotencyKey: string; + /** + * The type of evidence you are uploading. + * See [DisputeEvidenceType](#type-disputeevidencetype) for possible values + */ + evidenceType?: Square.DisputeEvidenceType; + /** + * The MIME type of the uploaded file. + * The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff. + */ + contentType?: string; +} diff --git a/src/api/types/CreateDisputeEvidenceFileResponse.ts b/src/api/types/CreateDisputeEvidenceFileResponse.ts new file mode 100644 index 000000000..8eaae103c --- /dev/null +++ b/src/api/types/CreateDisputeEvidenceFileResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields in a `CreateDisputeEvidenceFile` response. + */ +export interface CreateDisputeEvidenceFileResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The metadata of the newly uploaded dispute evidence. */ + evidence?: Square.DisputeEvidence; +} diff --git a/src/api/types/CreateDisputeEvidenceTextResponse.ts b/src/api/types/CreateDisputeEvidenceTextResponse.ts new file mode 100644 index 000000000..2f5ec1d8a --- /dev/null +++ b/src/api/types/CreateDisputeEvidenceTextResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields in a `CreateDisputeEvidenceText` response. + */ +export interface CreateDisputeEvidenceTextResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The newly uploaded dispute evidence metadata. */ + evidence?: Square.DisputeEvidence; +} diff --git a/src/api/types/CreateGiftCardActivityResponse.ts b/src/api/types/CreateGiftCardActivityResponse.ts new file mode 100644 index 000000000..9815bd3a5 --- /dev/null +++ b/src/api/types/CreateGiftCardActivityResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains a `GiftCardActivity` that was created. + * The response might contain a set of `Error` objects if the request resulted in errors. + */ +export interface CreateGiftCardActivityResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The gift card activity that was created. */ + giftCardActivity?: Square.GiftCardActivity; +} diff --git a/src/api/types/CreateGiftCardResponse.ts b/src/api/types/CreateGiftCardResponse.ts new file mode 100644 index 000000000..a5705662b --- /dev/null +++ b/src/api/types/CreateGiftCardResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains a `GiftCard`. The response might contain a set of `Error` objects if the request + * resulted in errors. + */ +export interface CreateGiftCardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The new gift card. */ + giftCard?: Square.GiftCard; +} diff --git a/src/api/types/CreateInvoiceAttachmentResponse.ts b/src/api/types/CreateInvoiceAttachmentResponse.ts new file mode 100644 index 000000000..b14cfba0f --- /dev/null +++ b/src/api/types/CreateInvoiceAttachmentResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) response. + */ +export interface CreateInvoiceAttachmentResponse { + /** Metadata about the attachment that was added to the invoice. */ + attachment?: Square.InvoiceAttachment; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateInvoiceResponse.ts b/src/api/types/CreateInvoiceResponse.ts new file mode 100644 index 000000000..e7f5e3396 --- /dev/null +++ b/src/api/types/CreateInvoiceResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response returned by the `CreateInvoice` request. + */ +export interface CreateInvoiceResponse { + /** The newly created invoice. */ + invoice?: Square.Invoice; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateJobResponse.ts b/src/api/types/CreateJobResponse.ts new file mode 100644 index 000000000..78e3ce0ff --- /dev/null +++ b/src/api/types/CreateJobResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CreateJob](api-endpoint:Team-CreateJob) response. Either `job` or `errors` + * is present in the response. + */ +export interface CreateJobResponse { + /** The new job. */ + job?: Square.Job; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateLocationCustomAttributeDefinitionResponse.ts b/src/api/types/CreateLocationCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..dc836c484 --- /dev/null +++ b/src/api/types/CreateLocationCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface CreateLocationCustomAttributeDefinitionResponse { + /** The new custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateLocationResponse.ts b/src/api/types/CreateLocationResponse.ts new file mode 100644 index 000000000..e625beaaf --- /dev/null +++ b/src/api/types/CreateLocationResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response object returned by the [CreateLocation](api-endpoint:Locations-CreateLocation) endpoint. + */ +export interface CreateLocationResponse { + /** Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) encountered during the request. */ + errors?: Square.Error_[]; + /** The newly created `Location` object. */ + location?: Square.Location; +} diff --git a/src/api/types/CreateLoyaltyAccountResponse.ts b/src/api/types/CreateLoyaltyAccountResponse.ts new file mode 100644 index 000000000..8deca79e7 --- /dev/null +++ b/src/api/types/CreateLoyaltyAccountResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that includes loyalty account created. + */ +export interface CreateLoyaltyAccountResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The newly created loyalty account. */ + loyaltyAccount?: Square.LoyaltyAccount; +} diff --git a/src/api/types/CreateLoyaltyPromotionResponse.ts b/src/api/types/CreateLoyaltyPromotionResponse.ts new file mode 100644 index 000000000..e9fddfd36 --- /dev/null +++ b/src/api/types/CreateLoyaltyPromotionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CreateLoyaltyPromotion](api-endpoint:Loyalty-CreateLoyaltyPromotion) response. + * Either `loyalty_promotion` or `errors` is present in the response. + */ +export interface CreateLoyaltyPromotionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The new loyalty promotion. */ + loyaltyPromotion?: Square.LoyaltyPromotion; +} diff --git a/src/api/types/CreateLoyaltyRewardResponse.ts b/src/api/types/CreateLoyaltyRewardResponse.ts new file mode 100644 index 000000000..d7895312f --- /dev/null +++ b/src/api/types/CreateLoyaltyRewardResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that includes the loyalty reward created. + */ +export interface CreateLoyaltyRewardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The loyalty reward created. */ + reward?: Square.LoyaltyReward; +} diff --git a/src/api/types/CreateMerchantCustomAttributeDefinitionResponse.ts b/src/api/types/CreateMerchantCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..48eaa375b --- /dev/null +++ b/src/api/types/CreateMerchantCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface CreateMerchantCustomAttributeDefinitionResponse { + /** The new custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateMobileAuthorizationCodeResponse.ts b/src/api/types/CreateMobileAuthorizationCodeResponse.ts new file mode 100644 index 000000000..51b82b007 --- /dev/null +++ b/src/api/types/CreateMobileAuthorizationCodeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `CreateMobileAuthorizationCode` endpoint. + */ +export interface CreateMobileAuthorizationCodeResponse { + /** + * The generated authorization code that connects a mobile application instance + * to a Square account. + */ + authorizationCode?: string; + /** + * The timestamp when `authorization_code` expires, in + * [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, "2016-09-04T23:59:33.123Z"). + */ + expiresAt?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateOrderCustomAttributeDefinitionResponse.ts b/src/api/types/CreateOrderCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..2cb47336e --- /dev/null +++ b/src/api/types/CreateOrderCustomAttributeDefinitionResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from creating an order custom attribute definition. + */ +export interface CreateOrderCustomAttributeDefinitionResponse { + /** The new custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateOrderRequest.ts b/src/api/types/CreateOrderRequest.ts new file mode 100644 index 000000000..7d0bcab65 --- /dev/null +++ b/src/api/types/CreateOrderRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreateOrderRequest { + /** + * The order to create. If this field is set, the only other top-level field that can be + * set is the `idempotency_key`. + */ + order?: Square.Order; + /** + * A value you specify that uniquely identifies this + * order among orders you have created. + * + * If you are unsure whether a particular order was created successfully, + * you can try it again with the same idempotency key without + * worrying about creating duplicate orders. + * + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + */ + idempotencyKey?: string; +} diff --git a/src/api/types/CreateOrderResponse.ts b/src/api/types/CreateOrderResponse.ts new file mode 100644 index 000000000..3f049e6fb --- /dev/null +++ b/src/api/types/CreateOrderResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `CreateOrder` endpoint. + * + * Either `errors` or `order` is present in a given response, but never both. + */ +export interface CreateOrderResponse { + /** The newly created order. */ + order?: Square.Order; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreatePaymentLinkResponse.ts b/src/api/types/CreatePaymentLinkResponse.ts new file mode 100644 index 000000000..e77451368 --- /dev/null +++ b/src/api/types/CreatePaymentLinkResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreatePaymentLinkResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The created payment link. */ + paymentLink?: Square.PaymentLink; + /** The list of related objects. */ + relatedResources?: Square.PaymentLinkRelatedResources; +} diff --git a/src/api/types/CreatePaymentResponse.ts b/src/api/types/CreatePaymentResponse.ts new file mode 100644 index 000000000..c8d39c720 --- /dev/null +++ b/src/api/types/CreatePaymentResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by [CreatePayment](api-endpoint:Payments-CreatePayment). + * + * If there are errors processing the request, the `payment` field might not be + * present, or it might be present with a status of `FAILED`. + */ +export interface CreatePaymentResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The newly created payment. */ + payment?: Square.Payment; +} diff --git a/src/api/types/CreateShiftResponse.ts b/src/api/types/CreateShiftResponse.ts new file mode 100644 index 000000000..1b9200fe0 --- /dev/null +++ b/src/api/types/CreateShiftResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request to create a `Shift`. The response contains + * the created `Shift` object and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface CreateShiftResponse { + /** The `Shift` that was created on the request. */ + shift?: Square.Shift; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateSubscriptionResponse.ts b/src/api/types/CreateSubscriptionResponse.ts new file mode 100644 index 000000000..4e562b14b --- /dev/null +++ b/src/api/types/CreateSubscriptionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response from the + * [CreateSubscription](api-endpoint:Subscriptions-CreateSubscription) endpoint. + */ +export interface CreateSubscriptionResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** + * The newly created subscription. + * + * For more information, see + * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#subscription-object). + */ + subscription?: Square.Subscription; +} diff --git a/src/api/types/CreateTeamMemberRequest.ts b/src/api/types/CreateTeamMemberRequest.ts new file mode 100644 index 000000000..163ad0994 --- /dev/null +++ b/src/api/types/CreateTeamMemberRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a create request for a `TeamMember` object. + */ +export interface CreateTeamMemberRequest { + /** + * A unique string that identifies this `CreateTeamMember` request. + * Keys can be any valid string, but must be unique for every request. + * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). + * + * The minimum length is 1 and the maximum length is 45. + */ + idempotencyKey?: string; + /** + * **Required** The data used to create the `TeamMember` object. If you include `wage_setting`, you must provide + * `job_id` for each job assignment. To get job IDs, call [ListJobs](api-endpoint:Team-ListJobs). + */ + teamMember?: Square.TeamMember; +} diff --git a/src/api/types/CreateTeamMemberResponse.ts b/src/api/types/CreateTeamMemberResponse.ts new file mode 100644 index 000000000..28ef6df03 --- /dev/null +++ b/src/api/types/CreateTeamMemberResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a create request containing the created `TeamMember` object or error messages. + */ +export interface CreateTeamMemberResponse { + /** The successfully created `TeamMember` object. */ + teamMember?: Square.TeamMember; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/CreateTerminalActionResponse.ts b/src/api/types/CreateTerminalActionResponse.ts new file mode 100644 index 000000000..cc9d6233e --- /dev/null +++ b/src/api/types/CreateTerminalActionResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreateTerminalActionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The created `TerminalAction` */ + action?: Square.TerminalAction; +} diff --git a/src/api/types/CreateTerminalCheckoutResponse.ts b/src/api/types/CreateTerminalCheckoutResponse.ts new file mode 100644 index 000000000..212fbe7c7 --- /dev/null +++ b/src/api/types/CreateTerminalCheckoutResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreateTerminalCheckoutResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The created `TerminalCheckout`. */ + checkout?: Square.TerminalCheckout; +} diff --git a/src/api/types/CreateTerminalRefundResponse.ts b/src/api/types/CreateTerminalRefundResponse.ts new file mode 100644 index 000000000..7ef0c70d1 --- /dev/null +++ b/src/api/types/CreateTerminalRefundResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface CreateTerminalRefundResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The created `TerminalRefund`. */ + refund?: Square.TerminalRefund; +} diff --git a/src/api/types/CreateVendorResponse.ts b/src/api/types/CreateVendorResponse.ts new file mode 100644 index 000000000..fc742ce16 --- /dev/null +++ b/src/api/types/CreateVendorResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an output from a call to [CreateVendor](api-endpoint:Vendors-CreateVendor). + */ +export interface CreateVendorResponse { + /** Errors encountered when the request fails. */ + errors?: Square.Error_[]; + /** The successfully created [Vendor](entity:Vendor) object. */ + vendor?: Square.Vendor; +} diff --git a/src/api/types/CreateWebhookSubscriptionResponse.ts b/src/api/types/CreateWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..26321d45b --- /dev/null +++ b/src/api/types/CreateWebhookSubscriptionResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) endpoint. + * + * Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be + * present. + */ +export interface CreateWebhookSubscriptionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The new [Subscription](entity:WebhookSubscription). */ + subscription?: Square.WebhookSubscription; +} diff --git a/src/api/types/Currency.ts b/src/api/types/Currency.ts new file mode 100644 index 000000000..68275d515 --- /dev/null +++ b/src/api/types/Currency.ts @@ -0,0 +1,377 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the associated currency for an amount of money. Values correspond + * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). + */ +export type Currency = + | "UNKNOWN_CURRENCY" + | "AED" + | "AFN" + | "ALL" + | "AMD" + | "ANG" + | "AOA" + | "ARS" + | "AUD" + | "AWG" + | "AZN" + | "BAM" + | "BBD" + | "BDT" + | "BGN" + | "BHD" + | "BIF" + | "BMD" + | "BND" + | "BOB" + | "BOV" + | "BRL" + | "BSD" + | "BTN" + | "BWP" + | "BYR" + | "BZD" + | "CAD" + | "CDF" + | "CHE" + | "CHF" + | "CHW" + | "CLF" + | "CLP" + | "CNY" + | "COP" + | "COU" + | "CRC" + | "CUC" + | "CUP" + | "CVE" + | "CZK" + | "DJF" + | "DKK" + | "DOP" + | "DZD" + | "EGP" + | "ERN" + | "ETB" + | "EUR" + | "FJD" + | "FKP" + | "GBP" + | "GEL" + | "GHS" + | "GIP" + | "GMD" + | "GNF" + | "GTQ" + | "GYD" + | "HKD" + | "HNL" + | "HRK" + | "HTG" + | "HUF" + | "IDR" + | "ILS" + | "INR" + | "IQD" + | "IRR" + | "ISK" + | "JMD" + | "JOD" + | "JPY" + | "KES" + | "KGS" + | "KHR" + | "KMF" + | "KPW" + | "KRW" + | "KWD" + | "KYD" + | "KZT" + | "LAK" + | "LBP" + | "LKR" + | "LRD" + | "LSL" + | "LTL" + | "LVL" + | "LYD" + | "MAD" + | "MDL" + | "MGA" + | "MKD" + | "MMK" + | "MNT" + | "MOP" + | "MRO" + | "MUR" + | "MVR" + | "MWK" + | "MXN" + | "MXV" + | "MYR" + | "MZN" + | "NAD" + | "NGN" + | "NIO" + | "NOK" + | "NPR" + | "NZD" + | "OMR" + | "PAB" + | "PEN" + | "PGK" + | "PHP" + | "PKR" + | "PLN" + | "PYG" + | "QAR" + | "RON" + | "RSD" + | "RUB" + | "RWF" + | "SAR" + | "SBD" + | "SCR" + | "SDG" + | "SEK" + | "SGD" + | "SHP" + | "SLL" + | "SLE" + | "SOS" + | "SRD" + | "SSP" + | "STD" + | "SVC" + | "SYP" + | "SZL" + | "THB" + | "TJS" + | "TMT" + | "TND" + | "TOP" + | "TRY" + | "TTD" + | "TWD" + | "TZS" + | "UAH" + | "UGX" + | "USD" + | "USN" + | "USS" + | "UYI" + | "UYU" + | "UZS" + | "VEF" + | "VND" + | "VUV" + | "WST" + | "XAF" + | "XAG" + | "XAU" + | "XBA" + | "XBB" + | "XBC" + | "XBD" + | "XCD" + | "XDR" + | "XOF" + | "XPD" + | "XPF" + | "XPT" + | "XTS" + | "XXX" + | "YER" + | "ZAR" + | "ZMK" + | "ZMW" + | "BTC" + | "XUS"; +export const Currency = { + UnknownCurrency: "UNKNOWN_CURRENCY", + Aed: "AED", + Afn: "AFN", + All: "ALL", + Amd: "AMD", + Ang: "ANG", + Aoa: "AOA", + Ars: "ARS", + Aud: "AUD", + Awg: "AWG", + Azn: "AZN", + Bam: "BAM", + Bbd: "BBD", + Bdt: "BDT", + Bgn: "BGN", + Bhd: "BHD", + Bif: "BIF", + Bmd: "BMD", + Bnd: "BND", + Bob: "BOB", + Bov: "BOV", + Brl: "BRL", + Bsd: "BSD", + Btn: "BTN", + Bwp: "BWP", + Byr: "BYR", + Bzd: "BZD", + Cad: "CAD", + Cdf: "CDF", + Che: "CHE", + Chf: "CHF", + Chw: "CHW", + Clf: "CLF", + Clp: "CLP", + Cny: "CNY", + Cop: "COP", + Cou: "COU", + Crc: "CRC", + Cuc: "CUC", + Cup: "CUP", + Cve: "CVE", + Czk: "CZK", + Djf: "DJF", + Dkk: "DKK", + Dop: "DOP", + Dzd: "DZD", + Egp: "EGP", + Ern: "ERN", + Etb: "ETB", + Eur: "EUR", + Fjd: "FJD", + Fkp: "FKP", + Gbp: "GBP", + Gel: "GEL", + Ghs: "GHS", + Gip: "GIP", + Gmd: "GMD", + Gnf: "GNF", + Gtq: "GTQ", + Gyd: "GYD", + Hkd: "HKD", + Hnl: "HNL", + Hrk: "HRK", + Htg: "HTG", + Huf: "HUF", + Idr: "IDR", + Ils: "ILS", + Inr: "INR", + Iqd: "IQD", + Irr: "IRR", + Isk: "ISK", + Jmd: "JMD", + Jod: "JOD", + Jpy: "JPY", + Kes: "KES", + Kgs: "KGS", + Khr: "KHR", + Kmf: "KMF", + Kpw: "KPW", + Krw: "KRW", + Kwd: "KWD", + Kyd: "KYD", + Kzt: "KZT", + Lak: "LAK", + Lbp: "LBP", + Lkr: "LKR", + Lrd: "LRD", + Lsl: "LSL", + Ltl: "LTL", + Lvl: "LVL", + Lyd: "LYD", + Mad: "MAD", + Mdl: "MDL", + Mga: "MGA", + Mkd: "MKD", + Mmk: "MMK", + Mnt: "MNT", + Mop: "MOP", + Mro: "MRO", + Mur: "MUR", + Mvr: "MVR", + Mwk: "MWK", + Mxn: "MXN", + Mxv: "MXV", + Myr: "MYR", + Mzn: "MZN", + Nad: "NAD", + Ngn: "NGN", + Nio: "NIO", + Nok: "NOK", + Npr: "NPR", + Nzd: "NZD", + Omr: "OMR", + Pab: "PAB", + Pen: "PEN", + Pgk: "PGK", + Php: "PHP", + Pkr: "PKR", + Pln: "PLN", + Pyg: "PYG", + Qar: "QAR", + Ron: "RON", + Rsd: "RSD", + Rub: "RUB", + Rwf: "RWF", + Sar: "SAR", + Sbd: "SBD", + Scr: "SCR", + Sdg: "SDG", + Sek: "SEK", + Sgd: "SGD", + Shp: "SHP", + Sll: "SLL", + Sle: "SLE", + Sos: "SOS", + Srd: "SRD", + Ssp: "SSP", + Std: "STD", + Svc: "SVC", + Syp: "SYP", + Szl: "SZL", + Thb: "THB", + Tjs: "TJS", + Tmt: "TMT", + Tnd: "TND", + Top: "TOP", + Try: "TRY", + Ttd: "TTD", + Twd: "TWD", + Tzs: "TZS", + Uah: "UAH", + Ugx: "UGX", + Usd: "USD", + Usn: "USN", + Uss: "USS", + Uyi: "UYI", + Uyu: "UYU", + Uzs: "UZS", + Vef: "VEF", + Vnd: "VND", + Vuv: "VUV", + Wst: "WST", + Xaf: "XAF", + Xag: "XAG", + Xau: "XAU", + Xba: "XBA", + Xbb: "XBB", + Xbc: "XBC", + Xbd: "XBD", + Xcd: "XCD", + Xdr: "XDR", + Xof: "XOF", + Xpd: "XPD", + Xpf: "XPF", + Xpt: "XPT", + Xts: "XTS", + Xxx: "XXX", + Yer: "YER", + Zar: "ZAR", + Zmk: "ZMK", + Zmw: "ZMW", + Btc: "BTC", + Xus: "XUS", +} as const; diff --git a/src/api/types/CustomAttribute.ts b/src/api/types/CustomAttribute.ts new file mode 100644 index 000000000..78cde8e8f --- /dev/null +++ b/src/api/types/CustomAttribute.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A custom attribute value. Each custom attribute value has a corresponding + * `CustomAttributeDefinition` object. + */ +export interface CustomAttribute { + /** + * The identifier + * of the custom attribute definition and its corresponding custom attributes. This value + * can be a simple key, which is the key that is provided when the custom attribute definition + * is created, or a qualified key, if the requesting + * application is not the definition owner. The qualified key consists of the application ID + * of the custom attribute definition owner + * followed by the simple key that was provided when the definition was created. It has the + * format application_id:simple key. + * + * The value for a simple key can contain up to 60 alphanumeric characters, periods (.), + * underscores (_), and hyphens (-). + */ + key?: string | null; + value?: unknown; + /** + * Read only. The current version of the custom attribute. This field is incremented when the custom attribute is changed. + * When updating an existing custom attribute value, you can provide this field + * and specify the current version of the custom attribute to enable + * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency). + * This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads, + * see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). + */ + version?: number; + /** + * A copy of the `visibility` field value for the associated custom attribute definition. + * See [CustomAttributeDefinitionVisibility](#type-customattributedefinitionvisibility) for possible values + */ + visibility?: Square.CustomAttributeDefinitionVisibility; + /** + * A copy of the associated custom attribute definition object. This field is only set when + * the optional field is specified on the request. + */ + definition?: Square.CustomAttributeDefinition; + /** + * The timestamp that indicates when the custom attribute was created or was most recently + * updated, in RFC 3339 format. + */ + updatedAt?: string; + /** The timestamp that indicates when the custom attribute was created, in RFC 3339 format. */ + createdAt?: string; +} diff --git a/src/api/types/CustomAttributeDefinition.ts b/src/api/types/CustomAttributeDefinition.ts new file mode 100644 index 000000000..f5c5c5e37 --- /dev/null +++ b/src/api/types/CustomAttributeDefinition.ts @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a definition for custom attribute values. A custom attribute definition + * specifies the key, visibility, schema, and other properties for a custom attribute. + */ +export interface CustomAttributeDefinition { + /** + * The identifier + * of the custom attribute definition and its corresponding custom attributes. This value + * can be a simple key, which is the key that is provided when the custom attribute definition + * is created, or a qualified key, if the requesting + * application is not the definition owner. The qualified key consists of the application ID + * of the custom attribute definition owner + * followed by the simple key that was provided when the definition was created. It has the + * format application_id:simple key. + * + * The value for a simple key can contain up to 60 alphanumeric characters, periods (.), + * underscores (_), and hyphens (-). + * + * This field can not be changed + * after the custom attribute definition is created. This field is required when creating + * a definition and must be unique per application, seller, and resource type. + */ + key?: string | null; + /** + * The JSON schema for the custom attribute definition, which determines the data type of the corresponding custom attributes. For more information, + * see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). This field is required when creating a definition. + */ + schema?: Record | null; + /** + * The name of the custom attribute definition for API and seller-facing UI purposes. The name must + * be unique within the seller and application pair. This field is required if the + * `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + */ + name?: string | null; + /** + * Seller-oriented description of the custom attribute definition, including any constraints + * that the seller should observe. May be displayed as a tooltip in Square UIs. This field is + * required if the `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + */ + description?: string | null; + /** + * Specifies how the custom attribute definition and its values should be shared with + * the seller and other applications. If no value is specified, the value defaults to `VISIBILITY_HIDDEN`. + * See [Visibility](#type-visibility) for possible values + */ + visibility?: Square.CustomAttributeDefinitionVisibility; + /** + * Read only. The current version of the custom attribute definition. + * The value is incremented each time the custom attribute definition is updated. + * When updating a custom attribute definition, you can provide this field + * and specify the current version of the custom attribute definition to enable + * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency). + * + * On writes, this field must be set to the latest version. Stale writes are rejected. + * + * This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads, + * see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). + */ + version?: number; + /** + * The timestamp that indicates when the custom attribute definition was created or most recently updated, + * in RFC 3339 format. + */ + updatedAt?: string; + /** The timestamp that indicates when the custom attribute definition was created, in RFC 3339 format. */ + createdAt?: string; +} diff --git a/src/api/types/CustomAttributeDefinitionVisibility.ts b/src/api/types/CustomAttributeDefinitionVisibility.ts new file mode 100644 index 000000000..65923bc78 --- /dev/null +++ b/src/api/types/CustomAttributeDefinitionVisibility.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The level of permission that a seller or other applications requires to + * view this custom attribute definition. + * The `Visibility` field controls who can read and write the custom attribute values + * and custom attribute definition. + */ +export type CustomAttributeDefinitionVisibility = + | "VISIBILITY_HIDDEN" + | "VISIBILITY_READ_ONLY" + | "VISIBILITY_READ_WRITE_VALUES"; +export const CustomAttributeDefinitionVisibility = { + VisibilityHidden: "VISIBILITY_HIDDEN", + VisibilityReadOnly: "VISIBILITY_READ_ONLY", + VisibilityReadWriteValues: "VISIBILITY_READ_WRITE_VALUES", +} as const; diff --git a/src/api/types/CustomAttributeFilter.ts b/src/api/types/CustomAttributeFilter.ts new file mode 100644 index 000000000..691eb9f87 --- /dev/null +++ b/src/api/types/CustomAttributeFilter.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Supported custom attribute query expressions for calling the + * [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) + * endpoint to search for items or item variations. + */ +export interface CustomAttributeFilter { + /** + * A query expression to filter items or item variations by matching their custom attributes' + * `custom_attribute_definition_id` property value against the the specified id. + * Exactly one of `custom_attribute_definition_id` or `key` must be specified. + */ + customAttributeDefinitionId?: string | null; + /** + * A query expression to filter items or item variations by matching their custom attributes' + * `key` property value against the specified key. + * Exactly one of `custom_attribute_definition_id` or `key` must be specified. + */ + key?: string | null; + /** + * A query expression to filter items or item variations by matching their custom attributes' + * `string_value` property value against the specified text. + * Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. + */ + stringFilter?: string | null; + /** + * A query expression to filter items or item variations with their custom attributes + * containing a number value within the specified range. + * Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. + */ + numberFilter?: Square.Range; + /** + * A query expression to filter items or item variations by matching their custom attributes' + * `selection_uid_values` values against the specified selection uids. + * Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. + */ + selectionUidsFilter?: string[] | null; + /** + * A query expression to filter items or item variations by matching their custom attributes' + * `boolean_value` property values against the specified Boolean expression. + * Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. + */ + boolFilter?: boolean | null; +} diff --git a/src/api/types/CustomField.ts b/src/api/types/CustomField.ts new file mode 100644 index 000000000..3ad7203a4 --- /dev/null +++ b/src/api/types/CustomField.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes a custom form field to add to the checkout page to collect more information from buyers during checkout. + * For more information, + * see [Specify checkout options](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#specify-checkout-options-1). + */ +export interface CustomField { + /** The title of the custom field. */ + title: string; +} diff --git a/src/api/types/Customer.ts b/src/api/types/Customer.ts new file mode 100644 index 000000000..9bf3d84b5 --- /dev/null +++ b/src/api/types/Customer.ts @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a Square customer profile in the Customer Directory of a Square seller. + */ +export interface Customer { + /** + * A unique Square-assigned ID for the customer profile. + * + * If you need this ID for an API request, use the ID returned when you created the customer profile or call the [SearchCustomers](api-endpoint:Customers-SearchCustomers) + * or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint. + */ + id?: string; + /** The timestamp when the customer profile was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the customer profile was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** The given name (that is, the first name) associated with the customer profile. */ + givenName?: string | null; + /** The family name (that is, the last name) associated with the customer profile. */ + familyName?: string | null; + /** A nickname for the customer profile. */ + nickname?: string | null; + /** A business name associated with the customer profile. */ + companyName?: string | null; + /** The email address associated with the customer profile. */ + emailAddress?: string | null; + /** The physical address associated with the customer profile. */ + address?: Square.Address; + /** The phone number associated with the customer profile. */ + phoneNumber?: string | null; + /** + * The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-21` + * represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year). + */ + birthday?: string | null; + /** + * An optional second ID used to associate the customer profile with an + * entity in another system. + */ + referenceId?: string | null; + /** A custom note associated with the customer profile. */ + note?: string | null; + /** Represents general customer preferences. */ + preferences?: Square.CustomerPreferences; + /** + * The method used to create the customer profile. + * See [CustomerCreationSource](#type-customercreationsource) for possible values + */ + creationSource?: Square.CustomerCreationSource; + /** The IDs of [customer groups](entity:CustomerGroup) the customer belongs to. */ + groupIds?: string[] | null; + /** The IDs of [customer segments](entity:CustomerSegment) the customer belongs to. */ + segmentIds?: string[] | null; + /** The Square-assigned version number of the customer profile. The version number is incremented each time an update is committed to the customer profile, except for changes to customer segment membership. */ + version?: bigint; + /** + * The tax ID associated with the customer profile. This field is present only for customers of sellers in EU countries or the United Kingdom. + * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). + */ + taxIds?: Square.CustomerTaxIds; +} diff --git a/src/api/types/CustomerAddressFilter.ts b/src/api/types/CustomerAddressFilter.ts new file mode 100644 index 000000000..174856341 --- /dev/null +++ b/src/api/types/CustomerAddressFilter.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue](entity:CustomerCustomAttributeFilterValue) filter when + * searching by an `Address`-type custom attribute. + */ +export interface CustomerAddressFilter { + /** The postal code to search for. Only an `exact` match is supported. */ + postalCode?: Square.CustomerTextFilter; + /** + * The country code to search for. + * See [Country](#type-country) for possible values + */ + country?: Square.Country; +} diff --git a/src/api/types/CustomerCreationSource.ts b/src/api/types/CustomerCreationSource.ts new file mode 100644 index 000000000..041067922 --- /dev/null +++ b/src/api/types/CustomerCreationSource.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the method used to create the customer profile. + */ +export type CustomerCreationSource = + | "OTHER" + | "APPOINTMENTS" + | "COUPON" + | "DELETION_RECOVERY" + | "DIRECTORY" + | "EGIFTING" + | "EMAIL_COLLECTION" + | "FEEDBACK" + | "IMPORT" + | "INVOICES" + | "LOYALTY" + | "MARKETING" + | "MERGE" + | "ONLINE_STORE" + | "INSTANT_PROFILE" + | "TERMINAL" + | "THIRD_PARTY" + | "THIRD_PARTY_IMPORT" + | "UNMERGE_RECOVERY"; +export const CustomerCreationSource = { + Other: "OTHER", + Appointments: "APPOINTMENTS", + Coupon: "COUPON", + DeletionRecovery: "DELETION_RECOVERY", + Directory: "DIRECTORY", + Egifting: "EGIFTING", + EmailCollection: "EMAIL_COLLECTION", + Feedback: "FEEDBACK", + Import: "IMPORT", + Invoices: "INVOICES", + Loyalty: "LOYALTY", + Marketing: "MARKETING", + Merge: "MERGE", + OnlineStore: "ONLINE_STORE", + InstantProfile: "INSTANT_PROFILE", + Terminal: "TERMINAL", + ThirdParty: "THIRD_PARTY", + ThirdPartyImport: "THIRD_PARTY_IMPORT", + UnmergeRecovery: "UNMERGE_RECOVERY", +} as const; diff --git a/src/api/types/CustomerCreationSourceFilter.ts b/src/api/types/CustomerCreationSourceFilter.ts new file mode 100644 index 000000000..01d0be76c --- /dev/null +++ b/src/api/types/CustomerCreationSourceFilter.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The creation source filter. + * + * If one or more creation sources are set, customer profiles are included in, + * or excluded from, the result if they match at least one of the filter criteria. + */ +export interface CustomerCreationSourceFilter { + /** + * The list of creation sources used as filtering criteria. + * See [CustomerCreationSource](#type-customercreationsource) for possible values + */ + values?: Square.CustomerCreationSource[] | null; + /** + * Indicates whether a customer profile matching the filter criteria + * should be included in the result or excluded from the result. + * + * Default: `INCLUDE`. + * See [CustomerInclusionExclusion](#type-customerinclusionexclusion) for possible values + */ + rule?: Square.CustomerInclusionExclusion; +} diff --git a/src/api/types/CustomerCustomAttributeFilter.ts b/src/api/types/CustomerCustomAttributeFilter.ts new file mode 100644 index 000000000..0d2b2ddc7 --- /dev/null +++ b/src/api/types/CustomerCustomAttributeFilter.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The custom attribute filter. Use this filter in a set of [custom attribute filters](entity:CustomerCustomAttributeFilters) to search + * based on the value or last updated date of a customer-related [custom attribute](entity:CustomAttribute). + */ +export interface CustomerCustomAttributeFilter { + /** + * The `key` of the [custom attribute](entity:CustomAttribute) to filter by. The key is the identifier of the custom attribute + * (and the corresponding custom attribute definition) and can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes). + */ + key: string; + /** + * A filter that corresponds to the data type of the target custom attribute. For example, provide the `phone` filter to + * search based on the value of a `PhoneNumber`-type custom attribute. The data type is specified by the schema field of the custom attribute definition, + * which can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes). + * + * You must provide this `filter` field, the `updated_at` field, or both. + */ + filter?: Square.CustomerCustomAttributeFilterValue; + /** + * The date range for when the custom attribute was last updated. The date range can include `start_at`, `end_at`, or + * both. Range boundaries are inclusive. Dates are specified as RFC 3339 timestamps. + * + * You must provide this `updated_at` field, the `filter` field, or both. + */ + updatedAt?: Square.TimeRange; +} diff --git a/src/api/types/CustomerCustomAttributeFilterValue.ts b/src/api/types/CustomerCustomAttributeFilterValue.ts new file mode 100644 index 000000000..25df2dfb4 --- /dev/null +++ b/src/api/types/CustomerCustomAttributeFilterValue.ts @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A type-specific filter used in a [custom attribute filter](entity:CustomerCustomAttributeFilter) to search based on the value + * of a customer-related [custom attribute](entity:CustomAttribute). + */ +export interface CustomerCustomAttributeFilterValue { + /** + * A filter for a query based on the value of an `Email`-type custom attribute. This filter is case-insensitive and can + * include `exact` or `fuzzy`, but not both. + * + * For an `exact` match, provide the complete email address. + * + * For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the email address. Square removes + * any punctuation (including periods (.), underscores (_), and the @ symbol) and tokenizes the email addresses on spaces. A match is found + * if a tokenized email address contains all the tokens in the search query, irrespective of the token order. For example, `Steven gmail` + * matches steven.jones@gmail.com and mygmail@stevensbakery.com. + */ + email?: Square.CustomerTextFilter; + /** + * A filter for a query based on the value of a `PhoneNumber`-type custom attribute. This filter is case-insensitive and + * can include `exact` or `fuzzy`, but not both. + * + * For an `exact` match, provide the complete phone number. This is always an E.164-compliant phone number that starts + * with the + sign followed by the country code and subscriber number. For example, the format for a US phone number is +12061112222. + * + * For a `fuzzy` match, provide a query expression containing one or more query tokens to match against the phone number. + * Square removes any punctuation and tokenizes the expression on spaces. A match is found if a tokenized phone number contains + * all the tokens in the search query, irrespective of the token order. For example, `415 123 45` is tokenized to `415`, `123`, and `45`, + * which matches +14151234567 and +12345674158, but does not match +1234156780. Similarly, the expression `415` matches + * +14151234567, +12345674158, and +1234156780. + */ + phone?: Square.CustomerTextFilter; + /** + * A filter for a query based on the value of a `String`-type custom attribute. This filter is case-insensitive and + * can include `exact` or `fuzzy`, but not both. + * + * For an `exact` match, provide the complete string. + * + * For a `fuzzy` match, provide a query expression containing one or more query tokens in any order that contain complete words + * to match against the string. Square tokenizes the expression using a grammar-based tokenizer. For example, the expressions `quick brown`, + * `brown quick`, and `quick fox` match "The quick brown fox jumps over the lazy dog". However, `quick foxes` and `qui` do not match. + */ + text?: Square.CustomerTextFilter; + /** + * A filter for a query based on the display name for a `Selection`-type custom attribute value. This filter is case-sensitive + * and can contain `any`, `all`, or both. The `none` condition is not supported. + * + * Provide the display name of each item that you want to search for. To find the display names for the selection, use the + * [Customer Custom Attributes API](api:CustomerCustomAttributes) to retrieve the corresponding custom attribute definition + * and then check the `schema.items.names` field. For more information, see + * [Search based on selection](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#custom-attribute-value-filter-selection). + * + * Note that when a `Selection`-type custom attribute is assigned to a customer profile, the custom attribute value is a list of one + * or more UUIDs (sourced from the `schema.items.enum` field) that map to the item names. These UUIDs are unique per seller. + */ + selection?: Square.FilterValue; + /** + * A filter for a query based on the value of a `Date`-type custom attribute. + * + * Provide a date range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Dates can be specified + * in `YYYY-MM-DD` format or as RFC 3339 timestamps. + */ + date?: Square.TimeRange; + /** + * A filter for a query based on the value of a `Number`-type custom attribute, which can be an integer or a decimal with up to + * 5 digits of precision. + * + * Provide a numerical range for this filter using `start_at`, `end_at`, or both. Range boundaries are inclusive. Numbers are specified + * as decimals or integers. The absolute value of range boundaries must not exceed `(2^63-1)/10^5`, or 92233720368547. + */ + number?: Square.FloatNumberRange; + /** A filter for a query based on the value of a `Boolean`-type custom attribute. */ + boolean?: boolean | null; + /** A filter for a query based on the value of an `Address`-type custom attribute. The filter can include `postal_code`, `country`, or both. */ + address?: Square.CustomerAddressFilter; +} diff --git a/src/api/types/CustomerCustomAttributeFilters.ts b/src/api/types/CustomerCustomAttributeFilters.ts new file mode 100644 index 000000000..bc9ac3f27 --- /dev/null +++ b/src/api/types/CustomerCustomAttributeFilters.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The custom attribute filters in a set of [customer filters](entity:CustomerFilter) used in a search query. Use this filter + * to search based on [custom attributes](entity:CustomAttribute) that are assigned to customer profiles. For more information, see + * [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). + */ +export interface CustomerCustomAttributeFilters { + /** + * The custom attribute filters. Each filter must specify `key` and include the `filter` field with a type-specific filter, + * the `updated_at` field, or both. The provided keys must be unique within the list of custom attribute filters. + */ + filters?: Square.CustomerCustomAttributeFilter[] | null; +} diff --git a/src/api/types/CustomerDetails.ts b/src/api/types/CustomerDetails.ts new file mode 100644 index 000000000..6ffb58fd6 --- /dev/null +++ b/src/api/types/CustomerDetails.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Details about the customer making the payment. + */ +export interface CustomerDetails { + /** Indicates whether the customer initiated the payment. */ + customerInitiated?: boolean | null; + /** + * Indicates that the seller keyed in payment details on behalf of the customer. + * This is used to flag a payment as Mail Order / Telephone Order (MOTO). + */ + sellerKeyedIn?: boolean | null; +} diff --git a/src/api/types/CustomerFilter.ts b/src/api/types/CustomerFilter.ts new file mode 100644 index 000000000..c7546e024 --- /dev/null +++ b/src/api/types/CustomerFilter.ts @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the filtering criteria in a [search query](entity:CustomerQuery) that defines how to filter + * customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results. + */ +export interface CustomerFilter { + /** A filter to select customers based on their creation source. */ + creationSource?: Square.CustomerCreationSourceFilter; + /** A filter to select customers based on when they were created. */ + createdAt?: Square.TimeRange; + /** A filter to select customers based on when they were last updated. */ + updatedAt?: Square.TimeRange; + /** + * A filter to [select customers by their email address](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-email-address) + * visible to the seller. + * This filter is case-insensitive. + * + * For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-email-address), this + * filter causes the search to return customer profiles + * whose `email_address` field value are identical to the email address provided + * in the query. + * + * For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-email-address), + * this filter causes the search to return customer profiles + * whose `email_address` field value has a token-wise partial match against the filtering + * expression in the query. For example, with `Steven gmail` provided in a search + * query, the search returns customers whose email address is `steven.johnson@gmail.com` + * or `mygmail@stevensbakery.com`. Square removes any punctuation (including periods (.), + * underscores (_), and the @ symbol) and tokenizes the email addresses on spaces. A match is + * found if a tokenized email address contains all the tokens in the search query, + * irrespective of the token order. + */ + emailAddress?: Square.CustomerTextFilter; + /** + * A filter to [select customers by their phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-phone-number) + * visible to the seller. + * + * For [exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-phone-number), + * this filter returns customers whose phone number matches the specified query expression. The number in the query must be of an + * E.164-compliant form. In particular, it must include the leading `+` sign followed by a country code and then a subscriber number. + * For example, the standard E.164 form of a US phone number is `+12062223333` and an E.164-compliant variation is `+1 (206) 222-3333`. + * To match the query expression, stored customer phone numbers are converted to the standard E.164 form. + * + * For [fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-phone-number), + * this filter returns customers whose phone number matches the token or tokens provided in the query expression. For example, with `415` + * provided in a search query, the search returns customers with the phone numbers `+1-415-212-1200`, `+1-212-415-1234`, and `+1 (551) 234-1567`. + * Similarly, a search query of `415 123` returns customers with the phone numbers `+1-212-415-1234` and `+1 (551) 234-1567` but not + * `+1-212-415-1200`. A match is found if a tokenized phone number contains all the tokens in the search query, irrespective of the token order. + */ + phoneNumber?: Square.CustomerTextFilter; + /** + * A filter to [select customers by their reference IDs](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-reference-id). + * This filter is case-insensitive. + * + * [Exact matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#exact-search-by-reference-id) + * of a customer's reference ID against a query's reference ID is evaluated as an + * exact match between two strings, character by character in the given order. + * + * [Fuzzy matching](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#fuzzy-search-by-reference-id) + * of stored reference IDs against queried reference IDs works + * exactly the same as fuzzy matching on email addresses. Non-alphanumeric characters + * are replaced by spaces to tokenize stored and queried reference IDs. A match is found + * if a tokenized stored reference ID contains all tokens specified in any order in the query. For example, + * a query of `NYC M` matches customer profiles with the `reference_id` value of `NYC_M_35_JOHNSON` + * and `NYC_27_MURRAY`. + */ + referenceId?: Square.CustomerTextFilter; + /** + * A filter to select customers based on the [groups](entity:CustomerGroup) they belong to. + * Group membership is controlled by sellers and developers. + * + * The `group_ids` filter has the following syntax: + * ``` + * "group_ids": { + * "any": ["{group_a_id}", "{group_b_id}", ...], + * "all": ["{group_1_id}", "{group_2_id}", ...], + * "none": ["{group_i_id}", "{group_ii_id}", ...] + * } + * ``` + * + * You can use any combination of the `any`, `all`, and `none` fields in the filter. + * With `any`, the search returns customers in groups `a` or `b` or any other group specified in the list. + * With `all`, the search returns customers in groups `1` and `2` and all other groups specified in the list. + * With `none`, the search returns customers not in groups `i` or `ii` or any other group specified in the list. + * + * If any of the search conditions are not met, including when an invalid or non-existent group ID is provided, + * the result is an empty object (`{}`). + */ + groupIds?: Square.FilterValue; + /** + * A filter to select customers based on one or more custom attributes. + * This filter can contain up to 10 custom attribute filters. Each custom attribute filter specifies filtering criteria for a target custom + * attribute. If multiple custom attribute filters are provided, they are combined as an `AND` operation. + * + * To be valid for a search, the custom attributes must be visible to the requesting application. For more information, including example queries, + * see [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). + * + * Square returns matching customer profiles, which do not contain custom attributes. To retrieve customer-related custom attributes, + * use the [Customer Custom Attributes API](api:CustomerCustomAttributes). For example, you can call + * [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) using a customer ID from the result set. + */ + customAttribute?: Square.CustomerCustomAttributeFilters; + /** + * A filter to select customers based on the [segments](entity:CustomerSegment) they belong to. + * Segment membership is dynamic and adjusts automatically based on whether customers meet the segment criteria. + * + * You can provide up to three segment IDs in the filter, using any combination of the `all`, `any`, and `none` fields. + * For the following example, the results include customers who belong to both segment A and segment B but do not belong to segment C. + * + * ``` + * "segment_ids": { + * "all": ["{segment_A_id}", "{segment_B_id}"], + * "none": ["{segment_C_id}"] + * } + * ``` + * + * If an invalid or non-existent segment ID is provided in the filter, Square stops processing the request + * and returns a `400 BAD_REQUEST` error that includes the segment ID. + */ + segmentIds?: Square.FilterValue; +} diff --git a/src/api/types/CustomerGroup.ts b/src/api/types/CustomerGroup.ts new file mode 100644 index 000000000..d7d65b7fa --- /dev/null +++ b/src/api/types/CustomerGroup.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a group of customer profiles. + * + * Customer groups can be created, be modified, and have their membership defined using + * the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. + */ +export interface CustomerGroup { + /** A unique Square-generated ID for the customer group. */ + id?: string; + /** The name of the customer group. */ + name: string; + /** The timestamp when the customer group was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the customer group was last updated, in RFC 3339 format. */ + updatedAt?: string; +} diff --git a/src/api/types/CustomerInclusionExclusion.ts b/src/api/types/CustomerInclusionExclusion.ts new file mode 100644 index 000000000..1d8be541f --- /dev/null +++ b/src/api/types/CustomerInclusionExclusion.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether customers should be included in, or excluded from, + * the result set when they match the filtering criteria. + */ +export type CustomerInclusionExclusion = "INCLUDE" | "EXCLUDE"; +export const CustomerInclusionExclusion = { + Include: "INCLUDE", + Exclude: "EXCLUDE", +} as const; diff --git a/src/api/types/CustomerPreferences.ts b/src/api/types/CustomerPreferences.ts new file mode 100644 index 000000000..2d50d372d --- /dev/null +++ b/src/api/types/CustomerPreferences.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents communication preferences for the customer profile. + */ +export interface CustomerPreferences { + /** Indicates whether the customer has unsubscribed from marketing campaign emails. A value of `true` means that the customer chose to opt out of email marketing from the current Square seller or from all Square sellers. This value is read-only from the Customers API. */ + emailUnsubscribed?: boolean | null; +} diff --git a/src/api/types/CustomerQuery.ts b/src/api/types/CustomerQuery.ts new file mode 100644 index 000000000..0cfacb26e --- /dev/null +++ b/src/api/types/CustomerQuery.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents filtering and sorting criteria for a [SearchCustomers](api-endpoint:Customers-SearchCustomers) request. + */ +export interface CustomerQuery { + /** + * The filtering criteria for the search query. A query can contain multiple filters in any combination. + * Multiple filters are combined as `AND` statements. + * + * __Note:__ Combining multiple filters as `OR` statements is not supported. Instead, send multiple single-filter + * searches and join the result sets. + */ + filter?: Square.CustomerFilter; + /** + * Sorting criteria for query results. The default behavior is to sort + * customers alphabetically by `given_name` and `family_name`. + */ + sort?: Square.CustomerSort; +} diff --git a/src/api/types/CustomerSegment.ts b/src/api/types/CustomerSegment.ts new file mode 100644 index 000000000..027aa3188 --- /dev/null +++ b/src/api/types/CustomerSegment.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a group of customer profiles that match one or more predefined filter criteria. + * + * Segments (also known as Smart Groups) are defined and created within the Customer Directory in the + * Square Seller Dashboard or Point of Sale. + */ +export interface CustomerSegment { + /** A unique Square-generated ID for the segment. */ + id?: string; + /** The name of the segment. */ + name: string; + /** The timestamp when the segment was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the segment was last updated, in RFC 3339 format. */ + updatedAt?: string; +} diff --git a/src/api/types/CustomerSort.ts b/src/api/types/CustomerSort.ts new file mode 100644 index 000000000..31fe8860b --- /dev/null +++ b/src/api/types/CustomerSort.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the sorting criteria in a [search query](entity:CustomerQuery) that defines how to sort + * customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results. + */ +export interface CustomerSort { + /** + * Indicates the fields to use as the sort key, which is either the default set of fields or `created_at`. + * + * The default value is `DEFAULT`. + * See [CustomerSortField](#type-customersortfield) for possible values + */ + field?: Square.CustomerSortField; + /** + * Indicates the order in which results should be sorted based on the + * sort field value. Strings use standard alphabetic comparison + * to determine order. Strings representing numbers are sorted as strings. + * + * The default value is `ASC`. + * See [SortOrder](#type-sortorder) for possible values + */ + order?: Square.SortOrder; +} diff --git a/src/api/types/CustomerSortField.ts b/src/api/types/CustomerSortField.ts new file mode 100644 index 000000000..453994a28 --- /dev/null +++ b/src/api/types/CustomerSortField.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specifies customer attributes as the sort key to customer profiles returned from a search. + */ +export type CustomerSortField = "DEFAULT" | "CREATED_AT"; +export const CustomerSortField = { + Default: "DEFAULT", + CreatedAt: "CREATED_AT", +} as const; diff --git a/src/api/types/CustomerTaxIds.ts b/src/api/types/CustomerTaxIds.ts new file mode 100644 index 000000000..93daf9e65 --- /dev/null +++ b/src/api/types/CustomerTaxIds.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the tax ID associated with a [customer profile](entity:Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. + * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). + */ +export interface CustomerTaxIds { + /** The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only. */ + euVat?: string | null; +} diff --git a/src/api/types/CustomerTextFilter.ts b/src/api/types/CustomerTextFilter.ts new file mode 100644 index 000000000..598e03ca9 --- /dev/null +++ b/src/api/types/CustomerTextFilter.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A filter to select customers based on exact or fuzzy matching of + * customer attributes against a specified query. Depending on the customer attributes, + * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. + */ +export interface CustomerTextFilter { + /** Use the exact filter to select customers whose attributes match exactly the specified query. */ + exact?: string | null; + /** + * Use the fuzzy filter to select customers whose attributes match the specified query + * in a fuzzy manner. When the fuzzy option is used, search queries are tokenized, and then + * each query token must be matched somewhere in the searched attribute. For single token queries, + * this is effectively the same behavior as a partial match operation. + */ + fuzzy?: string | null; +} diff --git a/src/api/types/DataCollectionOptions.ts b/src/api/types/DataCollectionOptions.ts new file mode 100644 index 000000000..c9fb89b7a --- /dev/null +++ b/src/api/types/DataCollectionOptions.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +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; + /** + * Represents the type of the input text. + * See [InputType](#type-inputtype) for possible values + */ + inputType: Square.DataCollectionOptionsInputType; + /** The buyer’s input text from the data collection screen. */ + collectedData?: Square.CollectedData; +} diff --git a/src/api/types/DataCollectionOptionsInputType.ts b/src/api/types/DataCollectionOptionsInputType.ts new file mode 100644 index 000000000..2e8b0cec0 --- /dev/null +++ b/src/api/types/DataCollectionOptionsInputType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes the input type of the data. + */ +export type DataCollectionOptionsInputType = "EMAIL" | "PHONE_NUMBER"; +export const DataCollectionOptionsInputType = { + Email: "EMAIL", + PhoneNumber: "PHONE_NUMBER", +} as const; diff --git a/src/api/types/DateRange.ts b/src/api/types/DateRange.ts new file mode 100644 index 000000000..d5b5c2a3f --- /dev/null +++ b/src/api/types/DateRange.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A range defined by two dates. Used for filtering a query for Connect v2 + * objects that have date properties. + */ +export interface DateRange { + /** + * A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601 + * extended format for calendar dates. + * The beginning of a date range (inclusive). + */ + startDate?: string | null; + /** + * A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601 + * extended format for calendar dates. + * The end of a date range (inclusive). + */ + endDate?: string | null; +} diff --git a/src/api/types/DayOfWeek.ts b/src/api/types/DayOfWeek.ts new file mode 100644 index 000000000..d2f9beb46 --- /dev/null +++ b/src/api/types/DayOfWeek.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the specific day of the week. + */ +export type DayOfWeek = "SUN" | "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT"; +export const DayOfWeek = { + Sun: "SUN", + Mon: "MON", + Tue: "TUE", + Wed: "WED", + Thu: "THU", + Fri: "FRI", + Sat: "SAT", +} as const; diff --git a/src/api/types/DeleteBookingCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteBookingCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..a2aefe00c --- /dev/null +++ b/src/api/types/DeleteBookingCustomAttributeDefinitionResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [DeleteBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttributeDefinition) response + * containing error messages when errors occurred during the request. The successful response does not contain any payload. + */ +export interface DeleteBookingCustomAttributeDefinitionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteBookingCustomAttributeResponse.ts b/src/api/types/DeleteBookingCustomAttributeResponse.ts new file mode 100644 index 000000000..57ab7546b --- /dev/null +++ b/src/api/types/DeleteBookingCustomAttributeResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [DeleteBookingCustomAttribute](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttribute) response. + * Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + */ +export interface DeleteBookingCustomAttributeResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteBreakTypeResponse.ts b/src/api/types/DeleteBreakTypeResponse.ts new file mode 100644 index 000000000..c85ce0eb0 --- /dev/null +++ b/src/api/types/DeleteBreakTypeResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request to delete a `BreakType`. The response might contain a set + * of `Error` objects if the request resulted in errors. + */ +export interface DeleteBreakTypeResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteCatalogObjectResponse.ts b/src/api/types/DeleteCatalogObjectResponse.ts new file mode 100644 index 000000000..734606657 --- /dev/null +++ b/src/api/types/DeleteCatalogObjectResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeleteCatalogObjectResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The IDs of all catalog objects deleted by this request. + * Multiple IDs may be returned when associated objects are also deleted, for example + * a catalog item variation will be deleted (and its ID included in this field) + * when its parent catalog item is deleted. + */ + deletedObjectIds?: string[]; + /** + * The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * of this deletion in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. + */ + deletedAt?: string; +} diff --git a/src/api/types/DeleteCustomerCardResponse.ts b/src/api/types/DeleteCustomerCardResponse.ts new file mode 100644 index 000000000..a5fcc3f81 --- /dev/null +++ b/src/api/types/DeleteCustomerCardResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `DeleteCustomerCard` endpoint. + */ +export interface DeleteCustomerCardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteCustomerCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteCustomerCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..66a5ca47b --- /dev/null +++ b/src/api/types/DeleteCustomerCustomAttributeDefinitionResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a delete request containing error messages if there are any. + */ +export interface DeleteCustomerCustomAttributeDefinitionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteCustomerCustomAttributeResponse.ts b/src/api/types/DeleteCustomerCustomAttributeResponse.ts new file mode 100644 index 000000000..c4bdba587 --- /dev/null +++ b/src/api/types/DeleteCustomerCustomAttributeResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [DeleteCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-DeleteCustomerCustomAttribute) response. + * Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + */ +export interface DeleteCustomerCustomAttributeResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteCustomerGroupResponse.ts b/src/api/types/DeleteCustomerGroupResponse.ts new file mode 100644 index 000000000..2a78946f7 --- /dev/null +++ b/src/api/types/DeleteCustomerGroupResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [DeleteCustomerGroup](api-endpoint:CustomerGroups-DeleteCustomerGroup) endpoint. + */ +export interface DeleteCustomerGroupResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteCustomerResponse.ts b/src/api/types/DeleteCustomerResponse.ts new file mode 100644 index 000000000..225fa47cf --- /dev/null +++ b/src/api/types/DeleteCustomerResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `DeleteCustomer` endpoint. + */ +export interface DeleteCustomerResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteDisputeEvidenceResponse.ts b/src/api/types/DeleteDisputeEvidenceResponse.ts new file mode 100644 index 000000000..a13499b2b --- /dev/null +++ b/src/api/types/DeleteDisputeEvidenceResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields in a `DeleteDisputeEvidence` response. + */ +export interface DeleteDisputeEvidenceResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteInvoiceAttachmentResponse.ts b/src/api/types/DeleteInvoiceAttachmentResponse.ts new file mode 100644 index 000000000..adc386aaa --- /dev/null +++ b/src/api/types/DeleteInvoiceAttachmentResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) response. + */ +export interface DeleteInvoiceAttachmentResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteInvoiceResponse.ts b/src/api/types/DeleteInvoiceResponse.ts new file mode 100644 index 000000000..f4a336074 --- /dev/null +++ b/src/api/types/DeleteInvoiceResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes a `DeleteInvoice` response. + */ +export interface DeleteInvoiceResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteLocationCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteLocationCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..35143f1d1 --- /dev/null +++ b/src/api/types/DeleteLocationCustomAttributeDefinitionResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a delete request containing error messages if there are any. + */ +export interface DeleteLocationCustomAttributeDefinitionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteLocationCustomAttributeResponse.ts b/src/api/types/DeleteLocationCustomAttributeResponse.ts new file mode 100644 index 000000000..e5f09f379 --- /dev/null +++ b/src/api/types/DeleteLocationCustomAttributeResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [DeleteLocationCustomAttribute](api-endpoint:LocationCustomAttributes-DeleteLocationCustomAttribute) response. + * Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + */ +export interface DeleteLocationCustomAttributeResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteLoyaltyRewardResponse.ts b/src/api/types/DeleteLoyaltyRewardResponse.ts new file mode 100644 index 000000000..f53e6ca05 --- /dev/null +++ b/src/api/types/DeleteLoyaltyRewardResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response returned by the API call. + */ +export interface DeleteLoyaltyRewardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteMerchantCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteMerchantCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..76deacfa0 --- /dev/null +++ b/src/api/types/DeleteMerchantCustomAttributeDefinitionResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a delete request containing error messages if there are any. + */ +export interface DeleteMerchantCustomAttributeDefinitionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteMerchantCustomAttributeResponse.ts b/src/api/types/DeleteMerchantCustomAttributeResponse.ts new file mode 100644 index 000000000..d878ba548 --- /dev/null +++ b/src/api/types/DeleteMerchantCustomAttributeResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [DeleteMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-DeleteMerchantCustomAttribute) response. + * Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + */ +export interface DeleteMerchantCustomAttributeResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteOrderCustomAttributeDefinitionResponse.ts b/src/api/types/DeleteOrderCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..7f1d85972 --- /dev/null +++ b/src/api/types/DeleteOrderCustomAttributeDefinitionResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from deleting an order custom attribute definition. + */ +export interface DeleteOrderCustomAttributeDefinitionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteOrderCustomAttributeResponse.ts b/src/api/types/DeleteOrderCustomAttributeResponse.ts new file mode 100644 index 000000000..2f1d498b6 --- /dev/null +++ b/src/api/types/DeleteOrderCustomAttributeResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from deleting an order custom attribute. + */ +export interface DeleteOrderCustomAttributeResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeletePaymentLinkResponse.ts b/src/api/types/DeletePaymentLinkResponse.ts new file mode 100644 index 000000000..6aef5e3e4 --- /dev/null +++ b/src/api/types/DeletePaymentLinkResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeletePaymentLinkResponse { + errors?: Square.Error_[]; + /** The ID of the link that is deleted. */ + id?: string; + /** + * The ID of the order that is canceled. When a payment link is deleted, Square updates the + * the `state` (of the order that the checkout link created) to CANCELED. + */ + cancelledOrderId?: string; +} diff --git a/src/api/types/DeleteShiftResponse.ts b/src/api/types/DeleteShiftResponse.ts new file mode 100644 index 000000000..8c7b76899 --- /dev/null +++ b/src/api/types/DeleteShiftResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request to delete a `Shift`. The response might contain a set of + * `Error` objects if the request resulted in errors. + */ +export interface DeleteShiftResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteSnippetResponse.ts b/src/api/types/DeleteSnippetResponse.ts new file mode 100644 index 000000000..2a768b803 --- /dev/null +++ b/src/api/types/DeleteSnippetResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a `DeleteSnippet` response. + */ +export interface DeleteSnippetResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DeleteSubscriptionActionResponse.ts b/src/api/types/DeleteSubscriptionActionResponse.ts new file mode 100644 index 000000000..5adb33949 --- /dev/null +++ b/src/api/types/DeleteSubscriptionActionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response of the [DeleteSubscriptionAction](api-endpoint:Subscriptions-DeleteSubscriptionAction) + * endpoint. + */ +export interface DeleteSubscriptionActionResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The subscription that has the specified action deleted. */ + subscription?: Square.Subscription; +} diff --git a/src/api/types/DeleteWebhookSubscriptionResponse.ts b/src/api/types/DeleteWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..5fd49d18f --- /dev/null +++ b/src/api/types/DeleteWebhookSubscriptionResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [DeleteWebhookSubscription](api-endpoint:WebhookSubscriptions-DeleteWebhookSubscription) endpoint. + */ +export interface DeleteWebhookSubscriptionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/Destination.ts b/src/api/types/Destination.ts new file mode 100644 index 000000000..c677acd36 --- /dev/null +++ b/src/api/types/Destination.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Information about the destination against which the payout was made. + */ +export interface Destination { + /** + * Type of the destination such as a bank account or debit card. + * See [DestinationType](#type-destinationtype) for possible values + */ + type?: Square.DestinationType; + /** Square issued unique ID (also known as the instrument ID) associated with this destination. */ + id?: string; +} diff --git a/src/api/types/DestinationDetails.ts b/src/api/types/DestinationDetails.ts new file mode 100644 index 000000000..5cdc3ccc7 --- /dev/null +++ b/src/api/types/DestinationDetails.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Details about a refund's destination. + */ +export interface DestinationDetails { + /** Details about a card refund. Only populated if the destination_type is `CARD`. */ + cardDetails?: Square.DestinationDetailsCardRefundDetails; + /** Details about a cash refund. Only populated if the destination_type is `CASH`. */ + cashDetails?: Square.DestinationDetailsCashRefundDetails; + /** Details about an external refund. Only populated if the destination_type is `EXTERNAL`. */ + externalDetails?: Square.DestinationDetailsExternalRefundDetails; +} diff --git a/src/api/types/DestinationDetailsCardRefundDetails.ts b/src/api/types/DestinationDetailsCardRefundDetails.ts new file mode 100644 index 000000000..dbeddd7e1 --- /dev/null +++ b/src/api/types/DestinationDetailsCardRefundDetails.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DestinationDetailsCardRefundDetails { + /** The card's non-confidential details. */ + card?: Square.Card; + /** + * The method used to enter the card's details for the refund. The method can be + * `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`. + */ + entryMethod?: string | null; + /** The authorization code provided by the issuer when a refund is approved. */ + authResultCode?: string | null; +} diff --git a/src/api/types/DestinationDetailsCashRefundDetails.ts b/src/api/types/DestinationDetailsCashRefundDetails.ts new file mode 100644 index 000000000..c88e91e58 --- /dev/null +++ b/src/api/types/DestinationDetailsCashRefundDetails.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Stores details about a cash refund. Contains only non-confidential information. + */ +export interface DestinationDetailsCashRefundDetails { + /** The amount and currency of the money supplied by the seller. */ + sellerSuppliedMoney: Square.Money; + /** + * The amount of change due back to the seller. + * This read-only field is calculated + * from the `amount_money` and `seller_supplied_money` fields. + */ + changeBackMoney?: Square.Money; +} diff --git a/src/api/types/DestinationDetailsExternalRefundDetails.ts b/src/api/types/DestinationDetailsExternalRefundDetails.ts new file mode 100644 index 000000000..1ebbbb2a8 --- /dev/null +++ b/src/api/types/DestinationDetailsExternalRefundDetails.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Stores details about an external refund. Contains only non-confidential information. + */ +export interface DestinationDetailsExternalRefundDetails { + /** + * The type of external refund the seller paid to the buyer. It can be one of the + * following: + * - CHECK - Refunded using a physical check. + * - BANK_TRANSFER - Refunded using external bank transfer. + * - OTHER\_GIFT\_CARD - Refunded using a non-Square gift card. + * - CRYPTO - Refunded using a crypto currency. + * - SQUARE_CASH - Refunded using Square Cash App. + * - SOCIAL - Refunded using peer-to-peer payment applications. + * - EXTERNAL - A third-party application gathered this refund outside of Square. + * - EMONEY - Refunded using an E-money provider. + * - CARD - A credit or debit card that Square does not support. + * - STORED_BALANCE - Use for house accounts, store credit, and so forth. + * - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals + * - OTHER - A type not listed here. + */ + type: string; + /** + * A description of the external refund source. For example, + * "Food Delivery Service". + */ + source: string; + /** An ID to associate the refund to its originating source. */ + sourceId?: string | null; +} diff --git a/src/api/types/DestinationType.ts b/src/api/types/DestinationType.ts new file mode 100644 index 000000000..6864671ab --- /dev/null +++ b/src/api/types/DestinationType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * List of possible destinations against which a payout can be made. + */ +export type DestinationType = "BANK_ACCOUNT" | "CARD" | "SQUARE_BALANCE" | "SQUARE_STORED_BALANCE"; +export const DestinationType = { + BankAccount: "BANK_ACCOUNT", + Card: "CARD", + SquareBalance: "SQUARE_BALANCE", + SquareStoredBalance: "SQUARE_STORED_BALANCE", +} as const; diff --git a/src/api/types/Device.ts b/src/api/types/Device.ts new file mode 100644 index 000000000..45d8ea2e0 --- /dev/null +++ b/src/api/types/Device.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface Device { + /** + * A synthetic identifier for the device. The identifier includes a standardized prefix and + * is otherwise an opaque id generated from key device fields. + */ + id?: string; + /** A collection of DeviceAttributes representing the device. */ + attributes: Square.DeviceAttributes; + /** A list of components applicable to the device. */ + components?: Square.Component[] | null; + /** The current status of the device. */ + status?: Square.DeviceStatus; +} diff --git a/src/api/types/DeviceAttributes.ts b/src/api/types/DeviceAttributes.ts new file mode 100644 index 000000000..8c76e3e37 --- /dev/null +++ b/src/api/types/DeviceAttributes.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeviceAttributes { + /** + * The device type. + * See [DeviceType](#type-devicetype) for possible values + */ + type: Square.DeviceAttributesDeviceType; + /** The maker of the device. */ + manufacturer: string; + /** The specific model of the device. */ + model?: string | null; + /** A seller-specified name for the device. */ + name?: string | null; + /** + * The manufacturer-supplied identifier for the device (where available). In many cases, + * this identifier will be a serial number. + */ + manufacturersId?: string | null; + /** + * The RFC 3339-formatted value of the most recent update to the device information. + * (Could represent any field update on the device.) + */ + updatedAt?: string; + /** The current version of software installed on the device. */ + version?: string; + /** The merchant_token identifying the merchant controlling the device. */ + merchantToken?: string | null; +} diff --git a/src/api/types/DeviceAttributesDeviceType.ts b/src/api/types/DeviceAttributesDeviceType.ts new file mode 100644 index 000000000..809a96fcb --- /dev/null +++ b/src/api/types/DeviceAttributesDeviceType.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enum identifier of the device type. + */ +export type DeviceAttributesDeviceType = "TERMINAL"; diff --git a/src/api/types/DeviceCheckoutOptions.ts b/src/api/types/DeviceCheckoutOptions.ts new file mode 100644 index 000000000..98d96f543 --- /dev/null +++ b/src/api/types/DeviceCheckoutOptions.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeviceCheckoutOptions { + /** + * The unique ID of the device intended for this `TerminalCheckout`. + * A list of `DeviceCode` objects can be retrieved from the /v2/devices/codes endpoint. + * Match a `DeviceCode.device_id` value with `device_id` to get the associated device code. + */ + deviceId: string; + /** Instructs the device to skip the receipt screen. Defaults to false. */ + skipReceiptScreen?: boolean | null; + /** Indicates that signature collection is desired during checkout. Defaults to false. */ + collectSignature?: boolean | null; + /** Tip-specific settings. */ + tipSettings?: Square.TipSettings; + /** + * Show the itemization screen prior to taking a payment. This field is only meaningful when the + * checkout includes an order ID. Defaults to true. + */ + showItemizedCart?: boolean | null; +} diff --git a/src/api/types/DeviceCode.ts b/src/api/types/DeviceCode.ts new file mode 100644 index 000000000..e762c9166 --- /dev/null +++ b/src/api/types/DeviceCode.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeviceCode { + /** The unique id for this device code. */ + id?: string; + /** An optional user-defined name for the device code. */ + name?: string | null; + /** The unique code that can be used to login. */ + code?: string; + /** The unique id of the device that used this code. Populated when the device is paired up. */ + deviceId?: string; + /** The targeting product type of the device code. */ + productType: Square.ProductType; + /** The location assigned to this code. */ + locationId?: string | null; + /** + * The pairing status of the device code. + * See [DeviceCodeStatus](#type-devicecodestatus) for possible values + */ + status?: Square.DeviceCodeStatus; + /** When this DeviceCode will expire and no longer login. Timestamp in RFC 3339 format. */ + pairBy?: string; + /** When this DeviceCode was created. Timestamp in RFC 3339 format. */ + createdAt?: string; + /** When this DeviceCode's status was last changed. Timestamp in RFC 3339 format. */ + statusChangedAt?: string; + /** When this DeviceCode was paired. Timestamp in RFC 3339 format. */ + pairedAt?: string; +} diff --git a/src/api/types/DeviceCodeStatus.ts b/src/api/types/DeviceCodeStatus.ts new file mode 100644 index 000000000..f1c62347d --- /dev/null +++ b/src/api/types/DeviceCodeStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * DeviceCode.Status enum. + */ +export type DeviceCodeStatus = "UNKNOWN" | "UNPAIRED" | "PAIRED" | "EXPIRED"; +export const DeviceCodeStatus = { + Unknown: "UNKNOWN", + Unpaired: "UNPAIRED", + Paired: "PAIRED", + Expired: "EXPIRED", +} as const; diff --git a/src/api/types/DeviceComponentDetailsApplicationDetails.ts b/src/api/types/DeviceComponentDetailsApplicationDetails.ts new file mode 100644 index 000000000..f514f19aa --- /dev/null +++ b/src/api/types/DeviceComponentDetailsApplicationDetails.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeviceComponentDetailsApplicationDetails { + /** + * The type of application. + * See [ApplicationType](#type-applicationtype) for possible values + */ + applicationType?: Square.ApplicationType; + /** The version of the application. */ + version?: string; + /** The location_id of the session for the application. */ + sessionLocation?: string | null; + /** The id of the device code that was used to log in to the device. */ + deviceCodeId?: string | null; +} diff --git a/src/api/types/DeviceComponentDetailsBatteryDetails.ts b/src/api/types/DeviceComponentDetailsBatteryDetails.ts new file mode 100644 index 000000000..3484279ff --- /dev/null +++ b/src/api/types/DeviceComponentDetailsBatteryDetails.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeviceComponentDetailsBatteryDetails { + /** The battery charge percentage as displayed on the device. */ + visiblePercent?: number | null; + /** + * The status of external_power. + * See [ExternalPower](#type-externalpower) for possible values + */ + externalPower?: Square.DeviceComponentDetailsExternalPower; +} diff --git a/src/api/types/DeviceComponentDetailsCardReaderDetails.ts b/src/api/types/DeviceComponentDetailsCardReaderDetails.ts new file mode 100644 index 000000000..73be61ee8 --- /dev/null +++ b/src/api/types/DeviceComponentDetailsCardReaderDetails.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DeviceComponentDetailsCardReaderDetails { + /** The version of the card reader. */ + version?: string; +} diff --git a/src/api/types/DeviceComponentDetailsEthernetDetails.ts b/src/api/types/DeviceComponentDetailsEthernetDetails.ts new file mode 100644 index 000000000..80069b55e --- /dev/null +++ b/src/api/types/DeviceComponentDetailsEthernetDetails.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DeviceComponentDetailsEthernetDetails { + /** A boolean to represent whether the Ethernet interface is currently active. */ + active?: boolean | null; + /** The string representation of the device’s IPv4 address. */ + ipAddressV4?: string | null; +} diff --git a/src/api/types/DeviceComponentDetailsExternalPower.ts b/src/api/types/DeviceComponentDetailsExternalPower.ts new file mode 100644 index 000000000..360a472b6 --- /dev/null +++ b/src/api/types/DeviceComponentDetailsExternalPower.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An enum for ExternalPower. + */ +export type DeviceComponentDetailsExternalPower = + | "AVAILABLE_CHARGING" + | "AVAILABLE_NOT_IN_USE" + | "UNAVAILABLE" + | "AVAILABLE_INSUFFICIENT"; +export const DeviceComponentDetailsExternalPower = { + AvailableCharging: "AVAILABLE_CHARGING", + AvailableNotInUse: "AVAILABLE_NOT_IN_USE", + Unavailable: "UNAVAILABLE", + AvailableInsufficient: "AVAILABLE_INSUFFICIENT", +} as const; diff --git a/src/api/types/DeviceComponentDetailsMeasurement.ts b/src/api/types/DeviceComponentDetailsMeasurement.ts new file mode 100644 index 000000000..d2121e43f --- /dev/null +++ b/src/api/types/DeviceComponentDetailsMeasurement.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A value qualified by unit of measure. + */ +export interface DeviceComponentDetailsMeasurement { + value?: number | null; +} diff --git a/src/api/types/DeviceComponentDetailsWiFiDetails.ts b/src/api/types/DeviceComponentDetailsWiFiDetails.ts new file mode 100644 index 000000000..a4305877f --- /dev/null +++ b/src/api/types/DeviceComponentDetailsWiFiDetails.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeviceComponentDetailsWiFiDetails { + /** A boolean to represent whether the WiFI interface is currently active. */ + active?: boolean | null; + /** The name of the connected WIFI network. */ + ssid?: string | null; + /** The string representation of the device’s IPv4 address. */ + ipAddressV4?: string | null; + /** + * The security protocol for a secure connection (e.g. WPA2). None provided if the connection + * is unsecured. + */ + secureConnection?: string | null; + /** A representation of signal strength of the WIFI network connection. */ + signalStrength?: Square.DeviceComponentDetailsMeasurement; +} diff --git a/src/api/types/DeviceDetails.ts b/src/api/types/DeviceDetails.ts new file mode 100644 index 000000000..a2b401bd9 --- /dev/null +++ b/src/api/types/DeviceDetails.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Details about the device that took the payment. + */ +export interface DeviceDetails { + /** The Square-issued ID of the device. */ + deviceId?: string | null; + /** The Square-issued installation ID for the device. */ + deviceInstallationId?: string | null; + /** The name of the device set by the seller. */ + deviceName?: string | null; +} diff --git a/src/api/types/DeviceMetadata.ts b/src/api/types/DeviceMetadata.ts new file mode 100644 index 000000000..407c6ecc6 --- /dev/null +++ b/src/api/types/DeviceMetadata.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DeviceMetadata { + /** The Terminal’s remaining battery percentage, between 1-100. */ + batteryPercentage?: string | null; + /** + * The current charging state of the Terminal. + * Options: `CHARGING`, `NOT_CHARGING` + */ + chargingState?: string | null; + /** The ID of the Square seller business location associated with the Terminal. */ + locationId?: string | null; + /** The ID of the Square merchant account that is currently signed-in to the Terminal. */ + merchantId?: string | null; + /** + * The Terminal’s current network connection type. + * Options: `WIFI`, `ETHERNET` + */ + networkConnectionType?: string | null; + /** The country in which the Terminal is authorized to take payments. */ + paymentRegion?: string | null; + /** + * The unique identifier assigned to the Terminal, which can be found on the lower back + * of the device. + */ + serialNumber?: string | null; + /** The current version of the Terminal’s operating system. */ + osVersion?: string | null; + /** The current version of the application running on the Terminal. */ + appVersion?: string | null; + /** The name of the Wi-Fi network to which the Terminal is connected. */ + wifiNetworkName?: string | null; + /** + * The signal strength of the Wi-FI network connection. + * Options: `POOR`, `FAIR`, `GOOD`, `EXCELLENT` + */ + wifiNetworkStrength?: string | null; + /** The IP address of the Terminal. */ + ipAddress?: string | null; +} diff --git a/src/api/types/DeviceStatus.ts b/src/api/types/DeviceStatus.ts new file mode 100644 index 000000000..25843c08c --- /dev/null +++ b/src/api/types/DeviceStatus.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DeviceStatus { + /** + * See [Category](#type-category) for possible values + */ + category?: Square.DeviceStatusCategory; +} diff --git a/src/api/types/DeviceStatusCategory.ts b/src/api/types/DeviceStatusCategory.ts new file mode 100644 index 000000000..cb580c647 --- /dev/null +++ b/src/api/types/DeviceStatusCategory.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type DeviceStatusCategory = "AVAILABLE" | "NEEDS_ATTENTION" | "OFFLINE"; +export const DeviceStatusCategory = { + Available: "AVAILABLE", + NeedsAttention: "NEEDS_ATTENTION", + Offline: "OFFLINE", +} as const; diff --git a/src/api/types/DigitalWalletDetails.ts b/src/api/types/DigitalWalletDetails.ts new file mode 100644 index 000000000..d64610a55 --- /dev/null +++ b/src/api/types/DigitalWalletDetails.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Additional details about `WALLET` type payments. Contains only non-confidential information. + */ +export interface DigitalWalletDetails { + /** + * The status of the `WALLET` payment. The status can be `AUTHORIZED`, `CAPTURED`, `VOIDED`, or + * `FAILED`. + */ + status?: string | null; + /** + * The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`, + * `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY` or `UNKNOWN`. + */ + brand?: string | null; + /** Brand-specific details for payments with the `brand` of `CASH_APP`. */ + cashAppDetails?: Square.CashAppDetails; +} diff --git a/src/api/types/DisableCardResponse.ts b/src/api/types/DisableCardResponse.ts new file mode 100644 index 000000000..9b9a103db --- /dev/null +++ b/src/api/types/DisableCardResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [DisableCard](api-endpoint:Cards-DisableCard) endpoint. + * + * Note: if there are errors processing the request, the card field will not be + * present. + */ +export interface DisableCardResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The retrieved card. */ + card?: Square.Card; +} diff --git a/src/api/types/DisableEventsResponse.ts b/src/api/types/DisableEventsResponse.ts new file mode 100644 index 000000000..070f3298f --- /dev/null +++ b/src/api/types/DisableEventsResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [DisableEvents](api-endpoint:Events-DisableEvents) endpoint. + * + * Note: if there are errors processing the request, the events field will not be + * present. + */ +export interface DisableEventsResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/DismissTerminalActionResponse.ts b/src/api/types/DismissTerminalActionResponse.ts new file mode 100644 index 000000000..2eb4d847e --- /dev/null +++ b/src/api/types/DismissTerminalActionResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DismissTerminalActionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** Current state of the action to be dismissed. */ + action?: Square.TerminalAction; +} diff --git a/src/api/types/DismissTerminalCheckoutResponse.ts b/src/api/types/DismissTerminalCheckoutResponse.ts new file mode 100644 index 000000000..1cf11b8b8 --- /dev/null +++ b/src/api/types/DismissTerminalCheckoutResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DismissTerminalCheckoutResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** Current state of the checkout to be dismissed. */ + checkout?: Square.TerminalCheckout; +} diff --git a/src/api/types/DismissTerminalRefundResponse.ts b/src/api/types/DismissTerminalRefundResponse.ts new file mode 100644 index 000000000..e79e0f94b --- /dev/null +++ b/src/api/types/DismissTerminalRefundResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DismissTerminalRefundResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** Current state of the refund to be dismissed. */ + refund?: Square.TerminalRefund; +} diff --git a/src/api/types/Dispute.ts b/src/api/types/Dispute.ts new file mode 100644 index 000000000..ad6f9f8f9 --- /dev/null +++ b/src/api/types/Dispute.ts @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. + */ +export interface Dispute { + /** The unique ID for this `Dispute`, generated by Square. */ + disputeId?: string | null; + /** The unique ID for this `Dispute`, generated by Square. */ + id?: string; + /** + * The disputed amount, which can be less than the total transaction amount. + * For instance, if multiple items were purchased but the cardholder only initiates a dispute over some of the items. + */ + amountMoney?: Square.Money; + /** + * The reason why the cardholder initiated the dispute. + * See [DisputeReason](#type-disputereason) for possible values + */ + reason?: Square.DisputeReason; + /** + * The current state of this dispute. + * See [DisputeState](#type-disputestate) for possible values + */ + state?: Square.DisputeState; + /** The deadline by which the seller must respond to the dispute, in [RFC 3339 format](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates). */ + dueAt?: string | null; + /** The payment challenged in this dispute. */ + disputedPayment?: Square.DisputedPayment; + /** The IDs of the evidence associated with the dispute. */ + evidenceIds?: string[] | null; + /** + * The card brand used in the disputed payment. + * See [CardBrand](#type-cardbrand) for possible values + */ + cardBrand?: Square.CardBrand; + /** The timestamp when the dispute was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the dispute was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** The ID of the dispute in the card brand system, generated by the card brand. */ + brandDisputeId?: string | null; + /** The timestamp when the dispute was reported, in RFC 3339 format. */ + reportedDate?: string | null; + /** The timestamp when the dispute was reported, in RFC 3339 format. */ + reportedAt?: string | null; + /** The current version of the `Dispute`. */ + version?: number; + /** The ID of the location where the dispute originated. */ + locationId?: string | null; +} diff --git a/src/api/types/DisputeEvidence.ts b/src/api/types/DisputeEvidence.ts new file mode 100644 index 000000000..958a24acb --- /dev/null +++ b/src/api/types/DisputeEvidence.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface DisputeEvidence { + /** The Square-generated ID of the evidence. */ + evidenceId?: string | null; + /** The Square-generated ID of the evidence. */ + id?: string; + /** The ID of the dispute the evidence is associated with. */ + disputeId?: string | null; + /** Image, PDF, TXT */ + evidenceFile?: Square.DisputeEvidenceFile; + /** Raw text */ + evidenceText?: string | null; + /** The time when the evidence was uploaded, in RFC 3339 format. */ + uploadedAt?: string | null; + /** + * The type of the evidence. + * See [DisputeEvidenceType](#type-disputeevidencetype) for possible values + */ + evidenceType?: Square.DisputeEvidenceType; +} diff --git a/src/api/types/DisputeEvidenceFile.ts b/src/api/types/DisputeEvidenceFile.ts new file mode 100644 index 000000000..44c30dd16 --- /dev/null +++ b/src/api/types/DisputeEvidenceFile.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A file to be uploaded as dispute evidence. + */ +export interface DisputeEvidenceFile { + /** The file name including the file extension. For example: "receipt.tiff". */ + filename?: string | null; + /** Dispute evidence files must be application/pdf, image/heic, image/heif, image/jpeg, image/png, or image/tiff formats. */ + filetype?: string | null; +} diff --git a/src/api/types/DisputeEvidenceType.ts b/src/api/types/DisputeEvidenceType.ts new file mode 100644 index 000000000..a1952d50e --- /dev/null +++ b/src/api/types/DisputeEvidenceType.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of the dispute evidence. + */ +export type DisputeEvidenceType = + | "GENERIC_EVIDENCE" + | "ONLINE_OR_APP_ACCESS_LOG" + | "AUTHORIZATION_DOCUMENTATION" + | "CANCELLATION_OR_REFUND_DOCUMENTATION" + | "CARDHOLDER_COMMUNICATION" + | "CARDHOLDER_INFORMATION" + | "PURCHASE_ACKNOWLEDGEMENT" + | "DUPLICATE_CHARGE_DOCUMENTATION" + | "PRODUCT_OR_SERVICE_DESCRIPTION" + | "RECEIPT" + | "SERVICE_RECEIVED_DOCUMENTATION" + | "PROOF_OF_DELIVERY_DOCUMENTATION" + | "RELATED_TRANSACTION_DOCUMENTATION" + | "REBUTTAL_EXPLANATION" + | "TRACKING_NUMBER"; +export const DisputeEvidenceType = { + GenericEvidence: "GENERIC_EVIDENCE", + OnlineOrAppAccessLog: "ONLINE_OR_APP_ACCESS_LOG", + AuthorizationDocumentation: "AUTHORIZATION_DOCUMENTATION", + CancellationOrRefundDocumentation: "CANCELLATION_OR_REFUND_DOCUMENTATION", + CardholderCommunication: "CARDHOLDER_COMMUNICATION", + CardholderInformation: "CARDHOLDER_INFORMATION", + PurchaseAcknowledgement: "PURCHASE_ACKNOWLEDGEMENT", + DuplicateChargeDocumentation: "DUPLICATE_CHARGE_DOCUMENTATION", + ProductOrServiceDescription: "PRODUCT_OR_SERVICE_DESCRIPTION", + Receipt: "RECEIPT", + ServiceReceivedDocumentation: "SERVICE_RECEIVED_DOCUMENTATION", + ProofOfDeliveryDocumentation: "PROOF_OF_DELIVERY_DOCUMENTATION", + RelatedTransactionDocumentation: "RELATED_TRANSACTION_DOCUMENTATION", + RebuttalExplanation: "REBUTTAL_EXPLANATION", + TrackingNumber: "TRACKING_NUMBER", +} as const; diff --git a/src/api/types/DisputeReason.ts b/src/api/types/DisputeReason.ts new file mode 100644 index 000000000..a2f57806c --- /dev/null +++ b/src/api/types/DisputeReason.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The list of possible reasons why a cardholder might initiate a + * dispute with their bank. + */ +export type DisputeReason = + | "AMOUNT_DIFFERS" + | "CANCELLED" + | "DUPLICATE" + | "NO_KNOWLEDGE" + | "NOT_AS_DESCRIBED" + | "NOT_RECEIVED" + | "PAID_BY_OTHER_MEANS" + | "CUSTOMER_REQUESTS_CREDIT" + | "EMV_LIABILITY_SHIFT"; +export const DisputeReason = { + AmountDiffers: "AMOUNT_DIFFERS", + Cancelled: "CANCELLED", + Duplicate: "DUPLICATE", + NoKnowledge: "NO_KNOWLEDGE", + NotAsDescribed: "NOT_AS_DESCRIBED", + NotReceived: "NOT_RECEIVED", + PaidByOtherMeans: "PAID_BY_OTHER_MEANS", + CustomerRequestsCredit: "CUSTOMER_REQUESTS_CREDIT", + EmvLiabilityShift: "EMV_LIABILITY_SHIFT", +} as const; diff --git a/src/api/types/DisputeState.ts b/src/api/types/DisputeState.ts new file mode 100644 index 000000000..bb425f605 --- /dev/null +++ b/src/api/types/DisputeState.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The list of possible dispute states. + */ +export type DisputeState = + | "INQUIRY_EVIDENCE_REQUIRED" + | "INQUIRY_PROCESSING" + | "INQUIRY_CLOSED" + | "EVIDENCE_REQUIRED" + | "PROCESSING" + | "WON" + | "LOST" + | "ACCEPTED"; +export const DisputeState = { + InquiryEvidenceRequired: "INQUIRY_EVIDENCE_REQUIRED", + InquiryProcessing: "INQUIRY_PROCESSING", + InquiryClosed: "INQUIRY_CLOSED", + EvidenceRequired: "EVIDENCE_REQUIRED", + Processing: "PROCESSING", + Won: "WON", + Lost: "LOST", + Accepted: "ACCEPTED", +} as const; diff --git a/src/api/types/DisputedPayment.ts b/src/api/types/DisputedPayment.ts new file mode 100644 index 000000000..3a0c7158e --- /dev/null +++ b/src/api/types/DisputedPayment.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The payment the cardholder disputed. + */ +export interface DisputedPayment { + /** Square-generated unique ID of the payment being disputed. */ + paymentId?: string | null; +} diff --git a/src/api/types/Employee.ts b/src/api/types/Employee.ts new file mode 100644 index 000000000..e8ae75817 --- /dev/null +++ b/src/api/types/Employee.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * An employee object that is used by the external API. + * + * DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember). + */ +export interface Employee { + /** UUID for this object. */ + id?: string; + /** The employee's first name. */ + firstName?: string | null; + /** The employee's last name. */ + lastName?: string | null; + /** The employee's email address */ + email?: string | null; + /** The employee's phone number in E.164 format, i.e. "+12125554250" */ + phoneNumber?: string | null; + /** A list of location IDs where this employee has access to. */ + locationIds?: string[] | null; + /** + * Specifies the status of the employees being fetched. + * See [EmployeeStatus](#type-employeestatus) for possible values + */ + status?: Square.EmployeeStatus; + /** + * Whether this employee is the owner of the merchant. Each merchant + * has one owner employee, and that employee has full authority over + * the account. + */ + isOwner?: boolean | null; + /** A read-only timestamp in RFC 3339 format. */ + createdAt?: string; + /** A read-only timestamp in RFC 3339 format. */ + updatedAt?: string; +} diff --git a/src/api/types/EmployeeStatus.ts b/src/api/types/EmployeeStatus.ts new file mode 100644 index 000000000..3a9d7592f --- /dev/null +++ b/src/api/types/EmployeeStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The status of the Employee being retrieved. + * + * DEPRECATED at version 2020-08-26. Replaced by [TeamMemberStatus](entity:TeamMemberStatus). + */ +export type EmployeeStatus = "ACTIVE" | "INACTIVE"; +export const EmployeeStatus = { + Active: "ACTIVE", + Inactive: "INACTIVE", +} as const; diff --git a/src/api/types/EmployeeWage.ts b/src/api/types/EmployeeWage.ts new file mode 100644 index 000000000..ef2a5948e --- /dev/null +++ b/src/api/types/EmployeeWage.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * 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; + /** The `Employee` that this wage is assigned to. */ + employeeId?: string | null; + /** The job title that this wage relates to. */ + title?: string | null; + /** + * Can be a custom-set hourly wage or the calculated effective hourly + * wage based on the annual wage and hours worked per week. + */ + hourlyRate?: Square.Money; +} diff --git a/src/api/types/EnableEventsResponse.ts b/src/api/types/EnableEventsResponse.ts new file mode 100644 index 000000000..28a57e147 --- /dev/null +++ b/src/api/types/EnableEventsResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [EnableEvents](api-endpoint:Events-EnableEvents) endpoint. + * + * Note: if there are errors processing the request, the events field will not be + * present. + */ +export interface EnableEventsResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ErrorCategory.ts b/src/api/types/ErrorCategory.ts new file mode 100644 index 000000000..90766ec56 --- /dev/null +++ b/src/api/types/ErrorCategory.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates which high-level category of error has occurred during a + * request to the Connect API. + */ +export type ErrorCategory = + | "API_ERROR" + | "AUTHENTICATION_ERROR" + | "INVALID_REQUEST_ERROR" + | "RATE_LIMIT_ERROR" + | "PAYMENT_METHOD_ERROR" + | "REFUND_ERROR" + | "MERCHANT_SUBSCRIPTION_ERROR" + | "EXTERNAL_VENDOR_ERROR"; +export const ErrorCategory = { + ApiError: "API_ERROR", + AuthenticationError: "AUTHENTICATION_ERROR", + InvalidRequestError: "INVALID_REQUEST_ERROR", + RateLimitError: "RATE_LIMIT_ERROR", + PaymentMethodError: "PAYMENT_METHOD_ERROR", + RefundError: "REFUND_ERROR", + MerchantSubscriptionError: "MERCHANT_SUBSCRIPTION_ERROR", + ExternalVendorError: "EXTERNAL_VENDOR_ERROR", +} as const; diff --git a/src/api/types/ErrorCode.ts b/src/api/types/ErrorCode.ts new file mode 100644 index 000000000..f15d31351 --- /dev/null +++ b/src/api/types/ErrorCode.ts @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the specific error that occurred during a request to a + * Square API. + */ +export type ErrorCode = + | "INTERNAL_SERVER_ERROR" + | "UNAUTHORIZED" + | "ACCESS_TOKEN_EXPIRED" + | "ACCESS_TOKEN_REVOKED" + | "CLIENT_DISABLED" + | "FORBIDDEN" + | "INSUFFICIENT_SCOPES" + | "APPLICATION_DISABLED" + | "V1_APPLICATION" + | "V1_ACCESS_TOKEN" + | "CARD_PROCESSING_NOT_ENABLED" + | "MERCHANT_SUBSCRIPTION_NOT_FOUND" + | "BAD_REQUEST" + | "MISSING_REQUIRED_PARAMETER" + | "INCORRECT_TYPE" + | "INVALID_TIME" + | "INVALID_TIME_RANGE" + | "INVALID_VALUE" + | "INVALID_CURSOR" + | "UNKNOWN_QUERY_PARAMETER" + | "CONFLICTING_PARAMETERS" + | "EXPECTED_JSON_BODY" + | "INVALID_SORT_ORDER" + | "VALUE_REGEX_MISMATCH" + | "VALUE_TOO_SHORT" + | "VALUE_TOO_LONG" + | "VALUE_TOO_LOW" + | "VALUE_TOO_HIGH" + | "VALUE_EMPTY" + | "ARRAY_LENGTH_TOO_LONG" + | "ARRAY_LENGTH_TOO_SHORT" + | "ARRAY_EMPTY" + | "EXPECTED_BOOLEAN" + | "EXPECTED_INTEGER" + | "EXPECTED_FLOAT" + | "EXPECTED_STRING" + | "EXPECTED_OBJECT" + | "EXPECTED_ARRAY" + | "EXPECTED_MAP" + | "EXPECTED_BASE64_ENCODED_BYTE_ARRAY" + | "INVALID_ARRAY_VALUE" + | "INVALID_ENUM_VALUE" + | "INVALID_CONTENT_TYPE" + | "INVALID_FORM_VALUE" + | "CUSTOMER_NOT_FOUND" + | "ONE_INSTRUMENT_EXPECTED" + | "NO_FIELDS_SET" + | "TOO_MANY_MAP_ENTRIES" + | "MAP_KEY_LENGTH_TOO_SHORT" + | "MAP_KEY_LENGTH_TOO_LONG" + | "CUSTOMER_MISSING_NAME" + | "CUSTOMER_MISSING_EMAIL" + | "INVALID_PAUSE_LENGTH" + | "INVALID_DATE" + | "UNSUPPORTED_COUNTRY" + | "UNSUPPORTED_CURRENCY" + | "APPLE_TTP_PIN_TOKEN" + | "CARD_EXPIRED" + | "INVALID_EXPIRATION" + | "INVALID_EXPIRATION_YEAR" + | "INVALID_EXPIRATION_DATE" + | "UNSUPPORTED_CARD_BRAND" + | "UNSUPPORTED_ENTRY_METHOD" + | "INVALID_ENCRYPTED_CARD" + | "INVALID_CARD" + | "PAYMENT_AMOUNT_MISMATCH" + | "GENERIC_DECLINE" + | "CVV_FAILURE" + | "ADDRESS_VERIFICATION_FAILURE" + | "INVALID_ACCOUNT" + | "CURRENCY_MISMATCH" + | "INSUFFICIENT_FUNDS" + | "INSUFFICIENT_PERMISSIONS" + | "CARDHOLDER_INSUFFICIENT_PERMISSIONS" + | "INVALID_LOCATION" + | "TRANSACTION_LIMIT" + | "VOICE_FAILURE" + | "PAN_FAILURE" + | "EXPIRATION_FAILURE" + | "CARD_NOT_SUPPORTED" + | "INVALID_PIN" + | "MISSING_PIN" + | "MISSING_ACCOUNT_TYPE" + | "INVALID_POSTAL_CODE" + | "INVALID_FEES" + | "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED" + | "PAYMENT_LIMIT_EXCEEDED" + | "GIFT_CARD_AVAILABLE_AMOUNT" + | "ACCOUNT_UNUSABLE" + | "BUYER_REFUSED_PAYMENT" + | "DELAYED_TRANSACTION_EXPIRED" + | "DELAYED_TRANSACTION_CANCELED" + | "DELAYED_TRANSACTION_CAPTURED" + | "DELAYED_TRANSACTION_FAILED" + | "CARD_TOKEN_EXPIRED" + | "CARD_TOKEN_USED" + | "AMOUNT_TOO_HIGH" + | "UNSUPPORTED_INSTRUMENT_TYPE" + | "REFUND_AMOUNT_INVALID" + | "REFUND_ALREADY_PENDING" + | "PAYMENT_NOT_REFUNDABLE" + | "PAYMENT_NOT_REFUNDABLE_DUE_TO_DISPUTE" + | "REFUND_DECLINED" + | "INSUFFICIENT_PERMISSIONS_FOR_REFUND" + | "INVALID_CARD_DATA" + | "SOURCE_USED" + | "SOURCE_EXPIRED" + | "UNSUPPORTED_LOYALTY_REWARD_TIER" + | "LOCATION_MISMATCH" + | "IDEMPOTENCY_KEY_REUSED" + | "UNEXPECTED_VALUE" + | "SANDBOX_NOT_SUPPORTED" + | "INVALID_EMAIL_ADDRESS" + | "INVALID_PHONE_NUMBER" + | "CHECKOUT_EXPIRED" + | "BAD_CERTIFICATE" + | "INVALID_SQUARE_VERSION_FORMAT" + | "API_VERSION_INCOMPATIBLE" + | "CARD_PRESENCE_REQUIRED" + | "UNSUPPORTED_SOURCE_TYPE" + | "CARD_MISMATCH" + | "PLAID_ERROR" + | "PLAID_ERROR_ITEM_LOGIN_REQUIRED" + | "PLAID_ERROR_RATE_LIMIT" + | "CARD_DECLINED" + | "VERIFY_CVV_FAILURE" + | "VERIFY_AVS_FAILURE" + | "CARD_DECLINED_CALL_ISSUER" + | "CARD_DECLINED_VERIFICATION_REQUIRED" + | "BAD_EXPIRATION" + | "CHIP_INSERTION_REQUIRED" + | "ALLOWABLE_PIN_TRIES_EXCEEDED" + | "RESERVATION_DECLINED" + | "UNKNOWN_BODY_PARAMETER" + | "NOT_FOUND" + | "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND" + | "METHOD_NOT_ALLOWED" + | "NOT_ACCEPTABLE" + | "REQUEST_TIMEOUT" + | "CONFLICT" + | "GONE" + | "REQUEST_ENTITY_TOO_LARGE" + | "UNSUPPORTED_MEDIA_TYPE" + | "UNPROCESSABLE_ENTITY" + | "RATE_LIMITED" + | "NOT_IMPLEMENTED" + | "BAD_GATEWAY" + | "SERVICE_UNAVAILABLE" + | "TEMPORARY_ERROR" + | "GATEWAY_TIMEOUT"; +export const ErrorCode = { + InternalServerError: "INTERNAL_SERVER_ERROR", + Unauthorized: "UNAUTHORIZED", + AccessTokenExpired: "ACCESS_TOKEN_EXPIRED", + AccessTokenRevoked: "ACCESS_TOKEN_REVOKED", + ClientDisabled: "CLIENT_DISABLED", + Forbidden: "FORBIDDEN", + InsufficientScopes: "INSUFFICIENT_SCOPES", + ApplicationDisabled: "APPLICATION_DISABLED", + V1Application: "V1_APPLICATION", + V1AccessToken: "V1_ACCESS_TOKEN", + CardProcessingNotEnabled: "CARD_PROCESSING_NOT_ENABLED", + MerchantSubscriptionNotFound: "MERCHANT_SUBSCRIPTION_NOT_FOUND", + BadRequest: "BAD_REQUEST", + MissingRequiredParameter: "MISSING_REQUIRED_PARAMETER", + IncorrectType: "INCORRECT_TYPE", + InvalidTime: "INVALID_TIME", + InvalidTimeRange: "INVALID_TIME_RANGE", + InvalidValue: "INVALID_VALUE", + InvalidCursor: "INVALID_CURSOR", + UnknownQueryParameter: "UNKNOWN_QUERY_PARAMETER", + ConflictingParameters: "CONFLICTING_PARAMETERS", + ExpectedJsonBody: "EXPECTED_JSON_BODY", + InvalidSortOrder: "INVALID_SORT_ORDER", + ValueRegexMismatch: "VALUE_REGEX_MISMATCH", + ValueTooShort: "VALUE_TOO_SHORT", + ValueTooLong: "VALUE_TOO_LONG", + ValueTooLow: "VALUE_TOO_LOW", + ValueTooHigh: "VALUE_TOO_HIGH", + ValueEmpty: "VALUE_EMPTY", + ArrayLengthTooLong: "ARRAY_LENGTH_TOO_LONG", + ArrayLengthTooShort: "ARRAY_LENGTH_TOO_SHORT", + ArrayEmpty: "ARRAY_EMPTY", + ExpectedBoolean: "EXPECTED_BOOLEAN", + ExpectedInteger: "EXPECTED_INTEGER", + ExpectedFloat: "EXPECTED_FLOAT", + ExpectedString: "EXPECTED_STRING", + ExpectedObject: "EXPECTED_OBJECT", + ExpectedArray: "EXPECTED_ARRAY", + ExpectedMap: "EXPECTED_MAP", + ExpectedBase64EncodedByteArray: "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", + InvalidArrayValue: "INVALID_ARRAY_VALUE", + InvalidEnumValue: "INVALID_ENUM_VALUE", + InvalidContentType: "INVALID_CONTENT_TYPE", + InvalidFormValue: "INVALID_FORM_VALUE", + CustomerNotFound: "CUSTOMER_NOT_FOUND", + OneInstrumentExpected: "ONE_INSTRUMENT_EXPECTED", + NoFieldsSet: "NO_FIELDS_SET", + TooManyMapEntries: "TOO_MANY_MAP_ENTRIES", + MapKeyLengthTooShort: "MAP_KEY_LENGTH_TOO_SHORT", + MapKeyLengthTooLong: "MAP_KEY_LENGTH_TOO_LONG", + CustomerMissingName: "CUSTOMER_MISSING_NAME", + CustomerMissingEmail: "CUSTOMER_MISSING_EMAIL", + InvalidPauseLength: "INVALID_PAUSE_LENGTH", + InvalidDate: "INVALID_DATE", + UnsupportedCountry: "UNSUPPORTED_COUNTRY", + UnsupportedCurrency: "UNSUPPORTED_CURRENCY", + AppleTtpPinToken: "APPLE_TTP_PIN_TOKEN", + CardExpired: "CARD_EXPIRED", + InvalidExpiration: "INVALID_EXPIRATION", + InvalidExpirationYear: "INVALID_EXPIRATION_YEAR", + InvalidExpirationDate: "INVALID_EXPIRATION_DATE", + UnsupportedCardBrand: "UNSUPPORTED_CARD_BRAND", + UnsupportedEntryMethod: "UNSUPPORTED_ENTRY_METHOD", + InvalidEncryptedCard: "INVALID_ENCRYPTED_CARD", + InvalidCard: "INVALID_CARD", + PaymentAmountMismatch: "PAYMENT_AMOUNT_MISMATCH", + GenericDecline: "GENERIC_DECLINE", + CvvFailure: "CVV_FAILURE", + AddressVerificationFailure: "ADDRESS_VERIFICATION_FAILURE", + InvalidAccount: "INVALID_ACCOUNT", + CurrencyMismatch: "CURRENCY_MISMATCH", + InsufficientFunds: "INSUFFICIENT_FUNDS", + InsufficientPermissions: "INSUFFICIENT_PERMISSIONS", + CardholderInsufficientPermissions: "CARDHOLDER_INSUFFICIENT_PERMISSIONS", + InvalidLocation: "INVALID_LOCATION", + TransactionLimit: "TRANSACTION_LIMIT", + VoiceFailure: "VOICE_FAILURE", + PanFailure: "PAN_FAILURE", + ExpirationFailure: "EXPIRATION_FAILURE", + CardNotSupported: "CARD_NOT_SUPPORTED", + InvalidPin: "INVALID_PIN", + MissingPin: "MISSING_PIN", + MissingAccountType: "MISSING_ACCOUNT_TYPE", + InvalidPostalCode: "INVALID_POSTAL_CODE", + InvalidFees: "INVALID_FEES", + ManuallyEnteredPaymentNotSupported: "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED", + PaymentLimitExceeded: "PAYMENT_LIMIT_EXCEEDED", + GiftCardAvailableAmount: "GIFT_CARD_AVAILABLE_AMOUNT", + AccountUnusable: "ACCOUNT_UNUSABLE", + BuyerRefusedPayment: "BUYER_REFUSED_PAYMENT", + DelayedTransactionExpired: "DELAYED_TRANSACTION_EXPIRED", + DelayedTransactionCanceled: "DELAYED_TRANSACTION_CANCELED", + DelayedTransactionCaptured: "DELAYED_TRANSACTION_CAPTURED", + DelayedTransactionFailed: "DELAYED_TRANSACTION_FAILED", + CardTokenExpired: "CARD_TOKEN_EXPIRED", + CardTokenUsed: "CARD_TOKEN_USED", + AmountTooHigh: "AMOUNT_TOO_HIGH", + UnsupportedInstrumentType: "UNSUPPORTED_INSTRUMENT_TYPE", + RefundAmountInvalid: "REFUND_AMOUNT_INVALID", + RefundAlreadyPending: "REFUND_ALREADY_PENDING", + PaymentNotRefundable: "PAYMENT_NOT_REFUNDABLE", + PaymentNotRefundableDueToDispute: "PAYMENT_NOT_REFUNDABLE_DUE_TO_DISPUTE", + RefundDeclined: "REFUND_DECLINED", + InsufficientPermissionsForRefund: "INSUFFICIENT_PERMISSIONS_FOR_REFUND", + InvalidCardData: "INVALID_CARD_DATA", + SourceUsed: "SOURCE_USED", + SourceExpired: "SOURCE_EXPIRED", + UnsupportedLoyaltyRewardTier: "UNSUPPORTED_LOYALTY_REWARD_TIER", + LocationMismatch: "LOCATION_MISMATCH", + IdempotencyKeyReused: "IDEMPOTENCY_KEY_REUSED", + UnexpectedValue: "UNEXPECTED_VALUE", + SandboxNotSupported: "SANDBOX_NOT_SUPPORTED", + InvalidEmailAddress: "INVALID_EMAIL_ADDRESS", + InvalidPhoneNumber: "INVALID_PHONE_NUMBER", + CheckoutExpired: "CHECKOUT_EXPIRED", + BadCertificate: "BAD_CERTIFICATE", + InvalidSquareVersionFormat: "INVALID_SQUARE_VERSION_FORMAT", + ApiVersionIncompatible: "API_VERSION_INCOMPATIBLE", + CardPresenceRequired: "CARD_PRESENCE_REQUIRED", + UnsupportedSourceType: "UNSUPPORTED_SOURCE_TYPE", + CardMismatch: "CARD_MISMATCH", + PlaidError: "PLAID_ERROR", + PlaidErrorItemLoginRequired: "PLAID_ERROR_ITEM_LOGIN_REQUIRED", + PlaidErrorRateLimit: "PLAID_ERROR_RATE_LIMIT", + CardDeclined: "CARD_DECLINED", + VerifyCvvFailure: "VERIFY_CVV_FAILURE", + VerifyAvsFailure: "VERIFY_AVS_FAILURE", + CardDeclinedCallIssuer: "CARD_DECLINED_CALL_ISSUER", + CardDeclinedVerificationRequired: "CARD_DECLINED_VERIFICATION_REQUIRED", + BadExpiration: "BAD_EXPIRATION", + ChipInsertionRequired: "CHIP_INSERTION_REQUIRED", + AllowablePinTriesExceeded: "ALLOWABLE_PIN_TRIES_EXCEEDED", + ReservationDeclined: "RESERVATION_DECLINED", + UnknownBodyParameter: "UNKNOWN_BODY_PARAMETER", + NotFound: "NOT_FOUND", + ApplePaymentProcessingCertificateHashNotFound: "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", + MethodNotAllowed: "METHOD_NOT_ALLOWED", + NotAcceptable: "NOT_ACCEPTABLE", + RequestTimeout: "REQUEST_TIMEOUT", + Conflict: "CONFLICT", + Gone: "GONE", + RequestEntityTooLarge: "REQUEST_ENTITY_TOO_LARGE", + UnsupportedMediaType: "UNSUPPORTED_MEDIA_TYPE", + UnprocessableEntity: "UNPROCESSABLE_ENTITY", + RateLimited: "RATE_LIMITED", + NotImplemented: "NOT_IMPLEMENTED", + BadGateway: "BAD_GATEWAY", + ServiceUnavailable: "SERVICE_UNAVAILABLE", + TemporaryError: "TEMPORARY_ERROR", + GatewayTimeout: "GATEWAY_TIMEOUT", +} as const; diff --git a/src/api/types/Error_.ts b/src/api/types/Error_.ts new file mode 100644 index 000000000..6efac0309 --- /dev/null +++ b/src/api/types/Error_.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * 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. + */ +export interface Error_ { + /** + * The high-level category for the error. + * See [ErrorCategory](#type-errorcategory) for possible values + */ + category: Square.ErrorCategory; + /** + * The specific code of the error. + * See [ErrorCode](#type-errorcode) for possible values + */ + code: Square.ErrorCode; + /** A human-readable description of the error for debugging purposes. */ + detail?: string; + /** + * The name of the field provided in the original request (if any) that + * the error pertains to. + */ + field?: string; +} diff --git a/src/api/types/Event.ts b/src/api/types/Event.ts new file mode 100644 index 000000000..b3c8135ed --- /dev/null +++ b/src/api/types/Event.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface Event { + /** The ID of the target merchant associated with the event. */ + merchantId?: string | null; + /** The ID of the target location associated with the event. */ + locationId?: string | null; + /** The type of event this represents. */ + type?: string | null; + /** A unique ID for the event. */ + eventId?: string | null; + /** Timestamp of when the event was created, in RFC 3339 format. */ + createdAt?: string; + /** The data associated with the event. */ + data?: Square.EventData; +} diff --git a/src/api/types/EventData.ts b/src/api/types/EventData.ts new file mode 100644 index 000000000..54d750b75 --- /dev/null +++ b/src/api/types/EventData.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface EventData { + /** The name of the affected object’s type. */ + type?: string | null; + /** The ID of the affected object. */ + id?: string; + /** This is true if the affected object has been deleted; otherwise, it's absent. */ + deleted?: boolean | null; + /** An object containing fields and values relevant to the event. It is absent if the affected object has been deleted. */ + object?: Record | null; +} diff --git a/src/api/types/EventMetadata.ts b/src/api/types/EventMetadata.ts new file mode 100644 index 000000000..afda8f14d --- /dev/null +++ b/src/api/types/EventMetadata.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Contains metadata about a particular [Event](entity:Event). + */ +export interface EventMetadata { + /** A unique ID for the event. */ + eventId?: string | null; + /** The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created. */ + apiVersion?: string | null; +} diff --git a/src/api/types/EventTypeMetadata.ts b/src/api/types/EventTypeMetadata.ts new file mode 100644 index 000000000..ab26d5ea5 --- /dev/null +++ b/src/api/types/EventTypeMetadata.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Contains the metadata of a webhook event type. + */ +export interface EventTypeMetadata { + /** The event type. */ + eventType?: string; + /** The API version at which the event type was introduced. */ + apiVersionIntroduced?: string; + /** The release status of the event type. */ + releaseStatus?: string; +} diff --git a/src/api/types/ExcludeStrategy.ts b/src/api/types/ExcludeStrategy.ts new file mode 100644 index 000000000..6305eb6fa --- /dev/null +++ b/src/api/types/ExcludeStrategy.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates which products matched by a CatalogPricingRule + * will be excluded if the pricing rule uses an exclude set. + */ +export type ExcludeStrategy = "LEAST_EXPENSIVE" | "MOST_EXPENSIVE"; +export const ExcludeStrategy = { + LeastExpensive: "LEAST_EXPENSIVE", + MostExpensive: "MOST_EXPENSIVE", +} as const; diff --git a/src/api/types/ExternalPaymentDetails.ts b/src/api/types/ExternalPaymentDetails.ts new file mode 100644 index 000000000..013cd8786 --- /dev/null +++ b/src/api/types/ExternalPaymentDetails.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Stores details about an external payment. Contains only non-confidential information. + * For more information, see + * [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). + */ +export interface ExternalPaymentDetails { + /** + * The type of external payment the seller received. It can be one of the following: + * - CHECK - Paid using a physical check. + * - BANK_TRANSFER - Paid using external bank transfer. + * - OTHER\_GIFT\_CARD - Paid using a non-Square gift card. + * - CRYPTO - Paid using a crypto currency. + * - SQUARE_CASH - Paid using Square Cash App. + * - SOCIAL - Paid using peer-to-peer payment applications. + * - EXTERNAL - A third-party application gathered this payment outside of Square. + * - EMONEY - Paid using an E-money provider. + * - CARD - A credit or debit card that Square does not support. + * - STORED_BALANCE - Use for house accounts, store credit, and so forth. + * - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals + * - OTHER - A type not listed here. + */ + type: string; + /** + * A description of the external payment source. For example, + * "Food Delivery Service". + */ + source: string; + /** An ID to associate the payment to its originating source. */ + sourceId?: string | null; + /** + * The fees paid to the source. The `amount_money` minus this field is + * the net amount seller receives. + */ + sourceFeeMoney?: Square.Money; +} diff --git a/src/api/types/FilterValue.ts b/src/api/types/FilterValue.ts new file mode 100644 index 000000000..2e3e17584 --- /dev/null +++ b/src/api/types/FilterValue.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A filter to select resources based on an exact field value. For any given + * value, the value can only be in one property. Depending on the field, either + * all properties can be set or only a subset will be available. + * + * Refer to the documentation of the field. + */ +export interface FilterValue { + /** A list of terms that must be present on the field of the resource. */ + all?: string[] | null; + /** + * A list of terms where at least one of them must be present on the + * field of the resource. + */ + any?: string[] | null; + /** A list of terms that must not be present on the field the resource */ + none?: string[] | null; +} diff --git a/src/api/types/FloatNumberRange.ts b/src/api/types/FloatNumberRange.ts new file mode 100644 index 000000000..8505a494b --- /dev/null +++ b/src/api/types/FloatNumberRange.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specifies a decimal number range. + */ +export interface FloatNumberRange { + /** A decimal value indicating where the range starts. */ + startAt?: string | null; + /** A decimal value indicating where the range ends. */ + endAt?: string | null; +} diff --git a/src/api/types/Fulfillment.ts b/src/api/types/Fulfillment.ts new file mode 100644 index 000000000..41dfa331b --- /dev/null +++ b/src/api/types/Fulfillment.ts @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Contains details about how to fulfill this order. + * Orders can only be created with at most one fulfillment using the API. + * However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. + */ +export interface Fulfillment { + /** A unique ID that identifies the fulfillment only within this order. */ + uid?: string | null; + /** + * The type of the fulfillment. + * See [FulfillmentType](#type-fulfillmenttype) for possible values + */ + type?: Square.FulfillmentType; + /** + * The state of the fulfillment. + * See [FulfillmentState](#type-fulfillmentstate) for possible values + */ + state?: Square.FulfillmentState; + /** + * Describes what order line items this fulfillment applies to. + * It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. + * See [FulfillmentFulfillmentLineItemApplication](#type-fulfillmentfulfillmentlineitemapplication) for possible values + */ + lineItemApplication?: Square.FulfillmentFulfillmentLineItemApplication; + /** + * A list of entries pertaining to the fulfillment of an order. Each entry must reference + * a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to + * fulfill. + * + * Multiple entries can reference the same line item `uid`, as long as the total quantity among + * all fulfillment entries referencing a single line item does not exceed the quantity of the + * order's line item itself. + * + * An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`, + * `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently + * before order completion. + */ + entries?: Square.FulfillmentFulfillmentEntry[]; + /** + * Application-defined data attached to this fulfillment. Metadata fields are intended + * to store descriptive references or associations with an entity in another system or store brief + * information about the object. Square does not process this field; it only stores and returns it + * in relevant API calls. Do not use metadata to store any sensitive information (such as personally + * identifiable information or card details). + * + * Keys written by applications must be 60 characters or less and must be in the character set + * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + * with a namespace, separated from the key with a ':' character. + * + * Values have a maximum length of 255 characters. + * + * An application can have up to 10 entries per metadata field. + * + * Entries written by applications are private and can only be read or modified by the same + * application. + * + * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + */ + metadata?: Record | null; + /** + * Contains details for a pickup fulfillment. These details are required when the fulfillment + * type is `PICKUP`. + */ + pickupDetails?: Square.FulfillmentPickupDetails; + /** + * Contains details for a shipment fulfillment. These details are required when the fulfillment type + * is `SHIPMENT`. + * + * A shipment fulfillment's relationship to fulfillment `state`: + * `PROPOSED`: A shipment is requested. + * `RESERVED`: Fulfillment in progress. Shipment processing. + * `PREPARED`: Shipment packaged. Shipping label created. + * `COMPLETED`: Package has been shipped. + * `CANCELED`: Shipment has been canceled. + * `FAILED`: Shipment has failed. + */ + shipmentDetails?: Square.FulfillmentShipmentDetails; + /** Describes delivery details of an order fulfillment. */ + deliveryDetails?: Square.FulfillmentDeliveryDetails; +} diff --git a/src/api/types/FulfillmentDeliveryDetails.ts b/src/api/types/FulfillmentDeliveryDetails.ts new file mode 100644 index 000000000..42b3e3ae3 --- /dev/null +++ b/src/api/types/FulfillmentDeliveryDetails.ts @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes delivery details of an order fulfillment. + */ +export interface FulfillmentDeliveryDetails { + /** The contact information for the person to receive the fulfillment. */ + recipient?: Square.FulfillmentRecipient; + /** + * Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then + * `deliver_at` is required. If `ASAP`, then `prep_time_duration` is required. The default is `SCHEDULED`. + * See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values + */ + scheduleType?: Square.FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was placed. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + * + * Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". + */ + placedAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * that represents the start of the delivery period. + * When the fulfillment `schedule_type` is `ASAP`, the field is automatically + * set to the current time plus the `prep_time_duration`. + * Otherwise, the application can set this field while the fulfillment `state` is + * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the + * terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). + * + * The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + deliverAt?: string | null; + /** + * The duration of time it takes to prepare and deliver this fulfillment. + * The duration must be in RFC 3339 format (for example, "P1W3D"). + */ + prepTimeDuration?: string | null; + /** + * The time period after `deliver_at` in which to deliver the order. + * Applications can set this field when the fulfillment `state` is + * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state + * such as `COMPLETED`, `CANCELED`, and `FAILED`). + * + * The duration must be in RFC 3339 format (for example, "P1W3D"). + */ + deliveryWindowDuration?: string | null; + /** + * Provides additional instructions about the delivery fulfillment. + * It is displayed in the Square Point of Sale application and set by the API. + */ + note?: string | null; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicates when the seller completed the fulfillment. + * This field is automatically set when fulfillment `state` changes to `COMPLETED`. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + completedAt?: string | null; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicates when the seller started processing the fulfillment. + * This field is automatically set when the fulfillment `state` changes to `RESERVED`. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + inProgressAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was rejected. This field is + * automatically set when the fulfillment `state` changes to `FAILED`. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + rejectedAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the seller marked the fulfillment as ready for + * courier pickup. This field is automatically set when the fulfillment `state` changes + * to PREPARED. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + readyAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was delivered to the recipient. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + deliveredAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was canceled. This field is automatically + * set when the fulfillment `state` changes to `CANCELED`. + * + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + canceledAt?: string; + /** The delivery cancellation reason. Max length: 100 characters. */ + cancelReason?: string | null; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when an order can be picked up by the courier for delivery. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + courierPickupAt?: string | null; + /** + * The time period after `courier_pickup_at` in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "P1W3D"). + */ + courierPickupWindowDuration?: string | null; + /** Whether the delivery is preferred to be no contact. */ + isNoContactDelivery?: boolean | null; + /** A note to provide additional instructions about how to deliver the order. */ + dropoffNotes?: string | null; + /** The name of the courier provider. */ + courierProviderName?: string | null; + /** The support phone number of the courier. */ + courierSupportPhoneNumber?: string | null; + /** The identifier for the delivery created by Square. */ + squareDeliveryId?: string | null; + /** The identifier for the delivery created by the third-party courier service. */ + externalDeliveryId?: string | null; + /** + * The flag to indicate the delivery is managed by a third party (ie DoorDash), which means + * we may not receive all recipient information for PII purposes. + */ + managedDelivery?: boolean | null; +} diff --git a/src/api/types/FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.ts b/src/api/types/FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.ts new file mode 100644 index 000000000..e27edc29d --- /dev/null +++ b/src/api/types/FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The schedule type of the delivery fulfillment. + */ +export type FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType = "SCHEDULED" | "ASAP"; +export const FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType = { + Scheduled: "SCHEDULED", + Asap: "ASAP", +} as const; diff --git a/src/api/types/FulfillmentFulfillmentEntry.ts b/src/api/types/FulfillmentFulfillmentEntry.ts new file mode 100644 index 000000000..eee1b6960 --- /dev/null +++ b/src/api/types/FulfillmentFulfillmentEntry.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Links an order line item to a fulfillment. Each entry must reference + * a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to + * fulfill. + */ +export interface FulfillmentFulfillmentEntry { + /** A unique ID that identifies the fulfillment entry only within this order. */ + uid?: string | null; + /** The `uid` from the order line item. */ + lineItemUid: string; + /** + * The quantity of the line item being fulfilled, formatted as a decimal number. + * For example, `"3"`. + * + * Fulfillments for line items with a `quantity_unit` can have non-integer quantities. + * For example, `"1.70000"`. + */ + quantity: string; + /** + * Application-defined data attached to this fulfillment entry. Metadata fields are intended + * to store descriptive references or associations with an entity in another system or store brief + * information about the object. Square does not process this field; it only stores and returns it + * in relevant API calls. Do not use metadata to store any sensitive information (such as personally + * identifiable information or card details). + * + * Keys written by applications must be 60 characters or less and must be in the character set + * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + * with a namespace, separated from the key with a ':' character. + * + * Values have a maximum length of 255 characters. + * + * An application can have up to 10 entries per metadata field. + * + * Entries written by applications are private and can only be read or modified by the same + * application. + * + * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + */ + metadata?: Record | null; +} diff --git a/src/api/types/FulfillmentFulfillmentLineItemApplication.ts b/src/api/types/FulfillmentFulfillmentLineItemApplication.ts new file mode 100644 index 000000000..4669179a4 --- /dev/null +++ b/src/api/types/FulfillmentFulfillmentLineItemApplication.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The `line_item_application` describes what order line items this fulfillment applies + * to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. + */ +export type FulfillmentFulfillmentLineItemApplication = "ALL" | "ENTRY_LIST"; +export const FulfillmentFulfillmentLineItemApplication = { + All: "ALL", + EntryList: "ENTRY_LIST", +} as const; diff --git a/src/api/types/FulfillmentPickupDetails.ts b/src/api/types/FulfillmentPickupDetails.ts new file mode 100644 index 000000000..2860652d2 --- /dev/null +++ b/src/api/types/FulfillmentPickupDetails.ts @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Contains details necessary to fulfill a pickup order. + */ +export interface FulfillmentPickupDetails { + /** + * Information about the person to pick up this fulfillment from a physical + * location. + */ + recipient?: Square.FulfillmentRecipient; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be + * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set + * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order + * are automatically completed. + */ + expiresAt?: string | null; + /** + * The duration of time after which an in progress pickup fulfillment is automatically moved + * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). + * + * If not set, this pickup fulfillment remains in progress until it is canceled or completed. + */ + autoCompleteDuration?: string | null; + /** + * The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`. + * See [FulfillmentPickupDetailsScheduleType](#type-fulfillmentpickupdetailsscheduletype) for possible values + */ + scheduleType?: Square.FulfillmentPickupDetailsScheduleType; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., + * "2016-09-04T23:59:33.123Z". + * + * For fulfillments with the schedule type `ASAP`, this is automatically set + * to the current time plus the expected duration to prepare the fulfillment. + */ + pickupAt?: string | null; + /** + * The window of time in which the order should be picked up after the `pickup_at` timestamp. + * Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an + * informational guideline for merchants. + */ + pickupWindowDuration?: string | null; + /** + * The duration of time it takes to prepare this fulfillment. + * The duration must be in RFC 3339 format (for example, "P1W3D"). + */ + prepTimeDuration?: string | null; + /** + * A note to provide additional instructions about the pickup + * fulfillment displayed in the Square Point of Sale application and set by the API. + */ + note?: string | null; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + placedAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + acceptedAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + rejectedAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + readyAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment expired. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + expiredAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + pickedUpAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + canceledAt?: string; + /** A description of why the pickup was canceled. The maximum length: 100 characters. */ + cancelReason?: string | null; + /** If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. */ + isCurbsidePickup?: boolean | null; + /** Specific details for curbside pickup. These details can only be populated if `is_curbside_pickup` is set to `true`. */ + curbsidePickupDetails?: Square.FulfillmentPickupDetailsCurbsidePickupDetails; +} diff --git a/src/api/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts b/src/api/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts new file mode 100644 index 000000000..68fade02b --- /dev/null +++ b/src/api/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specific details for curbside pickup. + */ +export interface FulfillmentPickupDetailsCurbsidePickupDetails { + /** Specific details for curbside pickup, such as parking number and vehicle model. */ + curbsideDetails?: string | null; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + buyerArrivedAt?: string | null; +} diff --git a/src/api/types/FulfillmentPickupDetailsScheduleType.ts b/src/api/types/FulfillmentPickupDetailsScheduleType.ts new file mode 100644 index 000000000..fab10fcda --- /dev/null +++ b/src/api/types/FulfillmentPickupDetailsScheduleType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The schedule type of the pickup fulfillment. + */ +export type FulfillmentPickupDetailsScheduleType = "SCHEDULED" | "ASAP"; +export const FulfillmentPickupDetailsScheduleType = { + Scheduled: "SCHEDULED", + Asap: "ASAP", +} as const; diff --git a/src/api/types/FulfillmentRecipient.ts b/src/api/types/FulfillmentRecipient.ts new file mode 100644 index 000000000..96e30c413 --- /dev/null +++ b/src/api/types/FulfillmentRecipient.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Information about the fulfillment recipient. + */ +export interface FulfillmentRecipient { + /** + * The ID of the customer associated with the fulfillment. + * + * If `customer_id` is provided, the fulfillment recipient's `display_name`, + * `email_address`, and `phone_number` are automatically populated from the + * targeted customer profile. If these fields are set in the request, the request + * values override the information from the customer profile. If the + * targeted customer profile does not contain the necessary information and + * these fields are left unset, the request results in an error. + */ + customerId?: string | null; + /** + * The display name of the fulfillment recipient. This field is required. + * + * If provided, the display name overrides the corresponding customer profile value + * indicated by `customer_id`. + */ + displayName?: string | null; + /** + * The email address of the fulfillment recipient. + * + * If provided, the email address overrides the corresponding customer profile value + * indicated by `customer_id`. + */ + emailAddress?: string | null; + /** + * The phone number of the fulfillment recipient. This field is required. + * + * If provided, the phone number overrides the corresponding customer profile value + * indicated by `customer_id`. + */ + phoneNumber?: string | null; + /** + * The address of the fulfillment recipient. This field is required. + * + * If provided, the address overrides the corresponding customer profile value + * indicated by `customer_id`. + */ + address?: Square.Address; +} diff --git a/src/api/types/FulfillmentShipmentDetails.ts b/src/api/types/FulfillmentShipmentDetails.ts new file mode 100644 index 000000000..48c6176a6 --- /dev/null +++ b/src/api/types/FulfillmentShipmentDetails.ts @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Contains the details necessary to fulfill a shipment order. + */ +export interface FulfillmentShipmentDetails { + /** Information about the person to receive this shipment fulfillment. */ + recipient?: Square.FulfillmentRecipient; + /** The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS). */ + carrier?: string | null; + /** A note with additional information for the shipping carrier. */ + shippingNote?: string | null; + /** + * A description of the type of shipping product purchased from the carrier + * (such as First Class, Priority, or Express). + */ + shippingType?: string | null; + /** The reference number provided by the carrier to track the shipment's progress. */ + trackingNumber?: string | null; + /** A link to the tracking webpage on the carrier's website. */ + trackingUrl?: string | null; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the shipment was requested. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + placedAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation + * of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + inProgressAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the + * fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + packagedAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the shipment is expected to be delivered to the shipping carrier. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + expectedShippedAt?: string | null; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that + * the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + shippedAt?: string; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating the shipment was canceled. + * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + */ + canceledAt?: string | null; + /** A description of why the shipment was canceled. */ + cancelReason?: string | null; + /** + * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) + * indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format + * (for example, "2016-09-04T23:59:33.123Z"). + */ + failedAt?: string; + /** A description of why the shipment failed to be completed. */ + failureReason?: string | null; +} diff --git a/src/api/types/FulfillmentState.ts b/src/api/types/FulfillmentState.ts new file mode 100644 index 000000000..49236c3cc --- /dev/null +++ b/src/api/types/FulfillmentState.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The current state of this fulfillment. + */ +export type FulfillmentState = "PROPOSED" | "RESERVED" | "PREPARED" | "COMPLETED" | "CANCELED" | "FAILED"; +export const FulfillmentState = { + Proposed: "PROPOSED", + Reserved: "RESERVED", + Prepared: "PREPARED", + Completed: "COMPLETED", + Canceled: "CANCELED", + Failed: "FAILED", +} as const; diff --git a/src/api/types/FulfillmentType.ts b/src/api/types/FulfillmentType.ts new file mode 100644 index 000000000..59bf58a4e --- /dev/null +++ b/src/api/types/FulfillmentType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of fulfillment. + */ +export type FulfillmentType = "PICKUP" | "SHIPMENT" | "DELIVERY"; +export const FulfillmentType = { + Pickup: "PICKUP", + Shipment: "SHIPMENT", + Delivery: "DELIVERY", +} as const; diff --git a/src/api/types/GetBankAccountByV1IdResponse.ts b/src/api/types/GetBankAccountByV1IdResponse.ts new file mode 100644 index 000000000..eb32b38e2 --- /dev/null +++ b/src/api/types/GetBankAccountByV1IdResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response object returned by GetBankAccountByV1Id. + */ +export interface GetBankAccountByV1IdResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `BankAccount` object. */ + bankAccount?: Square.BankAccount; +} diff --git a/src/api/types/GetBankAccountResponse.ts b/src/api/types/GetBankAccountResponse.ts new file mode 100644 index 000000000..4da1157b5 --- /dev/null +++ b/src/api/types/GetBankAccountResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response object returned by `GetBankAccount`. + */ +export interface GetBankAccountResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `BankAccount` object. */ + bankAccount?: Square.BankAccount; +} diff --git a/src/api/types/GetBookingResponse.ts b/src/api/types/GetBookingResponse.ts new file mode 100644 index 000000000..802155711 --- /dev/null +++ b/src/api/types/GetBookingResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetBookingResponse { + /** The booking that was requested. */ + booking?: Square.Booking; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetBreakTypeResponse.ts b/src/api/types/GetBreakTypeResponse.ts new file mode 100644 index 000000000..c19ef2831 --- /dev/null +++ b/src/api/types/GetBreakTypeResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request to get a `BreakType`. The response contains + * the requested `BreakType` objects and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface GetBreakTypeResponse { + /** The response object. */ + breakType?: Square.BreakType; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetBusinessBookingProfileResponse.ts b/src/api/types/GetBusinessBookingProfileResponse.ts new file mode 100644 index 000000000..4d00700b7 --- /dev/null +++ b/src/api/types/GetBusinessBookingProfileResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetBusinessBookingProfileResponse { + /** The seller's booking profile. */ + businessBookingProfile?: Square.BusinessBookingProfile; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetCardResponse.ts b/src/api/types/GetCardResponse.ts new file mode 100644 index 000000000..977887b0f --- /dev/null +++ b/src/api/types/GetCardResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [RetrieveCard](api-endpoint:Cards-RetrieveCard) endpoint. + * + * Note: if there are errors processing the request, the card field will not be + * present. + */ +export interface GetCardResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The retrieved card. */ + card?: Square.Card; +} diff --git a/src/api/types/GetCashDrawerShiftResponse.ts b/src/api/types/GetCashDrawerShiftResponse.ts new file mode 100644 index 000000000..c0dcd2bad --- /dev/null +++ b/src/api/types/GetCashDrawerShiftResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetCashDrawerShiftResponse { + /** The cash drawer shift queried for. */ + cashDrawerShift?: Square.CashDrawerShift; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetCatalogObjectResponse.ts b/src/api/types/GetCatalogObjectResponse.ts new file mode 100644 index 000000000..0c9fd7b6d --- /dev/null +++ b/src/api/types/GetCatalogObjectResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetCatalogObjectResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The `CatalogObject`s returned. */ + object?: Square.CatalogObject; + /** A list of `CatalogObject`s referenced by the object in the `object` field. */ + relatedObjects?: Square.CatalogObject[]; +} diff --git a/src/api/types/GetCustomerCustomAttributeDefinitionResponse.ts b/src/api/types/GetCustomerCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..d0e5c7991 --- /dev/null +++ b/src/api/types/GetCustomerCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface GetCustomerCustomAttributeDefinitionResponse { + /** The retrieved custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetCustomerCustomAttributeResponse.ts b/src/api/types/GetCustomerCustomAttributeResponse.ts new file mode 100644 index 000000000..1cddb6f62 --- /dev/null +++ b/src/api/types/GetCustomerCustomAttributeResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface GetCustomerCustomAttributeResponse { + /** + * The retrieved custom attribute. If `with_definition` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field. + */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetCustomerGroupResponse.ts b/src/api/types/GetCustomerGroupResponse.ts new file mode 100644 index 000000000..34e43193a --- /dev/null +++ b/src/api/types/GetCustomerGroupResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [RetrieveCustomerGroup](api-endpoint:CustomerGroups-RetrieveCustomerGroup) endpoint. + * + * Either `errors` or `group` is present in a given response (never both). + */ +export interface GetCustomerGroupResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The retrieved customer group. */ + group?: Square.CustomerGroup; +} diff --git a/src/api/types/GetCustomerResponse.ts b/src/api/types/GetCustomerResponse.ts new file mode 100644 index 000000000..6729a7527 --- /dev/null +++ b/src/api/types/GetCustomerResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `RetrieveCustomer` endpoint. + * + * Either `errors` or `customer` is present in a given response (never both). + */ +export interface GetCustomerResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The requested customer. */ + customer?: Square.Customer; +} diff --git a/src/api/types/GetCustomerSegmentResponse.ts b/src/api/types/GetCustomerSegmentResponse.ts new file mode 100644 index 000000000..03f3c5b30 --- /dev/null +++ b/src/api/types/GetCustomerSegmentResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint. + * + * Either `errors` or `segment` is present in a given response (never both). + */ +export interface GetCustomerSegmentResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The retrieved customer segment. */ + segment?: Square.CustomerSegment; +} diff --git a/src/api/types/GetDeviceCodeResponse.ts b/src/api/types/GetDeviceCodeResponse.ts new file mode 100644 index 000000000..cc4425f39 --- /dev/null +++ b/src/api/types/GetDeviceCodeResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetDeviceCodeResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The queried DeviceCode. */ + deviceCode?: Square.DeviceCode; +} diff --git a/src/api/types/GetDeviceResponse.ts b/src/api/types/GetDeviceResponse.ts new file mode 100644 index 000000000..307d74483 --- /dev/null +++ b/src/api/types/GetDeviceResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetDeviceResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `Device`. */ + device?: Square.Device; +} diff --git a/src/api/types/GetDisputeEvidenceResponse.ts b/src/api/types/GetDisputeEvidenceResponse.ts new file mode 100644 index 000000000..48a52ff8c --- /dev/null +++ b/src/api/types/GetDisputeEvidenceResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields in a `RetrieveDisputeEvidence` response. + */ +export interface GetDisputeEvidenceResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** Metadata about the dispute evidence file. */ + evidence?: Square.DisputeEvidence; +} diff --git a/src/api/types/GetDisputeResponse.ts b/src/api/types/GetDisputeResponse.ts new file mode 100644 index 000000000..a6d615a91 --- /dev/null +++ b/src/api/types/GetDisputeResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines fields in a `RetrieveDispute` response. + */ +export interface GetDisputeResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** Details about the requested `Dispute`. */ + dispute?: Square.Dispute; +} diff --git a/src/api/types/GetEmployeeResponse.ts b/src/api/types/GetEmployeeResponse.ts new file mode 100644 index 000000000..266fa41e1 --- /dev/null +++ b/src/api/types/GetEmployeeResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetEmployeeResponse { + employee?: Square.Employee; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetEmployeeWageResponse.ts b/src/api/types/GetEmployeeWageResponse.ts new file mode 100644 index 000000000..fe7c71f55 --- /dev/null +++ b/src/api/types/GetEmployeeWageResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response to a request to get an `EmployeeWage`. The response contains + * the requested `EmployeeWage` objects and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface GetEmployeeWageResponse { + /** The requested `EmployeeWage` object. */ + employeeWage?: Square.EmployeeWage; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetGiftCardFromGanResponse.ts b/src/api/types/GetGiftCardFromGanResponse.ts new file mode 100644 index 000000000..ecb5ff639 --- /dev/null +++ b/src/api/types/GetGiftCardFromGanResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains a `GiftCard`. This response might contain a set of `Error` objects + * if the request resulted in errors. + */ +export interface GetGiftCardFromGanResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** A gift card that was fetched, if present. It returns empty if an error occurred. */ + giftCard?: Square.GiftCard; +} diff --git a/src/api/types/GetGiftCardFromNonceResponse.ts b/src/api/types/GetGiftCardFromNonceResponse.ts new file mode 100644 index 000000000..dca2bcbfe --- /dev/null +++ b/src/api/types/GetGiftCardFromNonceResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains a `GiftCard` object. If the request resulted in errors, + * the response contains a set of `Error` objects. + */ +export interface GetGiftCardFromNonceResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The retrieved gift card. */ + giftCard?: Square.GiftCard; +} diff --git a/src/api/types/GetGiftCardResponse.ts b/src/api/types/GetGiftCardResponse.ts new file mode 100644 index 000000000..2548f71c0 --- /dev/null +++ b/src/api/types/GetGiftCardResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains a `GiftCard`. The response might contain a set of `Error` objects + * if the request resulted in errors. + */ +export interface GetGiftCardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The gift card retrieved. */ + giftCard?: Square.GiftCard; +} diff --git a/src/api/types/GetInventoryAdjustmentResponse.ts b/src/api/types/GetInventoryAdjustmentResponse.ts new file mode 100644 index 000000000..549648d11 --- /dev/null +++ b/src/api/types/GetInventoryAdjustmentResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetInventoryAdjustmentResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The requested [InventoryAdjustment](entity:InventoryAdjustment). */ + adjustment?: Square.InventoryAdjustment; +} diff --git a/src/api/types/GetInventoryChangesResponse.ts b/src/api/types/GetInventoryChangesResponse.ts new file mode 100644 index 000000000..91187103f --- /dev/null +++ b/src/api/types/GetInventoryChangesResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetInventoryChangesResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The set of inventory changes for the requested object and locations. */ + changes?: Square.InventoryChange[]; + /** + * The pagination cursor to be used in a subsequent request. If unset, + * this is the final response. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string; +} diff --git a/src/api/types/GetInventoryCountResponse.ts b/src/api/types/GetInventoryCountResponse.ts new file mode 100644 index 000000000..cdedcffdf --- /dev/null +++ b/src/api/types/GetInventoryCountResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetInventoryCountResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The current calculated inventory counts for the requested object and + * locations. + */ + counts?: Square.InventoryCount[]; + /** + * The pagination cursor to be used in a subsequent request. If unset, + * this is the final response. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string; +} diff --git a/src/api/types/GetInventoryPhysicalCountResponse.ts b/src/api/types/GetInventoryPhysicalCountResponse.ts new file mode 100644 index 000000000..32b1b4305 --- /dev/null +++ b/src/api/types/GetInventoryPhysicalCountResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetInventoryPhysicalCountResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The requested [InventoryPhysicalCount](entity:InventoryPhysicalCount). */ + count?: Square.InventoryPhysicalCount; +} diff --git a/src/api/types/GetInventoryTransferResponse.ts b/src/api/types/GetInventoryTransferResponse.ts new file mode 100644 index 000000000..e25b1fc68 --- /dev/null +++ b/src/api/types/GetInventoryTransferResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetInventoryTransferResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The requested [InventoryTransfer](entity:InventoryTransfer). */ + transfer?: Square.InventoryTransfer; +} diff --git a/src/api/types/GetInvoiceResponse.ts b/src/api/types/GetInvoiceResponse.ts new file mode 100644 index 000000000..620869be5 --- /dev/null +++ b/src/api/types/GetInvoiceResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes a `GetInvoice` response. + */ +export interface GetInvoiceResponse { + /** The invoice requested. */ + invoice?: Square.Invoice; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetLocationResponse.ts b/src/api/types/GetLocationResponse.ts new file mode 100644 index 000000000..fc0af595d --- /dev/null +++ b/src/api/types/GetLocationResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that the [RetrieveLocation](api-endpoint:Locations-RetrieveLocation) + * endpoint returns in a response. + */ +export interface GetLocationResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested location. */ + location?: Square.Location; +} diff --git a/src/api/types/GetLoyaltyAccountResponse.ts b/src/api/types/GetLoyaltyAccountResponse.ts new file mode 100644 index 000000000..566275fc9 --- /dev/null +++ b/src/api/types/GetLoyaltyAccountResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that includes the loyalty account. + */ +export interface GetLoyaltyAccountResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The loyalty account. */ + loyaltyAccount?: Square.LoyaltyAccount; +} diff --git a/src/api/types/GetLoyaltyProgramResponse.ts b/src/api/types/GetLoyaltyProgramResponse.ts new file mode 100644 index 000000000..e01dee587 --- /dev/null +++ b/src/api/types/GetLoyaltyProgramResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains the loyalty program. + */ +export interface GetLoyaltyProgramResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The loyalty program that was requested. */ + program?: Square.LoyaltyProgram; +} diff --git a/src/api/types/GetLoyaltyPromotionResponse.ts b/src/api/types/GetLoyaltyPromotionResponse.ts new file mode 100644 index 000000000..689d5a772 --- /dev/null +++ b/src/api/types/GetLoyaltyPromotionResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveLoyaltyPromotionPromotions](api-endpoint:Loyalty-RetrieveLoyaltyPromotion) response. + */ +export interface GetLoyaltyPromotionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The retrieved loyalty promotion. */ + loyaltyPromotion?: Square.LoyaltyPromotion; +} diff --git a/src/api/types/GetLoyaltyRewardResponse.ts b/src/api/types/GetLoyaltyRewardResponse.ts new file mode 100644 index 000000000..c285d582e --- /dev/null +++ b/src/api/types/GetLoyaltyRewardResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that includes the loyalty reward. + */ +export interface GetLoyaltyRewardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The loyalty reward retrieved. */ + reward?: Square.LoyaltyReward; +} diff --git a/src/api/types/GetMerchantResponse.ts b/src/api/types/GetMerchantResponse.ts new file mode 100644 index 000000000..603d2c794 --- /dev/null +++ b/src/api/types/GetMerchantResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response object returned by the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) endpoint. + */ +export interface GetMerchantResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `Merchant` object. */ + merchant?: Square.Merchant; +} diff --git a/src/api/types/GetOrderResponse.ts b/src/api/types/GetOrderResponse.ts new file mode 100644 index 000000000..17b50598b --- /dev/null +++ b/src/api/types/GetOrderResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetOrderResponse { + /** The requested order. */ + order?: Square.Order; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetPaymentLinkResponse.ts b/src/api/types/GetPaymentLinkResponse.ts new file mode 100644 index 000000000..e7fa33c13 --- /dev/null +++ b/src/api/types/GetPaymentLinkResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetPaymentLinkResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The payment link that is retrieved. */ + paymentLink?: Square.PaymentLink; +} diff --git a/src/api/types/GetPaymentRefundResponse.ts b/src/api/types/GetPaymentRefundResponse.ts new file mode 100644 index 000000000..2fcdadd81 --- /dev/null +++ b/src/api/types/GetPaymentRefundResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by [GetRefund](api-endpoint:Refunds-GetPaymentRefund). + * + * Note: If there are errors processing the request, the refund field might not be + * present or it might be present in a FAILED state. + */ +export interface GetPaymentRefundResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `PaymentRefund`. */ + refund?: Square.PaymentRefund; +} diff --git a/src/api/types/GetPaymentResponse.ts b/src/api/types/GetPaymentResponse.ts new file mode 100644 index 000000000..75908b112 --- /dev/null +++ b/src/api/types/GetPaymentResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by [GetPayment](api-endpoint:Payments-GetPayment). + */ +export interface GetPaymentResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `Payment`. */ + payment?: Square.Payment; +} diff --git a/src/api/types/GetPayoutResponse.ts b/src/api/types/GetPayoutResponse.ts new file mode 100644 index 000000000..7c70935d8 --- /dev/null +++ b/src/api/types/GetPayoutResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetPayoutResponse { + /** The requested payout. */ + payout?: Square.Payout; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetShiftResponse.ts b/src/api/types/GetShiftResponse.ts new file mode 100644 index 000000000..926693b5c --- /dev/null +++ b/src/api/types/GetShiftResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response to a request to get a `Shift`. The response contains + * the requested `Shift` object and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface GetShiftResponse { + /** The requested `Shift`. */ + shift?: Square.Shift; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetSnippetResponse.ts b/src/api/types/GetSnippetResponse.ts new file mode 100644 index 000000000..e37027c89 --- /dev/null +++ b/src/api/types/GetSnippetResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`. + */ +export interface GetSnippetResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The retrieved snippet. */ + snippet?: Square.Snippet; +} diff --git a/src/api/types/GetSubscriptionResponse.ts b/src/api/types/GetSubscriptionResponse.ts new file mode 100644 index 000000000..77341f9a7 --- /dev/null +++ b/src/api/types/GetSubscriptionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response from the + * [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) endpoint. + */ +export interface GetSubscriptionResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The subscription retrieved. */ + subscription?: Square.Subscription; +} diff --git a/src/api/types/GetTeamMemberBookingProfileResponse.ts b/src/api/types/GetTeamMemberBookingProfileResponse.ts new file mode 100644 index 000000000..df4c923ae --- /dev/null +++ b/src/api/types/GetTeamMemberBookingProfileResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetTeamMemberBookingProfileResponse { + /** The returned team member booking profile. */ + teamMemberBookingProfile?: Square.TeamMemberBookingProfile; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetTeamMemberResponse.ts b/src/api/types/GetTeamMemberResponse.ts new file mode 100644 index 000000000..e269e7dfa --- /dev/null +++ b/src/api/types/GetTeamMemberResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a retrieve request containing a `TeamMember` object or error messages. + */ +export interface GetTeamMemberResponse { + /** The successfully retrieved `TeamMember` object. */ + teamMember?: Square.TeamMember; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetTeamMemberWageResponse.ts b/src/api/types/GetTeamMemberWageResponse.ts new file mode 100644 index 000000000..2b8a9770a --- /dev/null +++ b/src/api/types/GetTeamMemberWageResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response to a request to get a `TeamMemberWage`. The response contains + * the requested `TeamMemberWage` objects and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface GetTeamMemberWageResponse { + /** The requested `TeamMemberWage` object. */ + teamMemberWage?: Square.TeamMemberWage; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetTerminalActionResponse.ts b/src/api/types/GetTerminalActionResponse.ts new file mode 100644 index 000000000..ac4225cbc --- /dev/null +++ b/src/api/types/GetTerminalActionResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetTerminalActionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `TerminalAction` */ + action?: Square.TerminalAction; +} diff --git a/src/api/types/GetTerminalCheckoutResponse.ts b/src/api/types/GetTerminalCheckoutResponse.ts new file mode 100644 index 000000000..23f4d7e68 --- /dev/null +++ b/src/api/types/GetTerminalCheckoutResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetTerminalCheckoutResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `TerminalCheckout`. */ + checkout?: Square.TerminalCheckout; +} diff --git a/src/api/types/GetTerminalRefundResponse.ts b/src/api/types/GetTerminalRefundResponse.ts new file mode 100644 index 000000000..973ca5864 --- /dev/null +++ b/src/api/types/GetTerminalRefundResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface GetTerminalRefundResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `Refund`. */ + refund?: Square.TerminalRefund; +} diff --git a/src/api/types/GetTransactionResponse.ts b/src/api/types/GetTransactionResponse.ts new file mode 100644 index 000000000..aff31de00 --- /dev/null +++ b/src/api/types/GetTransactionResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [RetrieveTransaction](api-endpoint:Transactions-RetrieveTransaction) endpoint. + * + * One of `errors` or `transaction` is present in a given response (never both). + */ +export interface GetTransactionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The requested transaction. */ + transaction?: Square.Transaction; +} diff --git a/src/api/types/GetVendorResponse.ts b/src/api/types/GetVendorResponse.ts new file mode 100644 index 000000000..34662553d --- /dev/null +++ b/src/api/types/GetVendorResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an output from a call to [RetrieveVendor](api-endpoint:Vendors-RetrieveVendor). + */ +export interface GetVendorResponse { + /** Errors encountered when the request fails. */ + errors?: Square.Error_[]; + /** The successfully retrieved [Vendor](entity:Vendor) object. */ + vendor?: Square.Vendor; +} diff --git a/src/api/types/GetWageSettingResponse.ts b/src/api/types/GetWageSettingResponse.ts new file mode 100644 index 000000000..d34904d40 --- /dev/null +++ b/src/api/types/GetWageSettingResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a retrieve request containing the specified `WageSetting` object or error messages. + */ +export interface GetWageSettingResponse { + /** The successfully retrieved `WageSetting` object. */ + wageSetting?: Square.WageSetting; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/GetWebhookSubscriptionResponse.ts b/src/api/types/GetWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..55d50ead7 --- /dev/null +++ b/src/api/types/GetWebhookSubscriptionResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [RetrieveWebhookSubscription](api-endpoint:WebhookSubscriptions-RetrieveWebhookSubscription) endpoint. + * + * Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be + * present. + */ +export interface GetWebhookSubscriptionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested [Subscription](entity:WebhookSubscription). */ + subscription?: Square.WebhookSubscription; +} diff --git a/src/api/types/GiftCard.ts b/src/api/types/GiftCard.ts new file mode 100644 index 000000000..ed24ffacb --- /dev/null +++ b/src/api/types/GiftCard.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a Square gift card. + */ +export interface GiftCard { + /** The Square-assigned ID of the gift card. */ + id?: string; + /** + * The gift card type. + * See [Type](#type-type) for possible values + */ + type: Square.GiftCardType; + /** + * The source that generated the gift card account number (GAN). The default value is `SQUARE`. + * See [GANSource](#type-gansource) for possible values + */ + ganSource?: Square.GiftCardGanSource; + /** + * The current gift card state. + * See [Status](#type-status) for possible values + */ + state?: Square.GiftCardStatus; + /** The current gift card balance. This balance is always greater than or equal to zero. */ + balanceMoney?: Square.Money; + /** + * The gift card account number (GAN). Buyers can use the GAN to make purchases or check + * the gift card balance. + */ + gan?: string | null; + /** + * The timestamp when the gift card was created, in RFC 3339 format. + * In the case of a digital gift card, it is the time when you create a card + * (using the Square Point of Sale application, Seller Dashboard, or Gift Cards API). + * In the case of a plastic gift card, it is the time when Square associates the card with the + * seller at the time of activation. + */ + createdAt?: string; + /** The IDs of the [customer profiles](entity:Customer) to whom this gift card is linked. */ + customerIds?: string[]; +} diff --git a/src/api/types/GiftCardActivity.ts b/src/api/types/GiftCardActivity.ts new file mode 100644 index 000000000..a19037829 --- /dev/null +++ b/src/api/types/GiftCardActivity.ts @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an action performed on a [gift card](entity:GiftCard) that affects its state or balance. + * A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity + * includes a `redeem_activity_details` field that contains information about the redemption. + */ +export interface GiftCardActivity { + /** The Square-assigned ID of the gift card activity. */ + id?: string; + /** + * The type of gift card activity. + * See [Type](#type-type) for possible values + */ + type: Square.GiftCardActivityType; + /** The ID of the [business location](entity:Location) where the activity occurred. */ + locationId: string; + /** The timestamp when the gift card activity was created, in RFC 3339 format. */ + createdAt?: string; + /** + * The gift card ID. When creating a gift card activity, `gift_card_id` is not required if + * `gift_card_gan` is specified. + */ + giftCardId?: string | null; + /** + * The gift card account number (GAN). When creating a gift card activity, `gift_card_gan` + * is not required if `gift_card_id` is specified. + */ + giftCardGan?: string | null; + /** The final balance on the gift card after the action is completed. */ + giftCardBalanceMoney?: Square.Money; + /** Additional details about a `LOAD` activity, which is used to reload money onto a gift card. */ + loadActivityDetails?: Square.GiftCardActivityLoad; + /** + * Additional details about an `ACTIVATE` activity, which is used to activate a gift card with + * an initial balance. + */ + activateActivityDetails?: Square.GiftCardActivityActivate; + /** + * Additional details about a `REDEEM` activity, which is used to redeem a gift card for a purchase. + * + * For applications that process payments using the Square Payments API, Square creates a `REDEEM` activity that + * updates the gift card balance after the corresponding [CreatePayment](api-endpoint:Payments-CreatePayment) + * request is completed. Applications that use a custom payment processing system must call + * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REDEEM` activity. + */ + redeemActivityDetails?: Square.GiftCardActivityRedeem; + /** Additional details about a `CLEAR_BALANCE` activity, which is used to set the balance of a gift card to zero. */ + clearBalanceActivityDetails?: Square.GiftCardActivityClearBalance; + /** Additional details about a `DEACTIVATE` activity, which is used to deactivate a gift card. */ + deactivateActivityDetails?: Square.GiftCardActivityDeactivate; + /** + * Additional details about an `ADJUST_INCREMENT` activity, which is used to add money to a gift card + * outside of a typical `ACTIVATE`, `LOAD`, or `REFUND` activity flow. + */ + adjustIncrementActivityDetails?: Square.GiftCardActivityAdjustIncrement; + /** + * Additional details about an `ADJUST_DECREMENT` activity, which is used to deduct money from a gift + * card outside of a typical `REDEEM` activity flow. + */ + adjustDecrementActivityDetails?: Square.GiftCardActivityAdjustDecrement; + /** + * Additional details about a `REFUND` activity, which is used to add money to a gift card when + * refunding a payment. + * + * For applications that refund payments to a gift card using the Square Refunds API, Square automatically + * creates a `REFUND` activity that updates the gift card balance after a [RefundPayment](api-endpoint:Refunds-RefundPayment) + * request is completed. Applications that use a custom processing system must call + * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) to create the `REFUND` activity. + */ + refundActivityDetails?: Square.GiftCardActivityRefund; + /** + * Additional details about an `UNLINKED_ACTIVITY_REFUND` activity. This activity is used to add money + * to a gift card when refunding a payment that was processed using a custom payment processing system + * and not linked to the gift card. + */ + unlinkedActivityRefundActivityDetails?: Square.GiftCardActivityUnlinkedActivityRefund; + /** + * Additional details about an `IMPORT` activity, which Square uses to import a third-party + * gift card with a balance. + */ + importActivityDetails?: Square.GiftCardActivityImport; + /** Additional details about a `BLOCK` activity, which Square uses to temporarily block a gift card. */ + blockActivityDetails?: Square.GiftCardActivityBlock; + /** Additional details about an `UNBLOCK` activity, which Square uses to unblock a gift card. */ + unblockActivityDetails?: Square.GiftCardActivityUnblock; + /** + * Additional details about an `IMPORT_REVERSAL` activity, which Square uses to reverse the + * import of a third-party gift card. + */ + importReversalActivityDetails?: Square.GiftCardActivityImportReversal; + /** + * Additional details about a `TRANSFER_BALANCE_TO` activity, which Square uses to add money to + * a gift card as the result of a transfer from another gift card. + */ + transferBalanceToActivityDetails?: Square.GiftCardActivityTransferBalanceTo; + /** + * Additional details about a `TRANSFER_BALANCE_FROM` activity, which Square uses to deduct money from + * a gift as the result of a transfer to another gift card. + */ + transferBalanceFromActivityDetails?: Square.GiftCardActivityTransferBalanceFrom; +} diff --git a/src/api/types/GiftCardActivityActivate.ts b/src/api/types/GiftCardActivityActivate.ts new file mode 100644 index 000000000..c8f56828f --- /dev/null +++ b/src/api/types/GiftCardActivityActivate.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about an `ACTIVATE` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityActivate { + /** + * The amount added to the gift card. This value is a positive integer. + * + * Applications that use a custom order processing system must specify this amount in the + * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + */ + amountMoney?: Square.Money; + /** + * The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. + * + * Applications that use the Square Orders API to process orders must specify the order ID + * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + */ + orderId?: string | null; + /** + * The UID of the `GIFT_CARD` line item in the order that represents the gift card purchase. + * + * Applications that use the Square Orders API to process orders must specify the line item UID + * in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + */ + lineItemUid?: string | null; + /** + * A client-specified ID that associates the gift card activity with an entity in another system. + * + * Applications that use a custom order processing system can use this field to track information + * related to an order or payment. + */ + referenceId?: string | null; + /** + * The payment instrument IDs used to process the gift card purchase, such as a credit card ID + * or bank account ID. + * + * Applications that use a custom order processing system must specify payment instrument IDs in + * the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + * Square uses this information to perform compliance checks. + * + * For applications that use the Square Orders API to process payments, Square has the necessary + * instrument IDs to perform compliance checks. + * + * Each buyer payment instrument ID can contain a maximum of 255 characters. + */ + buyerPaymentInstrumentIds?: string[] | null; +} diff --git a/src/api/types/GiftCardActivityAdjustDecrement.ts b/src/api/types/GiftCardActivityAdjustDecrement.ts new file mode 100644 index 000000000..80d24f854 --- /dev/null +++ b/src/api/types/GiftCardActivityAdjustDecrement.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about an `ADJUST_DECREMENT` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityAdjustDecrement { + /** The amount deducted from the gift card balance. This value is a positive integer. */ + amountMoney: Square.Money; + /** + * The reason the gift card balance was adjusted. + * See [Reason](#type-reason) for possible values + */ + reason: Square.GiftCardActivityAdjustDecrementReason; +} diff --git a/src/api/types/GiftCardActivityAdjustDecrementReason.ts b/src/api/types/GiftCardActivityAdjustDecrementReason.ts new file mode 100644 index 000000000..3d14288d9 --- /dev/null +++ b/src/api/types/GiftCardActivityAdjustDecrementReason.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the reason for deducting money from a [gift card](entity:GiftCard). + */ +export type GiftCardActivityAdjustDecrementReason = + | "SUSPICIOUS_ACTIVITY" + | "BALANCE_ACCIDENTALLY_INCREASED" + | "SUPPORT_ISSUE" + | "PURCHASE_WAS_REFUNDED"; +export const GiftCardActivityAdjustDecrementReason = { + SuspiciousActivity: "SUSPICIOUS_ACTIVITY", + BalanceAccidentallyIncreased: "BALANCE_ACCIDENTALLY_INCREASED", + SupportIssue: "SUPPORT_ISSUE", + PurchaseWasRefunded: "PURCHASE_WAS_REFUNDED", +} as const; diff --git a/src/api/types/GiftCardActivityAdjustIncrement.ts b/src/api/types/GiftCardActivityAdjustIncrement.ts new file mode 100644 index 000000000..7e333c906 --- /dev/null +++ b/src/api/types/GiftCardActivityAdjustIncrement.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about an `ADJUST_INCREMENT` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityAdjustIncrement { + /** The amount added to the gift card balance. This value is a positive integer. */ + amountMoney: Square.Money; + /** + * The reason the gift card balance was adjusted. + * See [Reason](#type-reason) for possible values + */ + reason: Square.GiftCardActivityAdjustIncrementReason; +} diff --git a/src/api/types/GiftCardActivityAdjustIncrementReason.ts b/src/api/types/GiftCardActivityAdjustIncrementReason.ts new file mode 100644 index 000000000..b863b9066 --- /dev/null +++ b/src/api/types/GiftCardActivityAdjustIncrementReason.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the reason for adding money to a [gift card](entity:GiftCard). + */ +export type GiftCardActivityAdjustIncrementReason = "COMPLIMENTARY" | "SUPPORT_ISSUE" | "TRANSACTION_VOIDED"; +export const GiftCardActivityAdjustIncrementReason = { + Complimentary: "COMPLIMENTARY", + SupportIssue: "SUPPORT_ISSUE", + TransactionVoided: "TRANSACTION_VOIDED", +} as const; diff --git a/src/api/types/GiftCardActivityBlock.ts b/src/api/types/GiftCardActivityBlock.ts new file mode 100644 index 000000000..7369f2101 --- /dev/null +++ b/src/api/types/GiftCardActivityBlock.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about a `BLOCK` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityBlock { + /** + * The reason the gift card was blocked. + * See [Reason](#type-reason) for possible values + */ + reason: Square.GiftCardActivityBlockReason; +} diff --git a/src/api/types/GiftCardActivityBlockReason.ts b/src/api/types/GiftCardActivityBlockReason.ts new file mode 100644 index 000000000..74695af78 --- /dev/null +++ b/src/api/types/GiftCardActivityBlockReason.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the reason for blocking a [gift card](entity:GiftCard). + */ +export type GiftCardActivityBlockReason = "CHARGEBACK_BLOCK"; diff --git a/src/api/types/GiftCardActivityClearBalance.ts b/src/api/types/GiftCardActivityClearBalance.ts new file mode 100644 index 000000000..3ead099c7 --- /dev/null +++ b/src/api/types/GiftCardActivityClearBalance.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about a `CLEAR_BALANCE` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityClearBalance { + /** + * The reason the gift card balance was cleared. + * See [Reason](#type-reason) for possible values + */ + reason: Square.GiftCardActivityClearBalanceReason; +} diff --git a/src/api/types/GiftCardActivityClearBalanceReason.ts b/src/api/types/GiftCardActivityClearBalanceReason.ts new file mode 100644 index 000000000..c780f08f8 --- /dev/null +++ b/src/api/types/GiftCardActivityClearBalanceReason.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the reason for clearing the balance of a [gift card](entity:GiftCard). + */ +export type GiftCardActivityClearBalanceReason = "SUSPICIOUS_ACTIVITY" | "REUSE_GIFTCARD" | "UNKNOWN_REASON"; +export const GiftCardActivityClearBalanceReason = { + SuspiciousActivity: "SUSPICIOUS_ACTIVITY", + ReuseGiftcard: "REUSE_GIFTCARD", + UnknownReason: "UNKNOWN_REASON", +} as const; diff --git a/src/api/types/GiftCardActivityDeactivate.ts b/src/api/types/GiftCardActivityDeactivate.ts new file mode 100644 index 000000000..3129c1c2f --- /dev/null +++ b/src/api/types/GiftCardActivityDeactivate.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about a `DEACTIVATE` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityDeactivate { + /** + * The reason the gift card was deactivated. + * See [Reason](#type-reason) for possible values + */ + reason: Square.GiftCardActivityDeactivateReason; +} diff --git a/src/api/types/GiftCardActivityDeactivateReason.ts b/src/api/types/GiftCardActivityDeactivateReason.ts new file mode 100644 index 000000000..efe431f40 --- /dev/null +++ b/src/api/types/GiftCardActivityDeactivateReason.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the reason for deactivating a [gift card](entity:GiftCard). + */ +export type GiftCardActivityDeactivateReason = "SUSPICIOUS_ACTIVITY" | "UNKNOWN_REASON" | "CHARGEBACK_DEACTIVATE"; +export const GiftCardActivityDeactivateReason = { + SuspiciousActivity: "SUSPICIOUS_ACTIVITY", + UnknownReason: "UNKNOWN_REASON", + ChargebackDeactivate: "CHARGEBACK_DEACTIVATE", +} as const; diff --git a/src/api/types/GiftCardActivityImport.ts b/src/api/types/GiftCardActivityImport.ts new file mode 100644 index 000000000..c0d4189de --- /dev/null +++ b/src/api/types/GiftCardActivityImport.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about an `IMPORT` [gift card activity type](entity:GiftCardActivityType). + * This activity type is used when Square imports a third-party gift card, in which case the + * `gan_source` of the gift card is set to `OTHER`. + */ +export interface GiftCardActivityImport { + /** The balance amount on the imported gift card. */ + amountMoney: Square.Money; +} diff --git a/src/api/types/GiftCardActivityImportReversal.ts b/src/api/types/GiftCardActivityImportReversal.ts new file mode 100644 index 000000000..33e18276e --- /dev/null +++ b/src/api/types/GiftCardActivityImportReversal.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about an `IMPORT_REVERSAL` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityImportReversal { + /** + * The amount of money cleared from the third-party gift card when + * the import was reversed. + */ + amountMoney: Square.Money; +} diff --git a/src/api/types/GiftCardActivityLoad.ts b/src/api/types/GiftCardActivityLoad.ts new file mode 100644 index 000000000..f5ec18e1a --- /dev/null +++ b/src/api/types/GiftCardActivityLoad.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about a `LOAD` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityLoad { + /** + * The amount added to the gift card. This value is a positive integer. + * + * Applications that use a custom order processing system must specify this amount in the + * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + */ + amountMoney?: Square.Money; + /** + * The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. + * + * Applications that use the Square Orders API to process orders must specify the order ID in the + * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + */ + orderId?: string | null; + /** + * The UID of the `GIFT_CARD` line item in the order that represents the additional funds for the gift card. + * + * Applications that use the Square Orders API to process orders must specify the line item UID + * in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + */ + lineItemUid?: string | null; + /** + * A client-specified ID that associates the gift card activity with an entity in another system. + * + * Applications that use a custom order processing system can use this field to track information related to + * an order or payment. + */ + referenceId?: string | null; + /** + * The payment instrument IDs used to process the order for the additional funds, such as a credit card ID + * or bank account ID. + * + * Applications that use a custom order processing system must specify payment instrument IDs in + * the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + * Square uses this information to perform compliance checks. + * + * For applications that use the Square Orders API to process payments, Square has the necessary + * instrument IDs to perform compliance checks. + * + * Each buyer payment instrument ID can contain a maximum of 255 characters. + */ + buyerPaymentInstrumentIds?: string[] | null; +} diff --git a/src/api/types/GiftCardActivityRedeem.ts b/src/api/types/GiftCardActivityRedeem.ts new file mode 100644 index 000000000..536cafdd3 --- /dev/null +++ b/src/api/types/GiftCardActivityRedeem.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about a `REDEEM` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityRedeem { + /** + * The amount deducted from the gift card for the redemption. This value is a positive integer. + * + * Applications that use a custom payment processing system must specify this amount in the + * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. + */ + amountMoney: Square.Money; + /** + * The ID of the payment that represents the gift card redemption. Square populates this field + * if the payment was processed by Square. + */ + paymentId?: string; + /** + * A client-specified ID that associates the gift card activity with an entity in another system. + * + * Applications that use a custom payment processing system can use this field to track information + * related to an order or payment. + */ + referenceId?: string | null; + /** + * The status of the gift card redemption. Gift cards redeemed from Square Point of Sale or the + * Square Seller Dashboard use a two-state process: `PENDING` + * to `COMPLETED` or `PENDING` to `CANCELED`. Gift cards redeemed using the Gift Card Activities API + * always have a `COMPLETED` status. + * See [Status](#type-status) for possible values + */ + status?: Square.GiftCardActivityRedeemStatus; +} diff --git a/src/api/types/GiftCardActivityRedeemStatus.ts b/src/api/types/GiftCardActivityRedeemStatus.ts new file mode 100644 index 000000000..a8f616921 --- /dev/null +++ b/src/api/types/GiftCardActivityRedeemStatus.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the status of a [gift card](entity:GiftCard) redemption. This status is relevant only for + * redemptions made from Square products (such as Square Point of Sale) because Square products use a + * two-state process. Gift cards redeemed using the Gift Card Activities API always have a `COMPLETED` status. + */ +export type GiftCardActivityRedeemStatus = "PENDING" | "COMPLETED" | "CANCELED"; +export const GiftCardActivityRedeemStatus = { + Pending: "PENDING", + Completed: "COMPLETED", + Canceled: "CANCELED", +} as const; diff --git a/src/api/types/GiftCardActivityRefund.ts b/src/api/types/GiftCardActivityRefund.ts new file mode 100644 index 000000000..854c4eae2 --- /dev/null +++ b/src/api/types/GiftCardActivityRefund.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about a `REFUND` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityRefund { + /** + * The ID of the refunded `REDEEM` gift card activity. Square populates this field if the + * `payment_id` in the corresponding [RefundPayment](api-endpoint:Refunds-RefundPayment) request + * represents a gift card redemption. + * + * For applications that use a custom payment processing system, this field is required when creating + * a `REFUND` activity. The provided `REDEEM` activity ID must be linked to the same gift card. + */ + redeemActivityId?: string | null; + /** + * The amount added to the gift card for the refund. This value is a positive integer. + * + * This field is required when creating a `REFUND` activity. The amount can represent a full or partial refund. + */ + amountMoney?: Square.Money; + /** A client-specified ID that associates the gift card activity with an entity in another system. */ + referenceId?: string | null; + /** + * The ID of the refunded payment. Square populates this field if the refund is for a + * payment processed by Square. This field matches the `payment_id` in the corresponding + * [RefundPayment](api-endpoint:Refunds-RefundPayment) request. + */ + paymentId?: string; +} diff --git a/src/api/types/GiftCardActivityTransferBalanceFrom.ts b/src/api/types/GiftCardActivityTransferBalanceFrom.ts new file mode 100644 index 000000000..41f6839de --- /dev/null +++ b/src/api/types/GiftCardActivityTransferBalanceFrom.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityTransferBalanceFrom { + /** The ID of the gift card to which the specified amount was transferred. */ + transferToGiftCardId: string; + /** The amount deducted from the gift card for the transfer. This value is a positive integer. */ + amountMoney: Square.Money; +} diff --git a/src/api/types/GiftCardActivityTransferBalanceTo.ts b/src/api/types/GiftCardActivityTransferBalanceTo.ts new file mode 100644 index 000000000..d68325bf3 --- /dev/null +++ b/src/api/types/GiftCardActivityTransferBalanceTo.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityTransferBalanceTo { + /** The ID of the gift card from which the specified amount was transferred. */ + transferFromGiftCardId: string; + /** The amount added to the gift card balance for the transfer. This value is a positive integer. */ + amountMoney: Square.Money; +} diff --git a/src/api/types/GiftCardActivityType.ts b/src/api/types/GiftCardActivityType.ts new file mode 100644 index 000000000..bc776443d --- /dev/null +++ b/src/api/types/GiftCardActivityType.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the type of [gift card activity](entity:GiftCardActivity). + */ +export type GiftCardActivityType = + | "ACTIVATE" + | "LOAD" + | "REDEEM" + | "CLEAR_BALANCE" + | "DEACTIVATE" + | "ADJUST_INCREMENT" + | "ADJUST_DECREMENT" + | "REFUND" + | "UNLINKED_ACTIVITY_REFUND" + | "IMPORT" + | "BLOCK" + | "UNBLOCK" + | "IMPORT_REVERSAL" + | "TRANSFER_BALANCE_FROM" + | "TRANSFER_BALANCE_TO"; +export const GiftCardActivityType = { + Activate: "ACTIVATE", + Load: "LOAD", + Redeem: "REDEEM", + ClearBalance: "CLEAR_BALANCE", + Deactivate: "DEACTIVATE", + AdjustIncrement: "ADJUST_INCREMENT", + AdjustDecrement: "ADJUST_DECREMENT", + Refund: "REFUND", + UnlinkedActivityRefund: "UNLINKED_ACTIVITY_REFUND", + Import: "IMPORT", + Block: "BLOCK", + Unblock: "UNBLOCK", + ImportReversal: "IMPORT_REVERSAL", + TransferBalanceFrom: "TRANSFER_BALANCE_FROM", + TransferBalanceTo: "TRANSFER_BALANCE_TO", +} as const; diff --git a/src/api/types/GiftCardActivityUnblock.ts b/src/api/types/GiftCardActivityUnblock.ts new file mode 100644 index 000000000..b6cb30f11 --- /dev/null +++ b/src/api/types/GiftCardActivityUnblock.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about an `UNBLOCK` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityUnblock { + /** + * The reason the gift card was unblocked. + * See [Reason](#type-reason) for possible values + */ + reason: Square.GiftCardActivityUnblockReason; +} diff --git a/src/api/types/GiftCardActivityUnblockReason.ts b/src/api/types/GiftCardActivityUnblockReason.ts new file mode 100644 index 000000000..9f67b21e8 --- /dev/null +++ b/src/api/types/GiftCardActivityUnblockReason.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the reason for unblocking a [gift card](entity:GiftCard). + */ +export type GiftCardActivityUnblockReason = "CHARGEBACK_UNBLOCK"; diff --git a/src/api/types/GiftCardActivityUnlinkedActivityRefund.ts b/src/api/types/GiftCardActivityUnlinkedActivityRefund.ts new file mode 100644 index 000000000..01f3229b4 --- /dev/null +++ b/src/api/types/GiftCardActivityUnlinkedActivityRefund.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type](entity:GiftCardActivityType). + */ +export interface GiftCardActivityUnlinkedActivityRefund { + /** The amount added to the gift card for the refund. This value is a positive integer. */ + amountMoney: Square.Money; + /** A client-specified ID that associates the gift card activity with an entity in another system. */ + referenceId?: string | null; + /** The ID of the refunded payment. This field is not used starting in Square version 2022-06-16. */ + paymentId?: string; +} diff --git a/src/api/types/GiftCardGanSource.ts b/src/api/types/GiftCardGanSource.ts new file mode 100644 index 000000000..4f0f75504 --- /dev/null +++ b/src/api/types/GiftCardGanSource.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the source that generated the gift card + * account number (GAN). + */ +export type GiftCardGanSource = "SQUARE" | "OTHER"; +export const GiftCardGanSource = { + Square: "SQUARE", + Other: "OTHER", +} as const; diff --git a/src/api/types/GiftCardStatus.ts b/src/api/types/GiftCardStatus.ts new file mode 100644 index 000000000..10395ce3d --- /dev/null +++ b/src/api/types/GiftCardStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the gift card state. + */ +export type GiftCardStatus = "ACTIVE" | "DEACTIVATED" | "BLOCKED" | "PENDING"; +export const GiftCardStatus = { + Active: "ACTIVE", + Deactivated: "DEACTIVATED", + Blocked: "BLOCKED", + Pending: "PENDING", +} as const; diff --git a/src/api/types/GiftCardType.ts b/src/api/types/GiftCardType.ts new file mode 100644 index 000000000..22c2337f3 --- /dev/null +++ b/src/api/types/GiftCardType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the gift card type. + */ +export type GiftCardType = "PHYSICAL" | "DIGITAL"; +export const GiftCardType = { + Physical: "PHYSICAL", + Digital: "DIGITAL", +} as const; diff --git a/src/api/types/InventoryAdjustment.ts b/src/api/types/InventoryAdjustment.ts new file mode 100644 index 000000000..b4914ae0b --- /dev/null +++ b/src/api/types/InventoryAdjustment.ts @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a change in state or quantity of product inventory at a + * particular time and location. + */ +export interface InventoryAdjustment { + /** + * A unique ID generated by Square for the + * `InventoryAdjustment`. + */ + id?: string; + /** + * An optional ID provided by the application to tie the + * `InventoryAdjustment` to an external + * system. + */ + referenceId?: string | null; + /** + * The [inventory state](entity:InventoryState) of the related quantity + * of items before the adjustment. + * See [InventoryState](#type-inventorystate) for possible values + */ + fromState?: Square.InventoryState; + /** + * The [inventory state](entity:InventoryState) of the related quantity + * of items after the adjustment. + * See [InventoryState](#type-inventorystate) for possible values + */ + toState?: Square.InventoryState; + /** + * The Square-generated ID of the [Location](entity:Location) where the related + * quantity of items is being tracked. + */ + locationId?: string | null; + /** + * The Square-generated ID of the + * [CatalogObject](entity:CatalogObject) being tracked. + */ + catalogObjectId?: string | null; + /** + * The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. + * + * The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. + * In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app. + */ + catalogObjectType?: string | null; + /** + * The number of items affected by the adjustment as a decimal string. + * Can support up to 5 digits after the decimal point. + */ + quantity?: string | null; + /** + * The total price paid for goods associated with the + * adjustment. Present if and only if `to_state` is `SOLD`. Always + * non-negative. + */ + totalPriceMoney?: Square.Money; + /** + * A client-generated RFC 3339-formatted timestamp that indicates when + * the inventory adjustment took place. For inventory adjustment updates, the `occurred_at` + * timestamp cannot be older than 24 hours or in the future relative to the + * time of the request. + */ + occurredAt?: string | null; + /** An RFC 3339-formatted timestamp that indicates when the inventory adjustment is received. */ + createdAt?: string; + /** + * Information about the application that caused the + * inventory adjustment. + */ + source?: Square.SourceApplication; + /** + * The Square-generated ID of the [Employee](entity:Employee) responsible for the + * inventory adjustment. + */ + employeeId?: string | null; + /** + * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the + * inventory adjustment. + */ + teamMemberId?: string | null; + /** + * The Square-generated ID of the [Transaction](entity:Transaction) that + * caused the adjustment. Only relevant for payment-related state + * transitions. + */ + transactionId?: string; + /** + * The Square-generated ID of the [Refund](entity:Refund) that + * caused the adjustment. Only relevant for refund-related state + * transitions. + */ + refundId?: string; + /** + * The Square-generated ID of the purchase order that caused the + * adjustment. Only relevant for state transitions from the Square for Retail + * app. + */ + purchaseOrderId?: string; + /** + * The Square-generated ID of the goods receipt that caused the + * adjustment. Only relevant for state transitions from the Square for Retail + * app. + */ + goodsReceiptId?: string; + /** An adjustment group bundling the related adjustments of item variations through stock conversions in a single inventory event. */ + adjustmentGroup?: Square.InventoryAdjustmentGroup; +} diff --git a/src/api/types/InventoryAdjustmentGroup.ts b/src/api/types/InventoryAdjustmentGroup.ts new file mode 100644 index 000000000..5d5325815 --- /dev/null +++ b/src/api/types/InventoryAdjustmentGroup.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface InventoryAdjustmentGroup { + /** + * A unique ID generated by Square for the + * `InventoryAdjustmentGroup`. + */ + id?: string; + /** The inventory adjustment of the composed variation. */ + rootAdjustmentId?: string; + /** + * Representative `from_state` for adjustments within the group. For example, for a group adjustment from `IN_STOCK` to `SOLD`, + * there can be two component adjustments in the group: one from `IN_STOCK`to `COMPOSED` and the other one from `COMPOSED` to `SOLD`. + * Here, the representative `from_state` for the `InventoryAdjustmentGroup` is `IN_STOCK`. + * See [InventoryState](#type-inventorystate) for possible values + */ + fromState?: Square.InventoryState; + /** + * Representative `to_state` for adjustments within group. For example, for a group adjustment from `IN_STOCK` to `SOLD`, + * the two component adjustments in the group can be from `IN_STOCK` to `COMPOSED` and from `COMPOSED` to `SOLD`. + * Here, the representative `to_state` of the `InventoryAdjustmentGroup` is `SOLD`. + * See [InventoryState](#type-inventorystate) for possible values + */ + toState?: Square.InventoryState; +} diff --git a/src/api/types/InventoryAlertType.ts b/src/api/types/InventoryAlertType.ts new file mode 100644 index 000000000..d4157ce67 --- /dev/null +++ b/src/api/types/InventoryAlertType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. + */ +export type InventoryAlertType = "NONE" | "LOW_QUANTITY"; +export const InventoryAlertType = { + None: "NONE", + LowQuantity: "LOW_QUANTITY", +} as const; diff --git a/src/api/types/InventoryChange.ts b/src/api/types/InventoryChange.ts new file mode 100644 index 000000000..155b8d6ad --- /dev/null +++ b/src/api/types/InventoryChange.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a single physical count, inventory, adjustment, or transfer + * that is part of the history of inventory changes for a particular + * [CatalogObject](entity:CatalogObject) instance. + */ +export interface InventoryChange { + /** + * Indicates how the inventory change is applied. See + * [InventoryChangeType](entity:InventoryChangeType) for all possible values. + * See [InventoryChangeType](#type-inventorychangetype) for possible values + */ + type?: Square.InventoryChangeType; + /** + * Contains details about the physical count when `type` is + * `PHYSICAL_COUNT`, and is unset for all other change types. + */ + physicalCount?: Square.InventoryPhysicalCount; + /** + * Contains details about the inventory adjustment when `type` is + * `ADJUSTMENT`, and is unset for all other change types. + */ + adjustment?: Square.InventoryAdjustment; + /** + * Contains details about the inventory transfer when `type` is + * `TRANSFER`, and is unset for all other change types. + * + * _Note:_ An [InventoryTransfer](entity:InventoryTransfer) object can only be set in the input to the + * [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) endpoint when the seller has an active Retail Plus subscription. + */ + transfer?: Square.InventoryTransfer; + /** The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. */ + measurementUnit?: Square.CatalogMeasurementUnit; + /** The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. */ + measurementUnitId?: string; +} diff --git a/src/api/types/InventoryChangeType.ts b/src/api/types/InventoryChangeType.ts new file mode 100644 index 000000000..c77ce19e8 --- /dev/null +++ b/src/api/types/InventoryChangeType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates how the inventory change was applied to a tracked product quantity. + */ +export type InventoryChangeType = "PHYSICAL_COUNT" | "ADJUSTMENT" | "TRANSFER"; +export const InventoryChangeType = { + PhysicalCount: "PHYSICAL_COUNT", + Adjustment: "ADJUSTMENT", + Transfer: "TRANSFER", +} as const; diff --git a/src/api/types/InventoryCount.ts b/src/api/types/InventoryCount.ts new file mode 100644 index 000000000..d5bcbd693 --- /dev/null +++ b/src/api/types/InventoryCount.ts @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents Square-estimated quantity of items in a particular state at a + * particular seller location based on the known history of physical counts and + * inventory adjustments. + */ +export interface InventoryCount { + /** + * The Square-generated ID of the + * [CatalogObject](entity:CatalogObject) being tracked. + */ + catalogObjectId?: string | null; + /** + * The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. + * + * The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. + * In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app. + */ + catalogObjectType?: string | null; + /** + * The current [inventory state](entity:InventoryState) for the related + * quantity of items. + * See [InventoryState](#type-inventorystate) for possible values + */ + state?: Square.InventoryState; + /** + * The Square-generated ID of the [Location](entity:Location) where the related + * quantity of items is being tracked. + */ + locationId?: string | null; + /** + * The number of items affected by the estimated count as a decimal string. + * Can support up to 5 digits after the decimal point. + */ + quantity?: string | null; + /** + * An RFC 3339-formatted timestamp that indicates when the most recent physical count or adjustment affecting + * the estimated count is received. + */ + calculatedAt?: string; + /** + * Whether the inventory count is for composed variation (TRUE) or not (FALSE). If true, the inventory count will not be present in the response of + * any of these endpoints: [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory), + * [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges), + * [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts), and + * [RetrieveInventoryChanges](api-endpoint:Inventory-RetrieveInventoryChanges). + */ + isEstimated?: boolean; +} diff --git a/src/api/types/InventoryPhysicalCount.ts b/src/api/types/InventoryPhysicalCount.ts new file mode 100644 index 000000000..c20ca06af --- /dev/null +++ b/src/api/types/InventoryPhysicalCount.ts @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the quantity of an item variation that is physically present + * at a specific location, verified by a seller or a seller's employee. For example, + * a physical count might come from an employee counting the item variations on + * hand or from syncing with an external system. + */ +export interface InventoryPhysicalCount { + /** + * A unique Square-generated ID for the + * [InventoryPhysicalCount](entity:InventoryPhysicalCount). + */ + id?: string; + /** + * An optional ID provided by the application to tie the + * [InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external + * system. + */ + referenceId?: string | null; + /** + * The Square-generated ID of the + * [CatalogObject](entity:CatalogObject) being tracked. + */ + catalogObjectId?: string | null; + /** + * The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. + * + * The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. + * In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app. + */ + catalogObjectType?: string | null; + /** + * The current [inventory state](entity:InventoryState) for the related + * quantity of items. + * See [InventoryState](#type-inventorystate) for possible values + */ + state?: Square.InventoryState; + /** + * The Square-generated ID of the [Location](entity:Location) where the related + * quantity of items is being tracked. + */ + locationId?: string | null; + /** + * The number of items affected by the physical count as a decimal string. + * The number can support up to 5 digits after the decimal point. + */ + quantity?: string | null; + /** + * Information about the application with which the + * physical count is submitted. + */ + source?: Square.SourceApplication; + /** + * The Square-generated ID of the [Employee](entity:Employee) responsible for the + * physical count. + */ + employeeId?: string | null; + /** + * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the + * physical count. + */ + teamMemberId?: string | null; + /** + * A client-generated RFC 3339-formatted timestamp that indicates when + * the physical count was examined. For physical count updates, the `occurred_at` + * timestamp cannot be older than 24 hours or in the future relative to the + * time of the request. + */ + occurredAt?: string | null; + /** An RFC 3339-formatted timestamp that indicates when the physical count is received. */ + createdAt?: string; +} diff --git a/src/api/types/InventoryState.ts b/src/api/types/InventoryState.ts new file mode 100644 index 000000000..34af6a483 --- /dev/null +++ b/src/api/types/InventoryState.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the state of a tracked item quantity in the lifecycle of goods. + */ +export type InventoryState = + | "CUSTOM" + | "IN_STOCK" + | "SOLD" + | "RETURNED_BY_CUSTOMER" + | "RESERVED_FOR_SALE" + | "SOLD_ONLINE" + | "ORDERED_FROM_VENDOR" + | "RECEIVED_FROM_VENDOR" + | "IN_TRANSIT_TO" + | "NONE" + | "WASTE" + | "UNLINKED_RETURN" + | "COMPOSED" + | "DECOMPOSED" + | "SUPPORTED_BY_NEWER_VERSION" + | "IN_TRANSIT"; +export const InventoryState = { + Custom: "CUSTOM", + InStock: "IN_STOCK", + Sold: "SOLD", + ReturnedByCustomer: "RETURNED_BY_CUSTOMER", + ReservedForSale: "RESERVED_FOR_SALE", + SoldOnline: "SOLD_ONLINE", + OrderedFromVendor: "ORDERED_FROM_VENDOR", + ReceivedFromVendor: "RECEIVED_FROM_VENDOR", + InTransitTo: "IN_TRANSIT_TO", + None: "NONE", + Waste: "WASTE", + UnlinkedReturn: "UNLINKED_RETURN", + Composed: "COMPOSED", + Decomposed: "DECOMPOSED", + SupportedByNewerVersion: "SUPPORTED_BY_NEWER_VERSION", + InTransit: "IN_TRANSIT", +} as const; diff --git a/src/api/types/InventoryTransfer.ts b/src/api/types/InventoryTransfer.ts new file mode 100644 index 000000000..180a85c25 --- /dev/null +++ b/src/api/types/InventoryTransfer.ts @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the transfer of a quantity of product inventory at a + * particular time from one location to another. + */ +export interface InventoryTransfer { + /** + * A unique ID generated by Square for the + * `InventoryTransfer`. + */ + id?: string; + /** + * An optional ID provided by the application to tie the + * `InventoryTransfer` to an external system. + */ + referenceId?: string | null; + /** + * The [inventory state](entity:InventoryState) for the quantity of + * items being transferred. + * See [InventoryState](#type-inventorystate) for possible values + */ + state?: Square.InventoryState; + /** + * The Square-generated ID of the [Location](entity:Location) where the related + * quantity of items was tracked before the transfer. + */ + fromLocationId?: string | null; + /** + * The Square-generated ID of the [Location](entity:Location) where the related + * quantity of items was tracked after the transfer. + */ + toLocationId?: string | null; + /** + * The Square-generated ID of the + * [CatalogObject](entity:CatalogObject) being tracked. + */ + catalogObjectId?: string | null; + /** + * The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. + * + * The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. + * In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app. + */ + catalogObjectType?: string | null; + /** + * The number of items affected by the transfer as a decimal string. + * Can support up to 5 digits after the decimal point. + */ + quantity?: string | null; + /** + * A client-generated RFC 3339-formatted timestamp that indicates when + * the transfer took place. For write actions, the `occurred_at` timestamp + * cannot be older than 24 hours or in the future relative to the time of the + * request. + */ + occurredAt?: string | null; + /** + * An RFC 3339-formatted timestamp that indicates when Square + * received the transfer request. + */ + createdAt?: string; + /** + * Information about the application that initiated the + * inventory transfer. + */ + source?: Square.SourceApplication; + /** + * The Square-generated ID of the [Employee](entity:Employee) responsible for the + * inventory transfer. + */ + employeeId?: string | null; + /** + * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the + * inventory transfer. + */ + teamMemberId?: string | null; +} diff --git a/src/api/types/Invoice.ts b/src/api/types/Invoice.ts new file mode 100644 index 000000000..913a2812f --- /dev/null +++ b/src/api/types/Invoice.ts @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Stores information about an invoice. You use the Invoices API to create and manage + * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). + */ +export interface Invoice { + /** The Square-assigned ID of the invoice. */ + id?: string; + /** The Square-assigned version number, which is incremented each time an update is committed to the invoice. */ + version?: number; + /** + * The ID of the location that this invoice is associated with. + * + * If specified in a `CreateInvoice` request, the value must match the `location_id` of the associated order. + */ + locationId?: string | null; + /** + * The ID of the [order](entity:Order) for which the invoice is created. + * This field is required when creating an invoice, and the order must be in the `OPEN` state. + * + * To view the line items and other information for the associated order, call the + * [RetrieveOrder](api-endpoint:Orders-RetrieveOrder) endpoint using the order ID. + */ + orderId?: string | null; + /** + * The customer who receives the invoice. This customer data is displayed on the invoice and used by Square to deliver the invoice. + * + * This field is required to publish an invoice, and it must specify the `customer_id`. + */ + primaryRecipient?: Square.InvoiceRecipient; + /** + * The payment schedule for the invoice, represented by one or more payment requests that + * define payment settings, such as amount due and due date. An invoice supports the following payment request combinations: + * - One balance + * - One deposit with one balance + * - 2–12 installments + * - One deposit with 2–12 installments + * + * This field is required when creating an invoice. It must contain at least one payment request. + * All payment requests for the invoice must equal the total order amount. For more information, see + * [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). + * + * Adding `INSTALLMENT` payment requests to an invoice requires an + * [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). + */ + paymentRequests?: Square.InvoicePaymentRequest[] | null; + /** + * The delivery method that Square uses to send the invoice, reminders, and receipts to + * the customer. After the invoice is published, Square processes the invoice based on the delivery + * method and payment request settings, either immediately or on the `scheduled_at` date, if specified. + * For example, Square might send the invoice or receipt for an automatic payment. For invoices with + * automatic payments, this field must be set to `EMAIL`. + * + * One of the following is required when creating an invoice: + * - (Recommended) This `delivery_method` field. To configure an automatic payment, the + * `automatic_payment_source` field of the payment request is also required. + * - The deprecated `request_method` field of the payment request. Note that `invoice` + * objects returned in responses do not include `request_method`. + * See [InvoiceDeliveryMethod](#type-invoicedeliverymethod) for possible values + */ + deliveryMethod?: Square.InvoiceDeliveryMethod; + /** + * A user-friendly invoice number that is displayed on the invoice. The value is unique within a location. + * If not provided when creating an invoice, Square assigns a value. + * It increments from 1 and is padded with zeros making it 7 characters long + * (for example, 0000001 and 0000002). + */ + invoiceNumber?: string | null; + /** The title of the invoice, which is displayed on the invoice. */ + title?: string | null; + /** The description of the invoice, which is displayed on the invoice. */ + description?: string | null; + /** + * The timestamp when the invoice is scheduled for processing, in RFC 3339 format. + * After the invoice is published, Square processes the invoice on the specified date, + * according to the delivery method and payment request settings. + * + * If the field is not set, Square processes the invoice immediately after it is published. + */ + scheduledAt?: string | null; + /** + * The URL of the Square-hosted invoice page. + * After you publish the invoice using the `PublishInvoice` endpoint, Square hosts the invoice + * page and returns the page URL in the response. + */ + publicUrl?: string; + /** + * The current amount due for the invoice. In addition to the + * amount due on the next payment request, this includes any overdue payment amounts. + */ + nextPaymentAmountMoney?: Square.Money; + /** + * The status of the invoice. + * See [InvoiceStatus](#type-invoicestatus) for possible values + */ + status?: Square.InvoiceStatus; + /** + * The time zone used to interpret calendar dates on the invoice, such as `due_date`. + * When an invoice is created, this field is set to the `timezone` specified for the seller + * location. The value cannot be changed. + * + * For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los\_Angeles + * becomes overdue at midnight on March 9 in America/Los\_Angeles (which equals a UTC timestamp + * of 2021-03-10T08:00:00Z). + */ + timezone?: string; + /** The timestamp when the invoice was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the invoice was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** + * The payment methods that customers can use to pay the invoice on the Square-hosted + * invoice page. This setting is independent of any automatic payment requests for the invoice. + * + * This field is required when creating an invoice and must set at least one payment method to `true`. + */ + acceptedPaymentMethods?: Square.InvoiceAcceptedPaymentMethods; + /** + * Additional seller-defined fields that are displayed on the invoice. For more information, see + * [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). + * + * Adding custom fields to an invoice requires an + * [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). + * + * Max: 2 custom fields + */ + customFields?: Square.InvoiceCustomField[] | null; + /** + * The ID of the [subscription](entity:Subscription) associated with the invoice. + * This field is present only on subscription billing invoices. + */ + subscriptionId?: string; + /** + * The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format. + * This field can be used to specify a past or future date which is displayed on the invoice. + */ + saleOrServiceDate?: string | null; + /** + * **France only.** The payment terms and conditions that are displayed on the invoice. For more information, + * see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions). + * + * For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and + * "Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests. + */ + paymentConditions?: string | null; + /** + * Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a + * bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on file__ checkbox on the + * invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`. + */ + storePaymentMethodEnabled?: boolean | null; + /** + * Metadata about the attachments on the invoice. Invoice attachments are managed using the + * [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints. + */ + attachments?: Square.InvoiceAttachment[]; +} diff --git a/src/api/types/InvoiceAcceptedPaymentMethods.ts b/src/api/types/InvoiceAcceptedPaymentMethods.ts new file mode 100644 index 000000000..3423517b3 --- /dev/null +++ b/src/api/types/InvoiceAcceptedPaymentMethods.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The payment methods that customers can use to pay an [invoice](entity:Invoice) on the Square-hosted invoice payment page. + */ +export interface InvoiceAcceptedPaymentMethods { + /** Indicates whether credit card or debit card payments are accepted. The default value is `false`. */ + card?: boolean | null; + /** Indicates whether Square gift card payments are accepted. The default value is `false`. */ + squareGiftCard?: boolean | null; + /** Indicates whether ACH bank transfer payments are accepted. The default value is `false`. */ + bankAccount?: boolean | null; + /** + * Indicates whether Afterpay (also known as Clearpay) payments are accepted. The default value is `false`. + * + * This option is allowed only for invoices that have a single payment request of the `BALANCE` type. This payment method is + * supported if the seller account accepts Afterpay payments and the seller location is in a country where Afterpay + * invoice payments are supported. As a best practice, consider enabling an additional payment method when allowing + * `buy_now_pay_later` payments. For more information, including detailed requirements and processing limits, see + * [Buy Now Pay Later payments with Afterpay](https://developer.squareup.com/docs/invoices-api/overview#buy-now-pay-later). + */ + buyNowPayLater?: boolean | null; + /** + * Indicates whether Cash App payments are accepted. The default value is `false`. + * + * This payment method is supported only for seller [locations](entity:Location) in the United States. + */ + cashAppPay?: boolean | null; +} diff --git a/src/api/types/InvoiceAttachment.ts b/src/api/types/InvoiceAttachment.ts new file mode 100644 index 000000000..025574248 --- /dev/null +++ b/src/api/types/InvoiceAttachment.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a file attached to an [invoice](entity:Invoice). + */ +export interface InvoiceAttachment { + /** The Square-assigned ID of the attachment. */ + id?: string; + /** The file name of the attachment, which is displayed on the invoice. */ + filename?: string; + /** + * The description of the attachment, which is displayed on the invoice. + * This field maps to the seller-defined **Message** field. + */ + description?: string; + /** The file size of the attachment in bytes. */ + filesize?: number; + /** The MD5 hash that was generated from the file contents. */ + hash?: string; + /** + * The mime type of the attachment. + * The following mime types are supported: + * image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. + */ + mimeType?: string; + /** The timestamp when the attachment was uploaded, in RFC 3339 format. */ + uploadedAt?: string; +} diff --git a/src/api/types/InvoiceAutomaticPaymentSource.ts b/src/api/types/InvoiceAutomaticPaymentSource.ts new file mode 100644 index 000000000..19068be2d --- /dev/null +++ b/src/api/types/InvoiceAutomaticPaymentSource.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the automatic payment method for an [invoice payment request](entity:InvoicePaymentRequest). + */ +export type InvoiceAutomaticPaymentSource = "NONE" | "CARD_ON_FILE" | "BANK_ON_FILE"; +export const InvoiceAutomaticPaymentSource = { + None: "NONE", + CardOnFile: "CARD_ON_FILE", + BankOnFile: "BANK_ON_FILE", +} as const; diff --git a/src/api/types/InvoiceCustomField.ts b/src/api/types/InvoiceCustomField.ts new file mode 100644 index 000000000..4dee741b2 --- /dev/null +++ b/src/api/types/InvoiceCustomField.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * An additional seller-defined and customer-facing field to include on the invoice. For more information, + * see [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). + * + * Adding custom fields to an invoice requires an + * [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). + */ +export interface InvoiceCustomField { + /** The label or title of the custom field. This field is required for a custom field. */ + label?: string | null; + /** The text of the custom field. If omitted, only the label is rendered. */ + value?: string | null; + /** + * The location of the custom field on the invoice. This field is required for a custom field. + * See [InvoiceCustomFieldPlacement](#type-invoicecustomfieldplacement) for possible values + */ + placement?: Square.InvoiceCustomFieldPlacement; +} diff --git a/src/api/types/InvoiceCustomFieldPlacement.ts b/src/api/types/InvoiceCustomFieldPlacement.ts new file mode 100644 index 000000000..efafb510b --- /dev/null +++ b/src/api/types/InvoiceCustomFieldPlacement.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates where to render a custom field on the Square-hosted invoice page and in emailed or PDF + * copies of the invoice. + */ +export type InvoiceCustomFieldPlacement = "ABOVE_LINE_ITEMS" | "BELOW_LINE_ITEMS"; +export const InvoiceCustomFieldPlacement = { + AboveLineItems: "ABOVE_LINE_ITEMS", + BelowLineItems: "BELOW_LINE_ITEMS", +} as const; diff --git a/src/api/types/InvoiceDeliveryMethod.ts b/src/api/types/InvoiceDeliveryMethod.ts new file mode 100644 index 000000000..d4cc5e7da --- /dev/null +++ b/src/api/types/InvoiceDeliveryMethod.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates how Square delivers the [invoice](entity:Invoice) to the customer. + */ +export type InvoiceDeliveryMethod = "EMAIL" | "SHARE_MANUALLY" | "SMS"; +export const InvoiceDeliveryMethod = { + Email: "EMAIL", + ShareManually: "SHARE_MANUALLY", + Sms: "SMS", +} as const; diff --git a/src/api/types/InvoiceFilter.ts b/src/api/types/InvoiceFilter.ts new file mode 100644 index 000000000..32d264df3 --- /dev/null +++ b/src/api/types/InvoiceFilter.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes query filters to apply. + */ +export interface InvoiceFilter { + /** + * Limits the search to the specified locations. A location is required. + * In the current implementation, only one location can be specified. + */ + locationIds: string[]; + /** + * Limits the search to the specified customers, within the specified locations. + * Specifying a customer is optional. In the current implementation, + * a maximum of one customer can be specified. + */ + customerIds?: string[] | null; +} diff --git a/src/api/types/InvoicePaymentReminder.ts b/src/api/types/InvoicePaymentReminder.ts new file mode 100644 index 000000000..4d52f0894 --- /dev/null +++ b/src/api/types/InvoicePaymentReminder.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes a payment request reminder (automatic notification) that Square sends + * to the customer. You configure a reminder relative to the payment request + * `due_date`. + */ +export interface InvoicePaymentReminder { + /** + * A Square-assigned ID that uniquely identifies the reminder within the + * `InvoicePaymentRequest`. + */ + uid?: string; + /** + * The number of days before (a negative number) or after (a positive number) + * the payment request `due_date` when the reminder is sent. For example, -3 indicates that + * the reminder should be sent 3 days before the payment request `due_date`. + */ + relativeScheduledDays?: number | null; + /** The reminder message. */ + message?: string | null; + /** + * The status of the reminder. + * See [InvoicePaymentReminderStatus](#type-invoicepaymentreminderstatus) for possible values + */ + status?: Square.InvoicePaymentReminderStatus; + /** If sent, the timestamp when the reminder was sent, in RFC 3339 format. */ + sentAt?: string; +} diff --git a/src/api/types/InvoicePaymentReminderStatus.ts b/src/api/types/InvoicePaymentReminderStatus.ts new file mode 100644 index 000000000..96f891348 --- /dev/null +++ b/src/api/types/InvoicePaymentReminderStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The status of a payment request reminder. + */ +export type InvoicePaymentReminderStatus = "PENDING" | "NOT_APPLICABLE" | "SENT"; +export const InvoicePaymentReminderStatus = { + Pending: "PENDING", + NotApplicable: "NOT_APPLICABLE", + Sent: "SENT", +} as const; diff --git a/src/api/types/InvoicePaymentRequest.ts b/src/api/types/InvoicePaymentRequest.ts new file mode 100644 index 000000000..b238a38b4 --- /dev/null +++ b/src/api/types/InvoicePaymentRequest.ts @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a payment request for an [invoice](entity:Invoice). Invoices can specify a maximum + * of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information, + * see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). + * + * Adding `INSTALLMENT` payment requests to an invoice requires an + * [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). + */ +export interface InvoicePaymentRequest { + /** The Square-generated ID of the payment request in an [invoice](entity:Invoice). */ + uid?: string | null; + /** + * Indicates how Square processes the payment request. DEPRECATED at version 2021-01-21. Replaced by the + * `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. + * + * One of the following is required when creating an invoice: + * - (Recommended) The `delivery_method` field of the invoice. To configure an automatic payment, the + * `automatic_payment_source` field of the payment request is also required. + * - This `request_method` field. Note that `invoice` objects returned in responses do not include `request_method`. + * See [InvoiceRequestMethod](#type-invoicerequestmethod) for possible values + */ + requestMethod?: Square.InvoiceRequestMethod; + /** + * Identifies the payment request type. This type defines how the payment request amount is determined. + * This field is required to create a payment request. + * See [InvoiceRequestType](#type-invoicerequesttype) for possible values + */ + requestType?: Square.InvoiceRequestType; + /** + * The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format. This field + * is required to create a payment request. If an `automatic_payment_source` is defined for the request, Square + * charges the payment source on this date. + * + * After this date, the invoice becomes overdue. For example, a payment `due_date` of 2021-03-09 with a `timezone` + * of America/Los\_Angeles becomes overdue at midnight on March 9 in America/Los\_Angeles (which equals a UTC + * timestamp of 2021-03-10T08:00:00Z). + */ + dueDate?: string | null; + /** + * If the payment request specifies `DEPOSIT` or `INSTALLMENT` as the `request_type`, + * this indicates the request amount. + * You cannot specify this when `request_type` is `BALANCE` or when the + * payment request includes the `percentage_requested` field. + */ + fixedAmountRequestedMoney?: Square.Money; + /** + * Specifies the amount for the payment request in percentage: + * + * - When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total amount. + * - When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's total less + * the deposit, if requested. The sum of the `percentage_requested` in all installment + * payment requests must be equal to 100. + * + * You cannot specify this when the payment `request_type` is `BALANCE` or when the + * payment request specifies the `fixed_amount_requested_money` field. + */ + percentageRequested?: string | null; + /** + * If set to true, the Square-hosted invoice page (the `public_url` field of the invoice) + * provides a place for the customer to pay a tip. + * + * This field is allowed only on the final payment request + * and the payment `request_type` must be `BALANCE` or `INSTALLMENT`. + */ + tippingEnabled?: boolean | null; + /** + * The payment method for an automatic payment. + * + * The default value is `NONE`. + * See [InvoiceAutomaticPaymentSource](#type-invoiceautomaticpaymentsource) for possible values + */ + automaticPaymentSource?: Square.InvoiceAutomaticPaymentSource; + /** + * The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer, + * call [ListCards](api-endpoint:Cards-ListCards) and include the `customer_id` of the invoice recipient. + */ + cardId?: string | null; + /** A list of one or more reminders to send for the payment request. */ + reminders?: Square.InvoicePaymentReminder[] | null; + /** + * The amount of the payment request, computed using the order amount and information from the various payment + * request fields (`request_type`, `fixed_amount_requested_money`, and `percentage_requested`). + */ + computedAmountMoney?: Square.Money; + /** + * The amount of money already paid for the specific payment request. + * This amount might include a rounding adjustment if the most recent invoice payment + * was in cash in a currency that rounds cash payments (such as, `CAD` or `AUD`). + */ + totalCompletedAmountMoney?: Square.Money; + /** + * If the most recent payment was a cash payment + * in a currency that rounds cash payments (such as, `CAD` or `AUD`) and the payment + * is rounded from `computed_amount_money` in the payment request, then this + * field specifies the rounding adjustment applied. This amount + * might be negative. + */ + roundingAdjustmentIncludedMoney?: Square.Money; +} diff --git a/src/api/types/InvoiceQuery.ts b/src/api/types/InvoiceQuery.ts new file mode 100644 index 000000000..4ed3833b7 --- /dev/null +++ b/src/api/types/InvoiceQuery.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes query criteria for searching invoices. + */ +export interface InvoiceQuery { + /** + * Query filters to apply in searching invoices. + * For more information, see [Search for invoices](https://developer.squareup.com/docs/invoices-api/retrieve-list-search-invoices#search-invoices). + */ + filter: Square.InvoiceFilter; + /** Describes the sort order for the search result. */ + sort?: Square.InvoiceSort; +} diff --git a/src/api/types/InvoiceRecipient.ts b/src/api/types/InvoiceRecipient.ts new file mode 100644 index 000000000..37cf7b4d2 --- /dev/null +++ b/src/api/types/InvoiceRecipient.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice + * and that Square uses to deliver the invoice. + * + * When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates + * the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published. + * Square updates the customer ID in response to a merge operation, but does not update other fields. + */ +export interface InvoiceRecipient { + /** + * The ID of the customer. This is the customer profile ID that + * you provide when creating a draft invoice. + */ + customerId?: string | null; + /** The recipient's given (that is, first) name. */ + givenName?: string; + /** The recipient's family (that is, last) name. */ + familyName?: string; + /** The recipient's email address. */ + emailAddress?: string; + /** The recipient's physical address. */ + address?: Square.Address; + /** The recipient's phone number. */ + phoneNumber?: string; + /** The name of the recipient's company. */ + companyName?: string; + /** + * The recipient's tax IDs. The country of the seller account determines whether this field + * is available for the customer. For more information, see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). + */ + taxIds?: Square.InvoiceRecipientTaxIds; +} diff --git a/src/api/types/InvoiceRecipientTaxIds.ts b/src/api/types/InvoiceRecipientTaxIds.ts new file mode 100644 index 000000000..bb695aae0 --- /dev/null +++ b/src/api/types/InvoiceRecipientTaxIds.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the tax IDs for an invoice recipient. The country of the seller account determines + * whether the corresponding `tax_ids` field is available for the customer. For more information, + * see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). + */ +export interface InvoiceRecipientTaxIds { + /** The EU VAT identification number for the invoice recipient. For example, `IE3426675K`. */ + euVat?: string; +} diff --git a/src/api/types/InvoiceRequestMethod.ts b/src/api/types/InvoiceRequestMethod.ts new file mode 100644 index 000000000..2c6c5698f --- /dev/null +++ b/src/api/types/InvoiceRequestMethod.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specifies the action for Square to take for processing the invoice. For example, + * email the invoice, charge a customer's card on file, or do nothing. DEPRECATED at + * version 2021-01-21. The corresponding `request_method` field is replaced by the + * `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. + */ +export type InvoiceRequestMethod = + | "EMAIL" + | "CHARGE_CARD_ON_FILE" + | "SHARE_MANUALLY" + | "CHARGE_BANK_ON_FILE" + | "SMS" + | "SMS_CHARGE_CARD_ON_FILE" + | "SMS_CHARGE_BANK_ON_FILE"; +export const InvoiceRequestMethod = { + Email: "EMAIL", + ChargeCardOnFile: "CHARGE_CARD_ON_FILE", + ShareManually: "SHARE_MANUALLY", + ChargeBankOnFile: "CHARGE_BANK_ON_FILE", + Sms: "SMS", + SmsChargeCardOnFile: "SMS_CHARGE_CARD_ON_FILE", + SmsChargeBankOnFile: "SMS_CHARGE_BANK_ON_FILE", +} as const; diff --git a/src/api/types/InvoiceRequestType.ts b/src/api/types/InvoiceRequestType.ts new file mode 100644 index 000000000..7b8d8188c --- /dev/null +++ b/src/api/types/InvoiceRequestType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the type of the payment request. For more information, see + * [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). + */ +export type InvoiceRequestType = "BALANCE" | "DEPOSIT" | "INSTALLMENT"; +export const InvoiceRequestType = { + Balance: "BALANCE", + Deposit: "DEPOSIT", + Installment: "INSTALLMENT", +} as const; diff --git a/src/api/types/InvoiceSort.ts b/src/api/types/InvoiceSort.ts new file mode 100644 index 000000000..4ddefc79d --- /dev/null +++ b/src/api/types/InvoiceSort.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Identifies the sort field and sort order. + */ +export interface InvoiceSort { + /** + * The field to use for sorting. + * See [InvoiceSortField](#type-invoicesortfield) for possible values + */ + field: Square.InvoiceSortField; + /** + * The order to use for sorting the results. + * See [SortOrder](#type-sortorder) for possible values + */ + order?: Square.SortOrder; +} diff --git a/src/api/types/InvoiceSortField.ts b/src/api/types/InvoiceSortField.ts new file mode 100644 index 000000000..0f1781d15 --- /dev/null +++ b/src/api/types/InvoiceSortField.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The field to use for sorting. + */ +export type InvoiceSortField = "INVOICE_SORT_DATE"; diff --git a/src/api/types/InvoiceStatus.ts b/src/api/types/InvoiceStatus.ts new file mode 100644 index 000000000..f261493cc --- /dev/null +++ b/src/api/types/InvoiceStatus.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the status of an invoice. + */ +export type InvoiceStatus = + | "DRAFT" + | "UNPAID" + | "SCHEDULED" + | "PARTIALLY_PAID" + | "PAID" + | "PARTIALLY_REFUNDED" + | "REFUNDED" + | "CANCELED" + | "FAILED" + | "PAYMENT_PENDING"; +export const InvoiceStatus = { + Draft: "DRAFT", + Unpaid: "UNPAID", + Scheduled: "SCHEDULED", + PartiallyPaid: "PARTIALLY_PAID", + Paid: "PAID", + PartiallyRefunded: "PARTIALLY_REFUNDED", + Refunded: "REFUNDED", + Canceled: "CANCELED", + Failed: "FAILED", + PaymentPending: "PAYMENT_PENDING", +} as const; diff --git a/src/api/types/ItemVariationLocationOverrides.ts b/src/api/types/ItemVariationLocationOverrides.ts new file mode 100644 index 000000000..fb9055148 --- /dev/null +++ b/src/api/types/ItemVariationLocationOverrides.ts @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Price and inventory alerting overrides for a `CatalogItemVariation` at a specific `Location`. + */ +export interface ItemVariationLocationOverrides { + /** The ID of the `Location`. This can include locations that are deactivated. */ + locationId?: string | null; + /** The price of the `CatalogItemVariation` at the given `Location`, or blank for variable pricing. */ + priceMoney?: Square.Money; + /** + * The pricing type (fixed or variable) for the `CatalogItemVariation` at the given `Location`. + * See [CatalogPricingType](#type-catalogpricingtype) for possible values + */ + pricingType?: Square.CatalogPricingType; + /** If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`. */ + trackInventory?: boolean | null; + /** + * Indicates whether the `CatalogItemVariation` displays an alert when its inventory + * quantity is less than or equal to its `inventory_alert_threshold`. + * See [InventoryAlertType](#type-inventoryalerttype) for possible values + */ + inventoryAlertType?: Square.InventoryAlertType; + /** + * If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` + * is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. + * + * This value is always an integer. + */ + inventoryAlertThreshold?: bigint | null; + /** + * Indicates whether the overridden item variation is sold out at the specified location. + * + * When inventory tracking is enabled on the item variation either globally or at the specified location, + * the item variation is automatically marked as sold out when its inventory count reaches zero. The seller + * can manually set the item variation as sold out even when the inventory count is greater than zero. + * Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is set, + * applications should treat its inventory count as zero when this attribute value is `true`. + */ + soldOut?: boolean; + /** + * The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation + * becomes available again at the specified location. Attempts by an application to set this attribute are ignored. + * When the current time is later than this attribute value, the affected item variation is no longer sold out. + */ + soldOutValidUntil?: string; +} diff --git a/src/api/types/Job.ts b/src/api/types/Job.ts new file mode 100644 index 000000000..feae74ed7 --- /dev/null +++ b/src/api/types/Job.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a job that can be assigned to [team members](entity:TeamMember). This object defines the + * job's title and tip eligibility. Compensation is defined in a [job assignment](entity:JobAssignment) + * in a team member's wage setting. + */ +export interface Job { + /** + * **Read only** The unique Square-assigned ID of the job. If you need a job ID for an API request, + * call [ListJobs](api-endpoint:Team-ListJobs) or use the ID returned when you created the job. + * You can also get job IDs from a team member's wage setting. + */ + id?: string; + /** The title of the job. */ + title?: string | null; + /** Indicates whether team members can earn tips for the job. */ + isTipEligible?: boolean | null; + /** The timestamp when the job was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the job was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** + * **Read only** The current version of the job. Include this field in `UpdateJob` requests to enable + * [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency) + * control and avoid overwrites from concurrent requests. Requests fail if the provided version doesn't + * match the server version at the time of the request. + */ + version?: number; +} diff --git a/src/api/types/JobAssignment.ts b/src/api/types/JobAssignment.ts new file mode 100644 index 000000000..676dacd7b --- /dev/null +++ b/src/api/types/JobAssignment.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a job assigned to a [team member](entity:TeamMember), including the compensation the team + * member earns for the job. Job assignments are listed in the team member's [wage setting](entity:WageSetting). + */ +export interface JobAssignment { + /** The title of the job. */ + jobTitle?: string | null; + /** + * The current pay type for the job assignment used to + * calculate the pay amount in a pay period. + * See [JobAssignmentPayType](#type-jobassignmentpaytype) for possible values + */ + payType: Square.JobAssignmentPayType; + /** + * The hourly pay rate of the job. For `SALARY` pay types, Square calculates the hourly rate based on + * `annual_rate` and `weekly_hours`. + */ + hourlyRate?: Square.Money; + /** The total pay amount for a 12-month period on the job. Set if the job `PayType` is `SALARY`. */ + annualRate?: Square.Money; + /** The planned hours per week for the job. Set if the job `PayType` is `SALARY`. */ + weeklyHours?: number | null; + /** The ID of the [job](entity:Job). */ + jobId?: string | null; +} diff --git a/src/api/types/JobAssignmentPayType.ts b/src/api/types/JobAssignmentPayType.ts new file mode 100644 index 000000000..5dde03d42 --- /dev/null +++ b/src/api/types/JobAssignmentPayType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enumerates the possible pay types that a job can be assigned. + */ +export type JobAssignmentPayType = "NONE" | "HOURLY" | "SALARY"; +export const JobAssignmentPayType = { + None: "NONE", + Hourly: "HOURLY", + Salary: "SALARY", +} as const; diff --git a/src/api/types/LinkCustomerToGiftCardResponse.ts b/src/api/types/LinkCustomerToGiftCardResponse.ts new file mode 100644 index 000000000..e0bafe979 --- /dev/null +++ b/src/api/types/LinkCustomerToGiftCardResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains the linked `GiftCard` object. If the request resulted in errors, + * the response contains a set of `Error` objects. + */ +export interface LinkCustomerToGiftCardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The gift card with the ID of the linked customer listed in the `customer_ids` field. */ + giftCard?: Square.GiftCard; +} diff --git a/src/api/types/ListBankAccountsResponse.ts b/src/api/types/ListBankAccountsResponse.ts new file mode 100644 index 000000000..2ab464731 --- /dev/null +++ b/src/api/types/ListBankAccountsResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Response object returned by ListBankAccounts. + */ +export interface ListBankAccountsResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** List of BankAccounts associated with this account. */ + bankAccounts?: Square.BankAccount[]; + /** + * When a response is truncated, it includes a cursor that you can + * use in a subsequent request to fetch next set of bank accounts. + * If empty, this is the final response. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListBookingCustomAttributeDefinitionsResponse.ts b/src/api/types/ListBookingCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..a2513f5fb --- /dev/null +++ b/src/api/types/ListBookingCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListBookingCustomAttributeDefinitions](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributeDefinitions) response. + * Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. + * If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + */ +export interface ListBookingCustomAttributeDefinitionsResponse { + /** + * The retrieved custom attribute definitions. If no custom attribute definitions are found, + * Square returns an empty object (`{}`). + */ + customAttributeDefinitions?: Square.CustomAttributeDefinition[]; + /** + * The cursor to provide in your next call to this endpoint to retrieve the next page of + * results for your original request. This field is present only if the request succeeded and + * additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListBookingCustomAttributesResponse.ts b/src/api/types/ListBookingCustomAttributesResponse.ts new file mode 100644 index 000000000..ce84c0459 --- /dev/null +++ b/src/api/types/ListBookingCustomAttributesResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListBookingCustomAttributes](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributes) response. + * Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional + * results are available, the `cursor` field is also present along with `custom_attributes`. + */ +export interface ListBookingCustomAttributesResponse { + /** + * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field of each custom attribute. + * + * If no custom attributes are found, Square returns an empty object (`{}`). + */ + customAttributes?: Square.CustomAttribute[]; + /** + * The cursor to use in your next call to this endpoint to retrieve the next page of results + * for your original request. This field is present only if the request succeeded and additional + * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListBookingsResponse.ts b/src/api/types/ListBookingsResponse.ts new file mode 100644 index 000000000..e6ec3d16d --- /dev/null +++ b/src/api/types/ListBookingsResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListBookingsResponse { + /** The list of targeted bookings. */ + bookings?: Square.Booking[]; + /** The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. */ + cursor?: string; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListBreakTypesResponse.ts b/src/api/types/ListBreakTypesResponse.ts new file mode 100644 index 000000000..130fe20ea --- /dev/null +++ b/src/api/types/ListBreakTypesResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request for a set of `BreakType` objects. The response contains + * the requested `BreakType` objects and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface ListBreakTypesResponse { + /** A page of `BreakType` results. */ + breakTypes?: Square.BreakType[]; + /** + * The value supplied in the subsequent request to fetch the next page + * of `BreakType` results. + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListCardsResponse.ts b/src/api/types/ListCardsResponse.ts new file mode 100644 index 000000000..1d62d8cec --- /dev/null +++ b/src/api/types/ListCardsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [ListCards](api-endpoint:Cards-ListCards) endpoint. + * + * Note: if there are errors processing the request, the card field will not be + * present. + */ +export interface ListCardsResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested list of `Card`s. */ + cards?: Square.Card[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, + * this is the final response. + * + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string; +} diff --git a/src/api/types/ListCashDrawerShiftEventsResponse.ts b/src/api/types/ListCashDrawerShiftEventsResponse.ts new file mode 100644 index 000000000..3383ab7a6 --- /dev/null +++ b/src/api/types/ListCashDrawerShiftEventsResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListCashDrawerShiftEventsResponse { + /** + * Opaque cursor for fetching the next page. Cursor is not present in + * the last page of results. + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * All of the events (payments, refunds, etc.) for a cash drawer during + * the shift. + */ + cashDrawerShiftEvents?: Square.CashDrawerShiftEvent[]; +} diff --git a/src/api/types/ListCashDrawerShiftsResponse.ts b/src/api/types/ListCashDrawerShiftsResponse.ts new file mode 100644 index 000000000..3e0d2e263 --- /dev/null +++ b/src/api/types/ListCashDrawerShiftsResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListCashDrawerShiftsResponse { + /** + * Opaque cursor for fetching the next page of results. Cursor is not + * present in the last page of results. + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * A collection of CashDrawerShiftSummary objects for shifts that match + * the query. + */ + cashDrawerShifts?: Square.CashDrawerShiftSummary[]; +} diff --git a/src/api/types/ListCatalogResponse.ts b/src/api/types/ListCatalogResponse.ts new file mode 100644 index 000000000..b1b84b52d --- /dev/null +++ b/src/api/types/ListCatalogResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListCatalogResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The pagination cursor to be used in a subsequent request. If unset, this is the final response. + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string; + /** The CatalogObjects returned. */ + objects?: Square.CatalogObject[]; +} diff --git a/src/api/types/ListCustomerCustomAttributeDefinitionsResponse.ts b/src/api/types/ListCustomerCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..4f19c1fb0 --- /dev/null +++ b/src/api/types/ListCustomerCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListCustomerCustomAttributeDefinitions](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributeDefinitions) response. + * Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. + * If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + */ +export interface ListCustomerCustomAttributeDefinitionsResponse { + /** + * The retrieved custom attribute definitions. If no custom attribute definitions are found, + * Square returns an empty object (`{}`). + */ + customAttributeDefinitions?: Square.CustomAttributeDefinition[]; + /** + * The cursor to provide in your next call to this endpoint to retrieve the next page of + * results for your original request. This field is present only if the request succeeded and + * additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListCustomerCustomAttributesResponse.ts b/src/api/types/ListCustomerCustomAttributesResponse.ts new file mode 100644 index 000000000..5a657217d --- /dev/null +++ b/src/api/types/ListCustomerCustomAttributesResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributes) response. + * Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional + * results are available, the `cursor` field is also present along with `custom_attributes`. + */ +export interface ListCustomerCustomAttributesResponse { + /** + * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field of each custom attribute. + * + * If no custom attributes are found, Square returns an empty object (`{}`). + */ + customAttributes?: Square.CustomAttribute[]; + /** + * The cursor to use in your next call to this endpoint to retrieve the next page of results + * for your original request. This field is present only if the request succeeded and additional + * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListCustomerGroupsResponse.ts b/src/api/types/ListCustomerGroupsResponse.ts new file mode 100644 index 000000000..ac41c182a --- /dev/null +++ b/src/api/types/ListCustomerGroupsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [ListCustomerGroups](api-endpoint:CustomerGroups-ListCustomerGroups) endpoint. + * + * Either `errors` or `groups` is present in a given response (never both). + */ +export interface ListCustomerGroupsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** A list of customer groups belonging to the current seller. */ + groups?: Square.CustomerGroup[]; + /** + * A pagination cursor to retrieve the next set of results for your + * original query to the endpoint. This value is present only if the request + * succeeded and additional results are available. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListCustomerSegmentsResponse.ts b/src/api/types/ListCustomerSegmentsResponse.ts new file mode 100644 index 000000000..883cea16d --- /dev/null +++ b/src/api/types/ListCustomerSegmentsResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint. + * + * Either `errors` or `segments` is present in a given response (never both). + */ +export interface ListCustomerSegmentsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The list of customer segments belonging to the associated Square account. */ + segments?: Square.CustomerSegment[]; + /** + * A pagination cursor to be used in subsequent calls to `ListCustomerSegments` + * to retrieve the next set of query results. The cursor is only present if the request succeeded and + * additional results are available. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListCustomersResponse.ts b/src/api/types/ListCustomersResponse.ts new file mode 100644 index 000000000..bfb19bc90 --- /dev/null +++ b/src/api/types/ListCustomersResponse.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `ListCustomers` endpoint. + * + * Either `errors` or `customers` is present in a given response (never both). + */ +export interface ListCustomersResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The customer profiles associated with the Square account or an empty object (`{}`) if none are found. + * Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or + * `phone_number`) are included in the response. + */ + customers?: Square.Customer[]; + /** + * A pagination cursor to retrieve the next set of results for the + * original query. A cursor is only present if the request succeeded and additional results + * are available. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** + * The total count of customers associated with the Square account. Only customer profiles with public information + * (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is present + * only if `count` is set to `true` in the request. + */ + count?: bigint; +} diff --git a/src/api/types/ListDeviceCodesResponse.ts b/src/api/types/ListDeviceCodesResponse.ts new file mode 100644 index 000000000..5929459ee --- /dev/null +++ b/src/api/types/ListDeviceCodesResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListDeviceCodesResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The queried DeviceCode. */ + deviceCodes?: Square.DeviceCode[]; + /** + * A pagination cursor to retrieve the next set of results for your + * original query to the endpoint. This value is present only if the request + * succeeded and additional results are available. + * + * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + */ + cursor?: string; +} diff --git a/src/api/types/ListDevicesResponse.ts b/src/api/types/ListDevicesResponse.ts new file mode 100644 index 000000000..d4bb92d53 --- /dev/null +++ b/src/api/types/ListDevicesResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListDevicesResponse { + /** Information about errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The requested list of `Device` objects. */ + devices?: Square.Device[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, + * this is the final response. + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string; +} diff --git a/src/api/types/ListDisputeEvidenceResponse.ts b/src/api/types/ListDisputeEvidenceResponse.ts new file mode 100644 index 000000000..5f54466da --- /dev/null +++ b/src/api/types/ListDisputeEvidenceResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields in a `ListDisputeEvidence` response. + */ +export interface ListDisputeEvidenceResponse { + /** The list of evidence previously uploaded to the specified dispute. */ + evidence?: Square.DisputeEvidence[]; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** + * The pagination cursor to be used in a subsequent request. + * If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListDisputesResponse.ts b/src/api/types/ListDisputesResponse.ts new file mode 100644 index 000000000..e5375c429 --- /dev/null +++ b/src/api/types/ListDisputesResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines fields in a `ListDisputes` response. + */ +export interface ListDisputesResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The list of disputes. */ + disputes?: Square.Dispute[]; + /** + * The pagination cursor to be used in a subsequent request. + * If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListEmployeeWagesResponse.ts b/src/api/types/ListEmployeeWagesResponse.ts new file mode 100644 index 000000000..942884239 --- /dev/null +++ b/src/api/types/ListEmployeeWagesResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request for a set of `EmployeeWage` objects. The response contains + * a set of `EmployeeWage` objects. + */ +export interface ListEmployeeWagesResponse { + /** A page of `EmployeeWage` results. */ + employeeWages?: Square.EmployeeWage[]; + /** + * The value supplied in the subsequent request to fetch the next page + * of `EmployeeWage` results. + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListEmployeesResponse.ts b/src/api/types/ListEmployeesResponse.ts new file mode 100644 index 000000000..cc7e8a11e --- /dev/null +++ b/src/api/types/ListEmployeesResponse.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListEmployeesResponse { + employees?: Square.Employee[]; + /** The token to be used to retrieve the next page of results. */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListEventTypesResponse.ts b/src/api/types/ListEventTypesResponse.ts new file mode 100644 index 000000000..109d6e21e --- /dev/null +++ b/src/api/types/ListEventTypesResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [ListEventTypes](api-endpoint:Events-ListEventTypes) endpoint. + * + * Note: if there are errors processing the request, the event types field will not be + * present. + */ +export interface ListEventTypesResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The list of event types. */ + eventTypes?: string[]; + /** Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). */ + metadata?: Square.EventTypeMetadata[]; +} diff --git a/src/api/types/ListGiftCardActivitiesResponse.ts b/src/api/types/ListGiftCardActivitiesResponse.ts new file mode 100644 index 000000000..34fc283b3 --- /dev/null +++ b/src/api/types/ListGiftCardActivitiesResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors, + * the response contains a set of `Error` objects. + */ +export interface ListGiftCardActivitiesResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The requested gift card activities or an empty object if none are found. */ + giftCardActivities?: Square.GiftCardActivity[]; + /** + * When a response is truncated, it includes a cursor that you can use in a + * subsequent request to retrieve the next set of activities. If a cursor is not present, this is + * the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListGiftCardsResponse.ts b/src/api/types/ListGiftCardsResponse.ts new file mode 100644 index 000000000..1b13da7bc --- /dev/null +++ b/src/api/types/ListGiftCardsResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains a list of `GiftCard` objects. If the request resulted in errors, + * the response contains a set of `Error` objects. + */ +export interface ListGiftCardsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The requested gift cards or an empty object if none are found. */ + giftCards?: Square.GiftCard[]; + /** + * When a response is truncated, it includes a cursor that you can use in a + * subsequent request to retrieve the next set of gift cards. If a cursor is not present, this is + * the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListInvoicesResponse.ts b/src/api/types/ListInvoicesResponse.ts new file mode 100644 index 000000000..6e45726bf --- /dev/null +++ b/src/api/types/ListInvoicesResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes a `ListInvoice` response. + */ +export interface ListInvoicesResponse { + /** The invoices retrieved. */ + invoices?: Square.Invoice[]; + /** + * When a response is truncated, it includes a cursor that you can use in a + * subsequent request to retrieve the next set of invoices. If empty, this is the final + * response. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListJobsResponse.ts b/src/api/types/ListJobsResponse.ts new file mode 100644 index 000000000..5322bc98a --- /dev/null +++ b/src/api/types/ListJobsResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListJobs](api-endpoint:Team-ListJobs) response. Either `jobs` or `errors` + * is present in the response. If additional results are available, the `cursor` field is also present. + */ +export interface ListJobsResponse { + /** The retrieved jobs. A single paged response contains up to 100 jobs. */ + jobs?: Square.Job[]; + /** + * An opaque cursor used to retrieve the next page of results. This field is present only + * if the request succeeded and additional results are available. For more information, see + * [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListLocationBookingProfilesResponse.ts b/src/api/types/ListLocationBookingProfilesResponse.ts new file mode 100644 index 000000000..b5f346193 --- /dev/null +++ b/src/api/types/ListLocationBookingProfilesResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListLocationBookingProfilesResponse { + /** The list of a seller's location booking profiles. */ + locationBookingProfiles?: Square.LocationBookingProfile[]; + /** The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. */ + cursor?: string; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListLocationCustomAttributeDefinitionsResponse.ts b/src/api/types/ListLocationCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..26b6776aa --- /dev/null +++ b/src/api/types/ListLocationCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListLocationCustomAttributeDefinitions](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributeDefinitions) response. + * Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. + * If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + */ +export interface ListLocationCustomAttributeDefinitionsResponse { + /** + * The retrieved custom attribute definitions. If no custom attribute definitions are found, + * Square returns an empty object (`{}`). + */ + customAttributeDefinitions?: Square.CustomAttributeDefinition[]; + /** + * The cursor to provide in your next call to this endpoint to retrieve the next page of + * results for your original request. This field is present only if the request succeeded and + * additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListLocationCustomAttributesResponse.ts b/src/api/types/ListLocationCustomAttributesResponse.ts new file mode 100644 index 000000000..c5ddf2867 --- /dev/null +++ b/src/api/types/ListLocationCustomAttributesResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListLocationCustomAttributes](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributes) response. + * Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional + * results are available, the `cursor` field is also present along with `custom_attributes`. + */ +export interface ListLocationCustomAttributesResponse { + /** + * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field of each custom attribute. + * If no custom attributes are found, Square returns an empty object (`{}`). + */ + customAttributes?: Square.CustomAttribute[]; + /** + * The cursor to use in your next call to this endpoint to retrieve the next page of results + * for your original request. This field is present only if the request succeeded and additional + * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListLocationsResponse.ts b/src/api/types/ListLocationsResponse.ts new file mode 100644 index 000000000..b03599ce5 --- /dev/null +++ b/src/api/types/ListLocationsResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of a request + * to the [ListLocations](api-endpoint:Locations-ListLocations) endpoint. + * + * Either `errors` or `locations` is present in a given response (never both). + */ +export interface ListLocationsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The business locations. */ + locations?: Square.Location[]; +} diff --git a/src/api/types/ListLoyaltyProgramsResponse.ts b/src/api/types/ListLoyaltyProgramsResponse.ts new file mode 100644 index 000000000..8ff095768 --- /dev/null +++ b/src/api/types/ListLoyaltyProgramsResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains all loyalty programs. + */ +export interface ListLoyaltyProgramsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** A list of `LoyaltyProgram` for the merchant. */ + programs?: Square.LoyaltyProgram[]; +} diff --git a/src/api/types/ListLoyaltyPromotionsResponse.ts b/src/api/types/ListLoyaltyPromotionsResponse.ts new file mode 100644 index 000000000..500c81c9a --- /dev/null +++ b/src/api/types/ListLoyaltyPromotionsResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) response. + * One of `loyalty_promotions`, an empty object, or `errors` is present in the response. + * If additional results are available, the `cursor` field is also present along with `loyalty_promotions`. + */ +export interface ListLoyaltyPromotionsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The retrieved loyalty promotions. */ + loyaltyPromotions?: Square.LoyaltyPromotion[]; + /** + * The cursor to use in your next call to this endpoint to retrieve the next page of results + * for your original request. This field is present only if the request succeeded and additional + * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListMerchantCustomAttributeDefinitionsResponse.ts b/src/api/types/ListMerchantCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..bc8d167d1 --- /dev/null +++ b/src/api/types/ListMerchantCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListMerchantCustomAttributeDefinitions](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributeDefinitions) response. + * Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. + * If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + */ +export interface ListMerchantCustomAttributeDefinitionsResponse { + /** + * The retrieved custom attribute definitions. If no custom attribute definitions are found, + * Square returns an empty object (`{}`). + */ + customAttributeDefinitions?: Square.CustomAttributeDefinition[]; + /** + * The cursor to provide in your next call to this endpoint to retrieve the next page of + * results for your original request. This field is present only if the request succeeded and + * additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListMerchantCustomAttributesResponse.ts b/src/api/types/ListMerchantCustomAttributesResponse.ts new file mode 100644 index 000000000..06bd4e2f1 --- /dev/null +++ b/src/api/types/ListMerchantCustomAttributesResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [ListMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributes) response. + * Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional + * results are available, the `cursor` field is also present along with `custom_attributes`. + */ +export interface ListMerchantCustomAttributesResponse { + /** + * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field of each custom attribute. + * If no custom attributes are found, Square returns an empty object (`{}`). + */ + customAttributes?: Square.CustomAttribute[]; + /** + * The cursor to use in your next call to this endpoint to retrieve the next page of results + * for your original request. This field is present only if the request succeeded and additional + * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListMerchantsResponse.ts b/src/api/types/ListMerchantsResponse.ts new file mode 100644 index 000000000..c90dae379 --- /dev/null +++ b/src/api/types/ListMerchantsResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response object returned by the [ListMerchant](api-endpoint:Merchants-ListMerchants) endpoint. + */ +export interface ListMerchantsResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested `Merchant` entities. */ + merchant?: Square.Merchant[]; + /** If the response is truncated, the cursor to use in next request to fetch next set of objects. */ + cursor?: number; +} diff --git a/src/api/types/ListOrderCustomAttributeDefinitionsResponse.ts b/src/api/types/ListOrderCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..8acfd8fcb --- /dev/null +++ b/src/api/types/ListOrderCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from listing order custom attribute definitions. + */ +export interface ListOrderCustomAttributeDefinitionsResponse { + /** The retrieved custom attribute definitions. If no custom attribute definitions are found, Square returns an empty object (`{}`). */ + customAttributeDefinitions: Square.CustomAttributeDefinition[]; + /** + * The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request. + * This field is present only if the request succeeded and additional results are available. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListOrderCustomAttributesResponse.ts b/src/api/types/ListOrderCustomAttributesResponse.ts new file mode 100644 index 000000000..73595ad53 --- /dev/null +++ b/src/api/types/ListOrderCustomAttributesResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from listing order custom attributes. + */ +export interface ListOrderCustomAttributesResponse { + /** The retrieved custom attributes. If no custom attribute are found, Square returns an empty object (`{}`). */ + customAttributes?: Square.CustomAttribute[]; + /** + * The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request. + * This field is present only if the request succeeded and additional results are available. + * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListPaymentLinksResponse.ts b/src/api/types/ListPaymentLinksResponse.ts new file mode 100644 index 000000000..b380ee63e --- /dev/null +++ b/src/api/types/ListPaymentLinksResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListPaymentLinksResponse { + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The list of payment links. */ + paymentLinks?: Square.PaymentLink[]; + /** + * When a response is truncated, it includes a cursor that you can use in a subsequent request + * to retrieve the next set of gift cards. If a cursor is not present, this is the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListPaymentRefundsResponse.ts b/src/api/types/ListPaymentRefundsResponse.ts new file mode 100644 index 000000000..a2f5aa8e1 --- /dev/null +++ b/src/api/types/ListPaymentRefundsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by [ListPaymentRefunds](api-endpoint:Refunds-ListPaymentRefunds). + * + * Either `errors` or `refunds` is present in a given response (never both). + */ +export interface ListPaymentRefundsResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The list of requested refunds. */ + refunds?: Square.PaymentRefund[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, + * this is the final response. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListPaymentsResponse.ts b/src/api/types/ListPaymentsResponse.ts new file mode 100644 index 000000000..65cb703a0 --- /dev/null +++ b/src/api/types/ListPaymentsResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by [ListPayments](api-endpoint:Payments-ListPayments). + */ +export interface ListPaymentsResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested list of payments. */ + payments?: Square.Payment[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, + * this is the final response. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListPayoutEntriesResponse.ts b/src/api/types/ListPayoutEntriesResponse.ts new file mode 100644 index 000000000..fad7d4893 --- /dev/null +++ b/src/api/types/ListPayoutEntriesResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to retrieve payout records entries. + */ +export interface ListPayoutEntriesResponse { + /** The requested list of payout entries, ordered with the given or default sort order. */ + payoutEntries?: Square.PayoutEntry[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, this is the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListPayoutsResponse.ts b/src/api/types/ListPayoutsResponse.ts new file mode 100644 index 000000000..6a76b4579 --- /dev/null +++ b/src/api/types/ListPayoutsResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to retrieve payout records entries. + */ +export interface ListPayoutsResponse { + /** The requested list of payouts. */ + payouts?: Square.Payout[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, this is the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListSitesResponse.ts b/src/api/types/ListSitesResponse.ts new file mode 100644 index 000000000..5a329a381 --- /dev/null +++ b/src/api/types/ListSitesResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a `ListSites` response. The response can include either `sites` or `errors`. + */ +export interface ListSitesResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The sites that belong to the seller. */ + sites?: Square.Site[]; +} diff --git a/src/api/types/ListSubscriptionEventsResponse.ts b/src/api/types/ListSubscriptionEventsResponse.ts new file mode 100644 index 000000000..2b2f1e37d --- /dev/null +++ b/src/api/types/ListSubscriptionEventsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response from the + * [ListSubscriptionEvents](api-endpoint:Subscriptions-ListSubscriptionEvents). + */ +export interface ListSubscriptionEventsResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The retrieved subscription events. */ + subscriptionEvents?: Square.SubscriptionEvent[]; + /** + * 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). + */ + cursor?: string; +} diff --git a/src/api/types/ListTeamMemberBookingProfilesResponse.ts b/src/api/types/ListTeamMemberBookingProfilesResponse.ts new file mode 100644 index 000000000..01db09ff2 --- /dev/null +++ b/src/api/types/ListTeamMemberBookingProfilesResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ListTeamMemberBookingProfilesResponse { + /** + * The list of team member booking profiles. The results are returned in the ascending order of the time + * when the team member booking profiles were last updated. Multiple booking profiles updated at the same time + * are further sorted in the ascending order of their IDs. + */ + teamMemberBookingProfiles?: Square.TeamMemberBookingProfile[]; + /** The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. */ + cursor?: string; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListTeamMemberWagesResponse.ts b/src/api/types/ListTeamMemberWagesResponse.ts new file mode 100644 index 000000000..363e6aea4 --- /dev/null +++ b/src/api/types/ListTeamMemberWagesResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request for a set of `TeamMemberWage` objects. The response contains + * a set of `TeamMemberWage` objects. + */ +export interface ListTeamMemberWagesResponse { + /** A page of `TeamMemberWage` results. */ + teamMemberWages?: Square.TeamMemberWage[]; + /** + * The value supplied in the subsequent request to fetch the next page + * of `TeamMemberWage` results. + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ListTransactionsResponse.ts b/src/api/types/ListTransactionsResponse.ts new file mode 100644 index 000000000..515c68cd5 --- /dev/null +++ b/src/api/types/ListTransactionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. + * + * One of `errors` or `transactions` is present in a given response (never both). + */ +export interface ListTransactionsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** An array of transactions that match your query. */ + transactions?: Square.Transaction[]; + /** + * A pagination cursor for retrieving the next set of results, + * if any remain. Provide this value as the `cursor` parameter in a subsequent + * request to this endpoint. + * + * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. + */ + cursor?: string; +} diff --git a/src/api/types/ListWebhookEventTypesResponse.ts b/src/api/types/ListWebhookEventTypesResponse.ts new file mode 100644 index 000000000..8f365f9df --- /dev/null +++ b/src/api/types/ListWebhookEventTypesResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [ListWebhookEventTypes](api-endpoint:WebhookSubscriptions-ListWebhookEventTypes) endpoint. + * + * Note: if there are errors processing the request, the event types field will not be + * present. + */ +export interface ListWebhookEventTypesResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The list of event types. */ + eventTypes?: string[]; + /** Contains the metadata of a webhook event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). */ + metadata?: Square.EventTypeMetadata[]; +} diff --git a/src/api/types/ListWebhookSubscriptionsResponse.ts b/src/api/types/ListWebhookSubscriptionsResponse.ts new file mode 100644 index 000000000..968cd9a68 --- /dev/null +++ b/src/api/types/ListWebhookSubscriptionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [ListWebhookSubscriptions](api-endpoint:WebhookSubscriptions-ListWebhookSubscriptions) endpoint. + * + * Note: if there are errors processing the request, the subscriptions field will not be + * present. + */ +export interface ListWebhookSubscriptionsResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested list of [Subscription](entity:WebhookSubscription)s. */ + subscriptions?: Square.WebhookSubscription[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, + * this is the final response. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/ListWorkweekConfigsResponse.ts b/src/api/types/ListWorkweekConfigsResponse.ts new file mode 100644 index 000000000..e24e7e639 --- /dev/null +++ b/src/api/types/ListWorkweekConfigsResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request for a set of `WorkweekConfig` objects. The response contains + * the requested `WorkweekConfig` objects and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface ListWorkweekConfigsResponse { + /** A page of `WorkweekConfig` results. */ + workweekConfigs?: Square.WorkweekConfig[]; + /** + * The value supplied in the subsequent request to fetch the next page of + * `WorkweekConfig` results. + */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/Location.ts b/src/api/types/Location.ts new file mode 100644 index 000000000..070551111 --- /dev/null +++ b/src/api/types/Location.ts @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). + */ +export interface Location { + /** A short generated string of letters and numbers that uniquely identifies this location instance. */ + id?: string; + /** + * The name of the location. + * This information appears in the Seller Dashboard as the nickname. + * A location name must be unique within a seller account. + */ + name?: string | null; + /** The physical address of the location. */ + address?: Square.Address; + /** + * The [IANA time zone](https://www.iana.org/time-zones) identifier for + * the time zone of the location. For example, `America/Los_Angeles`. + */ + timezone?: string | null; + /** + * The Square features that are enabled for the location. + * See [LocationCapability](entity:LocationCapability) for possible values. + * See [LocationCapability](#type-locationcapability) for possible values + */ + capabilities?: Square.LocationCapability[]; + /** + * The status of the location. + * See [LocationStatus](#type-locationstatus) for possible values + */ + status?: Square.LocationStatus; + /** + * The time when the location was created, in RFC 3339 format. + * For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). + */ + createdAt?: string; + /** The ID of the merchant that owns the location. */ + merchantId?: string; + /** + * The country of the location, in the two-letter format of ISO 3166. For example, `US` or `JP`. + * + * See [Country](entity:Country) for possible values. + * See [Country](#type-country) for possible values + */ + country?: Square.Country; + /** + * The language associated with the location, in + * [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). + * For more information, see [Language Preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences). + */ + languageCode?: string | null; + /** + * The currency used for all transactions at this location, + * in ISO 4217 format. For example, the currency code for US dollars is `USD`. + * See [Currency](entity:Currency) for possible values. + * See [Currency](#type-currency) for possible values + */ + currency?: Square.Currency; + /** The phone number of the location. For example, `+1 855-700-6000`. */ + phoneNumber?: string | null; + /** The name of the location's overall business. This name is present on receipts and other customer-facing branding, and can be changed no more than three times in a twelve-month period. */ + businessName?: string | null; + /** + * The type of the location. + * See [LocationType](#type-locationtype) for possible values + */ + type?: Square.LocationType; + /** The website URL of the location. For example, `https://squareup.com`. */ + websiteUrl?: string | null; + /** The hours of operation for the location. */ + businessHours?: Square.BusinessHours; + /** The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator. */ + businessEmail?: string | null; + /** The description of the location. For example, `Main Street location`. */ + description?: string | null; + /** The Twitter username of the location without the '@' symbol. For example, `Square`. */ + twitterUsername?: string | null; + /** The Instagram username of the location without the '@' symbol. For example, `square`. */ + instagramUsername?: string | null; + /** The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`. */ + facebookUrl?: string | null; + /** The physical coordinates (latitude and longitude) of the location. */ + coordinates?: Square.Coordinates; + /** + * The URL of the logo image for the location. When configured in the Seller + * Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller. + * This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels. + */ + logoUrl?: string; + /** The URL of the Point of Sale background image for the location. */ + posBackgroundUrl?: string; + /** + * A four-digit number that describes the kind of goods or services sold at the location. + * The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245. + * For example, `5045`, for a location that sells computer goods and software. + */ + mcc?: string | null; + /** + * The URL of a full-format logo image for the location. When configured in the Seller + * Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller. + * This image can be wider than it is tall and should be at least 1280x648 pixels. + */ + fullFormatLogoUrl?: string; + /** The tax IDs for this location. */ + taxIds?: Square.TaxIds; +} diff --git a/src/api/types/LocationBookingProfile.ts b/src/api/types/LocationBookingProfile.ts new file mode 100644 index 000000000..c75b777aa --- /dev/null +++ b/src/api/types/LocationBookingProfile.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. + */ +export interface LocationBookingProfile { + /** The ID of the [location](entity:Location). */ + locationId?: string | null; + /** Url for the online booking site for this location. */ + bookingSiteUrl?: string | null; + /** Indicates whether the location is enabled for online booking. */ + onlineBookingEnabled?: boolean | null; +} diff --git a/src/api/types/LocationCapability.ts b/src/api/types/LocationCapability.ts new file mode 100644 index 000000000..93dc952ea --- /dev/null +++ b/src/api/types/LocationCapability.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The capabilities a location might have. + */ +export type LocationCapability = "CREDIT_CARD_PROCESSING" | "AUTOMATIC_TRANSFERS" | "UNLINKED_REFUNDS"; +export const LocationCapability = { + CreditCardProcessing: "CREDIT_CARD_PROCESSING", + AutomaticTransfers: "AUTOMATIC_TRANSFERS", + UnlinkedRefunds: "UNLINKED_REFUNDS", +} as const; diff --git a/src/api/types/LocationStatus.ts b/src/api/types/LocationStatus.ts new file mode 100644 index 000000000..b9cb3d638 --- /dev/null +++ b/src/api/types/LocationStatus.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A location's status. + */ +export type LocationStatus = "ACTIVE" | "INACTIVE"; +export const LocationStatus = { + Active: "ACTIVE", + Inactive: "INACTIVE", +} as const; diff --git a/src/api/types/LocationType.ts b/src/api/types/LocationType.ts new file mode 100644 index 000000000..f9021c395 --- /dev/null +++ b/src/api/types/LocationType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A location's type. + */ +export type LocationType = "PHYSICAL" | "MOBILE"; +export const LocationType = { + Physical: "PHYSICAL", + Mobile: "MOBILE", +} as const; diff --git a/src/api/types/LoyaltyAccount.ts b/src/api/types/LoyaltyAccount.ts new file mode 100644 index 000000000..0f8dd4738 --- /dev/null +++ b/src/api/types/LoyaltyAccount.ts @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes a loyalty account in a [loyalty program](entity:LoyaltyProgram). For more information, see + * [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). + */ +export interface LoyaltyAccount { + /** The Square-assigned ID of the loyalty account. */ + id?: string; + /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram) to which the account belongs. */ + programId: string; + /** + * The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field. + * + * Your application should be able to handle loyalty accounts that have a negative point balance (`balance` is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange. + */ + balance?: number; + /** The total points accrued during the lifetime of the account. */ + lifetimePoints?: number; + /** The Square-assigned ID of the [customer](entity:Customer) that is associated with the account. */ + customerId?: string | null; + /** + * The timestamp when the buyer joined the loyalty program, in RFC 3339 format. This field is used to display the **Enrolled On** or **Member Since** date in first-party Square products. + * + * If this field is not set in a `CreateLoyaltyAccount` request, Square populates it after the buyer's first action on their account + * (when `AccumulateLoyaltyPoints` or `CreateLoyaltyReward` is called). In first-party flows, Square populates the field when the buyer agrees to the terms of service in Square Point of Sale. + * + * This field is typically specified in a `CreateLoyaltyAccount` request when creating a loyalty account for a buyer who already interacted with their account. + * For example, you would set this field when migrating accounts from an external system. The timestamp in the request can represent a current or previous date and time, but it cannot be set for the future. + */ + enrolledAt?: string | null; + /** The timestamp when the loyalty account was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the loyalty account was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** + * The mapping that associates the loyalty account with a buyer. Currently, + * a loyalty account can only be mapped to a buyer by phone number. + * + * To create a loyalty account, you must specify the `mapping` field, with the buyer's phone number + * in the `phone_number` field. + */ + mapping?: Square.LoyaltyAccountMapping; + /** + * The schedule for when points expire in the loyalty account balance. This field is present only if the account has points that are scheduled to expire. + * + * The total number of points in this field equals the number of points in the `balance` field. + */ + expiringPointDeadlines?: Square.LoyaltyAccountExpiringPointDeadline[] | null; +} diff --git a/src/api/types/LoyaltyAccountExpiringPointDeadline.ts b/src/api/types/LoyaltyAccountExpiringPointDeadline.ts new file mode 100644 index 000000000..778b340b3 --- /dev/null +++ b/src/api/types/LoyaltyAccountExpiringPointDeadline.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a set of points for a loyalty account that are scheduled to expire on a specific date. + */ +export interface LoyaltyAccountExpiringPointDeadline { + /** The number of points scheduled to expire at the `expires_at` timestamp. */ + points: number; + /** The timestamp of when the points are scheduled to expire, in RFC 3339 format. */ + expiresAt: string; +} diff --git a/src/api/types/LoyaltyAccountMapping.ts b/src/api/types/LoyaltyAccountMapping.ts new file mode 100644 index 000000000..59d14a0b3 --- /dev/null +++ b/src/api/types/LoyaltyAccountMapping.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the mapping that associates a loyalty account with a buyer. + * + * Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see + * [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview). + */ +export interface LoyaltyAccountMapping { + /** The Square-assigned ID of the mapping. */ + id?: string; + /** The timestamp when the mapping was created, in RFC 3339 format. */ + createdAt?: string; + /** The phone number of the buyer, in E.164 format. For example, "+14155551111". */ + phoneNumber?: string | null; +} diff --git a/src/api/types/LoyaltyEvent.ts b/src/api/types/LoyaltyEvent.ts new file mode 100644 index 000000000..3d9b316ac --- /dev/null +++ b/src/api/types/LoyaltyEvent.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Provides information about a loyalty event. + * For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). + */ +export interface LoyaltyEvent { + /** The Square-assigned ID of the loyalty event. */ + id: string; + /** + * The type of the loyalty event. + * See [LoyaltyEventType](#type-loyaltyeventtype) for possible values + */ + type: Square.LoyaltyEventType; + /** The timestamp when the event was created, in RFC 3339 format. */ + createdAt: string; + /** Provides metadata when the event `type` is `ACCUMULATE_POINTS`. */ + accumulatePoints?: Square.LoyaltyEventAccumulatePoints; + /** Provides metadata when the event `type` is `CREATE_REWARD`. */ + createReward?: Square.LoyaltyEventCreateReward; + /** Provides metadata when the event `type` is `REDEEM_REWARD`. */ + redeemReward?: Square.LoyaltyEventRedeemReward; + /** Provides metadata when the event `type` is `DELETE_REWARD`. */ + deleteReward?: Square.LoyaltyEventDeleteReward; + /** Provides metadata when the event `type` is `ADJUST_POINTS`. */ + adjustPoints?: Square.LoyaltyEventAdjustPoints; + /** The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event. */ + loyaltyAccountId: string; + /** The ID of the [location](entity:Location) where the event occurred. */ + locationId?: string; + /** + * Defines whether the event was generated by the Square Point of Sale. + * See [LoyaltyEventSource](#type-loyaltyeventsource) for possible values + */ + source: Square.LoyaltyEventSource; + /** Provides metadata when the event `type` is `EXPIRE_POINTS`. */ + expirePoints?: Square.LoyaltyEventExpirePoints; + /** Provides metadata when the event `type` is `OTHER`. */ + otherEvent?: Square.LoyaltyEventOther; + /** Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. */ + accumulatePromotionPoints?: Square.LoyaltyEventAccumulatePromotionPoints; +} diff --git a/src/api/types/LoyaltyEventAccumulatePoints.ts b/src/api/types/LoyaltyEventAccumulatePoints.ts new file mode 100644 index 000000000..11a26a152 --- /dev/null +++ b/src/api/types/LoyaltyEventAccumulatePoints.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Provides metadata when the event `type` is `ACCUMULATE_POINTS`. + */ +export interface LoyaltyEventAccumulatePoints { + /** The ID of the [loyalty program](entity:LoyaltyProgram). */ + loyaltyProgramId?: string; + /** The number of points accumulated by the event. */ + points?: number | null; + /** + * The ID of the [order](entity:Order) for which the buyer accumulated the points. + * This field is returned only if the Orders API is used to process orders. + */ + orderId?: string | null; +} diff --git a/src/api/types/LoyaltyEventAccumulatePromotionPoints.ts b/src/api/types/LoyaltyEventAccumulatePromotionPoints.ts new file mode 100644 index 000000000..34a9eef53 --- /dev/null +++ b/src/api/types/LoyaltyEventAccumulatePromotionPoints.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. + */ +export interface LoyaltyEventAccumulatePromotionPoints { + /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ + loyaltyProgramId?: string; + /** The Square-assigned ID of the [loyalty promotion](entity:LoyaltyPromotion). */ + loyaltyPromotionId?: string; + /** The number of points earned by the event. */ + points: number; + /** + * The ID of the [order](entity:Order) for which the buyer earned the promotion points. + * Only applications that use the Orders API to process orders can trigger this event. + */ + orderId: string; +} diff --git a/src/api/types/LoyaltyEventAdjustPoints.ts b/src/api/types/LoyaltyEventAdjustPoints.ts new file mode 100644 index 000000000..92ea5fca2 --- /dev/null +++ b/src/api/types/LoyaltyEventAdjustPoints.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Provides metadata when the event `type` is `ADJUST_POINTS`. + */ +export interface LoyaltyEventAdjustPoints { + /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ + loyaltyProgramId?: string; + /** The number of points added or removed. */ + points: number; + /** The reason for the adjustment of points. */ + reason?: string | null; +} diff --git a/src/api/types/LoyaltyEventCreateReward.ts b/src/api/types/LoyaltyEventCreateReward.ts new file mode 100644 index 000000000..52ec1c964 --- /dev/null +++ b/src/api/types/LoyaltyEventCreateReward.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Provides metadata when the event `type` is `CREATE_REWARD`. + */ +export interface LoyaltyEventCreateReward { + /** The ID of the [loyalty program](entity:LoyaltyProgram). */ + loyaltyProgramId: string; + /** + * The Square-assigned ID of the created [loyalty reward](entity:LoyaltyReward). + * This field is returned only if the event source is `LOYALTY_API`. + */ + rewardId?: string; + /** The loyalty points used to create the reward. */ + points: number; +} diff --git a/src/api/types/LoyaltyEventDateTimeFilter.ts b/src/api/types/LoyaltyEventDateTimeFilter.ts new file mode 100644 index 000000000..55bf54033 --- /dev/null +++ b/src/api/types/LoyaltyEventDateTimeFilter.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Filter events by date time range. + */ +export interface LoyaltyEventDateTimeFilter { + /** The `created_at` date time range used to filter the result. */ + createdAt: Square.TimeRange; +} diff --git a/src/api/types/LoyaltyEventDeleteReward.ts b/src/api/types/LoyaltyEventDeleteReward.ts new file mode 100644 index 000000000..c279060b0 --- /dev/null +++ b/src/api/types/LoyaltyEventDeleteReward.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Provides metadata when the event `type` is `DELETE_REWARD`. + */ +export interface LoyaltyEventDeleteReward { + /** The ID of the [loyalty program](entity:LoyaltyProgram). */ + loyaltyProgramId: string; + /** + * The ID of the deleted [loyalty reward](entity:LoyaltyReward). + * This field is returned only if the event source is `LOYALTY_API`. + */ + rewardId?: string; + /** The number of points returned to the loyalty account. */ + points: number; +} diff --git a/src/api/types/LoyaltyEventExpirePoints.ts b/src/api/types/LoyaltyEventExpirePoints.ts new file mode 100644 index 000000000..7f2d316ce --- /dev/null +++ b/src/api/types/LoyaltyEventExpirePoints.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Provides metadata when the event `type` is `EXPIRE_POINTS`. + */ +export interface LoyaltyEventExpirePoints { + /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ + loyaltyProgramId: string; + /** The number of points expired. */ + points: number; +} diff --git a/src/api/types/LoyaltyEventFilter.ts b/src/api/types/LoyaltyEventFilter.ts new file mode 100644 index 000000000..2b0b4788f --- /dev/null +++ b/src/api/types/LoyaltyEventFilter.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The filtering criteria. If the request specifies multiple filters, + * the endpoint uses a logical AND to evaluate them. + */ +export interface LoyaltyEventFilter { + /** Filter events by loyalty account. */ + loyaltyAccountFilter?: Square.LoyaltyEventLoyaltyAccountFilter; + /** Filter events by event type. */ + typeFilter?: Square.LoyaltyEventTypeFilter; + /** + * Filter events by date time range. + * For each range, the start time is inclusive and the end time + * is exclusive. + */ + dateTimeFilter?: Square.LoyaltyEventDateTimeFilter; + /** Filter events by location. */ + locationFilter?: Square.LoyaltyEventLocationFilter; + /** Filter events by the order associated with the event. */ + orderFilter?: Square.LoyaltyEventOrderFilter; +} diff --git a/src/api/types/LoyaltyEventLocationFilter.ts b/src/api/types/LoyaltyEventLocationFilter.ts new file mode 100644 index 000000000..0b3d8fe91 --- /dev/null +++ b/src/api/types/LoyaltyEventLocationFilter.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Filter events by location. + */ +export interface LoyaltyEventLocationFilter { + /** + * The [location](entity:Location) IDs for loyalty events to query. + * If multiple values are specified, the endpoint uses + * a logical OR to combine them. + */ + locationIds: string[]; +} diff --git a/src/api/types/LoyaltyEventLoyaltyAccountFilter.ts b/src/api/types/LoyaltyEventLoyaltyAccountFilter.ts new file mode 100644 index 000000000..a0e04bf97 --- /dev/null +++ b/src/api/types/LoyaltyEventLoyaltyAccountFilter.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Filter events by loyalty account. + */ +export interface LoyaltyEventLoyaltyAccountFilter { + /** The ID of the [loyalty account](entity:LoyaltyAccount) associated with loyalty events. */ + loyaltyAccountId: string; +} diff --git a/src/api/types/LoyaltyEventOrderFilter.ts b/src/api/types/LoyaltyEventOrderFilter.ts new file mode 100644 index 000000000..b051f9fdd --- /dev/null +++ b/src/api/types/LoyaltyEventOrderFilter.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Filter events by the order associated with the event. + */ +export interface LoyaltyEventOrderFilter { + /** The ID of the [order](entity:Order) associated with the event. */ + orderId: string; +} diff --git a/src/api/types/LoyaltyEventOther.ts b/src/api/types/LoyaltyEventOther.ts new file mode 100644 index 000000000..99ac32c99 --- /dev/null +++ b/src/api/types/LoyaltyEventOther.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Provides metadata when the event `type` is `OTHER`. + */ +export interface LoyaltyEventOther { + /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ + loyaltyProgramId: string; + /** The number of points added or removed. */ + points: number; +} diff --git a/src/api/types/LoyaltyEventQuery.ts b/src/api/types/LoyaltyEventQuery.ts new file mode 100644 index 000000000..12a06292f --- /dev/null +++ b/src/api/types/LoyaltyEventQuery.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a query used to search for loyalty events. + */ +export interface LoyaltyEventQuery { + /** The query filter criteria. */ + filter?: Square.LoyaltyEventFilter; +} diff --git a/src/api/types/LoyaltyEventRedeemReward.ts b/src/api/types/LoyaltyEventRedeemReward.ts new file mode 100644 index 000000000..52d63b7d7 --- /dev/null +++ b/src/api/types/LoyaltyEventRedeemReward.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Provides metadata when the event `type` is `REDEEM_REWARD`. + */ +export interface LoyaltyEventRedeemReward { + /** The ID of the [loyalty program](entity:LoyaltyProgram). */ + loyaltyProgramId: string; + /** + * The ID of the redeemed [loyalty reward](entity:LoyaltyReward). + * This field is returned only if the event source is `LOYALTY_API`. + */ + rewardId?: string; + /** + * The ID of the [order](entity:Order) that redeemed the reward. + * This field is returned only if the Orders API is used to process orders. + */ + orderId?: string; +} diff --git a/src/api/types/LoyaltyEventSource.ts b/src/api/types/LoyaltyEventSource.ts new file mode 100644 index 000000000..cdd90ab3a --- /dev/null +++ b/src/api/types/LoyaltyEventSource.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines whether the event was generated by the Square Point of Sale. + */ +export type LoyaltyEventSource = "SQUARE" | "LOYALTY_API"; +export const LoyaltyEventSource = { + Square: "SQUARE", + LoyaltyApi: "LOYALTY_API", +} as const; diff --git a/src/api/types/LoyaltyEventType.ts b/src/api/types/LoyaltyEventType.ts new file mode 100644 index 000000000..3c0232c1f --- /dev/null +++ b/src/api/types/LoyaltyEventType.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of the loyalty event. + */ +export type LoyaltyEventType = + | "ACCUMULATE_POINTS" + | "CREATE_REWARD" + | "REDEEM_REWARD" + | "DELETE_REWARD" + | "ADJUST_POINTS" + | "EXPIRE_POINTS" + | "OTHER" + | "ACCUMULATE_PROMOTION_POINTS"; +export const LoyaltyEventType = { + AccumulatePoints: "ACCUMULATE_POINTS", + CreateReward: "CREATE_REWARD", + RedeemReward: "REDEEM_REWARD", + DeleteReward: "DELETE_REWARD", + AdjustPoints: "ADJUST_POINTS", + ExpirePoints: "EXPIRE_POINTS", + Other: "OTHER", + AccumulatePromotionPoints: "ACCUMULATE_PROMOTION_POINTS", +} as const; diff --git a/src/api/types/LoyaltyEventTypeFilter.ts b/src/api/types/LoyaltyEventTypeFilter.ts new file mode 100644 index 000000000..f8308dd64 --- /dev/null +++ b/src/api/types/LoyaltyEventTypeFilter.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Filter events by event type. + */ +export interface LoyaltyEventTypeFilter { + /** + * The loyalty event types used to filter the result. + * If multiple values are specified, the endpoint uses a + * logical OR to combine them. + * See [LoyaltyEventType](#type-loyaltyeventtype) for possible values + */ + types: Square.LoyaltyEventType[]; +} diff --git a/src/api/types/LoyaltyProgram.ts b/src/api/types/LoyaltyProgram.ts new file mode 100644 index 000000000..944dfefb2 --- /dev/null +++ b/src/api/types/LoyaltyProgram.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards. + * Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. + * For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). + */ +export interface LoyaltyProgram { + /** + * The Square-assigned ID of the loyalty program. Updates to + * the loyalty program do not modify the identifier. + */ + id?: string; + /** + * Whether the program is currently active. + * See [LoyaltyProgramStatus](#type-loyaltyprogramstatus) for possible values + */ + status?: Square.LoyaltyProgramStatus; + /** The list of rewards for buyers, sorted by ascending points. */ + rewardTiers?: Square.LoyaltyProgramRewardTier[] | null; + /** If present, details for how points expire. */ + expirationPolicy?: Square.LoyaltyProgramExpirationPolicy; + /** A cosmetic name for the “points” currency. */ + terminology?: Square.LoyaltyProgramTerminology; + /** The [locations](entity:Location) at which the program is active. */ + locationIds?: string[] | null; + /** The timestamp when the program was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the reward was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** + * Defines how buyers can earn loyalty points from the base loyalty program. + * To check for associated [loyalty promotions](entity:LoyaltyPromotion) that enable + * buyers to earn extra points, call [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions). + */ + accrualRules?: Square.LoyaltyProgramAccrualRule[] | null; +} diff --git a/src/api/types/LoyaltyProgramAccrualRule.ts b/src/api/types/LoyaltyProgramAccrualRule.ts new file mode 100644 index 000000000..233cc9068 --- /dev/null +++ b/src/api/types/LoyaltyProgramAccrualRule.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program](entity:LoyaltyProgram). + */ +export interface LoyaltyProgramAccrualRule { + /** + * The type of the accrual rule that defines how buyers can earn points. + * See [LoyaltyProgramAccrualRuleType](#type-loyaltyprogramaccrualruletype) for possible values + */ + accrualType: Square.LoyaltyProgramAccrualRuleType; + /** + * The number of points that + * buyers earn based on the `accrual_type`. + */ + points?: number | null; + /** Additional data for rules with the `VISIT` accrual type. */ + visitData?: Square.LoyaltyProgramAccrualRuleVisitData; + /** Additional data for rules with the `SPEND` accrual type. */ + spendData?: Square.LoyaltyProgramAccrualRuleSpendData; + /** Additional data for rules with the `ITEM_VARIATION` accrual type. */ + itemVariationData?: Square.LoyaltyProgramAccrualRuleItemVariationData; + /** Additional data for rules with the `CATEGORY` accrual type. */ + categoryData?: Square.LoyaltyProgramAccrualRuleCategoryData; +} diff --git a/src/api/types/LoyaltyProgramAccrualRuleCategoryData.ts b/src/api/types/LoyaltyProgramAccrualRuleCategoryData.ts new file mode 100644 index 000000000..4fb4d01da --- /dev/null +++ b/src/api/types/LoyaltyProgramAccrualRuleCategoryData.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents additional data for rules with the `CATEGORY` accrual type. + */ +export interface LoyaltyProgramAccrualRuleCategoryData { + /** + * The ID of the `CATEGORY` [catalog object](entity:CatalogObject) that buyers can purchase to earn + * points. + */ + categoryId: string; +} diff --git a/src/api/types/LoyaltyProgramAccrualRuleItemVariationData.ts b/src/api/types/LoyaltyProgramAccrualRuleItemVariationData.ts new file mode 100644 index 000000000..e3bbea3e7 --- /dev/null +++ b/src/api/types/LoyaltyProgramAccrualRuleItemVariationData.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents additional data for rules with the `ITEM_VARIATION` accrual type. + */ +export interface LoyaltyProgramAccrualRuleItemVariationData { + /** + * The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to earn + * points. + */ + itemVariationId: string; +} diff --git a/src/api/types/LoyaltyProgramAccrualRuleSpendData.ts b/src/api/types/LoyaltyProgramAccrualRuleSpendData.ts new file mode 100644 index 000000000..d89798aaa --- /dev/null +++ b/src/api/types/LoyaltyProgramAccrualRuleSpendData.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents additional data for rules with the `SPEND` accrual type. + */ +export interface LoyaltyProgramAccrualRuleSpendData { + /** + * The amount that buyers must spend to earn points. + * For example, given an "Earn 1 point for every $10 spent" accrual rule, a buyer who spends $105 earns 10 points. + */ + amountMoney: Square.Money; + /** + * The IDs of any `CATEGORY` catalog objects that are excluded from points accrual. + * + * You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) + * endpoint to retrieve information about the excluded categories. + */ + excludedCategoryIds?: string[] | null; + /** + * The IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual. + * + * You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) + * endpoint to retrieve information about the excluded item variations. + */ + excludedItemVariationIds?: string[] | null; + /** + * Indicates how taxes should be treated when calculating the purchase amount used for points accrual. + * See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values + */ + taxMode: Square.LoyaltyProgramAccrualRuleTaxMode; +} diff --git a/src/api/types/LoyaltyProgramAccrualRuleTaxMode.ts b/src/api/types/LoyaltyProgramAccrualRuleTaxMode.ts new file mode 100644 index 000000000..0d1bb20b0 --- /dev/null +++ b/src/api/types/LoyaltyProgramAccrualRuleTaxMode.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual. + * This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. + */ +export type LoyaltyProgramAccrualRuleTaxMode = "BEFORE_TAX" | "AFTER_TAX"; +export const LoyaltyProgramAccrualRuleTaxMode = { + BeforeTax: "BEFORE_TAX", + AfterTax: "AFTER_TAX", +} as const; diff --git a/src/api/types/LoyaltyProgramAccrualRuleType.ts b/src/api/types/LoyaltyProgramAccrualRuleType.ts new file mode 100644 index 000000000..b8159b822 --- /dev/null +++ b/src/api/types/LoyaltyProgramAccrualRuleType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of the accrual rule that defines how buyers can earn points. + */ +export type LoyaltyProgramAccrualRuleType = "VISIT" | "SPEND" | "ITEM_VARIATION" | "CATEGORY"; +export const LoyaltyProgramAccrualRuleType = { + Visit: "VISIT", + Spend: "SPEND", + ItemVariation: "ITEM_VARIATION", + Category: "CATEGORY", +} as const; diff --git a/src/api/types/LoyaltyProgramAccrualRuleVisitData.ts b/src/api/types/LoyaltyProgramAccrualRuleVisitData.ts new file mode 100644 index 000000000..ca0a7548a --- /dev/null +++ b/src/api/types/LoyaltyProgramAccrualRuleVisitData.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents additional data for rules with the `VISIT` accrual type. + */ +export interface LoyaltyProgramAccrualRuleVisitData { + /** The minimum purchase required during the visit to quality for points. */ + minimumAmountMoney?: Square.Money; + /** + * Indicates how taxes should be treated when calculating the purchase amount to determine whether the visit qualifies for points. + * This setting applies only if `minimum_amount_money` is specified. + * See [LoyaltyProgramAccrualRuleTaxMode](#type-loyaltyprogramaccrualruletaxmode) for possible values + */ + taxMode: Square.LoyaltyProgramAccrualRuleTaxMode; +} diff --git a/src/api/types/LoyaltyProgramExpirationPolicy.ts b/src/api/types/LoyaltyProgramExpirationPolicy.ts new file mode 100644 index 000000000..8cae0f861 --- /dev/null +++ b/src/api/types/LoyaltyProgramExpirationPolicy.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes when the loyalty program expires. + */ +export interface LoyaltyProgramExpirationPolicy { + /** + * The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value of `P12M` represents a duration of 12 months. + * Points are valid through the last day of the month in which they are scheduled to expire. For example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021. + */ + expirationDuration: string; +} diff --git a/src/api/types/LoyaltyProgramRewardDefinition.ts b/src/api/types/LoyaltyProgramRewardDefinition.ts new file mode 100644 index 000000000..9529fddac --- /dev/null +++ b/src/api/types/LoyaltyProgramRewardDefinition.ts @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details + * are now defined using a catalog pricing rule and other catalog objects. For more information, see + * [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). + */ +export interface LoyaltyProgramRewardDefinition { + /** + * Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. You can find this information in the + * `product_set_data` field of the `PRODUCT_SET` catalog object referenced by the pricing rule. For `ORDER` scopes, + * `all_products` is true. For `ITEM_VARIATION` or `CATEGORY` scopes, `product_ids_any` is a list of + * catalog object IDs of the given type. + * See [LoyaltyProgramRewardDefinitionScope](#type-loyaltyprogramrewarddefinitionscope) for possible values + */ + scope: Square.LoyaltyProgramRewardDefinitionScope; + /** + * The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. You can find this information + * in the `discount_data.discount_type` field of the `DISCOUNT` catalog object referenced by the pricing rule. + * See [LoyaltyProgramRewardDefinitionType](#type-loyaltyprogramrewarddefinitiontype) for possible values + */ + discountType: Square.LoyaltyProgramRewardDefinitionType; + /** + * The fixed percentage of the discount. Present if `discount_type` is `FIXED_PERCENTAGE`. + * For example, a 7.25% off discount will be represented as "7.25". DEPRECATED at version 2020-12-16. You can find this + * information in the `discount_data.percentage` field of the `DISCOUNT` catalog object referenced by the pricing rule. + */ + percentageDiscount?: string; + /** + * The list of catalog objects to which this reward can be applied. They are either all item-variation ids or category ids, depending on the `type` field. + * DEPRECATED at version 2020-12-16. You can find this information in the `product_set_data.product_ids_any` field + * of the `PRODUCT_SET` catalog object referenced by the pricing rule. + */ + catalogObjectIds?: string[]; + /** + * The amount of the discount. Present if `discount_type` is `FIXED_AMOUNT`. For example, $5 off. + * DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.amount_money` field of the + * `DISCOUNT` catalog object referenced by the pricing rule. + */ + fixedDiscountMoney?: Square.Money; + /** + * When `discount_type` is `FIXED_PERCENTAGE`, the maximum discount amount that can be applied. + * DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.maximum_amount_money` field + * of the `DISCOUNT` catalog object referenced by the the pricing rule. + */ + maxDiscountMoney?: Square.Money; +} diff --git a/src/api/types/LoyaltyProgramRewardDefinitionScope.ts b/src/api/types/LoyaltyProgramRewardDefinitionScope.ts new file mode 100644 index 000000000..30d65b976 --- /dev/null +++ b/src/api/types/LoyaltyProgramRewardDefinitionScope.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. Discount details + * are now defined using a catalog pricing rule and other catalog objects. For more information, see + * [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). + */ +export type LoyaltyProgramRewardDefinitionScope = "ORDER" | "ITEM_VARIATION" | "CATEGORY"; +export const LoyaltyProgramRewardDefinitionScope = { + Order: "ORDER", + ItemVariation: "ITEM_VARIATION", + Category: "CATEGORY", +} as const; diff --git a/src/api/types/LoyaltyProgramRewardDefinitionType.ts b/src/api/types/LoyaltyProgramRewardDefinitionType.ts new file mode 100644 index 000000000..000593f12 --- /dev/null +++ b/src/api/types/LoyaltyProgramRewardDefinitionType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. Discount details + * are now defined using a catalog pricing rule and other catalog objects. For more information, see + * [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). + */ +export type LoyaltyProgramRewardDefinitionType = "FIXED_AMOUNT" | "FIXED_PERCENTAGE"; +export const LoyaltyProgramRewardDefinitionType = { + FixedAmount: "FIXED_AMOUNT", + FixedPercentage: "FIXED_PERCENTAGE", +} as const; diff --git a/src/api/types/LoyaltyProgramRewardTier.ts b/src/api/types/LoyaltyProgramRewardTier.ts new file mode 100644 index 000000000..77bb2ec6a --- /dev/null +++ b/src/api/types/LoyaltyProgramRewardTier.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers. + */ +export interface LoyaltyProgramRewardTier { + /** The Square-assigned ID of the reward tier. */ + id?: string; + /** The points exchanged for the reward tier. */ + points: number; + /** The name of the reward tier. */ + name?: string; + /** + * Provides details about the reward tier definition. + * DEPRECATED at version 2020-12-16. Replaced by the `pricing_rule_reference` field. + */ + definition?: Square.LoyaltyProgramRewardDefinition; + /** The timestamp when the reward tier was created, in RFC 3339 format. */ + createdAt?: string; + /** + * A reference to the specific version of a `PRICING_RULE` catalog object that contains information about the reward tier discount. + * + * Use `object_id` and `catalog_version` with the [RetrieveCatalogObject](api-endpoint:Catalog-RetrieveCatalogObject) endpoint + * to get discount details. Make sure to set `include_related_objects` to true in the request to retrieve all catalog objects + * that define the discount. For more information, see [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). + */ + pricingRuleReference: Square.CatalogObjectReference; +} diff --git a/src/api/types/LoyaltyProgramStatus.ts b/src/api/types/LoyaltyProgramStatus.ts new file mode 100644 index 000000000..99cf1c4de --- /dev/null +++ b/src/api/types/LoyaltyProgramStatus.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether the program is currently active. + */ +export type LoyaltyProgramStatus = "INACTIVE" | "ACTIVE"; +export const LoyaltyProgramStatus = { + Inactive: "INACTIVE", + Active: "ACTIVE", +} as const; diff --git a/src/api/types/LoyaltyProgramTerminology.ts b/src/api/types/LoyaltyProgramTerminology.ts new file mode 100644 index 000000000..a84f98bd9 --- /dev/null +++ b/src/api/types/LoyaltyProgramTerminology.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the naming used for loyalty points. + */ +export interface LoyaltyProgramTerminology { + /** A singular unit for a point (for example, 1 point is called 1 star). */ + one: string; + /** A plural unit for point (for example, 10 points is called 10 stars). */ + other: string; +} diff --git a/src/api/types/LoyaltyPromotion.ts b/src/api/types/LoyaltyPromotion.ts new file mode 100644 index 000000000..df8c25093 --- /dev/null +++ b/src/api/types/LoyaltyPromotion.ts @@ -0,0 +1,65 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a promotion for a [loyalty program](entity:LoyaltyProgram). Loyalty promotions enable buyers + * to earn extra points on top of those earned from the base program. + * + * A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. + */ +export interface LoyaltyPromotion { + /** The Square-assigned ID of the promotion. */ + id?: string; + /** The name of the promotion. */ + name: string; + /** + * The points incentive for the promotion. This field defines whether promotion points + * are earned by multiplying base program points or by adding a specified number of points. + */ + incentive: Square.LoyaltyPromotionIncentive; + /** The scheduling information that defines when purchases can qualify to earn points from an `ACTIVE` promotion. */ + availableTime: Square.LoyaltyPromotionAvailableTimeData; + /** + * The number of times a buyer can earn promotion points during a specified interval. + * If not specified, buyers can trigger the promotion an unlimited number of times. + */ + triggerLimit?: Square.LoyaltyPromotionTriggerLimit; + /** + * The current status of the promotion. + * See [LoyaltyPromotionStatus](#type-loyaltypromotionstatus) for possible values + */ + status?: Square.LoyaltyPromotionStatus; + /** The timestamp of when the promotion was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp of when the promotion was canceled, in RFC 3339 format. */ + canceledAt?: string; + /** The timestamp when the promotion was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** The ID of the [loyalty program](entity:LoyaltyProgram) associated with the promotion. */ + loyaltyProgramId?: string; + /** The minimum purchase amount required to earn promotion points. If specified, this amount is positive. */ + minimumSpendAmountMoney?: Square.Money; + /** + * The IDs of any qualifying `ITEM_VARIATION` [catalog objects](entity:CatalogObject). If specified, + * the purchase must include at least one of these items to qualify for the promotion. + * + * This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule. + * With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded. + * + * You can specify `qualifying_item_variation_ids` or `qualifying_category_ids` for a given promotion, but not both. + */ + qualifyingItemVariationIds?: string[] | null; + /** + * The IDs of any qualifying `CATEGORY` [catalog objects](entity:CatalogObject). If specified, + * the purchase must include at least one item from one of these categories to qualify for the promotion. + * + * This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule. + * With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded. + * + * You can specify `qualifying_category_ids` or `qualifying_item_variation_ids` for a promotion, but not both. + */ + qualifyingCategoryIds?: string[] | null; +} diff --git a/src/api/types/LoyaltyPromotionAvailableTimeData.ts b/src/api/types/LoyaltyPromotionAvailableTimeData.ts new file mode 100644 index 000000000..ef555493f --- /dev/null +++ b/src/api/types/LoyaltyPromotionAvailableTimeData.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents scheduling information that determines when purchases can qualify to earn points + * from a [loyalty promotion](entity:LoyaltyPromotion). + */ +export interface LoyaltyPromotionAvailableTimeData { + /** + * The date that the promotion starts, in `YYYY-MM-DD` format. Square populates this field + * based on the provided `time_periods`. + */ + startDate?: string; + /** + * The date that the promotion ends, in `YYYY-MM-DD` format. Square populates this field + * based on the provided `time_periods`. If an end date is not specified, an `ACTIVE` promotion + * remains available until it is canceled. + */ + endDate?: string; + /** + * A list of [iCalendar (RFC 5545) events](https://tools.ietf.org/html/rfc5545#section-3.6.1) + * (`VEVENT`). Each event represents an available time period per day or days of the week. + * A day can have a maximum of one available time period. + * + * Only `DTSTART`, `DURATION`, and `RRULE` are supported. `DTSTART` and `DURATION` are required and + * timestamps must be in local (unzoned) time format. Include `RRULE` to specify recurring promotions, + * an end date (using the `UNTIL` keyword), or both. For more information, see + * [Available time](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#available-time). + * + * Note that `BEGIN:VEVENT` and `END:VEVENT` are optional in a `CreateLoyaltyPromotion` request + * but are always included in the response. + */ + timePeriods: string[]; +} diff --git a/src/api/types/LoyaltyPromotionIncentive.ts b/src/api/types/LoyaltyPromotionIncentive.ts new file mode 100644 index 000000000..96aafdd44 --- /dev/null +++ b/src/api/types/LoyaltyPromotionIncentive.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents how points for a [loyalty promotion](entity:LoyaltyPromotion) are calculated, + * either by multiplying the points earned from the base program or by adding a specified number + * of points to the points earned from the base program. + */ +export interface LoyaltyPromotionIncentive { + /** + * The type of points incentive. + * See [LoyaltyPromotionIncentiveType](#type-loyaltypromotionincentivetype) for possible values + */ + type: Square.LoyaltyPromotionIncentiveType; + /** Additional data for a `POINTS_MULTIPLIER` incentive type. */ + pointsMultiplierData?: Square.LoyaltyPromotionIncentivePointsMultiplierData; + /** Additional data for a `POINTS_ADDITION` incentive type. */ + pointsAdditionData?: Square.LoyaltyPromotionIncentivePointsAdditionData; +} diff --git a/src/api/types/LoyaltyPromotionIncentivePointsAdditionData.ts b/src/api/types/LoyaltyPromotionIncentivePointsAdditionData.ts new file mode 100644 index 000000000..900a4166a --- /dev/null +++ b/src/api/types/LoyaltyPromotionIncentivePointsAdditionData.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive). + */ +export interface LoyaltyPromotionIncentivePointsAdditionData { + /** + * The number of additional points to earn each time the promotion is triggered. For example, + * suppose a purchase qualifies for 5 points from the base loyalty program. If the purchase also + * qualifies for a `POINTS_ADDITION` promotion incentive with a `points_addition` of 3, the buyer + * earns a total of 8 points (5 program points + 3 promotion points = 8 points). + */ + pointsAddition: number; +} diff --git a/src/api/types/LoyaltyPromotionIncentivePointsMultiplierData.ts b/src/api/types/LoyaltyPromotionIncentivePointsMultiplierData.ts new file mode 100644 index 000000000..1b89d2986 --- /dev/null +++ b/src/api/types/LoyaltyPromotionIncentivePointsMultiplierData.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive). + */ +export interface LoyaltyPromotionIncentivePointsMultiplierData { + /** + * The multiplier used to calculate the number of points earned each time the promotion + * is triggered. For example, suppose a purchase qualifies for 5 points from the base loyalty program. + * If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a `points_multiplier` + * of 3, the buyer earns a total of 15 points (5 program points x 3 promotion multiplier = 15 points). + * + * DEPRECATED at version 2023-08-16. Replaced by the `multiplier` field. + * + * One of the following is required when specifying a points multiplier: + * - (Recommended) The `multiplier` field. + * - This deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` + * with the equivalent value. + */ + pointsMultiplier?: number | null; + /** + * The multiplier used to calculate the number of points earned each time the promotion is triggered, + * specified as a string representation of a decimal. Square supports multipliers up to 10x, with three + * point precision for decimal multipliers. For example, suppose a purchase qualifies for 4 points from the + * base loyalty program. If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a + * `multiplier` of "1.5", the buyer earns a total of 6 points (4 program points x 1.5 promotion multiplier = 6 points). + * Fractional points are dropped. + * + * One of the following is required when specifying a points multiplier: + * - (Recommended) This `multiplier` field. + * - The deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` + * with the equivalent value. + */ + multiplier?: string | null; +} diff --git a/src/api/types/LoyaltyPromotionIncentiveType.ts b/src/api/types/LoyaltyPromotionIncentiveType.ts new file mode 100644 index 000000000..b60e6882e --- /dev/null +++ b/src/api/types/LoyaltyPromotionIncentiveType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the type of points incentive for a [loyalty promotion](entity:LoyaltyPromotion), + * which is used to determine how buyers can earn points from the promotion. + */ +export type LoyaltyPromotionIncentiveType = "POINTS_MULTIPLIER" | "POINTS_ADDITION"; +export const LoyaltyPromotionIncentiveType = { + PointsMultiplier: "POINTS_MULTIPLIER", + PointsAddition: "POINTS_ADDITION", +} as const; diff --git a/src/api/types/LoyaltyPromotionStatus.ts b/src/api/types/LoyaltyPromotionStatus.ts new file mode 100644 index 000000000..fc71b8bd4 --- /dev/null +++ b/src/api/types/LoyaltyPromotionStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the status of a [loyalty promotion](entity:LoyaltyPromotion). + */ +export type LoyaltyPromotionStatus = "ACTIVE" | "ENDED" | "CANCELED" | "SCHEDULED"; +export const LoyaltyPromotionStatus = { + Active: "ACTIVE", + Ended: "ENDED", + Canceled: "CANCELED", + Scheduled: "SCHEDULED", +} as const; diff --git a/src/api/types/LoyaltyPromotionTriggerLimit.ts b/src/api/types/LoyaltyPromotionTriggerLimit.ts new file mode 100644 index 000000000..940ec80f3 --- /dev/null +++ b/src/api/types/LoyaltyPromotionTriggerLimit.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the number of times a buyer can earn points during a [loyalty promotion](entity:LoyaltyPromotion). + * If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during + * the time that the promotion is available. + * + * A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. + */ +export interface LoyaltyPromotionTriggerLimit { + /** The maximum number of times a buyer can trigger the promotion during the specified `interval`. */ + times: number; + /** + * The time period the limit applies to. + * See [LoyaltyPromotionTriggerLimitInterval](#type-loyaltypromotiontriggerlimitinterval) for possible values + */ + interval?: Square.LoyaltyPromotionTriggerLimitInterval; +} diff --git a/src/api/types/LoyaltyPromotionTriggerLimitInterval.ts b/src/api/types/LoyaltyPromotionTriggerLimitInterval.ts new file mode 100644 index 000000000..af488c597 --- /dev/null +++ b/src/api/types/LoyaltyPromotionTriggerLimitInterval.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the time period that the [trigger limit](entity:LoyaltyPromotionTriggerLimit) applies to, + * which is used to determine the number of times a buyer can earn points for a [loyalty promotion](entity:LoyaltyPromotion). + */ +export type LoyaltyPromotionTriggerLimitInterval = "ALL_TIME" | "DAY"; +export const LoyaltyPromotionTriggerLimitInterval = { + AllTime: "ALL_TIME", + Day: "DAY", +} as const; diff --git a/src/api/types/LoyaltyReward.ts b/src/api/types/LoyaltyReward.ts new file mode 100644 index 000000000..9168d20b2 --- /dev/null +++ b/src/api/types/LoyaltyReward.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a contract to redeem loyalty points for a [reward tier](entity:LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. + * For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). + */ +export interface LoyaltyReward { + /** The Square-assigned ID of the loyalty reward. */ + id?: string; + /** + * The status of a loyalty reward. + * See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values + */ + status?: Square.LoyaltyRewardStatus; + /** The Square-assigned ID of the [loyalty account](entity:LoyaltyAccount) to which the reward belongs. */ + loyaltyAccountId: string; + /** The Square-assigned ID of the [reward tier](entity:LoyaltyProgramRewardTier) used to create the reward. */ + rewardTierId: string; + /** The number of loyalty points used for the reward. */ + points?: number; + /** The Square-assigned ID of the [order](entity:Order) to which the reward is attached. */ + orderId?: string | null; + /** The timestamp when the reward was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the reward was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** The timestamp when the reward was redeemed, in RFC 3339 format. */ + redeemedAt?: string; +} diff --git a/src/api/types/LoyaltyRewardStatus.ts b/src/api/types/LoyaltyRewardStatus.ts new file mode 100644 index 000000000..2e4593f28 --- /dev/null +++ b/src/api/types/LoyaltyRewardStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The status of the loyalty reward. + */ +export type LoyaltyRewardStatus = "ISSUED" | "REDEEMED" | "DELETED"; +export const LoyaltyRewardStatus = { + Issued: "ISSUED", + Redeemed: "REDEEMED", + Deleted: "DELETED", +} as const; diff --git a/src/api/types/MeasurementUnit.ts b/src/api/types/MeasurementUnit.ts new file mode 100644 index 000000000..24a146726 --- /dev/null +++ b/src/api/types/MeasurementUnit.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a unit of measurement to use with a quantity, such as ounces + * or inches. Exactly one of the following fields are required: `custom_unit`, + * `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. + */ +export interface MeasurementUnit { + /** + * A custom unit of measurement defined by the seller using the Point of Sale + * app or ad-hoc as an order line item. + */ + customUnit?: Square.MeasurementUnitCustom; + /** + * Represents a standard area unit. + * See [MeasurementUnitArea](#type-measurementunitarea) for possible values + */ + areaUnit?: Square.MeasurementUnitArea; + /** + * Represents a standard length unit. + * See [MeasurementUnitLength](#type-measurementunitlength) for possible values + */ + lengthUnit?: Square.MeasurementUnitLength; + /** + * Represents a standard volume unit. + * See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values + */ + volumeUnit?: Square.MeasurementUnitVolume; + /** + * Represents a standard unit of weight or mass. + * See [MeasurementUnitWeight](#type-measurementunitweight) for possible values + */ + weightUnit?: Square.MeasurementUnitWeight; + /** + * Reserved for API integrations that lack the ability to specify a real measurement unit + * See [MeasurementUnitGeneric](#type-measurementunitgeneric) for possible values + */ + genericUnit?: Square.MeasurementUnitGeneric; + /** + * Represents a standard unit of time. + * See [MeasurementUnitTime](#type-measurementunittime) for possible values + */ + timeUnit?: Square.MeasurementUnitTime; + /** + * Represents the type of the measurement unit. + * See [MeasurementUnitUnitType](#type-measurementunitunittype) for possible values + */ + type?: Square.MeasurementUnitUnitType; +} diff --git a/src/api/types/MeasurementUnitArea.ts b/src/api/types/MeasurementUnitArea.ts new file mode 100644 index 000000000..b3515d4f6 --- /dev/null +++ b/src/api/types/MeasurementUnitArea.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Unit of area used to measure a quantity. + */ +export type MeasurementUnitArea = + | "IMPERIAL_ACRE" + | "IMPERIAL_SQUARE_INCH" + | "IMPERIAL_SQUARE_FOOT" + | "IMPERIAL_SQUARE_YARD" + | "IMPERIAL_SQUARE_MILE" + | "METRIC_SQUARE_CENTIMETER" + | "METRIC_SQUARE_METER" + | "METRIC_SQUARE_KILOMETER"; +export const MeasurementUnitArea = { + ImperialAcre: "IMPERIAL_ACRE", + ImperialSquareInch: "IMPERIAL_SQUARE_INCH", + ImperialSquareFoot: "IMPERIAL_SQUARE_FOOT", + ImperialSquareYard: "IMPERIAL_SQUARE_YARD", + ImperialSquareMile: "IMPERIAL_SQUARE_MILE", + MetricSquareCentimeter: "METRIC_SQUARE_CENTIMETER", + MetricSquareMeter: "METRIC_SQUARE_METER", + MetricSquareKilometer: "METRIC_SQUARE_KILOMETER", +} as const; diff --git a/src/api/types/MeasurementUnitCustom.ts b/src/api/types/MeasurementUnitCustom.ts new file mode 100644 index 000000000..1a28c4793 --- /dev/null +++ b/src/api/types/MeasurementUnitCustom.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The information needed to define a custom unit, provided by the seller. + */ +export interface MeasurementUnitCustom { + /** The name of the custom unit, for example "bushel". */ + name: string; + /** + * The abbreviation of the custom unit, such as "bsh" (bushel). This appears + * in the cart for the Point of Sale app, and in reports. + */ + abbreviation: string; +} diff --git a/src/api/types/MeasurementUnitGeneric.ts b/src/api/types/MeasurementUnitGeneric.ts new file mode 100644 index 000000000..0882b88e3 --- /dev/null +++ b/src/api/types/MeasurementUnitGeneric.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type MeasurementUnitGeneric = "UNIT"; diff --git a/src/api/types/MeasurementUnitLength.ts b/src/api/types/MeasurementUnitLength.ts new file mode 100644 index 000000000..18208ada5 --- /dev/null +++ b/src/api/types/MeasurementUnitLength.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The unit of length used to measure a quantity. + */ +export type MeasurementUnitLength = + | "IMPERIAL_INCH" + | "IMPERIAL_FOOT" + | "IMPERIAL_YARD" + | "IMPERIAL_MILE" + | "METRIC_MILLIMETER" + | "METRIC_CENTIMETER" + | "METRIC_METER" + | "METRIC_KILOMETER"; +export const MeasurementUnitLength = { + ImperialInch: "IMPERIAL_INCH", + ImperialFoot: "IMPERIAL_FOOT", + ImperialYard: "IMPERIAL_YARD", + ImperialMile: "IMPERIAL_MILE", + MetricMillimeter: "METRIC_MILLIMETER", + MetricCentimeter: "METRIC_CENTIMETER", + MetricMeter: "METRIC_METER", + MetricKilometer: "METRIC_KILOMETER", +} as const; diff --git a/src/api/types/MeasurementUnitTime.ts b/src/api/types/MeasurementUnitTime.ts new file mode 100644 index 000000000..4c8187ae1 --- /dev/null +++ b/src/api/types/MeasurementUnitTime.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Unit of time used to measure a quantity (a duration). + */ +export type MeasurementUnitTime = + | "GENERIC_MILLISECOND" + | "GENERIC_SECOND" + | "GENERIC_MINUTE" + | "GENERIC_HOUR" + | "GENERIC_DAY"; +export const MeasurementUnitTime = { + GenericMillisecond: "GENERIC_MILLISECOND", + GenericSecond: "GENERIC_SECOND", + GenericMinute: "GENERIC_MINUTE", + GenericHour: "GENERIC_HOUR", + GenericDay: "GENERIC_DAY", +} as const; diff --git a/src/api/types/MeasurementUnitUnitType.ts b/src/api/types/MeasurementUnitUnitType.ts new file mode 100644 index 000000000..de29e72ee --- /dev/null +++ b/src/api/types/MeasurementUnitUnitType.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. + */ +export type MeasurementUnitUnitType = + | "TYPE_CUSTOM" + | "TYPE_AREA" + | "TYPE_LENGTH" + | "TYPE_VOLUME" + | "TYPE_WEIGHT" + | "TYPE_GENERIC"; +export const MeasurementUnitUnitType = { + TypeCustom: "TYPE_CUSTOM", + TypeArea: "TYPE_AREA", + TypeLength: "TYPE_LENGTH", + TypeVolume: "TYPE_VOLUME", + TypeWeight: "TYPE_WEIGHT", + TypeGeneric: "TYPE_GENERIC", +} as const; diff --git a/src/api/types/MeasurementUnitVolume.ts b/src/api/types/MeasurementUnitVolume.ts new file mode 100644 index 000000000..64a0f1c50 --- /dev/null +++ b/src/api/types/MeasurementUnitVolume.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The unit of volume used to measure a quantity. + */ +export type MeasurementUnitVolume = + | "GENERIC_FLUID_OUNCE" + | "GENERIC_SHOT" + | "GENERIC_CUP" + | "GENERIC_PINT" + | "GENERIC_QUART" + | "GENERIC_GALLON" + | "IMPERIAL_CUBIC_INCH" + | "IMPERIAL_CUBIC_FOOT" + | "IMPERIAL_CUBIC_YARD" + | "METRIC_MILLILITER" + | "METRIC_LITER"; +export const MeasurementUnitVolume = { + GenericFluidOunce: "GENERIC_FLUID_OUNCE", + GenericShot: "GENERIC_SHOT", + GenericCup: "GENERIC_CUP", + GenericPint: "GENERIC_PINT", + GenericQuart: "GENERIC_QUART", + GenericGallon: "GENERIC_GALLON", + ImperialCubicInch: "IMPERIAL_CUBIC_INCH", + ImperialCubicFoot: "IMPERIAL_CUBIC_FOOT", + ImperialCubicYard: "IMPERIAL_CUBIC_YARD", + MetricMilliliter: "METRIC_MILLILITER", + MetricLiter: "METRIC_LITER", +} as const; diff --git a/src/api/types/MeasurementUnitWeight.ts b/src/api/types/MeasurementUnitWeight.ts new file mode 100644 index 000000000..ed30cac93 --- /dev/null +++ b/src/api/types/MeasurementUnitWeight.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Unit of weight used to measure a quantity. + */ +export type MeasurementUnitWeight = + | "IMPERIAL_WEIGHT_OUNCE" + | "IMPERIAL_POUND" + | "IMPERIAL_STONE" + | "METRIC_MILLIGRAM" + | "METRIC_GRAM" + | "METRIC_KILOGRAM"; +export const MeasurementUnitWeight = { + ImperialWeightOunce: "IMPERIAL_WEIGHT_OUNCE", + ImperialPound: "IMPERIAL_POUND", + ImperialStone: "IMPERIAL_STONE", + MetricMilligram: "METRIC_MILLIGRAM", + MetricGram: "METRIC_GRAM", + MetricKilogram: "METRIC_KILOGRAM", +} as const; diff --git a/src/api/types/Merchant.ts b/src/api/types/Merchant.ts new file mode 100644 index 000000000..d57d5dff7 --- /dev/null +++ b/src/api/types/Merchant.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a business that sells with Square. + */ +export interface Merchant { + /** The Square-issued ID of the merchant. */ + id?: string; + /** The name of the merchant's overall business. */ + businessName?: string | null; + /** + * The country code associated with the merchant, in the two-letter format of ISO 3166. For example, `US` or `JP`. + * See [Country](#type-country) for possible values + */ + country: Square.Country; + /** The code indicating the [language preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences) of the merchant, in [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). For example, `en-US` or `fr-CA`. */ + languageCode?: string | null; + /** + * The currency associated with the merchant, in ISO 4217 format. For example, the currency code for US dollars is `USD`. + * See [Currency](#type-currency) for possible values + */ + currency?: Square.Currency; + /** + * The merchant's status. + * See [MerchantStatus](#type-merchantstatus) for possible values + */ + status?: Square.MerchantStatus; + /** The ID of the [main `Location`](https://developer.squareup.com/docs/locations-api#about-the-main-location) for this merchant. */ + mainLocationId?: string | null; + /** + * The time when the merchant was created, in RFC 3339 format. + * For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). + */ + createdAt?: string; +} diff --git a/src/api/types/MerchantStatus.ts b/src/api/types/MerchantStatus.ts new file mode 100644 index 000000000..5d20496e2 --- /dev/null +++ b/src/api/types/MerchantStatus.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type MerchantStatus = "ACTIVE" | "INACTIVE"; +export const MerchantStatus = { + Active: "ACTIVE", + Inactive: "INACTIVE", +} as const; diff --git a/src/api/types/ModifierLocationOverrides.ts b/src/api/types/ModifierLocationOverrides.ts new file mode 100644 index 000000000..fc4f18ebd --- /dev/null +++ b/src/api/types/ModifierLocationOverrides.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Location-specific overrides for specified properties of a `CatalogModifier` object. + */ +export interface ModifierLocationOverrides { + /** The ID of the `Location` object representing the location. This can include a deactivated location. */ + locationId?: string | null; + /** + * The overridden price at the specified location. If this is unspecified, the modifier price is not overridden. + * The modifier becomes free of charge at the specified location, when this `price_money` field is set to 0. + */ + priceMoney?: Square.Money; + /** + * Indicates whether the modifier is sold out at the specified location or not. As an example, for cheese (modifier) burger (item), when the modifier is sold out, it is the cheese, but not the burger, that is sold out. + * The seller can manually set this sold out status. Attempts by an application to set this attribute are ignored. + */ + soldOut?: boolean; +} diff --git a/src/api/types/Money.ts b/src/api/types/Money.ts new file mode 100644 index 000000000..a49a8633f --- /dev/null +++ b/src/api/types/Money.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * 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. + */ +export interface Money { + /** + * The amount of money, in the smallest denomination of the currency + * indicated by `currency`. For example, when `currency` is `USD`, `amount` is + * in cents. Monetary amounts can be positive or negative. See the specific + * field description to determine the meaning of the sign in a particular case. + */ + amount?: bigint | null; + /** + * The type of currency, in __ISO 4217 format__. For example, the currency + * code for US dollars is `USD`. + * + * See [Currency](entity:Currency) for possible values. + * See [Currency](#type-currency) for possible values + */ + currency?: Square.Currency; +} diff --git a/src/api/types/ObtainTokenResponse.ts b/src/api/types/ObtainTokenResponse.ts new file mode 100644 index 000000000..c0fded2a6 --- /dev/null +++ b/src/api/types/ObtainTokenResponse.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ObtainTokenResponse { + /** + * A valid OAuth access token. + * Provide the access token in a header with every request to Connect API + * endpoints. For more information, see [OAuth API: Walkthrough](https://developer.squareup.com/docs/oauth-api/walkthrough). + */ + accessToken?: string; + /** This value is always _bearer_. */ + tokenType?: string; + /** The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. */ + expiresAt?: string; + /** The ID of the authorizing merchant's business. */ + merchantId?: string; + /** + * __LEGACY FIELD__. The ID of a subscription plan the merchant signed up + * for. The ID is only present if the merchant signed up for a subscription plan during authorization. + */ + subscriptionId?: string; + /** + * __LEGACY FIELD__. The ID of the subscription plan the merchant signed + * up for. The ID is only present if the merchant signed up for a subscription plan during + * authorization. + */ + planId?: string; + /** + * The OpenID token belonging to this person. This token is only present if the + * OPENID scope is included in the authorization request. + */ + idToken?: string; + /** + * A refresh token. + * For more information, see [Refresh, Revoke, and Limit the Scope of OAuth Tokens](https://developer.squareup.com/docs/oauth-api/refresh-revoke-limit-scope). + */ + refreshToken?: string; + /** + * A Boolean indicating that the access token is a short-lived access token. + * The short-lived access token returned in the response expires in 24 hours. + */ + shortLived?: boolean; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. */ + refreshTokenExpiresAt?: string; +} diff --git a/src/api/types/OfflinePaymentDetails.ts b/src/api/types/OfflinePaymentDetails.ts new file mode 100644 index 000000000..d82128b4a --- /dev/null +++ b/src/api/types/OfflinePaymentDetails.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Details specific to offline payments. + */ +export interface OfflinePaymentDetails { + /** The client-side timestamp of when the offline payment was created, in RFC 3339 format. */ + clientCreatedAt?: string; +} diff --git a/src/api/types/Order.ts b/src/api/types/Order.ts new file mode 100644 index 000000000..4445dcd7d --- /dev/null +++ b/src/api/types/Order.ts @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Contains all information related to a single order to process with Square, + * including line items that specify the products to purchase. `Order` objects also + * include information about any associated tenders, refunds, and returns. + * + * All Connect V2 Transactions have all been converted to Orders including all associated + * itemization data. + */ +export interface Order { + /** The order's unique ID. */ + id?: string; + /** The ID of the seller location that this order is associated with. */ + locationId: string; + /** + * A client-specified ID to associate an entity in another system + * with this order. + */ + referenceId?: string | null; + /** The origination details of the order. */ + source?: Square.OrderSource; + /** + * The ID of the [customer](entity:Customer) associated with the order. + * + * You should specify a `customer_id` on the order (or the payment) to ensure that transactions + * are reliably linked to customers. Omitting this field might result in the creation of new + * [instant profiles](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles). + */ + customerId?: string | null; + /** The line items included in the order. */ + lineItems?: Square.OrderLineItem[] | null; + /** + * The list of all taxes associated with the order. + * + * Taxes can be scoped to either `ORDER` or `LINE_ITEM`. For taxes with `LINE_ITEM` scope, an + * `OrderLineItemAppliedTax` must be added to each line item that the tax applies to. For taxes + * with `ORDER` scope, the server generates an `OrderLineItemAppliedTax` for every line item. + * + * On reads, each tax in the list includes the total amount of that tax applied to the order. + * + * __IMPORTANT__: If `LINE_ITEM` scope is set on any taxes in this field, using the deprecated + * `line_items.taxes` field results in an error. Use `line_items.applied_taxes` + * instead. + */ + taxes?: Square.OrderLineItemTax[] | null; + /** + * The list of all discounts associated with the order. + * + * Discounts can be scoped to either `ORDER` or `LINE_ITEM`. For discounts scoped to `LINE_ITEM`, + * an `OrderLineItemAppliedDiscount` must be added to each line item that the discount applies to. + * For discounts with `ORDER` scope, the server generates an `OrderLineItemAppliedDiscount` + * for every line item. + * + * __IMPORTANT__: If `LINE_ITEM` scope is set on any discounts in this field, using the deprecated + * `line_items.discounts` field results in an error. Use `line_items.applied_discounts` + * instead. + */ + discounts?: Square.OrderLineItemDiscount[] | null; + /** A list of service charges applied to the order. */ + serviceCharges?: Square.OrderServiceCharge[] | null; + /** + * Details about order fulfillment. + * + * Orders can only be created with at most one fulfillment. However, orders returned + * by the API might contain multiple fulfillments. + */ + fulfillments?: Square.Fulfillment[] | null; + /** + * A collection of items from sale orders being returned in this one. Normally part of an + * itemized return or exchange. There is exactly one `Return` object per sale `Order` being + * referenced. + */ + returns?: Square.OrderReturn[]; + /** The rollup of the returned money amounts. */ + returnAmounts?: Square.OrderMoneyAmounts; + /** The net money amounts (sale money - return money). */ + netAmounts?: Square.OrderMoneyAmounts; + /** + * A positive rounding adjustment to the total of the order. This adjustment is commonly + * used to apply cash rounding when the minimum unit of account is smaller than the lowest physical + * denomination of the currency. + */ + roundingAdjustment?: Square.OrderRoundingAdjustment; + /** The tenders that were used to pay for the order. */ + tenders?: Square.Tender[]; + /** The refunds that are part of this order. */ + refunds?: Square.Refund[]; + /** + * Application-defined data attached to this order. Metadata fields are intended + * to store descriptive references or associations with an entity in another system or store brief + * information about the object. Square does not process this field; it only stores and returns it + * in relevant API calls. Do not use metadata to store any sensitive information (such as personally + * identifiable information or card details). + * + * Keys written by applications must be 60 characters or less and must be in the character set + * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + * with a namespace, separated from the key with a ':' character. + * + * Values have a maximum length of 255 characters. + * + * An application can have up to 10 entries per metadata field. + * + * Entries written by applications are private and can only be read or modified by the same + * application. + * + * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + */ + metadata?: Record | null; + /** The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). */ + createdAt?: string; + /** The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). */ + updatedAt?: string; + /** The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z"). */ + closedAt?: string; + /** + * The current state of the order. + * See [OrderState](#type-orderstate) for possible values + */ + state?: Square.OrderState; + /** + * The version number, which is incremented each time an update is committed to the order. + * Orders not created through the API do not include a version number and + * therefore cannot be updated. + * + * [Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders). + */ + version?: number; + /** The total amount of money to collect for the order. */ + totalMoney?: Square.Money; + /** The total amount of tax money to collect for the order. */ + totalTaxMoney?: Square.Money; + /** The total amount of discount money to collect for the order. */ + totalDiscountMoney?: Square.Money; + /** The total amount of tip money to collect for the order. */ + totalTipMoney?: Square.Money; + /** + * The total amount of money collected in service charges for the order. + * + * Note: `total_service_charge_money` is the sum of `applied_money` fields for each individual + * service charge. Therefore, `total_service_charge_money` only includes inclusive tax amounts, + * not additive tax amounts. + */ + totalServiceChargeMoney?: Square.Money; + /** + * A short-term identifier for the order (such as a customer first name, + * table number, or auto-generated order number that resets daily). + */ + ticketName?: string | null; + /** + * Pricing options for an order. The options affect how the order's price is calculated. + * They can be used, for example, to apply automatic price adjustments that are based on + * preconfigured [pricing rules](entity:CatalogPricingRule). + */ + pricingOptions?: Square.OrderPricingOptions; + /** A set-like list of Rewards that have been added to the Order. */ + rewards?: Square.OrderReward[]; + /** The net amount of money due on the order. */ + netAmountDueMoney?: Square.Money; +} diff --git a/src/api/types/OrderEntry.ts b/src/api/types/OrderEntry.ts new file mode 100644 index 000000000..1d662c616 --- /dev/null +++ b/src/api/types/OrderEntry.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A lightweight description of an [order](entity:Order) that is returned when + * `returned_entries` is `true` on a [SearchOrdersRequest](api-endpoint:Orders-SearchOrders). + */ +export interface OrderEntry { + /** The ID of the order. */ + orderId?: string | null; + /** + * The version number, which is incremented each time an update is committed to the order. + * Orders that were not created through the API do not include a version number and + * therefore cannot be updated. + * + * [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) + */ + version?: number; + /** The location ID the order belongs to. */ + locationId?: string | null; +} diff --git a/src/api/types/OrderLineItem.ts b/src/api/types/OrderLineItem.ts new file mode 100644 index 000000000..bba33a54e --- /dev/null +++ b/src/api/types/OrderLineItem.ts @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a line item in an order. Each line item describes a different + * product to purchase, with its own quantity and price details. + */ +export interface OrderLineItem { + /** A unique ID that identifies the line item only within this order. */ + uid?: string | null; + /** The name of the line item. */ + name?: string | null; + /** + * The count, or measurement, of a line item being purchased: + * + * If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an item count. For example: `3` apples. + * + * If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` denotes a measurement. For example: `2.25` pounds of broccoli. + * + * For more information, see [Specify item quantity and measurement unit](https://developer.squareup.com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit). + * + * Line items with a quantity of `0` are automatically removed + * when paying for or otherwise completing the order. + */ + quantity: string; + /** The measurement unit and decimal precision that this line item's quantity is measured in. */ + quantityUnit?: Square.OrderQuantityUnit; + /** An optional note associated with the line item. */ + note?: string | null; + /** The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this line item. */ + catalogObjectId?: string | null; + /** The version of the catalog object that this line item references. */ + catalogVersion?: bigint | null; + /** The name of the variation applied to this line item. */ + variationName?: string | null; + /** + * The type of line item: an itemized sale, a non-itemized sale (custom amount), or the + * activation or reloading of a gift card. + * See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values + */ + itemType?: Square.OrderLineItemItemType; + /** + * Application-defined data attached to this line item. Metadata fields are intended + * to store descriptive references or associations with an entity in another system or store brief + * information about the object. Square does not process this field; it only stores and returns it + * in relevant API calls. Do not use metadata to store any sensitive information (such as personally + * identifiable information or card details). + * + * Keys written by applications must be 60 characters or less and must be in the character set + * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + * with a namespace, separated from the key with a ':' character. + * + * Values have a maximum length of 255 characters. + * + * An application can have up to 10 entries per metadata field. + * + * Entries written by applications are private and can only be read or modified by the same + * application. + * + * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + */ + metadata?: Record | null; + /** The [CatalogModifier](entity:CatalogModifier)s applied to this line item. */ + modifiers?: Square.OrderLineItemModifier[] | null; + /** + * The list of references to taxes applied to this line item. Each + * `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a + * top-level `OrderLineItemTax` applied to the line item. On reads, the + * amount applied is populated. + * + * An `OrderLineItemAppliedTax` is automatically created on every line + * item for all `ORDER` scoped taxes added to the order. `OrderLineItemAppliedTax` + * records for `LINE_ITEM` scoped taxes must be added in requests for the tax + * to apply to any line items. + * + * To change the amount of a tax, modify the referenced top-level tax. + */ + appliedTaxes?: Square.OrderLineItemAppliedTax[] | null; + /** + * The list of references to discounts applied to this line item. Each + * `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level + * `OrderLineItemDiscounts` applied to the line item. On reads, the amount + * applied is populated. + * + * An `OrderLineItemAppliedDiscount` is automatically created on every line item for all + * `ORDER` scoped discounts that are added to the order. `OrderLineItemAppliedDiscount` records + * for `LINE_ITEM` scoped discounts must be added in requests for the discount to apply to any + * line items. + * + * To change the amount of a discount, modify the referenced top-level discount. + */ + appliedDiscounts?: Square.OrderLineItemAppliedDiscount[] | null; + /** + * The list of references to service charges applied to this line item. Each + * `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a + * top-level `OrderServiceCharge` applied to the line item. On reads, the amount applied is + * populated. + * + * To change the amount of a service charge, modify the referenced top-level service charge. + */ + appliedServiceCharges?: Square.OrderLineItemAppliedServiceCharge[] | null; + /** The base price for a single unit of the line item. */ + basePriceMoney?: Square.Money; + /** + * The total price of all item variations sold in this line item. + * The price is calculated as `base_price_money` multiplied by `quantity`. + * It does not include modifiers. + */ + variationTotalPriceMoney?: Square.Money; + /** + * The amount of money made in gross sales for this line item. + * The amount is calculated as the sum of the variation's total price and each modifier's total price. + * For inclusive tax items in the US, Canada, and Japan, tax is deducted from `gross_sales_money`. For Europe and + * Australia, inclusive tax remains as part of the gross sale calculation. + */ + grossSalesMoney?: Square.Money; + /** The total amount of tax money to collect for the line item. */ + totalTaxMoney?: Square.Money; + /** The total amount of discount money to collect for the line item. */ + totalDiscountMoney?: Square.Money; + /** The total amount of money to collect for this line item. */ + totalMoney?: Square.Money; + /** + * Describes pricing adjustments that are blocked from automatic + * application to a line item. For more information, see + * [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). + */ + pricingBlocklists?: Square.OrderLineItemPricingBlocklists; + /** The total amount of apportioned service charge money to collect for the line item. */ + totalServiceChargeMoney?: Square.Money; +} diff --git a/src/api/types/OrderLineItemAppliedDiscount.ts b/src/api/types/OrderLineItemAppliedDiscount.ts new file mode 100644 index 000000000..fca878465 --- /dev/null +++ b/src/api/types/OrderLineItemAppliedDiscount.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an applied portion of a discount to a line item in an order. + * + * Order scoped discounts have automatically applied discounts present for each line item. + * Line-item scoped discounts must have applied discounts added manually for any applicable line + * items. The corresponding applied money is automatically computed based on participating + * line items. + */ +export interface OrderLineItemAppliedDiscount { + /** A unique ID that identifies the applied discount only within this order. */ + uid?: string | null; + /** + * The `uid` of the discount that the applied discount represents. It must + * reference a discount present in the `order.discounts` field. + * + * This field is immutable. To change which discounts apply to a line item, + * you must delete the discount and re-add it as a new `OrderLineItemAppliedDiscount`. + */ + discountUid: string; + /** The amount of money applied by the discount to the line item. */ + appliedMoney?: Square.Money; +} diff --git a/src/api/types/OrderLineItemAppliedServiceCharge.ts b/src/api/types/OrderLineItemAppliedServiceCharge.ts new file mode 100644 index 000000000..a33c341e0 --- /dev/null +++ b/src/api/types/OrderLineItemAppliedServiceCharge.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface OrderLineItemAppliedServiceCharge { + /** A unique ID that identifies the applied service charge only within this order. */ + uid?: string | null; + /** + * The `uid` of the service charge that the applied service charge represents. It must + * reference a service charge present in the `order.service_charges` field. + * + * This field is immutable. To change which service charges apply to a line item, + * delete and add a new `OrderLineItemAppliedServiceCharge`. + */ + serviceChargeUid: string; + /** The amount of money applied by the service charge to the line item. */ + appliedMoney?: Square.Money; +} diff --git a/src/api/types/OrderLineItemAppliedTax.ts b/src/api/types/OrderLineItemAppliedTax.ts new file mode 100644 index 000000000..f858e9670 --- /dev/null +++ b/src/api/types/OrderLineItemAppliedTax.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an applied portion of a tax to a line item in an order. + * + * Order-scoped taxes automatically include the applied taxes in each line item. + * Line item taxes must be referenced from any applicable line items. + * The corresponding applied money is automatically computed, based on the + * set of participating line items. + */ +export interface OrderLineItemAppliedTax { + /** A unique ID that identifies the applied tax only within this order. */ + uid?: string | null; + /** + * The `uid` of the tax for which this applied tax represents. It must reference + * a tax present in the `order.taxes` field. + * + * This field is immutable. To change which taxes apply to a line item, delete and add a new + * `OrderLineItemAppliedTax`. + */ + taxUid: string; + /** The amount of money applied by the tax to the line item. */ + appliedMoney?: Square.Money; +} diff --git a/src/api/types/OrderLineItemDiscount.ts b/src/api/types/OrderLineItemDiscount.ts new file mode 100644 index 000000000..25778f56b --- /dev/null +++ b/src/api/types/OrderLineItemDiscount.ts @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a discount that applies to one or more line items in an + * order. + * + * Fixed-amount, order-scoped discounts are distributed across all non-zero line item totals. + * The amount distributed to each line item is relative to the + * amount contributed by the item to the order subtotal. + */ +export interface OrderLineItemDiscount { + /** A unique ID that identifies the discount only within this order. */ + uid?: string | null; + /** The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). */ + catalogObjectId?: string | null; + /** The version of the catalog object that this discount references. */ + catalogVersion?: bigint | null; + /** The discount's name. */ + name?: string | null; + /** + * The type of the discount. + * + * Discounts that do not reference a catalog object ID must have a type of + * `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. + * See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values + */ + type?: Square.OrderLineItemDiscountType; + /** + * The percentage of the discount, as a string representation of a decimal number. + * A value of `7.25` corresponds to a percentage of 7.25%. + * + * `percentage` is not set for amount-based discounts. + */ + percentage?: string | null; + /** + * The total declared monetary amount of the discount. + * + * `amount_money` is not set for percentage-based discounts. + */ + amountMoney?: Square.Money; + /** + * The amount of discount actually applied to the line item. + * + * The amount represents the amount of money applied as a line-item scoped discount. + * When an amount-based discount is scoped to the entire order, the value + * of `applied_money` is different than `amount_money` because the total + * amount of the discount is distributed across all line items. + */ + appliedMoney?: Square.Money; + /** + * Application-defined data attached to this discount. Metadata fields are intended + * to store descriptive references or associations with an entity in another system or store brief + * information about the object. Square does not process this field; it only stores and returns it + * in relevant API calls. Do not use metadata to store any sensitive information (such as personally + * identifiable information or card details). + * + * Keys written by applications must be 60 characters or less and must be in the character set + * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + * with a namespace, separated from the key with a ':' character. + * + * Values have a maximum length of 255 characters. + * + * An application can have up to 10 entries per metadata field. + * + * Entries written by applications are private and can only be read or modified by the same + * application. + * + * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + */ + metadata?: Record | null; + /** + * Indicates the level at which the discount applies. For `ORDER` scoped discounts, + * Square generates references in `applied_discounts` on all order line items that do + * not have them. For `LINE_ITEM` scoped discounts, the discount only applies to line items + * with a discount reference in their `applied_discounts` field. + * + * This field is immutable. To change the scope of a discount, you must delete + * the discount and re-add it as a new discount. + * See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values + */ + scope?: Square.OrderLineItemDiscountScope; + /** + * The reward IDs corresponding to this discount. The application and + * specification of discounts that have `reward_ids` are completely controlled by the backing + * criteria corresponding to the reward tiers of the rewards that are added to the order + * through the Loyalty API. To manually unapply discounts that are the result of added rewards, + * the rewards must be removed from the order through the Loyalty API. + */ + rewardIds?: string[]; + /** + * The object ID of a [pricing rule](entity:CatalogPricingRule) to be applied + * automatically to this discount. The specification and application of the discounts, to + * which a `pricing_rule_id` is assigned, are completely controlled by the corresponding + * pricing rule. + */ + pricingRuleId?: string; +} diff --git a/src/api/types/OrderLineItemDiscountScope.ts b/src/api/types/OrderLineItemDiscountScope.ts new file mode 100644 index 000000000..404306970 --- /dev/null +++ b/src/api/types/OrderLineItemDiscountScope.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether this is a line-item or order-level discount. + */ +export type OrderLineItemDiscountScope = "OTHER_DISCOUNT_SCOPE" | "LINE_ITEM" | "ORDER"; +export const OrderLineItemDiscountScope = { + OtherDiscountScope: "OTHER_DISCOUNT_SCOPE", + LineItem: "LINE_ITEM", + Order: "ORDER", +} as const; diff --git a/src/api/types/OrderLineItemDiscountType.ts b/src/api/types/OrderLineItemDiscountType.ts new file mode 100644 index 000000000..09a7154db --- /dev/null +++ b/src/api/types/OrderLineItemDiscountType.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates how the discount is applied to the associated line item or order. + */ +export type OrderLineItemDiscountType = + | "UNKNOWN_DISCOUNT" + | "FIXED_PERCENTAGE" + | "FIXED_AMOUNT" + | "VARIABLE_PERCENTAGE" + | "VARIABLE_AMOUNT"; +export const OrderLineItemDiscountType = { + UnknownDiscount: "UNKNOWN_DISCOUNT", + FixedPercentage: "FIXED_PERCENTAGE", + FixedAmount: "FIXED_AMOUNT", + VariablePercentage: "VARIABLE_PERCENTAGE", + VariableAmount: "VARIABLE_AMOUNT", +} as const; diff --git a/src/api/types/OrderLineItemItemType.ts b/src/api/types/OrderLineItemItemType.ts new file mode 100644 index 000000000..f41ab1f62 --- /dev/null +++ b/src/api/types/OrderLineItemItemType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the line item type. + */ +export type OrderLineItemItemType = "ITEM" | "CUSTOM_AMOUNT" | "GIFT_CARD"; +export const OrderLineItemItemType = { + Item: "ITEM", + CustomAmount: "CUSTOM_AMOUNT", + GiftCard: "GIFT_CARD", +} as const; diff --git a/src/api/types/OrderLineItemModifier.ts b/src/api/types/OrderLineItemModifier.ts new file mode 100644 index 000000000..c1c4344b6 --- /dev/null +++ b/src/api/types/OrderLineItemModifier.ts @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A [CatalogModifier](entity:CatalogModifier). + */ +export interface OrderLineItemModifier { + /** A unique ID that identifies the modifier only within this order. */ + uid?: string | null; + /** The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). */ + catalogObjectId?: string | null; + /** The version of the catalog object that this modifier references. */ + catalogVersion?: bigint | null; + /** The name of the item modifier. */ + name?: string | null; + /** + * The quantity of the line item modifier. The modifier quantity can be 0 or more. + * For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders + * this item, the restaurant records the purchase by creating an `Order` object with a line item + * for a burger. The line item includes a line item modifier: the name is cheese and the quantity + * is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses + * the extra cheese option, the modifier quantity increases to 2. If the buyer does not want + * any cheese, the modifier quantity is set to 0. + */ + quantity?: string | null; + /** + * The base price for the modifier. + * + * `base_price_money` is required for ad hoc modifiers. + * If both `catalog_object_id` and `base_price_money` are set, `base_price_money` will + * override the predefined [CatalogModifier](entity:CatalogModifier) price. + */ + basePriceMoney?: Square.Money; + /** + * The total price of the item modifier for its line item. + * This is the modifier's `base_price_money` multiplied by the line item's quantity. + */ + totalPriceMoney?: Square.Money; + /** + * Application-defined data attached to this order. Metadata fields are intended + * to store descriptive references or associations with an entity in another system or store brief + * information about the object. Square does not process this field; it only stores and returns it + * in relevant API calls. Do not use metadata to store any sensitive information (such as personally + * identifiable information or card details). + * + * Keys written by applications must be 60 characters or less and must be in the character set + * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + * with a namespace, separated from the key with a ':' character. + * + * Values have a maximum length of 255 characters. + * + * An application can have up to 10 entries per metadata field. + * + * Entries written by applications are private and can only be read or modified by the same + * application. + * + * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + */ + metadata?: Record | null; +} diff --git a/src/api/types/OrderLineItemPricingBlocklists.ts b/src/api/types/OrderLineItemPricingBlocklists.ts new file mode 100644 index 000000000..68ac4f5f9 --- /dev/null +++ b/src/api/types/OrderLineItemPricingBlocklists.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes pricing adjustments that are blocked from automatic + * application to a line item. For more information, see + * [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). + */ +export interface OrderLineItemPricingBlocklists { + /** + * A list of discounts blocked from applying to the line item. + * Discounts can be blocked by the `discount_uid` (for ad hoc discounts) or + * the `discount_catalog_object_id` (for catalog discounts). + */ + blockedDiscounts?: Square.OrderLineItemPricingBlocklistsBlockedDiscount[] | null; + /** + * A list of taxes blocked from applying to the line item. + * Taxes can be blocked by the `tax_uid` (for ad hoc taxes) or + * the `tax_catalog_object_id` (for catalog taxes). + */ + blockedTaxes?: Square.OrderLineItemPricingBlocklistsBlockedTax[] | null; +} diff --git a/src/api/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts b/src/api/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts new file mode 100644 index 000000000..6a89a96d9 --- /dev/null +++ b/src/api/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A discount to block from applying to a line item. The discount must be + * identified by either `discount_uid` or `discount_catalog_object_id`, but not both. + */ +export interface OrderLineItemPricingBlocklistsBlockedDiscount { + /** A unique ID of the `BlockedDiscount` within the order. */ + uid?: string | null; + /** + * The `uid` of the discount that should be blocked. Use this field to block + * ad hoc discounts. For catalog discounts, use the `discount_catalog_object_id` field. + */ + discountUid?: string | null; + /** + * The `catalog_object_id` of the discount that should be blocked. + * Use this field to block catalog discounts. For ad hoc discounts, use the + * `discount_uid` field. + */ + discountCatalogObjectId?: string | null; +} diff --git a/src/api/types/OrderLineItemPricingBlocklistsBlockedTax.ts b/src/api/types/OrderLineItemPricingBlocklistsBlockedTax.ts new file mode 100644 index 000000000..d6fe3da17 --- /dev/null +++ b/src/api/types/OrderLineItemPricingBlocklistsBlockedTax.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A tax to block from applying to a line item. The tax must be + * identified by either `tax_uid` or `tax_catalog_object_id`, but not both. + */ +export interface OrderLineItemPricingBlocklistsBlockedTax { + /** A unique ID of the `BlockedTax` within the order. */ + uid?: string | null; + /** + * The `uid` of the tax that should be blocked. Use this field to block + * ad hoc taxes. For catalog, taxes use the `tax_catalog_object_id` field. + */ + taxUid?: string | null; + /** + * The `catalog_object_id` of the tax that should be blocked. + * Use this field to block catalog taxes. For ad hoc taxes, use the + * `tax_uid` field. + */ + taxCatalogObjectId?: string | null; +} diff --git a/src/api/types/OrderLineItemTax.ts b/src/api/types/OrderLineItemTax.ts new file mode 100644 index 000000000..350cca4f6 --- /dev/null +++ b/src/api/types/OrderLineItemTax.ts @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a tax that applies to one or more line item in the order. + * + * Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals. + * The amount distributed to each line item is relative to the amount the item + * contributes to the order subtotal. + */ +export interface OrderLineItemTax { + /** A unique ID that identifies the tax only within this order. */ + uid?: string | null; + /** The catalog object ID referencing [CatalogTax](entity:CatalogTax). */ + catalogObjectId?: string | null; + /** The version of the catalog object that this tax references. */ + catalogVersion?: bigint | null; + /** The tax's name. */ + name?: string | null; + /** + * Indicates the calculation method used to apply the tax. + * See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values + */ + type?: Square.OrderLineItemTaxType; + /** + * The percentage of the tax, as a string representation of a decimal + * number. For example, a value of `"7.25"` corresponds to a percentage of + * 7.25%. + */ + percentage?: string | null; + /** + * Application-defined data attached to this tax. Metadata fields are intended + * to store descriptive references or associations with an entity in another system or store brief + * information about the object. Square does not process this field; it only stores and returns it + * in relevant API calls. Do not use metadata to store any sensitive information (such as personally + * identifiable information or card details). + * + * Keys written by applications must be 60 characters or less and must be in the character set + * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + * with a namespace, separated from the key with a ':' character. + * + * Values have a maximum length of 255 characters. + * + * An application can have up to 10 entries per metadata field. + * + * Entries written by applications are private and can only be read or modified by the same + * application. + * + * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + */ + metadata?: Record | null; + /** + * The amount of money applied to the order by the tax. + * + * - For percentage-based taxes, `applied_money` is the money + * calculated using the percentage. + */ + appliedMoney?: Square.Money; + /** + * Indicates the level at which the tax applies. For `ORDER` scoped taxes, + * Square generates references in `applied_taxes` on all order line items that do + * not have them. For `LINE_ITEM` scoped taxes, the tax only applies to line items + * with references in their `applied_taxes` field. + * + * This field is immutable. To change the scope, you must delete the tax and + * re-add it as a new tax. + * See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values + */ + scope?: Square.OrderLineItemTaxScope; + /** + * Determines whether the tax was automatically applied to the order based on + * the catalog configuration. For an example, see + * [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes). + */ + autoApplied?: boolean; +} diff --git a/src/api/types/OrderLineItemTaxScope.ts b/src/api/types/OrderLineItemTaxScope.ts new file mode 100644 index 000000000..64efb16ba --- /dev/null +++ b/src/api/types/OrderLineItemTaxScope.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether this is a line-item or order-level tax. + */ +export type OrderLineItemTaxScope = "OTHER_TAX_SCOPE" | "LINE_ITEM" | "ORDER"; +export const OrderLineItemTaxScope = { + OtherTaxScope: "OTHER_TAX_SCOPE", + LineItem: "LINE_ITEM", + Order: "ORDER", +} as const; diff --git a/src/api/types/OrderLineItemTaxType.ts b/src/api/types/OrderLineItemTaxType.ts new file mode 100644 index 000000000..12143f5b0 --- /dev/null +++ b/src/api/types/OrderLineItemTaxType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates how the tax is applied to the associated line item or order. + */ +export type OrderLineItemTaxType = "UNKNOWN_TAX" | "ADDITIVE" | "INCLUSIVE"; +export const OrderLineItemTaxType = { + UnknownTax: "UNKNOWN_TAX", + Additive: "ADDITIVE", + Inclusive: "INCLUSIVE", +} as const; diff --git a/src/api/types/OrderMoneyAmounts.ts b/src/api/types/OrderMoneyAmounts.ts new file mode 100644 index 000000000..39a9d1a5c --- /dev/null +++ b/src/api/types/OrderMoneyAmounts.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A collection of various money amounts. + */ +export interface OrderMoneyAmounts { + /** The total money. */ + totalMoney?: Square.Money; + /** The money associated with taxes. */ + taxMoney?: Square.Money; + /** The money associated with discounts. */ + discountMoney?: Square.Money; + /** The money associated with tips. */ + tipMoney?: Square.Money; + /** The money associated with service charges. */ + serviceChargeMoney?: Square.Money; +} diff --git a/src/api/types/OrderPricingOptions.ts b/src/api/types/OrderPricingOptions.ts new file mode 100644 index 000000000..b93c380b2 --- /dev/null +++ b/src/api/types/OrderPricingOptions.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Pricing options for an order. The options affect how the order's price is calculated. + * They can be used, for example, to apply automatic price adjustments that are based on preconfigured + * [pricing rules](entity:CatalogPricingRule). + */ +export interface OrderPricingOptions { + /** + * The option to determine whether pricing rule-based + * discounts are automatically applied to an order. + */ + autoApplyDiscounts?: boolean | null; + /** + * The option to determine whether rule-based taxes are automatically + * applied to an order when the criteria of the corresponding rules are met. + */ + autoApplyTaxes?: boolean | null; +} diff --git a/src/api/types/OrderQuantityUnit.ts b/src/api/types/OrderQuantityUnit.ts new file mode 100644 index 000000000..a8a12af82 --- /dev/null +++ b/src/api/types/OrderQuantityUnit.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Contains the measurement unit for a quantity and a precision that + * specifies the number of digits after the decimal point for decimal quantities. + */ +export interface OrderQuantityUnit { + /** + * A [MeasurementUnit](entity:MeasurementUnit) that represents the + * unit of measure for the quantity. + */ + measurementUnit?: Square.MeasurementUnit; + /** + * For non-integer quantities, represents the number of digits after the decimal point that are + * recorded for this quantity. + * + * For example, a precision of 1 allows quantities such as `"1.0"` and `"1.1"`, but not `"1.01"`. + * + * Min: 0. Max: 5. + */ + precision?: number | null; + /** + * The catalog object ID referencing the + * [CatalogMeasurementUnit](entity:CatalogMeasurementUnit). + * + * This field is set when this is a catalog-backed measurement unit. + */ + catalogObjectId?: string | null; + /** + * The version of the catalog object that this measurement unit references. + * + * This field is set when this is a catalog-backed measurement unit. + */ + catalogVersion?: bigint | null; +} diff --git a/src/api/types/OrderReturn.ts b/src/api/types/OrderReturn.ts new file mode 100644 index 000000000..81654aaa2 --- /dev/null +++ b/src/api/types/OrderReturn.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order. + */ +export interface OrderReturn { + /** A unique ID that identifies the return only within this order. */ + uid?: string | null; + /** + * An order that contains the original sale of these return line items. This is unset + * for unlinked returns. + */ + sourceOrderId?: string | null; + /** A collection of line items that are being returned. */ + returnLineItems?: Square.OrderReturnLineItem[] | null; + /** A collection of service charges that are being returned. */ + returnServiceCharges?: Square.OrderReturnServiceCharge[] | null; + /** + * A collection of references to taxes being returned for an order, including the total + * applied tax amount to be returned. The taxes must reference a top-level tax ID from the source + * order. + */ + returnTaxes?: Square.OrderReturnTax[]; + /** + * A collection of references to discounts being returned for an order, including the total + * applied discount amount to be returned. The discounts must reference a top-level discount ID + * from the source order. + */ + returnDiscounts?: Square.OrderReturnDiscount[]; + /** A collection of references to tips being returned for an order. */ + returnTips?: Square.OrderReturnTip[] | null; + /** + * A positive or negative rounding adjustment to the total value being returned. Adjustments are commonly + * used to apply cash rounding when the minimum unit of the account is smaller than the lowest + * physical denomination of the currency. + */ + roundingAdjustment?: Square.OrderRoundingAdjustment; + /** An aggregate monetary value being returned by this return entry. */ + returnAmounts?: Square.OrderMoneyAmounts; +} diff --git a/src/api/types/OrderReturnDiscount.ts b/src/api/types/OrderReturnDiscount.ts new file mode 100644 index 000000000..7df41273b --- /dev/null +++ b/src/api/types/OrderReturnDiscount.ts @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a discount being returned that applies to one or more return line items in an + * order. + * + * Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals. + * The amount distributed to each return line item is relative to that item’s contribution to the + * order subtotal. + */ +export interface OrderReturnDiscount { + /** A unique ID that identifies the returned discount only within this order. */ + uid?: string | null; + /** The discount `uid` from the order that contains the original application of this discount. */ + sourceDiscountUid?: string | null; + /** The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). */ + catalogObjectId?: string | null; + /** The version of the catalog object that this discount references. */ + catalogVersion?: bigint | null; + /** The discount's name. */ + name?: string | null; + /** + * The type of the discount. If it is created by the API, it is `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. + * + * Discounts that do not reference a catalog object ID must have a type of + * `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. + * See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values + */ + type?: Square.OrderLineItemDiscountType; + /** + * The percentage of the tax, as a string representation of a decimal number. + * A value of `"7.25"` corresponds to a percentage of 7.25%. + * + * `percentage` is not set for amount-based discounts. + */ + percentage?: string | null; + /** + * The total declared monetary amount of the discount. + * + * `amount_money` is not set for percentage-based discounts. + */ + amountMoney?: Square.Money; + /** + * The amount of discount actually applied to this line item. When an amount-based + * discount is at the order level, this value is different from `amount_money` because the discount + * is distributed across the line items. + */ + appliedMoney?: Square.Money; + /** + * Indicates the level at which the `OrderReturnDiscount` applies. For `ORDER` scoped + * discounts, the server generates references in `applied_discounts` on all + * `OrderReturnLineItem`s. For `LINE_ITEM` scoped discounts, the discount is only applied to + * `OrderReturnLineItem`s with references in their `applied_discounts` field. + * See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values + */ + scope?: Square.OrderLineItemDiscountScope; +} diff --git a/src/api/types/OrderReturnLineItem.ts b/src/api/types/OrderReturnLineItem.ts new file mode 100644 index 000000000..94f42b8e1 --- /dev/null +++ b/src/api/types/OrderReturnLineItem.ts @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The line item being returned in an order. + */ +export interface OrderReturnLineItem { + /** A unique ID for this return line-item entry. */ + uid?: string | null; + /** The `uid` of the line item in the original sale order. */ + sourceLineItemUid?: string | null; + /** The name of the line item. */ + name?: string | null; + /** + * The quantity returned, formatted as a decimal number. + * For example, `"3"`. + * + * Line items with a `quantity_unit` can have non-integer quantities. + * For example, `"1.70000"`. + */ + quantity: string; + /** The unit and precision that this return line item's quantity is measured in. */ + quantityUnit?: Square.OrderQuantityUnit; + /** The note of the return line item. */ + note?: string | null; + /** The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this return line item. */ + catalogObjectId?: string | null; + /** The version of the catalog object that this line item references. */ + catalogVersion?: bigint | null; + /** The name of the variation applied to this return line item. */ + variationName?: string | null; + /** + * The type of line item: an itemized return, a non-itemized return (custom amount), + * or the return of an unactivated gift card sale. + * See [OrderLineItemItemType](#type-orderlineitemitemtype) for possible values + */ + itemType?: Square.OrderLineItemItemType; + /** The [CatalogModifier](entity:CatalogModifier)s applied to this line item. */ + returnModifiers?: Square.OrderReturnLineItemModifier[] | null; + /** + * The list of references to `OrderReturnTax` entities applied to the return line item. Each + * `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level + * `OrderReturnTax` applied to the return line item. On reads, the applied amount + * is populated. + */ + appliedTaxes?: Square.OrderLineItemAppliedTax[] | null; + /** + * The list of references to `OrderReturnDiscount` entities applied to the return line item. Each + * `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level + * `OrderReturnDiscount` applied to the return line item. On reads, the applied amount + * is populated. + */ + appliedDiscounts?: Square.OrderLineItemAppliedDiscount[] | null; + /** The base price for a single unit of the line item. */ + basePriceMoney?: Square.Money; + /** + * The total price of all item variations returned in this line item. + * The price is calculated as `base_price_money` multiplied by `quantity` and + * does not include modifiers. + */ + variationTotalPriceMoney?: Square.Money; + /** The gross return amount of money calculated as (item base price + modifiers price) * quantity. */ + grossReturnMoney?: Square.Money; + /** The total amount of tax money to return for the line item. */ + totalTaxMoney?: Square.Money; + /** The total amount of discount money to return for the line item. */ + totalDiscountMoney?: Square.Money; + /** The total amount of money to return for this line item. */ + totalMoney?: Square.Money; + /** + * The list of references to `OrderReturnServiceCharge` entities applied to the return + * line item. Each `OrderLineItemAppliedServiceCharge` has a `service_charge_uid` that + * references the `uid` of a top-level `OrderReturnServiceCharge` applied to the return line + * item. On reads, the applied amount is populated. + */ + appliedServiceCharges?: Square.OrderLineItemAppliedServiceCharge[] | null; + /** The total amount of apportioned service charge money to return for the line item. */ + totalServiceChargeMoney?: Square.Money; +} diff --git a/src/api/types/OrderReturnLineItemModifier.ts b/src/api/types/OrderReturnLineItemModifier.ts new file mode 100644 index 000000000..91f5a1fe0 --- /dev/null +++ b/src/api/types/OrderReturnLineItemModifier.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A line item modifier being returned. + */ +export interface OrderReturnLineItemModifier { + /** A unique ID that identifies the return modifier only within this order. */ + uid?: string | null; + /** + * The modifier `uid` from the order's line item that contains the + * original sale of this line item modifier. + */ + sourceModifierUid?: string | null; + /** The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). */ + catalogObjectId?: string | null; + /** The version of the catalog object that this line item modifier references. */ + catalogVersion?: bigint | null; + /** The name of the item modifier. */ + name?: string | null; + /** + * The base price for the modifier. + * + * `base_price_money` is required for ad hoc modifiers. + * If both `catalog_object_id` and `base_price_money` are set, `base_price_money` overrides the predefined [CatalogModifier](entity:CatalogModifier) price. + */ + basePriceMoney?: Square.Money; + /** + * The total price of the item modifier for its line item. + * This is the modifier's `base_price_money` multiplied by the line item's quantity. + */ + totalPriceMoney?: Square.Money; + /** + * The quantity of the line item modifier. The modifier quantity can be 0 or more. + * For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders + * this item, the restaurant records the purchase by creating an `Order` object with a line item + * for a burger. The line item includes a line item modifier: the name is cheese and the quantity + * is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses + * the extra cheese option, the modifier quantity increases to 2. If the buyer does not want + * any cheese, the modifier quantity is set to 0. + */ + quantity?: string | null; +} diff --git a/src/api/types/OrderReturnServiceCharge.ts b/src/api/types/OrderReturnServiceCharge.ts new file mode 100644 index 000000000..6e55c018a --- /dev/null +++ b/src/api/types/OrderReturnServiceCharge.ts @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the service charge applied to the original order. + */ +export interface OrderReturnServiceCharge { + /** A unique ID that identifies the return service charge only within this order. */ + uid?: string | null; + /** + * The service charge `uid` from the order containing the original + * service charge. `source_service_charge_uid` is `null` for + * unlinked returns. + */ + sourceServiceChargeUid?: string | null; + /** The name of the service charge. */ + name?: string | null; + /** The catalog object ID of the associated [OrderServiceCharge](entity:OrderServiceCharge). */ + catalogObjectId?: string | null; + /** The version of the catalog object that this service charge references. */ + catalogVersion?: bigint | null; + /** + * The percentage of the service charge, as a string representation of + * a decimal number. For example, a value of `"7.25"` corresponds to a + * percentage of 7.25%. + * + * Either `percentage` or `amount_money` should be set, but not both. + */ + percentage?: string | null; + /** + * The amount of a non-percentage-based service charge. + * + * Either `percentage` or `amount_money` should be set, but not both. + */ + amountMoney?: Square.Money; + /** + * The amount of money applied to the order by the service charge, including + * any inclusive tax amounts, as calculated by Square. + * + * - For fixed-amount service charges, `applied_money` is equal to `amount_money`. + * - For percentage-based service charges, `applied_money` is the money calculated using the percentage. + */ + appliedMoney?: Square.Money; + /** + * The total amount of money to collect for the service charge. + * + * __NOTE__: If an inclusive tax is applied to the service charge, `total_money` + * does not equal `applied_money` plus `total_tax_money` because the inclusive + * tax amount is already included in both `applied_money` and `total_tax_money`. + */ + totalMoney?: Square.Money; + /** The total amount of tax money to collect for the service charge. */ + totalTaxMoney?: Square.Money; + /** + * The calculation phase after which to apply the service charge. + * See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values + */ + calculationPhase?: Square.OrderServiceChargeCalculationPhase; + /** + * Indicates whether the surcharge can be taxed. Service charges + * calculated in the `TOTAL_PHASE` cannot be marked as taxable. + */ + taxable?: boolean | null; + /** + * The list of references to `OrderReturnTax` entities applied to the + * `OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid` + * that references the `uid` of a top-level `OrderReturnTax` that is being + * applied to the `OrderReturnServiceCharge`. On reads, the applied amount is + * populated. + */ + appliedTaxes?: Square.OrderLineItemAppliedTax[] | null; + /** + * The treatment type of the service charge. + * See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values + */ + treatmentType?: Square.OrderServiceChargeTreatmentType; + /** + * Indicates the level at which the apportioned service charge applies. For `ORDER` + * scoped service charges, Square generates references in `applied_service_charges` on + * all order line items that do not have them. For `LINE_ITEM` scoped service charges, + * the service charge only applies to line items with a service charge reference in their + * `applied_service_charges` field. + * + * This field is immutable. To change the scope of an apportioned service charge, you must delete + * the apportioned service charge and re-add it as a new apportioned service charge. + * See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values + */ + scope?: Square.OrderServiceChargeScope; +} diff --git a/src/api/types/OrderReturnTax.ts b/src/api/types/OrderReturnTax.ts new file mode 100644 index 000000000..62c7ba5f0 --- /dev/null +++ b/src/api/types/OrderReturnTax.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a tax being returned that applies to one or more return line items in an order. + * + * Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals. + * The amount distributed to each return line item is relative to that item’s contribution to the + * order subtotal. + */ +export interface OrderReturnTax { + /** A unique ID that identifies the returned tax only within this order. */ + uid?: string | null; + /** The tax `uid` from the order that contains the original tax charge. */ + sourceTaxUid?: string | null; + /** The catalog object ID referencing [CatalogTax](entity:CatalogTax). */ + catalogObjectId?: string | null; + /** The version of the catalog object that this tax references. */ + catalogVersion?: bigint | null; + /** The tax's name. */ + name?: string | null; + /** + * Indicates the calculation method used to apply the tax. + * See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values + */ + type?: Square.OrderLineItemTaxType; + /** + * The percentage of the tax, as a string representation of a decimal number. + * For example, a value of `"7.25"` corresponds to a percentage of 7.25%. + */ + percentage?: string | null; + /** The amount of money applied by the tax in an order. */ + appliedMoney?: Square.Money; + /** + * Indicates the level at which the `OrderReturnTax` applies. For `ORDER` scoped + * taxes, Square generates references in `applied_taxes` on all + * `OrderReturnLineItem`s. For `LINE_ITEM` scoped taxes, the tax is only applied to + * `OrderReturnLineItem`s with references in their `applied_discounts` field. + * See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values + */ + scope?: Square.OrderLineItemTaxScope; +} diff --git a/src/api/types/OrderReturnTip.ts b/src/api/types/OrderReturnTip.ts new file mode 100644 index 000000000..3031cee77 --- /dev/null +++ b/src/api/types/OrderReturnTip.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A tip being returned. + */ +export interface OrderReturnTip { + /** A unique ID that identifies the tip only within this order. */ + uid?: string | null; + /** + * The amount of tip being returned + * -- + */ + appliedMoney?: Square.Money; + /** The tender `uid` from the order that contains the original application of this tip. */ + sourceTenderUid?: string | null; + /** The tender `id` from the order that contains the original application of this tip. */ + sourceTenderId?: string | null; +} diff --git a/src/api/types/OrderReward.ts b/src/api/types/OrderReward.ts new file mode 100644 index 000000000..2ee82beb8 --- /dev/null +++ b/src/api/types/OrderReward.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a reward that can be applied to an order if the necessary + * reward tier criteria are met. Rewards are created through the Loyalty API. + */ +export interface OrderReward { + /** The identifier of the reward. */ + id: string; + /** The identifier of the reward tier corresponding to this reward. */ + rewardTierId: string; +} diff --git a/src/api/types/OrderRoundingAdjustment.ts b/src/api/types/OrderRoundingAdjustment.ts new file mode 100644 index 000000000..b14027bf6 --- /dev/null +++ b/src/api/types/OrderRoundingAdjustment.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A rounding adjustment of the money being returned. Commonly used to apply cash rounding + * when the minimum unit of the account is smaller than the lowest physical denomination of the currency. + */ +export interface OrderRoundingAdjustment { + /** A unique ID that identifies the rounding adjustment only within this order. */ + uid?: string | null; + /** The name of the rounding adjustment from the original sale order. */ + name?: string | null; + /** The actual rounding adjustment amount. */ + amountMoney?: Square.Money; +} diff --git a/src/api/types/OrderServiceCharge.ts b/src/api/types/OrderServiceCharge.ts new file mode 100644 index 000000000..bbf802c55 --- /dev/null +++ b/src/api/types/OrderServiceCharge.ts @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a service charge applied to an order. + */ +export interface OrderServiceCharge { + /** A unique ID that identifies the service charge only within this order. */ + uid?: string | null; + /** The name of the service charge. */ + name?: string | null; + /** The catalog object ID referencing the service charge [CatalogObject](entity:CatalogObject). */ + catalogObjectId?: string | null; + /** The version of the catalog object that this service charge references. */ + catalogVersion?: bigint | null; + /** + * The service charge percentage as a string representation of a + * decimal number. For example, `"7.25"` indicates a service charge of 7.25%. + * + * Exactly 1 of `percentage` or `amount_money` should be set. + */ + percentage?: string | null; + /** + * The amount of a non-percentage-based service charge. + * + * Exactly one of `percentage` or `amount_money` should be set. + */ + amountMoney?: Square.Money; + /** + * The amount of money applied to the order by the service charge, + * including any inclusive tax amounts, as calculated by Square. + * + * - For fixed-amount service charges, `applied_money` is equal to `amount_money`. + * - For percentage-based service charges, `applied_money` is the money + * calculated using the percentage. + */ + appliedMoney?: Square.Money; + /** + * The total amount of money to collect for the service charge. + * + * __Note__: If an inclusive tax is applied to the service charge, + * `total_money` does not equal `applied_money` plus `total_tax_money` + * because the inclusive tax amount is already included in both + * `applied_money` and `total_tax_money`. + */ + totalMoney?: Square.Money; + /** The total amount of tax money to collect for the service charge. */ + totalTaxMoney?: Square.Money; + /** + * The calculation phase at which to apply the service charge. + * See [OrderServiceChargeCalculationPhase](#type-orderservicechargecalculationphase) for possible values + */ + calculationPhase?: Square.OrderServiceChargeCalculationPhase; + /** + * Indicates whether the service charge can be taxed. If set to `true`, + * order-level taxes automatically apply to the service charge. Note that + * service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable. + */ + taxable?: boolean | null; + /** + * The list of references to the taxes applied to this service charge. Each + * `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level + * `OrderLineItemTax` that is being applied to this service charge. On reads, the amount applied + * is populated. + * + * An `OrderLineItemAppliedTax` is automatically created on every taxable service charge + * for all `ORDER` scoped taxes that are added to the order. `OrderLineItemAppliedTax` records + * for `LINE_ITEM` scoped taxes must be added in requests for the tax to apply to any taxable + * service charge. Taxable service charges have the `taxable` field set to `true` and calculated + * in the `SUBTOTAL_PHASE`. + * + * To change the amount of a tax, modify the referenced top-level tax. + */ + appliedTaxes?: Square.OrderLineItemAppliedTax[] | null; + /** + * Application-defined data attached to this service charge. Metadata fields are intended + * to store descriptive references or associations with an entity in another system or store brief + * information about the object. Square does not process this field; it only stores and returns it + * in relevant API calls. Do not use metadata to store any sensitive information (such as personally + * identifiable information or card details). + * + * Keys written by applications must be 60 characters or less and must be in the character set + * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed + * with a namespace, separated from the key with a ':' character. + * + * Values have a maximum length of 255 characters. + * + * An application can have up to 10 entries per metadata field. + * + * Entries written by applications are private and can only be read or modified by the same + * application. + * + * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). + */ + metadata?: Record | null; + /** + * The type of the service charge. + * See [OrderServiceChargeType](#type-orderservicechargetype) for possible values + */ + type?: Square.OrderServiceChargeType; + /** + * The treatment type of the service charge. + * See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values + */ + treatmentType?: Square.OrderServiceChargeTreatmentType; + /** + * Indicates the level at which the apportioned service charge applies. For `ORDER` + * scoped service charges, Square generates references in `applied_service_charges` on + * all order line items that do not have them. For `LINE_ITEM` scoped service charges, + * the service charge only applies to line items with a service charge reference in their + * `applied_service_charges` field. + * + * This field is immutable. To change the scope of an apportioned service charge, you must delete + * the apportioned service charge and re-add it as a new apportioned service charge. + * See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values + */ + scope?: Square.OrderServiceChargeScope; +} diff --git a/src/api/types/OrderServiceChargeCalculationPhase.ts b/src/api/types/OrderServiceChargeCalculationPhase.ts new file mode 100644 index 000000000..d267e2ede --- /dev/null +++ b/src/api/types/OrderServiceChargeCalculationPhase.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a phase in the process of calculating order totals. + * Service charges are applied after the indicated phase. + * + * [Read more about how order totals are calculated.](https://developer.squareup.com/docs/orders-api/how-it-works#how-totals-are-calculated) + */ +export type OrderServiceChargeCalculationPhase = + | "SUBTOTAL_PHASE" + | "TOTAL_PHASE" + | "APPORTIONED_PERCENTAGE_PHASE" + | "APPORTIONED_AMOUNT_PHASE"; +export const OrderServiceChargeCalculationPhase = { + SubtotalPhase: "SUBTOTAL_PHASE", + TotalPhase: "TOTAL_PHASE", + ApportionedPercentagePhase: "APPORTIONED_PERCENTAGE_PHASE", + ApportionedAmountPhase: "APPORTIONED_AMOUNT_PHASE", +} as const; diff --git a/src/api/types/OrderServiceChargeScope.ts b/src/api/types/OrderServiceChargeScope.ts new file mode 100644 index 000000000..fdd81f87f --- /dev/null +++ b/src/api/types/OrderServiceChargeScope.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether this is a line-item or order-level apportioned + * service charge. + */ +export type OrderServiceChargeScope = "OTHER_SERVICE_CHARGE_SCOPE" | "LINE_ITEM" | "ORDER"; +export const OrderServiceChargeScope = { + OtherServiceChargeScope: "OTHER_SERVICE_CHARGE_SCOPE", + LineItem: "LINE_ITEM", + Order: "ORDER", +} as const; diff --git a/src/api/types/OrderServiceChargeTreatmentType.ts b/src/api/types/OrderServiceChargeTreatmentType.ts new file mode 100644 index 000000000..212f2d39a --- /dev/null +++ b/src/api/types/OrderServiceChargeTreatmentType.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates whether the service charge will be treated as a value-holding line item or + * apportioned toward a line item. + */ +export type OrderServiceChargeTreatmentType = "LINE_ITEM_TREATMENT" | "APPORTIONED_TREATMENT"; +export const OrderServiceChargeTreatmentType = { + LineItemTreatment: "LINE_ITEM_TREATMENT", + ApportionedTreatment: "APPORTIONED_TREATMENT", +} as const; diff --git a/src/api/types/OrderServiceChargeType.ts b/src/api/types/OrderServiceChargeType.ts new file mode 100644 index 000000000..960b13973 --- /dev/null +++ b/src/api/types/OrderServiceChargeType.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type OrderServiceChargeType = "AUTO_GRATUITY" | "CUSTOM"; +export const OrderServiceChargeType = { + AutoGratuity: "AUTO_GRATUITY", + Custom: "CUSTOM", +} as const; diff --git a/src/api/types/OrderSource.ts b/src/api/types/OrderSource.ts new file mode 100644 index 000000000..c02c1400e --- /dev/null +++ b/src/api/types/OrderSource.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the origination details of an order. + */ +export interface OrderSource { + /** + * The name used to identify the place (physical or digital) that an order originates. + * If unset, the name defaults to the name of the application that created the order. + */ + name?: string | null; +} diff --git a/src/api/types/OrderState.ts b/src/api/types/OrderState.ts new file mode 100644 index 000000000..545810af4 --- /dev/null +++ b/src/api/types/OrderState.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The state of the order. + */ +export type OrderState = "OPEN" | "COMPLETED" | "CANCELED" | "DRAFT"; +export const OrderState = { + Open: "OPEN", + Completed: "COMPLETED", + Canceled: "CANCELED", + Draft: "DRAFT", +} as const; diff --git a/src/api/types/PauseSubscriptionResponse.ts b/src/api/types/PauseSubscriptionResponse.ts new file mode 100644 index 000000000..0a0c66a4d --- /dev/null +++ b/src/api/types/PauseSubscriptionResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response from the + * [PauseSubscription](api-endpoint:Subscriptions-PauseSubscription) endpoint. + */ +export interface PauseSubscriptionResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The subscription to be paused by the scheduled `PAUSE` action. */ + subscription?: Square.Subscription; + /** The list of a `PAUSE` action and a possible `RESUME` action created by the request. */ + actions?: Square.SubscriptionAction[]; +} diff --git a/src/api/types/PayOrderResponse.ts b/src/api/types/PayOrderResponse.ts new file mode 100644 index 000000000..a1618a8f1 --- /dev/null +++ b/src/api/types/PayOrderResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of a request to the + * [PayOrder](api-endpoint:Orders-PayOrder) endpoint. + */ +export interface PayOrderResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The paid, updated [order](entity:Order). */ + order?: Square.Order; +} diff --git a/src/api/types/Payment.ts b/src/api/types/Payment.ts new file mode 100644 index 000000000..e374c606c --- /dev/null +++ b/src/api/types/Payment.ts @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a payment processed by the Square API. + */ +export interface Payment { + /** A unique ID for the payment. */ + id?: string; + /** The timestamp of when the payment was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp of when the payment was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** + * The amount processed for this payment, not including `tip_money`. + * + * The amount is specified in the smallest denomination of the applicable currency (for example, + * US dollar amounts are specified in cents). For more information, see + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + */ + amountMoney?: Square.Money; + /** + * The amount designated as a tip. + * + * This amount is specified in the smallest denomination of the applicable currency (for example, + * US dollar amounts are specified in cents). For more information, see + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + */ + tipMoney?: Square.Money; + /** + * The total amount for the payment, including `amount_money` and `tip_money`. + * This amount is specified in the smallest denomination of the applicable currency (for example, + * US dollar amounts are specified in cents). For more information, see + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + */ + totalMoney?: Square.Money; + /** + * The amount the developer is taking as a fee for facilitating the payment on behalf + * of the seller. This amount is specified in the smallest denomination of the applicable currency + * (for example, US dollar amounts are specified in cents). For more information, + * see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). + * + * The amount cannot be more than 90% of the `total_money` value. + * + * To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required. + * For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). + */ + appFeeMoney?: Square.Money; + /** + * The amount of money approved for this payment. This value may change if Square chooses to + * obtain reauthorization as part of a call to [UpdatePayment](api-endpoint:Payments-UpdatePayment). + */ + approvedMoney?: Square.Money; + /** The processing fees and fee adjustments assessed by Square for this payment. */ + processingFee?: Square.ProcessingFee[]; + /** + * The total amount of the payment refunded to date. + * + * This amount is specified in the smallest denomination of the applicable currency (for example, + * US dollar amounts are specified in cents). + */ + refundedMoney?: Square.Money; + /** Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED. */ + status?: string; + /** + * The duration of time after the payment's creation when Square automatically applies the + * `delay_action` to the payment. This automatic `delay_action` applies only to payments that + * do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the `delay_duration` + * time period. + * + * This field is specified as a time duration, in RFC 3339 format. + * + * Notes: + * This feature is only supported for card payments. + * + * Default: + * + * - Card-present payments: "PT36H" (36 hours) from the creation time. + * - Card-not-present payments: "P7D" (7 days) from the creation time. + */ + delayDuration?: string; + /** + * The action to be applied to the payment when the `delay_duration` has elapsed. + * + * Current values include `CANCEL` and `COMPLETE`. + */ + delayAction?: string | null; + /** + * The read-only timestamp of when the `delay_action` is automatically applied, + * in RFC 3339 format. + * + * Note that this field is calculated by summing the payment's `delay_duration` and `created_at` + * fields. The `created_at` field is generated by Square and might not exactly match the + * time on your local machine. + */ + delayedUntil?: string; + /** + * The source type for this payment. + * + * Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `SQUARE_ACCOUNT`, + * `CASH` and `EXTERNAL`. For information about these payment source types, + * see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). + */ + sourceType?: string; + /** Details about a card payment. These details are only populated if the source_type is `CARD`. */ + cardDetails?: Square.CardPaymentDetails; + /** Details about a cash payment. These details are only populated if the source_type is `CASH`. */ + cashDetails?: Square.CashPaymentDetails; + /** Details about a bank account payment. These details are only populated if the source_type is `BANK_ACCOUNT`. */ + bankAccountDetails?: Square.BankAccountPaymentDetails; + /** + * Details about an external payment. The details are only populated + * if the `source_type` is `EXTERNAL`. + */ + externalDetails?: Square.ExternalPaymentDetails; + /** + * Details about an wallet payment. The details are only populated + * if the `source_type` is `WALLET`. + */ + walletDetails?: Square.DigitalWalletDetails; + /** + * Details about a Buy Now Pay Later payment. The details are only populated + * if the `source_type` is `BUY_NOW_PAY_LATER`. For more information, see + * [Afterpay Payments](https://developer.squareup.com/docs/payments-api/take-payments/afterpay-payments). + */ + buyNowPayLaterDetails?: Square.BuyNowPayLaterDetails; + /** + * Details about a Square Account payment. The details are only populated + * if the `source_type` is `SQUARE_ACCOUNT`. + */ + squareAccountDetails?: Square.SquareAccountDetails; + /** The ID of the location associated with the payment. */ + locationId?: string; + /** The ID of the order associated with the payment. */ + orderId?: string; + /** + * An optional ID that associates the payment with an entity in + * another system. + */ + referenceId?: string; + /** + * The ID of the customer associated with the payment. If the ID is + * not provided in the `CreatePayment` request that was used to create the `Payment`, + * Square may use information in the request + * (such as the billing and shipping address, email address, and payment source) + * to identify a matching customer profile in the Customer Directory. + * If found, the profile ID is used. If a profile is not found, the + * API attempts to create an + * [instant profile](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles). + * If the API cannot create an + * instant profile (either because the seller has disabled it or the + * seller's region prevents creating it), this field remains unset. Note that + * this process is asynchronous and it may take some time before a + * customer ID is added to the payment. + */ + customerId?: string; + /** + * __Deprecated__: Use `Payment.team_member_id` instead. + * + * An optional ID of the employee associated with taking the payment. + */ + employeeId?: string; + /** An optional ID of the [TeamMember](entity:TeamMember) associated with taking the payment. */ + teamMemberId?: string | null; + /** A list of `refund_id`s identifying refunds for the payment. */ + refundIds?: string[]; + /** + * Provides information about the risk associated with the payment, as determined by Square. + * This field is present for payments to sellers that have opted in to receive risk + * evaluations. + */ + riskEvaluation?: Square.RiskEvaluation; + /** An optional ID for a Terminal checkout that is associated with the payment. */ + terminalCheckoutId?: string; + /** The buyer's email address. */ + buyerEmailAddress?: string; + /** The buyer's billing address. */ + billingAddress?: Square.Address; + /** The buyer's shipping address. */ + shippingAddress?: Square.Address; + /** An optional note to include when creating a payment. */ + note?: string; + /** + * Additional payment information that gets added to the customer's card statement + * as part of the statement description. + * + * Note that the `statement_description_identifier` might get truncated on the statement description + * to fit the required information including the Square identifier (SQ *) and the name of the + * seller taking the payment. + */ + statementDescriptionIdentifier?: string; + /** + * Actions that can be performed on this payment: + * - `EDIT_AMOUNT_UP` - The payment amount can be edited up. + * - `EDIT_AMOUNT_DOWN` - The payment amount can be edited down. + * - `EDIT_TIP_AMOUNT_UP` - The tip amount can be edited up. + * - `EDIT_TIP_AMOUNT_DOWN` - The tip amount can be edited down. + * - `EDIT_DELAY_ACTION` - The delay_action can be edited. + */ + capabilities?: string[]; + /** + * The payment's receipt number. + * The field is missing if a payment is canceled. + */ + receiptNumber?: string; + /** + * The URL for the payment's receipt. + * The field is only populated for COMPLETED payments. + */ + receiptUrl?: string; + /** Details about the device that took the payment. */ + deviceDetails?: Square.DeviceDetails; + /** Details about the application that took the payment. */ + applicationDetails?: Square.ApplicationDetails; + /** Whether or not this payment was taken offline. */ + isOfflinePayment?: boolean; + /** Additional information about the payment if it was taken offline. */ + offlinePaymentDetails?: Square.OfflinePaymentDetails; + /** + * Used for optimistic concurrency. This opaque token identifies a specific version of the + * `Payment` object. + */ + versionToken?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityAppFeeRefundDetail.ts b/src/api/types/PaymentBalanceActivityAppFeeRefundDetail.ts new file mode 100644 index 000000000..8ae3e35b9 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityAppFeeRefundDetail.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityAppFeeRefundDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The ID of the refund associated with this activity. */ + refundId?: string | null; + /** The ID of the location of the merchant associated with the payment refund activity */ + locationId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityAppFeeRevenueDetail.ts b/src/api/types/PaymentBalanceActivityAppFeeRevenueDetail.ts new file mode 100644 index 000000000..3365241f6 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityAppFeeRevenueDetail.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityAppFeeRevenueDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The ID of the location of the merchant associated with the payment activity */ + locationId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityAutomaticSavingsDetail.ts b/src/api/types/PaymentBalanceActivityAutomaticSavingsDetail.ts new file mode 100644 index 000000000..d74597394 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityAutomaticSavingsDetail.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityAutomaticSavingsDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The ID of the payout associated with this activity. */ + payoutId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts b/src/api/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts new file mode 100644 index 000000000..2d37f5c08 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityAutomaticSavingsReversedDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The ID of the payout associated with this activity. */ + payoutId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityChargeDetail.ts b/src/api/types/PaymentBalanceActivityChargeDetail.ts new file mode 100644 index 000000000..9c0ebb78b --- /dev/null +++ b/src/api/types/PaymentBalanceActivityChargeDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityChargeDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityDepositFeeDetail.ts b/src/api/types/PaymentBalanceActivityDepositFeeDetail.ts new file mode 100644 index 000000000..1c2b38a39 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityDepositFeeDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityDepositFeeDetail { + /** The ID of the payout that triggered this deposit fee activity. */ + payoutId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityDepositFeeReversedDetail.ts b/src/api/types/PaymentBalanceActivityDepositFeeReversedDetail.ts new file mode 100644 index 000000000..0c14b36ce --- /dev/null +++ b/src/api/types/PaymentBalanceActivityDepositFeeReversedDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityDepositFeeReversedDetail { + /** The ID of the payout that triggered this deposit fee activity. */ + payoutId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityDisputeDetail.ts b/src/api/types/PaymentBalanceActivityDisputeDetail.ts new file mode 100644 index 000000000..d8650ce27 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityDisputeDetail.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityDisputeDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The ID of the dispute associated with this activity. */ + disputeId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityFeeDetail.ts b/src/api/types/PaymentBalanceActivityFeeDetail.ts new file mode 100644 index 000000000..0a718c269 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityFeeDetail.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityFeeDetail { + /** + * The ID of the payment associated with this activity + * This will only be populated when a principal LedgerEntryToken is also populated. + * If the fee is independent (there is no principal LedgerEntryToken) then this will likely not + * be populated. + */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityFreeProcessingDetail.ts b/src/api/types/PaymentBalanceActivityFreeProcessingDetail.ts new file mode 100644 index 000000000..80871927f --- /dev/null +++ b/src/api/types/PaymentBalanceActivityFreeProcessingDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityFreeProcessingDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityHoldAdjustmentDetail.ts b/src/api/types/PaymentBalanceActivityHoldAdjustmentDetail.ts new file mode 100644 index 000000000..cabfda713 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityHoldAdjustmentDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityHoldAdjustmentDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityOpenDisputeDetail.ts b/src/api/types/PaymentBalanceActivityOpenDisputeDetail.ts new file mode 100644 index 000000000..5a6a4e388 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityOpenDisputeDetail.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityOpenDisputeDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The ID of the dispute associated with this activity. */ + disputeId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityOtherAdjustmentDetail.ts b/src/api/types/PaymentBalanceActivityOtherAdjustmentDetail.ts new file mode 100644 index 000000000..9a23c3c21 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityOtherAdjustmentDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityOtherAdjustmentDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityOtherDetail.ts b/src/api/types/PaymentBalanceActivityOtherDetail.ts new file mode 100644 index 000000000..ca0c2015e --- /dev/null +++ b/src/api/types/PaymentBalanceActivityOtherDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityOtherDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityRefundDetail.ts b/src/api/types/PaymentBalanceActivityRefundDetail.ts new file mode 100644 index 000000000..edf5fbeac --- /dev/null +++ b/src/api/types/PaymentBalanceActivityRefundDetail.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityRefundDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The ID of the refund associated with this activity. */ + refundId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts b/src/api/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts new file mode 100644 index 000000000..1264c364b --- /dev/null +++ b/src/api/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityReleaseAdjustmentDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityReserveHoldDetail.ts b/src/api/types/PaymentBalanceActivityReserveHoldDetail.ts new file mode 100644 index 000000000..8aa150e24 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityReserveHoldDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityReserveHoldDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityReserveReleaseDetail.ts b/src/api/types/PaymentBalanceActivityReserveReleaseDetail.ts new file mode 100644 index 000000000..11999dd2d --- /dev/null +++ b/src/api/types/PaymentBalanceActivityReserveReleaseDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityReserveReleaseDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts b/src/api/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts new file mode 100644 index 000000000..faea6cc0a --- /dev/null +++ b/src/api/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivitySquareCapitalPaymentDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts b/src/api/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts new file mode 100644 index 000000000..b906d7614 --- /dev/null +++ b/src/api/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivitySquareCapitalReversedPaymentDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts b/src/api/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts new file mode 100644 index 000000000..16740b83c --- /dev/null +++ b/src/api/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivitySquarePayrollTransferDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts b/src/api/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts new file mode 100644 index 000000000..9746b2c10 --- /dev/null +++ b/src/api/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivitySquarePayrollTransferReversedDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityTaxOnFeeDetail.ts b/src/api/types/PaymentBalanceActivityTaxOnFeeDetail.ts new file mode 100644 index 000000000..b85595f25 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityTaxOnFeeDetail.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityTaxOnFeeDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The description of the tax rate being applied. For example: "GST", "HST". */ + taxRateDescription?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityThirdPartyFeeDetail.ts b/src/api/types/PaymentBalanceActivityThirdPartyFeeDetail.ts new file mode 100644 index 000000000..9f3e4172a --- /dev/null +++ b/src/api/types/PaymentBalanceActivityThirdPartyFeeDetail.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityThirdPartyFeeDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; +} diff --git a/src/api/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts b/src/api/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts new file mode 100644 index 000000000..e84a88472 --- /dev/null +++ b/src/api/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PaymentBalanceActivityThirdPartyFeeRefundDetail { + /** The ID of the payment associated with this activity. */ + paymentId?: string | null; + /** The public refund id associated with this activity. */ + refundId?: string | null; +} diff --git a/src/api/types/PaymentLink.ts b/src/api/types/PaymentLink.ts new file mode 100644 index 000000000..65ddee385 --- /dev/null +++ b/src/api/types/PaymentLink.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface PaymentLink { + /** The Square-assigned ID of the payment link. */ + id?: string; + /** The Square-assigned version number, which is incremented each time an update is committed to the payment link. */ + version: number; + /** + * The optional description of the `payment_link` object. + * It is primarily for use by your application and is not used anywhere. + */ + description?: string | null; + /** The ID of the order associated with the payment link. */ + orderId?: string; + /** + * The checkout options configured for the payment link. + * For more information, see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). + */ + checkoutOptions?: Square.CheckoutOptions; + /** + * Describes buyer data to prepopulate + * on the checkout page. + */ + prePopulatedData?: Square.PrePopulatedData; + /** The shortened URL of the payment link. */ + url?: string; + /** The long URL of the payment link. */ + longUrl?: string; + /** The timestamp when the payment link was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the payment link was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** + * An optional note. After Square processes the payment, this note is added to the + * resulting `Payment`. + */ + paymentNote?: string | null; +} diff --git a/src/api/types/PaymentLinkRelatedResources.ts b/src/api/types/PaymentLinkRelatedResources.ts new file mode 100644 index 000000000..1161d468d --- /dev/null +++ b/src/api/types/PaymentLinkRelatedResources.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface PaymentLinkRelatedResources { + /** The order associated with the payment link. */ + orders?: Square.Order[] | null; + /** The subscription plan associated with the payment link. */ + subscriptionPlans?: Square.CatalogObject[] | null; +} diff --git a/src/api/types/PaymentOptions.ts b/src/api/types/PaymentOptions.ts new file mode 100644 index 000000000..363ee94b7 --- /dev/null +++ b/src/api/types/PaymentOptions.ts @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface PaymentOptions { + /** + * Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically + * `COMPLETED` or left in an `APPROVED` state for later modification. + * + * Default: true + */ + autocomplete?: boolean | null; + /** + * The duration of time after the payment's creation when Square automatically resolves the + * payment. This automatic resolution applies only to payments that do not reach a terminal state + * (`COMPLETED` or `CANCELED`) before the `delay_duration` time period. + * + * This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value + * of 1 minute and a maximum value of 36 hours. This feature is only supported for card payments, + * and all payments will be considered card-present. + * + * This parameter can only be set for a delayed capture payment (`autocomplete=false`). For more + * information, see [Delayed Capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold). + * + * Default: "PT36H" (36 hours) from the creation time + */ + delayDuration?: string | null; + /** + * If set to `true` and charging a Square Gift Card, a payment might be returned with + * `amount_money` equal to less than what was requested. For example, a request for $20 when charging + * a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose + * to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card + * payment. + * + * This parameter can only be set for a delayed capture payment (`autocomplete=false`). + * + * For more information, see [Take Partial Payments](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/partial-payments-with-gift-cards). + * + * Default: false + */ + acceptPartialAuthorization?: boolean | null; + /** + * The action to be applied to the `Payment` when the delay_duration has elapsed. + * The action must be CANCEL or COMPLETE. + * + * The action cannot be set to COMPLETE if an `order_id` is present on the TerminalCheckout. + * + * This parameter can only be set for a delayed capture payment (`autocomplete=false`). For more + * information, see [Delayed Capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold). + * + * Default: CANCEL + * See [DelayAction](#type-delayaction) for possible values + */ + delayAction?: Square.PaymentOptionsDelayAction; +} diff --git a/src/api/types/PaymentOptionsDelayAction.ts b/src/api/types/PaymentOptionsDelayAction.ts new file mode 100644 index 000000000..4b485f015 --- /dev/null +++ b/src/api/types/PaymentOptionsDelayAction.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes the action to be applied to a delayed capture payment when the delay_duration + * has elapsed. + */ +export type PaymentOptionsDelayAction = "CANCEL" | "COMPLETE"; +export const PaymentOptionsDelayAction = { + Cancel: "CANCEL", + Complete: "COMPLETE", +} as const; diff --git a/src/api/types/PaymentRefund.ts b/src/api/types/PaymentRefund.ts new file mode 100644 index 000000000..7118cb959 --- /dev/null +++ b/src/api/types/PaymentRefund.ts @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a refund of a payment made using Square. Contains information about + * the original payment and the amount of money refunded. + */ +export interface PaymentRefund { + /** The unique ID for this refund, generated by Square. */ + id: string; + /** + * The refund's status: + * - `PENDING` - Awaiting approval. + * - `COMPLETED` - Successfully completed. + * - `REJECTED` - The refund was rejected. + * - `FAILED` - An error occurred. + */ + status?: string | null; + /** The location ID associated with the payment this refund is attached to. */ + locationId?: string | null; + /** Flag indicating whether or not the refund is linked to an existing payment in Square. */ + unlinked?: boolean; + /** + * The destination type for this refund. + * + * Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`, + * `EXTERNAL`, and `SQUARE_ACCOUNT`. + */ + destinationType?: string | null; + /** + * Contains information about the refund destination. This field is populated only if + * `destination_id` is defined in the `RefundPayment` request. + */ + destinationDetails?: Square.DestinationDetails; + /** + * The amount of money refunded. This amount is specified in the smallest denomination + * of the applicable currency (for example, US dollar amounts are specified in cents). + */ + amountMoney: Square.Money; + /** + * The amount of money the application developer contributed to help cover the refunded amount. + * This amount is specified in the smallest denomination of the applicable currency (for example, + * US dollar amounts are specified in cents). For more information, see + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + */ + appFeeMoney?: Square.Money; + /** Processing fees and fee adjustments assessed by Square for this refund. */ + processingFee?: Square.ProcessingFee[] | null; + /** The ID of the payment associated with this refund. */ + paymentId?: string | null; + /** The ID of the order associated with the refund. */ + orderId?: string | null; + /** The reason for the refund. */ + reason?: string | null; + /** The timestamp of when the refund was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp of when the refund was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** An optional ID of the team member associated with taking the payment. */ + teamMemberId?: string; + /** An optional ID for a Terminal refund. */ + terminalRefundId?: string; +} diff --git a/src/api/types/PaymentSortField.ts b/src/api/types/PaymentSortField.ts new file mode 100644 index 000000000..40365490a --- /dev/null +++ b/src/api/types/PaymentSortField.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type PaymentSortField = "CREATED_AT" | "OFFLINE_CREATED_AT" | "UPDATED_AT"; +export const PaymentSortField = { + CreatedAt: "CREATED_AT", + OfflineCreatedAt: "OFFLINE_CREATED_AT", + UpdatedAt: "UPDATED_AT", +} as const; diff --git a/src/api/types/Payout.ts b/src/api/types/Payout.ts new file mode 100644 index 000000000..bd8aa5bfe --- /dev/null +++ b/src/api/types/Payout.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * An accounting of the amount owed the seller and record of the actual transfer to their + * external bank account or to the Square balance. + */ +export interface Payout { + /** A unique ID for the payout. */ + id: string; + /** + * Indicates the payout status. + * See [PayoutStatus](#type-payoutstatus) for possible values + */ + status?: Square.PayoutStatus; + /** The ID of the location associated with the payout. */ + locationId: string; + /** The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp of when the payout was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** The amount of money involved in the payout. A positive amount indicates a deposit, and a negative amount indicates a withdrawal. This amount is never zero. */ + amountMoney?: Square.Money; + /** + * Information about the banking destination (such as a bank account, Square checking account, or debit card) + * against which the payout was made. + */ + destination?: Square.Destination; + /** + * The version number, which is incremented each time an update is made to this payout record. + * The version number helps developers receive event notifications or feeds out of order. + */ + version?: number; + /** + * Indicates the payout type. + * See [PayoutType](#type-payouttype) for possible values + */ + type?: Square.PayoutType; + /** A list of transfer fees and any taxes on the fees assessed by Square for this payout. */ + payoutFee?: Square.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; +} diff --git a/src/api/types/PayoutEntry.ts b/src/api/types/PayoutEntry.ts new file mode 100644 index 000000000..50311ca45 --- /dev/null +++ b/src/api/types/PayoutEntry.ts @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity. + * The total amount of the payout will equal the sum of the payout entries for a batch payout + */ +export interface PayoutEntry { + /** A unique ID for the payout entry. */ + id: string; + /** The ID of the payout entries’ associated payout. */ + payoutId: string; + /** The timestamp of when the payout entry affected the balance, in RFC 3339 format. */ + effectiveAt?: string | null; + /** + * The type of activity associated with this payout entry. + * See [ActivityType](#type-activitytype) for possible values + */ + type?: Square.ActivityType; + /** The amount of money involved in this payout entry. */ + grossAmountMoney?: Square.Money; + /** The amount of Square fees associated with this payout entry. */ + feeAmountMoney?: Square.Money; + /** The net proceeds from this transaction after any fees. */ + netAmountMoney?: Square.Money; + /** Details of any developer app fee revenue generated on a payment. */ + typeAppFeeRevenueDetails?: Square.PaymentBalanceActivityAppFeeRevenueDetail; + /** Details of a refund for an app fee on a payment. */ + typeAppFeeRefundDetails?: Square.PaymentBalanceActivityAppFeeRefundDetail; + /** Details of any automatic transfer from the payment processing balance to the Square Savings account. These are, generally, proportional to the merchant's sales. */ + typeAutomaticSavingsDetails?: Square.PaymentBalanceActivityAutomaticSavingsDetail; + /** Details of any automatic transfer from the Square Savings account back to the processing balance. These are, generally, proportional to the merchant's refunds. */ + typeAutomaticSavingsReversedDetails?: Square.PaymentBalanceActivityAutomaticSavingsReversedDetail; + /** Details of credit card payment captures. */ + typeChargeDetails?: Square.PaymentBalanceActivityChargeDetail; + /** Details of any fees involved with deposits such as for instant deposits. */ + typeDepositFeeDetails?: Square.PaymentBalanceActivityDepositFeeDetail; + /** Details of any reversal or refund of fees involved with deposits such as for instant deposits. */ + typeDepositFeeReversedDetails?: Square.PaymentBalanceActivityDepositFeeReversedDetail; + /** Details of any balance change due to a dispute event. */ + typeDisputeDetails?: Square.PaymentBalanceActivityDisputeDetail; + /** Details of adjustments due to the Square processing fee. */ + typeFeeDetails?: Square.PaymentBalanceActivityFeeDetail; + /** Square offers Free Payments Processing for a variety of business scenarios including seller referral or when Square wants to apologize for a bug, customer service, repricing complication, and so on. This entry represents details of any credit to the merchant for the purposes of Free Processing. */ + typeFreeProcessingDetails?: Square.PaymentBalanceActivityFreeProcessingDetail; + /** Details of any adjustment made by Square related to the holding or releasing of a payment. */ + typeHoldAdjustmentDetails?: Square.PaymentBalanceActivityHoldAdjustmentDetail; + /** Details of any open disputes. */ + typeOpenDisputeDetails?: Square.PaymentBalanceActivityOpenDisputeDetail; + /** Details of any other type that does not belong in the rest of the types. */ + typeOtherDetails?: Square.PaymentBalanceActivityOtherDetail; + /** Details of any other type of adjustments that don't fall under existing types. */ + typeOtherAdjustmentDetails?: Square.PaymentBalanceActivityOtherAdjustmentDetail; + /** Details of a refund for an existing card payment. */ + typeRefundDetails?: Square.PaymentBalanceActivityRefundDetail; + /** Details of fees released for adjustments. */ + typeReleaseAdjustmentDetails?: Square.PaymentBalanceActivityReleaseAdjustmentDetail; + /** Details of fees paid for funding risk reserve. */ + typeReserveHoldDetails?: Square.PaymentBalanceActivityReserveHoldDetail; + /** Details of fees released from risk reserve. */ + typeReserveReleaseDetails?: Square.PaymentBalanceActivityReserveReleaseDetail; + /** Details of capital merchant cash advance (MCA) assessments. These are, generally, proportional to the merchant's sales but may be issued for other reasons related to the MCA. */ + typeSquareCapitalPaymentDetails?: Square.PaymentBalanceActivitySquareCapitalPaymentDetail; + /** Details of capital merchant cash advance (MCA) assessment refunds. These are, generally, proportional to the merchant's refunds but may be issued for other reasons related to the MCA. */ + typeSquareCapitalReversedPaymentDetails?: Square.PaymentBalanceActivitySquareCapitalReversedPaymentDetail; + /** Details of tax paid on fee amounts. */ + typeTaxOnFeeDetails?: Square.PaymentBalanceActivityTaxOnFeeDetail; + /** Details of fees collected by a 3rd party platform. */ + typeThirdPartyFeeDetails?: Square.PaymentBalanceActivityThirdPartyFeeDetail; + /** Details of refunded fees from a 3rd party platform. */ + typeThirdPartyFeeRefundDetails?: Square.PaymentBalanceActivityThirdPartyFeeRefundDetail; + /** Details of a payroll payment that was transferred to a team member’s bank account. */ + typeSquarePayrollTransferDetails?: Square.PaymentBalanceActivitySquarePayrollTransferDetail; + /** Details of a payroll payment to a team member’s bank account that was deposited back to the seller’s account by Square. */ + typeSquarePayrollTransferReversedDetails?: Square.PaymentBalanceActivitySquarePayrollTransferReversedDetail; +} diff --git a/src/api/types/PayoutFee.ts b/src/api/types/PayoutFee.ts new file mode 100644 index 000000000..0535fc9c8 --- /dev/null +++ b/src/api/types/PayoutFee.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a payout fee that can incur as part of a payout. + */ +export interface PayoutFee { + /** The money amount of the payout fee. */ + amountMoney?: Square.Money; + /** The timestamp of when the fee takes effect, in RFC 3339 format. */ + effectiveAt?: string | null; + /** + * The type of fee assessed as part of the payout. + * See [PayoutFeeType](#type-payoutfeetype) for possible values + */ + type?: Square.PayoutFeeType; +} diff --git a/src/api/types/PayoutFeeType.ts b/src/api/types/PayoutFeeType.ts new file mode 100644 index 000000000..ff40804b9 --- /dev/null +++ b/src/api/types/PayoutFeeType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the type of payout fee that can incur as part of a payout. + */ +export type PayoutFeeType = "TRANSFER_FEE" | "TAX_ON_TRANSFER_FEE"; +export const PayoutFeeType = { + TransferFee: "TRANSFER_FEE", + TaxOnTransferFee: "TAX_ON_TRANSFER_FEE", +} as const; diff --git a/src/api/types/PayoutStatus.ts b/src/api/types/PayoutStatus.ts new file mode 100644 index 000000000..47fc558fb --- /dev/null +++ b/src/api/types/PayoutStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Payout status types + */ +export type PayoutStatus = "SENT" | "FAILED" | "PAID"; +export const PayoutStatus = { + Sent: "SENT", + Failed: "FAILED", + Paid: "PAID", +} as const; diff --git a/src/api/types/PayoutType.ts b/src/api/types/PayoutType.ts new file mode 100644 index 000000000..d1a6a078f --- /dev/null +++ b/src/api/types/PayoutType.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * 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. + */ +export type PayoutType = "BATCH" | "SIMPLE"; +export const PayoutType = { + Batch: "BATCH", + Simple: "SIMPLE", +} as const; diff --git a/src/api/types/Phase.ts b/src/api/types/Phase.ts new file mode 100644 index 000000000..f3e728a97 --- /dev/null +++ b/src/api/types/Phase.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * 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?: bigint | null; + /** id of order to be used in billing */ + orderTemplateId?: string | null; + /** the uid from the plan's phase in catalog */ + planPhaseUid?: string | null; +} diff --git a/src/api/types/PhaseInput.ts b/src/api/types/PhaseInput.ts new file mode 100644 index 000000000..6337c2d0c --- /dev/null +++ b/src/api/types/PhaseInput.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the arguments used to construct a new phase. + */ +export interface PhaseInput { + /** index of phase in total subscription plan */ + ordinal: bigint; + /** id of order to be used in billing */ + orderTemplateId?: string | null; +} diff --git a/src/api/types/PrePopulatedData.ts b/src/api/types/PrePopulatedData.ts new file mode 100644 index 000000000..c44aa1414 --- /dev/null +++ b/src/api/types/PrePopulatedData.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes buyer data to prepopulate in the payment form. + * For more information, + * see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). + */ +export interface PrePopulatedData { + /** The buyer email to prepopulate in the payment form. */ + buyerEmail?: string | null; + /** The buyer phone number to prepopulate in the payment form. */ + buyerPhoneNumber?: string | null; + /** The buyer address to prepopulate in the payment form. */ + buyerAddress?: Square.Address; +} diff --git a/src/api/types/ProcessingFee.ts b/src/api/types/ProcessingFee.ts new file mode 100644 index 000000000..cc656115c --- /dev/null +++ b/src/api/types/ProcessingFee.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the Square processing fee. + */ +export interface ProcessingFee { + /** The timestamp of when the fee takes effect, in RFC 3339 format. */ + effectiveAt?: string | null; + /** The type of fee assessed or adjusted. The fee type can be `INITIAL` or `ADJUSTMENT`. */ + type?: string | null; + /** + * The fee amount, which might be negative, that is assessed or adjusted by Square. + * + * Positive values represent funds being assessed, while negative values represent + * funds being returned. + */ + amountMoney?: Square.Money; +} diff --git a/src/api/types/Product.ts b/src/api/types/Product.ts new file mode 100644 index 000000000..4255aff87 --- /dev/null +++ b/src/api/types/Product.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the Square product used to generate a change. + */ +export type Product = + | "SQUARE_POS" + | "EXTERNAL_API" + | "BILLING" + | "APPOINTMENTS" + | "INVOICES" + | "ONLINE_STORE" + | "PAYROLL" + | "DASHBOARD" + | "ITEM_LIBRARY_IMPORT" + | "OTHER"; +export const Product = { + SquarePos: "SQUARE_POS", + ExternalApi: "EXTERNAL_API", + Billing: "BILLING", + Appointments: "APPOINTMENTS", + Invoices: "INVOICES", + OnlineStore: "ONLINE_STORE", + Payroll: "PAYROLL", + Dashboard: "DASHBOARD", + ItemLibraryImport: "ITEM_LIBRARY_IMPORT", + Other: "OTHER", +} as const; diff --git a/src/api/types/ProductType.ts b/src/api/types/ProductType.ts new file mode 100644 index 000000000..8eb954886 --- /dev/null +++ b/src/api/types/ProductType.ts @@ -0,0 +1,5 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type ProductType = "TERMINAL_API"; diff --git a/src/api/types/PublishInvoiceResponse.ts b/src/api/types/PublishInvoiceResponse.ts new file mode 100644 index 000000000..bdbf60710 --- /dev/null +++ b/src/api/types/PublishInvoiceResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes a `PublishInvoice` response. + */ +export interface PublishInvoiceResponse { + /** The published invoice. */ + invoice?: Square.Invoice; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/QrCodeOptions.ts b/src/api/types/QrCodeOptions.ts new file mode 100644 index 000000000..ab7e8b989 --- /dev/null +++ b/src/api/types/QrCodeOptions.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * 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; +} diff --git a/src/api/types/QuickPay.ts b/src/api/types/QuickPay.ts new file mode 100644 index 000000000..f0ac1d1d6 --- /dev/null +++ b/src/api/types/QuickPay.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes an ad hoc item and price to generate a quick pay checkout link. + * For more information, + * see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). + */ +export interface QuickPay { + /** The ad hoc item name. In the resulting `Order`, this name appears as the line item name. */ + name: string; + /** The price of the item. */ + priceMoney: Square.Money; + /** The ID of the business location the checkout is associated with. */ + locationId: string; +} diff --git a/src/api/types/Range.ts b/src/api/types/Range.ts new file mode 100644 index 000000000..041ac1f84 --- /dev/null +++ b/src/api/types/Range.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The range of a number value between the specified lower and upper bounds. + */ +export interface Range { + /** + * The lower bound of the number range. At least one of `min` or `max` must be specified. + * If unspecified, the results will have no minimum value. + */ + min?: string | null; + /** + * The upper bound of the number range. At least one of `min` or `max` must be specified. + * If unspecified, the results will have no maximum value. + */ + max?: string | null; +} diff --git a/src/api/types/ReceiptOptions.ts b/src/api/types/ReceiptOptions.ts new file mode 100644 index 000000000..28a17e87f --- /dev/null +++ b/src/api/types/ReceiptOptions.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes receipt action fields. + */ +export interface ReceiptOptions { + /** The reference to the Square payment ID for the receipt. */ + paymentId: string; + /** + * Instructs the device to print the receipt without displaying the receipt selection screen. + * Requires `printer_enabled` set to true. + * Defaults to false. + */ + printOnly?: boolean | null; + /** + * Identify the receipt as a reprint rather than an original receipt. + * Defaults to false. + */ + isDuplicate?: boolean | null; +} diff --git a/src/api/types/RedeemLoyaltyRewardResponse.ts b/src/api/types/RedeemLoyaltyRewardResponse.ts new file mode 100644 index 000000000..b3233091b --- /dev/null +++ b/src/api/types/RedeemLoyaltyRewardResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that includes the `LoyaltyEvent` published for redeeming the reward. + */ +export interface RedeemLoyaltyRewardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The `LoyaltyEvent` for redeeming the reward. */ + event?: Square.LoyaltyEvent; +} diff --git a/src/api/types/Refund.ts b/src/api/types/Refund.ts new file mode 100644 index 000000000..23a0bd2be --- /dev/null +++ b/src/api/types/Refund.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a refund processed for a Square transaction. + */ +export interface Refund { + /** The refund's unique ID. */ + id: string; + /** The ID of the refund's associated location. */ + locationId: string; + /** The ID of the transaction that the refunded tender is part of. */ + transactionId?: string | null; + /** The ID of the refunded tender. */ + tenderId: string; + /** The timestamp for when the refund was created, in RFC 3339 format. */ + createdAt?: string; + /** The reason for the refund being issued. */ + reason: string; + /** The amount of money refunded to the buyer. */ + amountMoney: Square.Money; + /** + * The current status of the refund (`PENDING`, `APPROVED`, `REJECTED`, + * or `FAILED`). + * See [RefundStatus](#type-refundstatus) for possible values + */ + status: Square.RefundStatus; + /** The amount of Square processing fee money refunded to the *merchant*. */ + processingFeeMoney?: Square.Money; + /** + * Additional recipients (other than the merchant) receiving a portion of this refund. + * For example, fees assessed on a refund of a purchase by a third party integration. + */ + additionalRecipients?: Square.AdditionalRecipient[] | null; +} diff --git a/src/api/types/RefundPaymentResponse.ts b/src/api/types/RefundPaymentResponse.ts new file mode 100644 index 000000000..708d54360 --- /dev/null +++ b/src/api/types/RefundPaymentResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by + * [RefundPayment](api-endpoint:Refunds-RefundPayment). + * + * If there are errors processing the request, the `refund` field might not be + * present, or it might be present with a status of `FAILED`. + */ +export interface RefundPaymentResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The successfully created `PaymentRefund`. */ + refund?: Square.PaymentRefund; +} diff --git a/src/api/types/RefundStatus.ts b/src/api/types/RefundStatus.ts new file mode 100644 index 000000000..b090b92f1 --- /dev/null +++ b/src/api/types/RefundStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates a refund's current status. + */ +export type RefundStatus = "PENDING" | "APPROVED" | "REJECTED" | "FAILED"; +export const RefundStatus = { + Pending: "PENDING", + Approved: "APPROVED", + Rejected: "REJECTED", + Failed: "FAILED", +} as const; diff --git a/src/api/types/RegisterDomainResponse.ts b/src/api/types/RegisterDomainResponse.ts new file mode 100644 index 000000000..840e6d51d --- /dev/null +++ b/src/api/types/RegisterDomainResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [RegisterDomain](api-endpoint:ApplePay-RegisterDomain) endpoint. + * + * Either `errors` or `status` are present in a given response (never both). + */ +export interface RegisterDomainResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The status of the domain registration. + * + * See [RegisterDomainResponseStatus](entity:RegisterDomainResponseStatus) for possible values. + * See [RegisterDomainResponseStatus](#type-registerdomainresponsestatus) for possible values + */ + status?: Square.RegisterDomainResponseStatus; +} diff --git a/src/api/types/RegisterDomainResponseStatus.ts b/src/api/types/RegisterDomainResponseStatus.ts new file mode 100644 index 000000000..06dacbaf9 --- /dev/null +++ b/src/api/types/RegisterDomainResponseStatus.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The status of the domain registration. + */ +export type RegisterDomainResponseStatus = "PENDING" | "VERIFIED"; +export const RegisterDomainResponseStatus = { + Pending: "PENDING", + Verified: "VERIFIED", +} as const; diff --git a/src/api/types/RemoveGroupFromCustomerResponse.ts b/src/api/types/RemoveGroupFromCustomerResponse.ts new file mode 100644 index 000000000..964682649 --- /dev/null +++ b/src/api/types/RemoveGroupFromCustomerResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [RemoveGroupFromCustomer](api-endpoint:Customers-RemoveGroupFromCustomer) + * endpoint. + */ +export interface RemoveGroupFromCustomerResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/ResumeSubscriptionResponse.ts b/src/api/types/ResumeSubscriptionResponse.ts new file mode 100644 index 000000000..286cb12aa --- /dev/null +++ b/src/api/types/ResumeSubscriptionResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response from the + * [ResumeSubscription](api-endpoint:Subscriptions-ResumeSubscription) endpoint. + */ +export interface ResumeSubscriptionResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The resumed subscription. */ + subscription?: Square.Subscription; + /** A list of `RESUME` actions created by the request and scheduled for the subscription. */ + actions?: Square.SubscriptionAction[]; +} diff --git a/src/api/types/RetrieveBookingCustomAttributeDefinitionResponse.ts b/src/api/types/RetrieveBookingCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..a2ba2f0eb --- /dev/null +++ b/src/api/types/RetrieveBookingCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface RetrieveBookingCustomAttributeDefinitionResponse { + /** The retrieved custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveBookingCustomAttributeResponse.ts b/src/api/types/RetrieveBookingCustomAttributeResponse.ts new file mode 100644 index 000000000..0664f5398 --- /dev/null +++ b/src/api/types/RetrieveBookingCustomAttributeResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveBookingCustomAttribute](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttribute) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface RetrieveBookingCustomAttributeResponse { + /** + * The retrieved custom attribute. If `with_definition` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field. + */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveJobResponse.ts b/src/api/types/RetrieveJobResponse.ts new file mode 100644 index 000000000..b7609f394 --- /dev/null +++ b/src/api/types/RetrieveJobResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveJob](api-endpoint:Team-RetrieveJob) response. Either `job` or `errors` + * is present in the response. + */ +export interface RetrieveJobResponse { + /** The retrieved job. */ + job?: Square.Job; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveLocationBookingProfileResponse.ts b/src/api/types/RetrieveLocationBookingProfileResponse.ts new file mode 100644 index 000000000..35e4ae298 --- /dev/null +++ b/src/api/types/RetrieveLocationBookingProfileResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface RetrieveLocationBookingProfileResponse { + /** The requested location booking profile. */ + locationBookingProfile?: Square.LocationBookingProfile; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveLocationCustomAttributeDefinitionResponse.ts b/src/api/types/RetrieveLocationCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..fa2a38bde --- /dev/null +++ b/src/api/types/RetrieveLocationCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface RetrieveLocationCustomAttributeDefinitionResponse { + /** The retrieved custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveLocationCustomAttributeResponse.ts b/src/api/types/RetrieveLocationCustomAttributeResponse.ts new file mode 100644 index 000000000..20f15a340 --- /dev/null +++ b/src/api/types/RetrieveLocationCustomAttributeResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveLocationCustomAttribute](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttribute) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface RetrieveLocationCustomAttributeResponse { + /** + * The retrieved custom attribute. If `with_definition` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field. + */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveLocationSettingsResponse.ts b/src/api/types/RetrieveLocationSettingsResponse.ts new file mode 100644 index 000000000..41432cd77 --- /dev/null +++ b/src/api/types/RetrieveLocationSettingsResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface RetrieveLocationSettingsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The location settings. */ + locationSettings?: Square.CheckoutLocationSettings; +} diff --git a/src/api/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts b/src/api/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..a751ea6df --- /dev/null +++ b/src/api/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface RetrieveMerchantCustomAttributeDefinitionResponse { + /** The retrieved custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveMerchantCustomAttributeResponse.ts b/src/api/types/RetrieveMerchantCustomAttributeResponse.ts new file mode 100644 index 000000000..2db96df0f --- /dev/null +++ b/src/api/types/RetrieveMerchantCustomAttributeResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a [RetrieveMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttribute) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface RetrieveMerchantCustomAttributeResponse { + /** + * The retrieved custom attribute. If `with_definition` was set to `true` in the request, + * the custom attribute definition is returned in the `definition` field. + */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveMerchantSettingsResponse.ts b/src/api/types/RetrieveMerchantSettingsResponse.ts new file mode 100644 index 000000000..2f0065bbe --- /dev/null +++ b/src/api/types/RetrieveMerchantSettingsResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface RetrieveMerchantSettingsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The merchant settings. */ + merchantSettings?: Square.CheckoutMerchantSettings; +} diff --git a/src/api/types/RetrieveOrderCustomAttributeDefinitionResponse.ts b/src/api/types/RetrieveOrderCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..ad84e3d07 --- /dev/null +++ b/src/api/types/RetrieveOrderCustomAttributeDefinitionResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from getting an order custom attribute definition. + */ +export interface RetrieveOrderCustomAttributeDefinitionResponse { + /** The retrieved custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveOrderCustomAttributeResponse.ts b/src/api/types/RetrieveOrderCustomAttributeResponse.ts new file mode 100644 index 000000000..0d8556525 --- /dev/null +++ b/src/api/types/RetrieveOrderCustomAttributeResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from getting an order custom attribute. + */ +export interface RetrieveOrderCustomAttributeResponse { + /** The retrieved custom attribute. If `with_definition` was set to `true` in the request, the custom attribute definition is returned in the `definition field. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RetrieveTokenStatusResponse.ts b/src/api/types/RetrieveTokenStatusResponse.ts new file mode 100644 index 000000000..36f64d7c8 --- /dev/null +++ b/src/api/types/RetrieveTokenStatusResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * 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 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; + /** The ID of the authorizing merchant's business. */ + merchantId?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RevokeTokenResponse.ts b/src/api/types/RevokeTokenResponse.ts new file mode 100644 index 000000000..fe48f8c9e --- /dev/null +++ b/src/api/types/RevokeTokenResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface RevokeTokenResponse { + /** If the request is successful, this is `true`. */ + success?: boolean; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/RiskEvaluation.ts b/src/api/types/RiskEvaluation.ts new file mode 100644 index 000000000..b672456bc --- /dev/null +++ b/src/api/types/RiskEvaluation.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents fraud risk information for the associated payment. + * + * When you take a payment through Square's Payments API (using the `CreatePayment` + * endpoint), Square evaluates it and assigns a risk level to the payment. Sellers + * can use this information to determine the course of action (for example, + * provide the goods/services or refund the payment). + */ +export interface RiskEvaluation { + /** The timestamp when payment risk was evaluated, in RFC 3339 format. */ + createdAt?: string; + /** + * The risk level associated with the payment + * See [RiskEvaluationRiskLevel](#type-riskevaluationrisklevel) for possible values + */ + riskLevel?: Square.RiskEvaluationRiskLevel; +} diff --git a/src/api/types/RiskEvaluationRiskLevel.ts b/src/api/types/RiskEvaluationRiskLevel.ts new file mode 100644 index 000000000..8f693e9b0 --- /dev/null +++ b/src/api/types/RiskEvaluationRiskLevel.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type RiskEvaluationRiskLevel = "PENDING" | "NORMAL" | "MODERATE" | "HIGH"; +export const RiskEvaluationRiskLevel = { + Pending: "PENDING", + Normal: "NORMAL", + Moderate: "MODERATE", + High: "HIGH", +} as const; diff --git a/src/api/types/SaveCardOptions.ts b/src/api/types/SaveCardOptions.ts new file mode 100644 index 000000000..78f8c0223 --- /dev/null +++ b/src/api/types/SaveCardOptions.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes save-card action fields. + */ +export interface SaveCardOptions { + /** The square-assigned ID of the customer linked to the saved card. */ + customerId: string; + /** The id of the created card-on-file. */ + cardId?: string; + /** + * An optional user-defined reference ID that can be used to associate + * this `Card` to another entity in an external system. For example, a customer + * ID generated by a third-party system. + */ + referenceId?: string | null; +} diff --git a/src/api/types/SearchAvailabilityFilter.ts b/src/api/types/SearchAvailabilityFilter.ts new file mode 100644 index 000000000..41099dbd3 --- /dev/null +++ b/src/api/types/SearchAvailabilityFilter.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A query filter to search for buyer-accessible availabilities by. + */ +export interface SearchAvailabilityFilter { + /** + * The query expression to search for buy-accessible availabilities with their starting times falling within the specified time range. + * The time range must be at least 24 hours and at most 32 days long. + * For waitlist availabilities, the time range can be 0 or more up to 367 days long. + */ + startAtRange: Square.TimeRange; + /** + * The query expression to search for buyer-accessible availabilities with their location IDs matching the specified location ID. + * This query expression cannot be set if `booking_id` is set. + */ + locationId?: string | null; + /** + * The query expression to search for buyer-accessible availabilities matching the specified list of segment filters. + * If the size of the `segment_filters` list is `n`, the search returns availabilities with `n` segments per availability. + * + * This query expression cannot be set if `booking_id` is set. + */ + segmentFilters?: Square.SegmentFilter[] | null; + /** + * The query expression to search for buyer-accessible availabilities for an existing booking by matching the specified `booking_id` value. + * This is commonly used to reschedule an appointment. + * If this expression is set, the `location_id` and `segment_filters` expressions cannot be set. + */ + bookingId?: string | null; +} diff --git a/src/api/types/SearchAvailabilityQuery.ts b/src/api/types/SearchAvailabilityQuery.ts new file mode 100644 index 000000000..5314cfebb --- /dev/null +++ b/src/api/types/SearchAvailabilityQuery.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The query used to search for buyer-accessible availabilities of bookings. + */ +export interface SearchAvailabilityQuery { + /** The query filter to search for buyer-accessible availabilities of existing bookings. */ + filter: Square.SearchAvailabilityFilter; +} diff --git a/src/api/types/SearchAvailabilityResponse.ts b/src/api/types/SearchAvailabilityResponse.ts new file mode 100644 index 000000000..a6fafea09 --- /dev/null +++ b/src/api/types/SearchAvailabilityResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface SearchAvailabilityResponse { + /** List of appointment slots available for booking. */ + availabilities?: Square.Availability[]; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/SearchCatalogItemsRequestStockLevel.ts b/src/api/types/SearchCatalogItemsRequestStockLevel.ts new file mode 100644 index 000000000..15c5d8475 --- /dev/null +++ b/src/api/types/SearchCatalogItemsRequestStockLevel.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines supported stock levels of the item inventory. + */ +export type SearchCatalogItemsRequestStockLevel = "OUT" | "LOW"; +export const SearchCatalogItemsRequestStockLevel = { + Out: "OUT", + Low: "LOW", +} as const; diff --git a/src/api/types/SearchCatalogItemsResponse.ts b/src/api/types/SearchCatalogItemsResponse.ts new file mode 100644 index 000000000..71e916d48 --- /dev/null +++ b/src/api/types/SearchCatalogItemsResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response body returned from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint. + */ +export interface SearchCatalogItemsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** Returned items matching the specified query expressions. */ + items?: Square.CatalogObject[]; + /** Pagination token used in the next request to return more of the search result. */ + cursor?: string; + /** Ids of returned item variations matching the specified query expression. */ + matchedVariationIds?: string[]; +} diff --git a/src/api/types/SearchCatalogObjectsResponse.ts b/src/api/types/SearchCatalogObjectsResponse.ts new file mode 100644 index 000000000..daa11c3af --- /dev/null +++ b/src/api/types/SearchCatalogObjectsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface SearchCatalogObjectsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The pagination cursor to be used in a subsequent request. If unset, this is the final response. + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string; + /** The CatalogObjects returned. */ + objects?: Square.CatalogObject[]; + /** A list of CatalogObjects referenced by the objects in the `objects` field. */ + relatedObjects?: Square.CatalogObject[]; + /** + * When the associated product catalog was last updated. Will + * match the value for `end_time` or `cursor` if either field is included in the `SearchCatalog` request. + */ + latestTime?: string; +} diff --git a/src/api/types/SearchCustomersResponse.ts b/src/api/types/SearchCustomersResponse.ts new file mode 100644 index 000000000..5667827f2 --- /dev/null +++ b/src/api/types/SearchCustomersResponse.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the `SearchCustomers` endpoint. + * + * Either `errors` or `customers` is present in a given response (never both). + */ +export interface SearchCustomersResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The customer profiles that match the search query. If any search condition is not met, the result is an empty object (`{}`). + * Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) + * are included in the response. + */ + customers?: Square.Customer[]; + /** + * A pagination cursor that can be used during subsequent calls + * to `SearchCustomers` to retrieve the next set of results associated + * with the original query. Pagination cursors are only present when + * a request succeeds and additional results are available. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** + * The total count of customers associated with the Square account that match the search query. Only customer profiles with + * public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is + * present only if `count` is set to `true` in the request. + */ + count?: bigint; +} diff --git a/src/api/types/SearchEventsFilter.ts b/src/api/types/SearchEventsFilter.ts new file mode 100644 index 000000000..ccbb04b26 --- /dev/null +++ b/src/api/types/SearchEventsFilter.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Criteria to filter events by. + */ +export interface SearchEventsFilter { + /** Filter events by event types. */ + eventTypes?: string[] | null; + /** Filter events by merchant. */ + merchantIds?: string[] | null; + /** Filter events by location. */ + locationIds?: string[] | null; + /** Filter events by when they were created. */ + createdAt?: Square.TimeRange; +} diff --git a/src/api/types/SearchEventsQuery.ts b/src/api/types/SearchEventsQuery.ts new file mode 100644 index 000000000..c4923434d --- /dev/null +++ b/src/api/types/SearchEventsQuery.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Contains query criteria for the search. + */ +export interface SearchEventsQuery { + /** Criteria to filter events by. */ + filter?: Square.SearchEventsFilter; + /** Criteria to sort events by. */ + sort?: Square.SearchEventsSort; +} diff --git a/src/api/types/SearchEventsResponse.ts b/src/api/types/SearchEventsResponse.ts new file mode 100644 index 000000000..d28d5ee28 --- /dev/null +++ b/src/api/types/SearchEventsResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [SearchEvents](api-endpoint:Events-SearchEvents) endpoint. + * + * Note: if there are errors processing the request, the events field will not be + * present. + */ +export interface SearchEventsResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The list of [Event](entity:Event)s returned by the search. */ + events?: Square.Event[]; + /** Contains the metadata of an event. For more information, see [Event](entity:Event). */ + metadata?: Square.EventMetadata[]; + /** + * When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch the next set of events. If empty, this is the final response. + * + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/SearchEventsSort.ts b/src/api/types/SearchEventsSort.ts new file mode 100644 index 000000000..2bedcf9cc --- /dev/null +++ b/src/api/types/SearchEventsSort.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Criteria to sort events by. + */ +export interface SearchEventsSort { + /** + * Sort events by event types. + * See [SearchEventsSortField](#type-searcheventssortfield) for possible values + */ + field?: Square.SearchEventsSortField; + /** + * The order to use for sorting the events. + * See [SortOrder](#type-sortorder) for possible values + */ + order?: Square.SortOrder; +} diff --git a/src/api/types/SearchEventsSortField.ts b/src/api/types/SearchEventsSortField.ts new file mode 100644 index 000000000..7995d34cb --- /dev/null +++ b/src/api/types/SearchEventsSortField.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specifies the sort key for events returned from a search. + */ +export type SearchEventsSortField = "DEFAULT"; diff --git a/src/api/types/SearchInvoicesResponse.ts b/src/api/types/SearchInvoicesResponse.ts new file mode 100644 index 000000000..d8a9d2bd1 --- /dev/null +++ b/src/api/types/SearchInvoicesResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes a `SearchInvoices` response. + */ +export interface SearchInvoicesResponse { + /** The list of invoices returned by the search. */ + invoices?: Square.Invoice[]; + /** + * When a response is truncated, it includes a cursor that you can use in a + * subsequent request to fetch the next set of invoices. If empty, this is the final + * response. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts b/src/api/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts new file mode 100644 index 000000000..01bd91e80 --- /dev/null +++ b/src/api/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The search criteria for the loyalty accounts. + */ +export interface SearchLoyaltyAccountsRequestLoyaltyAccountQuery { + /** + * The set of mappings to use in the loyalty account search. + * + * This cannot be combined with `customer_ids`. + * + * Max: 30 mappings + */ + mappings?: Square.LoyaltyAccountMapping[] | null; + /** + * The set of customer IDs to use in the loyalty account search. + * + * This cannot be combined with `mappings`. + * + * Max: 30 customer IDs + */ + customerIds?: string[] | null; +} diff --git a/src/api/types/SearchLoyaltyAccountsResponse.ts b/src/api/types/SearchLoyaltyAccountsResponse.ts new file mode 100644 index 000000000..e3b9e6ea4 --- /dev/null +++ b/src/api/types/SearchLoyaltyAccountsResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that includes loyalty accounts that satisfy the search criteria. + */ +export interface SearchLoyaltyAccountsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The loyalty accounts that met the search criteria, + * in order of creation date. + */ + loyaltyAccounts?: Square.LoyaltyAccount[]; + /** + * The pagination cursor to use in a subsequent + * request. If empty, this is the final response. + * For more information, + * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/SearchLoyaltyEventsResponse.ts b/src/api/types/SearchLoyaltyEventsResponse.ts new file mode 100644 index 000000000..035520dad --- /dev/null +++ b/src/api/types/SearchLoyaltyEventsResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains loyalty events that satisfy the search + * criteria, in order by the `created_at` date. + */ +export interface SearchLoyaltyEventsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The loyalty events that satisfy the search criteria. */ + events?: Square.LoyaltyEvent[]; + /** + * The pagination cursor to be used in a subsequent + * request. If empty, this is the final response. + * For more information, + * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; +} diff --git a/src/api/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts b/src/api/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts new file mode 100644 index 000000000..387555f18 --- /dev/null +++ b/src/api/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The set of search requirements. + */ +export interface SearchLoyaltyRewardsRequestLoyaltyRewardQuery { + /** The ID of the [loyalty account](entity:LoyaltyAccount) to which the loyalty reward belongs. */ + loyaltyAccountId: string; + /** + * The status of the loyalty reward. + * See [LoyaltyRewardStatus](#type-loyaltyrewardstatus) for possible values + */ + status?: Square.LoyaltyRewardStatus; +} diff --git a/src/api/types/SearchLoyaltyRewardsResponse.ts b/src/api/types/SearchLoyaltyRewardsResponse.ts new file mode 100644 index 000000000..4227870d5 --- /dev/null +++ b/src/api/types/SearchLoyaltyRewardsResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that includes the loyalty rewards satisfying the search criteria. + */ +export interface SearchLoyaltyRewardsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The loyalty rewards that satisfy the search criteria. + * These are returned in descending order by `updated_at`. + */ + rewards?: Square.LoyaltyReward[]; + /** + * The pagination cursor to be used in a subsequent + * request. If empty, this is the final response. + */ + cursor?: string; +} diff --git a/src/api/types/SearchOrdersCustomerFilter.ts b/src/api/types/SearchOrdersCustomerFilter.ts new file mode 100644 index 000000000..167772657 --- /dev/null +++ b/src/api/types/SearchOrdersCustomerFilter.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A filter based on the order `customer_id` and any tender `customer_id` + * associated with the order. It does not filter based on the + * [FulfillmentRecipient](entity:FulfillmentRecipient) `customer_id`. + */ +export interface SearchOrdersCustomerFilter { + /** + * A list of customer IDs to filter by. + * + * Max: 10 customer ids. + */ + customerIds?: string[] | null; +} diff --git a/src/api/types/SearchOrdersDateTimeFilter.ts b/src/api/types/SearchOrdersDateTimeFilter.ts new file mode 100644 index 000000000..8895aee16 --- /dev/null +++ b/src/api/types/SearchOrdersDateTimeFilter.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Filter for `Order` objects based on whether their `CREATED_AT`, + * `CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range. + * You can specify the time range and which timestamp to filter for. You can filter + * for only one time range at a time. + * + * For each time range, the start time and end time are inclusive. If the end time + * is absent, it defaults to the time of the first request for the cursor. + * + * __Important:__ If you use the `DateTimeFilter` in a `SearchOrders` query, + * you must set the `sort_field` in [OrdersSort](entity:SearchOrdersSort) + * to the same field you filter for. For example, if you set the `CLOSED_AT` field + * in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to + * `CLOSED_AT`. Otherwise, `SearchOrders` throws an error. + * [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) + */ +export interface SearchOrdersDateTimeFilter { + /** + * The time range for filtering on the `created_at` timestamp. If you use this + * value, you must set the `sort_field` in the `OrdersSearchSort` object to + * `CREATED_AT`. + */ + createdAt?: Square.TimeRange; + /** + * The time range for filtering on the `updated_at` timestamp. If you use this + * value, you must set the `sort_field` in the `OrdersSearchSort` object to + * `UPDATED_AT`. + */ + updatedAt?: Square.TimeRange; + /** + * The time range for filtering on the `closed_at` timestamp. If you use this + * value, you must set the `sort_field` in the `OrdersSearchSort` object to + * `CLOSED_AT`. + */ + closedAt?: Square.TimeRange; +} diff --git a/src/api/types/SearchOrdersFilter.ts b/src/api/types/SearchOrdersFilter.ts new file mode 100644 index 000000000..f7999cca0 --- /dev/null +++ b/src/api/types/SearchOrdersFilter.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Filtering criteria to use for a `SearchOrders` request. Multiple filters + * are ANDed together. + */ +export interface SearchOrdersFilter { + /** Filter by [OrderState](entity:OrderState). */ + stateFilter?: Square.SearchOrdersStateFilter; + /** + * Filter for results within a time range. + * + * __Important:__ If you filter for orders by time range, you must set `SearchOrdersSort` + * to sort by the same field. + * [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) + */ + dateTimeFilter?: Square.SearchOrdersDateTimeFilter; + /** Filter by the fulfillment type or state. */ + fulfillmentFilter?: Square.SearchOrdersFulfillmentFilter; + /** Filter by the source of the order. */ + sourceFilter?: Square.SearchOrdersSourceFilter; + /** Filter by customers associated with the order. */ + customerFilter?: Square.SearchOrdersCustomerFilter; +} diff --git a/src/api/types/SearchOrdersFulfillmentFilter.ts b/src/api/types/SearchOrdersFulfillmentFilter.ts new file mode 100644 index 000000000..9ba85a337 --- /dev/null +++ b/src/api/types/SearchOrdersFulfillmentFilter.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Filter based on [order fulfillment](entity:Fulfillment) information. + */ +export interface SearchOrdersFulfillmentFilter { + /** + * A list of [fulfillment types](entity:FulfillmentType) to filter + * for. The list returns orders if any of its fulfillments match any of the fulfillment types + * listed in this field. + * See [FulfillmentType](#type-fulfillmenttype) for possible values + */ + fulfillmentTypes?: Square.FulfillmentType[] | null; + /** + * A list of [fulfillment states](entity:FulfillmentState) to filter + * for. The list returns orders if any of its fulfillments match any of the + * fulfillment states listed in this field. + * See [FulfillmentState](#type-fulfillmentstate) for possible values + */ + fulfillmentStates?: Square.FulfillmentState[] | null; +} diff --git a/src/api/types/SearchOrdersQuery.ts b/src/api/types/SearchOrdersQuery.ts new file mode 100644 index 000000000..8e0d23b82 --- /dev/null +++ b/src/api/types/SearchOrdersQuery.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Contains query criteria for the search. + */ +export interface SearchOrdersQuery { + /** Criteria to filter results by. */ + filter?: Square.SearchOrdersFilter; + /** Criteria to sort results by. */ + sort?: Square.SearchOrdersSort; +} diff --git a/src/api/types/SearchOrdersResponse.ts b/src/api/types/SearchOrdersResponse.ts new file mode 100644 index 000000000..750a9606f --- /dev/null +++ b/src/api/types/SearchOrdersResponse.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Either the `order_entries` or `orders` field is set, depending on whether + * `return_entries` is set on the [SearchOrdersRequest](api-endpoint:Orders-SearchOrders). + */ +export interface SearchOrdersResponse { + /** + * A list of [OrderEntries](entity:OrderEntry) that fit the query + * conditions. The list is populated only if `return_entries` is set to `true` in the request. + */ + orderEntries?: Square.OrderEntry[]; + /** + * A list of + * [Order](entity:Order) objects that match the query conditions. The list is populated only if + * `return_entries` is set to `false` in the request. + */ + orders?: Square.Order[]; + /** + * The pagination cursor to be used in a subsequent request. If unset, + * this is the final response. + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). + */ + cursor?: string; + /** [Errors](entity:Error) encountered during the search. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/SearchOrdersSort.ts b/src/api/types/SearchOrdersSort.ts new file mode 100644 index 000000000..a2137e503 --- /dev/null +++ b/src/api/types/SearchOrdersSort.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Sorting criteria for a `SearchOrders` request. Results can only be sorted + * by a timestamp field. + */ +export interface SearchOrdersSort { + /** + * The field to sort by. + * + * __Important:__ When using a [DateTimeFilter](entity:SearchOrdersFilter), + * `sort_field` must match the timestamp field that the `DateTimeFilter` uses to + * filter. For example, if you set your `sort_field` to `CLOSED_AT` and you use a + * `DateTimeFilter`, your `DateTimeFilter` must filter for orders by their `CLOSED_AT` date. + * If this field does not match the timestamp field in `DateTimeFilter`, + * `SearchOrders` returns an error. + * + * Default: `CREATED_AT`. + * See [SearchOrdersSortField](#type-searchorderssortfield) for possible values + */ + sortField: Square.SearchOrdersSortField; + /** + * The chronological order in which results are returned. Defaults to `DESC`. + * See [SortOrder](#type-sortorder) for possible values + */ + sortOrder?: Square.SortOrder; +} diff --git a/src/api/types/SearchOrdersSortField.ts b/src/api/types/SearchOrdersSortField.ts new file mode 100644 index 000000000..54123aa92 --- /dev/null +++ b/src/api/types/SearchOrdersSortField.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specifies which timestamp to use to sort `SearchOrder` results. + */ +export type SearchOrdersSortField = "CREATED_AT" | "UPDATED_AT" | "CLOSED_AT"; +export const SearchOrdersSortField = { + CreatedAt: "CREATED_AT", + UpdatedAt: "UPDATED_AT", + ClosedAt: "CLOSED_AT", +} as const; diff --git a/src/api/types/SearchOrdersSourceFilter.ts b/src/api/types/SearchOrdersSourceFilter.ts new file mode 100644 index 000000000..0b1475c9d --- /dev/null +++ b/src/api/types/SearchOrdersSourceFilter.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A filter based on order `source` information. + */ +export interface SearchOrdersSourceFilter { + /** + * Filters by the [Source](entity:OrderSource) `name`. The filter returns any orders + * with a `source.name` that matches any of the listed source names. + * + * Max: 10 source names. + */ + sourceNames?: string[] | null; +} diff --git a/src/api/types/SearchOrdersStateFilter.ts b/src/api/types/SearchOrdersStateFilter.ts new file mode 100644 index 000000000..fa5759b0b --- /dev/null +++ b/src/api/types/SearchOrdersStateFilter.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Filter by the current order `state`. + */ +export interface SearchOrdersStateFilter { + /** + * States to filter for. + * See [OrderState](#type-orderstate) for possible values + */ + states: Square.OrderState[]; +} diff --git a/src/api/types/SearchShiftsResponse.ts b/src/api/types/SearchShiftsResponse.ts new file mode 100644 index 000000000..427926dc2 --- /dev/null +++ b/src/api/types/SearchShiftsResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request for `Shift` objects. The response contains + * the requested `Shift` objects and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface SearchShiftsResponse { + /** Shifts. */ + shifts?: Square.Shift[]; + /** An opaque cursor for fetching the next page. */ + cursor?: string; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/SearchSubscriptionsFilter.ts b/src/api/types/SearchSubscriptionsFilter.ts new file mode 100644 index 000000000..41b97918d --- /dev/null +++ b/src/api/types/SearchSubscriptionsFilter.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by + * the [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint. + */ +export interface SearchSubscriptionsFilter { + /** A filter to select subscriptions based on the subscribing customer IDs. */ + customerIds?: string[] | null; + /** A filter to select subscriptions based on the location. */ + locationIds?: string[] | null; + /** A filter to select subscriptions based on the source application. */ + sourceNames?: string[] | null; +} diff --git a/src/api/types/SearchSubscriptionsQuery.ts b/src/api/types/SearchSubscriptionsQuery.ts new file mode 100644 index 000000000..224516676 --- /dev/null +++ b/src/api/types/SearchSubscriptionsQuery.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a query, consisting of specified query expressions, used to search for subscriptions. + */ +export interface SearchSubscriptionsQuery { + /** A list of query expressions. */ + filter?: Square.SearchSubscriptionsFilter; +} diff --git a/src/api/types/SearchSubscriptionsResponse.ts b/src/api/types/SearchSubscriptionsResponse.ts new file mode 100644 index 000000000..4e71da01a --- /dev/null +++ b/src/api/types/SearchSubscriptionsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response from the + * [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint. + */ +export interface SearchSubscriptionsResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The subscriptions matching the specified query expressions. */ + subscriptions?: Square.Subscription[]; + /** + * 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). + */ + cursor?: string; +} diff --git a/src/api/types/SearchTeamMembersFilter.ts b/src/api/types/SearchTeamMembersFilter.ts new file mode 100644 index 000000000..c21df9ad8 --- /dev/null +++ b/src/api/types/SearchTeamMembersFilter.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied + * between the individual fields, and `OR` logic is applied within list-based fields. + * For example, setting this filter value: + * ``` + * filter = (locations_ids = ["A", "B"], status = ACTIVE) + * ``` + * returns only active team members assigned to either location "A" or "B". + */ +export interface SearchTeamMembersFilter { + /** + * When present, filters by team members assigned to the specified locations. + * When empty, includes team members assigned to any location. + */ + locationIds?: string[] | null; + /** + * When present, filters by team members who match the given status. + * When empty, includes team members of all statuses. + * See [TeamMemberStatus](#type-teammemberstatus) for possible values + */ + status?: Square.TeamMemberStatus; + /** When present and set to true, returns the team member who is the owner of the Square account. */ + isOwner?: boolean | null; +} diff --git a/src/api/types/SearchTeamMembersQuery.ts b/src/api/types/SearchTeamMembersQuery.ts new file mode 100644 index 000000000..657d67159 --- /dev/null +++ b/src/api/types/SearchTeamMembersQuery.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the parameters in a search for `TeamMember` objects. + */ +export interface SearchTeamMembersQuery { + /** The options to filter by. */ + filter?: Square.SearchTeamMembersFilter; +} diff --git a/src/api/types/SearchTeamMembersResponse.ts b/src/api/types/SearchTeamMembersResponse.ts new file mode 100644 index 000000000..0b84c9c15 --- /dev/null +++ b/src/api/types/SearchTeamMembersResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from a search request containing a filtered list of `TeamMember` objects. + */ +export interface SearchTeamMembersResponse { + /** The filtered list of `TeamMember` objects. */ + teamMembers?: Square.TeamMember[]; + /** + * The opaque cursor for fetching the next page. For more information, see + * [pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + */ + cursor?: string; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/SearchTerminalActionsResponse.ts b/src/api/types/SearchTerminalActionsResponse.ts new file mode 100644 index 000000000..243a6fb58 --- /dev/null +++ b/src/api/types/SearchTerminalActionsResponse.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface SearchTerminalActionsResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested search result of `TerminalAction`s. */ + action?: Square.TerminalAction[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, + * this is the final response. + * + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more + * information. + */ + cursor?: string; +} diff --git a/src/api/types/SearchTerminalCheckoutsResponse.ts b/src/api/types/SearchTerminalCheckoutsResponse.ts new file mode 100644 index 000000000..764c4b2f9 --- /dev/null +++ b/src/api/types/SearchTerminalCheckoutsResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface SearchTerminalCheckoutsResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested search result of `TerminalCheckout` objects. */ + checkouts?: Square.TerminalCheckout[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, + * this is the final response. + * + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string; +} diff --git a/src/api/types/SearchTerminalRefundsResponse.ts b/src/api/types/SearchTerminalRefundsResponse.ts new file mode 100644 index 000000000..0beaece31 --- /dev/null +++ b/src/api/types/SearchTerminalRefundsResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface SearchTerminalRefundsResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The requested search result of `TerminalRefund` objects. */ + refunds?: Square.TerminalRefund[]; + /** + * The pagination cursor to be used in a subsequent request. If empty, + * this is the final response. + * + * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. + */ + cursor?: string; +} diff --git a/src/api/types/SearchVendorsRequestFilter.ts b/src/api/types/SearchVendorsRequestFilter.ts new file mode 100644 index 000000000..973b97569 --- /dev/null +++ b/src/api/types/SearchVendorsRequestFilter.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines supported query expressions to search for vendors by. + */ +export interface SearchVendorsRequestFilter { + /** The names of the [Vendor](entity:Vendor) objects to retrieve. */ + name?: string[] | null; + /** + * The statuses of the [Vendor](entity:Vendor) objects to retrieve. + * See [VendorStatus](#type-vendorstatus) for possible values + */ + status?: Square.VendorStatus[] | null; +} diff --git a/src/api/types/SearchVendorsRequestSort.ts b/src/api/types/SearchVendorsRequestSort.ts new file mode 100644 index 000000000..99caa763d --- /dev/null +++ b/src/api/types/SearchVendorsRequestSort.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines a sorter used to sort results from [SearchVendors](api-endpoint:Vendors-SearchVendors). + */ +export interface SearchVendorsRequestSort { + /** + * Specifies the sort key to sort the returned vendors. + * See [Field](#type-field) for possible values + */ + field?: Square.SearchVendorsRequestSortField; + /** + * Specifies the sort order for the returned vendors. + * See [SortOrder](#type-sortorder) for possible values + */ + order?: Square.SortOrder; +} diff --git a/src/api/types/SearchVendorsRequestSortField.ts b/src/api/types/SearchVendorsRequestSortField.ts new file mode 100644 index 000000000..daa069ea4 --- /dev/null +++ b/src/api/types/SearchVendorsRequestSortField.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The field to sort the returned [Vendor](entity:Vendor) objects by. + */ +export type SearchVendorsRequestSortField = "NAME" | "CREATED_AT"; +export const SearchVendorsRequestSortField = { + Name: "NAME", + CreatedAt: "CREATED_AT", +} as const; diff --git a/src/api/types/SearchVendorsResponse.ts b/src/api/types/SearchVendorsResponse.ts new file mode 100644 index 000000000..3b001cbba --- /dev/null +++ b/src/api/types/SearchVendorsResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an output from a call to [SearchVendors](api-endpoint:Vendors-SearchVendors). + */ +export interface SearchVendorsResponse { + /** Errors encountered when the request fails. */ + errors?: Square.Error_[]; + /** The [Vendor](entity:Vendor) objects matching the specified search filter. */ + vendors?: Square.Vendor[]; + /** + * The pagination cursor to be used in a subsequent request. If unset, + * this is the final response. + * + * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. + */ + cursor?: string; +} diff --git a/src/api/types/SegmentFilter.ts b/src/api/types/SegmentFilter.ts new file mode 100644 index 000000000..65e099271 --- /dev/null +++ b/src/api/types/SegmentFilter.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A query filter to search for buyer-accessible appointment segments by. + */ +export interface SegmentFilter { + /** The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment. */ + serviceVariationId: string; + /** + * A query filter to search for buyer-accessible appointment segments with service-providing team members matching the specified list of team member IDs. Supported query expressions are + * - `ANY`: return the appointment segments with team members whose IDs match any member in this list. + * - `NONE`: return the appointment segments with team members whose IDs are not in this list. + * - `ALL`: not supported. + * + * When no expression is specified, any service-providing team member is eligible to fulfill the Booking. + */ + teamMemberIdFilter?: Square.FilterValue; +} diff --git a/src/api/types/SelectOption.ts b/src/api/types/SelectOption.ts new file mode 100644 index 000000000..2cb33751a --- /dev/null +++ b/src/api/types/SelectOption.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface SelectOption { + /** The reference id for the option. */ + referenceId: string; + /** The title text that displays in the select option button. */ + title: string; +} diff --git a/src/api/types/SelectOptions.ts b/src/api/types/SelectOptions.ts new file mode 100644 index 000000000..26d3b1af5 --- /dev/null +++ b/src/api/types/SelectOptions.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +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: Square.SelectOption[]; + /** The buyer’s selected option. */ + selectedOption?: Square.SelectOption; +} diff --git a/src/api/types/Shift.ts b/src/api/types/Shift.ts new file mode 100644 index 000000000..78a9eb0b5 --- /dev/null +++ b/src/api/types/Shift.ts @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A record of the hourly rate, start, and end times for a single work shift + * for an employee. This might include a record of the start and end times for breaks + * taken during the shift. + */ +export interface Shift { + /** The UUID for this object. */ + id?: string; + /** The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id` instead. */ + employeeId?: string | null; + /** + * The ID of the location this shift occurred at. The location should be based on + * where the employee clocked in. + */ + locationId: string; + /** + * The read-only convenience value that is calculated from the location based + * on the `location_id`. Format: the IANA timezone database identifier for the + * location timezone. + */ + timezone?: string | null; + /** + * RFC 3339; shifted to the location timezone + offset. Precision up to the + * minute is respected; seconds are truncated. + */ + startAt: string; + /** + * RFC 3339; shifted to the timezone + offset. Precision up to the minute is + * respected; seconds are truncated. + */ + endAt?: string | null; + /** + * Job and pay related information. If the wage is not set on create, it defaults to a wage + * of zero. If the title is not set on create, it defaults to the name of the role the employee + * is assigned to, if any. + */ + wage?: Square.ShiftWage; + /** A list of all the paid or unpaid breaks that were taken during this shift. */ + breaks?: Square.Break[] | null; + /** + * Describes the working state of the current `Shift`. + * See [ShiftStatus](#type-shiftstatus) for possible values + */ + status?: Square.ShiftStatus; + /** + * Used for resolving concurrency issues. The request fails if the version + * provided does not match the server version at the time of the request. If not provided, + * Square executes a blind write; potentially overwriting data from another + * write. + */ + version?: number; + /** A read-only timestamp in RFC 3339 format; presented in UTC. */ + createdAt?: string; + /** A read-only timestamp in RFC 3339 format; presented in UTC. */ + updatedAt?: string; + /** The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26". */ + teamMemberId?: string | null; + /** The tips declared by the team member for the shift. */ + declaredCashTipMoney?: Square.Money; +} diff --git a/src/api/types/ShiftFilter.ts b/src/api/types/ShiftFilter.ts new file mode 100644 index 000000000..60ff990a5 --- /dev/null +++ b/src/api/types/ShiftFilter.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines a filter used in a search for `Shift` records. `AND` logic is + * used by Square's servers to apply each filter property specified. + */ +export interface ShiftFilter { + /** Fetch shifts for the specified location. */ + locationIds?: string[] | null; + /** Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead. */ + employeeIds?: string[] | null; + /** + * Fetch a `Shift` instance by `Shift.status`. + * See [ShiftFilterStatus](#type-shiftfilterstatus) for possible values + */ + status?: Square.ShiftFilterStatus; + /** Fetch `Shift` instances that start in the time range - Inclusive. */ + start?: Square.TimeRange; + /** Fetch the `Shift` instances that end in the time range - Inclusive. */ + end?: Square.TimeRange; + /** Fetch the `Shift` instances based on the workday date range. */ + workday?: Square.ShiftWorkday; + /** Fetch shifts for the specified team members. Replaced `employee_ids` at version "2020-08-26". */ + teamMemberIds?: string[] | null; +} diff --git a/src/api/types/ShiftFilterStatus.ts b/src/api/types/ShiftFilterStatus.ts new file mode 100644 index 000000000..2a4298990 --- /dev/null +++ b/src/api/types/ShiftFilterStatus.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Specifies the `status` of `Shift` records to be returned. + */ +export type ShiftFilterStatus = "OPEN" | "CLOSED"; +export const ShiftFilterStatus = { + Open: "OPEN", + Closed: "CLOSED", +} as const; diff --git a/src/api/types/ShiftQuery.ts b/src/api/types/ShiftQuery.ts new file mode 100644 index 000000000..1059e49ea --- /dev/null +++ b/src/api/types/ShiftQuery.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The parameters of a `Shift` search query, which includes filter and sort options. + */ +export interface ShiftQuery { + /** Query filter options. */ + filter?: Square.ShiftFilter; + /** Sort order details. */ + sort?: Square.ShiftSort; +} diff --git a/src/api/types/ShiftSort.ts b/src/api/types/ShiftSort.ts new file mode 100644 index 000000000..1b5399932 --- /dev/null +++ b/src/api/types/ShiftSort.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Sets the sort order of search results. + */ +export interface ShiftSort { + /** + * The field to sort on. + * See [ShiftSortField](#type-shiftsortfield) for possible values + */ + field?: Square.ShiftSortField; + /** + * The order in which results are returned. Defaults to DESC. + * See [SortOrder](#type-sortorder) for possible values + */ + order?: Square.SortOrder; +} diff --git a/src/api/types/ShiftSortField.ts b/src/api/types/ShiftSortField.ts new file mode 100644 index 000000000..b7b38851f --- /dev/null +++ b/src/api/types/ShiftSortField.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enumerates the `Shift` fields to sort on. + */ +export type ShiftSortField = "START_AT" | "END_AT" | "CREATED_AT" | "UPDATED_AT"; +export const ShiftSortField = { + StartAt: "START_AT", + EndAt: "END_AT", + CreatedAt: "CREATED_AT", + UpdatedAt: "UPDATED_AT", +} as const; diff --git a/src/api/types/ShiftStatus.ts b/src/api/types/ShiftStatus.ts new file mode 100644 index 000000000..f3f70e963 --- /dev/null +++ b/src/api/types/ShiftStatus.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enumerates the possible status of a `Shift`. + */ +export type ShiftStatus = "OPEN" | "CLOSED"; +export const ShiftStatus = { + Open: "OPEN", + Closed: "CLOSED", +} as const; diff --git a/src/api/types/ShiftWage.ts b/src/api/types/ShiftWage.ts new file mode 100644 index 000000000..4137736e5 --- /dev/null +++ b/src/api/types/ShiftWage.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The hourly wage rate used to compensate an employee for this shift. + */ +export interface ShiftWage { + /** The name of the job performed during this shift. */ + title?: string | null; + /** + * Can be a custom-set hourly wage or the calculated effective hourly + * wage based on the annual wage and hours worked per week. + */ + hourlyRate?: Square.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; + /** Whether team members are eligible for tips when working this job. */ + tipEligible?: boolean | null; +} diff --git a/src/api/types/ShiftWorkday.ts b/src/api/types/ShiftWorkday.ts new file mode 100644 index 000000000..fa0e9456d --- /dev/null +++ b/src/api/types/ShiftWorkday.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A `Shift` search query filter parameter that sets a range of days that + * a `Shift` must start or end in before passing the filter condition. + */ +export interface ShiftWorkday { + /** Dates for fetching the shifts. */ + dateRange?: Square.DateRange; + /** + * The strategy on which the dates are applied. + * See [ShiftWorkdayMatcher](#type-shiftworkdaymatcher) for possible values + */ + matchShiftsBy?: Square.ShiftWorkdayMatcher; + /** + * Location-specific timezones convert workdays to datetime filters. + * Every location included in the query must have a timezone or this field + * must be provided as a fallback. Format: the IANA timezone database + * identifier for the relevant timezone. + */ + defaultTimezone?: string | null; +} diff --git a/src/api/types/ShiftWorkdayMatcher.ts b/src/api/types/ShiftWorkdayMatcher.ts new file mode 100644 index 000000000..6decb98a7 --- /dev/null +++ b/src/api/types/ShiftWorkdayMatcher.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Defines the logic used to apply a workday filter. + */ +export type ShiftWorkdayMatcher = "START_AT" | "END_AT" | "INTERSECTION"; +export const ShiftWorkdayMatcher = { + StartAt: "START_AT", + EndAt: "END_AT", + Intersection: "INTERSECTION", +} as const; diff --git a/src/api/types/ShippingFee.ts b/src/api/types/ShippingFee.ts new file mode 100644 index 000000000..9418d0a85 --- /dev/null +++ b/src/api/types/ShippingFee.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface ShippingFee { + /** The name for the shipping fee. */ + name?: string | null; + /** The amount and currency for the shipping fee. */ + charge: Square.Money; +} diff --git a/src/api/types/SignatureImage.ts b/src/api/types/SignatureImage.ts new file mode 100644 index 000000000..8147a46eb --- /dev/null +++ b/src/api/types/SignatureImage.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +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; +} diff --git a/src/api/types/SignatureOptions.ts b/src/api/types/SignatureOptions.ts new file mode 100644 index 000000000..0f8c1dd8c --- /dev/null +++ b/src/api/types/SignatureOptions.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +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?: Square.SignatureImage[]; +} diff --git a/src/api/types/Site.ts b/src/api/types/Site.ts new file mode 100644 index 000000000..2980bd188 --- /dev/null +++ b/src/api/types/Site.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a Square Online site, which is an online store for a Square seller. + */ +export interface Site { + /** The Square-assigned ID of the site. */ + id?: string; + /** The title of the site. */ + siteTitle?: string | null; + /** The domain of the site (without the protocol). For example, `mysite1.square.site`. */ + domain?: string | null; + /** Indicates whether the site is published. */ + isPublished?: boolean | null; + /** The timestamp of when the site was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp of when the site was last updated, in RFC 3339 format. */ + updatedAt?: string; +} diff --git a/src/api/types/Snippet.ts b/src/api/types/Snippet.ts new file mode 100644 index 000000000..912e3fd6e --- /dev/null +++ b/src/api/types/Snippet.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. + */ +export interface Snippet { + /** The Square-assigned ID for the snippet. */ + id?: string; + /** The ID of the site that contains the snippet. */ + siteId?: string; + /** The snippet code, which can contain valid HTML, JavaScript, or both. */ + content: string; + /** The timestamp of when the snippet was initially added to the site, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp of when the snippet was last updated on the site, in RFC 3339 format. */ + updatedAt?: string; +} diff --git a/src/api/types/SortOrder.ts b/src/api/types/SortOrder.ts new file mode 100644 index 000000000..8a6aeadfa --- /dev/null +++ b/src/api/types/SortOrder.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The order (e.g., chronological or alphabetical) in which results from a request are returned. + */ +export type SortOrder = "DESC" | "ASC"; +export const SortOrder = { + Desc: "DESC", + Asc: "ASC", +} as const; diff --git a/src/api/types/SourceApplication.ts b/src/api/types/SourceApplication.ts new file mode 100644 index 000000000..5cbddc36b --- /dev/null +++ b/src/api/types/SourceApplication.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents information about the application used to generate a change. + */ +export interface SourceApplication { + /** + * __Read only__ The [product](entity:Product) type of the application. + * See [Product](#type-product) for possible values + */ + product?: Square.Product; + /** + * __Read only__ The Square-assigned ID of the application. This field is used only if the + * [product](entity:Product) type is `EXTERNAL_API`. + */ + applicationId?: string | null; + /** + * __Read only__ The display name of the application + * (for example, `"Custom Application"` or `"Square POS 4.74 for Android"`). + */ + name?: string | null; +} diff --git a/src/api/types/SquareAccountDetails.ts b/src/api/types/SquareAccountDetails.ts new file mode 100644 index 000000000..edacd3d33 --- /dev/null +++ b/src/api/types/SquareAccountDetails.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Additional details about Square Account payments. + */ +export interface SquareAccountDetails { + /** Unique identifier for the payment source used for this payment. */ + paymentSourceToken?: string | null; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[] | null; +} diff --git a/src/api/types/StandardUnitDescription.ts b/src/api/types/StandardUnitDescription.ts new file mode 100644 index 000000000..66e3a9ab2 --- /dev/null +++ b/src/api/types/StandardUnitDescription.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Contains the name and abbreviation for standard measurement unit. + */ +export interface StandardUnitDescription { + /** Identifies the measurement unit being described. */ + unit?: Square.MeasurementUnit; + /** UI display name of the measurement unit. For example, 'Pound'. */ + name?: string | null; + /** UI display abbreviation for the measurement unit. For example, 'lb'. */ + abbreviation?: string | null; +} diff --git a/src/api/types/StandardUnitDescriptionGroup.ts b/src/api/types/StandardUnitDescriptionGroup.ts new file mode 100644 index 000000000..55625e4c6 --- /dev/null +++ b/src/api/types/StandardUnitDescriptionGroup.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Group of standard measurement units. + */ +export interface StandardUnitDescriptionGroup { + /** List of standard (non-custom) measurement units in this description group. */ + standardUnitDescriptions?: Square.StandardUnitDescription[] | null; + /** IETF language tag. */ + languageCode?: string | null; +} diff --git a/src/api/types/SubmitEvidenceResponse.ts b/src/api/types/SubmitEvidenceResponse.ts new file mode 100644 index 000000000..5e647ee24 --- /dev/null +++ b/src/api/types/SubmitEvidenceResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields in a `SubmitEvidence` response. + */ +export interface SubmitEvidenceResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The `Dispute` for which evidence was submitted. */ + dispute?: Square.Dispute; +} diff --git a/src/api/types/Subscription.ts b/src/api/types/Subscription.ts new file mode 100644 index 000000000..8a209bba2 --- /dev/null +++ b/src/api/types/Subscription.ts @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * 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 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. */ + startDate?: string; + /** + * 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. + */ + canceledDate?: string | null; + /** + * The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the + * subscription. + * + * After the invoice is sent for a given billing period, + * this date will be the last day of the billing period. + * For example, + * suppose for the month of May a subscriber gets an invoice + * (or charged the card) on May 1. For the monthly billing scenario, + * this date is then set to May 31. + */ + chargedThroughDate?: string; + /** + * The current status of the subscription. + * See [SubscriptionStatus](#type-subscriptionstatus) for possible values + */ + status?: Square.SubscriptionStatus; + /** + * The tax amount applied 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%. + */ + taxPercentage?: string | null; + /** + * The IDs of the [invoices](entity:Invoice) created for the + * subscription, listed in order when the invoices were created + * (newest invoices appear first). + */ + invoiceIds?: string[]; + /** + * A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing. + * This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead, + * you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates). + */ + priceOverrideMoney?: Square.Money; + /** + * The version of the object. When updating an object, the version + * supplied must match the version in the database, otherwise the write will + * be rejected as conflicting. + */ + version?: bigint; + /** The timestamp when the subscription was created, in RFC 3339 format. */ + createdAt?: string; + /** + * The ID of the [subscriber's](entity:Customer) [card](entity:Card) + * used to charge for the subscription. + */ + cardId?: string | null; + /** + * 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`). + */ + timezone?: string; + /** The origination details of the subscription. */ + source?: Square.SubscriptionSource; + /** + * The list of scheduled actions on this subscription. It is set only in the response from + * [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) with the query parameter + * of `include=actions` or from + * [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) with the input parameter + * of `include:["actions"]`. + */ + actions?: Square.SubscriptionAction[] | null; + /** The day of the month on which the subscription will issue invoices and publish orders. */ + monthlyBillingAnchorDate?: number; + /** array of phases for this subscription */ + phases?: Square.Phase[]; +} diff --git a/src/api/types/SubscriptionAction.ts b/src/api/types/SubscriptionAction.ts new file mode 100644 index 000000000..a9542aced --- /dev/null +++ b/src/api/types/SubscriptionAction.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an action as a pending change to a subscription. + */ +export interface SubscriptionAction { + /** The ID of an action scoped to a subscription. */ + id?: string; + /** + * The type of the action. + * See [SubscriptionActionType](#type-subscriptionactiontype) for possible values + */ + type?: Square.SubscriptionActionType; + /** The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. */ + effectiveDate?: string | null; + /** The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. */ + monthlyBillingAnchorDate?: number | null; + /** A list of Phases, to pass phase-specific information used in the swap. */ + phases?: Square.Phase[] | null; + /** The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action. */ + newPlanVariationId?: string | null; +} diff --git a/src/api/types/SubscriptionActionType.ts b/src/api/types/SubscriptionActionType.ts new file mode 100644 index 000000000..c7e54059d --- /dev/null +++ b/src/api/types/SubscriptionActionType.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported types of an action as a pending change to a subscription. + */ +export type SubscriptionActionType = "CANCEL" | "PAUSE" | "RESUME" | "SWAP_PLAN" | "CHANGE_BILLING_ANCHOR_DATE"; +export const SubscriptionActionType = { + Cancel: "CANCEL", + Pause: "PAUSE", + Resume: "RESUME", + SwapPlan: "SWAP_PLAN", + ChangeBillingAnchorDate: "CHANGE_BILLING_ANCHOR_DATE", +} as const; diff --git a/src/api/types/SubscriptionCadence.ts b/src/api/types/SubscriptionCadence.ts new file mode 100644 index 000000000..3cf285f5f --- /dev/null +++ b/src/api/types/SubscriptionCadence.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Determines the billing cadence of a [Subscription](entity:Subscription) + */ +export type SubscriptionCadence = + | "DAILY" + | "WEEKLY" + | "EVERY_TWO_WEEKS" + | "THIRTY_DAYS" + | "SIXTY_DAYS" + | "NINETY_DAYS" + | "MONTHLY" + | "EVERY_TWO_MONTHS" + | "QUARTERLY" + | "EVERY_FOUR_MONTHS" + | "EVERY_SIX_MONTHS" + | "ANNUAL" + | "EVERY_TWO_YEARS"; +export const SubscriptionCadence = { + Daily: "DAILY", + Weekly: "WEEKLY", + EveryTwoWeeks: "EVERY_TWO_WEEKS", + ThirtyDays: "THIRTY_DAYS", + SixtyDays: "SIXTY_DAYS", + NinetyDays: "NINETY_DAYS", + Monthly: "MONTHLY", + EveryTwoMonths: "EVERY_TWO_MONTHS", + Quarterly: "QUARTERLY", + EveryFourMonths: "EVERY_FOUR_MONTHS", + EverySixMonths: "EVERY_SIX_MONTHS", + Annual: "ANNUAL", + EveryTwoYears: "EVERY_TWO_YEARS", +} as const; diff --git a/src/api/types/SubscriptionEvent.ts b/src/api/types/SubscriptionEvent.ts new file mode 100644 index 000000000..d5e54af48 --- /dev/null +++ b/src/api/types/SubscriptionEvent.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes changes to a subscription and the subscription status. + */ +export interface SubscriptionEvent { + /** The ID of the subscription event. */ + id: string; + /** + * Type of the subscription event. + * See [SubscriptionEventSubscriptionEventType](#type-subscriptioneventsubscriptioneventtype) for possible values + */ + subscriptionEventType: Square.SubscriptionEventSubscriptionEventType; + /** The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred. */ + effectiveDate: string; + /** The day-of-the-month the billing anchor date was changed to, if applicable. */ + monthlyBillingAnchorDate?: number; + /** Additional information about the subscription event. */ + info?: Square.SubscriptionEventInfo; + /** A list of Phases, to pass phase-specific information used in the swap. */ + phases?: Square.Phase[] | null; + /** The ID of the subscription plan variation associated with the subscription. */ + planVariationId: string; +} diff --git a/src/api/types/SubscriptionEventInfo.ts b/src/api/types/SubscriptionEventInfo.ts new file mode 100644 index 000000000..4b46a5784 --- /dev/null +++ b/src/api/types/SubscriptionEventInfo.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Provides information about the subscription event. + */ +export interface SubscriptionEventInfo { + /** A human-readable explanation for the event. */ + detail?: string | null; + /** + * An info code indicating the subscription event that occurred. + * See [InfoCode](#type-infocode) for possible values + */ + code?: Square.SubscriptionEventInfoCode; +} diff --git a/src/api/types/SubscriptionEventInfoCode.ts b/src/api/types/SubscriptionEventInfoCode.ts new file mode 100644 index 000000000..60d6365e8 --- /dev/null +++ b/src/api/types/SubscriptionEventInfoCode.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported info codes of a subscription event. + */ +export type SubscriptionEventInfoCode = + | "LOCATION_NOT_ACTIVE" + | "LOCATION_CANNOT_ACCEPT_PAYMENT" + | "CUSTOMER_DELETED" + | "CUSTOMER_NO_EMAIL" + | "CUSTOMER_NO_NAME" + | "USER_PROVIDED"; +export const SubscriptionEventInfoCode = { + LocationNotActive: "LOCATION_NOT_ACTIVE", + LocationCannotAcceptPayment: "LOCATION_CANNOT_ACCEPT_PAYMENT", + CustomerDeleted: "CUSTOMER_DELETED", + CustomerNoEmail: "CUSTOMER_NO_EMAIL", + CustomerNoName: "CUSTOMER_NO_NAME", + UserProvided: "USER_PROVIDED", +} as const; diff --git a/src/api/types/SubscriptionEventSubscriptionEventType.ts b/src/api/types/SubscriptionEventSubscriptionEventType.ts new file mode 100644 index 000000000..75f229c4a --- /dev/null +++ b/src/api/types/SubscriptionEventSubscriptionEventType.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported types of an event occurred to a subscription. + */ +export type SubscriptionEventSubscriptionEventType = + | "START_SUBSCRIPTION" + | "PLAN_CHANGE" + | "STOP_SUBSCRIPTION" + | "DEACTIVATE_SUBSCRIPTION" + | "RESUME_SUBSCRIPTION" + | "PAUSE_SUBSCRIPTION" + | "BILLING_ANCHOR_DATE_CHANGED"; +export const SubscriptionEventSubscriptionEventType = { + StartSubscription: "START_SUBSCRIPTION", + PlanChange: "PLAN_CHANGE", + StopSubscription: "STOP_SUBSCRIPTION", + DeactivateSubscription: "DEACTIVATE_SUBSCRIPTION", + ResumeSubscription: "RESUME_SUBSCRIPTION", + PauseSubscription: "PAUSE_SUBSCRIPTION", + BillingAnchorDateChanged: "BILLING_ANCHOR_DATE_CHANGED", +} as const; diff --git a/src/api/types/SubscriptionPhase.ts b/src/api/types/SubscriptionPhase.ts new file mode 100644 index 000000000..d12e92001 --- /dev/null +++ b/src/api/types/SubscriptionPhase.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * 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; + /** + * The billing cadence of the phase. For example, weekly or monthly. This field cannot be changed after a `SubscriptionPhase` is created. + * See [SubscriptionCadence](#type-subscriptioncadence) for possible values + */ + cadence: Square.SubscriptionCadence; + /** 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. */ + periods?: number | null; + /** The amount to bill for each `cadence`. Failure to specify this field results in a `MISSING_REQUIRED_PARAMETER` error at runtime. */ + recurringPriceMoney?: Square.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; + /** The subscription pricing. */ + pricing?: Square.SubscriptionPricing; +} diff --git a/src/api/types/SubscriptionPricing.ts b/src/api/types/SubscriptionPricing.ts new file mode 100644 index 000000000..26fdc06f0 --- /dev/null +++ b/src/api/types/SubscriptionPricing.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes the pricing for the subscription. + */ +export interface SubscriptionPricing { + /** + * RELATIVE or STATIC + * See [SubscriptionPricingType](#type-subscriptionpricingtype) for possible values + */ + type?: Square.SubscriptionPricingType; + /** The ids of the discount catalog objects */ + discountIds?: string[] | null; + /** The price of the subscription, if STATIC */ + priceMoney?: Square.Money; +} diff --git a/src/api/types/SubscriptionPricingType.ts b/src/api/types/SubscriptionPricingType.ts new file mode 100644 index 000000000..02e717ce1 --- /dev/null +++ b/src/api/types/SubscriptionPricingType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Determines the pricing of a [Subscription](entity:Subscription) + */ +export type SubscriptionPricingType = "STATIC" | "RELATIVE"; +export const SubscriptionPricingType = { + Static: "STATIC", + Relative: "RELATIVE", +} as const; diff --git a/src/api/types/SubscriptionSource.ts b/src/api/types/SubscriptionSource.ts new file mode 100644 index 000000000..4ca4db7df --- /dev/null +++ b/src/api/types/SubscriptionSource.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The origination details of the subscription. + */ +export interface SubscriptionSource { + /** + * The name used to identify the place (physical or digital) that + * a subscription originates. If unset, the name defaults to the name + * of the application that created the subscription. + */ + name?: string | null; +} diff --git a/src/api/types/SubscriptionStatus.ts b/src/api/types/SubscriptionStatus.ts new file mode 100644 index 000000000..3214410cb --- /dev/null +++ b/src/api/types/SubscriptionStatus.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Supported subscription statuses. + */ +export type SubscriptionStatus = "PENDING" | "ACTIVE" | "CANCELED" | "DEACTIVATED" | "PAUSED"; +export const SubscriptionStatus = { + Pending: "PENDING", + Active: "ACTIVE", + Canceled: "CANCELED", + Deactivated: "DEACTIVATED", + Paused: "PAUSED", +} as const; diff --git a/src/api/types/SubscriptionTestResult.ts b/src/api/types/SubscriptionTestResult.ts new file mode 100644 index 000000000..dcaa70218 --- /dev/null +++ b/src/api/types/SubscriptionTestResult.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the details of a webhook subscription, including notification URL, + * event types, and signature key. + */ +export interface SubscriptionTestResult { + /** A Square-generated unique ID for the subscription test result. */ + id?: string; + /** The status code returned by the subscription notification URL. */ + statusCode?: number | null; + /** An object containing the payload of the test event. For example, a `payment.created` event. */ + payload?: string | null; + /** + * The timestamp of when the subscription was created, in RFC 3339 format. + * For example, "2016-09-04T23:59:33.123Z". + */ + createdAt?: string; + /** + * The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". + * Because a subscription test result is unique, this field is the same as the `created_at` field. + */ + updatedAt?: string; +} diff --git a/src/api/types/SwapPlanResponse.ts b/src/api/types/SwapPlanResponse.ts new file mode 100644 index 000000000..d431f6471 --- /dev/null +++ b/src/api/types/SwapPlanResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response of the + * [SwapPlan](api-endpoint:Subscriptions-SwapPlan) endpoint. + */ +export interface SwapPlanResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The subscription with the updated subscription plan. */ + subscription?: Square.Subscription; + /** A list of a `SWAP_PLAN` action created by the request. */ + actions?: Square.SubscriptionAction[]; +} diff --git a/src/api/types/TaxCalculationPhase.ts b/src/api/types/TaxCalculationPhase.ts new file mode 100644 index 000000000..9627c3bd7 --- /dev/null +++ b/src/api/types/TaxCalculationPhase.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * When to calculate the taxes due on a cart. + */ +export type TaxCalculationPhase = "TAX_SUBTOTAL_PHASE" | "TAX_TOTAL_PHASE"; +export const TaxCalculationPhase = { + TaxSubtotalPhase: "TAX_SUBTOTAL_PHASE", + TaxTotalPhase: "TAX_TOTAL_PHASE", +} as const; diff --git a/src/api/types/TaxIds.ts b/src/api/types/TaxIds.ts new file mode 100644 index 000000000..42ce0d3f6 --- /dev/null +++ b/src/api/types/TaxIds.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Identifiers for the location used by various governments for tax purposes. + */ +export interface TaxIds { + /** + * The EU VAT number for this location. For example, `IE3426675K`. + * If the EU VAT number is present, it is well-formed and has been + * validated with VIES, the VAT Information Exchange System. + */ + euVat?: string; + /** + * The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements) + * number is a 14-digit code issued by the French INSEE. For example, `39922799000021`. + */ + frSiret?: string; + /** + * The French government uses the NAF (Nomenclature des Activités Françaises) to display and + * track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code. + * For example, `6910Z`. + */ + frNaf?: string; + /** + * The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain. + * If it is present, it has been validated. For example, `73628495A`. + */ + esNif?: string; + /** + * The QII (Qualified Invoice Issuer) number is a 14-character tax identifier used in Japan. + * For example, `T1234567890123`. + */ + jpQii?: string; +} diff --git a/src/api/types/TaxInclusionType.ts b/src/api/types/TaxInclusionType.ts new file mode 100644 index 000000000..c9ef446b9 --- /dev/null +++ b/src/api/types/TaxInclusionType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Whether to the tax amount should be additional to or included in the CatalogItem price. + */ +export type TaxInclusionType = "ADDITIVE" | "INCLUSIVE"; +export const TaxInclusionType = { + Additive: "ADDITIVE", + Inclusive: "INCLUSIVE", +} as const; diff --git a/src/api/types/TeamMember.ts b/src/api/types/TeamMember.ts new file mode 100644 index 000000000..b878cb8b5 --- /dev/null +++ b/src/api/types/TeamMember.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A record representing an individual team member for a business. + */ +export interface TeamMember { + /** The unique ID for the team member. */ + id?: string; + /** A second ID used to associate the team member with an entity in another system. */ + referenceId?: string | null; + /** Whether the team member is the owner of the Square account. */ + isOwner?: boolean; + /** + * Describes the status of the team member. + * See [TeamMemberStatus](#type-teammemberstatus) for possible values + */ + status?: Square.TeamMemberStatus; + /** The given name (that is, the first name) associated with the team member. */ + givenName?: string | null; + /** The family name (that is, the last name) associated with the team member. */ + familyName?: string | null; + /** + * The email address associated with the team member. After accepting the invitation + * from Square, only the team member can change this value. + */ + emailAddress?: string | null; + /** + * The team member's phone number, in E.164 format. For example: + * +14155552671 - the country code is 1 for US + * +551155256325 - the country code is 55 for BR + */ + phoneNumber?: string | null; + /** The timestamp when the team member was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the team member was last updated, in RFC 3339 format. */ + updatedAt?: string; + /** Describes the team member's assigned locations. */ + assignedLocations?: Square.TeamMemberAssignedLocations; + /** Information about the team member's overtime exemption status, job assignments, and compensation. */ + wageSetting?: Square.WageSetting; +} diff --git a/src/api/types/TeamMemberAssignedLocations.ts b/src/api/types/TeamMemberAssignedLocations.ts new file mode 100644 index 000000000..c55f08566 --- /dev/null +++ b/src/api/types/TeamMemberAssignedLocations.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * An object that represents a team member's assignment to locations. + */ +export interface TeamMemberAssignedLocations { + /** + * The current assignment type of the team member. + * See [TeamMemberAssignedLocationsAssignmentType](#type-teammemberassignedlocationsassignmenttype) for possible values + */ + assignmentType?: Square.TeamMemberAssignedLocationsAssignmentType; + /** The explicit locations that the team member is assigned to. */ + locationIds?: string[] | null; +} diff --git a/src/api/types/TeamMemberAssignedLocationsAssignmentType.ts b/src/api/types/TeamMemberAssignedLocationsAssignmentType.ts new file mode 100644 index 000000000..599714a16 --- /dev/null +++ b/src/api/types/TeamMemberAssignedLocationsAssignmentType.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enumerates the possible assignment types that the team member can have. + */ +export type TeamMemberAssignedLocationsAssignmentType = "ALL_CURRENT_AND_FUTURE_LOCATIONS" | "EXPLICIT_LOCATIONS"; +export const TeamMemberAssignedLocationsAssignmentType = { + AllCurrentAndFutureLocations: "ALL_CURRENT_AND_FUTURE_LOCATIONS", + ExplicitLocations: "EXPLICIT_LOCATIONS", +} as const; diff --git a/src/api/types/TeamMemberBookingProfile.ts b/src/api/types/TeamMemberBookingProfile.ts new file mode 100644 index 000000000..2ac2d2a8c --- /dev/null +++ b/src/api/types/TeamMemberBookingProfile.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. + */ +export interface TeamMemberBookingProfile { + /** The ID of the [TeamMember](entity:TeamMember) object for the team member associated with the booking profile. */ + teamMemberId?: string; + /** The description of the team member. */ + description?: string; + /** The display name of the team member. */ + displayName?: string; + /** Indicates whether the team member can be booked through the Bookings API or the seller's online booking channel or site (`true`) or not (`false`). */ + isBookable?: boolean | null; + /** The URL of the team member's image for the bookings profile. */ + profileImageUrl?: string; +} diff --git a/src/api/types/TeamMemberStatus.ts b/src/api/types/TeamMemberStatus.ts new file mode 100644 index 000000000..6ad59b666 --- /dev/null +++ b/src/api/types/TeamMemberStatus.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enumerates the possible statuses the team member can have within a business. + */ +export type TeamMemberStatus = "ACTIVE" | "INACTIVE"; +export const TeamMemberStatus = { + Active: "ACTIVE", + Inactive: "INACTIVE", +} as const; diff --git a/src/api/types/TeamMemberWage.ts b/src/api/types/TeamMemberWage.ts new file mode 100644 index 000000000..878dab4d7 --- /dev/null +++ b/src/api/types/TeamMemberWage.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The hourly wage rate that a team member earns on a `Shift` for doing the job + * specified by the `title` property of this object. + */ +export interface TeamMemberWage { + /** The UUID for this object. */ + id?: string; + /** The `TeamMember` that this wage is assigned to. */ + teamMemberId?: string | null; + /** The job title that this wage relates to. */ + title?: string | null; + /** + * Can be a custom-set hourly wage or the calculated effective hourly + * wage based on the annual wage and hours worked per week. + */ + hourlyRate?: Square.Money; + /** + * An identifier for the job that this wage relates to. This cannot be + * used to retrieve the job. + */ + jobId?: string | null; + /** Whether team members are eligible for tips when working this job. */ + tipEligible?: boolean | null; +} diff --git a/src/api/types/Tender.ts b/src/api/types/Tender.ts new file mode 100644 index 000000000..d0b7b1c0a --- /dev/null +++ b/src/api/types/Tender.ts @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a tender (i.e., a method of payment) used in a Square transaction. + */ +export interface Tender { + /** The tender's unique ID. It is the associated payment ID. */ + id?: string; + /** The ID of the transaction's associated location. */ + locationId?: string | null; + /** The ID of the tender's associated transaction. */ + transactionId?: string | null; + /** The timestamp for when the tender was created, in RFC 3339 format. */ + createdAt?: string; + /** An optional note associated with the tender at the time of payment. */ + note?: string | null; + /** + * The total amount of the tender, including `tip_money`. If the tender has a `payment_id`, + * the `total_money` of the corresponding [Payment](entity:Payment) will be equal to the + * `amount_money` of the tender. + */ + amountMoney?: Square.Money; + /** The tip's amount of the tender. */ + tipMoney?: Square.Money; + /** + * The amount of any Square processing fees applied to the tender. + * + * This field is not immediately populated when a new transaction is created. + * It is usually available after about ten seconds. + */ + processingFeeMoney?: Square.Money; + /** + * If the tender is associated with a customer or represents a customer's card on file, + * this is the ID of the associated customer. + */ + customerId?: string | null; + /** + * The type of tender, such as `CARD` or `CASH`. + * See [TenderType](#type-tendertype) for possible values + */ + type: Square.TenderType; + /** + * The details of the card tender. + * + * This value is present only if the value of `type` is `CARD`. + */ + cardDetails?: Square.TenderCardDetails; + /** + * The details of the cash tender. + * + * This value is present only if the value of `type` is `CASH`. + */ + cashDetails?: Square.TenderCashDetails; + /** + * The details of the bank account tender. + * + * This value is present only if the value of `type` is `BANK_ACCOUNT`. + */ + bankAccountDetails?: Square.TenderBankAccountDetails; + /** + * The details of a Buy Now Pay Later tender. + * + * This value is present only if the value of `type` is `BUY_NOW_PAY_LATER`. + */ + buyNowPayLaterDetails?: Square.TenderBuyNowPayLaterDetails; + /** + * The details of a Square Account tender. + * + * This value is present only if the value of `type` is `SQUARE_ACCOUNT`. + */ + squareAccountDetails?: Square.TenderSquareAccountDetails; + /** + * Additional recipients (other than the merchant) receiving a portion of this tender. + * For example, fees assessed on the purchase by a third party integration. + */ + additionalRecipients?: Square.AdditionalRecipient[] | null; + /** + * The ID of the [Payment](entity:Payment) that corresponds to this tender. + * This value is only present for payments created with the v2 Payments API. + */ + paymentId?: string | null; +} diff --git a/src/api/types/TenderBankAccountDetails.ts b/src/api/types/TenderBankAccountDetails.ts new file mode 100644 index 000000000..1199c1800 --- /dev/null +++ b/src/api/types/TenderBankAccountDetails.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the details of a tender with `type` `BANK_ACCOUNT`. + * + * See [BankAccountPaymentDetails](entity:BankAccountPaymentDetails) + * for more exposed details of a bank account payment. + */ +export interface TenderBankAccountDetails { + /** + * The bank account payment's current state. + * + * See [TenderBankAccountPaymentDetailsStatus](entity:TenderBankAccountDetailsStatus) for possible values. + * See [TenderBankAccountDetailsStatus](#type-tenderbankaccountdetailsstatus) for possible values + */ + status?: Square.TenderBankAccountDetailsStatus; +} diff --git a/src/api/types/TenderBankAccountDetailsStatus.ts b/src/api/types/TenderBankAccountDetailsStatus.ts new file mode 100644 index 000000000..ac29a9563 --- /dev/null +++ b/src/api/types/TenderBankAccountDetailsStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the bank account payment's current status. + */ +export type TenderBankAccountDetailsStatus = "PENDING" | "COMPLETED" | "FAILED"; +export const TenderBankAccountDetailsStatus = { + Pending: "PENDING", + Completed: "COMPLETED", + Failed: "FAILED", +} as const; diff --git a/src/api/types/TenderBuyNowPayLaterDetails.ts b/src/api/types/TenderBuyNowPayLaterDetails.ts new file mode 100644 index 000000000..0fd644977 --- /dev/null +++ b/src/api/types/TenderBuyNowPayLaterDetails.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. + */ +export interface TenderBuyNowPayLaterDetails { + /** + * The Buy Now Pay Later brand. + * See [Brand](#type-brand) for possible values + */ + buyNowPayLaterBrand?: Square.TenderBuyNowPayLaterDetailsBrand; + /** + * The buy now pay later payment's current state (such as `AUTHORIZED` or + * `CAPTURED`). See [TenderBuyNowPayLaterDetailsStatus](entity:TenderBuyNowPayLaterDetailsStatus) + * for possible values. + * See [Status](#type-status) for possible values + */ + status?: Square.TenderBuyNowPayLaterDetailsStatus; +} diff --git a/src/api/types/TenderBuyNowPayLaterDetailsBrand.ts b/src/api/types/TenderBuyNowPayLaterDetailsBrand.ts new file mode 100644 index 000000000..20d091150 --- /dev/null +++ b/src/api/types/TenderBuyNowPayLaterDetailsBrand.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type TenderBuyNowPayLaterDetailsBrand = "OTHER_BRAND" | "AFTERPAY"; +export const TenderBuyNowPayLaterDetailsBrand = { + OtherBrand: "OTHER_BRAND", + Afterpay: "AFTERPAY", +} as const; diff --git a/src/api/types/TenderBuyNowPayLaterDetailsStatus.ts b/src/api/types/TenderBuyNowPayLaterDetailsStatus.ts new file mode 100644 index 000000000..64ee06f4e --- /dev/null +++ b/src/api/types/TenderBuyNowPayLaterDetailsStatus.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type TenderBuyNowPayLaterDetailsStatus = "AUTHORIZED" | "CAPTURED" | "VOIDED" | "FAILED"; +export const TenderBuyNowPayLaterDetailsStatus = { + Authorized: "AUTHORIZED", + Captured: "CAPTURED", + Voided: "VOIDED", + Failed: "FAILED", +} as const; diff --git a/src/api/types/TenderCardDetails.ts b/src/api/types/TenderCardDetails.ts new file mode 100644 index 000000000..e31bec1c8 --- /dev/null +++ b/src/api/types/TenderCardDetails.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` + */ +export interface TenderCardDetails { + /** + * The credit card payment's current state (such as `AUTHORIZED` or + * `CAPTURED`). See [TenderCardDetailsStatus](entity:TenderCardDetailsStatus) + * for possible values. + * See [TenderCardDetailsStatus](#type-tendercarddetailsstatus) for possible values + */ + status?: Square.TenderCardDetailsStatus; + /** The credit card's non-confidential details. */ + card?: Square.Card; + /** + * The method used to enter the card's details for the transaction. + * See [TenderCardDetailsEntryMethod](#type-tendercarddetailsentrymethod) for possible values + */ + entryMethod?: Square.TenderCardDetailsEntryMethod; +} diff --git a/src/api/types/TenderCardDetailsEntryMethod.ts b/src/api/types/TenderCardDetailsEntryMethod.ts new file mode 100644 index 000000000..d90918f9e --- /dev/null +++ b/src/api/types/TenderCardDetailsEntryMethod.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the method used to enter the card's details. + */ +export type TenderCardDetailsEntryMethod = "SWIPED" | "KEYED" | "EMV" | "ON_FILE" | "CONTACTLESS"; +export const TenderCardDetailsEntryMethod = { + Swiped: "SWIPED", + Keyed: "KEYED", + Emv: "EMV", + OnFile: "ON_FILE", + Contactless: "CONTACTLESS", +} as const; diff --git a/src/api/types/TenderCardDetailsStatus.ts b/src/api/types/TenderCardDetailsStatus.ts new file mode 100644 index 000000000..cc694fbd5 --- /dev/null +++ b/src/api/types/TenderCardDetailsStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the card transaction's current status. + */ +export type TenderCardDetailsStatus = "AUTHORIZED" | "CAPTURED" | "VOIDED" | "FAILED"; +export const TenderCardDetailsStatus = { + Authorized: "AUTHORIZED", + Captured: "CAPTURED", + Voided: "VOIDED", + Failed: "FAILED", +} as const; diff --git a/src/api/types/TenderCashDetails.ts b/src/api/types/TenderCashDetails.ts new file mode 100644 index 000000000..423925958 --- /dev/null +++ b/src/api/types/TenderCashDetails.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the details of a tender with `type` `CASH`. + */ +export interface TenderCashDetails { + /** The total amount of cash provided by the buyer, before change is given. */ + buyerTenderedMoney?: Square.Money; + /** The amount of change returned to the buyer. */ + changeBackMoney?: Square.Money; +} diff --git a/src/api/types/TenderSquareAccountDetails.ts b/src/api/types/TenderSquareAccountDetails.ts new file mode 100644 index 000000000..7b340004c --- /dev/null +++ b/src/api/types/TenderSquareAccountDetails.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents the details of a tender with `type` `SQUARE_ACCOUNT`. + */ +export interface TenderSquareAccountDetails { + /** + * The Square Account payment's current state (such as `AUTHORIZED` or + * `CAPTURED`). See [TenderSquareAccountDetailsStatus](entity:TenderSquareAccountDetailsStatus) + * for possible values. + * See [Status](#type-status) for possible values + */ + status?: Square.TenderSquareAccountDetailsStatus; +} diff --git a/src/api/types/TenderSquareAccountDetailsStatus.ts b/src/api/types/TenderSquareAccountDetailsStatus.ts new file mode 100644 index 000000000..811f47cb2 --- /dev/null +++ b/src/api/types/TenderSquareAccountDetailsStatus.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type TenderSquareAccountDetailsStatus = "AUTHORIZED" | "CAPTURED" | "VOIDED" | "FAILED"; +export const TenderSquareAccountDetailsStatus = { + Authorized: "AUTHORIZED", + Captured: "CAPTURED", + Voided: "VOIDED", + Failed: "FAILED", +} as const; diff --git a/src/api/types/TenderType.ts b/src/api/types/TenderType.ts new file mode 100644 index 000000000..36f3223f3 --- /dev/null +++ b/src/api/types/TenderType.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates a tender's type. + */ +export type TenderType = + | "CARD" + | "CASH" + | "THIRD_PARTY_CARD" + | "SQUARE_GIFT_CARD" + | "NO_SALE" + | "BANK_ACCOUNT" + | "WALLET" + | "BUY_NOW_PAY_LATER" + | "SQUARE_ACCOUNT" + | "OTHER"; +export const TenderType = { + Card: "CARD", + Cash: "CASH", + ThirdPartyCard: "THIRD_PARTY_CARD", + SquareGiftCard: "SQUARE_GIFT_CARD", + NoSale: "NO_SALE", + BankAccount: "BANK_ACCOUNT", + Wallet: "WALLET", + BuyNowPayLater: "BUY_NOW_PAY_LATER", + SquareAccount: "SQUARE_ACCOUNT", + Other: "OTHER", +} as const; diff --git a/src/api/types/TerminalAction.ts b/src/api/types/TerminalAction.ts new file mode 100644 index 000000000..0bc88412d --- /dev/null +++ b/src/api/types/TerminalAction.ts @@ -0,0 +1,88 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an action processed by the Square Terminal. + */ +export interface TerminalAction { + /** A unique ID for this `TerminalAction`. */ + id?: string; + /** + * The unique Id of the device intended for this `TerminalAction`. + * The Id can be retrieved from /v2/devices api. + */ + deviceId?: string | null; + /** + * The duration as an RFC 3339 duration, after which the action will be automatically canceled. + * TerminalActions that are `PENDING` will be automatically `CANCELED` and have a cancellation reason + * of `TIMED_OUT` + * + * Default: 5 minutes from creation + * + * Maximum: 5 minutes + */ + deadlineDuration?: string | null; + /** + * The status of the `TerminalAction`. + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` + */ + status?: string; + /** + * The reason why `TerminalAction` is canceled. Present if the status is `CANCELED`. + * See [ActionCancelReason](#type-actioncancelreason) for possible values + */ + cancelReason?: Square.ActionCancelReason; + /** The time when the `TerminalAction` was created as an RFC 3339 timestamp. */ + createdAt?: string; + /** The time when the `TerminalAction` was last updated as an RFC 3339 timestamp. */ + updatedAt?: string; + /** The ID of the application that created the action. */ + appId?: string; + /** The location id the action is attached to, if a link can be made. */ + locationId?: string; + /** + * Represents the type of the action. + * See [ActionType](#type-actiontype) for possible values + */ + type?: Square.TerminalActionActionType; + /** Describes configuration for the QR code action. Requires `QR_CODE` type. */ + qrCodeOptions?: Square.QrCodeOptions; + /** Describes configuration for the save-card action. Requires `SAVE_CARD` type. */ + saveCardOptions?: Square.SaveCardOptions; + /** Describes configuration for the signature capture action. Requires `SIGNATURE` type. */ + signatureOptions?: Square.SignatureOptions; + /** Describes configuration for the confirmation action. Requires `CONFIRMATION` type. */ + confirmationOptions?: Square.ConfirmationOptions; + /** Describes configuration for the receipt action. Requires `RECEIPT` type. */ + receiptOptions?: Square.ReceiptOptions; + /** Describes configuration for the data collection action. Requires `DATA_COLLECTION` type. */ + dataCollectionOptions?: Square.DataCollectionOptions; + /** Describes configuration for the select action. Requires `SELECT` type. */ + selectOptions?: Square.SelectOptions; + /** + * Details about the Terminal that received the action request (such as battery level, + * operating system version, and network connection settings). + * + * Only available for `PING` action type. + */ + deviceMetadata?: Square.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; +} diff --git a/src/api/types/TerminalActionActionType.ts b/src/api/types/TerminalActionActionType.ts new file mode 100644 index 000000000..3eea1e7c4 --- /dev/null +++ b/src/api/types/TerminalActionActionType.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. + */ +export type TerminalActionActionType = + | "QR_CODE" + | "PING" + | "SAVE_CARD" + | "SIGNATURE" + | "CONFIRMATION" + | "RECEIPT" + | "DATA_COLLECTION" + | "SELECT"; +export const TerminalActionActionType = { + QrCode: "QR_CODE", + Ping: "PING", + SaveCard: "SAVE_CARD", + Signature: "SIGNATURE", + Confirmation: "CONFIRMATION", + Receipt: "RECEIPT", + DataCollection: "DATA_COLLECTION", + Select: "SELECT", +} as const; diff --git a/src/api/types/TerminalActionQuery.ts b/src/api/types/TerminalActionQuery.ts new file mode 100644 index 000000000..8dcd1d695 --- /dev/null +++ b/src/api/types/TerminalActionQuery.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TerminalActionQuery { + /** Options for filtering returned `TerminalAction`s */ + filter?: Square.TerminalActionQueryFilter; + /** Option for sorting returned `TerminalAction` objects. */ + sort?: Square.TerminalActionQuerySort; +} diff --git a/src/api/types/TerminalActionQueryFilter.ts b/src/api/types/TerminalActionQueryFilter.ts new file mode 100644 index 000000000..b37e776e7 --- /dev/null +++ b/src/api/types/TerminalActionQueryFilter.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TerminalActionQueryFilter { + /** + * `TerminalAction`s associated with a specific device. If no device is specified then all + * `TerminalAction`s for the merchant will be displayed. + */ + deviceId?: string | null; + /** + * Time range for the beginning of the reporting period. Inclusive. + * Default value: The current time minus one day. + * Note that `TerminalAction`s are available for 30 days after creation. + */ + createdAt?: Square.TimeRange; + /** + * Filter results with the desired status of the `TerminalAction` + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` + */ + status?: string | null; + /** + * Filter results with the requested ActionType. + * See [TerminalActionActionType](#type-terminalactionactiontype) for possible values + */ + type?: Square.TerminalActionActionType; +} diff --git a/src/api/types/TerminalActionQuerySort.ts b/src/api/types/TerminalActionQuerySort.ts new file mode 100644 index 000000000..9bd211967 --- /dev/null +++ b/src/api/types/TerminalActionQuerySort.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TerminalActionQuerySort { + /** + * The order in which results are listed. + * - `ASC` - Oldest to newest. + * - `DESC` - Newest to oldest (default). + * See [SortOrder](#type-sortorder) for possible values + */ + sortOrder?: Square.SortOrder; +} diff --git a/src/api/types/TerminalCheckout.ts b/src/api/types/TerminalCheckout.ts new file mode 100644 index 000000000..3bd0b84db --- /dev/null +++ b/src/api/types/TerminalCheckout.ts @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a checkout processed by the Square Terminal. + */ +export interface TerminalCheckout { + /** A unique ID for this `TerminalCheckout`. */ + id?: string; + /** The amount of money (including the tax amount) that the Square Terminal device should try to collect. */ + amountMoney: Square.Money; + /** + * An optional user-defined reference ID that can be used to associate + * this `TerminalCheckout` to another entity in an external system. For example, an order + * ID generated by a third-party shopping cart. The ID is also associated with any payments + * used to complete the checkout. + */ + referenceId?: string | null; + /** + * An optional note to associate with the checkout, as well as with any payments used to complete the checkout. + * Note: maximum 500 characters + */ + note?: string | null; + /** The reference to the Square order ID for the checkout request. Supported only in the US. */ + orderId?: string | null; + /** Payment-specific options for the checkout request. Supported only in the US. */ + paymentOptions?: Square.PaymentOptions; + /** Options to control the display and behavior of the Square Terminal device. */ + deviceOptions: Square.DeviceCheckoutOptions; + /** + * An RFC 3339 duration, after which the checkout is automatically canceled. + * A `TerminalCheckout` that is `PENDING` is automatically `CANCELED` and has a cancellation reason + * of `TIMED_OUT`. + * + * Default: 5 minutes from creation + * + * Maximum: 5 minutes + */ + deadlineDuration?: string | null; + /** + * The status of the `TerminalCheckout`. + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` + */ + status?: string; + /** + * The reason why `TerminalCheckout` is canceled. Present if the status is `CANCELED`. + * See [ActionCancelReason](#type-actioncancelreason) for possible values + */ + cancelReason?: Square.ActionCancelReason; + /** A list of IDs for payments created by this `TerminalCheckout`. */ + paymentIds?: string[]; + /** The time when the `TerminalCheckout` was created, as an RFC 3339 timestamp. */ + createdAt?: string; + /** The time when the `TerminalCheckout` was last updated, as an RFC 3339 timestamp. */ + updatedAt?: string; + /** The ID of the application that created the checkout. */ + appId?: string; + /** The location of the device where the `TerminalCheckout` was directed. */ + locationId?: string; + /** + * The type of payment the terminal should attempt to capture from. Defaults to `CARD_PRESENT`. + * See [CheckoutOptionsPaymentType](#type-checkoutoptionspaymenttype) for possible values + */ + paymentType?: Square.CheckoutOptionsPaymentType; + /** An optional ID of the team member associated with creating the checkout. */ + teamMemberId?: string | null; + /** An optional ID of the customer associated with the checkout. */ + customerId?: string | null; + /** + * The amount the developer is taking as a fee for facilitating the payment on behalf + * of the seller. + * + * The amount cannot be more than 90% of the total amount of the payment. + * + * The amount must be specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + * + * The fee currency code must match the currency associated with the seller that is accepting the payment. The application must be from a developer account in the same country and using the same currency code as the seller. + * + * For more information about the application fee scenario, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees). + * + * To set this field, PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS OAuth permission is required. For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions). + * + * Supported only in the US. + */ + appFeeMoney?: Square.Money; + /** + * Optional additional payment information to include on the customer's card statement as + * part of the statement description. This can be, for example, an invoice number, ticket number, + * or short description that uniquely identifies the purchase. Supported only in the US. + */ + statementDescriptionIdentifier?: string | null; + /** + * The amount designated as a tip, in addition to `amount_money`. This may only be set for a + * checkout that has tipping disabled (`tip_settings.allow_tipping` is `false`). Supported only in + * the US. + */ + tipMoney?: Square.Money; +} diff --git a/src/api/types/TerminalCheckoutQuery.ts b/src/api/types/TerminalCheckoutQuery.ts new file mode 100644 index 000000000..ff31643bc --- /dev/null +++ b/src/api/types/TerminalCheckoutQuery.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TerminalCheckoutQuery { + /** Options for filtering returned `TerminalCheckout` objects. */ + filter?: Square.TerminalCheckoutQueryFilter; + /** Option for sorting returned `TerminalCheckout` objects. */ + sort?: Square.TerminalCheckoutQuerySort; +} diff --git a/src/api/types/TerminalCheckoutQueryFilter.ts b/src/api/types/TerminalCheckoutQueryFilter.ts new file mode 100644 index 000000000..0bad649c3 --- /dev/null +++ b/src/api/types/TerminalCheckoutQueryFilter.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TerminalCheckoutQueryFilter { + /** + * The `TerminalCheckout` objects associated with a specific device. If no device is specified, then all + * `TerminalCheckout` objects for the merchant are displayed. + */ + deviceId?: string | null; + /** + * The time range for the beginning of the reporting period, which is inclusive. + * Default value: The current time minus one day. + * Note that `TerminalCheckout`s are available for 30 days after creation. + */ + createdAt?: Square.TimeRange; + /** + * Filtered results with the desired status of the `TerminalCheckout`. + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` + */ + status?: string | null; +} diff --git a/src/api/types/TerminalCheckoutQuerySort.ts b/src/api/types/TerminalCheckoutQuerySort.ts new file mode 100644 index 000000000..f9cec6434 --- /dev/null +++ b/src/api/types/TerminalCheckoutQuerySort.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TerminalCheckoutQuerySort { + /** + * The order in which results are listed. + * Default: `DESC` + * See [SortOrder](#type-sortorder) for possible values + */ + sortOrder?: Square.SortOrder; +} diff --git a/src/api/types/TerminalRefund.ts b/src/api/types/TerminalRefund.ts new file mode 100644 index 000000000..eb858f1e9 --- /dev/null +++ b/src/api/types/TerminalRefund.ts @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. + */ +export interface TerminalRefund { + /** A unique ID for this `TerminalRefund`. */ + id?: string; + /** The reference to the payment refund created by completing this `TerminalRefund`. */ + refundId?: string; + /** The unique ID of the payment being refunded. */ + paymentId: string; + /** The reference to the Square order ID for the payment identified by the `payment_id`. */ + orderId?: string; + /** + * The amount of money, inclusive of `tax_money`, that the `TerminalRefund` should return. + * This value is limited to the amount taken in the original payment minus any completed or + * pending refunds. + */ + amountMoney: Square.Money; + /** A description of the reason for the refund. */ + reason: string; + /** + * The unique ID of the device intended for this `TerminalRefund`. + * The Id can be retrieved from /v2/devices api. + */ + deviceId: string; + /** + * The RFC 3339 duration, after which the refund is automatically canceled. + * A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason + * of `TIMED_OUT`. + * + * Default: 5 minutes from creation. + * + * Maximum: 5 minutes + */ + deadlineDuration?: string | null; + /** + * The status of the `TerminalRefund`. + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. + */ + status?: string; + /** + * Present if the status is `CANCELED`. + * See [ActionCancelReason](#type-actioncancelreason) for possible values + */ + cancelReason?: Square.ActionCancelReason; + /** The time when the `TerminalRefund` was created, as an RFC 3339 timestamp. */ + createdAt?: string; + /** The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp. */ + updatedAt?: string; + /** The ID of the application that created the refund. */ + appId?: string; + /** The location of the device where the `TerminalRefund` was directed. */ + locationId?: string; +} diff --git a/src/api/types/TerminalRefundQuery.ts b/src/api/types/TerminalRefundQuery.ts new file mode 100644 index 000000000..99a8c3ebd --- /dev/null +++ b/src/api/types/TerminalRefundQuery.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TerminalRefundQuery { + /** The filter for the Terminal refund query. */ + filter?: Square.TerminalRefundQueryFilter; + /** The sort order for the Terminal refund query. */ + sort?: Square.TerminalRefundQuerySort; +} diff --git a/src/api/types/TerminalRefundQueryFilter.ts b/src/api/types/TerminalRefundQueryFilter.ts new file mode 100644 index 000000000..8afc83ed8 --- /dev/null +++ b/src/api/types/TerminalRefundQueryFilter.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface TerminalRefundQueryFilter { + /** + * `TerminalRefund` objects associated with a specific device. If no device is specified, then all + * `TerminalRefund` objects for the signed-in account are displayed. + */ + deviceId?: string | null; + /** + * The timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive. + * Default value: The current time minus one day. + * Note that `TerminalRefund`s are available for 30 days after creation. + */ + createdAt?: Square.TimeRange; + /** + * Filtered results with the desired status of the `TerminalRefund`. + * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. + */ + status?: string | null; +} diff --git a/src/api/types/TerminalRefundQuerySort.ts b/src/api/types/TerminalRefundQuerySort.ts new file mode 100644 index 000000000..277d8f115 --- /dev/null +++ b/src/api/types/TerminalRefundQuerySort.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TerminalRefundQuerySort { + /** + * The order in which results are listed. + * - `ASC` - Oldest to newest. + * - `DESC` - Newest to oldest (default). + */ + sortOrder?: string | null; +} diff --git a/src/api/types/TestWebhookSubscriptionResponse.ts b/src/api/types/TestWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..01af77619 --- /dev/null +++ b/src/api/types/TestWebhookSubscriptionResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [TestWebhookSubscription](api-endpoint:WebhookSubscriptions-TestWebhookSubscription) endpoint. + * + * Note: If there are errors processing the request, the [SubscriptionTestResult](entity:SubscriptionTestResult) field is not + * present. + */ +export interface TestWebhookSubscriptionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The [SubscriptionTestResult](entity:SubscriptionTestResult). */ + subscriptionTestResult?: Square.SubscriptionTestResult; +} diff --git a/src/api/types/TimeRange.ts b/src/api/types/TimeRange.ts new file mode 100644 index 000000000..f0624288c --- /dev/null +++ b/src/api/types/TimeRange.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a generic time range. The start and end values are + * represented in RFC 3339 format. Time ranges are customized to be + * inclusive or exclusive based on the needs of a particular endpoint. + * Refer to the relevant endpoint-specific documentation to determine + * how time ranges are handled. + */ +export interface TimeRange { + /** + * A datetime value in RFC 3339 format indicating when the time range + * starts. + */ + startAt?: string | null; + /** + * A datetime value in RFC 3339 format indicating when the time range + * ends. + */ + endAt?: string | null; +} diff --git a/src/api/types/TipSettings.ts b/src/api/types/TipSettings.ts new file mode 100644 index 000000000..00b18e986 --- /dev/null +++ b/src/api/types/TipSettings.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface TipSettings { + /** Indicates whether tipping is enabled for this checkout. Defaults to false. */ + allowTipping?: boolean | null; + /** + * Indicates whether tip options should be presented on the screen before presenting + * the signature screen during card payment. Defaults to false. + */ + separateTipScreen?: boolean | null; + /** Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false. */ + customTipField?: boolean | null; + /** + * A list of tip percentages that should be presented during the checkout flow, specified as + * up to 3 non-negative integers from 0 to 100 (inclusive). Defaults to 15, 20, and 25. + */ + tipPercentages?: number[] | null; + /** + * Enables the "Smart Tip Amounts" behavior. + * Exact tipping options depend on the region in which the Square seller is active. + * + * For payments under 10.00, in the Australia, Canada, Ireland, United Kingdom, and United States, tipping options are presented as no tip, .50, 1.00 or 2.00. + * + * For payment amounts of 10.00 or greater, tipping options are presented as the following percentages: 0%, 5%, 10%, 15%. + * + * If set to true, the `tip_percentages` settings is ignored. + * Defaults to false. + * + * To learn more about smart tipping, see [Accept Tips with the Square App](https://squareup.com/help/us/en/article/5069-accept-tips-with-the-square-app). + */ + smartTipping?: boolean | null; +} diff --git a/src/api/types/Transaction.ts b/src/api/types/Transaction.ts new file mode 100644 index 000000000..50ccaf1a3 --- /dev/null +++ b/src/api/types/Transaction.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a transaction processed with Square, either with the + * Connect API or with Square Point of Sale. + * + * The `tenders` field of this object lists all methods of payment used to pay in + * the transaction. + */ +export interface Transaction { + /** The transaction's unique ID, issued by Square payments servers. */ + id?: string; + /** The ID of the transaction's associated location. */ + locationId?: string | null; + /** The timestamp for when the transaction was created, in RFC 3339 format. */ + createdAt?: string; + /** The tenders used to pay in the transaction. */ + tenders?: Square.Tender[] | null; + /** Refunds that have been applied to any tender in the transaction. */ + refunds?: Square.Refund[] | null; + /** + * If the transaction was created with the [Charge](api-endpoint:Transactions-Charge) + * endpoint, this value is the same as the value provided for the `reference_id` + * parameter in the request to that endpoint. Otherwise, it is not set. + */ + referenceId?: string | null; + /** + * The Square product that processed the transaction. + * See [TransactionProduct](#type-transactionproduct) for possible values + */ + product?: Square.TransactionProduct; + /** + * If the transaction was created in the Square Point of Sale app, this value + * is the ID generated for the transaction by Square Point of Sale. + * + * This ID has no relationship to the transaction's canonical `id`, which is + * generated by Square's backend servers. This value is generated for bookkeeping + * purposes, in case the transaction cannot immediately be completed (for example, + * if the transaction is processed in offline mode). + * + * It is not currently possible with the Connect API to perform a transaction + * lookup by this value. + */ + clientId?: string | null; + /** The shipping address provided in the request, if any. */ + shippingAddress?: Square.Address; + /** The order_id is an identifier for the order associated with this transaction, if any. */ + orderId?: string | null; +} diff --git a/src/api/types/TransactionProduct.ts b/src/api/types/TransactionProduct.ts new file mode 100644 index 000000000..4d481f24d --- /dev/null +++ b/src/api/types/TransactionProduct.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Indicates the Square product used to process a transaction. + */ +export type TransactionProduct = + | "REGISTER" + | "EXTERNAL_API" + | "BILLING" + | "APPOINTMENTS" + | "INVOICES" + | "ONLINE_STORE" + | "PAYROLL" + | "OTHER"; +export const TransactionProduct = { + Register: "REGISTER", + ExternalApi: "EXTERNAL_API", + Billing: "BILLING", + Appointments: "APPOINTMENTS", + Invoices: "INVOICES", + OnlineStore: "ONLINE_STORE", + Payroll: "PAYROLL", + Other: "OTHER", +} as const; diff --git a/src/api/types/UnlinkCustomerFromGiftCardResponse.ts b/src/api/types/UnlinkCustomerFromGiftCardResponse.ts new file mode 100644 index 000000000..f8dec48c7 --- /dev/null +++ b/src/api/types/UnlinkCustomerFromGiftCardResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response that contains the unlinked `GiftCard` object. If the request resulted in errors, + * the response contains a set of `Error` objects. + */ +export interface UnlinkCustomerFromGiftCardResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The gift card with the ID of the unlinked customer removed from the `customer_ids` field. + * If no other customers are linked, the `customer_ids` field is also removed. + */ + giftCard?: Square.GiftCard; +} diff --git a/src/api/types/UpdateBookingCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateBookingCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..1313eb17f --- /dev/null +++ b/src/api/types/UpdateBookingCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpdateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-UpdateBookingCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface UpdateBookingCustomAttributeDefinitionResponse { + /** The updated custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateBookingResponse.ts b/src/api/types/UpdateBookingResponse.ts new file mode 100644 index 000000000..519c8dc71 --- /dev/null +++ b/src/api/types/UpdateBookingResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface UpdateBookingResponse { + /** The booking that was updated. */ + booking?: Square.Booking; + /** Errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateBreakTypeResponse.ts b/src/api/types/UpdateBreakTypeResponse.ts new file mode 100644 index 000000000..094813247 --- /dev/null +++ b/src/api/types/UpdateBreakTypeResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A response to a request to update a `BreakType`. The response contains + * the requested `BreakType` objects and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface UpdateBreakTypeResponse { + /** The response object. */ + breakType?: Square.BreakType; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateCatalogImageRequest.ts b/src/api/types/UpdateCatalogImageRequest.ts new file mode 100644 index 000000000..89b7091d7 --- /dev/null +++ b/src/api/types/UpdateCatalogImageRequest.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface UpdateCatalogImageRequest { + /** + * A unique string that identifies this UpdateCatalogImage request. + * Keys can be any valid string but must be unique for every UpdateCatalogImage request. + * + * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. + */ + idempotencyKey: string; +} diff --git a/src/api/types/UpdateCatalogImageResponse.ts b/src/api/types/UpdateCatalogImageResponse.ts new file mode 100644 index 000000000..c574bcbf0 --- /dev/null +++ b/src/api/types/UpdateCatalogImageResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface UpdateCatalogImageResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** + * The newly updated `CatalogImage` including a Square-generated + * URL for the encapsulated image file. + */ + image?: Square.CatalogObject; +} diff --git a/src/api/types/UpdateCustomerCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateCustomerCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..b5760da5b --- /dev/null +++ b/src/api/types/UpdateCustomerCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpdateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-UpdateCustomerCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface UpdateCustomerCustomAttributeDefinitionResponse { + /** The updated custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateCustomerGroupResponse.ts b/src/api/types/UpdateCustomerGroupResponse.ts new file mode 100644 index 000000000..913d8c6f4 --- /dev/null +++ b/src/api/types/UpdateCustomerGroupResponse.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [UpdateCustomerGroup](api-endpoint:CustomerGroups-UpdateCustomerGroup) endpoint. + * + * Either `errors` or `group` is present in a given response (never both). + */ +export interface UpdateCustomerGroupResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The successfully updated customer group. */ + group?: Square.CustomerGroup; +} diff --git a/src/api/types/UpdateCustomerResponse.ts b/src/api/types/UpdateCustomerResponse.ts new file mode 100644 index 000000000..7f949f940 --- /dev/null +++ b/src/api/types/UpdateCustomerResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [UpdateCustomer](api-endpoint:Customers-UpdateCustomer) or + * [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint. + * + * Either `errors` or `customer` is present in a given response (never both). + */ +export interface UpdateCustomerResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The updated customer. */ + customer?: Square.Customer; +} diff --git a/src/api/types/UpdateInvoiceResponse.ts b/src/api/types/UpdateInvoiceResponse.ts new file mode 100644 index 000000000..d6f79f3e3 --- /dev/null +++ b/src/api/types/UpdateInvoiceResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Describes a `UpdateInvoice` response. + */ +export interface UpdateInvoiceResponse { + /** The updated invoice. */ + invoice?: Square.Invoice; + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateItemModifierListsResponse.ts b/src/api/types/UpdateItemModifierListsResponse.ts new file mode 100644 index 000000000..0559418e8 --- /dev/null +++ b/src/api/types/UpdateItemModifierListsResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface UpdateItemModifierListsResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The database [timestamp](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. */ + updatedAt?: string; +} diff --git a/src/api/types/UpdateItemTaxesResponse.ts b/src/api/types/UpdateItemTaxesResponse.ts new file mode 100644 index 000000000..d0f11d28b --- /dev/null +++ b/src/api/types/UpdateItemTaxesResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface UpdateItemTaxesResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. */ + updatedAt?: string; +} diff --git a/src/api/types/UpdateJobResponse.ts b/src/api/types/UpdateJobResponse.ts new file mode 100644 index 000000000..a07019f8e --- /dev/null +++ b/src/api/types/UpdateJobResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpdateJob](api-endpoint:Team-UpdateJob) response. Either `job` or `errors` + * is present in the response. + */ +export interface UpdateJobResponse { + /** The updated job. */ + job?: Square.Job; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateLocationCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateLocationCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..0c649bc07 --- /dev/null +++ b/src/api/types/UpdateLocationCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpdateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-UpdateLocationCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface UpdateLocationCustomAttributeDefinitionResponse { + /** The updated custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateLocationResponse.ts b/src/api/types/UpdateLocationResponse.ts new file mode 100644 index 000000000..25aede1c6 --- /dev/null +++ b/src/api/types/UpdateLocationResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response object returned by the [UpdateLocation](api-endpoint:Locations-UpdateLocation) endpoint. + */ +export interface UpdateLocationResponse { + /** Information about errors encountered during the request. */ + errors?: Square.Error_[]; + /** The updated `Location` object. */ + location?: Square.Location; +} diff --git a/src/api/types/UpdateLocationSettingsResponse.ts b/src/api/types/UpdateLocationSettingsResponse.ts new file mode 100644 index 000000000..f6d4a37d2 --- /dev/null +++ b/src/api/types/UpdateLocationSettingsResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface UpdateLocationSettingsResponse { + /** Any errors that occurred when updating the location settings. */ + errors?: Square.Error_[]; + /** The updated location settings. */ + locationSettings?: Square.CheckoutLocationSettings; +} diff --git a/src/api/types/UpdateMerchantCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateMerchantCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..c6f872588 --- /dev/null +++ b/src/api/types/UpdateMerchantCustomAttributeDefinitionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpdateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-UpdateMerchantCustomAttributeDefinition) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface UpdateMerchantCustomAttributeDefinitionResponse { + /** The updated custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateMerchantSettingsResponse.ts b/src/api/types/UpdateMerchantSettingsResponse.ts new file mode 100644 index 000000000..51b94b7f1 --- /dev/null +++ b/src/api/types/UpdateMerchantSettingsResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface UpdateMerchantSettingsResponse { + /** Any errors that occurred when updating the merchant settings. */ + errors?: Square.Error_[]; + /** The updated merchant settings. */ + merchantSettings?: Square.CheckoutMerchantSettings; +} diff --git a/src/api/types/UpdateOrderCustomAttributeDefinitionResponse.ts b/src/api/types/UpdateOrderCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..85b32051f --- /dev/null +++ b/src/api/types/UpdateOrderCustomAttributeDefinitionResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from updating an order custom attribute definition. + */ +export interface UpdateOrderCustomAttributeDefinitionResponse { + /** The updated order custom attribute definition. */ + customAttributeDefinition?: Square.CustomAttributeDefinition; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateOrderResponse.ts b/src/api/types/UpdateOrderResponse.ts new file mode 100644 index 000000000..50f3ff049 --- /dev/null +++ b/src/api/types/UpdateOrderResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint. + */ +export interface UpdateOrderResponse { + /** The updated order. */ + order?: Square.Order; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdatePaymentLinkResponse.ts b/src/api/types/UpdatePaymentLinkResponse.ts new file mode 100644 index 000000000..5db98657d --- /dev/null +++ b/src/api/types/UpdatePaymentLinkResponse.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface UpdatePaymentLinkResponse { + /** Any errors that occurred when updating the payment link. */ + errors?: Square.Error_[]; + /** The updated payment link. */ + paymentLink?: Square.PaymentLink; +} diff --git a/src/api/types/UpdatePaymentResponse.ts b/src/api/types/UpdatePaymentResponse.ts new file mode 100644 index 000000000..13c975379 --- /dev/null +++ b/src/api/types/UpdatePaymentResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the response returned by + * [UpdatePayment](api-endpoint:Payments-UpdatePayment). + */ +export interface UpdatePaymentResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The updated payment. */ + payment?: Square.Payment; +} diff --git a/src/api/types/UpdateShiftResponse.ts b/src/api/types/UpdateShiftResponse.ts new file mode 100644 index 000000000..0acfcc969 --- /dev/null +++ b/src/api/types/UpdateShiftResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request to update a `Shift`. The response contains + * the updated `Shift` object and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface UpdateShiftResponse { + /** The updated `Shift`. */ + shift?: Square.Shift; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateSubscriptionResponse.ts b/src/api/types/UpdateSubscriptionResponse.ts new file mode 100644 index 000000000..134a6ac96 --- /dev/null +++ b/src/api/types/UpdateSubscriptionResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines output parameters in a response from the + * [UpdateSubscription](api-endpoint:Subscriptions-UpdateSubscription) endpoint. + */ +export interface UpdateSubscriptionResponse { + /** Errors encountered during the request. */ + errors?: Square.Error_[]; + /** The updated subscription. */ + subscription?: Square.Subscription; +} diff --git a/src/api/types/UpdateTeamMemberRequest.ts b/src/api/types/UpdateTeamMemberRequest.ts new file mode 100644 index 000000000..4944b1cf6 --- /dev/null +++ b/src/api/types/UpdateTeamMemberRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an update request for a `TeamMember` object. + */ +export interface UpdateTeamMemberRequest { + /** + * The team member fields to add, change, or clear. Fields can be cleared using a null value. To update + * `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, call + * [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values. + */ + teamMember?: Square.TeamMember; +} diff --git a/src/api/types/UpdateTeamMemberResponse.ts b/src/api/types/UpdateTeamMemberResponse.ts new file mode 100644 index 000000000..498af27a0 --- /dev/null +++ b/src/api/types/UpdateTeamMemberResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from an update request containing the updated `TeamMember` object or error messages. + */ +export interface UpdateTeamMemberResponse { + /** The successfully updated `TeamMember` object. */ + teamMember?: Square.TeamMember; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateVendorRequest.ts b/src/api/types/UpdateVendorRequest.ts new file mode 100644 index 000000000..dcb85e48b --- /dev/null +++ b/src/api/types/UpdateVendorRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an input to a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor). + */ +export interface UpdateVendorRequest { + /** + * A client-supplied, universally unique identifier (UUID) for the + * request. + * + * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the + * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more + * information. + */ + idempotencyKey?: string | null; + /** The specified [Vendor](entity:Vendor) to be updated. */ + vendor: Square.Vendor; +} diff --git a/src/api/types/UpdateVendorResponse.ts b/src/api/types/UpdateVendorResponse.ts new file mode 100644 index 000000000..644dbe1c5 --- /dev/null +++ b/src/api/types/UpdateVendorResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an output from a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor). + */ +export interface UpdateVendorResponse { + /** Errors occurred when the request fails. */ + errors?: Square.Error_[]; + /** The [Vendor](entity:Vendor) that has been updated. */ + vendor?: Square.Vendor; +} diff --git a/src/api/types/UpdateWageSettingResponse.ts b/src/api/types/UpdateWageSettingResponse.ts new file mode 100644 index 000000000..62348f77e --- /dev/null +++ b/src/api/types/UpdateWageSettingResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from an update request containing the updated `WageSetting` object + * or error messages. + */ +export interface UpdateWageSettingResponse { + /** The successfully updated `WageSetting` object. */ + wageSetting?: Square.WageSetting; + /** The errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpdateWebhookSubscriptionResponse.ts b/src/api/types/UpdateWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..c54292ac6 --- /dev/null +++ b/src/api/types/UpdateWebhookSubscriptionResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [UpdateWebhookSubscription](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscription) endpoint. + * + * Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not + * present. + */ +export interface UpdateWebhookSubscriptionResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The updated [Subscription](entity:WebhookSubscription). */ + subscription?: Square.WebhookSubscription; +} diff --git a/src/api/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts b/src/api/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts new file mode 100644 index 000000000..675854985 --- /dev/null +++ b/src/api/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) endpoint. + * + * Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not + * present. + */ +export interface UpdateWebhookSubscriptionSignatureKeyResponse { + /** Information on errors encountered during the request. */ + errors?: Square.Error_[]; + /** The new Square-generated signature key used to validate the origin of the webhook event. */ + signatureKey?: string; +} diff --git a/src/api/types/UpdateWorkweekConfigResponse.ts b/src/api/types/UpdateWorkweekConfigResponse.ts new file mode 100644 index 000000000..20a17afca --- /dev/null +++ b/src/api/types/UpdateWorkweekConfigResponse.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * The response to a request to update a `WorkweekConfig` object. The response contains + * the updated `WorkweekConfig` object and might contain a set of `Error` objects if + * the request resulted in errors. + */ +export interface UpdateWorkweekConfigResponse { + /** The response object. */ + workweekConfig?: Square.WorkweekConfig; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpsertBookingCustomAttributeResponse.ts b/src/api/types/UpsertBookingCustomAttributeResponse.ts new file mode 100644 index 000000000..8197bcbcb --- /dev/null +++ b/src/api/types/UpsertBookingCustomAttributeResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpsertBookingCustomAttribute](api-endpoint:BookingCustomAttributes-UpsertBookingCustomAttribute) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface UpsertBookingCustomAttributeResponse { + /** The new or updated custom attribute. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpsertCatalogObjectResponse.ts b/src/api/types/UpsertCatalogObjectResponse.ts new file mode 100644 index 000000000..8fafabd00 --- /dev/null +++ b/src/api/types/UpsertCatalogObjectResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface UpsertCatalogObjectResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The successfully created or updated CatalogObject. */ + catalogObject?: Square.CatalogObject; + /** The mapping between client and server IDs for this upsert. */ + idMappings?: Square.CatalogIdMapping[]; +} diff --git a/src/api/types/UpsertCustomerCustomAttributeResponse.ts b/src/api/types/UpsertCustomerCustomAttributeResponse.ts new file mode 100644 index 000000000..0f76c7631 --- /dev/null +++ b/src/api/types/UpsertCustomerCustomAttributeResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface UpsertCustomerCustomAttributeResponse { + /** The new or updated custom attribute. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpsertLocationCustomAttributeResponse.ts b/src/api/types/UpsertLocationCustomAttributeResponse.ts new file mode 100644 index 000000000..131868814 --- /dev/null +++ b/src/api/types/UpsertLocationCustomAttributeResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface UpsertLocationCustomAttributeResponse { + /** The new or updated custom attribute. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpsertMerchantCustomAttributeResponse.ts b/src/api/types/UpsertMerchantCustomAttributeResponse.ts new file mode 100644 index 000000000..9dc89c1a8 --- /dev/null +++ b/src/api/types/UpsertMerchantCustomAttributeResponse.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) response. + * Either `custom_attribute_definition` or `errors` is present in the response. + */ +export interface UpsertMerchantCustomAttributeResponse { + /** The new or updated custom attribute. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpsertOrderCustomAttributeResponse.ts b/src/api/types/UpsertOrderCustomAttributeResponse.ts new file mode 100644 index 000000000..b6e8e1664 --- /dev/null +++ b/src/api/types/UpsertOrderCustomAttributeResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a response from upserting order custom attribute definitions. + */ +export interface UpsertOrderCustomAttributeResponse { + /** The order custom attribute that was created or modified. */ + customAttribute?: Square.CustomAttribute; + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/UpsertSnippetResponse.ts b/src/api/types/UpsertSnippetResponse.ts new file mode 100644 index 000000000..27e12d945 --- /dev/null +++ b/src/api/types/UpsertSnippetResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`. + */ +export interface UpsertSnippetResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; + /** The new or updated snippet. */ + snippet?: Square.Snippet; +} diff --git a/src/api/types/V1Money.ts b/src/api/types/V1Money.ts new file mode 100644 index 000000000..3cdcdae09 --- /dev/null +++ b/src/api/types/V1Money.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +export interface V1Money { + /** + * Amount in the lowest denominated value of this Currency. E.g. in USD + * these are cents, in JPY they are Yen (which do not have a 'cent' concept). + */ + amount?: number | null; + /** + * See [Currency](#type-currency) for possible values + */ + currencyCode?: Square.Currency; +} diff --git a/src/api/types/V1Order.ts b/src/api/types/V1Order.ts new file mode 100644 index 000000000..106ac9982 --- /dev/null +++ b/src/api/types/V1Order.ts @@ -0,0 +1,64 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * V1Order + */ +export interface V1Order { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[] | null; + /** The order's unique identifier. */ + id?: string; + /** The email address of the order's buyer. */ + buyerEmail?: string | null; + /** The name of the order's buyer. */ + recipientName?: string | null; + /** The phone number to use for the order's delivery. */ + recipientPhoneNumber?: string | null; + /** + * Whether the tax is an ADDITIVE tax or an INCLUSIVE tax. + * See [V1OrderState](#type-v1orderstate) for possible values + */ + state?: Square.V1OrderState; + /** The address to ship the order to. */ + shippingAddress?: Square.Address; + /** The amount of all items purchased in the order, before taxes and shipping. */ + subtotalMoney?: Square.V1Money; + /** The shipping cost for the order. */ + totalShippingMoney?: Square.V1Money; + /** The total of all taxes applied to the order. */ + totalTaxMoney?: Square.V1Money; + /** The total cost of the order. */ + totalPriceMoney?: Square.V1Money; + /** The total of all discounts applied to the order. */ + totalDiscountMoney?: Square.V1Money; + /** The time when the order was created, in ISO 8601 format. */ + createdAt?: string; + /** The time when the order was last modified, in ISO 8601 format. */ + updatedAt?: string; + /** The time when the order expires if no action is taken, in ISO 8601 format. */ + expiresAt?: string | null; + /** The unique identifier of the payment associated with the order. */ + paymentId?: string | null; + /** A note provided by the buyer when the order was created, if any. */ + buyerNote?: string | null; + /** A note provided by the merchant when the order's state was set to COMPLETED, if any */ + completedNote?: string | null; + /** A note provided by the merchant when the order's state was set to REFUNDED, if any. */ + refundedNote?: string | null; + /** A note provided by the merchant when the order's state was set to CANCELED, if any. */ + canceledNote?: string | null; + /** The tender used to pay for the order. */ + tender?: Square.V1Tender; + /** The history of actions associated with the order. */ + orderHistory?: Square.V1OrderHistoryEntry[] | null; + /** The promo code provided by the buyer, if any. */ + promoCode?: string | null; + /** For Bitcoin transactions, the address that the buyer sent Bitcoin to. */ + btcReceiveAddress?: string | null; + /** For Bitcoin transactions, the price of the buyer's order in satoshi (100 million satoshi equals 1 BTC). */ + btcPriceSatoshi?: number | null; +} diff --git a/src/api/types/V1OrderHistoryEntry.ts b/src/api/types/V1OrderHistoryEntry.ts new file mode 100644 index 000000000..9781f5148 --- /dev/null +++ b/src/api/types/V1OrderHistoryEntry.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * V1OrderHistoryEntry + */ +export interface V1OrderHistoryEntry { + /** + * The type of action performed on the order. + * See [V1OrderHistoryEntryAction](#type-v1orderhistoryentryaction) for possible values + */ + action?: Square.V1OrderHistoryEntryAction; + /** The time when the action was performed, in ISO 8601 format. */ + createdAt?: string; +} diff --git a/src/api/types/V1OrderHistoryEntryAction.ts b/src/api/types/V1OrderHistoryEntryAction.ts new file mode 100644 index 000000000..228dbe95f --- /dev/null +++ b/src/api/types/V1OrderHistoryEntryAction.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V1OrderHistoryEntryAction = + | "ORDER_PLACED" + | "DECLINED" + | "PAYMENT_RECEIVED" + | "CANCELED" + | "COMPLETED" + | "REFUNDED" + | "EXPIRED"; +export const V1OrderHistoryEntryAction = { + OrderPlaced: "ORDER_PLACED", + Declined: "DECLINED", + PaymentReceived: "PAYMENT_RECEIVED", + Canceled: "CANCELED", + Completed: "COMPLETED", + Refunded: "REFUNDED", + Expired: "EXPIRED", +} as const; diff --git a/src/api/types/V1OrderState.ts b/src/api/types/V1OrderState.ts new file mode 100644 index 000000000..c11830bda --- /dev/null +++ b/src/api/types/V1OrderState.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V1OrderState = "PENDING" | "OPEN" | "COMPLETED" | "CANCELED" | "REFUNDED" | "REJECTED"; +export const V1OrderState = { + Pending: "PENDING", + Open: "OPEN", + Completed: "COMPLETED", + Canceled: "CANCELED", + Refunded: "REFUNDED", + Rejected: "REJECTED", +} as const; diff --git a/src/api/types/V1Tender.ts b/src/api/types/V1Tender.ts new file mode 100644 index 000000000..95e244291 --- /dev/null +++ b/src/api/types/V1Tender.ts @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * A tender represents a discrete monetary exchange. Square represents this + * exchange as a money object with a specific currency and amount, where the + * amount is given in the smallest denomination of the given currency. + * + * Square POS can accept more than one form of tender for a single payment (such + * as by splitting a bill between a credit card and a gift card). The `tender` + * field of the Payment object lists all forms of tender used for the payment. + * + * Split tender payments behave slightly differently from single tender payments: + * + * The receipt_url for a split tender corresponds only to the first tender listed + * in the tender field. To get the receipt URLs for the remaining tenders, use + * the receipt_url fields of the corresponding Tender objects. + * + * *A note on gift cards**: when a customer purchases a Square gift card from a + * merchant, the merchant receives the full amount of the gift card in the + * associated payment. + * + * When that gift card is used as a tender, the balance of the gift card is + * reduced and the merchant receives no funds. A `Tender` object with a type of + * `SQUARE_GIFT_CARD` indicates a gift card was used for some or all of the + * associated payment. + */ +export interface V1Tender { + /** The tender's unique ID. */ + id?: string; + /** + * The type of tender. + * See [V1TenderType](#type-v1tendertype) for possible values + */ + type?: Square.V1TenderType; + /** A human-readable description of the tender. */ + name?: string | null; + /** The ID of the employee that processed the tender. */ + employeeId?: string | null; + /** The URL of the receipt for the tender. */ + receiptUrl?: string | null; + /** + * The brand of credit card provided. + * See [V1TenderCardBrand](#type-v1tendercardbrand) for possible values + */ + cardBrand?: Square.V1TenderCardBrand; + /** The last four digits of the provided credit card's account number. */ + panSuffix?: string | null; + /** + * The tender's unique ID. + * See [V1TenderEntryMethod](#type-v1tenderentrymethod) for possible values + */ + entryMethod?: Square.V1TenderEntryMethod; + /** Notes entered by the merchant about the tender at the time of payment, if any. Typically only present for tender with the type: OTHER. */ + paymentNote?: string | null; + /** The total amount of money provided in this form of tender. */ + totalMoney?: Square.V1Money; + /** The amount of total_money applied to the payment. */ + tenderedMoney?: Square.V1Money; + /** The time when the tender was created, in ISO 8601 format. */ + tenderedAt?: string | null; + /** The time when the tender was settled, in ISO 8601 format. */ + settledAt?: string | null; + /** The amount of total_money returned to the buyer as change. */ + changeBackMoney?: Square.V1Money; + /** The total of all refunds applied to this tender. This amount is always negative or zero. */ + refundedMoney?: Square.V1Money; + /** Indicates whether or not the tender is associated with an exchange. If is_exchange is true, the tender represents the value of goods returned in an exchange not the actual money paid. The exchange value reduces the tender amounts needed to pay for items purchased in the exchange. */ + isExchange?: boolean | null; +} diff --git a/src/api/types/V1TenderCardBrand.ts b/src/api/types/V1TenderCardBrand.ts new file mode 100644 index 000000000..9087fa6e3 --- /dev/null +++ b/src/api/types/V1TenderCardBrand.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The brand of a credit card. + */ +export type V1TenderCardBrand = + | "OTHER_BRAND" + | "VISA" + | "MASTER_CARD" + | "AMERICAN_EXPRESS" + | "DISCOVER" + | "DISCOVER_DINERS" + | "JCB" + | "CHINA_UNIONPAY" + | "SQUARE_GIFT_CARD"; +export const V1TenderCardBrand = { + OtherBrand: "OTHER_BRAND", + Visa: "VISA", + MasterCard: "MASTER_CARD", + AmericanExpress: "AMERICAN_EXPRESS", + Discover: "DISCOVER", + DiscoverDiners: "DISCOVER_DINERS", + Jcb: "JCB", + ChinaUnionpay: "CHINA_UNIONPAY", + SquareGiftCard: "SQUARE_GIFT_CARD", +} as const; diff --git a/src/api/types/V1TenderEntryMethod.ts b/src/api/types/V1TenderEntryMethod.ts new file mode 100644 index 000000000..d567aee00 --- /dev/null +++ b/src/api/types/V1TenderEntryMethod.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V1TenderEntryMethod = + | "MANUAL" + | "SCANNED" + | "SQUARE_CASH" + | "SQUARE_WALLET" + | "SWIPED" + | "WEB_FORM" + | "OTHER"; +export const V1TenderEntryMethod = { + Manual: "MANUAL", + Scanned: "SCANNED", + SquareCash: "SQUARE_CASH", + SquareWallet: "SQUARE_WALLET", + Swiped: "SWIPED", + WebForm: "WEB_FORM", + Other: "OTHER", +} as const; diff --git a/src/api/types/V1TenderType.ts b/src/api/types/V1TenderType.ts new file mode 100644 index 000000000..1f6d4569a --- /dev/null +++ b/src/api/types/V1TenderType.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V1TenderType = + | "CREDIT_CARD" + | "CASH" + | "THIRD_PARTY_CARD" + | "NO_SALE" + | "SQUARE_WALLET" + | "SQUARE_GIFT_CARD" + | "UNKNOWN" + | "OTHER"; +export const V1TenderType = { + CreditCard: "CREDIT_CARD", + Cash: "CASH", + ThirdPartyCard: "THIRD_PARTY_CARD", + NoSale: "NO_SALE", + SquareWallet: "SQUARE_WALLET", + SquareGiftCard: "SQUARE_GIFT_CARD", + Unknown: "UNKNOWN", + Other: "OTHER", +} as const; diff --git a/src/api/types/V1UpdateOrderRequestAction.ts b/src/api/types/V1UpdateOrderRequestAction.ts new file mode 100644 index 000000000..4b4434d3b --- /dev/null +++ b/src/api/types/V1UpdateOrderRequestAction.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type V1UpdateOrderRequestAction = "COMPLETE" | "CANCEL" | "REFUND"; +export const V1UpdateOrderRequestAction = { + Complete: "COMPLETE", + Cancel: "CANCEL", + Refund: "REFUND", +} as const; diff --git a/src/api/types/Vendor.ts b/src/api/types/Vendor.ts new file mode 100644 index 000000000..b8b908a2a --- /dev/null +++ b/src/api/types/Vendor.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents a supplier to a seller. + */ +export interface Vendor { + /** + * A unique Square-generated ID for the [Vendor](entity:Vendor). + * This field is required when attempting to update a [Vendor](entity:Vendor). + */ + id?: string; + /** + * An RFC 3339-formatted timestamp that indicates when the + * [Vendor](entity:Vendor) was created. + */ + createdAt?: string; + /** + * An RFC 3339-formatted timestamp that indicates when the + * [Vendor](entity:Vendor) was last updated. + */ + updatedAt?: string; + /** + * The name of the [Vendor](entity:Vendor). + * This field is required when attempting to create or update a [Vendor](entity:Vendor). + */ + name?: string | null; + /** The address of the [Vendor](entity:Vendor). */ + address?: Square.Address; + /** The contacts of the [Vendor](entity:Vendor). */ + contacts?: Square.VendorContact[] | null; + /** The account number of the [Vendor](entity:Vendor). */ + accountNumber?: string | null; + /** A note detailing information about the [Vendor](entity:Vendor). */ + note?: string | null; + /** The version of the [Vendor](entity:Vendor). */ + version?: number; + /** + * The status of the [Vendor](entity:Vendor). + * See [Status](#type-status) for possible values + */ + status?: Square.VendorStatus; +} diff --git a/src/api/types/VendorContact.ts b/src/api/types/VendorContact.ts new file mode 100644 index 000000000..e965078c5 --- /dev/null +++ b/src/api/types/VendorContact.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a contact of a [Vendor](entity:Vendor). + */ +export interface VendorContact { + /** + * A unique Square-generated ID for the [VendorContact](entity:VendorContact). + * This field is required when attempting to update a [VendorContact](entity:VendorContact). + */ + id?: string; + /** + * The name of the [VendorContact](entity:VendorContact). + * This field is required when attempting to create a [Vendor](entity:Vendor). + */ + name?: string | null; + /** The email address of the [VendorContact](entity:VendorContact). */ + emailAddress?: string | null; + /** The phone number of the [VendorContact](entity:VendorContact). */ + phoneNumber?: string | null; + /** The state of the [VendorContact](entity:VendorContact). */ + removed?: boolean | null; + /** The ordinal of the [VendorContact](entity:VendorContact). */ + ordinal: number; +} diff --git a/src/api/types/VendorStatus.ts b/src/api/types/VendorStatus.ts new file mode 100644 index 000000000..dc11fc135 --- /dev/null +++ b/src/api/types/VendorStatus.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The status of the [Vendor](entity:Vendor), + * whether a [Vendor](entity:Vendor) is active or inactive. + */ +export type VendorStatus = "ACTIVE" | "INACTIVE"; +export const VendorStatus = { + Active: "ACTIVE", + Inactive: "INACTIVE", +} as const; diff --git a/src/api/types/VisibilityFilter.ts b/src/api/types/VisibilityFilter.ts new file mode 100644 index 000000000..7660e6b1c --- /dev/null +++ b/src/api/types/VisibilityFilter.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. + */ +export type VisibilityFilter = "ALL" | "READ" | "READ_WRITE"; +export const VisibilityFilter = { + All: "ALL", + Read: "READ", + ReadWrite: "READ_WRITE", +} as const; diff --git a/src/api/types/VoidTransactionResponse.ts b/src/api/types/VoidTransactionResponse.ts new file mode 100644 index 000000000..ad3847dbb --- /dev/null +++ b/src/api/types/VoidTransactionResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Defines the fields that are included in the response body of + * a request to the [VoidTransaction](api-endpoint:Transactions-VoidTransaction) endpoint. + */ +export interface VoidTransactionResponse { + /** Any errors that occurred during the request. */ + errors?: Square.Error_[]; +} diff --git a/src/api/types/WageSetting.ts b/src/api/types/WageSetting.ts new file mode 100644 index 000000000..eb4401a99 --- /dev/null +++ b/src/api/types/WageSetting.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Represents information about the overtime exemption status, job assignments, and compensation + * for a [team member](entity:TeamMember). + */ +export interface WageSetting { + /** The ID of the team member associated with the wage setting. */ + teamMemberId?: string | null; + /** + * **Required** The ordered list of jobs that the team member is assigned to. + * The first job assignment is considered the team member's primary job. + */ + jobAssignments?: Square.JobAssignment[] | null; + /** Whether the team member is exempt from the overtime rules of the seller's country. */ + isOvertimeExempt?: boolean | null; + /** + * **Read only** Used for resolving concurrency issues. The request fails if the version + * provided does not match the server version at the time of the request. If not provided, + * Square executes a blind write, potentially overwriting data from another write. For more information, + * see [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency). + */ + version?: number; + /** The timestamp when the wage setting was created, in RFC 3339 format. */ + createdAt?: string; + /** The timestamp when the wage setting was last updated, in RFC 3339 format. */ + updatedAt?: string; +} diff --git a/src/api/types/WebhookSubscription.ts b/src/api/types/WebhookSubscription.ts new file mode 100644 index 000000000..5691d95e2 --- /dev/null +++ b/src/api/types/WebhookSubscription.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents the details of a webhook subscription, including notification URL, + * event types, and signature key. + */ +export interface WebhookSubscription { + /** A Square-generated unique ID for the subscription. */ + id?: string; + /** The name of this subscription. */ + name?: string | null; + /** Indicates whether the subscription is enabled (`true`) or not (`false`). */ + enabled?: boolean | null; + /** The event types associated with this subscription. */ + eventTypes?: string[] | null; + /** The URL to which webhooks are sent. */ + notificationUrl?: string | null; + /** + * The API version of the subscription. + * This field is optional for `CreateWebhookSubscription`. + * The value defaults to the API version used by the application. + */ + apiVersion?: string | null; + /** The Square-generated signature key used to validate the origin of the webhook event. */ + signatureKey?: string; + /** The timestamp of when the subscription was created, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". */ + createdAt?: string; + /** + * The timestamp of when the subscription was last updated, in RFC 3339 format. + * For example, "2016-09-04T23:59:33.123Z". + */ + updatedAt?: string; +} diff --git a/src/api/types/Weekday.ts b/src/api/types/Weekday.ts new file mode 100644 index 000000000..f944a12bf --- /dev/null +++ b/src/api/types/Weekday.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The days of the week. + */ +export type Weekday = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN"; +export const Weekday = { + Mon: "MON", + Tue: "TUE", + Wed: "WED", + Thu: "THU", + Fri: "FRI", + Sat: "SAT", + Sun: "SUN", +} as const; diff --git a/src/api/types/WorkweekConfig.ts b/src/api/types/WorkweekConfig.ts new file mode 100644 index 000000000..5d26dd907 --- /dev/null +++ b/src/api/types/WorkweekConfig.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Square from "../index"; + +/** + * Sets the day of the week and hour of the day that a business starts a + * workweek. This is used to calculate overtime pay. + */ +export interface WorkweekConfig { + /** The UUID for this object. */ + id?: string; + /** + * The day of the week on which a business week starts for + * compensation purposes. + * See [Weekday](#type-weekday) for possible values + */ + startOfWeek: Square.Weekday; + /** + * The local time at which a business week starts. Represented as a + * string in `HH:MM` format (`HH:MM:SS` is also accepted, but seconds are + * truncated). + */ + startOfDayLocalTime: string; + /** + * Used for resolving concurrency issues. The request fails if the version + * provided does not match the server version at the time of the request. If not provided, + * Square executes a blind write; potentially overwriting data from another + * write. + */ + version?: number; + /** A read-only timestamp in RFC 3339 format; presented in UTC. */ + createdAt?: string; + /** A read-only timestamp in RFC 3339 format; presented in UTC. */ + updatedAt?: string; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts new file mode 100644 index 000000000..af8e87c8a --- /dev/null +++ b/src/api/types/index.ts @@ -0,0 +1,913 @@ +export * from "./AchDetails"; +export * from "./AcceptDisputeResponse"; +export * from "./AcceptedPaymentMethods"; +export * from "./AccumulateLoyaltyPointsResponse"; +export * from "./ActionCancelReason"; +export * from "./ActivityType"; +export * from "./AddGroupToCustomerResponse"; +export * from "./AdditionalRecipient"; +export * from "./Address"; +export * from "./AdjustLoyaltyPointsResponse"; +export * from "./AfterpayDetails"; +export * from "./ApplicationDetails"; +export * from "./ApplicationDetailsExternalSquareProduct"; +export * from "./ApplicationType"; +export * from "./AppointmentSegment"; +export * from "./ArchivedState"; +export * from "./Availability"; +export * from "./BankAccount"; +export * from "./BankAccountPaymentDetails"; +export * from "./BankAccountStatus"; +export * from "./BankAccountType"; +export * from "./BatchChangeInventoryRequest"; +export * from "./BatchChangeInventoryResponse"; +export * from "./BatchDeleteCatalogObjectsResponse"; +export * from "./BatchGetCatalogObjectsResponse"; +export * from "./BatchRetrieveInventoryChangesRequest"; +export * from "./BatchGetInventoryChangesResponse"; +export * from "./BatchGetInventoryCountsRequest"; +export * from "./BatchGetInventoryCountsResponse"; +export * from "./BatchGetOrdersResponse"; +export * from "./BatchUpsertCatalogObjectsResponse"; +export * from "./Booking"; +export * from "./BookingBookingSource"; +export * from "./BookingCreatorDetails"; +export * from "./BookingCreatorDetailsCreatorType"; +export * from "./BookingCustomAttributeDeleteRequest"; +export * from "./BookingCustomAttributeDeleteResponse"; +export * from "./BookingCustomAttributeUpsertRequest"; +export * from "./BookingCustomAttributeUpsertResponse"; +export * from "./BookingStatus"; +export * from "./Break"; +export * from "./BreakType"; +export * from "./BulkCreateCustomerData"; +export * from "./BulkCreateCustomersResponse"; +export * from "./BatchCreateTeamMembersResponse"; +export * from "./BatchCreateVendorsResponse"; +export * from "./BulkDeleteBookingCustomAttributesResponse"; +export * from "./BulkDeleteCustomersResponse"; +export * from "./BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest"; +export * from "./BulkDeleteLocationCustomAttributesResponse"; +export * from "./BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse"; +export * from "./BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest"; +export * from "./BulkDeleteMerchantCustomAttributesResponse"; +export * from "./BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse"; +export * from "./BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute"; +export * from "./BulkDeleteOrderCustomAttributesResponse"; +export * from "./BulkRetrieveBookingsResponse"; +export * from "./BulkRetrieveCustomersResponse"; +export * from "./BulkRetrieveTeamMemberBookingProfilesResponse"; +export * from "./BatchGetVendorsResponse"; +export * from "./BulkSwapPlanResponse"; +export * from "./BulkUpdateCustomerData"; +export * from "./BulkUpdateCustomersResponse"; +export * from "./BatchUpdateTeamMembersResponse"; +export * from "./BatchUpdateVendorsResponse"; +export * from "./BulkUpsertBookingCustomAttributesResponse"; +export * from "./BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest"; +export * from "./BatchUpsertCustomerCustomAttributesResponse"; +export * from "./BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse"; +export * from "./BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest"; +export * from "./BulkUpsertLocationCustomAttributesResponse"; +export * from "./BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse"; +export * from "./BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest"; +export * from "./BulkUpsertMerchantCustomAttributesResponse"; +export * from "./BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse"; +export * from "./BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute"; +export * from "./BulkUpsertOrderCustomAttributesResponse"; +export * from "./BusinessAppointmentSettings"; +export * from "./BusinessAppointmentSettingsAlignmentTime"; +export * from "./BusinessAppointmentSettingsBookingLocationType"; +export * from "./BusinessAppointmentSettingsCancellationPolicy"; +export * from "./BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType"; +export * from "./BusinessBookingProfile"; +export * from "./BusinessBookingProfileBookingPolicy"; +export * from "./BusinessBookingProfileCustomerTimezoneChoice"; +export * from "./BusinessHours"; +export * from "./BusinessHoursPeriod"; +export * from "./BuyNowPayLaterDetails"; +export * from "./CalculateLoyaltyPointsResponse"; +export * from "./CalculateOrderResponse"; +export * from "./CancelBookingResponse"; +export * from "./CancelInvoiceResponse"; +export * from "./CancelLoyaltyPromotionResponse"; +export * from "./CancelPaymentByIdempotencyKeyResponse"; +export * from "./CancelPaymentResponse"; +export * from "./CancelSubscriptionResponse"; +export * from "./CancelTerminalActionResponse"; +export * from "./CancelTerminalCheckoutResponse"; +export * from "./CancelTerminalRefundResponse"; +export * from "./CaptureTransactionResponse"; +export * from "./Card"; +export * from "./CardBrand"; +export * from "./CardCoBrand"; +export * from "./CardPaymentDetails"; +export * from "./CardPaymentTimeline"; +export * from "./CardPrepaidType"; +export * from "./CardType"; +export * from "./CashAppDetails"; +export * from "./CashDrawerDevice"; +export * from "./CashDrawerEventType"; +export * from "./CashDrawerShift"; +export * from "./CashDrawerShiftEvent"; +export * from "./CashDrawerShiftState"; +export * from "./CashDrawerShiftSummary"; +export * from "./CashPaymentDetails"; +export * from "./CatalogCategory"; +export * from "./CatalogCategoryType"; +export * from "./CatalogCustomAttributeDefinition"; +export * from "./CatalogCustomAttributeDefinitionAppVisibility"; +export * from "./CatalogCustomAttributeDefinitionNumberConfig"; +export * from "./CatalogCustomAttributeDefinitionSelectionConfig"; +export * from "./CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection"; +export * from "./CatalogCustomAttributeDefinitionSellerVisibility"; +export * from "./CatalogCustomAttributeDefinitionStringConfig"; +export * from "./CatalogCustomAttributeDefinitionType"; +export * from "./CatalogCustomAttributeValue"; +export * from "./CatalogDiscount"; +export * from "./CatalogDiscountModifyTaxBasis"; +export * from "./CatalogDiscountType"; +export * from "./CatalogEcomSeoData"; +export * from "./CatalogIdMapping"; +export * from "./CatalogImage"; +export * from "./CatalogInfoResponse"; +export * from "./CatalogInfoResponseLimits"; +export * from "./CatalogItem"; +export * from "./CatalogItemFoodAndBeverageDetails"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreference"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceType"; +export * from "./CatalogItemFoodAndBeverageDetailsIngredient"; +export * from "./CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient"; +export * from "./CatalogItemModifierListInfo"; +export * from "./CatalogItemOption"; +export * from "./CatalogItemOptionForItem"; +export * from "./CatalogItemOptionValue"; +export * from "./CatalogItemOptionValueForItemVariation"; +export * from "./CatalogItemProductType"; +export * from "./CatalogItemVariation"; +export * from "./CatalogMeasurementUnit"; +export * from "./CatalogModifier"; +export * from "./CatalogModifierList"; +export * from "./CatalogModifierListModifierType"; +export * from "./CatalogModifierListSelectionType"; +export * from "./CatalogModifierOverride"; +export * from "./CatalogObject"; +export * from "./CatalogObjectBatch"; +export * from "./CatalogObjectCategory"; +export * from "./CatalogObjectBase"; +export * from "./CatalogObjectReference"; +export * from "./CatalogObjectType"; +export * from "./CatalogPricingRule"; +export * from "./CatalogPricingType"; +export * from "./CatalogProductSet"; +export * from "./CatalogQuery"; +export * from "./CatalogQueryExact"; +export * from "./CatalogQueryItemVariationsForItemOptionValues"; +export * from "./CatalogQueryItemsForItemOptions"; +export * from "./CatalogQueryItemsForModifierList"; +export * from "./CatalogQueryItemsForTax"; +export * from "./CatalogQueryPrefix"; +export * from "./CatalogQueryRange"; +export * from "./CatalogQuerySet"; +export * from "./CatalogQuerySortedAttribute"; +export * from "./CatalogQueryText"; +export * from "./CatalogQuickAmount"; +export * from "./CatalogQuickAmountType"; +export * from "./CatalogQuickAmountsSettings"; +export * from "./CatalogQuickAmountsSettingsOption"; +export * from "./CatalogStockConversion"; +export * from "./CatalogSubscriptionPlan"; +export * from "./CatalogTax"; +export * from "./CatalogTimePeriod"; +export * from "./CatalogV1Id"; +export * from "./CategoryPathToRootNode"; +export * from "./ChangeBillingAnchorDateResponse"; +export * from "./ChangeTiming"; +export * from "./ChargeRequestAdditionalRecipient"; +export * from "./Checkout"; +export * from "./CheckoutLocationSettings"; +export * from "./CheckoutLocationSettingsBranding"; +export * from "./CheckoutLocationSettingsBrandingButtonShape"; +export * from "./CheckoutLocationSettingsBrandingHeaderType"; +export * from "./CheckoutLocationSettingsCoupons"; +export * from "./CheckoutLocationSettingsPolicy"; +export * from "./CheckoutLocationSettingsTipping"; +export * from "./CheckoutMerchantSettings"; +export * from "./CheckoutMerchantSettingsPaymentMethods"; +export * from "./CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay"; +export * from "./CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange"; +export * from "./CheckoutMerchantSettingsPaymentMethodsPaymentMethod"; +export * from "./CheckoutOptions"; +export * from "./CheckoutOptionsPaymentType"; +export * from "./ClearpayDetails"; +export * from "./CloneOrderResponse"; +export * from "./CollectedData"; +export * from "./CompletePaymentResponse"; +export * from "./Component"; +export * from "./ComponentComponentType"; +export * from "./ConfirmationDecision"; +export * from "./ConfirmationOptions"; +export * from "./Coordinates"; +export * from "./Country"; +export * from "./CreateBookingCustomAttributeDefinitionResponse"; +export * from "./CreateBookingResponse"; +export * from "./CreateBreakTypeResponse"; +export * from "./CreateCardResponse"; +export * from "./CreateCatalogImageRequest"; +export * from "./CreateCatalogImageResponse"; +export * from "./CreateCheckoutResponse"; +export * from "./CreateCustomerCardResponse"; +export * from "./CreateCustomerCustomAttributeDefinitionResponse"; +export * from "./CreateCustomerGroupResponse"; +export * from "./CreateCustomerResponse"; +export * from "./CreateDeviceCodeResponse"; +export * from "./CreateDisputeEvidenceFileRequest"; +export * from "./CreateDisputeEvidenceFileResponse"; +export * from "./CreateDisputeEvidenceTextResponse"; +export * from "./CreateGiftCardActivityResponse"; +export * from "./CreateGiftCardResponse"; +export * from "./CreateInvoiceAttachmentResponse"; +export * from "./CreateInvoiceResponse"; +export * from "./CreateJobResponse"; +export * from "./CreateLocationCustomAttributeDefinitionResponse"; +export * from "./CreateLocationResponse"; +export * from "./CreateLoyaltyAccountResponse"; +export * from "./CreateLoyaltyPromotionResponse"; +export * from "./CreateLoyaltyRewardResponse"; +export * from "./CreateMerchantCustomAttributeDefinitionResponse"; +export * from "./CreateMobileAuthorizationCodeResponse"; +export * from "./CreateOrderCustomAttributeDefinitionResponse"; +export * from "./CreateOrderRequest"; +export * from "./CreateOrderResponse"; +export * from "./CreatePaymentLinkResponse"; +export * from "./CreatePaymentResponse"; +export * from "./CreateShiftResponse"; +export * from "./CreateSubscriptionResponse"; +export * from "./CreateTeamMemberRequest"; +export * from "./CreateTeamMemberResponse"; +export * from "./CreateTerminalActionResponse"; +export * from "./CreateTerminalCheckoutResponse"; +export * from "./CreateTerminalRefundResponse"; +export * from "./CreateVendorResponse"; +export * from "./CreateWebhookSubscriptionResponse"; +export * from "./Currency"; +export * from "./CustomAttribute"; +export * from "./CustomAttributeDefinition"; +export * from "./CustomAttributeDefinitionVisibility"; +export * from "./CustomAttributeFilter"; +export * from "./CustomField"; +export * from "./Customer"; +export * from "./CustomerAddressFilter"; +export * from "./CustomerCreationSource"; +export * from "./CustomerCreationSourceFilter"; +export * from "./CustomerCustomAttributeFilter"; +export * from "./CustomerCustomAttributeFilterValue"; +export * from "./CustomerCustomAttributeFilters"; +export * from "./CustomerDetails"; +export * from "./CustomerFilter"; +export * from "./CustomerGroup"; +export * from "./CustomerInclusionExclusion"; +export * from "./CustomerPreferences"; +export * from "./CustomerQuery"; +export * from "./CustomerSegment"; +export * from "./CustomerSort"; +export * from "./CustomerSortField"; +export * from "./CustomerTaxIds"; +export * from "./CustomerTextFilter"; +export * from "./DataCollectionOptions"; +export * from "./DataCollectionOptionsInputType"; +export * from "./DateRange"; +export * from "./DayOfWeek"; +export * from "./DeleteBookingCustomAttributeDefinitionResponse"; +export * from "./DeleteBookingCustomAttributeResponse"; +export * from "./DeleteBreakTypeResponse"; +export * from "./DeleteCatalogObjectResponse"; +export * from "./DeleteCustomerCardResponse"; +export * from "./DeleteCustomerCustomAttributeDefinitionResponse"; +export * from "./DeleteCustomerCustomAttributeResponse"; +export * from "./DeleteCustomerGroupResponse"; +export * from "./DeleteCustomerResponse"; +export * from "./DeleteDisputeEvidenceResponse"; +export * from "./DeleteInvoiceAttachmentResponse"; +export * from "./DeleteInvoiceResponse"; +export * from "./DeleteLocationCustomAttributeDefinitionResponse"; +export * from "./DeleteLocationCustomAttributeResponse"; +export * from "./DeleteLoyaltyRewardResponse"; +export * from "./DeleteMerchantCustomAttributeDefinitionResponse"; +export * from "./DeleteMerchantCustomAttributeResponse"; +export * from "./DeleteOrderCustomAttributeDefinitionResponse"; +export * from "./DeleteOrderCustomAttributeResponse"; +export * from "./DeletePaymentLinkResponse"; +export * from "./DeleteShiftResponse"; +export * from "./DeleteSnippetResponse"; +export * from "./DeleteSubscriptionActionResponse"; +export * from "./DeleteWebhookSubscriptionResponse"; +export * from "./Destination"; +export * from "./DestinationDetails"; +export * from "./DestinationDetailsCardRefundDetails"; +export * from "./DestinationDetailsCashRefundDetails"; +export * from "./DestinationDetailsExternalRefundDetails"; +export * from "./DestinationType"; +export * from "./Device"; +export * from "./DeviceAttributes"; +export * from "./DeviceAttributesDeviceType"; +export * from "./DeviceCheckoutOptions"; +export * from "./DeviceCode"; +export * from "./DeviceCodeStatus"; +export * from "./DeviceComponentDetailsApplicationDetails"; +export * from "./DeviceComponentDetailsBatteryDetails"; +export * from "./DeviceComponentDetailsCardReaderDetails"; +export * from "./DeviceComponentDetailsEthernetDetails"; +export * from "./DeviceComponentDetailsExternalPower"; +export * from "./DeviceComponentDetailsMeasurement"; +export * from "./DeviceComponentDetailsWiFiDetails"; +export * from "./DeviceDetails"; +export * from "./DeviceMetadata"; +export * from "./DeviceStatus"; +export * from "./DeviceStatusCategory"; +export * from "./DigitalWalletDetails"; +export * from "./DisableCardResponse"; +export * from "./DisableEventsResponse"; +export * from "./DismissTerminalActionResponse"; +export * from "./DismissTerminalCheckoutResponse"; +export * from "./DismissTerminalRefundResponse"; +export * from "./Dispute"; +export * from "./DisputeEvidence"; +export * from "./DisputeEvidenceFile"; +export * from "./DisputeEvidenceType"; +export * from "./DisputeReason"; +export * from "./DisputeState"; +export * from "./DisputedPayment"; +export * from "./Employee"; +export * from "./EmployeeStatus"; +export * from "./EmployeeWage"; +export * from "./EnableEventsResponse"; +export * from "./Error_"; +export * from "./ErrorCategory"; +export * from "./ErrorCode"; +export * from "./Event"; +export * from "./EventData"; +export * from "./EventMetadata"; +export * from "./EventTypeMetadata"; +export * from "./ExcludeStrategy"; +export * from "./ExternalPaymentDetails"; +export * from "./FilterValue"; +export * from "./FloatNumberRange"; +export * from "./Fulfillment"; +export * from "./FulfillmentDeliveryDetails"; +export * from "./FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType"; +export * from "./FulfillmentFulfillmentEntry"; +export * from "./FulfillmentFulfillmentLineItemApplication"; +export * from "./FulfillmentPickupDetails"; +export * from "./FulfillmentPickupDetailsCurbsidePickupDetails"; +export * from "./FulfillmentPickupDetailsScheduleType"; +export * from "./FulfillmentRecipient"; +export * from "./FulfillmentShipmentDetails"; +export * from "./FulfillmentState"; +export * from "./FulfillmentType"; +export * from "./GetBankAccountByV1IdResponse"; +export * from "./GetBankAccountResponse"; +export * from "./GetBreakTypeResponse"; +export * from "./GetDeviceCodeResponse"; +export * from "./GetDeviceResponse"; +export * from "./GetEmployeeWageResponse"; +export * from "./GetInvoiceResponse"; +export * from "./GetPaymentRefundResponse"; +export * from "./GetPaymentResponse"; +export * from "./GetPayoutResponse"; +export * from "./GetShiftResponse"; +export * from "./GetTeamMemberWageResponse"; +export * from "./GetTerminalActionResponse"; +export * from "./GetTerminalCheckoutResponse"; +export * from "./GetTerminalRefundResponse"; +export * from "./GiftCard"; +export * from "./GiftCardActivity"; +export * from "./GiftCardActivityActivate"; +export * from "./GiftCardActivityAdjustDecrement"; +export * from "./GiftCardActivityAdjustDecrementReason"; +export * from "./GiftCardActivityAdjustIncrement"; +export * from "./GiftCardActivityAdjustIncrementReason"; +export * from "./GiftCardActivityBlock"; +export * from "./GiftCardActivityBlockReason"; +export * from "./GiftCardActivityClearBalance"; +export * from "./GiftCardActivityClearBalanceReason"; +export * from "./GiftCardActivityDeactivate"; +export * from "./GiftCardActivityDeactivateReason"; +export * from "./GiftCardActivityImport"; +export * from "./GiftCardActivityImportReversal"; +export * from "./GiftCardActivityLoad"; +export * from "./GiftCardActivityRedeem"; +export * from "./GiftCardActivityRedeemStatus"; +export * from "./GiftCardActivityRefund"; +export * from "./GiftCardActivityTransferBalanceFrom"; +export * from "./GiftCardActivityTransferBalanceTo"; +export * from "./GiftCardActivityType"; +export * from "./GiftCardActivityUnblock"; +export * from "./GiftCardActivityUnblockReason"; +export * from "./GiftCardActivityUnlinkedActivityRefund"; +export * from "./GiftCardGanSource"; +export * from "./GiftCardStatus"; +export * from "./GiftCardType"; +export * from "./InventoryAdjustment"; +export * from "./InventoryAdjustmentGroup"; +export * from "./InventoryAlertType"; +export * from "./InventoryChange"; +export * from "./InventoryChangeType"; +export * from "./InventoryCount"; +export * from "./InventoryPhysicalCount"; +export * from "./InventoryState"; +export * from "./InventoryTransfer"; +export * from "./Invoice"; +export * from "./InvoiceAcceptedPaymentMethods"; +export * from "./InvoiceAttachment"; +export * from "./InvoiceAutomaticPaymentSource"; +export * from "./InvoiceCustomField"; +export * from "./InvoiceCustomFieldPlacement"; +export * from "./InvoiceDeliveryMethod"; +export * from "./InvoiceFilter"; +export * from "./InvoicePaymentReminder"; +export * from "./InvoicePaymentReminderStatus"; +export * from "./InvoicePaymentRequest"; +export * from "./InvoiceQuery"; +export * from "./InvoiceRecipient"; +export * from "./InvoiceRecipientTaxIds"; +export * from "./InvoiceRequestMethod"; +export * from "./InvoiceRequestType"; +export * from "./InvoiceSort"; +export * from "./InvoiceSortField"; +export * from "./InvoiceStatus"; +export * from "./ItemVariationLocationOverrides"; +export * from "./Job"; +export * from "./JobAssignment"; +export * from "./JobAssignmentPayType"; +export * from "./LinkCustomerToGiftCardResponse"; +export * from "./ListBankAccountsResponse"; +export * from "./ListBookingCustomAttributeDefinitionsResponse"; +export * from "./ListBookingCustomAttributesResponse"; +export * from "./ListBookingsResponse"; +export * from "./ListBreakTypesResponse"; +export * from "./ListCardsResponse"; +export * from "./ListCashDrawerShiftEventsResponse"; +export * from "./ListCashDrawerShiftsResponse"; +export * from "./ListCatalogResponse"; +export * from "./ListCustomerCustomAttributeDefinitionsResponse"; +export * from "./ListCustomerCustomAttributesResponse"; +export * from "./ListCustomerGroupsResponse"; +export * from "./ListCustomerSegmentsResponse"; +export * from "./ListCustomersResponse"; +export * from "./ListDeviceCodesResponse"; +export * from "./ListDevicesResponse"; +export * from "./ListDisputeEvidenceResponse"; +export * from "./ListDisputesResponse"; +export * from "./ListEmployeeWagesResponse"; +export * from "./ListEmployeesResponse"; +export * from "./ListEventTypesResponse"; +export * from "./ListGiftCardActivitiesResponse"; +export * from "./ListGiftCardsResponse"; +export * from "./ListInvoicesResponse"; +export * from "./ListJobsResponse"; +export * from "./ListLocationBookingProfilesResponse"; +export * from "./ListLocationCustomAttributeDefinitionsResponse"; +export * from "./ListLocationCustomAttributesResponse"; +export * from "./ListLocationsResponse"; +export * from "./ListLoyaltyProgramsResponse"; +export * from "./ListLoyaltyPromotionsResponse"; +export * from "./ListMerchantCustomAttributeDefinitionsResponse"; +export * from "./ListMerchantCustomAttributesResponse"; +export * from "./ListMerchantsResponse"; +export * from "./ListOrderCustomAttributeDefinitionsResponse"; +export * from "./ListOrderCustomAttributesResponse"; +export * from "./ListPaymentLinksResponse"; +export * from "./ListPaymentRefundsResponse"; +export * from "./ListPaymentsResponse"; +export * from "./ListPayoutEntriesResponse"; +export * from "./ListPayoutsResponse"; +export * from "./ListSitesResponse"; +export * from "./ListSubscriptionEventsResponse"; +export * from "./ListTeamMemberBookingProfilesResponse"; +export * from "./ListTeamMemberWagesResponse"; +export * from "./ListTransactionsResponse"; +export * from "./ListWebhookEventTypesResponse"; +export * from "./ListWebhookSubscriptionsResponse"; +export * from "./ListWorkweekConfigsResponse"; +export * from "./Location"; +export * from "./LocationBookingProfile"; +export * from "./LocationCapability"; +export * from "./LocationStatus"; +export * from "./LocationType"; +export * from "./LoyaltyAccount"; +export * from "./LoyaltyAccountExpiringPointDeadline"; +export * from "./LoyaltyAccountMapping"; +export * from "./LoyaltyEvent"; +export * from "./LoyaltyEventAccumulatePoints"; +export * from "./LoyaltyEventAccumulatePromotionPoints"; +export * from "./LoyaltyEventAdjustPoints"; +export * from "./LoyaltyEventCreateReward"; +export * from "./LoyaltyEventDateTimeFilter"; +export * from "./LoyaltyEventDeleteReward"; +export * from "./LoyaltyEventExpirePoints"; +export * from "./LoyaltyEventFilter"; +export * from "./LoyaltyEventLocationFilter"; +export * from "./LoyaltyEventLoyaltyAccountFilter"; +export * from "./LoyaltyEventOrderFilter"; +export * from "./LoyaltyEventOther"; +export * from "./LoyaltyEventQuery"; +export * from "./LoyaltyEventRedeemReward"; +export * from "./LoyaltyEventSource"; +export * from "./LoyaltyEventType"; +export * from "./LoyaltyEventTypeFilter"; +export * from "./LoyaltyProgram"; +export * from "./LoyaltyProgramAccrualRule"; +export * from "./LoyaltyProgramAccrualRuleCategoryData"; +export * from "./LoyaltyProgramAccrualRuleItemVariationData"; +export * from "./LoyaltyProgramAccrualRuleSpendData"; +export * from "./LoyaltyProgramAccrualRuleTaxMode"; +export * from "./LoyaltyProgramAccrualRuleType"; +export * from "./LoyaltyProgramAccrualRuleVisitData"; +export * from "./LoyaltyProgramExpirationPolicy"; +export * from "./LoyaltyProgramRewardDefinition"; +export * from "./LoyaltyProgramRewardDefinitionScope"; +export * from "./LoyaltyProgramRewardDefinitionType"; +export * from "./LoyaltyProgramRewardTier"; +export * from "./LoyaltyProgramStatus"; +export * from "./LoyaltyProgramTerminology"; +export * from "./LoyaltyPromotion"; +export * from "./LoyaltyPromotionAvailableTimeData"; +export * from "./LoyaltyPromotionIncentive"; +export * from "./LoyaltyPromotionIncentivePointsAdditionData"; +export * from "./LoyaltyPromotionIncentivePointsMultiplierData"; +export * from "./LoyaltyPromotionIncentiveType"; +export * from "./LoyaltyPromotionStatus"; +export * from "./LoyaltyPromotionTriggerLimit"; +export * from "./LoyaltyPromotionTriggerLimitInterval"; +export * from "./LoyaltyReward"; +export * from "./LoyaltyRewardStatus"; +export * from "./MeasurementUnit"; +export * from "./MeasurementUnitArea"; +export * from "./MeasurementUnitCustom"; +export * from "./MeasurementUnitGeneric"; +export * from "./MeasurementUnitLength"; +export * from "./MeasurementUnitTime"; +export * from "./MeasurementUnitUnitType"; +export * from "./MeasurementUnitVolume"; +export * from "./MeasurementUnitWeight"; +export * from "./Merchant"; +export * from "./MerchantStatus"; +export * from "./ModifierLocationOverrides"; +export * from "./Money"; +export * from "./ObtainTokenResponse"; +export * from "./OfflinePaymentDetails"; +export * from "./Order"; +export * from "./OrderEntry"; +export * from "./OrderLineItem"; +export * from "./OrderLineItemAppliedDiscount"; +export * from "./OrderLineItemAppliedServiceCharge"; +export * from "./OrderLineItemAppliedTax"; +export * from "./OrderLineItemDiscount"; +export * from "./OrderLineItemDiscountScope"; +export * from "./OrderLineItemDiscountType"; +export * from "./OrderLineItemItemType"; +export * from "./OrderLineItemModifier"; +export * from "./OrderLineItemPricingBlocklists"; +export * from "./OrderLineItemPricingBlocklistsBlockedDiscount"; +export * from "./OrderLineItemPricingBlocklistsBlockedTax"; +export * from "./OrderLineItemTax"; +export * from "./OrderLineItemTaxScope"; +export * from "./OrderLineItemTaxType"; +export * from "./OrderMoneyAmounts"; +export * from "./OrderPricingOptions"; +export * from "./OrderQuantityUnit"; +export * from "./OrderReturn"; +export * from "./OrderReturnDiscount"; +export * from "./OrderReturnLineItem"; +export * from "./OrderReturnLineItemModifier"; +export * from "./OrderReturnServiceCharge"; +export * from "./OrderReturnTax"; +export * from "./OrderReturnTip"; +export * from "./OrderReward"; +export * from "./OrderRoundingAdjustment"; +export * from "./OrderServiceCharge"; +export * from "./OrderServiceChargeCalculationPhase"; +export * from "./OrderServiceChargeScope"; +export * from "./OrderServiceChargeTreatmentType"; +export * from "./OrderServiceChargeType"; +export * from "./OrderSource"; +export * from "./OrderState"; +export * from "./PauseSubscriptionResponse"; +export * from "./PayOrderResponse"; +export * from "./Payment"; +export * from "./PaymentBalanceActivityAppFeeRefundDetail"; +export * from "./PaymentBalanceActivityAppFeeRevenueDetail"; +export * from "./PaymentBalanceActivityAutomaticSavingsDetail"; +export * from "./PaymentBalanceActivityAutomaticSavingsReversedDetail"; +export * from "./PaymentBalanceActivityChargeDetail"; +export * from "./PaymentBalanceActivityDepositFeeDetail"; +export * from "./PaymentBalanceActivityDepositFeeReversedDetail"; +export * from "./PaymentBalanceActivityDisputeDetail"; +export * from "./PaymentBalanceActivityFeeDetail"; +export * from "./PaymentBalanceActivityFreeProcessingDetail"; +export * from "./PaymentBalanceActivityHoldAdjustmentDetail"; +export * from "./PaymentBalanceActivityOpenDisputeDetail"; +export * from "./PaymentBalanceActivityOtherAdjustmentDetail"; +export * from "./PaymentBalanceActivityOtherDetail"; +export * from "./PaymentBalanceActivityRefundDetail"; +export * from "./PaymentBalanceActivityReleaseAdjustmentDetail"; +export * from "./PaymentBalanceActivityReserveHoldDetail"; +export * from "./PaymentBalanceActivityReserveReleaseDetail"; +export * from "./PaymentBalanceActivitySquareCapitalPaymentDetail"; +export * from "./PaymentBalanceActivitySquareCapitalReversedPaymentDetail"; +export * from "./PaymentBalanceActivitySquarePayrollTransferDetail"; +export * from "./PaymentBalanceActivitySquarePayrollTransferReversedDetail"; +export * from "./PaymentBalanceActivityTaxOnFeeDetail"; +export * from "./PaymentBalanceActivityThirdPartyFeeDetail"; +export * from "./PaymentBalanceActivityThirdPartyFeeRefundDetail"; +export * from "./PaymentLink"; +export * from "./PaymentLinkRelatedResources"; +export * from "./PaymentOptions"; +export * from "./PaymentOptionsDelayAction"; +export * from "./PaymentRefund"; +export * from "./PaymentSortField"; +export * from "./Payout"; +export * from "./PayoutEntry"; +export * from "./PayoutFee"; +export * from "./PayoutFeeType"; +export * from "./PayoutStatus"; +export * from "./PayoutType"; +export * from "./Phase"; +export * from "./PhaseInput"; +export * from "./PrePopulatedData"; +export * from "./ProcessingFee"; +export * from "./Product"; +export * from "./ProductType"; +export * from "./PublishInvoiceResponse"; +export * from "./QrCodeOptions"; +export * from "./QuickPay"; +export * from "./Range"; +export * from "./ReceiptOptions"; +export * from "./RedeemLoyaltyRewardResponse"; +export * from "./Refund"; +export * from "./RefundPaymentResponse"; +export * from "./RefundStatus"; +export * from "./RegisterDomainResponse"; +export * from "./RegisterDomainResponseStatus"; +export * from "./RemoveGroupFromCustomerResponse"; +export * from "./ResumeSubscriptionResponse"; +export * from "./RetrieveBookingCustomAttributeDefinitionResponse"; +export * from "./RetrieveBookingCustomAttributeResponse"; +export * from "./GetBookingResponse"; +export * from "./GetBusinessBookingProfileResponse"; +export * from "./GetCardResponse"; +export * from "./GetCashDrawerShiftResponse"; +export * from "./GetCatalogObjectResponse"; +export * from "./GetCustomerCustomAttributeDefinitionResponse"; +export * from "./GetCustomerCustomAttributeResponse"; +export * from "./GetCustomerGroupResponse"; +export * from "./GetCustomerResponse"; +export * from "./GetCustomerSegmentResponse"; +export * from "./GetDisputeEvidenceResponse"; +export * from "./GetDisputeResponse"; +export * from "./GetEmployeeResponse"; +export * from "./GetGiftCardFromGanResponse"; +export * from "./GetGiftCardFromNonceResponse"; +export * from "./GetGiftCardResponse"; +export * from "./GetInventoryAdjustmentResponse"; +export * from "./GetInventoryChangesResponse"; +export * from "./GetInventoryCountResponse"; +export * from "./GetInventoryPhysicalCountResponse"; +export * from "./GetInventoryTransferResponse"; +export * from "./RetrieveJobResponse"; +export * from "./RetrieveLocationBookingProfileResponse"; +export * from "./RetrieveLocationCustomAttributeDefinitionResponse"; +export * from "./RetrieveLocationCustomAttributeResponse"; +export * from "./GetLocationResponse"; +export * from "./RetrieveLocationSettingsResponse"; +export * from "./GetLoyaltyAccountResponse"; +export * from "./GetLoyaltyProgramResponse"; +export * from "./GetLoyaltyPromotionResponse"; +export * from "./GetLoyaltyRewardResponse"; +export * from "./RetrieveMerchantCustomAttributeDefinitionResponse"; +export * from "./RetrieveMerchantCustomAttributeResponse"; +export * from "./GetMerchantResponse"; +export * from "./RetrieveMerchantSettingsResponse"; +export * from "./RetrieveOrderCustomAttributeDefinitionResponse"; +export * from "./RetrieveOrderCustomAttributeResponse"; +export * from "./GetOrderResponse"; +export * from "./GetPaymentLinkResponse"; +export * from "./GetSnippetResponse"; +export * from "./GetSubscriptionResponse"; +export * from "./GetTeamMemberBookingProfileResponse"; +export * from "./GetTeamMemberResponse"; +export * from "./RetrieveTokenStatusResponse"; +export * from "./GetTransactionResponse"; +export * from "./GetVendorResponse"; +export * from "./GetWageSettingResponse"; +export * from "./GetWebhookSubscriptionResponse"; +export * from "./RevokeTokenResponse"; +export * from "./RiskEvaluation"; +export * from "./RiskEvaluationRiskLevel"; +export * from "./SaveCardOptions"; +export * from "./SearchAvailabilityFilter"; +export * from "./SearchAvailabilityQuery"; +export * from "./SearchAvailabilityResponse"; +export * from "./SearchCatalogItemsRequestStockLevel"; +export * from "./SearchCatalogItemsResponse"; +export * from "./SearchCatalogObjectsResponse"; +export * from "./SearchCustomersResponse"; +export * from "./SearchEventsFilter"; +export * from "./SearchEventsQuery"; +export * from "./SearchEventsResponse"; +export * from "./SearchEventsSort"; +export * from "./SearchEventsSortField"; +export * from "./SearchInvoicesResponse"; +export * from "./SearchLoyaltyAccountsRequestLoyaltyAccountQuery"; +export * from "./SearchLoyaltyAccountsResponse"; +export * from "./SearchLoyaltyEventsResponse"; +export * from "./SearchLoyaltyRewardsRequestLoyaltyRewardQuery"; +export * from "./SearchLoyaltyRewardsResponse"; +export * from "./SearchOrdersCustomerFilter"; +export * from "./SearchOrdersDateTimeFilter"; +export * from "./SearchOrdersFilter"; +export * from "./SearchOrdersFulfillmentFilter"; +export * from "./SearchOrdersQuery"; +export * from "./SearchOrdersResponse"; +export * from "./SearchOrdersSort"; +export * from "./SearchOrdersSortField"; +export * from "./SearchOrdersSourceFilter"; +export * from "./SearchOrdersStateFilter"; +export * from "./SearchShiftsResponse"; +export * from "./SearchSubscriptionsFilter"; +export * from "./SearchSubscriptionsQuery"; +export * from "./SearchSubscriptionsResponse"; +export * from "./SearchTeamMembersFilter"; +export * from "./SearchTeamMembersQuery"; +export * from "./SearchTeamMembersResponse"; +export * from "./SearchTerminalActionsResponse"; +export * from "./SearchTerminalCheckoutsResponse"; +export * from "./SearchTerminalRefundsResponse"; +export * from "./SearchVendorsRequestFilter"; +export * from "./SearchVendorsRequestSort"; +export * from "./SearchVendorsRequestSortField"; +export * from "./SearchVendorsResponse"; +export * from "./SegmentFilter"; +export * from "./SelectOption"; +export * from "./SelectOptions"; +export * from "./Shift"; +export * from "./ShiftFilter"; +export * from "./ShiftFilterStatus"; +export * from "./ShiftQuery"; +export * from "./ShiftSort"; +export * from "./ShiftSortField"; +export * from "./ShiftStatus"; +export * from "./ShiftWage"; +export * from "./ShiftWorkday"; +export * from "./ShiftWorkdayMatcher"; +export * from "./ShippingFee"; +export * from "./SignatureImage"; +export * from "./SignatureOptions"; +export * from "./Site"; +export * from "./Snippet"; +export * from "./SortOrder"; +export * from "./SourceApplication"; +export * from "./SquareAccountDetails"; +export * from "./StandardUnitDescription"; +export * from "./StandardUnitDescriptionGroup"; +export * from "./SubmitEvidenceResponse"; +export * from "./Subscription"; +export * from "./SubscriptionAction"; +export * from "./SubscriptionActionType"; +export * from "./SubscriptionCadence"; +export * from "./SubscriptionEvent"; +export * from "./SubscriptionEventInfo"; +export * from "./SubscriptionEventInfoCode"; +export * from "./SubscriptionEventSubscriptionEventType"; +export * from "./SubscriptionPhase"; +export * from "./SubscriptionPricing"; +export * from "./SubscriptionPricingType"; +export * from "./SubscriptionSource"; +export * from "./SubscriptionStatus"; +export * from "./SubscriptionTestResult"; +export * from "./SwapPlanResponse"; +export * from "./TaxCalculationPhase"; +export * from "./TaxIds"; +export * from "./TaxInclusionType"; +export * from "./TeamMember"; +export * from "./TeamMemberAssignedLocations"; +export * from "./TeamMemberAssignedLocationsAssignmentType"; +export * from "./TeamMemberBookingProfile"; +export * from "./TeamMemberStatus"; +export * from "./TeamMemberWage"; +export * from "./Tender"; +export * from "./TenderBankAccountDetails"; +export * from "./TenderBankAccountDetailsStatus"; +export * from "./TenderBuyNowPayLaterDetails"; +export * from "./TenderBuyNowPayLaterDetailsBrand"; +export * from "./TenderBuyNowPayLaterDetailsStatus"; +export * from "./TenderCardDetails"; +export * from "./TenderCardDetailsEntryMethod"; +export * from "./TenderCardDetailsStatus"; +export * from "./TenderCashDetails"; +export * from "./TenderSquareAccountDetails"; +export * from "./TenderSquareAccountDetailsStatus"; +export * from "./TenderType"; +export * from "./TerminalAction"; +export * from "./TerminalActionActionType"; +export * from "./TerminalActionQuery"; +export * from "./TerminalActionQueryFilter"; +export * from "./TerminalActionQuerySort"; +export * from "./TerminalCheckout"; +export * from "./TerminalCheckoutQuery"; +export * from "./TerminalCheckoutQueryFilter"; +export * from "./TerminalCheckoutQuerySort"; +export * from "./TerminalRefund"; +export * from "./TerminalRefundQuery"; +export * from "./TerminalRefundQueryFilter"; +export * from "./TerminalRefundQuerySort"; +export * from "./TestWebhookSubscriptionResponse"; +export * from "./TimeRange"; +export * from "./TipSettings"; +export * from "./Transaction"; +export * from "./TransactionProduct"; +export * from "./UnlinkCustomerFromGiftCardResponse"; +export * from "./UpdateBookingCustomAttributeDefinitionResponse"; +export * from "./UpdateBookingResponse"; +export * from "./UpdateBreakTypeResponse"; +export * from "./UpdateCatalogImageRequest"; +export * from "./UpdateCatalogImageResponse"; +export * from "./UpdateCustomerCustomAttributeDefinitionResponse"; +export * from "./UpdateCustomerGroupResponse"; +export * from "./UpdateCustomerResponse"; +export * from "./UpdateInvoiceResponse"; +export * from "./UpdateItemModifierListsResponse"; +export * from "./UpdateItemTaxesResponse"; +export * from "./UpdateJobResponse"; +export * from "./UpdateLocationCustomAttributeDefinitionResponse"; +export * from "./UpdateLocationResponse"; +export * from "./UpdateLocationSettingsResponse"; +export * from "./UpdateMerchantCustomAttributeDefinitionResponse"; +export * from "./UpdateMerchantSettingsResponse"; +export * from "./UpdateOrderCustomAttributeDefinitionResponse"; +export * from "./UpdateOrderResponse"; +export * from "./UpdatePaymentLinkResponse"; +export * from "./UpdatePaymentResponse"; +export * from "./UpdateShiftResponse"; +export * from "./UpdateSubscriptionResponse"; +export * from "./UpdateTeamMemberRequest"; +export * from "./UpdateTeamMemberResponse"; +export * from "./UpdateVendorRequest"; +export * from "./UpdateVendorResponse"; +export * from "./UpdateWageSettingResponse"; +export * from "./UpdateWebhookSubscriptionResponse"; +export * from "./UpdateWebhookSubscriptionSignatureKeyResponse"; +export * from "./UpdateWorkweekConfigResponse"; +export * from "./UpsertBookingCustomAttributeResponse"; +export * from "./UpsertCatalogObjectResponse"; +export * from "./UpsertCustomerCustomAttributeResponse"; +export * from "./UpsertLocationCustomAttributeResponse"; +export * from "./UpsertMerchantCustomAttributeResponse"; +export * from "./UpsertOrderCustomAttributeResponse"; +export * from "./UpsertSnippetResponse"; +export * from "./V1Money"; +export * from "./V1Order"; +export * from "./V1OrderHistoryEntry"; +export * from "./V1OrderHistoryEntryAction"; +export * from "./V1OrderState"; +export * from "./V1Tender"; +export * from "./V1TenderCardBrand"; +export * from "./V1TenderEntryMethod"; +export * from "./V1TenderType"; +export * from "./V1UpdateOrderRequestAction"; +export * from "./Vendor"; +export * from "./VendorContact"; +export * from "./VendorStatus"; +export * from "./VisibilityFilter"; +export * from "./VoidTransactionResponse"; +export * from "./WageSetting"; +export * from "./WebhookSubscription"; +export * from "./Weekday"; +export * from "./WorkweekConfig"; +export * from "./CatalogObjectItem"; +export * from "./CatalogObjectItemVariation"; +export * from "./CatalogObjectTax"; +export * from "./CatalogObjectDiscount"; +export * from "./CatalogObjectModifierList"; +export * from "./CatalogObjectModifier"; +export * from "./CatalogObjectDiningOption"; +export * from "./CatalogObjectTaxExemption"; +export * from "./CatalogObjectServiceCharge"; +export * from "./CatalogObjectTimePeriod"; +export * from "./CatalogObjectProductSet"; +export * from "./CatalogObjectPricingRule"; +export * from "./CatalogObjectImage"; +export * from "./CatalogObjectMeasurementUnit"; +export * from "./CatalogObjectSubscriptionPlan"; +export * from "./CatalogObjectItemOption"; +export * from "./CatalogObjectItemOptionValue"; +export * from "./CatalogObjectCustomAttributeDefinition"; +export * from "./CatalogObjectQuickAmountsSettings"; +export * from "./CatalogObjectComponent"; +export * from "./CatalogObjectComposition"; +export * from "./CatalogObjectResource"; +export * from "./CatalogObjectCheckoutLink"; +export * from "./CatalogObjectAddress"; +export * from "./CatalogObjectSubscriptionProduct"; diff --git a/src/api/v1TransactionsApi.ts b/src/api/v1TransactionsApi.ts deleted file mode 100644 index 22653f559..000000000 --- a/src/api/v1TransactionsApi.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { V1Order, v1OrderSchema } from '../models/v1Order'; -import { - V1UpdateOrderRequest, - v1UpdateOrderRequestSchema, -} from '../models/v1UpdateOrderRequest'; -import { array, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class V1TransactionsApi extends BaseApi { - /** - * Provides summary information for a merchant's online store orders. - * - * @param locationId The ID of the location to list online store orders for. - * @param order The order in which payments are listed in the response. - * @param limit The maximum number of payments to return in a single response. This value cannot - * exceed 200. - * @param batchToken A pagination cursor to retrieve the next set of results for your original query to - * the endpoint. - * @return Response from the API call - * @deprecated - */ - async v1ListOrders( - locationId: string, - order?: string, - limit?: number, - batchToken?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - order: [order, optional(string())], - limit: [limit, optional(number())], - batchToken: [batchToken, optional(string())], - }); - req.query('order', mapped.order); - req.query('limit', mapped.limit); - req.query('batch_token', mapped.batchToken); - req.appendTemplatePath`/v1/${mapped.locationId}/orders`; - req.deprecated('V1TransactionsApi.v1ListOrders'); - req.authenticate([{ global: true }]); - return req.callAsJson(array(v1OrderSchema), requestOptions); - } - - /** - * Provides comprehensive information for a single online store order, including the order's history. - * - * @param locationId The ID of the order's associated location. - * @param orderId The order's Square-issued ID. You obtain this value from Order objects returned by - * the List Orders endpoint - * @return Response from the API call - * @deprecated - */ - async v1RetrieveOrder( - locationId: string, - orderId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - orderId: [orderId, string()], - }); - req.appendTemplatePath`/v1/${mapped.locationId}/orders/${mapped.orderId}`; - req.deprecated('V1TransactionsApi.v1RetrieveOrder'); - req.authenticate([{ global: true }]); - return req.callAsJson(v1OrderSchema, requestOptions); - } - - /** - * Updates the details of an online store order. Every update you perform on an order corresponds to - * one of three actions: - * - * @param locationId The ID of the order's associated location. - * @param orderId The order's Square-issued ID. You obtain this value from Order - * objects returned by the List Orders endpoint - * @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 - * @deprecated - */ - async v1UpdateOrder( - locationId: string, - orderId: string, - body: V1UpdateOrderRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - locationId: [locationId, string()], - orderId: [orderId, string()], - body: [body, v1UpdateOrderRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v1/${mapped.locationId}/orders/${mapped.orderId}`; - req.deprecated('V1TransactionsApi.v1UpdateOrder'); - req.authenticate([{ global: true }]); - return req.callAsJson(v1OrderSchema, requestOptions); - } -} diff --git a/src/api/vendorsApi.ts b/src/api/vendorsApi.ts deleted file mode 100644 index f262ed547..000000000 --- a/src/api/vendorsApi.ts +++ /dev/null @@ -1,204 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - BulkCreateVendorsRequest, - bulkCreateVendorsRequestSchema, -} from '../models/bulkCreateVendorsRequest'; -import { - BulkCreateVendorsResponse, - bulkCreateVendorsResponseSchema, -} from '../models/bulkCreateVendorsResponse'; -import { - BulkRetrieveVendorsRequest, - bulkRetrieveVendorsRequestSchema, -} from '../models/bulkRetrieveVendorsRequest'; -import { - BulkRetrieveVendorsResponse, - bulkRetrieveVendorsResponseSchema, -} from '../models/bulkRetrieveVendorsResponse'; -import { - BulkUpdateVendorsRequest, - bulkUpdateVendorsRequestSchema, -} from '../models/bulkUpdateVendorsRequest'; -import { - BulkUpdateVendorsResponse, - bulkUpdateVendorsResponseSchema, -} from '../models/bulkUpdateVendorsResponse'; -import { - CreateVendorRequest, - createVendorRequestSchema, -} from '../models/createVendorRequest'; -import { - CreateVendorResponse, - createVendorResponseSchema, -} from '../models/createVendorResponse'; -import { - RetrieveVendorResponse, - retrieveVendorResponseSchema, -} from '../models/retrieveVendorResponse'; -import { - SearchVendorsRequest, - searchVendorsRequestSchema, -} from '../models/searchVendorsRequest'; -import { - SearchVendorsResponse, - searchVendorsResponseSchema, -} from '../models/searchVendorsResponse'; -import { - UpdateVendorRequest, - updateVendorRequestSchema, -} from '../models/updateVendorRequest'; -import { - UpdateVendorResponse, - updateVendorResponseSchema, -} from '../models/updateVendorResponse'; -import { string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class VendorsApi extends BaseApi { - /** - * Creates one or more [Vendor]($m/Vendor) objects to represent suppliers to a seller. - * - * @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 - */ - async bulkCreateVendors( - body: BulkCreateVendorsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/vendors/bulk-create'); - const mapped = req.prepareArgs({ - body: [body, bulkCreateVendorsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkCreateVendorsResponseSchema, requestOptions); - } - - /** - * Retrieves one or more vendors of specified [Vendor]($m/Vendor) IDs. - * - * @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 - */ - async bulkRetrieveVendors( - body: BulkRetrieveVendorsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/vendors/bulk-retrieve'); - const mapped = req.prepareArgs({ - body: [body, bulkRetrieveVendorsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkRetrieveVendorsResponseSchema, requestOptions); - } - - /** - * Updates one or more of existing [Vendor]($m/Vendor) objects as suppliers to a seller. - * - * @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 - */ - async bulkUpdateVendors( - body: BulkUpdateVendorsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT', '/v2/vendors/bulk-update'); - const mapped = req.prepareArgs({ - body: [body, bulkUpdateVendorsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(bulkUpdateVendorsResponseSchema, requestOptions); - } - - /** - * Creates a single [Vendor]($m/Vendor) object to represent a supplier to a seller. - * - * @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 - */ - async createVendor( - body: CreateVendorRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/vendors/create'); - const mapped = req.prepareArgs({ body: [body, createVendorRequestSchema] }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(createVendorResponseSchema, requestOptions); - } - - /** - * Searches for vendors using a filter against supported [Vendor]($m/Vendor) properties and a supported - * sorter. - * - * @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 - */ - async searchVendors( - body: SearchVendorsRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/vendors/search'); - const mapped = req.prepareArgs({ - body: [body, searchVendorsRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson(searchVendorsResponseSchema, requestOptions); - } - - /** - * Retrieves the vendor of a specified [Vendor]($m/Vendor) ID. - * - * @param vendorId ID of the [Vendor](entity:Vendor) to retrieve. - * @return Response from the API call - */ - async retrieveVendor( - vendorId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ vendorId: [vendorId, string()] }); - req.appendTemplatePath`/v2/vendors/${mapped.vendorId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(retrieveVendorResponseSchema, requestOptions); - } - - /** - * Updates an existing [Vendor]($m/Vendor) object as a supplier to a seller. - * - * @param body An object containing the fields to POST for the request. See - * the corresponding object definition for field details. - * @param vendorId - * @return Response from the API call - */ - async updateVendor( - body: UpdateVendorRequest, - vendorId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - body: [body, updateVendorRequestSchema], - vendorId: [vendorId, string()], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/vendors/${mapped.vendorId}`; - req.authenticate([{ global: true }]); - return req.callAsJson(updateVendorResponseSchema, requestOptions); - } -} diff --git a/src/api/webhookSubscriptionsApi.ts b/src/api/webhookSubscriptionsApi.ts deleted file mode 100644 index 602641e62..000000000 --- a/src/api/webhookSubscriptionsApi.ts +++ /dev/null @@ -1,275 +0,0 @@ -import { ApiResponse, RequestOptions } from '../core'; -import { - CreateWebhookSubscriptionRequest, - createWebhookSubscriptionRequestSchema, -} from '../models/createWebhookSubscriptionRequest'; -import { - CreateWebhookSubscriptionResponse, - createWebhookSubscriptionResponseSchema, -} from '../models/createWebhookSubscriptionResponse'; -import { - DeleteWebhookSubscriptionResponse, - deleteWebhookSubscriptionResponseSchema, -} from '../models/deleteWebhookSubscriptionResponse'; -import { - ListWebhookEventTypesResponse, - listWebhookEventTypesResponseSchema, -} from '../models/listWebhookEventTypesResponse'; -import { - ListWebhookSubscriptionsResponse, - listWebhookSubscriptionsResponseSchema, -} from '../models/listWebhookSubscriptionsResponse'; -import { - RetrieveWebhookSubscriptionResponse, - retrieveWebhookSubscriptionResponseSchema, -} from '../models/retrieveWebhookSubscriptionResponse'; -import { - TestWebhookSubscriptionRequest, - testWebhookSubscriptionRequestSchema, -} from '../models/testWebhookSubscriptionRequest'; -import { - TestWebhookSubscriptionResponse, - testWebhookSubscriptionResponseSchema, -} from '../models/testWebhookSubscriptionResponse'; -import { - UpdateWebhookSubscriptionRequest, - updateWebhookSubscriptionRequestSchema, -} from '../models/updateWebhookSubscriptionRequest'; -import { - UpdateWebhookSubscriptionResponse, - updateWebhookSubscriptionResponseSchema, -} from '../models/updateWebhookSubscriptionResponse'; -import { - UpdateWebhookSubscriptionSignatureKeyRequest, - updateWebhookSubscriptionSignatureKeyRequestSchema, -} from '../models/updateWebhookSubscriptionSignatureKeyRequest'; -import { - UpdateWebhookSubscriptionSignatureKeyResponse, - updateWebhookSubscriptionSignatureKeyResponseSchema, -} from '../models/updateWebhookSubscriptionSignatureKeyResponse'; -import { boolean, number, optional, string } from '../schema'; -import { BaseApi } from './baseApi'; - -export class WebhookSubscriptionsApi extends BaseApi { - /** - * Lists all webhook event types that can be subscribed to. - * - * @param apiVersion The API version for which to list event types. Setting this field overrides the - * default version used by the application. - * @return Response from the API call - */ - async listWebhookEventTypes( - apiVersion?: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/webhooks/event-types'); - const mapped = req.prepareArgs({ - apiVersion: [apiVersion, optional(string())], - }); - req.query('api_version', mapped.apiVersion); - req.authenticate([{ global: true }]); - return req.callAsJson(listWebhookEventTypesResponseSchema, requestOptions); - } - - /** - * Lists all webhook subscriptions owned by your application. - * - * @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this - * to retrieve the next set of results for your original query. For more - * information, see [Pagination](https://developer.squareup.com/docs/build- - * basics/common-api-patterns/pagination). - * @param includeDisabled Includes disabled [Subscription](entity:WebhookSubscription)s. By default, all - * enabled [Subscription](entity:WebhookSubscription)s are returned. - * @param sortOrder Sorts the returned list by when the [Subscription](entity:WebhookSubscription) - * was created with the specified order. This field defaults to ASC. - * @param limit The maximum number of results to be returned in a single page. It is possible - * to receive fewer results than the specified limit on a given page. The default - * value of 100 is also the maximum allowed value. Default: 100 - * @return Response from the API call - */ - async listWebhookSubscriptions( - cursor?: string, - includeDisabled?: boolean, - sortOrder?: string, - limit?: number, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET', '/v2/webhooks/subscriptions'); - const mapped = req.prepareArgs({ - cursor: [cursor, optional(string())], - includeDisabled: [includeDisabled, optional(boolean())], - sortOrder: [sortOrder, optional(string())], - limit: [limit, optional(number())], - }); - req.query('cursor', mapped.cursor); - req.query('include_disabled', mapped.includeDisabled); - req.query('sort_order', mapped.sortOrder); - req.query('limit', mapped.limit); - req.authenticate([{ global: true }]); - return req.callAsJson( - listWebhookSubscriptionsResponseSchema, - requestOptions - ); - } - - /** - * Creates a webhook 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 - */ - async createWebhookSubscription( - body: CreateWebhookSubscriptionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST', '/v2/webhooks/subscriptions'); - const mapped = req.prepareArgs({ - body: [body, createWebhookSubscriptionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.authenticate([{ global: true }]); - return req.callAsJson( - createWebhookSubscriptionResponseSchema, - requestOptions - ); - } - - /** - * Deletes a webhook subscription. - * - * @param subscriptionId [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to delete. - * @return Response from the API call - */ - async deleteWebhookSubscription( - subscriptionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('DELETE'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - }); - req.appendTemplatePath`/v2/webhooks/subscriptions/${mapped.subscriptionId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - deleteWebhookSubscriptionResponseSchema, - requestOptions - ); - } - - /** - * Retrieves a webhook subscription identified by its ID. - * - * @param subscriptionId [REQUIRED] The ID of the [Subscription](entity:WebhookSubscription) to retrieve. - * @return Response from the API call - */ - async retrieveWebhookSubscription( - subscriptionId: string, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('GET'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - }); - req.appendTemplatePath`/v2/webhooks/subscriptions/${mapped.subscriptionId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - retrieveWebhookSubscriptionResponseSchema, - requestOptions - ); - } - - /** - * Updates a webhook subscription. - * - * @param subscriptionId [REQUIRED] The ID of the [Subscription](entity: - * WebhookSubscription) to update. - * @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 - */ - async updateWebhookSubscription( - subscriptionId: string, - body: UpdateWebhookSubscriptionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('PUT'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - body: [body, updateWebhookSubscriptionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/webhooks/subscriptions/${mapped.subscriptionId}`; - req.authenticate([{ global: true }]); - return req.callAsJson( - updateWebhookSubscriptionResponseSchema, - requestOptions - ); - } - - /** - * Updates a webhook subscription by replacing the existing signature key with a new one. - * - * @param subscriptionId [REQUIRED] The ID of the - * [Subscription](entity: - * WebhookSubscription) to update. - * @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 - */ - async updateWebhookSubscriptionSignatureKey( - subscriptionId: string, - body: UpdateWebhookSubscriptionSignatureKeyRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - body: [body, updateWebhookSubscriptionSignatureKeyRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/webhooks/subscriptions/${mapped.subscriptionId}/signature-key`; - req.authenticate([{ global: true }]); - return req.callAsJson( - updateWebhookSubscriptionSignatureKeyResponseSchema, - requestOptions - ); - } - - /** - * Tests a webhook subscription by sending a test event to the notification URL. - * - * @param subscriptionId [REQUIRED] The ID of the [Subscription](entity: - * WebhookSubscription) to test. - * @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 - */ - async testWebhookSubscription( - subscriptionId: string, - body: TestWebhookSubscriptionRequest, - requestOptions?: RequestOptions - ): Promise> { - const req = this.createRequest('POST'); - const mapped = req.prepareArgs({ - subscriptionId: [subscriptionId, string()], - body: [body, testWebhookSubscriptionRequestSchema], - }); - req.header('Content-Type', 'application/json'); - req.json(mapped.body); - req.appendTemplatePath`/v2/webhooks/subscriptions/${mapped.subscriptionId}/test`; - req.authenticate([{ global: true }]); - return req.callAsJson( - testWebhookSubscriptionResponseSchema, - requestOptions - ); - } -} diff --git a/src/authProvider.ts b/src/authProvider.ts deleted file mode 100644 index d8910cbe7..000000000 --- a/src/authProvider.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { - accessTokenAuthenticationProvider, - compositeAuthenticationProvider, -} from './authentication'; -import { Configuration } from './configuration'; - -export function createAuthProviderFromConfig(config: Partial) { - const authConfig = { - global: - config.bearerAuthCredentials && - accessTokenAuthenticationProvider(config.bearerAuthCredentials), - }; - - return compositeAuthenticationProvider< - keyof typeof authConfig, - typeof authConfig - >(authConfig); -} diff --git a/src/authentication.ts b/src/authentication.ts deleted file mode 100644 index 8069efae7..000000000 --- a/src/authentication.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@apimatic/authentication-adapters'; diff --git a/src/client.ts b/src/client.ts deleted file mode 100644 index 388776c89..000000000 --- a/src/client.ts +++ /dev/null @@ -1,318 +0,0 @@ -import { ApplePayApi } from './api/applePayApi'; -import { BankAccountsApi } from './api/bankAccountsApi'; -import { BookingCustomAttributesApi } from './api/bookingCustomAttributesApi'; -import { BookingsApi } from './api/bookingsApi'; -import { CardsApi } from './api/cardsApi'; -import { CashDrawersApi } from './api/cashDrawersApi'; -import { CatalogApi } from './api/catalogApi'; -import { CheckoutApi } from './api/checkoutApi'; -import { CustomerCustomAttributesApi } from './api/customerCustomAttributesApi'; -import { CustomerGroupsApi } from './api/customerGroupsApi'; -import { CustomersApi } from './api/customersApi'; -import { CustomerSegmentsApi } from './api/customerSegmentsApi'; -import { DevicesApi } from './api/devicesApi'; -import { DisputesApi } from './api/disputesApi'; -import { EmployeesApi } from './api/employeesApi'; -import { EventsApi } from './api/eventsApi'; -import { GiftCardActivitiesApi } from './api/giftCardActivitiesApi'; -import { GiftCardsApi } from './api/giftCardsApi'; -import { InventoryApi } from './api/inventoryApi'; -import { InvoicesApi } from './api/invoicesApi'; -import { LaborApi } from './api/laborApi'; -import { LocationCustomAttributesApi } from './api/locationCustomAttributesApi'; -import { LocationsApi } from './api/locationsApi'; -import { LoyaltyApi } from './api/loyaltyApi'; -import { MerchantCustomAttributesApi } from './api/merchantCustomAttributesApi'; -import { MerchantsApi } from './api/merchantsApi'; -import { MobileAuthorizationApi } from './api/mobileAuthorizationApi'; -import { OAuthApi } from './api/oAuthApi'; -import { OrderCustomAttributesApi } from './api/orderCustomAttributesApi'; -import { OrdersApi } from './api/ordersApi'; -import { PaymentsApi } from './api/paymentsApi'; -import { PayoutsApi } from './api/payoutsApi'; -import { RefundsApi } from './api/refundsApi'; -import { SitesApi } from './api/sitesApi'; -import { SnippetsApi } from './api/snippetsApi'; -import { SubscriptionsApi } from './api/subscriptionsApi'; -import { TeamApi } from './api/teamApi'; -import { TerminalApi } from './api/terminalApi'; -import { TransactionsApi } from './api/transactionsApi'; -import { V1TransactionsApi } from './api/v1TransactionsApi'; -import { VendorsApi } from './api/vendorsApi'; -import { WebhookSubscriptionsApi } from './api/webhookSubscriptionsApi'; -import { createAuthProviderFromConfig } from './authProvider'; -import { - AuthParams, - ClientInterface, - SdkRequestBuilder, - SdkRequestBuilderFactory, - Server, -} from './clientInterface'; -import { Configuration, Environment } from './configuration'; -import { - DEFAULT_CONFIGURATION, - DEFAULT_RETRY_CONFIG, -} from './defaultConfiguration'; -import { ApiError } from './errors/apiError'; -import { assertHeaders, mergeHeaders } from './core'; -import { pathTemplate, SkipEncode } from './core'; -import { setHeader } from './core'; -import { updateUserAgent } from './core'; -import { - AbortError, - AuthenticatorInterface, - createRequestBuilderFactory, - HttpClientInterface, - RetryConfiguration, -} from './core'; -import { HttpClient } from './clientAdapter'; - -/** Current SDK version */ -export const SDK_VERSION = '39.1.1'; -export class Client implements ClientInterface { - private _config: Readonly; - private _timeout: number; - private _retryConfig: RetryConfiguration; - private _requestBuilderFactory: SdkRequestBuilderFactory; - private _userAgent: string; - - public readonly applePayApi: ApplePayApi; - public readonly bankAccountsApi: BankAccountsApi; - public readonly bookingCustomAttributesApi: BookingCustomAttributesApi; - public readonly bookingsApi: BookingsApi; - public readonly cardsApi: CardsApi; - public readonly cashDrawersApi: CashDrawersApi; - public readonly catalogApi: CatalogApi; - public readonly checkoutApi: CheckoutApi; - public readonly customerCustomAttributesApi: CustomerCustomAttributesApi; - public readonly customerGroupsApi: CustomerGroupsApi; - public readonly customersApi: CustomersApi; - public readonly customerSegmentsApi: CustomerSegmentsApi; - public readonly devicesApi: DevicesApi; - public readonly disputesApi: DisputesApi; - public readonly employeesApi: EmployeesApi; - public readonly eventsApi: EventsApi; - public readonly giftCardActivitiesApi: GiftCardActivitiesApi; - public readonly giftCardsApi: GiftCardsApi; - public readonly inventoryApi: InventoryApi; - public readonly invoicesApi: InvoicesApi; - public readonly laborApi: LaborApi; - public readonly locationCustomAttributesApi: LocationCustomAttributesApi; - public readonly locationsApi: LocationsApi; - public readonly loyaltyApi: LoyaltyApi; - public readonly merchantCustomAttributesApi: MerchantCustomAttributesApi; - public readonly merchantsApi: MerchantsApi; - public readonly mobileAuthorizationApi: MobileAuthorizationApi; - public readonly oAuthApi: OAuthApi; - public readonly orderCustomAttributesApi: OrderCustomAttributesApi; - public readonly ordersApi: OrdersApi; - public readonly paymentsApi: PaymentsApi; - public readonly payoutsApi: PayoutsApi; - public readonly refundsApi: RefundsApi; - public readonly sitesApi: SitesApi; - public readonly snippetsApi: SnippetsApi; - public readonly subscriptionsApi: SubscriptionsApi; - public readonly teamApi: TeamApi; - public readonly terminalApi: TerminalApi; - public readonly transactionsApi: TransactionsApi; - public readonly v1TransactionsApi: V1TransactionsApi; - public readonly vendorsApi: VendorsApi; - public readonly webhookSubscriptionsApi: WebhookSubscriptionsApi; - - constructor(config?: Partial) { - this._config = { - ...DEFAULT_CONFIGURATION, - ...config, - }; - this._retryConfig = { - ...DEFAULT_RETRY_CONFIG, - ...this._config.httpClientOptions?.retryConfig, - }; - this._timeout = - typeof this._config.httpClientOptions?.timeout != 'undefined' - ? this._config.httpClientOptions.timeout - : this._config.timeout; - const clonedConfig = { - ...this._config, - bearerAuthCredentials: this._config.bearerAuthCredentials || { - accessToken: this._config.accessToken || '', - }, - }; - - this._userAgent = updateUserAgent( - 'Square-TypeScript-SDK/39.1.1 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}', - this._config.squareVersion, - this._config.userAgentDetail - ); - this._requestBuilderFactory = createRequestHandlerFactory( - (server) => getBaseUri(server, this._config), - createAuthProviderFromConfig(clonedConfig), - new HttpClient(AbortError, { - timeout: this._timeout, - clientConfigOverrides: this._config.unstable_httpClientOptions, - httpAgent: this._config.httpClientOptions?.httpAgent, - httpsAgent: this._config.httpClientOptions?.httpsAgent, - }), - [ - withErrorHandlers, - withUserAgent(this._userAgent), - withAdditionalHeaders(this._config), - withAuthenticationByDefault, - withSquareVersion(this._config), - ], - this._retryConfig - ); - - this.applePayApi = new ApplePayApi(this); - this.bankAccountsApi = new BankAccountsApi(this); - this.bookingCustomAttributesApi = new BookingCustomAttributesApi(this); - this.bookingsApi = new BookingsApi(this); - this.cardsApi = new CardsApi(this); - this.cashDrawersApi = new CashDrawersApi(this); - this.catalogApi = new CatalogApi(this); - this.checkoutApi = new CheckoutApi(this); - this.customerCustomAttributesApi = new CustomerCustomAttributesApi(this); - this.customerGroupsApi = new CustomerGroupsApi(this); - this.customersApi = new CustomersApi(this); - this.customerSegmentsApi = new CustomerSegmentsApi(this); - this.devicesApi = new DevicesApi(this); - this.disputesApi = new DisputesApi(this); - this.employeesApi = new EmployeesApi(this); - this.eventsApi = new EventsApi(this); - this.giftCardActivitiesApi = new GiftCardActivitiesApi(this); - this.giftCardsApi = new GiftCardsApi(this); - this.inventoryApi = new InventoryApi(this); - this.invoicesApi = new InvoicesApi(this); - this.laborApi = new LaborApi(this); - this.locationCustomAttributesApi = new LocationCustomAttributesApi(this); - this.locationsApi = new LocationsApi(this); - this.loyaltyApi = new LoyaltyApi(this); - this.merchantCustomAttributesApi = new MerchantCustomAttributesApi(this); - this.merchantsApi = new MerchantsApi(this); - this.mobileAuthorizationApi = new MobileAuthorizationApi(this); - this.oAuthApi = new OAuthApi(this); - this.orderCustomAttributesApi = new OrderCustomAttributesApi(this); - this.ordersApi = new OrdersApi(this); - this.paymentsApi = new PaymentsApi(this); - this.payoutsApi = new PayoutsApi(this); - this.refundsApi = new RefundsApi(this); - this.sitesApi = new SitesApi(this); - this.snippetsApi = new SnippetsApi(this); - this.subscriptionsApi = new SubscriptionsApi(this); - this.teamApi = new TeamApi(this); - this.terminalApi = new TerminalApi(this); - this.transactionsApi = new TransactionsApi(this); - this.v1TransactionsApi = new V1TransactionsApi(this); - this.vendorsApi = new VendorsApi(this); - this.webhookSubscriptionsApi = new WebhookSubscriptionsApi(this); - } - - public getRequestBuilderFactory(): SdkRequestBuilderFactory { - return this._requestBuilderFactory; - } - - /** - * Clone this client and override given configuration options - */ - public withConfiguration(config: Partial) { - return new Client({ ...this._config, ...config }); - } -} - -function createHttpClientAdapter(client: HttpClient): HttpClientInterface { - return async (request, requestOptions) => { - return await client.executeRequest(request, requestOptions); - }; -} - -function getBaseUri(server: Server = 'default', config: Configuration): string { - if (config.environment === Environment.Production) { - if (server === 'default') { - return 'https://connect.squareup.com'; - } - } - if (config.environment === Environment.Sandbox) { - if (server === 'default') { - return 'https://connect.squareupsandbox.com'; - } - } - if (config.environment === Environment.Custom) { - if (server === 'default') { - return pathTemplate`${new SkipEncode(config.customUrl)}`; - } - } - throw new Error('Could not get Base URL. Invalid environment or server.'); -} - -function createRequestHandlerFactory( - baseUrlProvider: (server?: Server) => string, - authProvider: AuthenticatorInterface, - httpClient: HttpClient, - addons: ((rb: SdkRequestBuilder) => void)[], - retryConfig: RetryConfiguration -): SdkRequestBuilderFactory { - const requestBuilderFactory = createRequestBuilderFactory( - createHttpClientAdapter(httpClient), - baseUrlProvider, - ApiError, - authProvider, - retryConfig - ); - - return tap(requestBuilderFactory, ...addons); -} - -function tap( - requestBuilderFactory: SdkRequestBuilderFactory, - ...callback: ((requestBuilder: SdkRequestBuilder) => void)[] -): SdkRequestBuilderFactory { - return (...args) => { - const requestBuilder = requestBuilderFactory(...args); - callback.forEach((c) => c(requestBuilder)); - return requestBuilder; - }; -} - -function withErrorHandlers(rb: SdkRequestBuilder) { - rb.defaultToError(ApiError); -} - -function withAdditionalHeaders({ - additionalHeaders, -}: { - additionalHeaders: Readonly>; -}) { - const clone = { ...additionalHeaders }; - assertHeaders(clone); - return (rb: SdkRequestBuilder) => { - rb.interceptRequest((request) => { - const headers = request.headers ?? {}; - mergeHeaders(headers, clone); - return { ...request, headers }; - }); - }; -} - -function withUserAgent(userAgent: string) { - return (rb: SdkRequestBuilder) => { - rb.interceptRequest((request) => { - const headers = request.headers ?? {}; - setHeader(headers, 'user-agent', userAgent); - return { ...request, headers }; - }); - }; -} - -function withSquareVersion({ squareVersion }: { squareVersion: string }) { - return (rb: SdkRequestBuilder) => { - rb.interceptRequest((request) => { - const headers = request.headers ?? {}; - setHeader(headers, 'Square-Version', squareVersion); - return { ...request, headers }; - }); - }; -} - -function withAuthenticationByDefault(rb: SdkRequestBuilder) { - rb.authenticate([]); -} diff --git a/src/clientAdapter.ts b/src/clientAdapter.ts deleted file mode 100644 index 412af93a1..000000000 --- a/src/clientAdapter.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@apimatic/axios-client-adapter'; diff --git a/src/clientInterface.ts b/src/clientInterface.ts deleted file mode 100644 index 9acdd0890..000000000 --- a/src/clientInterface.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { createAuthProviderFromConfig } from './authProvider'; -import { AuthenticatorInterface, RequestBuilderFactory } from './core'; - -export interface ClientInterface { - getRequestBuilderFactory(): SdkRequestBuilderFactory; -} - -export type SdkRequestBuilderFactory = RequestBuilderFactory< - Server, - AuthParams ->; - -export type SdkRequestBuilder = ReturnType; - -export type Server = 'default'; - -export type AuthParams = ReturnType< - typeof createAuthProviderFromConfig -> extends AuthenticatorInterface - ? X - : never; diff --git a/src/configuration.ts b/src/configuration.ts deleted file mode 100644 index ee04036e6..000000000 --- a/src/configuration.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { HttpClientOptions } from './clientAdapter'; - -/** An interface for all configuration parameters required by the SDK. */ -export interface Configuration { - timeout: number; - squareVersion: string; - additionalHeaders: Readonly>; - userAgentDetail: string; - environment: Environment; - customUrl: string; - /** @deprecated use bearerAuthCredentials field instead */ - accessToken?: string; - bearerAuthCredentials?: { - accessToken: string; - }; - httpClientOptions?: Partial; - unstable_httpClientOptions?: any; -} - -/** Environments available for API */ -export enum Environment { - Production = 'production', - Sandbox = 'sandbox', - Custom = 'custom', -} diff --git a/src/core.ts b/src/core.ts deleted file mode 100644 index 1265ef343..000000000 --- a/src/core.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@apimatic/core'; diff --git a/src/core/auth/BasicAuth.ts b/src/core/auth/BasicAuth.ts new file mode 100644 index 000000000..146df2150 --- /dev/null +++ b/src/core/auth/BasicAuth.ts @@ -0,0 +1,31 @@ +import { Base64 } from "js-base64"; + +export interface BasicAuth { + username: string; + password: string; +} + +const BASIC_AUTH_HEADER_PREFIX = /^Basic /i; + +export const BasicAuth = { + toAuthorizationHeader: (basicAuth: BasicAuth | undefined): string | undefined => { + if (basicAuth == null) { + return undefined; + } + const token = Base64.encode(`${basicAuth.username}:${basicAuth.password}`); + return `Basic ${token}`; + }, + fromAuthorizationHeader: (header: string): BasicAuth => { + const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, ""); + const decoded = Base64.decode(credentials); + const [username, password] = decoded.split(":", 2); + + if (username == null || password == null) { + throw new Error("Invalid basic auth"); + } + return { + username, + password, + }; + }, +}; diff --git a/src/core/auth/BearerToken.ts b/src/core/auth/BearerToken.ts new file mode 100644 index 000000000..fe987fc9c --- /dev/null +++ b/src/core/auth/BearerToken.ts @@ -0,0 +1,15 @@ +export type BearerToken = string; + +const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i; + +export const BearerToken = { + toAuthorizationHeader: (token: BearerToken | undefined): string | undefined => { + if (token == null) { + return undefined; + } + return `Bearer ${token}`; + }, + fromAuthorizationHeader: (header: string): BearerToken => { + return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim() as BearerToken; + }, +}; diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts new file mode 100644 index 000000000..ee293b343 --- /dev/null +++ b/src/core/auth/index.ts @@ -0,0 +1,2 @@ +export { BasicAuth } from "./BasicAuth"; +export { BearerToken } from "./BearerToken"; diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts new file mode 100644 index 000000000..3664d09e1 --- /dev/null +++ b/src/core/fetcher/APIResponse.ts @@ -0,0 +1,12 @@ +export type APIResponse = SuccessfulResponse | FailedResponse; + +export interface SuccessfulResponse { + ok: true; + body: T; + headers?: Record; +} + +export interface FailedResponse { + ok: false; + error: T; +} diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts new file mode 100644 index 000000000..f3ee18ee8 --- /dev/null +++ b/src/core/fetcher/Fetcher.ts @@ -0,0 +1,144 @@ +import { toJson } from "../json"; +import { APIResponse } from "./APIResponse"; +import { createRequestUrl } from "./createRequestUrl"; +import { getFetchFn } from "./getFetchFn"; +import { getRequestBody } from "./getRequestBody"; +import { getResponseBody } from "./getResponseBody"; +import { makeRequest } from "./makeRequest"; +import { requestWithRetries } from "./requestWithRetries"; + +export type FetchFunction = (args: Fetcher.Args) => Promise>; + +export declare namespace Fetcher { + export interface Args { + url: string; + method: string; + contentType?: string; + headers?: Record; + queryParameters?: Record; + body?: unknown; + timeoutMs?: number; + maxRetries?: number; + withCredentials?: boolean; + abortSignal?: AbortSignal; + requestType?: "json" | "file" | "bytes"; + responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer"; + duplex?: "half"; + } + + export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; + + export interface FailedStatusCodeError { + reason: "status-code"; + statusCode: number; + body: unknown; + } + + export interface NonJsonError { + reason: "non-json"; + statusCode: number; + rawBody: string; + } + + export interface TimeoutError { + reason: "timeout"; + } + + export interface UnknownError { + reason: "unknown"; + errorMessage: string; + } +} + +export async function fetcherImpl(args: Fetcher.Args): Promise> { + const headers: Record = {}; + if (args.body !== undefined && args.contentType != null) { + headers["Content-Type"] = args.contentType; + } + + if (args.headers != null) { + for (const [key, value] of Object.entries(args.headers)) { + if (value != null) { + headers[key] = value; + } + } + } + + const url = createRequestUrl(args.url, args.queryParameters); + const requestBody: BodyInit | undefined = await getRequestBody({ + body: args.body, + type: args.requestType === "json" ? "json" : "other", + }); + const fetchFn = await getFetchFn(); + + try { + const response = await requestWithRetries( + async () => + makeRequest( + fetchFn, + url, + args.method, + headers, + requestBody, + args.timeoutMs, + args.abortSignal, + args.withCredentials, + args.duplex, + ), + args.maxRetries, + ); + const responseBody = await getResponseBody(response, args.responseType); + + if (response.status >= 200 && response.status < 400) { + return { + ok: true, + body: responseBody as R, + headers: response.headers, + }; + } else { + return { + ok: false, + error: { + reason: "status-code", + statusCode: response.status, + body: responseBody, + }, + }; + } + } catch (error) { + if (args.abortSignal != null && args.abortSignal.aborted) { + return { + ok: false, + error: { + reason: "unknown", + errorMessage: "The user aborted a request", + }, + }; + } else if (error instanceof Error && error.name === "AbortError") { + return { + ok: false, + error: { + reason: "timeout", + }, + }; + } else if (error instanceof Error) { + return { + ok: false, + error: { + reason: "unknown", + errorMessage: error.message, + }, + }; + } + + return { + ok: false, + error: { + reason: "unknown", + errorMessage: toJson(error), + }, + }; + } +} + +export const fetcher: FetchFunction = fetcherImpl; diff --git a/src/core/fetcher/Supplier.ts b/src/core/fetcher/Supplier.ts new file mode 100644 index 000000000..867c931c0 --- /dev/null +++ b/src/core/fetcher/Supplier.ts @@ -0,0 +1,11 @@ +export type Supplier = T | Promise | (() => T | Promise); + +export const Supplier = { + get: async (supplier: Supplier): Promise => { + if (typeof supplier === "function") { + return (supplier as () => T)(); + } else { + return supplier; + } + }, +}; diff --git a/src/core/fetcher/createRequestUrl.ts b/src/core/fetcher/createRequestUrl.ts new file mode 100644 index 000000000..f1157ce72 --- /dev/null +++ b/src/core/fetcher/createRequestUrl.ts @@ -0,0 +1,10 @@ +import qs from "qs"; + +export function createRequestUrl( + baseUrl: string, + queryParameters?: Record, +): string { + return Object.keys(queryParameters ?? {}).length > 0 + ? `${baseUrl}?${qs.stringify(queryParameters, { arrayFormat: "repeat" })}` + : baseUrl; +} diff --git a/src/core/fetcher/getFetchFn.ts b/src/core/fetcher/getFetchFn.ts new file mode 100644 index 000000000..9fd9bfc42 --- /dev/null +++ b/src/core/fetcher/getFetchFn.ts @@ -0,0 +1,25 @@ +import { RUNTIME } from "../runtime"; + +/** + * Returns a fetch function based on the runtime + */ +export async function getFetchFn(): Promise { + // In Node.js 18+ environments, use native fetch + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + return fetch; + } + + // In Node.js 18 or lower environments, the SDK always uses`node-fetch`. + if (RUNTIME.type === "node") { + return (await import("node-fetch")).default as any; + } + + // Otherwise the SDK uses global fetch if available, + // and falls back to node-fetch. + if (typeof fetch == "function") { + return fetch; + } + + // Defaults to node `node-fetch` if global fetch isn't available + return (await import("node-fetch")).default as any; +} diff --git a/src/core/fetcher/getHeader.ts b/src/core/fetcher/getHeader.ts new file mode 100644 index 000000000..50f922b0e --- /dev/null +++ b/src/core/fetcher/getHeader.ts @@ -0,0 +1,8 @@ +export function getHeader(headers: Record, header: string): string | undefined { + for (const [headerKey, headerValue] of Object.entries(headers)) { + if (headerKey.toLowerCase() === header.toLowerCase()) { + return headerValue; + } + } + return undefined; +} diff --git a/src/core/fetcher/getRequestBody.ts b/src/core/fetcher/getRequestBody.ts new file mode 100644 index 000000000..fce5589c5 --- /dev/null +++ b/src/core/fetcher/getRequestBody.ts @@ -0,0 +1,16 @@ +import { toJson } from "../json"; + +export declare namespace GetRequestBody { + interface Args { + body: unknown; + type: "json" | "file" | "bytes" | "other"; + } +} + +export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type.includes("json")) { + return toJson(body); + } else { + return body as BodyInit; + } +} diff --git a/src/core/fetcher/getResponseBody.ts b/src/core/fetcher/getResponseBody.ts new file mode 100644 index 000000000..d046e6ea2 --- /dev/null +++ b/src/core/fetcher/getResponseBody.ts @@ -0,0 +1,34 @@ +import { chooseStreamWrapper } from "./stream-wrappers/chooseStreamWrapper"; + +export async function getResponseBody(response: Response, responseType?: string): Promise { + if (response.body != null && responseType === "blob") { + return await response.blob(); + } else if (response.body != null && responseType === "arrayBuffer") { + return await response.arrayBuffer(); + } else if (response.body != null && responseType === "sse") { + return response.body; + } else if (response.body != null && responseType === "streaming") { + return chooseStreamWrapper(response.body); + } else if (response.body != null && responseType === "text") { + return await response.text(); + } else { + const text = await response.text(); + if (text.length > 0) { + try { + let responseBody = JSON.parse(text); + return responseBody; + } catch (err) { + return { + ok: false, + error: { + reason: "non-json", + statusCode: response.status, + rawBody: text, + }, + }; + } + } else { + return undefined; + } + } +} diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts new file mode 100644 index 000000000..2d658ca48 --- /dev/null +++ b/src/core/fetcher/index.ts @@ -0,0 +1,5 @@ +export type { APIResponse } from "./APIResponse"; +export { fetcher } from "./Fetcher"; +export type { Fetcher, FetchFunction } from "./Fetcher"; +export { getHeader } from "./getHeader"; +export { Supplier } from "./Supplier"; diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts new file mode 100644 index 000000000..1af42bb9f --- /dev/null +++ b/src/core/fetcher/makeRequest.ts @@ -0,0 +1,44 @@ +import { anySignal, getTimeoutSignal } from "./signals"; + +export const makeRequest = async ( + fetchFn: (url: string, init: RequestInit) => Promise, + url: string, + method: string, + headers: Record, + requestBody: BodyInit | undefined, + timeoutMs?: number, + abortSignal?: AbortSignal, + withCredentials?: boolean, + duplex?: "half", +): Promise => { + const signals: AbortSignal[] = []; + + // Add timeout signal + let timeoutAbortId: NodeJS.Timeout | undefined = undefined; + if (timeoutMs != null) { + const { signal, abortId } = getTimeoutSignal(timeoutMs); + timeoutAbortId = abortId; + signals.push(signal); + } + + // Add arbitrary signal + if (abortSignal != null) { + signals.push(abortSignal); + } + let newSignals = anySignal(signals); + const response = await fetchFn(url, { + method: method, + headers, + body: requestBody, + signal: newSignals, + credentials: withCredentials ? "include" : undefined, + // @ts-ignore + duplex, + }); + + if (timeoutAbortId != null) { + clearTimeout(timeoutAbortId); + } + + return response; +}; diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts new file mode 100644 index 000000000..add3cce02 --- /dev/null +++ b/src/core/fetcher/requestWithRetries.ts @@ -0,0 +1,33 @@ +const INITIAL_RETRY_DELAY = 1000; // in milliseconds +const MAX_RETRY_DELAY = 60000; // in milliseconds +const DEFAULT_MAX_RETRIES = 2; +const JITTER_FACTOR = 0.2; // 20% random jitter + +function addJitter(delay: number): number { + // Generate a random value between -JITTER_FACTOR and +JITTER_FACTOR + const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR; + return delay * jitterMultiplier; +} + +export async function requestWithRetries( + requestFn: () => Promise, + maxRetries: number = DEFAULT_MAX_RETRIES, +): Promise { + let response: Response = await requestFn(); + + for (let i = 0; i < maxRetries; ++i) { + if ([408, 429].includes(response.status) || response.status >= 500) { + // Calculate base delay using exponential backoff (in milliseconds) + const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY); + + // Add jitter to the delay + const delayWithJitter = addJitter(baseDelay); + + await new Promise((resolve) => setTimeout(resolve, delayWithJitter)); + response = await requestFn(); + } else { + break; + } + } + return response!; +} diff --git a/src/core/fetcher/signals.ts b/src/core/fetcher/signals.ts new file mode 100644 index 000000000..a8d32a2e8 --- /dev/null +++ b/src/core/fetcher/signals.ts @@ -0,0 +1,38 @@ +const TIMEOUT = "timeout"; + +export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: NodeJS.Timeout } { + const controller = new AbortController(); + const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs); + return { signal: controller.signal, abortId }; +} + +/** + * Returns an abort signal that is getting aborted when + * at least one of the specified abort signals is aborted. + * + * Requires at least node.js 18. + */ +export function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { + // Allowing signals to be passed either as array + // of signals or as multiple arguments. + const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args) as AbortSignal[]; + + const controller = new AbortController(); + + for (const signal of signals) { + if (signal.aborted) { + // Exiting early if one of the signals + // is already aborted. + controller.abort((signal as any)?.reason); + break; + } + + // Listening for signals and removing the listeners + // when at least one symbol is aborted. + signal.addEventListener("abort", () => controller.abort((signal as any)?.reason), { + signal: controller.signal, + }); + } + + return controller.signal; +} diff --git a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts new file mode 100644 index 000000000..6f1a82e96 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts @@ -0,0 +1,257 @@ +import type { Writable } from "readable-stream"; + +import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; + +export class Node18UniversalStreamWrapper + implements + StreamWrapper | Writable | WritableStream, ReadFormat> +{ + private readableStream: ReadableStream; + private reader: ReadableStreamDefaultReader; + private events: Record; + private paused: boolean; + private resumeCallback: ((value?: unknown) => void) | null; + private encoding: string | null; + + constructor(readableStream: ReadableStream) { + this.readableStream = readableStream; + this.reader = this.readableStream.getReader(); + this.events = { + data: [], + end: [], + error: [], + readable: [], + close: [], + pause: [], + resume: [], + }; + this.paused = false; + this.resumeCallback = null; + this.encoding = null; + } + + public on(event: string, callback: EventCallback): void { + this.events[event]?.push(callback); + } + + public off(event: string, callback: EventCallback): void { + this.events[event] = this.events[event]?.filter((cb) => cb !== callback); + } + + public pipe( + dest: Node18UniversalStreamWrapper | Writable | WritableStream, + ): Node18UniversalStreamWrapper | Writable | WritableStream { + this.on("data", async (chunk) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._write(chunk); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } else { + dest.write(chunk); + } + }); + + this.on("end", async () => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._end(); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.close(); + } else { + dest.end(); + } + }); + + this.on("error", async (error) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._error(error); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.abort(error); + } else { + dest.destroy(error); + } + }); + + this._startReading(); + + return dest; + } + + public pipeTo( + dest: Node18UniversalStreamWrapper | Writable | WritableStream, + ): Node18UniversalStreamWrapper | Writable | WritableStream { + return this.pipe(dest); + } + + public unpipe(dest: Node18UniversalStreamWrapper | Writable | WritableStream): void { + this.off("data", async (chunk) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._write(chunk); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } else { + dest.write(chunk); + } + }); + + this.off("end", async () => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._end(); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.close(); + } else { + dest.end(); + } + }); + + this.off("error", async (error) => { + if (dest instanceof Node18UniversalStreamWrapper) { + dest._error(error); + } else if (dest instanceof WritableStream) { + const writer = dest.getWriter(); + writer.abort(error); + } else { + dest.destroy(error); + } + }); + } + + public destroy(error?: Error): void { + this.reader + .cancel(error) + .then(() => { + this._emit("close"); + }) + .catch((err) => { + this._emit("error", err); + }); + } + + public pause(): void { + this.paused = true; + this._emit("pause"); + } + + public resume(): void { + if (this.paused) { + this.paused = false; + this._emit("resume"); + if (this.resumeCallback) { + this.resumeCallback(); + this.resumeCallback = null; + } + } + } + + public get isPaused(): boolean { + return this.paused; + } + + public async read(): Promise { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + + if (done) { + return undefined; + } + return value; + } + + public setEncoding(encoding: string): void { + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: ReadFormat[] = []; + + while (true) { + const { done, value } = await this.reader.read(); + if (done) { + break; + } + if (value) { + chunks.push(value); + } + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(await new Blob(chunks).arrayBuffer()); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } + + private _write(chunk: ReadFormat): void { + this._emit("data", chunk); + } + + private _end(): void { + this._emit("end"); + } + + private _error(error: any): void { + this._emit("error", error); + } + + private _emit(event: string, data?: any): void { + if (this.events[event]) { + for (const callback of this.events[event] || []) { + callback(data); + } + } + } + + private async _startReading(): Promise { + try { + this._emit("readable"); + while (true) { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + this._emit("end"); + this._emit("close"); + break; + } + if (value) { + this._emit("data", value); + } + } + } catch (error) { + this._emit("error", error); + } + } + + [Symbol.asyncIterator](): AsyncIterableIterator { + return { + next: async () => { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + return { done: true, value: undefined }; + } + return { done: false, value }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; + } +} diff --git a/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts new file mode 100644 index 000000000..23c01a1a7 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts @@ -0,0 +1,107 @@ +import type { Readable, Writable } from "readable-stream"; + +import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; + +export class NodePre18StreamWrapper implements StreamWrapper { + private readableStream: Readable; + private encoding: string | undefined; + + constructor(readableStream: Readable) { + this.readableStream = readableStream; + } + + public on(event: string, callback: EventCallback): void { + this.readableStream.on(event, callback); + } + + public off(event: string, callback: EventCallback): void { + this.readableStream.off(event, callback); + } + + public pipe(dest: Writable): Writable { + this.readableStream.pipe(dest); + return dest; + } + + public pipeTo(dest: Writable): Writable { + return this.pipe(dest); + } + + public unpipe(dest?: Writable): void { + if (dest) { + this.readableStream.unpipe(dest); + } else { + this.readableStream.unpipe(); + } + } + + public destroy(error?: Error): void { + this.readableStream.destroy(error); + } + + public pause(): void { + this.readableStream.pause(); + } + + public resume(): void { + this.readableStream.resume(); + } + + public get isPaused(): boolean { + return this.readableStream.isPaused(); + } + + public async read(): Promise { + return new Promise((resolve, reject) => { + const chunk = this.readableStream.read(); + if (chunk) { + resolve(chunk); + } else { + this.readableStream.once("readable", () => { + const chunk = this.readableStream.read(); + resolve(chunk); + }); + this.readableStream.once("error", reject); + } + }); + } + + public setEncoding(encoding?: string): void { + this.readableStream.setEncoding(encoding as BufferEncoding); + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: Uint8Array[] = []; + const encoder = new TextEncoder(); + this.readableStream.setEncoding((this.encoding || "utf-8") as BufferEncoding); + + for await (const chunk of this.readableStream) { + chunks.push(encoder.encode(chunk)); + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(Buffer.concat(chunks)); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } + + public [Symbol.asyncIterator](): AsyncIterableIterator { + const readableStream = this.readableStream; + const iterator = readableStream[Symbol.asyncIterator](); + + // Create and return an async iterator that yields buffers + return { + async next(): Promise> { + const { value, done } = await iterator.next(); + return { value: value as Buffer, done }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; + } +} diff --git a/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts new file mode 100644 index 000000000..091e2a7f3 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts @@ -0,0 +1,243 @@ +import { StreamWrapper } from "./chooseStreamWrapper"; + +type EventCallback = (data?: any) => void; + +export class UndiciStreamWrapper + implements StreamWrapper | WritableStream, ReadFormat> +{ + private readableStream: ReadableStream; + private reader: ReadableStreamDefaultReader; + private events: Record; + private paused: boolean; + private resumeCallback: ((value?: unknown) => void) | null; + private encoding: string | null; + + constructor(readableStream: ReadableStream) { + this.readableStream = readableStream; + this.reader = this.readableStream.getReader(); + this.events = { + data: [], + end: [], + error: [], + readable: [], + close: [], + pause: [], + resume: [], + }; + this.paused = false; + this.resumeCallback = null; + this.encoding = null; + } + + public on(event: string, callback: EventCallback): void { + this.events[event]?.push(callback); + } + + public off(event: string, callback: EventCallback): void { + this.events[event] = this.events[event]?.filter((cb) => cb !== callback); + } + + public pipe( + dest: UndiciStreamWrapper | WritableStream, + ): UndiciStreamWrapper | WritableStream { + this.on("data", (chunk) => { + if (dest instanceof UndiciStreamWrapper) { + dest._write(chunk); + } else { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } + }); + + this.on("end", () => { + if (dest instanceof UndiciStreamWrapper) { + dest._end(); + } else { + const writer = dest.getWriter(); + writer.close(); + } + }); + + this.on("error", (error) => { + if (dest instanceof UndiciStreamWrapper) { + dest._error(error); + } else { + const writer = dest.getWriter(); + writer.abort(error); + } + }); + + this._startReading(); + + return dest; + } + + public pipeTo( + dest: UndiciStreamWrapper | WritableStream, + ): UndiciStreamWrapper | WritableStream { + return this.pipe(dest); + } + + public unpipe(dest: UndiciStreamWrapper | WritableStream): void { + this.off("data", (chunk) => { + if (dest instanceof UndiciStreamWrapper) { + dest._write(chunk); + } else { + const writer = dest.getWriter(); + writer.write(chunk).then(() => writer.releaseLock()); + } + }); + + this.off("end", () => { + if (dest instanceof UndiciStreamWrapper) { + dest._end(); + } else { + const writer = dest.getWriter(); + writer.close(); + } + }); + + this.off("error", (error) => { + if (dest instanceof UndiciStreamWrapper) { + dest._error(error); + } else { + const writer = dest.getWriter(); + writer.abort(error); + } + }); + } + + public destroy(error?: Error): void { + this.reader + .cancel(error) + .then(() => { + this._emit("close"); + }) + .catch((err) => { + this._emit("error", err); + }); + } + + public pause(): void { + this.paused = true; + this._emit("pause"); + } + + public resume(): void { + if (this.paused) { + this.paused = false; + this._emit("resume"); + if (this.resumeCallback) { + this.resumeCallback(); + this.resumeCallback = null; + } + } + } + + public get isPaused(): boolean { + return this.paused; + } + + public async read(): Promise { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + return undefined; + } + return value; + } + + public setEncoding(encoding: string): void { + this.encoding = encoding; + } + + public async text(): Promise { + const chunks: BlobPart[] = []; + + while (true) { + const { done, value } = await this.reader.read(); + if (done) { + break; + } + if (value) { + chunks.push(value); + } + } + + const decoder = new TextDecoder(this.encoding || "utf-8"); + return decoder.decode(await new Blob(chunks).arrayBuffer()); + } + + public async json(): Promise { + const text = await this.text(); + return JSON.parse(text); + } + + private _write(chunk: ReadFormat): void { + this._emit("data", chunk); + } + + private _end(): void { + this._emit("end"); + } + + private _error(error: any): void { + this._emit("error", error); + } + + private _emit(event: string, data?: any): void { + if (this.events[event]) { + for (const callback of this.events[event] || []) { + callback(data); + } + } + } + + private async _startReading(): Promise { + try { + this._emit("readable"); + while (true) { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + this._emit("end"); + this._emit("close"); + break; + } + if (value) { + this._emit("data", value); + } + } + } catch (error) { + this._emit("error", error); + } + } + + [Symbol.asyncIterator](): AsyncIterableIterator { + return { + next: async () => { + if (this.paused) { + await new Promise((resolve) => { + this.resumeCallback = resolve; + }); + } + const { done, value } = await this.reader.read(); + if (done) { + return { done: true, value: undefined }; + } + return { done: false, value }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; + } +} diff --git a/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts new file mode 100644 index 000000000..8c7492fc8 --- /dev/null +++ b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts @@ -0,0 +1,34 @@ +import type { Readable } from "readable-stream"; + +import { RUNTIME } from "../../runtime"; + +export type EventCallback = (data?: any) => void; + +export interface StreamWrapper { + setEncoding(encoding?: string): void; + on(event: string, callback: EventCallback): void; + off(event: string, callback: EventCallback): void; + pipe(dest: WritableStream): WritableStream; + pipeTo(dest: WritableStream): WritableStream; + unpipe(dest?: WritableStream): void; + destroy(error?: Error): void; + pause(): void; + resume(): void; + get isPaused(): boolean; + read(): Promise; + text(): Promise; + json(): Promise; + [Symbol.asyncIterator](): AsyncIterableIterator; +} + +export async function chooseStreamWrapper(responseBody: any): Promise>> { + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + return new (await import("./Node18UniversalStreamWrapper")).Node18UniversalStreamWrapper( + responseBody as ReadableStream, + ); + } else if (RUNTIME.type !== "node" && typeof fetch === "function") { + return new (await import("./UndiciStreamWrapper")).UndiciStreamWrapper(responseBody as ReadableStream); + } else { + return new (await import("./NodePre18StreamWrapper")).NodePre18StreamWrapper(responseBody as Readable); + } +} diff --git a/src/core/form-data-utils/FormDataWrapper.ts b/src/core/form-data-utils/FormDataWrapper.ts new file mode 100644 index 000000000..ad0d90dc1 --- /dev/null +++ b/src/core/form-data-utils/FormDataWrapper.ts @@ -0,0 +1,177 @@ +import { RUNTIME } from "../runtime"; + +export type MaybePromise = Promise | T; + +interface FormDataRequest { + body: Body; + headers: Record; + duplex?: "half"; +} + +function isNamedValue(value: unknown): value is { name: string } { + return typeof value === "object" && value != null && "name" in value; +} + +export interface CrossPlatformFormData { + setup(): Promise; + + append(key: string, value: unknown): void; + + appendFile(key: string, value: unknown, fileName?: string): Promise; + + getRequest(): MaybePromise>; +} + +export async function newFormData(): Promise { + let formdata: CrossPlatformFormData; + if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + formdata = new Node18FormData(); + } else if (RUNTIME.type === "node") { + formdata = new Node16FormData(); + } else { + formdata = new WebFormData(); + } + await formdata.setup(); + return formdata; +} + +export type Node18FormDataFd = + | { + append(name: string, value: unknown, fileName?: string): void; + } + | undefined; + +/** + * Form Data Implementation for Node.js 18+ + */ +export class Node18FormData implements CrossPlatformFormData { + private fd: Node18FormDataFd; + + public async setup() { + this.fd = new (await import("formdata-node")).FormData(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); + } + + public async appendFile(key: string, value: unknown, fileName?: string): Promise { + if (fileName == null && isNamedValue(value)) { + fileName = value.name; + } + + if (value instanceof Blob) { + this.fd?.append(key, value, fileName); + } else { + this.fd?.append(key, { + type: undefined, + name: fileName, + [Symbol.toStringTag]: "File", + stream() { + return value; + }, + }); + } + } + + public async getRequest(): Promise> { + const encoder = new (await import("form-data-encoder")).FormDataEncoder(this.fd as any); + return { + body: (await import("readable-stream")).Readable.from(encoder), + headers: encoder.headers, + duplex: "half", + }; + } +} + +export type Node16FormDataFd = + | { + append( + name: string, + value: unknown, + options?: + | string + | { + header?: string | Headers; + knownLength?: number; + filename?: string; + filepath?: string; + contentType?: string; + }, + ): void; + + getHeaders(): Record; + } + | undefined; + +/** + * Form Data Implementation for Node.js 16-18 + */ +export class Node16FormData implements CrossPlatformFormData { + private fd: Node16FormDataFd; + + public async setup(): Promise { + this.fd = new (await import("form-data")).default(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); + } + + public async appendFile(key: string, value: unknown, fileName?: string): Promise { + if (fileName == null && isNamedValue(value)) { + fileName = value.name; + } + + let bufferedValue; + if (value instanceof Blob) { + bufferedValue = Buffer.from(await (value as any).arrayBuffer()); + } else { + bufferedValue = value; + } + + if (fileName == null) { + this.fd?.append(key, bufferedValue); + } else { + this.fd?.append(key, bufferedValue, { filename: fileName }); + } + } + + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: this.fd ? this.fd.getHeaders() : {}, + }; + } +} + +export type WebFormDataFd = { append(name: string, value: string | Blob, fileName?: string): void } | undefined; + +/** + * Form Data Implementation for Web + */ +export class WebFormData implements CrossPlatformFormData { + protected fd: WebFormDataFd; + + public async setup(): Promise { + this.fd = new FormData(); + } + + public append(key: string, value: any): void { + this.fd?.append(key, value); + } + + public async appendFile(key: string, value: any, fileName?: string): Promise { + if (fileName == null && isNamedValue(value)) { + fileName = value.name; + } + this.fd?.append(key, new Blob([value]), fileName); + } + + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: {}, + }; + } +} diff --git a/src/core/form-data-utils/index.ts b/src/core/form-data-utils/index.ts new file mode 100644 index 000000000..f210ac408 --- /dev/null +++ b/src/core/form-data-utils/index.ts @@ -0,0 +1 @@ +export * from "./FormDataWrapper"; diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 000000000..31520f7bd --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,7 @@ +export * from "./fetcher"; +export * from "./auth"; +export * from "./runtime"; +export * from "./utils"; +export * from "./pagination"; +export * from "./form-data-utils"; +export * as serialization from "./schemas"; diff --git a/src/core/json.ts b/src/core/json.ts new file mode 100644 index 000000000..ddc9d2dc6 --- /dev/null +++ b/src/core/json.ts @@ -0,0 +1,97 @@ +// Credit to Ivan Korolenko +// Code adopted from https://github.com/Ivan-Korolenko/json-with-bigint + +/* + Function to serialize data to JSON string + Converts BigInt values to custom format (strings with digits and "n" at the end) and then converts them to proper big integers in JSON string +*/ + +/** + * Serialize a value to JSON + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + * @returns JSON string + */ +export const toJson = ( + data: unknown, + replacer?: (this: unknown, key: string, value: unknown) => unknown, + space?: string | number, +): string => { + if (!data) { + return JSON.stringify(data, replacer, space); + } + + // eslint-disable-next-line no-useless-escape + const bigInts = /([\[:])?"(-?\d+)n"([,\}\]])/g; + const preliminaryJSON = JSON.stringify( + data, + (key, value) => + typeof value === "bigint" + ? value.toString() + "n" + : typeof replacer === "undefined" + ? value + : replacer(key, value), + space, + ); + const finalJSON = preliminaryJSON.replace(bigInts, "$1$2$3"); + + return finalJSON; +}; + +/* + Function to parse JSON + If JSON has values presented in a lib's custom format (strings with digits and "n" character at the end), we just parse them to BigInt values (for backward compatibility with previous versions of the lib) + If JSON has values greater than Number.MAX_SAFE_INTEGER, we convert those values to our custom format, then parse them to BigInt values. + Other types of values are not affected and parsed as native JSON.parse() would parse them. + + Big numbers are found and marked using a Regular Expression with these conditions: + + 1. Before the match there is no . and one of the following is present: + 1.1 ": + 1.2 ":[ + 1.3 ":[anyNumberOf(anyCharacters) + 1.4 , with no ":"anyNumberOf(anyCharacters) before it + All " required in the rule are not escaped. All whitespace and newline characters outside of string values are ignored. + + 2. The match itself has more than 16 digits OR (16 digits and any digit of the number is greater than that of the Number.MAX_SAFE_INTEGER). And it may have a - sign at the start. + + 3. After the match one of the following is present: + 3.1 , without anyNumberOf(anyCharacters) "} or anyNumberOf(anyCharacters) "] after it + 3.2 } without " after it + 3.3 ] without " after it + All whitespace and newline characters outside of string values are ignored. +*/ + +/** + * Parse JSON string to object, array, or other type + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is. + * @returns Parsed object, array, or other type + */ +export function fromJson( + json: string, + reviver?: (this: unknown, key: string, value: unknown) => unknown, +): T { + if (!json) { + return JSON.parse(json, reviver); + } + + const numbersBiggerThanMaxInt = // eslint-disable-next-line no-useless-escape + /(?<=[^\\]":\n*\s*[\[]?|[^\\]":\n*\s*\[.*[^\.\d*]\n*\s*|(? { + const isCustomFormatBigInt = typeof value === "string" && Boolean(value.match(/^-?\d+n$/)); + + if (isCustomFormatBigInt) { + return BigInt(value.substring(0, value.length - 1)); + } + + if (typeof reviver !== "undefined") { + return reviver(key, value); + } + + return value; + }); +} diff --git a/src/core/pagination/Page.ts b/src/core/pagination/Page.ts new file mode 100644 index 000000000..07c6796ee --- /dev/null +++ b/src/core/pagination/Page.ts @@ -0,0 +1,67 @@ +/** + * A page of results from a paginated API. + * + * @template T The type of the items in the page. + */ +export class Page implements AsyncIterable { + public data: T[]; + + private response: unknown; + private _hasNextPage: (response: unknown) => boolean; + private getItems: (response: unknown) => T[]; + private loadNextPage: (response: unknown) => Promise; + + constructor({ + response, + hasNextPage, + getItems, + loadPage, + }: { + response: unknown; + hasNextPage: (response: unknown) => boolean; + getItems: (response: unknown) => T[]; + loadPage: (response: unknown) => Promise; + }) { + this.response = response; + this.data = getItems(response); + this._hasNextPage = hasNextPage; + this.getItems = getItems; + this.loadNextPage = loadPage; + } + + /** + * Retrieves the next page + * @returns this + */ + public async getNextPage(): Promise { + this.response = await this.loadNextPage(this.response); + this.data = this.getItems(this.response); + return this; + } + + /** + * @returns whether there is a next page to load + */ + public hasNextPage(): boolean { + return this._hasNextPage(this.response); + } + + private async *iterMessages(): AsyncGenerator { + for (const item of this.data) { + yield item; + } + + while (this.hasNextPage()) { + await this.getNextPage(); + for (const item of this.data) { + yield item; + } + } + } + + async *[Symbol.asyncIterator](): AsyncIterator { + for await (const message of this.iterMessages()) { + yield message; + } + } +} diff --git a/src/core/pagination/Pageable.ts b/src/core/pagination/Pageable.ts new file mode 100644 index 000000000..befce6359 --- /dev/null +++ b/src/core/pagination/Pageable.ts @@ -0,0 +1,16 @@ +import { Page } from "./Page"; + +export declare namespace Pageable { + interface Args { + response: Response; + hasNextPage: (response: Response) => boolean; + getItems: (response: Response) => Item[]; + loadPage: (response: Response) => Promise; + } +} + +export class Pageable extends Page { + constructor(args: Pageable.Args) { + super(args as any); + } +} diff --git a/src/core/pagination/index.ts b/src/core/pagination/index.ts new file mode 100644 index 000000000..2ceb26844 --- /dev/null +++ b/src/core/pagination/index.ts @@ -0,0 +1,2 @@ +export { Page } from "./Page"; +export { Pageable } from "./Pageable"; diff --git a/src/core/runtime/index.ts b/src/core/runtime/index.ts new file mode 100644 index 000000000..5c76dbb13 --- /dev/null +++ b/src/core/runtime/index.ts @@ -0,0 +1 @@ +export { RUNTIME } from "./runtime"; diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts new file mode 100644 index 000000000..a97501751 --- /dev/null +++ b/src/core/runtime/runtime.ts @@ -0,0 +1,131 @@ +interface DenoGlobal { + version: { + deno: string; + }; +} + +interface BunGlobal { + version: string; +} + +declare const Deno: DenoGlobal | undefined; +declare const Bun: BunGlobal | undefined; +declare const EdgeRuntime: string | undefined; + +/** + * A constant that indicates which environment and version the SDK is running in. + */ +export const RUNTIME: Runtime = evaluateRuntime(); + +export interface Runtime { + type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime"; + version?: string; + parsedVersion?: number; +} + +function evaluateRuntime(): Runtime { + /** + * A constant that indicates whether the environment the code is running is a Web Browser. + */ + const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; + if (isBrowser) { + return { + type: "browser", + version: window.navigator.userAgent, + }; + } + + /** + * A constant that indicates whether the environment the code is running is Cloudflare. + * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent + */ + const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers"; + if (isCloudflare) { + return { + type: "workerd", + }; + } + + /** + * A constant that indicates whether the environment the code is running is Edge Runtime. + * https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime + */ + const isEdgeRuntime = typeof EdgeRuntime === "string"; + if (isEdgeRuntime) { + return { + type: "edge-runtime", + }; + } + + /** + * A constant that indicates whether the environment the code is running is a Web Worker. + */ + const isWebWorker = + typeof self === "object" && + // @ts-ignore + typeof self?.importScripts === "function" && + (self.constructor?.name === "DedicatedWorkerGlobalScope" || + self.constructor?.name === "ServiceWorkerGlobalScope" || + self.constructor?.name === "SharedWorkerGlobalScope"); + if (isWebWorker) { + return { + type: "web-worker", + }; + } + + /** + * A constant that indicates whether the environment the code is running is Deno. + * FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions + */ + const isDeno = + typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; + if (isDeno) { + return { + type: "deno", + version: Deno.version.deno, + }; + } + + /** + * A constant that indicates whether the environment the code is running is Bun.sh. + */ + const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; + if (isBun) { + return { + type: "bun", + version: Bun.version, + }; + } + + /** + * A constant that indicates whether the environment the code is running is Node.JS. + */ + const isNode = + typeof process !== "undefined" && + "version" in process && + !!process.version && + "versions" in process && + !!process.versions?.node; + if (isNode) { + return { + type: "node", + version: process.versions.node, + parsedVersion: Number(process.versions.node.split(".")[0]), + }; + } + + /** + * A constant that indicates whether the environment the code is running is in React-Native. + * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js + */ + const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; + if (isReactNative) { + return { + type: "react-native", + }; + } + + return { + type: "unknown", + }; +} diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts new file mode 100644 index 000000000..921a15466 --- /dev/null +++ b/src/core/schemas/Schema.ts @@ -0,0 +1,101 @@ +import { SchemaUtils } from "./builders"; + +export type Schema = BaseSchema & SchemaUtils; + +export type inferRaw = S extends Schema ? Raw : never; +export type inferParsed = S extends Schema ? Parsed : never; + +export interface BaseSchema { + parse: (raw: unknown, opts?: SchemaOptions) => MaybeValid; + json: (parsed: unknown, opts?: SchemaOptions) => MaybeValid; + getType: () => SchemaType | SchemaType; +} + +export const SchemaType = { + BIGINT: "bigint", + DATE: "date", + ENUM: "enum", + LIST: "list", + STRING_LITERAL: "stringLiteral", + BOOLEAN_LITERAL: "booleanLiteral", + OBJECT: "object", + ANY: "any", + BOOLEAN: "boolean", + NUMBER: "number", + STRING: "string", + UNKNOWN: "unknown", + RECORD: "record", + SET: "set", + UNION: "union", + UNDISCRIMINATED_UNION: "undiscriminatedUnion", + NULLABLE: "nullable", + OPTIONAL: "optional", + OPTIONAL_NULLABLE: "optionalNullable", +} as const; +export type SchemaType = (typeof SchemaType)[keyof typeof SchemaType]; + +export type MaybeValid = Valid | Invalid; + +export interface Valid { + ok: true; + value: T; +} + +export interface Invalid { + ok: false; + errors: ValidationError[]; +} + +export interface ValidationError { + path: string[]; + message: string; +} + +export interface SchemaOptions { + /** + * how to handle unrecognized keys in objects + * + * @default "fail" + */ + unrecognizedObjectKeys?: "fail" | "passthrough" | "strip"; + + /** + * whether to fail when an unrecognized discriminant value is + * encountered in a union + * + * @default false + */ + allowUnrecognizedUnionMembers?: boolean; + + /** + * whether to fail when an unrecognized enum value is encountered + * + * @default false + */ + allowUnrecognizedEnumValues?: boolean; + + /** + * whether to allow data that doesn't conform to the schema. + * invalid data is passed through without transformation. + * + * when this is enabled, .parse() and .json() will always + * return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()` + * will never fail. + * + * @default false + */ + skipValidation?: boolean; + + /** + * each validation failure contains a "path" property, which is + * the breadcrumbs to the offending node in the JSON. you can supply + * a prefix that is prepended to all the errors' paths. this can be + * helpful for zurg's internal debug logging. + */ + breadcrumbsPrefix?: string[]; + + /** + * whether to send 'null' for optional properties explicitly set to 'undefined'. + */ + omitUndefined?: boolean; +} diff --git a/src/core/schemas/builders/bigint/bigint.ts b/src/core/schemas/builders/bigint/bigint.ts new file mode 100644 index 000000000..e69bb791e --- /dev/null +++ b/src/core/schemas/builders/bigint/bigint.ts @@ -0,0 +1,55 @@ +import { BaseSchema, Schema, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; + +export function bigint(): Schema { + const baseSchema: BaseSchema = { + parse: (raw, { breadcrumbsPrefix = [] } = {}) => { + if (typeof raw === "bigint") { + return { + ok: true, + value: raw, + }; + } + if (typeof raw === "number") { + return { + ok: true, + value: BigInt(raw), + }; + } + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(raw, "bigint | number"), + }, + ], + }; + }, + json: (bigint, { breadcrumbsPrefix = [] } = {}) => { + if (typeof bigint !== "bigint") { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(bigint, "bigint"), + }, + ], + }; + } + return { + ok: true, + value: bigint, + }; + }, + getType: () => SchemaType.BIGINT, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/bigint/index.ts b/src/core/schemas/builders/bigint/index.ts new file mode 100644 index 000000000..e5843043f --- /dev/null +++ b/src/core/schemas/builders/bigint/index.ts @@ -0,0 +1 @@ +export { bigint } from "./bigint"; diff --git a/src/core/schemas/builders/date/date.ts b/src/core/schemas/builders/date/date.ts new file mode 100644 index 000000000..b70f24b04 --- /dev/null +++ b/src/core/schemas/builders/date/date.ts @@ -0,0 +1,65 @@ +import { BaseSchema, Schema, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; + +// https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime +const ISO_8601_REGEX = + /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; + +export function date(): Schema { + const baseSchema: BaseSchema = { + parse: (raw, { breadcrumbsPrefix = [] } = {}) => { + if (typeof raw !== "string") { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(raw, "string"), + }, + ], + }; + } + if (!ISO_8601_REGEX.test(raw)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(raw, "ISO 8601 date string"), + }, + ], + }; + } + return { + ok: true, + value: new Date(raw), + }; + }, + json: (date, { breadcrumbsPrefix = [] } = {}) => { + if (date instanceof Date) { + return { + ok: true, + value: date.toISOString(), + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(date, "Date object"), + }, + ], + }; + } + }, + getType: () => SchemaType.DATE, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/date/index.ts b/src/core/schemas/builders/date/index.ts new file mode 100644 index 000000000..187b29040 --- /dev/null +++ b/src/core/schemas/builders/date/index.ts @@ -0,0 +1 @@ +export { date } from "./date"; diff --git a/src/core/schemas/builders/enum/enum.ts b/src/core/schemas/builders/enum/enum.ts new file mode 100644 index 000000000..69aced6be --- /dev/null +++ b/src/core/schemas/builders/enum/enum.ts @@ -0,0 +1,43 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function enum_(values: E): Schema { + const validValues = new Set(values); + + const schemaCreator = createIdentitySchemaCreator( + SchemaType.ENUM, + (value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => { + if (typeof value !== "string") { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "string"), + }, + ], + }; + } + + if (!validValues.has(value) && !allowUnrecognizedEnumValues) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "enum"), + }, + ], + }; + } + + return { + ok: true, + value: value as U, + }; + }, + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/enum/index.ts b/src/core/schemas/builders/enum/index.ts new file mode 100644 index 000000000..fe6faed93 --- /dev/null +++ b/src/core/schemas/builders/enum/index.ts @@ -0,0 +1 @@ +export { enum_ } from "./enum"; diff --git a/src/core/schemas/builders/index.ts b/src/core/schemas/builders/index.ts new file mode 100644 index 000000000..65211f925 --- /dev/null +++ b/src/core/schemas/builders/index.ts @@ -0,0 +1,14 @@ +export * from "./bigint"; +export * from "./date"; +export * from "./enum"; +export * from "./lazy"; +export * from "./list"; +export * from "./literals"; +export * from "./object"; +export * from "./object-like"; +export * from "./primitives"; +export * from "./record"; +export * from "./schema-utils"; +export * from "./set"; +export * from "./undiscriminated-union"; +export * from "./union"; diff --git a/src/core/schemas/builders/lazy/index.ts b/src/core/schemas/builders/lazy/index.ts new file mode 100644 index 000000000..77420fb03 --- /dev/null +++ b/src/core/schemas/builders/lazy/index.ts @@ -0,0 +1,3 @@ +export { lazy } from "./lazy"; +export type { SchemaGetter } from "./lazy"; +export { lazyObject } from "./lazyObject"; diff --git a/src/core/schemas/builders/lazy/lazy.ts b/src/core/schemas/builders/lazy/lazy.ts new file mode 100644 index 000000000..2962bdfe0 --- /dev/null +++ b/src/core/schemas/builders/lazy/lazy.ts @@ -0,0 +1,32 @@ +import { BaseSchema, Schema } from "../../Schema"; +import { getSchemaUtils } from "../schema-utils"; + +export type SchemaGetter> = () => SchemaType; + +export function lazy(getter: SchemaGetter>): Schema { + const baseSchema = constructLazyBaseSchema(getter); + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} + +export function constructLazyBaseSchema( + getter: SchemaGetter>, +): BaseSchema { + return { + parse: (raw, opts) => getMemoizedSchema(getter).parse(raw, opts), + json: (parsed, opts) => getMemoizedSchema(getter).json(parsed, opts), + getType: () => getMemoizedSchema(getter).getType(), + }; +} + +type MemoizedGetter> = SchemaGetter & { __zurg_memoized?: SchemaType }; + +export function getMemoizedSchema>(getter: SchemaGetter): SchemaType { + const castedGetter = getter as MemoizedGetter; + if (castedGetter.__zurg_memoized == null) { + castedGetter.__zurg_memoized = getter(); + } + return castedGetter.__zurg_memoized; +} diff --git a/src/core/schemas/builders/lazy/lazyObject.ts b/src/core/schemas/builders/lazy/lazyObject.ts new file mode 100644 index 000000000..d8ee6ec5d --- /dev/null +++ b/src/core/schemas/builders/lazy/lazyObject.ts @@ -0,0 +1,20 @@ +import { getObjectUtils } from "../object"; +import { getObjectLikeUtils } from "../object-like"; +import { BaseObjectSchema, ObjectSchema } from "../object/types"; +import { getSchemaUtils } from "../schema-utils"; +import { SchemaGetter, constructLazyBaseSchema, getMemoizedSchema } from "./lazy"; + +export function lazyObject(getter: SchemaGetter>): ObjectSchema { + const baseSchema: BaseObjectSchema = { + ...constructLazyBaseSchema(getter), + _getRawProperties: () => getMemoizedSchema(getter)._getRawProperties(), + _getParsedProperties: () => getMemoizedSchema(getter)._getParsedProperties(), + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/list/index.ts b/src/core/schemas/builders/list/index.ts new file mode 100644 index 000000000..25f4bcc17 --- /dev/null +++ b/src/core/schemas/builders/list/index.ts @@ -0,0 +1 @@ +export { list } from "./list"; diff --git a/src/core/schemas/builders/list/list.ts b/src/core/schemas/builders/list/list.ts new file mode 100644 index 000000000..a6167a5be --- /dev/null +++ b/src/core/schemas/builders/list/list.ts @@ -0,0 +1,73 @@ +import { BaseSchema, MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; + +export function list(schema: Schema): Schema { + const baseSchema: BaseSchema = { + parse: (raw, opts) => + validateAndTransformArray(raw, (item, index) => + schema.parse(item, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], + }), + ), + json: (parsed, opts) => + validateAndTransformArray(parsed, (item, index) => + schema.json(item, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `[${index}]`], + }), + ), + getType: () => SchemaType.LIST, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +function validateAndTransformArray( + value: unknown, + transformItem: (item: Raw, index: number) => MaybeValid, +): MaybeValid { + if (!Array.isArray(value)) { + return { + ok: false, + errors: [ + { + message: getErrorMessageForIncorrectType(value, "list"), + path: [], + }, + ], + }; + } + + const maybeValidItems = value.map((item, index) => transformItem(item, index)); + + return maybeValidItems.reduce>( + (acc, item) => { + if (acc.ok && item.ok) { + return { + ok: true, + value: [...acc.value, item.value], + }; + } + + const errors: ValidationError[] = []; + if (!acc.ok) { + errors.push(...acc.errors); + } + if (!item.ok) { + errors.push(...item.errors); + } + + return { + ok: false, + errors, + }; + }, + { ok: true, value: [] }, + ); +} diff --git a/src/core/schemas/builders/literals/booleanLiteral.ts b/src/core/schemas/builders/literals/booleanLiteral.ts new file mode 100644 index 000000000..5c004133d --- /dev/null +++ b/src/core/schemas/builders/literals/booleanLiteral.ts @@ -0,0 +1,29 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function booleanLiteral(literal: V): Schema { + const schemaCreator = createIdentitySchemaCreator( + SchemaType.BOOLEAN_LITERAL, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (value === literal) { + return { + ok: true, + value: literal, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, `${literal.toString()}`), + }, + ], + }; + } + }, + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/literals/index.ts b/src/core/schemas/builders/literals/index.ts new file mode 100644 index 000000000..d2bf08fc6 --- /dev/null +++ b/src/core/schemas/builders/literals/index.ts @@ -0,0 +1,2 @@ +export { stringLiteral } from "./stringLiteral"; +export { booleanLiteral } from "./booleanLiteral"; diff --git a/src/core/schemas/builders/literals/stringLiteral.ts b/src/core/schemas/builders/literals/stringLiteral.ts new file mode 100644 index 000000000..334bbdc46 --- /dev/null +++ b/src/core/schemas/builders/literals/stringLiteral.ts @@ -0,0 +1,29 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function stringLiteral(literal: V): Schema { + const schemaCreator = createIdentitySchemaCreator( + SchemaType.STRING_LITERAL, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (value === literal) { + return { + ok: true, + value: literal, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, `"${literal}"`), + }, + ], + }; + } + }, + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/object-like/getObjectLikeUtils.ts b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts new file mode 100644 index 000000000..8885586e2 --- /dev/null +++ b/src/core/schemas/builders/object-like/getObjectLikeUtils.ts @@ -0,0 +1,79 @@ +import { BaseSchema } from "../../Schema"; +import { filterObject } from "../../utils/filterObject"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { getSchemaUtils } from "../schema-utils"; +import { ObjectLikeSchema, ObjectLikeUtils } from "./types"; + +export function getObjectLikeUtils(schema: BaseSchema): ObjectLikeUtils { + return { + withParsedProperties: (properties) => withParsedProperties(schema, properties), + }; +} + +/** + * object-like utils are defined in one file to resolve issues with circular imports + */ + +export function withParsedProperties( + objectLike: BaseSchema, + properties: { [K in keyof Properties]: Properties[K] | ((parsed: ParsedObjectShape) => Properties[K]) }, +): ObjectLikeSchema { + const objectSchema: BaseSchema = { + parse: (raw, opts) => { + const parsedObject = objectLike.parse(raw, opts); + if (!parsedObject.ok) { + return parsedObject; + } + + const additionalProperties = Object.entries(properties).reduce>( + (processed, [key, value]) => { + return { + ...processed, + [key]: typeof value === "function" ? value(parsedObject.value) : value, + }; + }, + {}, + ); + + return { + ok: true, + value: { + ...parsedObject.value, + ...(additionalProperties as Properties), + }, + }; + }, + + json: (parsed, opts) => { + if (!isPlainObject(parsed)) { + return { + ok: false, + errors: [ + { + path: opts?.breadcrumbsPrefix ?? [], + message: getErrorMessageForIncorrectType(parsed, "object"), + }, + ], + }; + } + + // strip out added properties + const addedPropertyKeys = new Set(Object.keys(properties)); + const parsedWithoutAddedProperties = filterObject( + parsed, + Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key)), + ); + + return objectLike.json(parsedWithoutAddedProperties as ParsedObjectShape, opts); + }, + + getType: () => objectLike.getType(), + }; + + return { + ...objectSchema, + ...getSchemaUtils(objectSchema), + ...getObjectLikeUtils(objectSchema), + }; +} diff --git a/src/core/schemas/builders/object-like/index.ts b/src/core/schemas/builders/object-like/index.ts new file mode 100644 index 000000000..c342e72cf --- /dev/null +++ b/src/core/schemas/builders/object-like/index.ts @@ -0,0 +1,2 @@ +export { getObjectLikeUtils, withParsedProperties } from "./getObjectLikeUtils"; +export type { ObjectLikeSchema, ObjectLikeUtils } from "./types"; diff --git a/src/core/schemas/builders/object-like/types.ts b/src/core/schemas/builders/object-like/types.ts new file mode 100644 index 000000000..75b369872 --- /dev/null +++ b/src/core/schemas/builders/object-like/types.ts @@ -0,0 +1,11 @@ +import { BaseSchema, Schema } from "../../Schema"; + +export type ObjectLikeSchema = Schema & + BaseSchema & + ObjectLikeUtils; + +export interface ObjectLikeUtils { + withParsedProperties: >(properties: { + [K in keyof T]: T[K] | ((parsed: Parsed) => T[K]); + }) => ObjectLikeSchema; +} diff --git a/src/core/schemas/builders/object/index.ts b/src/core/schemas/builders/object/index.ts new file mode 100644 index 000000000..e3f4388db --- /dev/null +++ b/src/core/schemas/builders/object/index.ts @@ -0,0 +1,22 @@ +export { getObjectUtils, object } from "./object"; +export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties"; +export type { + inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, + inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, +} from "./objectWithoutOptionalProperties"; +export { isProperty, property } from "./property"; +export type { Property } from "./property"; +export type { + BaseObjectSchema, + inferObjectSchemaFromPropertySchemas, + inferParsedObject, + inferParsedObjectFromPropertySchemas, + inferParsedPropertySchema, + inferRawKey, + inferRawObject, + inferRawObjectFromPropertySchemas, + inferRawPropertySchema, + ObjectSchema, + ObjectUtils, + PropertySchemas, +} from "./types"; diff --git a/src/core/schemas/builders/object/object.ts b/src/core/schemas/builders/object/object.ts new file mode 100644 index 000000000..05fbca8a1 --- /dev/null +++ b/src/core/schemas/builders/object/object.ts @@ -0,0 +1,366 @@ +import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { entries } from "../../utils/entries"; +import { filterObject } from "../../utils/filterObject"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { keys } from "../../utils/keys"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { partition } from "../../utils/partition"; +import { getObjectLikeUtils } from "../object-like"; +import { getSchemaUtils } from "../schema-utils"; +import { isProperty } from "./property"; +import { + BaseObjectSchema, + ObjectSchema, + ObjectUtils, + PropertySchemas, + inferObjectSchemaFromPropertySchemas, + inferParsedObjectFromPropertySchemas, + inferRawObjectFromPropertySchemas, +} from "./types"; + +interface ObjectPropertyWithRawKey { + rawKey: string; + parsedKey: string; + valueSchema: Schema; +} + +export function object>( + schemas: T, +): inferObjectSchemaFromPropertySchemas { + const baseSchema: BaseObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectFromPropertySchemas + > = { + _getRawProperties: () => + Object.entries(schemas).map(([parsedKey, propertySchema]) => + isProperty(propertySchema) ? propertySchema.rawKey : parsedKey, + ) as unknown as (keyof inferRawObjectFromPropertySchemas)[], + _getParsedProperties: () => keys(schemas) as unknown as (keyof inferParsedObjectFromPropertySchemas)[], + + parse: (raw, opts) => { + const rawKeyToProperty: Record = {}; + const requiredKeys: string[] = []; + + for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { + const rawKey = isProperty(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey; + const valueSchema: Schema = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.valueSchema + : schemaOrObjectProperty; + + const property: ObjectPropertyWithRawKey = { + rawKey, + parsedKey: parsedKey as string, + valueSchema, + }; + + rawKeyToProperty[rawKey] = property; + + if (isSchemaRequired(valueSchema)) { + requiredKeys.push(rawKey); + } + } + + return validateAndTransformObject({ + value: raw, + requiredKeys, + getProperty: (rawKey) => { + const property = rawKeyToProperty[rawKey]; + if (property == null) { + return undefined; + } + return { + transformedKey: property.parsedKey, + transform: (propertyValue) => + property.valueSchema.parse(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawKey], + }), + }; + }, + unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, + skipValidation: opts?.skipValidation, + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + omitUndefined: opts?.omitUndefined, + }); + }, + + json: (parsed, opts) => { + const requiredKeys: string[] = []; + + for (const [parsedKey, schemaOrObjectProperty] of entries(schemas)) { + const valueSchema: Schema = isProperty(schemaOrObjectProperty) + ? schemaOrObjectProperty.valueSchema + : schemaOrObjectProperty; + + if (isSchemaRequired(valueSchema)) { + requiredKeys.push(parsedKey as string); + } + } + + return validateAndTransformObject({ + value: parsed, + requiredKeys, + getProperty: ( + parsedKey, + ): { transformedKey: string; transform: (propertyValue: object) => MaybeValid } | undefined => { + const property = schemas[parsedKey as keyof T]; + + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (property == null) { + return undefined; + } + + if (isProperty(property)) { + return { + transformedKey: property.rawKey, + transform: (propertyValue) => + property.valueSchema.json(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], + }), + }; + } else { + return { + transformedKey: parsedKey, + transform: (propertyValue) => + property.json(propertyValue, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedKey], + }), + }; + } + }, + unrecognizedObjectKeys: opts?.unrecognizedObjectKeys, + skipValidation: opts?.skipValidation, + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + omitUndefined: opts?.omitUndefined, + }); + }, + + getType: () => SchemaType.OBJECT, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; +} + +function validateAndTransformObject({ + value, + requiredKeys, + getProperty, + unrecognizedObjectKeys = "fail", + skipValidation = false, + breadcrumbsPrefix = [], +}: { + value: unknown; + requiredKeys: string[]; + getProperty: ( + preTransformedKey: string, + ) => { transformedKey: string; transform: (propertyValue: object) => MaybeValid } | undefined; + unrecognizedObjectKeys: "fail" | "passthrough" | "strip" | undefined; + skipValidation: boolean | undefined; + breadcrumbsPrefix: string[] | undefined; + omitUndefined: boolean | undefined; +}): MaybeValid { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + const missingRequiredKeys = new Set(requiredKeys); + const errors: ValidationError[] = []; + const transformed: Record = {}; + + for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) { + const property = getProperty(preTransformedKey); + + if (property != null) { + missingRequiredKeys.delete(preTransformedKey); + + const value = property.transform(preTransformedItemValue as object); + if (value.ok) { + transformed[property.transformedKey] = value.value; + } else { + transformed[preTransformedKey] = preTransformedItemValue; + errors.push(...value.errors); + } + } else { + switch (unrecognizedObjectKeys) { + case "fail": + errors.push({ + path: [...breadcrumbsPrefix, preTransformedKey], + message: `Unexpected key "${preTransformedKey}"`, + }); + break; + case "strip": + break; + case "passthrough": + transformed[preTransformedKey] = preTransformedItemValue; + break; + } + } + } + + errors.push( + ...requiredKeys + .filter((key) => missingRequiredKeys.has(key)) + .map((key) => ({ + path: breadcrumbsPrefix, + message: `Missing required key "${key}"`, + })), + ); + + if (errors.length === 0 || skipValidation) { + return { + ok: true, + value: transformed as Transformed, + }; + } else { + return { + ok: false, + errors, + }; + } +} + +export function getObjectUtils(schema: BaseObjectSchema): ObjectUtils { + return { + extend: (extension: ObjectSchema) => { + const baseSchema: BaseObjectSchema = { + _getParsedProperties: () => [...schema._getParsedProperties(), ...extension._getParsedProperties()], + _getRawProperties: () => [...schema._getRawProperties(), ...extension._getRawProperties()], + parse: (raw, opts) => { + return validateAndTransformExtendedObject({ + extensionKeys: extension._getRawProperties(), + value: raw as object, + transformBase: (rawBase) => schema.parse(rawBase, opts), + transformExtension: (rawExtension) => extension.parse(rawExtension, opts), + }); + }, + json: (parsed, opts) => { + return validateAndTransformExtendedObject({ + extensionKeys: extension._getParsedProperties(), + value: parsed as object, + transformBase: (parsedBase) => schema.json(parsedBase, opts), + transformExtension: (parsedExtension) => extension.json(parsedExtension, opts), + }); + }, + getType: () => SchemaType.OBJECT, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; + }, + passthrough: () => { + const baseSchema: BaseObjectSchema = + { + _getParsedProperties: () => schema._getParsedProperties(), + _getRawProperties: () => schema._getRawProperties(), + parse: (raw, opts) => { + const transformed = schema.parse(raw, { ...opts, unrecognizedObjectKeys: "passthrough" }); + if (!transformed.ok) { + return transformed; + } + return { + ok: true, + value: { + ...(raw as any), + ...transformed.value, + }, + }; + }, + json: (parsed, opts) => { + const transformed = schema.json(parsed, { ...opts, unrecognizedObjectKeys: "passthrough" }); + if (!transformed.ok) { + return transformed; + } + return { + ok: true, + value: { + ...(parsed as any), + ...transformed.value, + }, + }; + }, + getType: () => SchemaType.OBJECT, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + ...getObjectUtils(baseSchema), + }; + }, + }; +} + +function validateAndTransformExtendedObject({ + extensionKeys, + value, + transformBase, + transformExtension, +}: { + extensionKeys: (keyof PreTransformedExtension)[]; + value: object; + transformBase: (value: object) => MaybeValid; + transformExtension: (value: object) => MaybeValid; +}): MaybeValid { + const extensionPropertiesSet = new Set(extensionKeys); + const [extensionProperties, baseProperties] = partition(keys(value), (key) => + extensionPropertiesSet.has(key as keyof PreTransformedExtension), + ); + + const transformedBase = transformBase(filterObject(value, baseProperties)); + const transformedExtension = transformExtension(filterObject(value, extensionProperties)); + + if (transformedBase.ok && transformedExtension.ok) { + return { + ok: true, + value: { + ...transformedBase.value, + ...transformedExtension.value, + }, + }; + } else { + return { + ok: false, + errors: [ + ...(transformedBase.ok ? [] : transformedBase.errors), + ...(transformedExtension.ok ? [] : transformedExtension.errors), + ], + }; + } +} + +function isSchemaRequired(schema: Schema): boolean { + return !isSchemaOptional(schema); +} + +function isSchemaOptional(schema: Schema): boolean { + switch (schema.getType()) { + case SchemaType.ANY: + case SchemaType.UNKNOWN: + case SchemaType.OPTIONAL: + case SchemaType.OPTIONAL_NULLABLE: + return true; + default: + return false; + } +} diff --git a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts new file mode 100644 index 000000000..ce4d3edca --- /dev/null +++ b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts @@ -0,0 +1,18 @@ +import { object } from "./object"; +import { ObjectSchema, PropertySchemas, inferParsedPropertySchema, inferRawObjectFromPropertySchemas } from "./types"; + +export function objectWithoutOptionalProperties>( + schemas: T, +): inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas { + return object(schemas) as unknown as inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas; +} + +export type inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas> = + ObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas + >; + +export type inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas> = { + [K in keyof T]: inferParsedPropertySchema; +}; diff --git a/src/core/schemas/builders/object/property.ts b/src/core/schemas/builders/object/property.ts new file mode 100644 index 000000000..fa9a9be84 --- /dev/null +++ b/src/core/schemas/builders/object/property.ts @@ -0,0 +1,23 @@ +import { Schema } from "../../Schema"; + +export function property( + rawKey: RawKey, + valueSchema: Schema, +): Property { + return { + rawKey, + valueSchema, + isProperty: true, + }; +} + +export interface Property { + rawKey: RawKey; + valueSchema: Schema; + isProperty: true; +} + +export function isProperty>(maybeProperty: unknown): maybeProperty is O { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + return (maybeProperty as O).isProperty; +} diff --git a/src/core/schemas/builders/object/types.ts b/src/core/schemas/builders/object/types.ts new file mode 100644 index 000000000..b4f49c884 --- /dev/null +++ b/src/core/schemas/builders/object/types.ts @@ -0,0 +1,58 @@ +import { BaseSchema, Schema, inferParsed, inferRaw } from "../../Schema"; +import { addQuestionMarksToNullableProperties } from "../../utils/addQuestionMarksToNullableProperties"; +import { ObjectLikeUtils } from "../object-like"; +import { SchemaUtils } from "../schema-utils"; +import { Property } from "./property"; + +export type ObjectSchema = BaseObjectSchema & + ObjectLikeUtils & + ObjectUtils & + SchemaUtils; + +export interface BaseObjectSchema extends BaseSchema { + _getRawProperties: () => (keyof Raw)[]; + _getParsedProperties: () => (keyof Parsed)[]; +} + +export interface ObjectUtils { + extend: ( + schemas: ObjectSchema, + ) => ObjectSchema; + passthrough: () => ObjectSchema; +} + +export type inferRawObject> = O extends ObjectSchema ? Raw : never; + +export type inferParsedObject> = + O extends ObjectSchema ? Parsed : never; + +export type inferObjectSchemaFromPropertySchemas> = ObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectFromPropertySchemas +>; + +export type inferRawObjectFromPropertySchemas> = + addQuestionMarksToNullableProperties<{ + [ParsedKey in keyof T as inferRawKey]: inferRawPropertySchema; + }>; + +export type inferParsedObjectFromPropertySchemas> = + addQuestionMarksToNullableProperties<{ + [K in keyof T]: inferParsedPropertySchema; + }>; + +export type PropertySchemas = Record< + ParsedKeys, + Property | Schema +>; + +export type inferRawPropertySchema

| Schema> = + P extends Property ? Raw : P extends Schema ? inferRaw

: never; + +export type inferParsedPropertySchema

| Schema> = + P extends Property ? Parsed : P extends Schema ? inferParsed

: never; + +export type inferRawKey< + ParsedKey extends string | number | symbol, + P extends Property | Schema, +> = P extends Property ? Raw : ParsedKey; diff --git a/src/core/schemas/builders/primitives/any.ts b/src/core/schemas/builders/primitives/any.ts new file mode 100644 index 000000000..fcaeb0425 --- /dev/null +++ b/src/core/schemas/builders/primitives/any.ts @@ -0,0 +1,4 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; + +export const any = createIdentitySchemaCreator(SchemaType.ANY, (value) => ({ ok: true, value })); diff --git a/src/core/schemas/builders/primitives/boolean.ts b/src/core/schemas/builders/primitives/boolean.ts new file mode 100644 index 000000000..2b5598810 --- /dev/null +++ b/src/core/schemas/builders/primitives/boolean.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const boolean = createIdentitySchemaCreator( + SchemaType.BOOLEAN, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "boolean") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "boolean"), + }, + ], + }; + } + }, +); diff --git a/src/core/schemas/builders/primitives/index.ts b/src/core/schemas/builders/primitives/index.ts new file mode 100644 index 000000000..788f9416b --- /dev/null +++ b/src/core/schemas/builders/primitives/index.ts @@ -0,0 +1,5 @@ +export { any } from "./any"; +export { boolean } from "./boolean"; +export { number } from "./number"; +export { string } from "./string"; +export { unknown } from "./unknown"; diff --git a/src/core/schemas/builders/primitives/number.ts b/src/core/schemas/builders/primitives/number.ts new file mode 100644 index 000000000..3d6be6ff7 --- /dev/null +++ b/src/core/schemas/builders/primitives/number.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const number = createIdentitySchemaCreator( + SchemaType.NUMBER, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "number") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "number"), + }, + ], + }; + } + }, +); diff --git a/src/core/schemas/builders/primitives/string.ts b/src/core/schemas/builders/primitives/string.ts new file mode 100644 index 000000000..e09aceeca --- /dev/null +++ b/src/core/schemas/builders/primitives/string.ts @@ -0,0 +1,25 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export const string = createIdentitySchemaCreator( + SchemaType.STRING, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (typeof value === "string") { + return { + ok: true, + value, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "string"), + }, + ], + }; + } + }, +); diff --git a/src/core/schemas/builders/primitives/unknown.ts b/src/core/schemas/builders/primitives/unknown.ts new file mode 100644 index 000000000..4d5249571 --- /dev/null +++ b/src/core/schemas/builders/primitives/unknown.ts @@ -0,0 +1,4 @@ +import { SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; + +export const unknown = createIdentitySchemaCreator(SchemaType.UNKNOWN, (value) => ({ ok: true, value })); diff --git a/src/core/schemas/builders/record/index.ts b/src/core/schemas/builders/record/index.ts new file mode 100644 index 000000000..82e25c5c2 --- /dev/null +++ b/src/core/schemas/builders/record/index.ts @@ -0,0 +1,2 @@ +export { record } from "./record"; +export type { BaseRecordSchema, RecordSchema } from "./types"; diff --git a/src/core/schemas/builders/record/record.ts b/src/core/schemas/builders/record/record.ts new file mode 100644 index 000000000..eb3e9a999 --- /dev/null +++ b/src/core/schemas/builders/record/record.ts @@ -0,0 +1,129 @@ +import { MaybeValid, Schema, SchemaType, ValidationError } from "../../Schema"; +import { entries } from "../../utils/entries"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; +import { BaseRecordSchema, RecordSchema } from "./types"; + +export function record( + keySchema: Schema, + valueSchema: Schema, +): RecordSchema { + const baseSchema: BaseRecordSchema = { + parse: (raw, opts) => { + return validateAndTransformRecord({ + value: raw, + isKeyNumeric: keySchema.getType() === SchemaType.NUMBER, + transformKey: (key) => + keySchema.parse(key, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], + }), + transformValue: (value, key) => + valueSchema.parse(value, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], + }), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + json: (parsed, opts) => { + return validateAndTransformRecord({ + value: parsed, + isKeyNumeric: keySchema.getType() === SchemaType.NUMBER, + transformKey: (key) => + keySchema.json(key, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key} (key)`], + }), + transformValue: (value, key) => + valueSchema.json(value, { + ...opts, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), `${key}`], + }), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + getType: () => SchemaType.RECORD, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +function validateAndTransformRecord({ + value, + isKeyNumeric, + transformKey, + transformValue, + breadcrumbsPrefix = [], +}: { + value: unknown; + isKeyNumeric: boolean; + transformKey: (key: string | number) => MaybeValid; + transformValue: (value: unknown, key: string | number) => MaybeValid; + breadcrumbsPrefix: string[] | undefined; +}): MaybeValid> { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + return entries(value).reduce>>( + (accPromise, [stringKey, value]) => { + if (value === undefined) { + return accPromise; + } + + const acc = accPromise; + + let key: string | number = stringKey; + if (isKeyNumeric) { + const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN; + if (!isNaN(numberKey)) { + key = numberKey; + } + } + const transformedKey = transformKey(key); + + const transformedValue = transformValue(value, key); + + if (acc.ok && transformedKey.ok && transformedValue.ok) { + return { + ok: true, + value: { + ...acc.value, + [transformedKey.value]: transformedValue.value, + }, + }; + } + + const errors: ValidationError[] = []; + if (!acc.ok) { + errors.push(...acc.errors); + } + if (!transformedKey.ok) { + errors.push(...transformedKey.errors); + } + if (!transformedValue.ok) { + errors.push(...transformedValue.errors); + } + + return { + ok: false, + errors, + }; + }, + { ok: true, value: {} as Record }, + ); +} diff --git a/src/core/schemas/builders/record/types.ts b/src/core/schemas/builders/record/types.ts new file mode 100644 index 000000000..fec431d43 --- /dev/null +++ b/src/core/schemas/builders/record/types.ts @@ -0,0 +1,17 @@ +import { BaseSchema } from "../../Schema"; +import { SchemaUtils } from "../schema-utils"; + +export type RecordSchema< + RawKey extends string | number, + RawValue, + ParsedKey extends string | number, + ParsedValue, +> = BaseRecordSchema & + SchemaUtils, Record>; + +export type BaseRecordSchema< + RawKey extends string | number, + RawValue, + ParsedKey extends string | number, + ParsedValue, +> = BaseSchema, Record>; diff --git a/src/core/schemas/builders/schema-utils/JsonError.ts b/src/core/schemas/builders/schema-utils/JsonError.ts new file mode 100644 index 000000000..2b89ca0e7 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/JsonError.ts @@ -0,0 +1,9 @@ +import { ValidationError } from "../../Schema"; +import { stringifyValidationError } from "./stringifyValidationErrors"; + +export class JsonError extends Error { + constructor(public readonly errors: ValidationError[]) { + super(errors.map(stringifyValidationError).join("; ")); + Object.setPrototypeOf(this, JsonError.prototype); + } +} diff --git a/src/core/schemas/builders/schema-utils/ParseError.ts b/src/core/schemas/builders/schema-utils/ParseError.ts new file mode 100644 index 000000000..d056eb45c --- /dev/null +++ b/src/core/schemas/builders/schema-utils/ParseError.ts @@ -0,0 +1,9 @@ +import { ValidationError } from "../../Schema"; +import { stringifyValidationError } from "./stringifyValidationErrors"; + +export class ParseError extends Error { + constructor(public readonly errors: ValidationError[]) { + super(errors.map(stringifyValidationError).join("; ")); + Object.setPrototypeOf(this, ParseError.prototype); + } +} diff --git a/src/core/schemas/builders/schema-utils/getSchemaUtils.ts b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts new file mode 100644 index 000000000..d5e7a955d --- /dev/null +++ b/src/core/schemas/builders/schema-utils/getSchemaUtils.ts @@ -0,0 +1,181 @@ +import { BaseSchema, Schema, SchemaOptions, SchemaType } from "../../Schema"; +import { JsonError } from "./JsonError"; +import { ParseError } from "./ParseError"; + +export interface SchemaUtils { + nullable: () => Schema; + optional: () => Schema; + optionalNullable: () => Schema; + transform: (transformer: SchemaTransformer) => Schema; + parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed; + jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw; +} + +export interface SchemaTransformer { + transform: (parsed: Parsed) => Transformed; + untransform: (transformed: any) => Parsed; +} + +export function getSchemaUtils(schema: BaseSchema): SchemaUtils { + return { + nullable: () => nullable(schema), + optional: () => optional(schema), + optionalNullable: () => optionalNullable(schema), + transform: (transformer) => transform(schema, transformer), + parseOrThrow: (raw, opts) => { + const parsed = schema.parse(raw, opts); + if (parsed.ok) { + return parsed.value; + } + throw new ParseError(parsed.errors); + }, + jsonOrThrow: (parsed, opts) => { + const raw = schema.json(parsed, opts); + if (raw.ok) { + return raw.value; + } + throw new JsonError(raw.errors); + }, + }; +} + +/** + * schema utils are defined in one file to resolve issues with circular imports + */ + +export function nullable(schema: BaseSchema): Schema { + const baseSchema: BaseSchema = { + parse: (raw, opts) => { + if (raw == null) { + return { + ok: true, + value: null, + }; + } + return schema.parse(raw, opts); + }, + json: (parsed, opts) => { + if (parsed == null) { + return { + ok: true, + value: null, + }; + } + return schema.json(parsed, opts); + }, + getType: () => SchemaType.NULLABLE, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} + +export function optional( + schema: BaseSchema, +): Schema { + const baseSchema: BaseSchema = { + parse: (raw, opts) => { + if (raw == null) { + return { + ok: true, + value: undefined, + }; + } + return schema.parse(raw, opts); + }, + json: (parsed, opts) => { + if (opts?.omitUndefined && parsed === undefined) { + return { + ok: true, + value: undefined, + }; + } + if (parsed == null) { + return { + ok: true, + value: null, + }; + } + return schema.json(parsed, opts); + }, + getType: () => SchemaType.OPTIONAL, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} + +export function optionalNullable( + schema: BaseSchema, +): Schema { + const baseSchema: BaseSchema = { + parse: (raw, opts) => { + if (raw === undefined) { + return { + ok: true, + value: undefined, + }; + } + if (raw === null) { + return { + ok: true, + value: null, + }; + } + return schema.parse(raw, opts); + }, + json: (parsed, opts) => { + if (parsed === undefined) { + return { + ok: true, + value: undefined, + }; + } + if (parsed === null) { + return { + ok: true, + value: null, + }; + } + return schema.json(parsed, opts); + }, + getType: () => SchemaType.OPTIONAL_NULLABLE, + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} + +export function transform( + schema: BaseSchema, + transformer: SchemaTransformer, +): Schema { + const baseSchema: BaseSchema = { + parse: (raw, opts) => { + const parsed = schema.parse(raw, opts); + if (!parsed.ok) { + return parsed; + } + return { + ok: true, + value: transformer.transform(parsed.value), + }; + }, + json: (transformed, opts) => { + const parsed = transformer.untransform(transformed); + return schema.json(parsed, opts); + }, + getType: () => schema.getType(), + }; + + return { + ...baseSchema, + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/schema-utils/index.ts b/src/core/schemas/builders/schema-utils/index.ts new file mode 100644 index 000000000..aa04e051d --- /dev/null +++ b/src/core/schemas/builders/schema-utils/index.ts @@ -0,0 +1,4 @@ +export { getSchemaUtils, optional, transform } from "./getSchemaUtils"; +export type { SchemaUtils } from "./getSchemaUtils"; +export { JsonError } from "./JsonError"; +export { ParseError } from "./ParseError"; diff --git a/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts new file mode 100644 index 000000000..4160f0a26 --- /dev/null +++ b/src/core/schemas/builders/schema-utils/stringifyValidationErrors.ts @@ -0,0 +1,8 @@ +import { ValidationError } from "../../Schema"; + +export function stringifyValidationError(error: ValidationError): string { + if (error.path.length === 0) { + return error.message; + } + return `${error.path.join(" -> ")}: ${error.message}`; +} diff --git a/src/core/schemas/builders/set/index.ts b/src/core/schemas/builders/set/index.ts new file mode 100644 index 000000000..f3310e8bd --- /dev/null +++ b/src/core/schemas/builders/set/index.ts @@ -0,0 +1 @@ +export { set } from "./set"; diff --git a/src/core/schemas/builders/set/set.ts b/src/core/schemas/builders/set/set.ts new file mode 100644 index 000000000..e9e6bb7e5 --- /dev/null +++ b/src/core/schemas/builders/set/set.ts @@ -0,0 +1,43 @@ +import { BaseSchema, Schema, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { list } from "../list"; +import { getSchemaUtils } from "../schema-utils"; + +export function set(schema: Schema): Schema> { + const listSchema = list(schema); + const baseSchema: BaseSchema> = { + parse: (raw, opts) => { + const parsedList = listSchema.parse(raw, opts); + if (parsedList.ok) { + return { + ok: true, + value: new Set(parsedList.value), + }; + } else { + return parsedList; + } + }, + json: (parsed, opts) => { + if (!(parsed instanceof Set)) { + return { + ok: false, + errors: [ + { + path: opts?.breadcrumbsPrefix ?? [], + message: getErrorMessageForIncorrectType(parsed, "Set"), + }, + ], + }; + } + const jsonList = listSchema.json([...parsed], opts); + return jsonList; + }, + getType: () => SchemaType.SET, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} diff --git a/src/core/schemas/builders/undiscriminated-union/index.ts b/src/core/schemas/builders/undiscriminated-union/index.ts new file mode 100644 index 000000000..75b71cb35 --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/index.ts @@ -0,0 +1,6 @@ +export type { + inferParsedUnidiscriminatedUnionSchema, + inferRawUnidiscriminatedUnionSchema, + UndiscriminatedUnionSchema, +} from "./types"; +export { undiscriminatedUnion } from "./undiscriminatedUnion"; diff --git a/src/core/schemas/builders/undiscriminated-union/types.ts b/src/core/schemas/builders/undiscriminated-union/types.ts new file mode 100644 index 000000000..4f0888aaf --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/types.ts @@ -0,0 +1,10 @@ +import { Schema, inferParsed, inferRaw } from "../../Schema"; + +export type UndiscriminatedUnionSchema = Schema< + inferRawUnidiscriminatedUnionSchema, + inferParsedUnidiscriminatedUnionSchema +>; + +export type inferRawUnidiscriminatedUnionSchema = inferRaw; + +export type inferParsedUnidiscriminatedUnionSchema = inferParsed; diff --git a/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts new file mode 100644 index 000000000..a5cf01fa5 --- /dev/null +++ b/src/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.ts @@ -0,0 +1,60 @@ +import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType, ValidationError } from "../../Schema"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { getSchemaUtils } from "../schema-utils"; +import { inferParsedUnidiscriminatedUnionSchema, inferRawUnidiscriminatedUnionSchema } from "./types"; + +export function undiscriminatedUnion, ...Schema[]]>( + schemas: Schemas, +): Schema, inferParsedUnidiscriminatedUnionSchema> { + const baseSchema: BaseSchema< + inferRawUnidiscriminatedUnionSchema, + inferParsedUnidiscriminatedUnionSchema + > = { + parse: (raw, opts) => { + return validateAndTransformUndiscriminatedUnion>( + (schema, opts) => schema.parse(raw, opts), + schemas, + opts, + ); + }, + json: (parsed, opts) => { + return validateAndTransformUndiscriminatedUnion>( + (schema, opts) => schema.json(parsed, opts), + schemas, + opts, + ); + }, + getType: () => SchemaType.UNDISCRIMINATED_UNION, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; +} + +function validateAndTransformUndiscriminatedUnion( + transform: (schema: Schema, opts: SchemaOptions) => MaybeValid, + schemas: Schema[], + opts: SchemaOptions | undefined, +): MaybeValid { + const errors: ValidationError[] = []; + for (const [index, schema] of schemas.entries()) { + const transformed = transform(schema, { ...opts, skipValidation: false }); + if (transformed.ok) { + return transformed; + } else { + for (const error of transformed.errors) { + errors.push({ + path: error.path, + message: `[Variant ${index}] ${error.message}`, + }); + } + } + } + + return { + ok: false, + errors, + }; +} diff --git a/src/core/schemas/builders/union/discriminant.ts b/src/core/schemas/builders/union/discriminant.ts new file mode 100644 index 000000000..73cd62ade --- /dev/null +++ b/src/core/schemas/builders/union/discriminant.ts @@ -0,0 +1,14 @@ +export function discriminant( + parsedDiscriminant: ParsedDiscriminant, + rawDiscriminant: RawDiscriminant, +): Discriminant { + return { + parsedDiscriminant, + rawDiscriminant, + }; +} + +export interface Discriminant { + parsedDiscriminant: ParsedDiscriminant; + rawDiscriminant: RawDiscriminant; +} diff --git a/src/core/schemas/builders/union/index.ts b/src/core/schemas/builders/union/index.ts new file mode 100644 index 000000000..85fc008a2 --- /dev/null +++ b/src/core/schemas/builders/union/index.ts @@ -0,0 +1,10 @@ +export { discriminant } from "./discriminant"; +export type { Discriminant } from "./discriminant"; +export type { + inferParsedDiscriminant, + inferParsedUnion, + inferRawDiscriminant, + inferRawUnion, + UnionSubtypes, +} from "./types"; +export { union } from "./union"; diff --git a/src/core/schemas/builders/union/types.ts b/src/core/schemas/builders/union/types.ts new file mode 100644 index 000000000..7ac9d16d6 --- /dev/null +++ b/src/core/schemas/builders/union/types.ts @@ -0,0 +1,26 @@ +import { ObjectSchema, inferParsedObject, inferRawObject } from "../object"; +import { Discriminant } from "./discriminant"; + +export type UnionSubtypes = { + [K in DiscriminantValues]: ObjectSchema; +}; + +export type inferRawUnion, U extends UnionSubtypes> = { + [K in keyof U]: Record, K> & inferRawObject; +}[keyof U]; + +export type inferParsedUnion, U extends UnionSubtypes> = { + [K in keyof U]: Record, K> & inferParsedObject; +}[keyof U]; + +export type inferRawDiscriminant> = D extends string + ? D + : D extends Discriminant + ? Raw + : never; + +export type inferParsedDiscriminant> = D extends string + ? D + : D extends Discriminant + ? Parsed + : never; diff --git a/src/core/schemas/builders/union/union.ts b/src/core/schemas/builders/union/union.ts new file mode 100644 index 000000000..afdd5a1f5 --- /dev/null +++ b/src/core/schemas/builders/union/union.ts @@ -0,0 +1,170 @@ +import { BaseSchema, MaybeValid, SchemaType } from "../../Schema"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; +import { isPlainObject } from "../../utils/isPlainObject"; +import { keys } from "../../utils/keys"; +import { maybeSkipValidation } from "../../utils/maybeSkipValidation"; +import { enum_ } from "../enum"; +import { ObjectSchema } from "../object"; +import { ObjectLikeSchema, getObjectLikeUtils } from "../object-like"; +import { getSchemaUtils } from "../schema-utils"; +import { Discriminant } from "./discriminant"; +import { UnionSubtypes, inferParsedDiscriminant, inferParsedUnion, inferRawDiscriminant, inferRawUnion } from "./types"; + +export function union, U extends UnionSubtypes>( + discriminant: D, + union: U, +): ObjectLikeSchema, inferParsedUnion> { + const rawDiscriminant = + typeof discriminant === "string" ? discriminant : (discriminant.rawDiscriminant as inferRawDiscriminant); + const parsedDiscriminant = + typeof discriminant === "string" + ? discriminant + : (discriminant.parsedDiscriminant as inferParsedDiscriminant); + + const discriminantValueSchema = enum_(keys(union) as string[]); + + const baseSchema: BaseSchema, inferParsedUnion> = { + parse: (raw, opts) => { + return transformAndValidateUnion({ + value: raw, + discriminant: rawDiscriminant, + transformedDiscriminant: parsedDiscriminant, + transformDiscriminantValue: (discriminantValue) => + discriminantValueSchema.parse(discriminantValue, { + allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), rawDiscriminant], + }), + getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue], + allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers, + transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => + additionalPropertiesSchema.parse(additionalProperties, opts), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + json: (parsed, opts) => { + return transformAndValidateUnion({ + value: parsed, + discriminant: parsedDiscriminant, + transformedDiscriminant: rawDiscriminant, + transformDiscriminantValue: (discriminantValue) => + discriminantValueSchema.json(discriminantValue, { + allowUnrecognizedEnumValues: opts?.allowUnrecognizedUnionMembers, + breadcrumbsPrefix: [...(opts?.breadcrumbsPrefix ?? []), parsedDiscriminant], + }), + getAdditionalPropertiesSchema: (discriminantValue) => union[discriminantValue], + allowUnrecognizedUnionMembers: opts?.allowUnrecognizedUnionMembers, + transformAdditionalProperties: (additionalProperties, additionalPropertiesSchema) => + additionalPropertiesSchema.json(additionalProperties, opts), + breadcrumbsPrefix: opts?.breadcrumbsPrefix, + }); + }, + getType: () => SchemaType.UNION, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + ...getObjectLikeUtils(baseSchema), + }; +} + +function transformAndValidateUnion< + TransformedDiscriminant extends string, + TransformedDiscriminantValue extends string, + TransformedAdditionalProperties, +>({ + value, + discriminant, + transformedDiscriminant, + transformDiscriminantValue, + getAdditionalPropertiesSchema, + allowUnrecognizedUnionMembers = false, + transformAdditionalProperties, + breadcrumbsPrefix = [], +}: { + value: unknown; + discriminant: string; + transformedDiscriminant: TransformedDiscriminant; + transformDiscriminantValue: (discriminantValue: unknown) => MaybeValid; + getAdditionalPropertiesSchema: (discriminantValue: string) => ObjectSchema | undefined; + allowUnrecognizedUnionMembers: boolean | undefined; + transformAdditionalProperties: ( + additionalProperties: unknown, + additionalPropertiesSchema: ObjectSchema, + ) => MaybeValid; + breadcrumbsPrefix: string[] | undefined; +}): MaybeValid & TransformedAdditionalProperties> { + if (!isPlainObject(value)) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, "object"), + }, + ], + }; + } + + const { [discriminant]: discriminantValue, ...additionalProperties } = value; + + if (discriminantValue == null) { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: `Missing discriminant ("${discriminant}")`, + }, + ], + }; + } + + const transformedDiscriminantValue = transformDiscriminantValue(discriminantValue); + if (!transformedDiscriminantValue.ok) { + return { + ok: false, + errors: transformedDiscriminantValue.errors, + }; + } + + const additionalPropertiesSchema = getAdditionalPropertiesSchema(transformedDiscriminantValue.value); + + if (additionalPropertiesSchema == null) { + if (allowUnrecognizedUnionMembers) { + return { + ok: true, + value: { + [transformedDiscriminant]: transformedDiscriminantValue.value, + ...additionalProperties, + } as Record & TransformedAdditionalProperties, + }; + } else { + return { + ok: false, + errors: [ + { + path: [...breadcrumbsPrefix, discriminant], + message: "Unexpected discriminant value", + }, + ], + }; + } + } + + const transformedAdditionalProperties = transformAdditionalProperties( + additionalProperties, + additionalPropertiesSchema, + ); + if (!transformedAdditionalProperties.ok) { + return transformedAdditionalProperties; + } + + return { + ok: true, + value: { + [transformedDiscriminant]: discriminantValue, + ...transformedAdditionalProperties.value, + } as Record & TransformedAdditionalProperties, + }; +} diff --git a/src/core/schemas/index.ts b/src/core/schemas/index.ts new file mode 100644 index 000000000..5429d8b43 --- /dev/null +++ b/src/core/schemas/index.ts @@ -0,0 +1,2 @@ +export * from "./builders"; +export type { inferParsed, inferRaw, Schema, SchemaOptions } from "./Schema"; diff --git a/src/core/schemas/utils/MaybePromise.ts b/src/core/schemas/utils/MaybePromise.ts new file mode 100644 index 000000000..9cd354b34 --- /dev/null +++ b/src/core/schemas/utils/MaybePromise.ts @@ -0,0 +1 @@ +export type MaybePromise = T | Promise; diff --git a/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts b/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts new file mode 100644 index 000000000..59f9e6588 --- /dev/null +++ b/src/core/schemas/utils/addQuestionMarksToNullableProperties.ts @@ -0,0 +1,9 @@ +export type addQuestionMarksToNullableProperties = { + [K in OptionalKeys]?: T[K]; +} & Pick>; + +export type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] ? K : never; +}[keyof T]; + +export type RequiredKeys = Exclude>; diff --git a/src/core/schemas/utils/createIdentitySchemaCreator.ts b/src/core/schemas/utils/createIdentitySchemaCreator.ts new file mode 100644 index 000000000..4db71be4a --- /dev/null +++ b/src/core/schemas/utils/createIdentitySchemaCreator.ts @@ -0,0 +1,21 @@ +import { BaseSchema, MaybeValid, Schema, SchemaOptions, SchemaType } from "../Schema"; +import { getSchemaUtils } from "../builders/schema-utils"; +import { maybeSkipValidation } from "./maybeSkipValidation"; + +export function createIdentitySchemaCreator( + schemaType: SchemaType, + validate: (value: unknown, opts?: SchemaOptions) => MaybeValid, +): () => Schema { + return () => { + const baseSchema: BaseSchema = { + parse: validate, + json: validate, + getType: () => schemaType, + }; + + return { + ...maybeSkipValidation(baseSchema), + ...getSchemaUtils(baseSchema), + }; + }; +} diff --git a/src/core/schemas/utils/entries.ts b/src/core/schemas/utils/entries.ts new file mode 100644 index 000000000..2d5c93d65 --- /dev/null +++ b/src/core/schemas/utils/entries.ts @@ -0,0 +1,3 @@ +export function entries(object: T): [keyof T, T[keyof T]][] { + return Object.entries(object) as [keyof T, T[keyof T]][]; +} diff --git a/src/core/schemas/utils/filterObject.ts b/src/core/schemas/utils/filterObject.ts new file mode 100644 index 000000000..70527d100 --- /dev/null +++ b/src/core/schemas/utils/filterObject.ts @@ -0,0 +1,13 @@ +export function filterObject(obj: T, keysToInclude: K[]): Pick { + const keysToIncludeSet = new Set(keysToInclude); + return Object.entries(obj).reduce( + (acc, [key, value]) => { + if (keysToIncludeSet.has(key as K)) { + acc[key as K] = value as T[K]; + } + return acc; + // eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter + }, + {} as Pick, + ); +} diff --git a/src/core/schemas/utils/getErrorMessageForIncorrectType.ts b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts new file mode 100644 index 000000000..1a5c31027 --- /dev/null +++ b/src/core/schemas/utils/getErrorMessageForIncorrectType.ts @@ -0,0 +1,25 @@ +export function getErrorMessageForIncorrectType(value: unknown, expectedType: string): string { + return `Expected ${expectedType}. Received ${getTypeAsString(value)}.`; +} + +function getTypeAsString(value: unknown): string { + if (Array.isArray(value)) { + return "list"; + } + if (value === null) { + return "null"; + } + if (value instanceof BigInt) { + return "BigInt"; + } + switch (typeof value) { + case "string": + return `"${value}"`; + case "bigint": + case "number": + case "boolean": + case "undefined": + return `${value}`; + } + return typeof value; +} diff --git a/src/core/schemas/utils/isPlainObject.ts b/src/core/schemas/utils/isPlainObject.ts new file mode 100644 index 000000000..db82a722c --- /dev/null +++ b/src/core/schemas/utils/isPlainObject.ts @@ -0,0 +1,17 @@ +// borrowed from https://github.com/lodash/lodash/blob/master/isPlainObject.js +export function isPlainObject(value: unknown): value is Record { + if (typeof value !== "object" || value === null) { + return false; + } + + if (Object.getPrototypeOf(value) === null) { + return true; + } + + let proto = value; + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + + return Object.getPrototypeOf(value) === proto; +} diff --git a/src/core/schemas/utils/keys.ts b/src/core/schemas/utils/keys.ts new file mode 100644 index 000000000..2e0930e2d --- /dev/null +++ b/src/core/schemas/utils/keys.ts @@ -0,0 +1,3 @@ +export function keys(object: T): (keyof T)[] { + return Object.keys(object) as (keyof T)[]; +} diff --git a/src/core/schemas/utils/maybeSkipValidation.ts b/src/core/schemas/utils/maybeSkipValidation.ts new file mode 100644 index 000000000..950d5f9c5 --- /dev/null +++ b/src/core/schemas/utils/maybeSkipValidation.ts @@ -0,0 +1,38 @@ +import { BaseSchema, MaybeValid, SchemaOptions } from "../Schema"; + +export function maybeSkipValidation, Raw, Parsed>(schema: S): S { + return { + ...schema, + json: transformAndMaybeSkipValidation(schema.json), + parse: transformAndMaybeSkipValidation(schema.parse), + }; +} + +function transformAndMaybeSkipValidation( + transform: (value: unknown, opts?: SchemaOptions) => MaybeValid, +): (value: unknown, opts?: SchemaOptions) => MaybeValid { + return (value, opts): MaybeValid => { + const transformed = transform(value, opts); + const { skipValidation = false } = opts ?? {}; + if (!transformed.ok && skipValidation) { + // eslint-disable-next-line no-console + console.warn( + [ + "Failed to validate.", + ...transformed.errors.map( + (error) => + " - " + + (error.path.length > 0 ? `${error.path.join(".")}: ${error.message}` : error.message), + ), + ].join("\n"), + ); + + return { + ok: true, + value: value as T, + }; + } else { + return transformed; + } + }; +} diff --git a/src/core/schemas/utils/partition.ts b/src/core/schemas/utils/partition.ts new file mode 100644 index 000000000..f58d6f3d3 --- /dev/null +++ b/src/core/schemas/utils/partition.ts @@ -0,0 +1,12 @@ +export function partition(items: readonly T[], predicate: (item: T) => boolean): [T[], T[]] { + const trueItems: T[] = [], + falseItems: T[] = []; + for (const item of items) { + if (predicate(item)) { + trueItems.push(item); + } else { + falseItems.push(item); + } + } + return [trueItems, falseItems]; +} diff --git a/src/core/utils/index.ts b/src/core/utils/index.ts new file mode 100644 index 000000000..b168f599a --- /dev/null +++ b/src/core/utils/index.ts @@ -0,0 +1 @@ +export { setObjectProperty } from "./setObjectProperty"; diff --git a/src/core/utils/setObjectProperty.ts b/src/core/utils/setObjectProperty.ts new file mode 100644 index 000000000..5528af248 --- /dev/null +++ b/src/core/utils/setObjectProperty.ts @@ -0,0 +1,43 @@ +/** + * Sets the value at path of object. If a portion of path doesn’t exist it’s created. This is + * inspired by Lodash's set function, but is simplified to accommodate our use case. + * For more details, see https://lodash.com/docs/4.17.15#set. + * + * @param object The object to modify. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ +export function setObjectProperty(object: T, path: string, value: any): T { + if (object == null) { + return object; + } + + const keys: string[] = path.split("."); + if (keys.length === 0) { + // Invalid path; do nothing. + return object; + } + + let current: Record = object; + for (let i = 0; i < keys.length - 1; i++) { + const key = keys[i]; + if (key == null) { + // Unreachable. + continue; + } + if (!current[key] || typeof current[key] !== "object") { + current[key] = {}; + } + current = current[key] as Record; + } + + const lastKey = keys[keys.length - 1]; + if (lastKey == null) { + // Unreachable. + return object; + } + + current[lastKey] = value; + return object; +} diff --git a/src/defaultConfiguration.ts b/src/defaultConfiguration.ts deleted file mode 100644 index 22004fbdf..000000000 --- a/src/defaultConfiguration.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Configuration, Environment } from './configuration'; -import { RetryConfiguration } from './core'; - -/** Default values for the configuration parameters of the client. */ -export const DEFAULT_CONFIGURATION: Configuration = { - timeout: 60000, - squareVersion: '2024-12-18', - additionalHeaders: {}, - userAgentDetail: '', - environment: Environment.Production, - customUrl: 'https://connect.squareup.com', -}; - -/** Default values for retry configuration parameters. */ -export const DEFAULT_RETRY_CONFIG: RetryConfiguration = { - maxNumberOfRetries: 0, - retryOnTimeout: true, - retryInterval: 1, - maximumRetryWaitTime: 0, - backoffFactor: 2, - httpStatusCodesToRetry: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], - httpMethodsToRetry: ['GET', 'PUT'], -}; diff --git a/src/environments.ts b/src/environments.ts new file mode 100644 index 000000000..3f579afbe --- /dev/null +++ b/src/environments.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export const SquareEnvironment = { + Production: "https://connect.squareup.com", + Sandbox: "https://connect.squareupsandbox.com", +} as const; + +export type SquareEnvironment = typeof SquareEnvironment.Production | typeof SquareEnvironment.Sandbox; diff --git a/src/errors/SquareError.ts b/src/errors/SquareError.ts new file mode 100644 index 000000000..d191b2965 --- /dev/null +++ b/src/errors/SquareError.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import { toJson } from "../core/json"; + +export class SquareError extends Error { + readonly statusCode?: number; + readonly body?: unknown; + + constructor({ message, statusCode, body }: { message?: string; statusCode?: number; body?: unknown }) { + super(buildMessage({ message, statusCode, body })); + Object.setPrototypeOf(this, SquareError.prototype); + if (statusCode != null) { + this.statusCode = statusCode; + } + + if (body !== undefined) { + this.body = body; + } + } +} + +function buildMessage({ + message, + statusCode, + body, +}: { + message: string | undefined; + statusCode: number | undefined; + body: unknown | undefined; +}): string { + let lines: string[] = []; + if (message != null) { + lines.push(message); + } + + if (statusCode != null) { + lines.push(`Status code: ${statusCode.toString()}`); + } + + if (body != null) { + lines.push(`Body: ${toJson(body, undefined, 2)}`); + } + + return lines.join("\n"); +} diff --git a/src/errors/SquareTimeoutError.ts b/src/errors/SquareTimeoutError.ts new file mode 100644 index 000000000..fb095ec5d --- /dev/null +++ b/src/errors/SquareTimeoutError.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export class SquareTimeoutError extends Error { + constructor(message: string) { + super(message); + Object.setPrototypeOf(this, SquareTimeoutError.prototype); + } +} diff --git a/src/errors/apiError.ts b/src/errors/apiError.ts deleted file mode 100644 index 6ff91f653..000000000 --- a/src/errors/apiError.ts +++ /dev/null @@ -1,61 +0,0 @@ -import JSONBig from '@apimatic/json-bigint'; -import { ApiResponse, HttpContext, HttpRequest } from '../core'; -import { Error as SquareError } from '../models/error'; - -/** - * Thrown when the HTTP status code is not okay. - * - * The ApiError extends the ApiResponse interface, so all ApiResponse - * properties are available. - */ -export class ApiError extends Error - implements ApiResponse { - public request: HttpRequest; - public statusCode: number; - public headers: Record; - public result: T | undefined; - public body: string | Blob | NodeJS.ReadableStream; - public errors?: SquareError[]; - - constructor(context: HttpContext, message: string) { - super(message); - Object.setPrototypeOf(this, new.target.prototype); - - const { request, response } = context; - this.request = request; - this.statusCode = response.statusCode; - this.headers = response.headers; - this.body = response.body; - - if (typeof response.body === 'string' && response.body !== '') { - const JSON = JSONBig(); - try { - this.result = JSON.parse(response.body); - - if (typeof this.result === 'object') { - const result = this.result as Record; - if ('errors' in result) { - this.errors = result['errors'] as SquareError[]; - } else { - this.errors = [ - { - category: 'V1_ERROR', - code: (result['type'] as string) ?? 'Unknown', - detail: result['message'] as string, - field: result['field'] as string, - }, - ]; - } - } - } catch (error) { - if (process.env.NODE_ENV !== 'production') { - if (console) { - console.warn( - `Unexpected error: Could not parse HTTP response body as JSON. ${error}` - ); - } - } - } - } - } -} diff --git a/src/errors/index.ts b/src/errors/index.ts new file mode 100644 index 000000000..93f3e69f7 --- /dev/null +++ b/src/errors/index.ts @@ -0,0 +1,2 @@ +export { SquareError } from "./SquareError"; +export { SquareTimeoutError } from "./SquareTimeoutError"; diff --git a/src/index.ts b/src/index.ts index 2fdfba9eb..f5e34a15d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,1003 +1,5 @@ -export * from './client'; -export * from './configuration'; -export type { ApiResponse } from './core'; -export { - AbortError, - ArgumentsValidationError, - cloneFileWrapper, - FileWrapper, - isFileWrapper, - ResponseValidationError, -} from './core'; -export * from './defaultConfiguration'; -export * from './api/applePayApi'; -export * from './api/bankAccountsApi'; -export * from './api/bookingCustomAttributesApi'; -export * from './api/bookingsApi'; -export * from './api/cardsApi'; -export * from './api/cashDrawersApi'; -export * from './api/catalogApi'; -export * from './api/checkoutApi'; -export * from './api/customerCustomAttributesApi'; -export * from './api/customerGroupsApi'; -export * from './api/customersApi'; -export * from './api/customerSegmentsApi'; -export * from './api/devicesApi'; -export * from './api/disputesApi'; -export * from './api/employeesApi'; -export * from './api/eventsApi'; -export * from './api/giftCardActivitiesApi'; -export * from './api/giftCardsApi'; -export * from './api/inventoryApi'; -export * from './api/invoicesApi'; -export * from './api/laborApi'; -export * from './api/locationCustomAttributesApi'; -export * from './api/locationsApi'; -export * from './api/loyaltyApi'; -export * from './api/merchantCustomAttributesApi'; -export * from './api/merchantsApi'; -export * from './api/mobileAuthorizationApi'; -export * from './api/oAuthApi'; -export * from './api/orderCustomAttributesApi'; -export * from './api/ordersApi'; -export * from './api/paymentsApi'; -export * from './api/payoutsApi'; -export * from './api/refundsApi'; -export * from './api/sitesApi'; -export * from './api/snippetsApi'; -export * from './api/subscriptionsApi'; -export * from './api/teamApi'; -export * from './api/terminalApi'; -export * from './api/transactionsApi'; -export * from './api/v1TransactionsApi'; -export * from './api/vendorsApi'; -export * from './api/webhookSubscriptionsApi'; -export * from './errors/apiError'; -export type { AcceptDisputeResponse } from './models/acceptDisputeResponse'; -export type { AcceptedPaymentMethods } from './models/acceptedPaymentMethods'; -export type { AccumulateLoyaltyPointsRequest } from './models/accumulateLoyaltyPointsRequest'; -export type { AccumulateLoyaltyPointsResponse } from './models/accumulateLoyaltyPointsResponse'; -export type { ACHDetails } from './models/aCHDetails'; -export type { AddGroupToCustomerResponse } from './models/addGroupToCustomerResponse'; -export type { AdditionalRecipient } from './models/additionalRecipient'; -export type { Address } from './models/address'; -export type { AdjustLoyaltyPointsRequest } from './models/adjustLoyaltyPointsRequest'; -export type { AdjustLoyaltyPointsResponse } from './models/adjustLoyaltyPointsResponse'; -export type { AfterpayDetails } from './models/afterpayDetails'; -export type { ApplicationDetails } from './models/applicationDetails'; -export type { AppointmentSegment } from './models/appointmentSegment'; -export type { Availability } from './models/availability'; -export type { BankAccount } from './models/bankAccount'; -export type { BankAccountPaymentDetails } from './models/bankAccountPaymentDetails'; -export type { BatchChangeInventoryRequest } from './models/batchChangeInventoryRequest'; -export type { BatchChangeInventoryResponse } from './models/batchChangeInventoryResponse'; -export type { BatchDeleteCatalogObjectsRequest } from './models/batchDeleteCatalogObjectsRequest'; -export type { BatchDeleteCatalogObjectsResponse } from './models/batchDeleteCatalogObjectsResponse'; -export type { BatchRetrieveCatalogObjectsRequest } from './models/batchRetrieveCatalogObjectsRequest'; -export type { BatchRetrieveCatalogObjectsResponse } from './models/batchRetrieveCatalogObjectsResponse'; -export type { BatchRetrieveInventoryChangesRequest } from './models/batchRetrieveInventoryChangesRequest'; -export type { BatchRetrieveInventoryChangesResponse } from './models/batchRetrieveInventoryChangesResponse'; -export type { BatchRetrieveInventoryCountsRequest } from './models/batchRetrieveInventoryCountsRequest'; -export type { BatchRetrieveInventoryCountsResponse } from './models/batchRetrieveInventoryCountsResponse'; -export type { BatchRetrieveOrdersRequest } from './models/batchRetrieveOrdersRequest'; -export type { BatchRetrieveOrdersResponse } from './models/batchRetrieveOrdersResponse'; -export type { BatchUpsertCatalogObjectsRequest } from './models/batchUpsertCatalogObjectsRequest'; -export type { BatchUpsertCatalogObjectsResponse } from './models/batchUpsertCatalogObjectsResponse'; -export type { Booking } from './models/booking'; -export type { BookingCreatorDetails } from './models/bookingCreatorDetails'; -export type { BookingCustomAttributeDeleteRequest } from './models/bookingCustomAttributeDeleteRequest'; -export type { BookingCustomAttributeDeleteResponse } from './models/bookingCustomAttributeDeleteResponse'; -export type { BookingCustomAttributeUpsertRequest } from './models/bookingCustomAttributeUpsertRequest'; -export type { BookingCustomAttributeUpsertResponse } from './models/bookingCustomAttributeUpsertResponse'; -export type { Break } from './models/break'; -export type { BreakType } from './models/breakType'; -export type { BulkCreateCustomerData } from './models/bulkCreateCustomerData'; -export type { BulkCreateCustomersRequest } from './models/bulkCreateCustomersRequest'; -export type { BulkCreateCustomersResponse } from './models/bulkCreateCustomersResponse'; -export type { BulkCreateTeamMembersRequest } from './models/bulkCreateTeamMembersRequest'; -export type { BulkCreateTeamMembersResponse } from './models/bulkCreateTeamMembersResponse'; -export type { BulkCreateVendorsRequest } from './models/bulkCreateVendorsRequest'; -export type { BulkCreateVendorsResponse } from './models/bulkCreateVendorsResponse'; -export type { BulkDeleteBookingCustomAttributesRequest } from './models/bulkDeleteBookingCustomAttributesRequest'; -export type { BulkDeleteBookingCustomAttributesResponse } from './models/bulkDeleteBookingCustomAttributesResponse'; -export type { BulkDeleteCustomersRequest } from './models/bulkDeleteCustomersRequest'; -export type { BulkDeleteCustomersResponse } from './models/bulkDeleteCustomersResponse'; -export type { BulkDeleteLocationCustomAttributesRequest } from './models/bulkDeleteLocationCustomAttributesRequest'; -export type { BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest } from './models/bulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest'; -export type { BulkDeleteLocationCustomAttributesResponse } from './models/bulkDeleteLocationCustomAttributesResponse'; -export type { BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse } from './models/bulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse'; -export type { BulkDeleteMerchantCustomAttributesRequest } from './models/bulkDeleteMerchantCustomAttributesRequest'; -export type { BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest } from './models/bulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest'; -export type { BulkDeleteMerchantCustomAttributesResponse } from './models/bulkDeleteMerchantCustomAttributesResponse'; -export type { BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse } from './models/bulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse'; -export type { BulkDeleteOrderCustomAttributesRequest } from './models/bulkDeleteOrderCustomAttributesRequest'; -export type { BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute } from './models/bulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute'; -export type { BulkDeleteOrderCustomAttributesResponse } from './models/bulkDeleteOrderCustomAttributesResponse'; -export type { BulkRetrieveBookingsRequest } from './models/bulkRetrieveBookingsRequest'; -export type { BulkRetrieveBookingsResponse } from './models/bulkRetrieveBookingsResponse'; -export type { BulkRetrieveCustomersRequest } from './models/bulkRetrieveCustomersRequest'; -export type { BulkRetrieveCustomersResponse } from './models/bulkRetrieveCustomersResponse'; -export type { BulkRetrieveTeamMemberBookingProfilesRequest } from './models/bulkRetrieveTeamMemberBookingProfilesRequest'; -export type { BulkRetrieveTeamMemberBookingProfilesResponse } from './models/bulkRetrieveTeamMemberBookingProfilesResponse'; -export type { BulkRetrieveVendorsRequest } from './models/bulkRetrieveVendorsRequest'; -export type { BulkRetrieveVendorsResponse } from './models/bulkRetrieveVendorsResponse'; -export type { BulkSwapPlanRequest } from './models/bulkSwapPlanRequest'; -export type { BulkSwapPlanResponse } from './models/bulkSwapPlanResponse'; -export type { BulkUpdateCustomerData } from './models/bulkUpdateCustomerData'; -export type { BulkUpdateCustomersRequest } from './models/bulkUpdateCustomersRequest'; -export type { BulkUpdateCustomersResponse } from './models/bulkUpdateCustomersResponse'; -export type { BulkUpdateTeamMembersRequest } from './models/bulkUpdateTeamMembersRequest'; -export type { BulkUpdateTeamMembersResponse } from './models/bulkUpdateTeamMembersResponse'; -export type { BulkUpdateVendorsRequest } from './models/bulkUpdateVendorsRequest'; -export type { BulkUpdateVendorsResponse } from './models/bulkUpdateVendorsResponse'; -export type { BulkUpsertBookingCustomAttributesRequest } from './models/bulkUpsertBookingCustomAttributesRequest'; -export type { BulkUpsertBookingCustomAttributesResponse } from './models/bulkUpsertBookingCustomAttributesResponse'; -export type { BulkUpsertCustomerCustomAttributesRequest } from './models/bulkUpsertCustomerCustomAttributesRequest'; -export type { BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest } from './models/bulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest'; -export type { BulkUpsertCustomerCustomAttributesResponse } from './models/bulkUpsertCustomerCustomAttributesResponse'; -export type { BulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse } from './models/bulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse'; -export type { BulkUpsertLocationCustomAttributesRequest } from './models/bulkUpsertLocationCustomAttributesRequest'; -export type { BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest } from './models/bulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest'; -export type { BulkUpsertLocationCustomAttributesResponse } from './models/bulkUpsertLocationCustomAttributesResponse'; -export type { BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse } from './models/bulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse'; -export type { BulkUpsertMerchantCustomAttributesRequest } from './models/bulkUpsertMerchantCustomAttributesRequest'; -export type { BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest } from './models/bulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest'; -export type { BulkUpsertMerchantCustomAttributesResponse } from './models/bulkUpsertMerchantCustomAttributesResponse'; -export type { BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse } from './models/bulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse'; -export type { BulkUpsertOrderCustomAttributesRequest } from './models/bulkUpsertOrderCustomAttributesRequest'; -export type { BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute } from './models/bulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute'; -export type { BulkUpsertOrderCustomAttributesResponse } from './models/bulkUpsertOrderCustomAttributesResponse'; -export type { BusinessAppointmentSettings } from './models/businessAppointmentSettings'; -export type { BusinessBookingProfile } from './models/businessBookingProfile'; -export type { BusinessHours } from './models/businessHours'; -export type { BusinessHoursPeriod } from './models/businessHoursPeriod'; -export type { BuyNowPayLaterDetails } from './models/buyNowPayLaterDetails'; -export type { CalculateLoyaltyPointsRequest } from './models/calculateLoyaltyPointsRequest'; -export type { CalculateLoyaltyPointsResponse } from './models/calculateLoyaltyPointsResponse'; -export type { CalculateOrderRequest } from './models/calculateOrderRequest'; -export type { CalculateOrderResponse } from './models/calculateOrderResponse'; -export type { CancelBookingRequest } from './models/cancelBookingRequest'; -export type { CancelBookingResponse } from './models/cancelBookingResponse'; -export type { CancelInvoiceRequest } from './models/cancelInvoiceRequest'; -export type { CancelInvoiceResponse } from './models/cancelInvoiceResponse'; -export type { CancelLoyaltyPromotionResponse } from './models/cancelLoyaltyPromotionResponse'; -export type { CancelPaymentByIdempotencyKeyRequest } from './models/cancelPaymentByIdempotencyKeyRequest'; -export type { CancelPaymentByIdempotencyKeyResponse } from './models/cancelPaymentByIdempotencyKeyResponse'; -export type { CancelPaymentResponse } from './models/cancelPaymentResponse'; -export type { CancelSubscriptionResponse } from './models/cancelSubscriptionResponse'; -export type { CancelTerminalActionResponse } from './models/cancelTerminalActionResponse'; -export type { CancelTerminalCheckoutResponse } from './models/cancelTerminalCheckoutResponse'; -export type { CancelTerminalRefundResponse } from './models/cancelTerminalRefundResponse'; -export type { CaptureTransactionResponse } from './models/captureTransactionResponse'; -export type { Card } from './models/card'; -export type { CardPaymentDetails } from './models/cardPaymentDetails'; -export type { CardPaymentTimeline } from './models/cardPaymentTimeline'; -export type { CashAppDetails } from './models/cashAppDetails'; -export type { CashDrawerDevice } from './models/cashDrawerDevice'; -export type { CashDrawerShift } from './models/cashDrawerShift'; -export type { CashDrawerShiftEvent } from './models/cashDrawerShiftEvent'; -export type { CashDrawerShiftSummary } from './models/cashDrawerShiftSummary'; -export type { CashPaymentDetails } from './models/cashPaymentDetails'; -export type { CatalogAvailabilityPeriod } from './models/catalogAvailabilityPeriod'; -export type { CatalogCategory } from './models/catalogCategory'; -export type { CatalogCustomAttributeDefinition } from './models/catalogCustomAttributeDefinition'; -export type { CatalogCustomAttributeDefinitionNumberConfig } from './models/catalogCustomAttributeDefinitionNumberConfig'; -export type { CatalogCustomAttributeDefinitionSelectionConfig } from './models/catalogCustomAttributeDefinitionSelectionConfig'; -export type { CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection } from './models/catalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection'; -export type { CatalogCustomAttributeDefinitionStringConfig } from './models/catalogCustomAttributeDefinitionStringConfig'; -export type { CatalogCustomAttributeValue } from './models/catalogCustomAttributeValue'; -export type { CatalogDiscount } from './models/catalogDiscount'; -export type { CatalogEcomSeoData } from './models/catalogEcomSeoData'; -export type { CatalogIdMapping } from './models/catalogIdMapping'; -export type { CatalogImage } from './models/catalogImage'; -export type { CatalogInfoResponse } from './models/catalogInfoResponse'; -export type { CatalogInfoResponseLimits } from './models/catalogInfoResponseLimits'; -export type { CatalogItem } from './models/catalogItem'; -export type { CatalogItemFoodAndBeverageDetails } from './models/catalogItemFoodAndBeverageDetails'; -export type { CatalogItemFoodAndBeverageDetailsDietaryPreference } from './models/catalogItemFoodAndBeverageDetailsDietaryPreference'; -export type { CatalogItemFoodAndBeverageDetailsIngredient } from './models/catalogItemFoodAndBeverageDetailsIngredient'; -export type { CatalogItemModifierListInfo } from './models/catalogItemModifierListInfo'; -export type { CatalogItemOption } from './models/catalogItemOption'; -export type { CatalogItemOptionForItem } from './models/catalogItemOptionForItem'; -export type { CatalogItemOptionValue } from './models/catalogItemOptionValue'; -export type { CatalogItemOptionValueForItemVariation } from './models/catalogItemOptionValueForItemVariation'; -export type { CatalogItemVariation } from './models/catalogItemVariation'; -export type { CatalogMeasurementUnit } from './models/catalogMeasurementUnit'; -export type { CatalogModifier } from './models/catalogModifier'; -export type { CatalogModifierList } from './models/catalogModifierList'; -export type { CatalogModifierOverride } from './models/catalogModifierOverride'; -export type { CatalogObject } from './models/catalogObject'; -export type { CatalogObjectBatch } from './models/catalogObjectBatch'; -export type { CatalogObjectCategory } from './models/catalogObjectCategory'; -export type { CatalogObjectReference } from './models/catalogObjectReference'; -export type { CatalogPricingRule } from './models/catalogPricingRule'; -export type { CatalogProductSet } from './models/catalogProductSet'; -export type { CatalogQuery } from './models/catalogQuery'; -export type { CatalogQueryExact } from './models/catalogQueryExact'; -export type { CatalogQueryItemsForItemOptions } from './models/catalogQueryItemsForItemOptions'; -export type { CatalogQueryItemsForModifierList } from './models/catalogQueryItemsForModifierList'; -export type { CatalogQueryItemsForTax } from './models/catalogQueryItemsForTax'; -export type { CatalogQueryItemVariationsForItemOptionValues } from './models/catalogQueryItemVariationsForItemOptionValues'; -export type { CatalogQueryPrefix } from './models/catalogQueryPrefix'; -export type { CatalogQueryRange } from './models/catalogQueryRange'; -export type { CatalogQuerySet } from './models/catalogQuerySet'; -export type { CatalogQuerySortedAttribute } from './models/catalogQuerySortedAttribute'; -export type { CatalogQueryText } from './models/catalogQueryText'; -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'; -export type { CategoryPathToRootNode } from './models/categoryPathToRootNode'; -export type { ChangeBillingAnchorDateRequest } from './models/changeBillingAnchorDateRequest'; -export type { ChangeBillingAnchorDateResponse } from './models/changeBillingAnchorDateResponse'; -export type { ChargeRequest } from './models/chargeRequest'; -export type { ChargeRequestAdditionalRecipient } from './models/chargeRequestAdditionalRecipient'; -export type { ChargeResponse } from './models/chargeResponse'; -export type { Checkout } from './models/checkout'; -export type { CheckoutLocationSettings } from './models/checkoutLocationSettings'; -export type { CheckoutLocationSettingsBranding } from './models/checkoutLocationSettingsBranding'; -export type { CheckoutLocationSettingsCoupons } from './models/checkoutLocationSettingsCoupons'; -export type { CheckoutLocationSettingsPolicy } from './models/checkoutLocationSettingsPolicy'; -export type { CheckoutLocationSettingsTipping } from './models/checkoutLocationSettingsTipping'; -export type { CheckoutMerchantSettings } from './models/checkoutMerchantSettings'; -export type { CheckoutMerchantSettingsPaymentMethods } from './models/checkoutMerchantSettingsPaymentMethods'; -export type { CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay } from './models/checkoutMerchantSettingsPaymentMethodsAfterpayClearpay'; -export type { CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange } from './models/checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange'; -export type { CheckoutMerchantSettingsPaymentMethodsPaymentMethod } from './models/checkoutMerchantSettingsPaymentMethodsPaymentMethod'; -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 { Component } from './models/component'; -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'; -export type { CreateBookingRequest } from './models/createBookingRequest'; -export type { CreateBookingResponse } from './models/createBookingResponse'; -export type { CreateBreakTypeRequest } from './models/createBreakTypeRequest'; -export type { CreateBreakTypeResponse } from './models/createBreakTypeResponse'; -export type { CreateCardRequest } from './models/createCardRequest'; -export type { CreateCardResponse } from './models/createCardResponse'; -export type { CreateCatalogImageRequest } from './models/createCatalogImageRequest'; -export type { CreateCatalogImageResponse } from './models/createCatalogImageResponse'; -export type { CreateCheckoutRequest } from './models/createCheckoutRequest'; -export type { CreateCheckoutResponse } from './models/createCheckoutResponse'; -export type { CreateCustomerCardRequest } from './models/createCustomerCardRequest'; -export type { CreateCustomerCardResponse } from './models/createCustomerCardResponse'; -export type { CreateCustomerCustomAttributeDefinitionRequest } from './models/createCustomerCustomAttributeDefinitionRequest'; -export type { CreateCustomerCustomAttributeDefinitionResponse } from './models/createCustomerCustomAttributeDefinitionResponse'; -export type { CreateCustomerGroupRequest } from './models/createCustomerGroupRequest'; -export type { CreateCustomerGroupResponse } from './models/createCustomerGroupResponse'; -export type { CreateCustomerRequest } from './models/createCustomerRequest'; -export type { CreateCustomerResponse } from './models/createCustomerResponse'; -export type { CreateDeviceCodeRequest } from './models/createDeviceCodeRequest'; -export type { CreateDeviceCodeResponse } from './models/createDeviceCodeResponse'; -export type { CreateDisputeEvidenceFileRequest } from './models/createDisputeEvidenceFileRequest'; -export type { CreateDisputeEvidenceFileResponse } from './models/createDisputeEvidenceFileResponse'; -export type { CreateDisputeEvidenceTextRequest } from './models/createDisputeEvidenceTextRequest'; -export type { CreateDisputeEvidenceTextResponse } from './models/createDisputeEvidenceTextResponse'; -export type { CreateGiftCardActivityRequest } from './models/createGiftCardActivityRequest'; -export type { CreateGiftCardActivityResponse } from './models/createGiftCardActivityResponse'; -export type { CreateGiftCardRequest } from './models/createGiftCardRequest'; -export type { CreateGiftCardResponse } from './models/createGiftCardResponse'; -export type { CreateInvoiceAttachmentRequest } from './models/createInvoiceAttachmentRequest'; -export type { CreateInvoiceAttachmentResponse } from './models/createInvoiceAttachmentResponse'; -export type { CreateInvoiceRequest } from './models/createInvoiceRequest'; -export type { CreateInvoiceResponse } from './models/createInvoiceResponse'; -export type { CreateJobRequest } from './models/createJobRequest'; -export type { CreateJobResponse } from './models/createJobResponse'; -export type { CreateLocationCustomAttributeDefinitionRequest } from './models/createLocationCustomAttributeDefinitionRequest'; -export type { CreateLocationCustomAttributeDefinitionResponse } from './models/createLocationCustomAttributeDefinitionResponse'; -export type { CreateLocationRequest } from './models/createLocationRequest'; -export type { CreateLocationResponse } from './models/createLocationResponse'; -export type { CreateLoyaltyAccountRequest } from './models/createLoyaltyAccountRequest'; -export type { CreateLoyaltyAccountResponse } from './models/createLoyaltyAccountResponse'; -export type { CreateLoyaltyPromotionRequest } from './models/createLoyaltyPromotionRequest'; -export type { CreateLoyaltyPromotionResponse } from './models/createLoyaltyPromotionResponse'; -export type { CreateLoyaltyRewardRequest } from './models/createLoyaltyRewardRequest'; -export type { CreateLoyaltyRewardResponse } from './models/createLoyaltyRewardResponse'; -export type { CreateMerchantCustomAttributeDefinitionRequest } from './models/createMerchantCustomAttributeDefinitionRequest'; -export type { CreateMerchantCustomAttributeDefinitionResponse } from './models/createMerchantCustomAttributeDefinitionResponse'; -export type { CreateMobileAuthorizationCodeRequest } from './models/createMobileAuthorizationCodeRequest'; -export type { CreateMobileAuthorizationCodeResponse } from './models/createMobileAuthorizationCodeResponse'; -export type { CreateOrderCustomAttributeDefinitionRequest } from './models/createOrderCustomAttributeDefinitionRequest'; -export type { CreateOrderCustomAttributeDefinitionResponse } from './models/createOrderCustomAttributeDefinitionResponse'; -export type { CreateOrderRequest } from './models/createOrderRequest'; -export type { CreateOrderResponse } from './models/createOrderResponse'; -export type { CreatePaymentLinkRequest } from './models/createPaymentLinkRequest'; -export type { CreatePaymentLinkResponse } from './models/createPaymentLinkResponse'; -export type { CreatePaymentRequest } from './models/createPaymentRequest'; -export type { CreatePaymentResponse } from './models/createPaymentResponse'; -export type { CreateRefundRequest } from './models/createRefundRequest'; -export type { CreateRefundResponse } from './models/createRefundResponse'; -export type { CreateShiftRequest } from './models/createShiftRequest'; -export type { CreateShiftResponse } from './models/createShiftResponse'; -export type { CreateSubscriptionRequest } from './models/createSubscriptionRequest'; -export type { CreateSubscriptionResponse } from './models/createSubscriptionResponse'; -export type { CreateTeamMemberRequest } from './models/createTeamMemberRequest'; -export type { CreateTeamMemberResponse } from './models/createTeamMemberResponse'; -export type { CreateTerminalActionRequest } from './models/createTerminalActionRequest'; -export type { CreateTerminalActionResponse } from './models/createTerminalActionResponse'; -export type { CreateTerminalCheckoutRequest } from './models/createTerminalCheckoutRequest'; -export type { CreateTerminalCheckoutResponse } from './models/createTerminalCheckoutResponse'; -export type { CreateTerminalRefundRequest } from './models/createTerminalRefundRequest'; -export type { CreateTerminalRefundResponse } from './models/createTerminalRefundResponse'; -export type { CreateVendorRequest } from './models/createVendorRequest'; -export type { CreateVendorResponse } from './models/createVendorResponse'; -export type { CreateWebhookSubscriptionRequest } from './models/createWebhookSubscriptionRequest'; -export type { CreateWebhookSubscriptionResponse } from './models/createWebhookSubscriptionResponse'; -export type { CustomAttribute } from './models/customAttribute'; -export type { CustomAttributeDefinition } from './models/customAttributeDefinition'; -export type { CustomAttributeFilter } from './models/customAttributeFilter'; -export type { Customer } from './models/customer'; -export type { CustomerAddressFilter } from './models/customerAddressFilter'; -export type { CustomerCreationSourceFilter } from './models/customerCreationSourceFilter'; -export type { CustomerCustomAttributeFilter } from './models/customerCustomAttributeFilter'; -export type { CustomerCustomAttributeFilters } from './models/customerCustomAttributeFilters'; -export type { CustomerCustomAttributeFilterValue } from './models/customerCustomAttributeFilterValue'; -export type { CustomerDetails } from './models/customerDetails'; -export type { CustomerFilter } from './models/customerFilter'; -export type { CustomerGroup } from './models/customerGroup'; -export type { CustomerPreferences } from './models/customerPreferences'; -export type { CustomerQuery } from './models/customerQuery'; -export type { CustomerSegment } from './models/customerSegment'; -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'; -export type { DeleteBreakTypeResponse } from './models/deleteBreakTypeResponse'; -export type { DeleteCatalogObjectResponse } from './models/deleteCatalogObjectResponse'; -export type { DeleteCustomerCardResponse } from './models/deleteCustomerCardResponse'; -export type { DeleteCustomerCustomAttributeDefinitionResponse } from './models/deleteCustomerCustomAttributeDefinitionResponse'; -export type { DeleteCustomerCustomAttributeResponse } from './models/deleteCustomerCustomAttributeResponse'; -export type { DeleteCustomerGroupResponse } from './models/deleteCustomerGroupResponse'; -export type { DeleteCustomerRequest } from './models/deleteCustomerRequest'; -export type { DeleteCustomerResponse } from './models/deleteCustomerResponse'; -export type { DeleteDisputeEvidenceResponse } from './models/deleteDisputeEvidenceResponse'; -export type { DeleteInvoiceAttachmentResponse } from './models/deleteInvoiceAttachmentResponse'; -export type { DeleteInvoiceRequest } from './models/deleteInvoiceRequest'; -export type { DeleteInvoiceResponse } from './models/deleteInvoiceResponse'; -export type { DeleteLocationCustomAttributeDefinitionResponse } from './models/deleteLocationCustomAttributeDefinitionResponse'; -export type { DeleteLocationCustomAttributeResponse } from './models/deleteLocationCustomAttributeResponse'; -export type { DeleteLoyaltyRewardResponse } from './models/deleteLoyaltyRewardResponse'; -export type { DeleteMerchantCustomAttributeDefinitionResponse } from './models/deleteMerchantCustomAttributeDefinitionResponse'; -export type { DeleteMerchantCustomAttributeResponse } from './models/deleteMerchantCustomAttributeResponse'; -export type { DeleteOrderCustomAttributeDefinitionResponse } from './models/deleteOrderCustomAttributeDefinitionResponse'; -export type { DeleteOrderCustomAttributeResponse } from './models/deleteOrderCustomAttributeResponse'; -export type { DeletePaymentLinkResponse } from './models/deletePaymentLinkResponse'; -export type { DeleteShiftResponse } from './models/deleteShiftResponse'; -export type { DeleteSnippetResponse } from './models/deleteSnippetResponse'; -export type { DeleteSubscriptionActionResponse } from './models/deleteSubscriptionActionResponse'; -export type { DeleteWebhookSubscriptionResponse } from './models/deleteWebhookSubscriptionResponse'; -export type { DeprecatedCreateDisputeEvidenceFileRequest } from './models/deprecatedCreateDisputeEvidenceFileRequest'; -export type { DeprecatedCreateDisputeEvidenceFileResponse } from './models/deprecatedCreateDisputeEvidenceFileResponse'; -export type { DeprecatedCreateDisputeEvidenceTextRequest } from './models/deprecatedCreateDisputeEvidenceTextRequest'; -export type { DeprecatedCreateDisputeEvidenceTextResponse } from './models/deprecatedCreateDisputeEvidenceTextResponse'; -export type { Destination } from './models/destination'; -export type { DestinationDetails } from './models/destinationDetails'; -export type { DestinationDetailsCardRefundDetails } from './models/destinationDetailsCardRefundDetails'; -export type { DestinationDetailsCashRefundDetails } from './models/destinationDetailsCashRefundDetails'; -export type { DestinationDetailsExternalRefundDetails } from './models/destinationDetailsExternalRefundDetails'; -export type { Device } from './models/device'; -export type { DeviceAttributes } from './models/deviceAttributes'; -export type { DeviceCheckoutOptions } from './models/deviceCheckoutOptions'; -export type { DeviceCode } from './models/deviceCode'; -export type { DeviceComponentDetailsApplicationDetails } from './models/deviceComponentDetailsApplicationDetails'; -export type { DeviceComponentDetailsBatteryDetails } from './models/deviceComponentDetailsBatteryDetails'; -export type { DeviceComponentDetailsCardReaderDetails } from './models/deviceComponentDetailsCardReaderDetails'; -export type { DeviceComponentDetailsEthernetDetails } from './models/deviceComponentDetailsEthernetDetails'; -export type { DeviceComponentDetailsMeasurement } from './models/deviceComponentDetailsMeasurement'; -export type { DeviceComponentDetailsNetworkInterfaceDetails } from './models/deviceComponentDetailsNetworkInterfaceDetails'; -export type { DeviceComponentDetailsWiFiDetails } from './models/deviceComponentDetailsWiFiDetails'; -export type { DeviceDetails } from './models/deviceDetails'; -export type { DeviceMetadata } from './models/deviceMetadata'; -export type { DeviceStatus } from './models/deviceStatus'; -export type { DigitalWalletDetails } from './models/digitalWalletDetails'; -export type { DisableCardResponse } from './models/disableCardResponse'; -export type { DisableEventsResponse } from './models/disableEventsResponse'; -export type { DismissTerminalActionResponse } from './models/dismissTerminalActionResponse'; -export type { DismissTerminalCheckoutResponse } from './models/dismissTerminalCheckoutResponse'; -export type { DismissTerminalRefundResponse } from './models/dismissTerminalRefundResponse'; -export type { Dispute } from './models/dispute'; -export type { DisputedPayment } from './models/disputedPayment'; -export type { DisputeEvidence } from './models/disputeEvidence'; -export type { DisputeEvidenceFile } from './models/disputeEvidenceFile'; -export type { Employee } from './models/employee'; -export type { EmployeeWage } from './models/employeeWage'; -export type { EnableEventsResponse } from './models/enableEventsResponse'; -export type { Error } from './models/error'; -export type { Event } from './models/event'; -export type { EventData } from './models/eventData'; -export type { EventMetadata } from './models/eventMetadata'; -export type { EventTypeMetadata } from './models/eventTypeMetadata'; -export type { ExternalPaymentDetails } from './models/externalPaymentDetails'; -export type { FilterValue } from './models/filterValue'; -export type { FloatNumberRange } from './models/floatNumberRange'; -export type { Fulfillment } from './models/fulfillment'; -export type { FulfillmentDeliveryDetails } from './models/fulfillmentDeliveryDetails'; -export type { FulfillmentFulfillmentEntry } from './models/fulfillmentFulfillmentEntry'; -export type { FulfillmentPickupDetails } from './models/fulfillmentPickupDetails'; -export type { FulfillmentPickupDetailsCurbsidePickupDetails } from './models/fulfillmentPickupDetailsCurbsidePickupDetails'; -export type { FulfillmentRecipient } from './models/fulfillmentRecipient'; -export type { FulfillmentShipmentDetails } from './models/fulfillmentShipmentDetails'; -export type { GetBankAccountByV1IdResponse } from './models/getBankAccountByV1IdResponse'; -export type { GetBankAccountResponse } from './models/getBankAccountResponse'; -export type { GetBreakTypeResponse } from './models/getBreakTypeResponse'; -export type { GetDeviceCodeResponse } from './models/getDeviceCodeResponse'; -export type { GetDeviceResponse } from './models/getDeviceResponse'; -export type { GetEmployeeWageResponse } from './models/getEmployeeWageResponse'; -export type { GetInvoiceResponse } from './models/getInvoiceResponse'; -export type { GetPaymentRefundResponse } from './models/getPaymentRefundResponse'; -export type { GetPaymentResponse } from './models/getPaymentResponse'; -export type { GetPayoutResponse } from './models/getPayoutResponse'; -export type { GetShiftResponse } from './models/getShiftResponse'; -export type { GetTeamMemberWageResponse } from './models/getTeamMemberWageResponse'; -export type { GetTerminalActionResponse } from './models/getTerminalActionResponse'; -export type { GetTerminalCheckoutResponse } from './models/getTerminalCheckoutResponse'; -export type { GetTerminalRefundResponse } from './models/getTerminalRefundResponse'; -export type { GiftCard } from './models/giftCard'; -export type { GiftCardActivity } from './models/giftCardActivity'; -export type { GiftCardActivityActivate } from './models/giftCardActivityActivate'; -export type { GiftCardActivityAdjustDecrement } from './models/giftCardActivityAdjustDecrement'; -export type { GiftCardActivityAdjustIncrement } from './models/giftCardActivityAdjustIncrement'; -export type { GiftCardActivityBlock } from './models/giftCardActivityBlock'; -export type { GiftCardActivityClearBalance } from './models/giftCardActivityClearBalance'; -export type { GiftCardActivityDeactivate } from './models/giftCardActivityDeactivate'; -export type { GiftCardActivityImport } from './models/giftCardActivityImport'; -export type { GiftCardActivityImportReversal } from './models/giftCardActivityImportReversal'; -export type { GiftCardActivityLoad } from './models/giftCardActivityLoad'; -export type { GiftCardActivityRedeem } from './models/giftCardActivityRedeem'; -export type { GiftCardActivityRefund } from './models/giftCardActivityRefund'; -export type { GiftCardActivityTransferBalanceFrom } from './models/giftCardActivityTransferBalanceFrom'; -export type { GiftCardActivityTransferBalanceTo } from './models/giftCardActivityTransferBalanceTo'; -export type { GiftCardActivityUnblock } from './models/giftCardActivityUnblock'; -export type { GiftCardActivityUnlinkedActivityRefund } from './models/giftCardActivityUnlinkedActivityRefund'; -export type { InventoryAdjustment } from './models/inventoryAdjustment'; -export type { InventoryAdjustmentGroup } from './models/inventoryAdjustmentGroup'; -export type { InventoryChange } from './models/inventoryChange'; -export type { InventoryCount } from './models/inventoryCount'; -export type { InventoryPhysicalCount } from './models/inventoryPhysicalCount'; -export type { InventoryTransfer } from './models/inventoryTransfer'; -export type { Invoice } from './models/invoice'; -export type { InvoiceAcceptedPaymentMethods } from './models/invoiceAcceptedPaymentMethods'; -export type { InvoiceAttachment } from './models/invoiceAttachment'; -export type { InvoiceCustomField } from './models/invoiceCustomField'; -export type { InvoiceFilter } from './models/invoiceFilter'; -export type { InvoicePaymentReminder } from './models/invoicePaymentReminder'; -export type { InvoicePaymentRequest } from './models/invoicePaymentRequest'; -export type { InvoiceQuery } from './models/invoiceQuery'; -export type { InvoiceRecipient } from './models/invoiceRecipient'; -export type { InvoiceRecipientTaxIds } from './models/invoiceRecipientTaxIds'; -export type { InvoiceSort } from './models/invoiceSort'; -export type { ItemVariationLocationOverrides } from './models/itemVariationLocationOverrides'; -export type { Job } from './models/job'; -export type { JobAssignment } from './models/jobAssignment'; -export type { LinkCustomerToGiftCardRequest } from './models/linkCustomerToGiftCardRequest'; -export type { LinkCustomerToGiftCardResponse } from './models/linkCustomerToGiftCardResponse'; -export type { ListBankAccountsRequest } from './models/listBankAccountsRequest'; -export type { ListBankAccountsResponse } from './models/listBankAccountsResponse'; -export type { ListBookingCustomAttributeDefinitionsRequest } from './models/listBookingCustomAttributeDefinitionsRequest'; -export type { ListBookingCustomAttributeDefinitionsResponse } from './models/listBookingCustomAttributeDefinitionsResponse'; -export type { ListBookingCustomAttributesRequest } from './models/listBookingCustomAttributesRequest'; -export type { ListBookingCustomAttributesResponse } from './models/listBookingCustomAttributesResponse'; -export type { ListBookingsRequest } from './models/listBookingsRequest'; -export type { ListBookingsResponse } from './models/listBookingsResponse'; -export type { ListBreakTypesRequest } from './models/listBreakTypesRequest'; -export type { ListBreakTypesResponse } from './models/listBreakTypesResponse'; -export type { ListCardsRequest } from './models/listCardsRequest'; -export type { ListCardsResponse } from './models/listCardsResponse'; -export type { ListCashDrawerShiftEventsRequest } from './models/listCashDrawerShiftEventsRequest'; -export type { ListCashDrawerShiftEventsResponse } from './models/listCashDrawerShiftEventsResponse'; -export type { ListCashDrawerShiftsRequest } from './models/listCashDrawerShiftsRequest'; -export type { ListCashDrawerShiftsResponse } from './models/listCashDrawerShiftsResponse'; -export type { ListCatalogRequest } from './models/listCatalogRequest'; -export type { ListCatalogResponse } from './models/listCatalogResponse'; -export type { ListCustomerCustomAttributeDefinitionsRequest } from './models/listCustomerCustomAttributeDefinitionsRequest'; -export type { ListCustomerCustomAttributeDefinitionsResponse } from './models/listCustomerCustomAttributeDefinitionsResponse'; -export type { ListCustomerCustomAttributesRequest } from './models/listCustomerCustomAttributesRequest'; -export type { ListCustomerCustomAttributesResponse } from './models/listCustomerCustomAttributesResponse'; -export type { ListCustomerGroupsRequest } from './models/listCustomerGroupsRequest'; -export type { ListCustomerGroupsResponse } from './models/listCustomerGroupsResponse'; -export type { ListCustomerSegmentsRequest } from './models/listCustomerSegmentsRequest'; -export type { ListCustomerSegmentsResponse } from './models/listCustomerSegmentsResponse'; -export type { ListCustomersRequest } from './models/listCustomersRequest'; -export type { ListCustomersResponse } from './models/listCustomersResponse'; -export type { ListDeviceCodesRequest } from './models/listDeviceCodesRequest'; -export type { ListDeviceCodesResponse } from './models/listDeviceCodesResponse'; -export type { ListDevicesRequest } from './models/listDevicesRequest'; -export type { ListDevicesResponse } from './models/listDevicesResponse'; -export type { ListDisputeEvidenceRequest } from './models/listDisputeEvidenceRequest'; -export type { ListDisputeEvidenceResponse } from './models/listDisputeEvidenceResponse'; -export type { ListDisputesRequest } from './models/listDisputesRequest'; -export type { ListDisputesResponse } from './models/listDisputesResponse'; -export type { ListEmployeesRequest } from './models/listEmployeesRequest'; -export type { ListEmployeesResponse } from './models/listEmployeesResponse'; -export type { ListEmployeeWagesRequest } from './models/listEmployeeWagesRequest'; -export type { ListEmployeeWagesResponse } from './models/listEmployeeWagesResponse'; -export type { ListEventTypesRequest } from './models/listEventTypesRequest'; -export type { ListEventTypesResponse } from './models/listEventTypesResponse'; -export type { ListGiftCardActivitiesRequest } from './models/listGiftCardActivitiesRequest'; -export type { ListGiftCardActivitiesResponse } from './models/listGiftCardActivitiesResponse'; -export type { ListGiftCardsRequest } from './models/listGiftCardsRequest'; -export type { ListGiftCardsResponse } from './models/listGiftCardsResponse'; -export type { ListInvoicesRequest } from './models/listInvoicesRequest'; -export type { ListInvoicesResponse } from './models/listInvoicesResponse'; -export type { ListJobsRequest } from './models/listJobsRequest'; -export type { ListJobsResponse } from './models/listJobsResponse'; -export type { ListLocationBookingProfilesRequest } from './models/listLocationBookingProfilesRequest'; -export type { ListLocationBookingProfilesResponse } from './models/listLocationBookingProfilesResponse'; -export type { ListLocationCustomAttributeDefinitionsRequest } from './models/listLocationCustomAttributeDefinitionsRequest'; -export type { ListLocationCustomAttributeDefinitionsResponse } from './models/listLocationCustomAttributeDefinitionsResponse'; -export type { ListLocationCustomAttributesRequest } from './models/listLocationCustomAttributesRequest'; -export type { ListLocationCustomAttributesResponse } from './models/listLocationCustomAttributesResponse'; -export type { ListLocationsResponse } from './models/listLocationsResponse'; -export type { ListLoyaltyProgramsResponse } from './models/listLoyaltyProgramsResponse'; -export type { ListLoyaltyPromotionsRequest } from './models/listLoyaltyPromotionsRequest'; -export type { ListLoyaltyPromotionsResponse } from './models/listLoyaltyPromotionsResponse'; -export type { ListMerchantCustomAttributeDefinitionsRequest } from './models/listMerchantCustomAttributeDefinitionsRequest'; -export type { ListMerchantCustomAttributeDefinitionsResponse } from './models/listMerchantCustomAttributeDefinitionsResponse'; -export type { ListMerchantCustomAttributesRequest } from './models/listMerchantCustomAttributesRequest'; -export type { ListMerchantCustomAttributesResponse } from './models/listMerchantCustomAttributesResponse'; -export type { ListMerchantsRequest } from './models/listMerchantsRequest'; -export type { ListMerchantsResponse } from './models/listMerchantsResponse'; -export type { ListOrderCustomAttributeDefinitionsRequest } from './models/listOrderCustomAttributeDefinitionsRequest'; -export type { ListOrderCustomAttributeDefinitionsResponse } from './models/listOrderCustomAttributeDefinitionsResponse'; -export type { ListOrderCustomAttributesRequest } from './models/listOrderCustomAttributesRequest'; -export type { ListOrderCustomAttributesResponse } from './models/listOrderCustomAttributesResponse'; -export type { ListPaymentLinksRequest } from './models/listPaymentLinksRequest'; -export type { ListPaymentLinksResponse } from './models/listPaymentLinksResponse'; -export type { ListPaymentRefundsRequest } from './models/listPaymentRefundsRequest'; -export type { ListPaymentRefundsResponse } from './models/listPaymentRefundsResponse'; -export type { ListPaymentsRequest } from './models/listPaymentsRequest'; -export type { ListPaymentsResponse } from './models/listPaymentsResponse'; -export type { ListPayoutEntriesRequest } from './models/listPayoutEntriesRequest'; -export type { ListPayoutEntriesResponse } from './models/listPayoutEntriesResponse'; -export type { ListPayoutsRequest } from './models/listPayoutsRequest'; -export type { ListPayoutsResponse } from './models/listPayoutsResponse'; -export type { ListRefundsRequest } from './models/listRefundsRequest'; -export type { ListRefundsResponse } from './models/listRefundsResponse'; -export type { ListSitesResponse } from './models/listSitesResponse'; -export type { ListSubscriptionEventsRequest } from './models/listSubscriptionEventsRequest'; -export type { ListSubscriptionEventsResponse } from './models/listSubscriptionEventsResponse'; -export type { ListTeamMemberBookingProfilesRequest } from './models/listTeamMemberBookingProfilesRequest'; -export type { ListTeamMemberBookingProfilesResponse } from './models/listTeamMemberBookingProfilesResponse'; -export type { ListTeamMemberWagesRequest } from './models/listTeamMemberWagesRequest'; -export type { ListTeamMemberWagesResponse } from './models/listTeamMemberWagesResponse'; -export type { ListTransactionsRequest } from './models/listTransactionsRequest'; -export type { ListTransactionsResponse } from './models/listTransactionsResponse'; -export type { ListWebhookEventTypesRequest } from './models/listWebhookEventTypesRequest'; -export type { ListWebhookEventTypesResponse } from './models/listWebhookEventTypesResponse'; -export type { ListWebhookSubscriptionsRequest } from './models/listWebhookSubscriptionsRequest'; -export type { ListWebhookSubscriptionsResponse } from './models/listWebhookSubscriptionsResponse'; -export type { ListWorkweekConfigsRequest } from './models/listWorkweekConfigsRequest'; -export type { ListWorkweekConfigsResponse } from './models/listWorkweekConfigsResponse'; -export type { Location } from './models/location'; -export type { LocationBookingProfile } from './models/locationBookingProfile'; -export type { LoyaltyAccount } from './models/loyaltyAccount'; -export type { LoyaltyAccountExpiringPointDeadline } from './models/loyaltyAccountExpiringPointDeadline'; -export type { LoyaltyAccountMapping } from './models/loyaltyAccountMapping'; -export type { LoyaltyEvent } from './models/loyaltyEvent'; -export type { LoyaltyEventAccumulatePoints } from './models/loyaltyEventAccumulatePoints'; -export type { LoyaltyEventAccumulatePromotionPoints } from './models/loyaltyEventAccumulatePromotionPoints'; -export type { LoyaltyEventAdjustPoints } from './models/loyaltyEventAdjustPoints'; -export type { LoyaltyEventCreateReward } from './models/loyaltyEventCreateReward'; -export type { LoyaltyEventDateTimeFilter } from './models/loyaltyEventDateTimeFilter'; -export type { LoyaltyEventDeleteReward } from './models/loyaltyEventDeleteReward'; -export type { LoyaltyEventExpirePoints } from './models/loyaltyEventExpirePoints'; -export type { LoyaltyEventFilter } from './models/loyaltyEventFilter'; -export type { LoyaltyEventLocationFilter } from './models/loyaltyEventLocationFilter'; -export type { LoyaltyEventLoyaltyAccountFilter } from './models/loyaltyEventLoyaltyAccountFilter'; -export type { LoyaltyEventOrderFilter } from './models/loyaltyEventOrderFilter'; -export type { LoyaltyEventOther } from './models/loyaltyEventOther'; -export type { LoyaltyEventQuery } from './models/loyaltyEventQuery'; -export type { LoyaltyEventRedeemReward } from './models/loyaltyEventRedeemReward'; -export type { LoyaltyEventTypeFilter } from './models/loyaltyEventTypeFilter'; -export type { LoyaltyProgram } from './models/loyaltyProgram'; -export type { LoyaltyProgramAccrualRule } from './models/loyaltyProgramAccrualRule'; -export type { LoyaltyProgramAccrualRuleCategoryData } from './models/loyaltyProgramAccrualRuleCategoryData'; -export type { LoyaltyProgramAccrualRuleItemVariationData } from './models/loyaltyProgramAccrualRuleItemVariationData'; -export type { LoyaltyProgramAccrualRuleSpendData } from './models/loyaltyProgramAccrualRuleSpendData'; -export type { LoyaltyProgramAccrualRuleVisitData } from './models/loyaltyProgramAccrualRuleVisitData'; -export type { LoyaltyProgramExpirationPolicy } from './models/loyaltyProgramExpirationPolicy'; -export type { LoyaltyProgramRewardDefinition } from './models/loyaltyProgramRewardDefinition'; -export type { LoyaltyProgramRewardTier } from './models/loyaltyProgramRewardTier'; -export type { LoyaltyProgramTerminology } from './models/loyaltyProgramTerminology'; -export type { LoyaltyPromotion } from './models/loyaltyPromotion'; -export type { LoyaltyPromotionAvailableTimeData } from './models/loyaltyPromotionAvailableTimeData'; -export type { LoyaltyPromotionIncentive } from './models/loyaltyPromotionIncentive'; -export type { LoyaltyPromotionIncentivePointsAdditionData } from './models/loyaltyPromotionIncentivePointsAdditionData'; -export type { LoyaltyPromotionIncentivePointsMultiplierData } from './models/loyaltyPromotionIncentivePointsMultiplierData'; -export type { LoyaltyPromotionTriggerLimit } from './models/loyaltyPromotionTriggerLimit'; -export type { LoyaltyReward } from './models/loyaltyReward'; -export type { MeasurementUnit } from './models/measurementUnit'; -export type { MeasurementUnitCustom } from './models/measurementUnitCustom'; -export type { Merchant } from './models/merchant'; -export type { ModifierLocationOverrides } from './models/modifierLocationOverrides'; -export type { Money } from './models/money'; -export type { ObtainTokenRequest } from './models/obtainTokenRequest'; -export type { ObtainTokenResponse } from './models/obtainTokenResponse'; -export type { OfflinePaymentDetails } from './models/offlinePaymentDetails'; -export type { Order } from './models/order'; -export type { OrderCreated } from './models/orderCreated'; -export type { OrderCreatedObject } from './models/orderCreatedObject'; -export type { OrderEntry } from './models/orderEntry'; -export type { OrderFulfillment } from './models/orderFulfillment'; -export type { OrderFulfillmentDeliveryDetails } from './models/orderFulfillmentDeliveryDetails'; -export type { OrderFulfillmentFulfillmentEntry } from './models/orderFulfillmentFulfillmentEntry'; -export type { OrderFulfillmentPickupDetails } from './models/orderFulfillmentPickupDetails'; -export type { OrderFulfillmentPickupDetailsCurbsidePickupDetails } from './models/orderFulfillmentPickupDetailsCurbsidePickupDetails'; -export type { OrderFulfillmentRecipient } from './models/orderFulfillmentRecipient'; -export type { OrderFulfillmentShipmentDetails } from './models/orderFulfillmentShipmentDetails'; -export type { OrderFulfillmentUpdated } from './models/orderFulfillmentUpdated'; -export type { OrderFulfillmentUpdatedObject } from './models/orderFulfillmentUpdatedObject'; -export type { OrderFulfillmentUpdatedUpdate } from './models/orderFulfillmentUpdatedUpdate'; -export type { OrderLineItem } from './models/orderLineItem'; -export type { OrderLineItemAppliedDiscount } from './models/orderLineItemAppliedDiscount'; -export type { OrderLineItemAppliedServiceCharge } from './models/orderLineItemAppliedServiceCharge'; -export type { OrderLineItemAppliedTax } from './models/orderLineItemAppliedTax'; -export type { OrderLineItemDiscount } from './models/orderLineItemDiscount'; -export type { OrderLineItemModifier } from './models/orderLineItemModifier'; -export type { OrderLineItemPricingBlocklists } from './models/orderLineItemPricingBlocklists'; -export type { OrderLineItemPricingBlocklistsBlockedDiscount } from './models/orderLineItemPricingBlocklistsBlockedDiscount'; -export type { OrderLineItemPricingBlocklistsBlockedTax } from './models/orderLineItemPricingBlocklistsBlockedTax'; -export type { OrderLineItemTax } from './models/orderLineItemTax'; -export type { OrderMoneyAmounts } from './models/orderMoneyAmounts'; -export type { OrderPricingOptions } from './models/orderPricingOptions'; -export type { OrderQuantityUnit } from './models/orderQuantityUnit'; -export type { OrderReturn } from './models/orderReturn'; -export type { OrderReturnDiscount } from './models/orderReturnDiscount'; -export type { OrderReturnLineItem } from './models/orderReturnLineItem'; -export type { OrderReturnLineItemModifier } from './models/orderReturnLineItemModifier'; -export type { OrderReturnServiceCharge } from './models/orderReturnServiceCharge'; -export type { OrderReturnTax } from './models/orderReturnTax'; -export type { OrderReturnTip } from './models/orderReturnTip'; -export type { OrderReward } from './models/orderReward'; -export type { OrderRoundingAdjustment } from './models/orderRoundingAdjustment'; -export type { OrderServiceCharge } from './models/orderServiceCharge'; -export type { OrderSource } from './models/orderSource'; -export type { OrderUpdated } from './models/orderUpdated'; -export type { OrderUpdatedObject } from './models/orderUpdatedObject'; -export type { PaginationCursor } from './models/paginationCursor'; -export type { PauseSubscriptionRequest } from './models/pauseSubscriptionRequest'; -export type { PauseSubscriptionResponse } from './models/pauseSubscriptionResponse'; -export type { Payment } from './models/payment'; -export type { PaymentBalanceActivityAppFeeRefundDetail } from './models/paymentBalanceActivityAppFeeRefundDetail'; -export type { PaymentBalanceActivityAppFeeRevenueDetail } from './models/paymentBalanceActivityAppFeeRevenueDetail'; -export type { PaymentBalanceActivityAutomaticSavingsDetail } from './models/paymentBalanceActivityAutomaticSavingsDetail'; -export type { PaymentBalanceActivityAutomaticSavingsReversedDetail } from './models/paymentBalanceActivityAutomaticSavingsReversedDetail'; -export type { PaymentBalanceActivityChargeDetail } from './models/paymentBalanceActivityChargeDetail'; -export type { PaymentBalanceActivityDepositFeeDetail } from './models/paymentBalanceActivityDepositFeeDetail'; -export type { PaymentBalanceActivityDepositFeeReversedDetail } from './models/paymentBalanceActivityDepositFeeReversedDetail'; -export type { PaymentBalanceActivityDisputeDetail } from './models/paymentBalanceActivityDisputeDetail'; -export type { PaymentBalanceActivityFeeDetail } from './models/paymentBalanceActivityFeeDetail'; -export type { PaymentBalanceActivityFreeProcessingDetail } from './models/paymentBalanceActivityFreeProcessingDetail'; -export type { PaymentBalanceActivityHoldAdjustmentDetail } from './models/paymentBalanceActivityHoldAdjustmentDetail'; -export type { PaymentBalanceActivityOpenDisputeDetail } from './models/paymentBalanceActivityOpenDisputeDetail'; -export type { PaymentBalanceActivityOtherAdjustmentDetail } from './models/paymentBalanceActivityOtherAdjustmentDetail'; -export type { PaymentBalanceActivityOtherDetail } from './models/paymentBalanceActivityOtherDetail'; -export type { PaymentBalanceActivityRefundDetail } from './models/paymentBalanceActivityRefundDetail'; -export type { PaymentBalanceActivityReleaseAdjustmentDetail } from './models/paymentBalanceActivityReleaseAdjustmentDetail'; -export type { PaymentBalanceActivityReserveHoldDetail } from './models/paymentBalanceActivityReserveHoldDetail'; -export type { PaymentBalanceActivityReserveReleaseDetail } from './models/paymentBalanceActivityReserveReleaseDetail'; -export type { PaymentBalanceActivitySquareCapitalPaymentDetail } from './models/paymentBalanceActivitySquareCapitalPaymentDetail'; -export type { PaymentBalanceActivitySquareCapitalReversedPaymentDetail } from './models/paymentBalanceActivitySquareCapitalReversedPaymentDetail'; -export type { PaymentBalanceActivitySquarePayrollTransferDetail } from './models/paymentBalanceActivitySquarePayrollTransferDetail'; -export type { PaymentBalanceActivitySquarePayrollTransferReversedDetail } from './models/paymentBalanceActivitySquarePayrollTransferReversedDetail'; -export type { PaymentBalanceActivityTaxOnFeeDetail } from './models/paymentBalanceActivityTaxOnFeeDetail'; -export type { PaymentBalanceActivityThirdPartyFeeDetail } from './models/paymentBalanceActivityThirdPartyFeeDetail'; -export type { PaymentBalanceActivityThirdPartyFeeRefundDetail } from './models/paymentBalanceActivityThirdPartyFeeRefundDetail'; -export type { PaymentLink } from './models/paymentLink'; -export type { PaymentLinkRelatedResources } from './models/paymentLinkRelatedResources'; -export type { PaymentOptions } from './models/paymentOptions'; -export type { PaymentRefund } from './models/paymentRefund'; -export type { PayOrderRequest } from './models/payOrderRequest'; -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'; -export type { ReceiptOptions } from './models/receiptOptions'; -export type { RedeemLoyaltyRewardRequest } from './models/redeemLoyaltyRewardRequest'; -export type { RedeemLoyaltyRewardResponse } from './models/redeemLoyaltyRewardResponse'; -export type { Refund } from './models/refund'; -export type { RefundPaymentRequest } from './models/refundPaymentRequest'; -export type { RefundPaymentResponse } from './models/refundPaymentResponse'; -export type { RegisterDomainRequest } from './models/registerDomainRequest'; -export type { RegisterDomainResponse } from './models/registerDomainResponse'; -export type { RemoveGroupFromCustomerResponse } from './models/removeGroupFromCustomerResponse'; -export type { ResumeSubscriptionRequest } from './models/resumeSubscriptionRequest'; -export type { ResumeSubscriptionResponse } from './models/resumeSubscriptionResponse'; -export type { RetrieveBookingCustomAttributeDefinitionRequest } from './models/retrieveBookingCustomAttributeDefinitionRequest'; -export type { RetrieveBookingCustomAttributeDefinitionResponse } from './models/retrieveBookingCustomAttributeDefinitionResponse'; -export type { RetrieveBookingCustomAttributeRequest } from './models/retrieveBookingCustomAttributeRequest'; -export type { RetrieveBookingCustomAttributeResponse } from './models/retrieveBookingCustomAttributeResponse'; -export type { RetrieveBookingResponse } from './models/retrieveBookingResponse'; -export type { RetrieveBusinessBookingProfileResponse } from './models/retrieveBusinessBookingProfileResponse'; -export type { RetrieveCardResponse } from './models/retrieveCardResponse'; -export type { RetrieveCashDrawerShiftRequest } from './models/retrieveCashDrawerShiftRequest'; -export type { RetrieveCashDrawerShiftResponse } from './models/retrieveCashDrawerShiftResponse'; -export type { RetrieveCatalogObjectRequest } from './models/retrieveCatalogObjectRequest'; -export type { RetrieveCatalogObjectResponse } from './models/retrieveCatalogObjectResponse'; -export type { RetrieveCustomerCustomAttributeDefinitionRequest } from './models/retrieveCustomerCustomAttributeDefinitionRequest'; -export type { RetrieveCustomerCustomAttributeDefinitionResponse } from './models/retrieveCustomerCustomAttributeDefinitionResponse'; -export type { RetrieveCustomerCustomAttributeRequest } from './models/retrieveCustomerCustomAttributeRequest'; -export type { RetrieveCustomerCustomAttributeResponse } from './models/retrieveCustomerCustomAttributeResponse'; -export type { RetrieveCustomerGroupResponse } from './models/retrieveCustomerGroupResponse'; -export type { RetrieveCustomerResponse } from './models/retrieveCustomerResponse'; -export type { RetrieveCustomerSegmentResponse } from './models/retrieveCustomerSegmentResponse'; -export type { RetrieveDisputeEvidenceResponse } from './models/retrieveDisputeEvidenceResponse'; -export type { RetrieveDisputeResponse } from './models/retrieveDisputeResponse'; -export type { RetrieveEmployeeResponse } from './models/retrieveEmployeeResponse'; -export type { RetrieveGiftCardFromGANRequest } from './models/retrieveGiftCardFromGANRequest'; -export type { RetrieveGiftCardFromGANResponse } from './models/retrieveGiftCardFromGANResponse'; -export type { RetrieveGiftCardFromNonceRequest } from './models/retrieveGiftCardFromNonceRequest'; -export type { RetrieveGiftCardFromNonceResponse } from './models/retrieveGiftCardFromNonceResponse'; -export type { RetrieveGiftCardResponse } from './models/retrieveGiftCardResponse'; -export type { RetrieveInventoryAdjustmentResponse } from './models/retrieveInventoryAdjustmentResponse'; -export type { RetrieveInventoryChangesRequest } from './models/retrieveInventoryChangesRequest'; -export type { RetrieveInventoryChangesResponse } from './models/retrieveInventoryChangesResponse'; -export type { RetrieveInventoryCountRequest } from './models/retrieveInventoryCountRequest'; -export type { RetrieveInventoryCountResponse } from './models/retrieveInventoryCountResponse'; -export type { RetrieveInventoryPhysicalCountResponse } from './models/retrieveInventoryPhysicalCountResponse'; -export type { RetrieveInventoryTransferResponse } from './models/retrieveInventoryTransferResponse'; -export type { RetrieveJobResponse } from './models/retrieveJobResponse'; -export type { RetrieveLocationBookingProfileResponse } from './models/retrieveLocationBookingProfileResponse'; -export type { RetrieveLocationCustomAttributeDefinitionRequest } from './models/retrieveLocationCustomAttributeDefinitionRequest'; -export type { RetrieveLocationCustomAttributeDefinitionResponse } from './models/retrieveLocationCustomAttributeDefinitionResponse'; -export type { RetrieveLocationCustomAttributeRequest } from './models/retrieveLocationCustomAttributeRequest'; -export type { RetrieveLocationCustomAttributeResponse } from './models/retrieveLocationCustomAttributeResponse'; -export type { RetrieveLocationResponse } from './models/retrieveLocationResponse'; -export type { RetrieveLocationSettingsResponse } from './models/retrieveLocationSettingsResponse'; -export type { RetrieveLoyaltyAccountResponse } from './models/retrieveLoyaltyAccountResponse'; -export type { RetrieveLoyaltyProgramResponse } from './models/retrieveLoyaltyProgramResponse'; -export type { RetrieveLoyaltyPromotionResponse } from './models/retrieveLoyaltyPromotionResponse'; -export type { RetrieveLoyaltyRewardResponse } from './models/retrieveLoyaltyRewardResponse'; -export type { RetrieveMerchantCustomAttributeDefinitionRequest } from './models/retrieveMerchantCustomAttributeDefinitionRequest'; -export type { RetrieveMerchantCustomAttributeDefinitionResponse } from './models/retrieveMerchantCustomAttributeDefinitionResponse'; -export type { RetrieveMerchantCustomAttributeRequest } from './models/retrieveMerchantCustomAttributeRequest'; -export type { RetrieveMerchantCustomAttributeResponse } from './models/retrieveMerchantCustomAttributeResponse'; -export type { RetrieveMerchantResponse } from './models/retrieveMerchantResponse'; -export type { RetrieveMerchantSettingsResponse } from './models/retrieveMerchantSettingsResponse'; -export type { RetrieveOrderCustomAttributeDefinitionRequest } from './models/retrieveOrderCustomAttributeDefinitionRequest'; -export type { RetrieveOrderCustomAttributeDefinitionResponse } from './models/retrieveOrderCustomAttributeDefinitionResponse'; -export type { RetrieveOrderCustomAttributeRequest } from './models/retrieveOrderCustomAttributeRequest'; -export type { RetrieveOrderCustomAttributeResponse } from './models/retrieveOrderCustomAttributeResponse'; -export type { RetrieveOrderResponse } from './models/retrieveOrderResponse'; -export type { RetrievePaymentLinkResponse } from './models/retrievePaymentLinkResponse'; -export type { RetrieveSnippetResponse } from './models/retrieveSnippetResponse'; -export type { RetrieveSubscriptionRequest } from './models/retrieveSubscriptionRequest'; -export type { RetrieveSubscriptionResponse } from './models/retrieveSubscriptionResponse'; -export type { RetrieveTeamMemberBookingProfileResponse } from './models/retrieveTeamMemberBookingProfileResponse'; -export type { RetrieveTeamMemberResponse } from './models/retrieveTeamMemberResponse'; -export type { RetrieveTokenStatusResponse } from './models/retrieveTokenStatusResponse'; -export type { RetrieveTransactionResponse } from './models/retrieveTransactionResponse'; -export type { RetrieveVendorResponse } from './models/retrieveVendorResponse'; -export type { RetrieveWageSettingResponse } from './models/retrieveWageSettingResponse'; -export type { RetrieveWebhookSubscriptionResponse } from './models/retrieveWebhookSubscriptionResponse'; -export type { RevokeTokenRequest } from './models/revokeTokenRequest'; -export type { RevokeTokenResponse } from './models/revokeTokenResponse'; -export type { RiskEvaluation } from './models/riskEvaluation'; -export type { SaveCardOptions } from './models/saveCardOptions'; -export type { SearchAvailabilityFilter } from './models/searchAvailabilityFilter'; -export type { SearchAvailabilityQuery } from './models/searchAvailabilityQuery'; -export type { SearchAvailabilityRequest } from './models/searchAvailabilityRequest'; -export type { SearchAvailabilityResponse } from './models/searchAvailabilityResponse'; -export type { SearchCatalogItemsRequest } from './models/searchCatalogItemsRequest'; -export type { SearchCatalogItemsResponse } from './models/searchCatalogItemsResponse'; -export type { SearchCatalogObjectsRequest } from './models/searchCatalogObjectsRequest'; -export type { SearchCatalogObjectsResponse } from './models/searchCatalogObjectsResponse'; -export type { SearchCustomersRequest } from './models/searchCustomersRequest'; -export type { SearchCustomersResponse } from './models/searchCustomersResponse'; -export type { SearchEventsFilter } from './models/searchEventsFilter'; -export type { SearchEventsQuery } from './models/searchEventsQuery'; -export type { SearchEventsRequest } from './models/searchEventsRequest'; -export type { SearchEventsResponse } from './models/searchEventsResponse'; -export type { SearchEventsSort } from './models/searchEventsSort'; -export type { SearchInvoicesRequest } from './models/searchInvoicesRequest'; -export type { SearchInvoicesResponse } from './models/searchInvoicesResponse'; -export type { SearchLoyaltyAccountsRequest } from './models/searchLoyaltyAccountsRequest'; -export type { SearchLoyaltyAccountsRequestLoyaltyAccountQuery } from './models/searchLoyaltyAccountsRequestLoyaltyAccountQuery'; -export type { SearchLoyaltyAccountsResponse } from './models/searchLoyaltyAccountsResponse'; -export type { SearchLoyaltyEventsRequest } from './models/searchLoyaltyEventsRequest'; -export type { SearchLoyaltyEventsResponse } from './models/searchLoyaltyEventsResponse'; -export type { SearchLoyaltyRewardsRequest } from './models/searchLoyaltyRewardsRequest'; -export type { SearchLoyaltyRewardsRequestLoyaltyRewardQuery } from './models/searchLoyaltyRewardsRequestLoyaltyRewardQuery'; -export type { SearchLoyaltyRewardsResponse } from './models/searchLoyaltyRewardsResponse'; -export type { SearchOrdersCustomerFilter } from './models/searchOrdersCustomerFilter'; -export type { SearchOrdersDateTimeFilter } from './models/searchOrdersDateTimeFilter'; -export type { SearchOrdersFilter } from './models/searchOrdersFilter'; -export type { SearchOrdersFulfillmentFilter } from './models/searchOrdersFulfillmentFilter'; -export type { SearchOrdersQuery } from './models/searchOrdersQuery'; -export type { SearchOrdersRequest } from './models/searchOrdersRequest'; -export type { SearchOrdersResponse } from './models/searchOrdersResponse'; -export type { SearchOrdersSort } from './models/searchOrdersSort'; -export type { SearchOrdersSourceFilter } from './models/searchOrdersSourceFilter'; -export type { SearchOrdersStateFilter } from './models/searchOrdersStateFilter'; -export type { SearchShiftsRequest } from './models/searchShiftsRequest'; -export type { SearchShiftsResponse } from './models/searchShiftsResponse'; -export type { SearchSubscriptionsFilter } from './models/searchSubscriptionsFilter'; -export type { SearchSubscriptionsQuery } from './models/searchSubscriptionsQuery'; -export type { SearchSubscriptionsRequest } from './models/searchSubscriptionsRequest'; -export type { SearchSubscriptionsResponse } from './models/searchSubscriptionsResponse'; -export type { SearchTeamMembersFilter } from './models/searchTeamMembersFilter'; -export type { SearchTeamMembersQuery } from './models/searchTeamMembersQuery'; -export type { SearchTeamMembersRequest } from './models/searchTeamMembersRequest'; -export type { SearchTeamMembersResponse } from './models/searchTeamMembersResponse'; -export type { SearchTerminalActionsRequest } from './models/searchTerminalActionsRequest'; -export type { SearchTerminalActionsResponse } from './models/searchTerminalActionsResponse'; -export type { SearchTerminalCheckoutsRequest } from './models/searchTerminalCheckoutsRequest'; -export type { SearchTerminalCheckoutsResponse } from './models/searchTerminalCheckoutsResponse'; -export type { SearchTerminalRefundsRequest } from './models/searchTerminalRefundsRequest'; -export type { SearchTerminalRefundsResponse } from './models/searchTerminalRefundsResponse'; -export type { SearchVendorsRequest } from './models/searchVendorsRequest'; -export type { SearchVendorsRequestFilter } from './models/searchVendorsRequestFilter'; -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'; -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'; -export type { SourceApplication } from './models/sourceApplication'; -export type { SquareAccountDetails } from './models/squareAccountDetails'; -export type { StandardUnitDescription } from './models/standardUnitDescription'; -export type { StandardUnitDescriptionGroup } from './models/standardUnitDescriptionGroup'; -export type { SubmitEvidenceResponse } from './models/submitEvidenceResponse'; -export type { Subscription } from './models/subscription'; -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'; -export type { SwapPlanResponse } from './models/swapPlanResponse'; -export type { TaxIds } from './models/taxIds'; -export type { TeamMember } from './models/teamMember'; -export type { TeamMemberAssignedLocations } from './models/teamMemberAssignedLocations'; -export type { TeamMemberBookingProfile } from './models/teamMemberBookingProfile'; -export type { TeamMemberWage } from './models/teamMemberWage'; -export type { Tender } from './models/tender'; -export type { TenderBankAccountDetails } from './models/tenderBankAccountDetails'; -export type { TenderBuyNowPayLaterDetails } from './models/tenderBuyNowPayLaterDetails'; -export type { TenderCardDetails } from './models/tenderCardDetails'; -export type { TenderCashDetails } from './models/tenderCashDetails'; -export type { TenderSquareAccountDetails } from './models/tenderSquareAccountDetails'; -export type { TerminalAction } from './models/terminalAction'; -export type { TerminalActionQuery } from './models/terminalActionQuery'; -export type { TerminalActionQueryFilter } from './models/terminalActionQueryFilter'; -export type { TerminalActionQuerySort } from './models/terminalActionQuerySort'; -export type { TerminalCheckout } from './models/terminalCheckout'; -export type { TerminalCheckoutQuery } from './models/terminalCheckoutQuery'; -export type { TerminalCheckoutQueryFilter } from './models/terminalCheckoutQueryFilter'; -export type { TerminalCheckoutQuerySort } from './models/terminalCheckoutQuerySort'; -export type { TerminalRefund } from './models/terminalRefund'; -export type { TerminalRefundQuery } from './models/terminalRefundQuery'; -export type { TerminalRefundQueryFilter } from './models/terminalRefundQueryFilter'; -export type { TerminalRefundQuerySort } from './models/terminalRefundQuerySort'; -export type { TestWebhookSubscriptionRequest } from './models/testWebhookSubscriptionRequest'; -export type { TestWebhookSubscriptionResponse } from './models/testWebhookSubscriptionResponse'; -export type { TimeRange } from './models/timeRange'; -export type { TipSettings } from './models/tipSettings'; -export type { Transaction } from './models/transaction'; -export type { UnlinkCustomerFromGiftCardRequest } from './models/unlinkCustomerFromGiftCardRequest'; -export type { UnlinkCustomerFromGiftCardResponse } from './models/unlinkCustomerFromGiftCardResponse'; -export type { UpdateBookingCustomAttributeDefinitionRequest } from './models/updateBookingCustomAttributeDefinitionRequest'; -export type { UpdateBookingCustomAttributeDefinitionResponse } from './models/updateBookingCustomAttributeDefinitionResponse'; -export type { UpdateBookingRequest } from './models/updateBookingRequest'; -export type { UpdateBookingResponse } from './models/updateBookingResponse'; -export type { UpdateBreakTypeRequest } from './models/updateBreakTypeRequest'; -export type { UpdateBreakTypeResponse } from './models/updateBreakTypeResponse'; -export type { UpdateCatalogImageRequest } from './models/updateCatalogImageRequest'; -export type { UpdateCatalogImageResponse } from './models/updateCatalogImageResponse'; -export type { UpdateCustomerCustomAttributeDefinitionRequest } from './models/updateCustomerCustomAttributeDefinitionRequest'; -export type { UpdateCustomerCustomAttributeDefinitionResponse } from './models/updateCustomerCustomAttributeDefinitionResponse'; -export type { UpdateCustomerGroupRequest } from './models/updateCustomerGroupRequest'; -export type { UpdateCustomerGroupResponse } from './models/updateCustomerGroupResponse'; -export type { UpdateCustomerRequest } from './models/updateCustomerRequest'; -export type { UpdateCustomerResponse } from './models/updateCustomerResponse'; -export type { UpdateInvoiceRequest } from './models/updateInvoiceRequest'; -export type { UpdateInvoiceResponse } from './models/updateInvoiceResponse'; -export type { UpdateItemModifierListsRequest } from './models/updateItemModifierListsRequest'; -export type { UpdateItemModifierListsResponse } from './models/updateItemModifierListsResponse'; -export type { UpdateItemTaxesRequest } from './models/updateItemTaxesRequest'; -export type { UpdateItemTaxesResponse } from './models/updateItemTaxesResponse'; -export type { UpdateJobRequest } from './models/updateJobRequest'; -export type { UpdateJobResponse } from './models/updateJobResponse'; -export type { UpdateLocationCustomAttributeDefinitionRequest } from './models/updateLocationCustomAttributeDefinitionRequest'; -export type { UpdateLocationCustomAttributeDefinitionResponse } from './models/updateLocationCustomAttributeDefinitionResponse'; -export type { UpdateLocationRequest } from './models/updateLocationRequest'; -export type { UpdateLocationResponse } from './models/updateLocationResponse'; -export type { UpdateLocationSettingsRequest } from './models/updateLocationSettingsRequest'; -export type { UpdateLocationSettingsResponse } from './models/updateLocationSettingsResponse'; -export type { UpdateMerchantCustomAttributeDefinitionRequest } from './models/updateMerchantCustomAttributeDefinitionRequest'; -export type { UpdateMerchantCustomAttributeDefinitionResponse } from './models/updateMerchantCustomAttributeDefinitionResponse'; -export type { UpdateMerchantSettingsRequest } from './models/updateMerchantSettingsRequest'; -export type { UpdateMerchantSettingsResponse } from './models/updateMerchantSettingsResponse'; -export type { UpdateOrderCustomAttributeDefinitionRequest } from './models/updateOrderCustomAttributeDefinitionRequest'; -export type { UpdateOrderCustomAttributeDefinitionResponse } from './models/updateOrderCustomAttributeDefinitionResponse'; -export type { UpdateOrderRequest } from './models/updateOrderRequest'; -export type { UpdateOrderResponse } from './models/updateOrderResponse'; -export type { UpdatePaymentLinkRequest } from './models/updatePaymentLinkRequest'; -export type { UpdatePaymentLinkResponse } from './models/updatePaymentLinkResponse'; -export type { UpdatePaymentRequest } from './models/updatePaymentRequest'; -export type { UpdatePaymentResponse } from './models/updatePaymentResponse'; -export type { UpdateShiftRequest } from './models/updateShiftRequest'; -export type { UpdateShiftResponse } from './models/updateShiftResponse'; -export type { UpdateSubscriptionRequest } from './models/updateSubscriptionRequest'; -export type { UpdateSubscriptionResponse } from './models/updateSubscriptionResponse'; -export type { UpdateTeamMemberRequest } from './models/updateTeamMemberRequest'; -export type { UpdateTeamMemberResponse } from './models/updateTeamMemberResponse'; -export type { UpdateVendorRequest } from './models/updateVendorRequest'; -export type { UpdateVendorResponse } from './models/updateVendorResponse'; -export type { UpdateWageSettingRequest } from './models/updateWageSettingRequest'; -export type { UpdateWageSettingResponse } from './models/updateWageSettingResponse'; -export type { UpdateWebhookSubscriptionRequest } from './models/updateWebhookSubscriptionRequest'; -export type { UpdateWebhookSubscriptionResponse } from './models/updateWebhookSubscriptionResponse'; -export type { UpdateWebhookSubscriptionSignatureKeyRequest } from './models/updateWebhookSubscriptionSignatureKeyRequest'; -export type { UpdateWebhookSubscriptionSignatureKeyResponse } from './models/updateWebhookSubscriptionSignatureKeyResponse'; -export type { UpdateWorkweekConfigRequest } from './models/updateWorkweekConfigRequest'; -export type { UpdateWorkweekConfigResponse } from './models/updateWorkweekConfigResponse'; -export type { UpsertBookingCustomAttributeRequest } from './models/upsertBookingCustomAttributeRequest'; -export type { UpsertBookingCustomAttributeResponse } from './models/upsertBookingCustomAttributeResponse'; -export type { UpsertCatalogObjectRequest } from './models/upsertCatalogObjectRequest'; -export type { UpsertCatalogObjectResponse } from './models/upsertCatalogObjectResponse'; -export type { UpsertCustomerCustomAttributeRequest } from './models/upsertCustomerCustomAttributeRequest'; -export type { UpsertCustomerCustomAttributeResponse } from './models/upsertCustomerCustomAttributeResponse'; -export type { UpsertLocationCustomAttributeRequest } from './models/upsertLocationCustomAttributeRequest'; -export type { UpsertLocationCustomAttributeResponse } from './models/upsertLocationCustomAttributeResponse'; -export type { UpsertMerchantCustomAttributeRequest } from './models/upsertMerchantCustomAttributeRequest'; -export type { UpsertMerchantCustomAttributeResponse } from './models/upsertMerchantCustomAttributeResponse'; -export type { UpsertOrderCustomAttributeRequest } from './models/upsertOrderCustomAttributeRequest'; -export type { UpsertOrderCustomAttributeResponse } from './models/upsertOrderCustomAttributeResponse'; -export type { UpsertSnippetRequest } from './models/upsertSnippetRequest'; -export type { UpsertSnippetResponse } from './models/upsertSnippetResponse'; -export type { V1Device } from './models/v1Device'; -export type { V1ListOrdersRequest } from './models/v1ListOrdersRequest'; -export type { V1ListOrdersResponse } from './models/v1ListOrdersResponse'; -export type { V1Money } from './models/v1Money'; -export type { V1Order } from './models/v1Order'; -export type { V1OrderHistoryEntry } from './models/v1OrderHistoryEntry'; -export type { V1PhoneNumber } from './models/v1PhoneNumber'; -export type { V1Tender } from './models/v1Tender'; -export type { V1UpdateOrderRequest } from './models/v1UpdateOrderRequest'; -export type { Vendor } from './models/vendor'; -export type { VendorContact } from './models/vendorContact'; -export type { VoidTransactionResponse } from './models/voidTransactionResponse'; -export type { WageSetting } from './models/wageSetting'; -export type { WebhookSubscription } from './models/webhookSubscription'; -export type { WorkweekConfig } from './models/workweekConfig'; -export * from './utilities/webhooksHelper'; +export * as Square from "./api"; +export { SquareClient } from "./Client"; +export { SquareEnvironment } from "./environments"; +export { SquareError, SquareTimeoutError } from "./errors"; +export * as serialization from "./serialization"; diff --git a/src/models/aCHDetails.ts b/src/models/aCHDetails.ts deleted file mode 100644 index c878805c2..000000000 --- a/src/models/aCHDetails.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`. */ -export interface ACHDetails { - /** The routing number for the bank account. */ - routingNumber?: string | null; - /** The last few digits of the bank account number. */ - accountNumberSuffix?: string | null; - /** - * The type of the bank account performing the transfer. The account type can be `CHECKING`, - * `SAVINGS`, or `UNKNOWN`. - */ - accountType?: string | null; -} - -export const aCHDetailsSchema: Schema = object({ - routingNumber: ['routing_number', optional(nullable(string()))], - accountNumberSuffix: ['account_number_suffix', optional(nullable(string()))], - accountType: ['account_type', optional(nullable(string()))], -}); diff --git a/src/models/acceptDisputeResponse.ts b/src/models/acceptDisputeResponse.ts deleted file mode 100644 index e276bcfe4..000000000 --- a/src/models/acceptDisputeResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Dispute, disputeSchema } from './dispute'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in an `AcceptDispute` response. */ -export interface AcceptDisputeResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. */ - dispute?: Dispute; -} - -export const acceptDisputeResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - dispute: ['dispute', optional(lazy(() => disputeSchema))], - } -); diff --git a/src/models/acceptedPaymentMethods.ts b/src/models/acceptedPaymentMethods.ts deleted file mode 100644 index 0ecdf221d..000000000 --- a/src/models/acceptedPaymentMethods.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { boolean, nullable, object, optional, Schema } from '../schema'; - -export interface AcceptedPaymentMethods { - /** Whether Apple Pay is accepted at checkout. */ - applePay?: boolean | null; - /** Whether Google Pay is accepted at checkout. */ - googlePay?: boolean | null; - /** Whether Cash App Pay is accepted at checkout. */ - cashAppPay?: boolean | null; - /** Whether Afterpay/Clearpay is accepted at checkout. */ - afterpayClearpay?: boolean | null; -} - -export const acceptedPaymentMethodsSchema: Schema = object( - { - applePay: ['apple_pay', optional(nullable(boolean()))], - googlePay: ['google_pay', optional(nullable(boolean()))], - cashAppPay: ['cash_app_pay', optional(nullable(boolean()))], - afterpayClearpay: ['afterpay_clearpay', optional(nullable(boolean()))], - } -); diff --git a/src/models/accumulateLoyaltyPointsRequest.ts b/src/models/accumulateLoyaltyPointsRequest.ts deleted file mode 100644 index cc17458ef..000000000 --- a/src/models/accumulateLoyaltyPointsRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { - LoyaltyEventAccumulatePoints, - loyaltyEventAccumulatePointsSchema, -} from './loyaltyEventAccumulatePoints'; - -/** Represents an [AccumulateLoyaltyPoints]($e/Loyalty/AccumulateLoyaltyPoints) request. */ -export interface AccumulateLoyaltyPointsRequest { - /** Provides metadata when the event `type` is `ACCUMULATE_POINTS`. */ - accumulatePoints: LoyaltyEventAccumulatePoints; - /** - * A unique string that identifies the `AccumulateLoyaltyPoints` request. - * Keys can be any valid string but must be unique for every request. - */ - idempotencyKey: string; - /** The [location](entity:Location) where the purchase was made. */ - locationId: string; -} - -export const accumulateLoyaltyPointsRequestSchema: Schema = object( - { - accumulatePoints: [ - 'accumulate_points', - lazy(() => loyaltyEventAccumulatePointsSchema), - ], - idempotencyKey: ['idempotency_key', string()], - locationId: ['location_id', string()], - } -); diff --git a/src/models/accumulateLoyaltyPointsResponse.ts b/src/models/accumulateLoyaltyPointsResponse.ts deleted file mode 100644 index fad632e9a..000000000 --- a/src/models/accumulateLoyaltyPointsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyEvent, loyaltyEventSchema } from './loyaltyEvent'; - -/** Represents an [AccumulateLoyaltyPoints]($e/Loyalty/AccumulateLoyaltyPoints) response. */ -export interface AccumulateLoyaltyPointsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Provides information about a loyalty event. - * For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). - */ - event?: LoyaltyEvent; - /** - * The resulting loyalty events. If the purchase qualifies for points, the `ACCUMULATE_POINTS` event - * is always included. When using the Orders API, the `ACCUMULATE_PROMOTION_POINTS` event is included - * if the purchase also qualifies for a loyalty promotion. - */ - events?: LoyaltyEvent[]; -} - -export const accumulateLoyaltyPointsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - event: ['event', optional(lazy(() => loyaltyEventSchema))], - events: ['events', optional(array(lazy(() => loyaltyEventSchema)))], - } -); diff --git a/src/models/addGroupToCustomerResponse.ts b/src/models/addGroupToCustomerResponse.ts deleted file mode 100644 index 414ee0d63..000000000 --- a/src/models/addGroupToCustomerResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [AddGroupToCustomer]($e/Customers/AddGroupToCustomer) endpoint. - */ -export interface AddGroupToCustomerResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const addGroupToCustomerResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/additionalRecipient.ts b/src/models/additionalRecipient.ts deleted file mode 100644 index 527bf186f..000000000 --- a/src/models/additionalRecipient.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents an additional recipient (other than the merchant) receiving a portion of this tender. */ -export interface AdditionalRecipient { - /** The location ID for a recipient (other than the merchant) receiving a portion of this tender. */ - locationId: string; - /** The description of the additional recipient. */ - description?: 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. - */ - amountMoney: Money; - /** The unique ID for the RETIRED `AdditionalRecipientReceivable` object. This field should be empty for any `AdditionalRecipient` objects created after the retirement. */ - receivableId?: string | null; -} - -export const additionalRecipientSchema: Schema = object({ - locationId: ['location_id', string()], - description: ['description', optional(nullable(string()))], - amountMoney: ['amount_money', lazy(() => moneySchema)], - receivableId: ['receivable_id', optional(nullable(string()))], -}); diff --git a/src/models/address.ts b/src/models/address.ts deleted file mode 100644 index 5e986209a..000000000 --- a/src/models/address.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ -export interface Address { - /** - * The first line of the address. - * Fields that start with `address_line` provide the address's most specific - * details, like street number, street name, and building name. They do *not* - * provide less specific details like city, state/province, or country (these - * details are provided in other fields). - */ - addressLine1?: string | null; - /** The second line of the address, if any. */ - addressLine2?: string | null; - /** The third line of the address, if any. */ - addressLine3?: string | null; - /** The city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). */ - locality?: string | null; - /** A civil region within the address's `locality`, if any. */ - sublocality?: string | null; - /** A civil region within the address's `sublocality`, if any. */ - sublocality2?: string | null; - /** A civil region within the address's `sublocality_2`, if any. */ - sublocality3?: string | null; - /** - * A civil entity within the address's country. In the US, this - * is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - administrativeDistrictLevel1?: string | null; - /** - * A civil entity within the address's `administrative_district_level_1`. - * In the US, this is the county. - */ - administrativeDistrictLevel2?: string | null; - /** - * A civil entity within the address's `administrative_district_level_2`, - * if any. - */ - administrativeDistrictLevel3?: string | null; - /** The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). */ - postalCode?: string | null; - /** - * Indicates the country associated with another entity, such as a business. - * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). - */ - country?: string; - /** Optional first name when it's representing recipient. */ - firstName?: string | null; - /** Optional last name when it's representing recipient. */ - lastName?: string | null; -} - -export const addressSchema: Schema

= object({ - addressLine1: ['address_line_1', optional(nullable(string()))], - addressLine2: ['address_line_2', optional(nullable(string()))], - addressLine3: ['address_line_3', optional(nullable(string()))], - locality: ['locality', optional(nullable(string()))], - sublocality: ['sublocality', optional(nullable(string()))], - sublocality2: ['sublocality_2', optional(nullable(string()))], - sublocality3: ['sublocality_3', optional(nullable(string()))], - administrativeDistrictLevel1: [ - 'administrative_district_level_1', - optional(nullable(string())), - ], - administrativeDistrictLevel2: [ - 'administrative_district_level_2', - optional(nullable(string())), - ], - administrativeDistrictLevel3: [ - 'administrative_district_level_3', - optional(nullable(string())), - ], - postalCode: ['postal_code', optional(nullable(string()))], - country: ['country', optional(string())], - firstName: ['first_name', optional(nullable(string()))], - lastName: ['last_name', optional(nullable(string()))], -}); diff --git a/src/models/adjustLoyaltyPointsRequest.ts b/src/models/adjustLoyaltyPointsRequest.ts deleted file mode 100644 index 3d9e6ac9b..000000000 --- a/src/models/adjustLoyaltyPointsRequest.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - LoyaltyEventAdjustPoints, - loyaltyEventAdjustPointsSchema, -} from './loyaltyEventAdjustPoints'; - -/** Represents an [AdjustLoyaltyPoints]($e/Loyalty/AdjustLoyaltyPoints) request. */ -export interface AdjustLoyaltyPointsRequest { - /** - * A unique string that identifies this `AdjustLoyaltyPoints` request. - * Keys can be any valid string, but must be unique for every request. - */ - idempotencyKey: string; - /** Provides metadata when the event `type` is `ADJUST_POINTS`. */ - adjustPoints: LoyaltyEventAdjustPoints; - /** - * Indicates whether to allow a negative adjustment to result in a negative balance. If `true`, a negative - * balance is allowed when subtracting points. If `false`, Square returns a `BAD_REQUEST` error when subtracting - * the specified number of points would result in a negative balance. The default value is `false`. - */ - allowNegativeBalance?: boolean | null; -} - -export const adjustLoyaltyPointsRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - adjustPoints: ['adjust_points', lazy(() => loyaltyEventAdjustPointsSchema)], - allowNegativeBalance: [ - 'allow_negative_balance', - optional(nullable(boolean())), - ], - } -); diff --git a/src/models/adjustLoyaltyPointsResponse.ts b/src/models/adjustLoyaltyPointsResponse.ts deleted file mode 100644 index afd99a0bc..000000000 --- a/src/models/adjustLoyaltyPointsResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyEvent, loyaltyEventSchema } from './loyaltyEvent'; - -/** Represents an [AdjustLoyaltyPoints]($e/Loyalty/AdjustLoyaltyPoints) request. */ -export interface AdjustLoyaltyPointsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Provides information about a loyalty event. - * For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). - */ - event?: LoyaltyEvent; -} - -export const adjustLoyaltyPointsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - event: ['event', optional(lazy(() => loyaltyEventSchema))], - } -); diff --git a/src/models/afterpayDetails.ts b/src/models/afterpayDetails.ts deleted file mode 100644 index d67974297..000000000 --- a/src/models/afterpayDetails.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Additional details about Afterpay payments. */ -export interface AfterpayDetails { - /** Email address on the buyer's Afterpay account. */ - emailAddress?: string | null; -} - -export const afterpayDetailsSchema: Schema = object({ - emailAddress: ['email_address', optional(nullable(string()))], -}); diff --git a/src/models/applicationDetails.ts b/src/models/applicationDetails.ts deleted file mode 100644 index 0b7691c2f..000000000 --- a/src/models/applicationDetails.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Details about the application that took the payment. */ -export interface ApplicationDetails { - /** A list of products to return to external callers. */ - squareProduct?: string; - /** - * The Square ID assigned to the application used to take the payment. - * Application developers can use this information to identify payments that - * their application processed. - * For example, if a developer uses a custom application to process payments, - * this field contains the application ID from the Developer Dashboard. - * If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace) - * application to process payments, the field contains the corresponding application ID. - */ - applicationId?: string | null; -} - -export const applicationDetailsSchema: Schema = object({ - squareProduct: ['square_product', optional(string())], - applicationId: ['application_id', optional(nullable(string()))], -}); diff --git a/src/models/appointmentSegment.ts b/src/models/appointmentSegment.ts deleted file mode 100644 index 011ffc883..000000000 --- a/src/models/appointmentSegment.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - array, - bigint, - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** Defines an appointment segment of a booking. */ -export interface AppointmentSegment { - /** The time span in minutes of an appointment segment. */ - durationMinutes?: number | null; - /** The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment. */ - serviceVariationId?: string | null; - /** The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this segment. */ - teamMemberId: string; - /** The current version of the item variation representing the service booked in this segment. */ - serviceVariationVersion?: bigint | null; - /** Time between the end of this segment and the beginning of the subsequent segment. */ - intermissionMinutes?: number; - /** Whether the customer accepts any team member, instead of a specific one, to serve this segment. */ - anyTeamMember?: boolean; - /** The IDs of the seller-accessible resources used for this appointment segment. */ - resourceIds?: string[]; -} - -export const appointmentSegmentSchema: Schema = object({ - durationMinutes: ['duration_minutes', optional(nullable(number()))], - serviceVariationId: ['service_variation_id', optional(nullable(string()))], - teamMemberId: ['team_member_id', string()], - serviceVariationVersion: [ - 'service_variation_version', - optional(nullable(bigint())), - ], - intermissionMinutes: ['intermission_minutes', optional(number())], - anyTeamMember: ['any_team_member', optional(boolean())], - resourceIds: ['resource_ids', optional(array(string()))], -}); diff --git a/src/models/availability.ts b/src/models/availability.ts deleted file mode 100644 index 2622c1a57..000000000 --- a/src/models/availability.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - AppointmentSegment, - appointmentSegmentSchema, -} from './appointmentSegment'; - -/** Defines an appointment slot that encapsulates the appointment segments, location and starting time available for booking. */ -export interface Availability { - /** The RFC 3339 timestamp specifying the beginning time of the slot available for booking. */ - startAt?: string | null; - /** The ID of the location available for booking. */ - locationId?: string; - /** The list of appointment segments available for booking */ - appointmentSegments?: AppointmentSegment[] | null; -} - -export const availabilitySchema: Schema = object({ - startAt: ['start_at', optional(nullable(string()))], - locationId: ['location_id', optional(string())], - appointmentSegments: [ - 'appointment_segments', - optional(nullable(array(lazy(() => appointmentSegmentSchema)))), - ], -}); diff --git a/src/models/bankAccount.ts b/src/models/bankAccount.ts deleted file mode 100644 index c8a43ca6d..000000000 --- a/src/models/bankAccount.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * Represents a bank account. For more information about - * linking a bank account to a Square account, see - * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). - */ -export interface BankAccount { - /** The unique, Square-issued identifier for the bank account. */ - id: string; - /** The last few digits of the account number. */ - accountNumberSuffix: string; - /** - * Indicates the country associated with another entity, such as a business. - * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). - */ - country: string; - /** - * Indicates the associated currency for an amount of money. Values correspond - * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). - */ - currency: string; - /** Indicates the financial purpose of the bank account. */ - accountType: string; - /** - * Name of the account holder. This name must match the name - * on the targeted bank account record. - */ - holderName: string; - /** - * Primary identifier for the bank. For more information, see - * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). - */ - primaryBankIdentificationNumber: string; - /** - * Secondary identifier for the bank. For more information, see - * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). - */ - secondaryBankIdentificationNumber?: string | null; - /** - * Reference identifier that will be displayed to UK bank account owners - * when collecting direct debit authorization. Only required for UK bank accounts. - */ - debitMandateReferenceId?: string | null; - /** - * Client-provided identifier for linking the banking account to an entity - * in a third-party system (for example, a bank account number or a user identifier). - */ - referenceId?: string | null; - /** The location to which the bank account belongs. */ - locationId?: string | null; - /** Indicates the current verification status of a `BankAccount` object. */ - status: string; - /** Indicates whether it is possible for Square to send money to this bank account. */ - creditable: boolean; - /** - * Indicates whether it is possible for Square to take money from this - * bank account. - */ - debitable: boolean; - /** - * A Square-assigned, unique identifier for the bank account based on the - * account information. The account fingerprint can be used to compare account - * entries and determine if the they represent the same real-world bank account. - */ - fingerprint?: string | null; - /** The current version of the `BankAccount`. */ - version?: number; - /** - * Read only. Name of actual financial institution. - * For example "Bank of America". - */ - bankName?: string | null; -} - -export const bankAccountSchema: Schema = object({ - id: ['id', string()], - accountNumberSuffix: ['account_number_suffix', string()], - country: ['country', string()], - currency: ['currency', string()], - accountType: ['account_type', string()], - holderName: ['holder_name', string()], - primaryBankIdentificationNumber: [ - 'primary_bank_identification_number', - string(), - ], - secondaryBankIdentificationNumber: [ - 'secondary_bank_identification_number', - optional(nullable(string())), - ], - debitMandateReferenceId: [ - 'debit_mandate_reference_id', - optional(nullable(string())), - ], - referenceId: ['reference_id', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - status: ['status', string()], - creditable: ['creditable', boolean()], - debitable: ['debitable', boolean()], - fingerprint: ['fingerprint', optional(nullable(string()))], - version: ['version', optional(number())], - bankName: ['bank_name', optional(nullable(string()))], -}); diff --git a/src/models/bankAccountPaymentDetails.ts b/src/models/bankAccountPaymentDetails.ts deleted file mode 100644 index e442111a8..000000000 --- a/src/models/bankAccountPaymentDetails.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { ACHDetails, aCHDetailsSchema } from './aCHDetails'; -import { Error, errorSchema } from './error'; - -/** Additional details about BANK_ACCOUNT type payments. */ -export interface BankAccountPaymentDetails { - /** The name of the bank associated with the bank account. */ - bankName?: string | null; - /** The type of the bank transfer. The type can be `ACH` or `UNKNOWN`. */ - transferType?: string | null; - /** - * The ownership type of the bank account performing the transfer. - * The type can be `INDIVIDUAL`, `COMPANY`, or `ACCOUNT_TYPE_UNKNOWN`. - */ - accountOwnershipType?: string | null; - /** - * Uniquely identifies the bank account for this seller and can be used - * to determine if payments are from the same bank account. - */ - fingerprint?: string | null; - /** The two-letter ISO code representing the country the bank account is located in. */ - country?: string | null; - /** The statement description as sent to the bank. */ - statementDescription?: string | null; - /** ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`. */ - achDetails?: ACHDetails; - /** Information about errors encountered during the request. */ - errors?: Error[] | null; -} - -export const bankAccountPaymentDetailsSchema: Schema = object( - { - bankName: ['bank_name', optional(nullable(string()))], - transferType: ['transfer_type', optional(nullable(string()))], - accountOwnershipType: [ - 'account_ownership_type', - optional(nullable(string())), - ], - fingerprint: ['fingerprint', optional(nullable(string()))], - country: ['country', optional(nullable(string()))], - statementDescription: [ - 'statement_description', - optional(nullable(string())), - ], - achDetails: ['ach_details', optional(lazy(() => aCHDetailsSchema))], - errors: ['errors', optional(nullable(array(lazy(() => errorSchema))))], - } -); diff --git a/src/models/batchChangeInventoryRequest.ts b/src/models/batchChangeInventoryRequest.ts deleted file mode 100644 index 8937f9ee2..000000000 --- a/src/models/batchChangeInventoryRequest.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { InventoryChange, inventoryChangeSchema } from './inventoryChange'; - -export interface BatchChangeInventoryRequest { - /** - * A client-supplied, universally unique identifier (UUID) for the - * request. - * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the - * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more - * information. - */ - idempotencyKey: string; - /** - * The set of physical counts and inventory adjustments to be made. - * Changes are applied based on the client-supplied timestamp and may be sent - * out of order. - */ - changes?: InventoryChange[] | null; - /** - * Indicates whether the current physical count should be ignored if - * the quantity is unchanged since the last physical count. Default: `true`. - */ - ignoreUnchangedCounts?: boolean | null; -} - -export const batchChangeInventoryRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - changes: [ - 'changes', - optional(nullable(array(lazy(() => inventoryChangeSchema)))), - ], - ignoreUnchangedCounts: [ - 'ignore_unchanged_counts', - optional(nullable(boolean())), - ], - } -); diff --git a/src/models/batchChangeInventoryResponse.ts b/src/models/batchChangeInventoryResponse.ts deleted file mode 100644 index 2d6b7a209..000000000 --- a/src/models/batchChangeInventoryResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { InventoryChange, inventoryChangeSchema } from './inventoryChange'; -import { InventoryCount, inventoryCountSchema } from './inventoryCount'; - -export interface BatchChangeInventoryResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The current counts for all objects referenced in the request. */ - counts?: InventoryCount[]; - /** Changes created for the request. */ - changes?: InventoryChange[]; -} - -export const batchChangeInventoryResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - counts: ['counts', optional(array(lazy(() => inventoryCountSchema)))], - changes: ['changes', optional(array(lazy(() => inventoryChangeSchema)))], - } -); diff --git a/src/models/batchDeleteCatalogObjectsRequest.ts b/src/models/batchDeleteCatalogObjectsRequest.ts deleted file mode 100644 index bd3172f8e..000000000 --- a/src/models/batchDeleteCatalogObjectsRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -export interface BatchDeleteCatalogObjectsRequest { - /** - * The IDs of the CatalogObjects to be deleted. When an object is deleted, other objects - * in the graph that depend on that object will be deleted as well (for example, deleting a - * CatalogItem will delete its CatalogItemVariation. - */ - objectIds?: string[] | null; -} - -export const batchDeleteCatalogObjectsRequestSchema: Schema = object( - { objectIds: ['object_ids', optional(nullable(array(string())))] } -); diff --git a/src/models/batchDeleteCatalogObjectsResponse.ts b/src/models/batchDeleteCatalogObjectsResponse.ts deleted file mode 100644 index 081b8efdf..000000000 --- a/src/models/batchDeleteCatalogObjectsResponse.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -export interface BatchDeleteCatalogObjectsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The IDs of all CatalogObjects deleted by this request. */ - deletedObjectIds?: string[]; - /** The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this deletion in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". */ - deletedAt?: string; -} - -export const batchDeleteCatalogObjectsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - deletedObjectIds: ['deleted_object_ids', optional(array(string()))], - deletedAt: ['deleted_at', optional(string())], - } -); diff --git a/src/models/batchRetrieveCatalogObjectsRequest.ts b/src/models/batchRetrieveCatalogObjectsRequest.ts deleted file mode 100644 index b271590e7..000000000 --- a/src/models/batchRetrieveCatalogObjectsRequest.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - array, - bigint, - boolean, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; - -export interface BatchRetrieveCatalogObjectsRequest { - /** The IDs of the CatalogObjects to be retrieved. */ - objectIds: string[]; - /** - * If `true`, the response will include additional objects that are related to the - * requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field - * of the response. These objects are put in the `related_objects` field. Setting this to `true` is - * helpful when the objects are needed for immediate display to a user. - * This process only goes one level deep. Objects referenced by the related objects will not be included. For example, - * if the `objects` field of the response contains a CatalogItem, its associated - * CatalogCategory objects, CatalogTax objects, CatalogImage objects and - * CatalogModifierLists will be returned in the `related_objects` field of the - * response. If the `objects` field of the response contains a CatalogItemVariation, - * its parent CatalogItem will be returned in the `related_objects` field of - * the response. - * Default value: `false` - */ - includeRelatedObjects?: boolean | null; - /** - * The specific version of the catalog objects to be included in the response. - * This allows you to retrieve historical versions of objects. The specified version value is matched against - * the [CatalogObject]($m/CatalogObject)s' `version` attribute. If not included, results will - * be from the current version of the catalog. - */ - catalogVersion?: bigint | null; - /** Indicates whether to include (`true`) or not (`false`) in the response deleted objects, namely, those with the `is_deleted` attribute set to `true`. */ - includeDeletedObjects?: boolean | null; - /** - * Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists - * of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category - * and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned - * in the response payload. - */ - includeCategoryPathToRoot?: boolean | null; -} - -export const batchRetrieveCatalogObjectsRequestSchema: Schema = object( - { - objectIds: ['object_ids', array(string())], - includeRelatedObjects: [ - 'include_related_objects', - optional(nullable(boolean())), - ], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - includeDeletedObjects: [ - 'include_deleted_objects', - optional(nullable(boolean())), - ], - includeCategoryPathToRoot: [ - 'include_category_path_to_root', - optional(nullable(boolean())), - ], - } -); diff --git a/src/models/batchRetrieveCatalogObjectsResponse.ts b/src/models/batchRetrieveCatalogObjectsResponse.ts deleted file mode 100644 index 9b756568e..000000000 --- a/src/models/batchRetrieveCatalogObjectsResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -export interface BatchRetrieveCatalogObjectsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** A list of [CatalogObject](entity:CatalogObject)s returned. */ - objects?: CatalogObject[]; - /** A list of [CatalogObject](entity:CatalogObject)s referenced by the object in the `objects` field. */ - relatedObjects?: CatalogObject[]; -} - -export const batchRetrieveCatalogObjectsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - objects: ['objects', optional(array(lazy(() => catalogObjectSchema)))], - relatedObjects: [ - 'related_objects', - optional(array(lazy(() => catalogObjectSchema))), - ], - } -); diff --git a/src/models/batchRetrieveInventoryChangesRequest.ts b/src/models/batchRetrieveInventoryChangesRequest.ts deleted file mode 100644 index fad416ddd..000000000 --- a/src/models/batchRetrieveInventoryChangesRequest.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - array, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -export interface BatchRetrieveInventoryChangesRequest { - /** - * The filter to return results by `CatalogObject` ID. - * The filter is only applicable when set. The default value is null. - */ - catalogObjectIds?: string[] | null; - /** - * The filter to return results by `Location` ID. - * The filter is only applicable when set. The default value is null. - */ - locationIds?: string[] | null; - /** - * The filter to return results by `InventoryChangeType` values other than `TRANSFER`. - * The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. - */ - types?: string[] | null; - /** - * The filter to return `ADJUSTMENT` query results by - * `InventoryState`. This filter is only applied when set. - * The default value is null. - */ - states?: string[] | null; - /** - * The filter to return results with their `calculated_at` value - * after the given time as specified in an RFC 3339 timestamp. - * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). - */ - updatedAfter?: string | null; - /** - * The filter to return results with their `created_at` or `calculated_at` value - * strictly before the given time as specified in an RFC 3339 timestamp. - * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). - */ - updatedBefore?: string | null; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for the original query. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string | null; - /** The number of [records](entity:InventoryChange) to return. */ - limit?: number | null; -} - -export const batchRetrieveInventoryChangesRequestSchema: Schema = object( - { - catalogObjectIds: [ - 'catalog_object_ids', - optional(nullable(array(string()))), - ], - locationIds: ['location_ids', optional(nullable(array(string())))], - types: ['types', optional(nullable(array(string())))], - states: ['states', optional(nullable(array(string())))], - updatedAfter: ['updated_after', optional(nullable(string()))], - updatedBefore: ['updated_before', optional(nullable(string()))], - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/batchRetrieveInventoryChangesResponse.ts b/src/models/batchRetrieveInventoryChangesResponse.ts deleted file mode 100644 index 06b7ef95b..000000000 --- a/src/models/batchRetrieveInventoryChangesResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { InventoryChange, inventoryChangeSchema } from './inventoryChange'; - -export interface BatchRetrieveInventoryChangesResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The current calculated inventory changes for the requested objects - * and locations. - */ - changes?: InventoryChange[]; - /** - * The pagination cursor to be used in a subsequent request. If unset, - * this is the final response. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string; -} - -export const batchRetrieveInventoryChangesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - changes: ['changes', optional(array(lazy(() => inventoryChangeSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/batchRetrieveInventoryCountsRequest.ts b/src/models/batchRetrieveInventoryCountsRequest.ts deleted file mode 100644 index 78104b844..000000000 --- a/src/models/batchRetrieveInventoryCountsRequest.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { - array, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -export interface BatchRetrieveInventoryCountsRequest { - /** - * The filter to return results by `CatalogObject` ID. - * The filter is applicable only when set. The default is null. - */ - catalogObjectIds?: string[] | null; - /** - * The filter to return results by `Location` ID. - * This filter is applicable only when set. The default is null. - */ - locationIds?: string[] | null; - /** - * The filter to return results with their `calculated_at` value - * after the given time as specified in an RFC 3339 timestamp. - * The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). - */ - updatedAfter?: string | null; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for the original query. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string | null; - /** - * The filter to return results by `InventoryState`. The filter is only applicable when set. - * Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`. - * The default is null. - */ - states?: string[] | null; - /** The number of [records](entity:InventoryCount) to return. */ - limit?: number | null; -} - -export const batchRetrieveInventoryCountsRequestSchema: Schema = object( - { - catalogObjectIds: [ - 'catalog_object_ids', - optional(nullable(array(string()))), - ], - locationIds: ['location_ids', optional(nullable(array(string())))], - updatedAfter: ['updated_after', optional(nullable(string()))], - cursor: ['cursor', optional(nullable(string()))], - states: ['states', optional(nullable(array(string())))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/batchRetrieveInventoryCountsResponse.ts b/src/models/batchRetrieveInventoryCountsResponse.ts deleted file mode 100644 index bf0619221..000000000 --- a/src/models/batchRetrieveInventoryCountsResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { InventoryCount, inventoryCountSchema } from './inventoryCount'; - -export interface BatchRetrieveInventoryCountsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The current calculated inventory counts for the requested objects - * and locations. - */ - counts?: InventoryCount[]; - /** - * The pagination cursor to be used in a subsequent request. If unset, - * this is the final response. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string; -} - -export const batchRetrieveInventoryCountsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - counts: ['counts', optional(array(lazy(() => inventoryCountSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/batchRetrieveOrdersRequest.ts b/src/models/batchRetrieveOrdersRequest.ts deleted file mode 100644 index 26a5d696b..000000000 --- a/src/models/batchRetrieveOrdersRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** - * Defines the fields that are included in requests to the - * `BatchRetrieveOrders` endpoint. - */ -export interface BatchRetrieveOrdersRequest { - /** - * The ID of the location for these orders. This field is optional: omit it to retrieve - * orders within the scope of the current authorization's merchant ID. - */ - locationId?: string | null; - /** The IDs of the orders to retrieve. A maximum of 100 orders can be retrieved per request. */ - orderIds: string[]; -} - -export const batchRetrieveOrdersRequestSchema: Schema = object( - { - locationId: ['location_id', optional(nullable(string()))], - orderIds: ['order_ids', array(string())], - } -); diff --git a/src/models/batchRetrieveOrdersResponse.ts b/src/models/batchRetrieveOrdersResponse.ts deleted file mode 100644 index 5f3929722..000000000 --- a/src/models/batchRetrieveOrdersResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Order, orderSchema } from './order'; - -/** - * Defines the fields that are included in the response body of - * a request to the `BatchRetrieveOrders` endpoint. - */ -export interface BatchRetrieveOrdersResponse { - /** The requested orders. This will omit any requested orders that do not exist. */ - orders?: Order[]; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const batchRetrieveOrdersResponseSchema: Schema = object( - { - orders: ['orders', optional(array(lazy(() => orderSchema)))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/batchUpsertCatalogObjectsRequest.ts b/src/models/batchUpsertCatalogObjectsRequest.ts deleted file mode 100644 index 8084cdcf2..000000000 --- a/src/models/batchUpsertCatalogObjectsRequest.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { array, lazy, object, Schema, string } from '../schema'; -import { - CatalogObjectBatch, - catalogObjectBatchSchema, -} from './catalogObjectBatch'; - -export interface BatchUpsertCatalogObjectsRequest { - /** - * A value you specify that uniquely identifies this - * request among all your requests. A common way to create - * a valid idempotency key is to use a Universally unique - * identifier (UUID). - * If you're unsure whether a particular request was successful, - * you can reattempt it with the same idempotency key without - * worrying about creating duplicate objects. - * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - */ - idempotencyKey: string; - /** - * A batch of CatalogObjects to be inserted/updated atomically. - * The objects within a batch will be inserted in an all-or-nothing fashion, i.e., if an error occurs - * attempting to insert or update an object within a batch, the entire batch will be rejected. However, an error - * in one batch will not affect other batches within the same request. - * For each object, its `updated_at` field is ignored and replaced with a current [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), and its - * `is_deleted` field must not be set to `true`. - * To modify an existing object, supply its ID. To create a new object, use an ID starting - * with `#`. These IDs may be used to create relationships between an object and attributes of - * other objects that reference it. For example, you can create a CatalogItem with - * ID `#ABC` and a CatalogItemVariation with its `item_id` attribute set to - * `#ABC` in order to associate the CatalogItemVariation with its parent - * CatalogItem. - * Any `#`-prefixed IDs are valid only within a single atomic batch, and will be replaced by server-generated IDs. - * Each batch may contain up to 1,000 objects. The total number of objects across all batches for a single request - * may not exceed 10,000. If either of these limits is violated, an error will be returned and no objects will - * be inserted or updated. - */ - batches: CatalogObjectBatch[]; -} - -export const batchUpsertCatalogObjectsRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - batches: ['batches', array(lazy(() => catalogObjectBatchSchema))], - } -); diff --git a/src/models/batchUpsertCatalogObjectsResponse.ts b/src/models/batchUpsertCatalogObjectsResponse.ts deleted file mode 100644 index 1572306e4..000000000 --- a/src/models/batchUpsertCatalogObjectsResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CatalogIdMapping, catalogIdMappingSchema } from './catalogIdMapping'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -export interface BatchUpsertCatalogObjectsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The created successfully created CatalogObjects. */ - objects?: CatalogObject[]; - /** The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". */ - updatedAt?: string; - /** The mapping between client and server IDs for this upsert. */ - idMappings?: CatalogIdMapping[]; -} - -export const batchUpsertCatalogObjectsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - objects: ['objects', optional(array(lazy(() => catalogObjectSchema)))], - updatedAt: ['updated_at', optional(string())], - idMappings: [ - 'id_mappings', - optional(array(lazy(() => catalogIdMappingSchema))), - ], - } -); diff --git a/src/models/booking.ts b/src/models/booking.ts deleted file mode 100644 index e1f0d185c..000000000 --- a/src/models/booking.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { - AppointmentSegment, - appointmentSegmentSchema, -} from './appointmentSegment'; -import { - BookingCreatorDetails, - bookingCreatorDetailsSchema, -} from './bookingCreatorDetails'; - -/** - * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service - * at a given location to a requesting customer in one or more appointment segments. - */ -export interface Booking { - /** A unique ID of this object representing a booking. */ - id?: string; - /** The revision number for the booking used for optimistic concurrency. */ - version?: number; - /** Supported booking statuses. */ - status?: string; - /** The RFC 3339 timestamp specifying the creation time of this booking. */ - createdAt?: string; - /** The RFC 3339 timestamp specifying the most recent update time of this booking. */ - updatedAt?: string; - /** The RFC 3339 timestamp specifying the starting time of this booking. */ - startAt?: string | null; - /** The ID of the [Location](entity:Location) object representing the location where the booked service is provided. Once set when the booking is created, its value cannot be changed. */ - locationId?: string | null; - /** The ID of the [Customer](entity:Customer) object representing the customer receiving the booked service. */ - customerId?: string | null; - /** The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](entity:CatalogObject) instance. */ - customerNote?: string | null; - /** - * The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](entity:CatalogObject) instance. - * This field should not be visible to customers. - */ - sellerNote?: string | null; - /** A list of appointment segments for this booking. */ - appointmentSegments?: AppointmentSegment[] | null; - /** - * Additional time at the end of a booking. - * Applications should not make this field visible to customers of a seller. - */ - transitionTimeMinutes?: number; - /** Whether the booking is of a full business day. */ - allDay?: boolean; - /** Supported types of location where service is provided. */ - locationType?: string; - /** Information about a booking creator. */ - creatorDetails?: BookingCreatorDetails; - /** Supported sources a booking was created from. */ - source?: string; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; -} - -export const bookingSchema: Schema = object({ - id: ['id', optional(string())], - version: ['version', optional(number())], - status: ['status', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - startAt: ['start_at', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - customerId: ['customer_id', optional(nullable(string()))], - customerNote: ['customer_note', optional(nullable(string()))], - sellerNote: ['seller_note', optional(nullable(string()))], - appointmentSegments: [ - 'appointment_segments', - optional(nullable(array(lazy(() => appointmentSegmentSchema)))), - ], - transitionTimeMinutes: ['transition_time_minutes', optional(number())], - allDay: ['all_day', optional(boolean())], - locationType: ['location_type', optional(string())], - creatorDetails: [ - 'creator_details', - optional(lazy(() => bookingCreatorDetailsSchema)), - ], - source: ['source', optional(string())], - address: ['address', optional(lazy(() => addressSchema))], -}); diff --git a/src/models/bookingCreatorDetails.ts b/src/models/bookingCreatorDetails.ts deleted file mode 100644 index f3aca3243..000000000 --- a/src/models/bookingCreatorDetails.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Information about a booking creator. */ -export interface BookingCreatorDetails { - /** Supported types of a booking creator. */ - creatorType?: string; - /** - * The ID of the team member who created the booking, when the booking creator is of the `TEAM_MEMBER` type. - * Access to this field requires seller-level permissions. - */ - teamMemberId?: string; - /** - * The ID of the customer who created the booking, when the booking creator is of the `CUSTOMER` type. - * Access to this field requires seller-level permissions. - */ - customerId?: string; -} - -export const bookingCreatorDetailsSchema: Schema = object( - { - creatorType: ['creator_type', optional(string())], - teamMemberId: ['team_member_id', optional(string())], - customerId: ['customer_id', optional(string())], - } -); diff --git a/src/models/bookingCustomAttributeDeleteRequest.ts b/src/models/bookingCustomAttributeDeleteRequest.ts deleted file mode 100644 index 71109eea2..000000000 --- a/src/models/bookingCustomAttributeDeleteRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** - * Represents an individual delete request in a [BulkDeleteBookingCustomAttributes]($e/BookingCustomAttributes/BulkDeleteBookingCustomAttributes) - * request. An individual request contains a booking ID, the custom attribute to delete, and an optional idempotency key. - */ -export interface BookingCustomAttributeDeleteRequest { - /** The ID of the target [booking](entity:Booking). */ - bookingId: string; - /** - * The key of the custom attribute to delete. This key must match the `key` of a - * custom attribute definition in the Square seller account. If the requesting application is not - * the definition owner, you must use the qualified key. - */ - key: string; -} - -export const bookingCustomAttributeDeleteRequestSchema: Schema = object( - { bookingId: ['booking_id', string()], key: ['key', string()] } -); diff --git a/src/models/bookingCustomAttributeDeleteResponse.ts b/src/models/bookingCustomAttributeDeleteResponse.ts deleted file mode 100644 index 276eaae82..000000000 --- a/src/models/bookingCustomAttributeDeleteResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a response for an individual upsert request in a [BulkDeleteBookingCustomAttributes]($e/BookingCustomAttributes/BulkDeleteBookingCustomAttributes) operation. */ -export interface BookingCustomAttributeDeleteResponse { - /** The ID of the [booking](entity:Booking) associated with the custom attribute. */ - bookingId?: string; - /** Any errors that occurred while processing the individual request. */ - errors?: Error[]; -} - -export const bookingCustomAttributeDeleteResponseSchema: Schema = object( - { - bookingId: ['booking_id', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bookingCustomAttributeUpsertRequest.ts b/src/models/bookingCustomAttributeUpsertRequest.ts deleted file mode 100644 index 20627aa74..000000000 --- a/src/models/bookingCustomAttributeUpsertRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** - * Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes]($e/BookingCustomAttributes/BulkUpsertBookingCustomAttributes) - * request. An individual request contains a booking ID, the custom attribute to create or update, - * and an optional idempotency key. - */ -export interface BookingCustomAttributeUpsertRequest { - /** The ID of the target [booking](entity:Booking). */ - bookingId: string; - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this individual upsert request, used to ensure idempotency. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const bookingCustomAttributeUpsertRequestSchema: Schema = object( - { - bookingId: ['booking_id', string()], - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/bookingCustomAttributeUpsertResponse.ts b/src/models/bookingCustomAttributeUpsertResponse.ts deleted file mode 100644 index 6d84aec5e..000000000 --- a/src/models/bookingCustomAttributeUpsertResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** Represents a response for an individual upsert request in a [BulkUpsertBookingCustomAttributes]($e/BookingCustomAttributes/BulkUpsertBookingCustomAttributes) operation. */ -export interface BookingCustomAttributeUpsertResponse { - /** The ID of the [booking](entity:Booking) associated with the custom attribute. */ - bookingId?: string; - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred while processing the individual request. */ - errors?: Error[]; -} - -export const bookingCustomAttributeUpsertResponseSchema: Schema = object( - { - bookingId: ['booking_id', optional(string())], - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/break.ts b/src/models/break.ts deleted file mode 100644 index 7122ba426..000000000 --- a/src/models/break.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** A record of an employee's break during a shift. */ -export interface Break { - /** The UUID for this object. */ - id?: string; - /** - * RFC 3339; follows the same timezone information as `Shift`. Precision up to - * the minute is respected; seconds are truncated. - */ - startAt: string; - /** - * RFC 3339; follows the same timezone information as `Shift`. Precision up to - * the minute is respected; seconds are truncated. - */ - endAt?: string | null; - /** The `BreakType` that this `Break` was templated on. */ - breakTypeId: string; - /** A human-readable name. */ - name: string; - /** - * Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of - * the break. - */ - expectedDuration: string; - /** - * Whether this break counts towards time worked for compensation - * purposes. - */ - isPaid: boolean; -} - -export const breakSchema: Schema = object({ - id: ['id', optional(string())], - startAt: ['start_at', string()], - endAt: ['end_at', optional(nullable(string()))], - breakTypeId: ['break_type_id', string()], - name: ['name', string()], - expectedDuration: ['expected_duration', string()], - isPaid: ['is_paid', boolean()], -}); diff --git a/src/models/breakType.ts b/src/models/breakType.ts deleted file mode 100644 index cd23d94d1..000000000 --- a/src/models/breakType.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { boolean, number, object, optional, Schema, string } from '../schema'; - -/** - * A defined break template that sets an expectation for possible `Break` - * instances on a `Shift`. - */ -export interface BreakType { - /** The UUID for this object. */ - id?: string; - /** The ID of the business location this type of break applies to. */ - locationId: string; - /** - * A human-readable name for this type of break. The name is displayed to - * employees in Square products. - */ - breakName: string; - /** - * Format: RFC-3339 P[n]Y[n]M[n]DT[n]H[n]M[n]S. The expected length of - * this break. Precision less than minutes is truncated. - * Example for break expected duration of 15 minutes: T15M - */ - expectedDuration: string; - /** - * Whether this break counts towards time worked for compensation - * purposes. - */ - isPaid: boolean; - /** - * Used for resolving concurrency issues. The request fails if the version - * provided does not match the server version at the time of the request. If a value is not - * provided, Square's servers execute a "blind" write; potentially - * overwriting another writer's data. - */ - version?: number; - /** A read-only timestamp in RFC 3339 format. */ - createdAt?: string; - /** A read-only timestamp in RFC 3339 format. */ - updatedAt?: string; -} - -export const breakTypeSchema: Schema = object({ - id: ['id', optional(string())], - locationId: ['location_id', string()], - breakName: ['break_name', string()], - expectedDuration: ['expected_duration', string()], - isPaid: ['is_paid', boolean()], - version: ['version', optional(number())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/bulkCreateCustomerData.ts b/src/models/bulkCreateCustomerData.ts deleted file mode 100644 index b93840c3c..000000000 --- a/src/models/bulkCreateCustomerData.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Address, addressSchema } from './address'; -import { CustomerTaxIds, customerTaxIdsSchema } from './customerTaxIds'; - -/** - * Defines the customer data provided in individual create requests for a - * [BulkCreateCustomers]($e/Customers/BulkCreateCustomers) operation. - */ -export interface BulkCreateCustomerData { - /** The given name (that is, the first name) associated with the customer profile. */ - givenName?: string | null; - /** The family name (that is, the last name) associated with the customer profile. */ - familyName?: string | null; - /** A business name associated with the customer profile. */ - companyName?: string | null; - /** A nickname for the customer profile. */ - nickname?: string | null; - /** The email address associated with the customer profile. */ - emailAddress?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; - /** - * The phone number associated with the customer profile. The phone number must be valid - * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, - * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). - */ - phoneNumber?: string | null; - /** - * An optional second ID used to associate the customer profile with an - * entity in another system. - */ - referenceId?: string | null; - /** A custom note associated with the customer profile. */ - note?: string | null; - /** - * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. - * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. - * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or - * `0000` if a birth year is not specified. - */ - birthday?: string | null; - /** - * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. - * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). - */ - taxIds?: CustomerTaxIds; -} - -export const bulkCreateCustomerDataSchema: Schema = object( - { - givenName: ['given_name', optional(nullable(string()))], - familyName: ['family_name', optional(nullable(string()))], - companyName: ['company_name', optional(nullable(string()))], - nickname: ['nickname', optional(nullable(string()))], - emailAddress: ['email_address', optional(nullable(string()))], - address: ['address', optional(lazy(() => addressSchema))], - phoneNumber: ['phone_number', optional(nullable(string()))], - referenceId: ['reference_id', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - birthday: ['birthday', optional(nullable(string()))], - taxIds: ['tax_ids', optional(lazy(() => customerTaxIdsSchema))], - } -); diff --git a/src/models/bulkCreateCustomersRequest.ts b/src/models/bulkCreateCustomersRequest.ts deleted file mode 100644 index 29d0ed105..000000000 --- a/src/models/bulkCreateCustomersRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkCreateCustomerData, - bulkCreateCustomerDataSchema, -} from './bulkCreateCustomerData'; - -/** - * Defines the body parameters that can be included in requests to the - * [BulkCreateCustomers]($e/Customers/BulkCreateCustomers) endpoint. - */ -export interface BulkCreateCustomersRequest { - /** - * A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }` - * key-value pairs. - * Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) - * that uniquely identifies the create request. Each value contains the customer data used to create the - * customer profile. - */ - customers: Record; -} - -export const bulkCreateCustomersRequestSchema: Schema = object( - { customers: ['customers', dict(lazy(() => bulkCreateCustomerDataSchema))] } -); diff --git a/src/models/bulkCreateCustomersResponse.ts b/src/models/bulkCreateCustomersResponse.ts deleted file mode 100644 index 9895d1b03..000000000 --- a/src/models/bulkCreateCustomersResponse.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - CreateCustomerResponse, - createCustomerResponseSchema, -} from './createCustomerResponse'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields included in the response body from the - * [BulkCreateCustomers]($e/Customers/BulkCreateCustomers) endpoint. - */ -export interface BulkCreateCustomersResponse { - /** - * A map of responses that correspond to individual create requests, represented by - * key-value pairs. - * Each key is the idempotency key that was provided for a create request and each value - * is the corresponding response. - * If the request succeeds, the value is the new customer profile. - * If the request fails, the value contains any errors that occurred during the request. - */ - responses?: Record; - /** Any top-level errors that prevented the bulk operation from running. */ - errors?: Error[]; -} - -export const bulkCreateCustomersResponseSchema: Schema = object( - { - responses: [ - 'responses', - optional(dict(lazy(() => createCustomerResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkCreateTeamMembersRequest.ts b/src/models/bulkCreateTeamMembersRequest.ts deleted file mode 100644 index 6309199f5..000000000 --- a/src/models/bulkCreateTeamMembersRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - CreateTeamMemberRequest, - createTeamMemberRequestSchema, -} from './createTeamMemberRequest'; - -/** Represents a bulk create request for `TeamMember` objects. */ -export interface BulkCreateTeamMembersRequest { - /** - * The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. - * The maximum number of create objects is 25. - * If you include a team member's `wage_setting`, you must provide `job_id` for each job assignment. To get job IDs, - * call [ListJobs](api-endpoint:Team-ListJobs). - */ - teamMembers: Record; -} - -export const bulkCreateTeamMembersRequestSchema: Schema = object( - { - teamMembers: [ - 'team_members', - dict(lazy(() => createTeamMemberRequestSchema)), - ], - } -); diff --git a/src/models/bulkCreateTeamMembersResponse.ts b/src/models/bulkCreateTeamMembersResponse.ts deleted file mode 100644 index 62539e281..000000000 --- a/src/models/bulkCreateTeamMembersResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - CreateTeamMemberResponse, - createTeamMemberResponseSchema, -} from './createTeamMemberResponse'; -import { Error, errorSchema } from './error'; - -/** Represents a response from a bulk create request containing the created `TeamMember` objects or error messages. */ -export interface BulkCreateTeamMembersResponse { - /** The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. */ - teamMembers?: Record; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkCreateTeamMembersResponseSchema: Schema = object( - { - teamMembers: [ - 'team_members', - optional(dict(lazy(() => createTeamMemberResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkCreateVendorsRequest.ts b/src/models/bulkCreateVendorsRequest.ts deleted file mode 100644 index e4e6f051f..000000000 --- a/src/models/bulkCreateVendorsRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { Vendor, vendorSchema } from './vendor'; - -/** Represents an input to a call to [BulkCreateVendors]($e/Vendors/BulkCreateVendors). */ -export interface BulkCreateVendorsRequest { - /** Specifies a set of new [Vendor](entity:Vendor) objects as represented by a collection of idempotency-key/`Vendor`-object pairs. */ - vendors: Record; -} - -export const bulkCreateVendorsRequestSchema: Schema = object( - { vendors: ['vendors', dict(lazy(() => vendorSchema))] } -); diff --git a/src/models/bulkCreateVendorsResponse.ts b/src/models/bulkCreateVendorsResponse.ts deleted file mode 100644 index b9ebc7396..000000000 --- a/src/models/bulkCreateVendorsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - CreateVendorResponse, - createVendorResponseSchema, -} from './createVendorResponse'; -import { Error, errorSchema } from './error'; - -/** Represents an output from a call to [BulkCreateVendors]($e/Vendors/BulkCreateVendors). */ -export interface BulkCreateVendorsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * A set of [CreateVendorResponse](entity:CreateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor) - * objects or error responses for failed attempts. The set is represented by - * a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The idempotency keys correspond to those specified - * in the input. - */ - responses?: Record; -} - -export const bulkCreateVendorsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - responses: [ - 'responses', - optional(dict(lazy(() => createVendorResponseSchema))), - ], - } -); diff --git a/src/models/bulkDeleteBookingCustomAttributesRequest.ts b/src/models/bulkDeleteBookingCustomAttributesRequest.ts deleted file mode 100644 index 4c7a98714..000000000 --- a/src/models/bulkDeleteBookingCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BookingCustomAttributeDeleteRequest, - bookingCustomAttributeDeleteRequestSchema, -} from './bookingCustomAttributeDeleteRequest'; - -/** Represents a [BulkDeleteBookingCustomAttributes]($e/BookingCustomAttributes/BulkDeleteBookingCustomAttributes) request. */ -export interface BulkDeleteBookingCustomAttributesRequest { - /** - * A map containing 1 to 25 individual Delete requests. For each request, provide an - * arbitrary ID that is unique for this `BulkDeleteBookingCustomAttributes` request and the - * information needed to delete a custom attribute. - */ - values: Record; -} - -export const bulkDeleteBookingCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict(lazy(() => bookingCustomAttributeDeleteRequestSchema)), - ], - } -); diff --git a/src/models/bulkDeleteBookingCustomAttributesResponse.ts b/src/models/bulkDeleteBookingCustomAttributesResponse.ts deleted file mode 100644 index 50a5d6959..000000000 --- a/src/models/bulkDeleteBookingCustomAttributesResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - BookingCustomAttributeDeleteResponse, - bookingCustomAttributeDeleteResponseSchema, -} from './bookingCustomAttributeDeleteResponse'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [BulkDeleteBookingCustomAttributes]($e/BookingCustomAttributes/BulkDeleteBookingCustomAttributes) response, - * which contains a map of responses that each corresponds to an individual delete request. - */ -export interface BulkDeleteBookingCustomAttributesResponse { - /** - * A map of responses that correspond to individual delete requests. Each response has the - * same ID as the corresponding request and contains `booking_id` and `errors` field. - */ - values?: Record; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkDeleteBookingCustomAttributesResponseSchema: Schema = object( - { - values: [ - 'values', - optional(dict(lazy(() => bookingCustomAttributeDeleteResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkDeleteCustomersRequest.ts b/src/models/bulkDeleteCustomersRequest.ts deleted file mode 100644 index 23b957c10..000000000 --- a/src/models/bulkDeleteCustomersRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** - * Defines the body parameters that can be included in requests to the - * [BulkDeleteCustomers]($e/Customers/BulkDeleteCustomers) endpoint. - */ -export interface BulkDeleteCustomersRequest { - /** The IDs of the [customer profiles](entity:Customer) to delete. */ - customerIds: string[]; -} - -export const bulkDeleteCustomersRequestSchema: Schema = object( - { customerIds: ['customer_ids', array(string())] } -); diff --git a/src/models/bulkDeleteCustomersResponse.ts b/src/models/bulkDeleteCustomersResponse.ts deleted file mode 100644 index 8176c6a6a..000000000 --- a/src/models/bulkDeleteCustomersResponse.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - DeleteCustomerResponse, - deleteCustomerResponseSchema, -} from './deleteCustomerResponse'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields included in the response body from the - * [BulkDeleteCustomers]($e/Customers/BulkDeleteCustomers) endpoint. - */ -export interface BulkDeleteCustomersResponse { - /** - * A map of responses that correspond to individual delete requests, represented by - * key-value pairs. - * Each key is the customer ID that was specified for a delete request and each value - * is the corresponding response. - * If the request succeeds, the value is an empty object (`{ }`). - * If the request fails, the value contains any errors that occurred during the request. - */ - responses?: Record; - /** Any top-level errors that prevented the bulk operation from running. */ - errors?: Error[]; -} - -export const bulkDeleteCustomersResponseSchema: Schema = object( - { - responses: [ - 'responses', - optional(dict(lazy(() => deleteCustomerResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkDeleteLocationCustomAttributesRequest.ts b/src/models/bulkDeleteLocationCustomAttributesRequest.ts deleted file mode 100644 index a6adf06a0..000000000 --- a/src/models/bulkDeleteLocationCustomAttributesRequest.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest, - bulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestSchema, -} from './bulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest'; - -/** Represents a [BulkDeleteLocationCustomAttributes]($e/LocationCustomAttributes/BulkDeleteLocationCustomAttributes) request. */ -export interface BulkDeleteLocationCustomAttributesRequest { - /** - * The data used to update the `CustomAttribute` objects. - * The keys must be unique and are used to map to the corresponding response. - */ - values: Record< - string, - BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest - >; -} - -export const bulkDeleteLocationCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestSchema - ) - ), - ], - } -); diff --git a/src/models/bulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts b/src/models/bulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts deleted file mode 100644 index 76915bb79..000000000 --- a/src/models/bulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Represents an individual delete request in a [BulkDeleteLocationCustomAttributes]($e/LocationCustomAttributes/BulkDeleteLocationCustomAttributes) - * request. An individual request contains an optional ID of the associated custom attribute definition - * and optional key of the associated custom attribute definition. - */ -export interface BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest { - /** - * The key of the associated custom attribute definition. - * Represented as a qualified key if the requesting app is not the definition owner. - */ - key?: string; -} - -export const bulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequestSchema: Schema = object( - { key: ['key', optional(string())] } -); diff --git a/src/models/bulkDeleteLocationCustomAttributesResponse.ts b/src/models/bulkDeleteLocationCustomAttributesResponse.ts deleted file mode 100644 index 7d6516026..000000000 --- a/src/models/bulkDeleteLocationCustomAttributesResponse.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse, - bulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponseSchema, -} from './bulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [BulkDeleteLocationCustomAttributes]($e/LocationCustomAttributes/BulkDeleteLocationCustomAttributes) response, - * which contains a map of responses that each corresponds to an individual delete request. - */ -export interface BulkDeleteLocationCustomAttributesResponse { - /** - * A map of responses that correspond to individual delete requests. Each response has the - * same key as the corresponding request. - */ - values: Record< - string, - BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse - >; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkDeleteLocationCustomAttributesResponseSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponseSchema - ) - ), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts b/src/models/bulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts deleted file mode 100644 index 69ddf565e..000000000 --- a/src/models/bulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Represents an individual delete response in a [BulkDeleteLocationCustomAttributes]($e/LocationCustomAttributes/BulkDeleteLocationCustomAttributes) - * request. - */ -export interface BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse { - /** The ID of the location associated with the custom attribute. */ - locationId?: string; - /** Errors that occurred while processing the individual LocationCustomAttributeDeleteRequest request */ - errors?: Error[]; -} - -export const bulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponseSchema: Schema = object( - { - locationId: ['location_id', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkDeleteMerchantCustomAttributesRequest.ts b/src/models/bulkDeleteMerchantCustomAttributesRequest.ts deleted file mode 100644 index 26b2ef38b..000000000 --- a/src/models/bulkDeleteMerchantCustomAttributesRequest.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest, - bulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestSchema, -} from './bulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest'; - -/** Represents a [BulkDeleteMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkDeleteMerchantCustomAttributes) request. */ -export interface BulkDeleteMerchantCustomAttributesRequest { - /** - * The data used to update the `CustomAttribute` objects. - * The keys must be unique and are used to map to the corresponding response. - */ - values: Record< - string, - BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest - >; -} - -export const bulkDeleteMerchantCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestSchema - ) - ), - ], - } -); diff --git a/src/models/bulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts b/src/models/bulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts deleted file mode 100644 index f540c9538..000000000 --- a/src/models/bulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Represents an individual delete request in a [BulkDeleteMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkDeleteMerchantCustomAttributes) - * request. An individual request contains an optional ID of the associated custom attribute definition - * and optional key of the associated custom attribute definition. - */ -export interface BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest { - /** - * The key of the associated custom attribute definition. - * Represented as a qualified key if the requesting app is not the definition owner. - */ - key?: string; -} - -export const bulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequestSchema: Schema = object( - { key: ['key', optional(string())] } -); diff --git a/src/models/bulkDeleteMerchantCustomAttributesResponse.ts b/src/models/bulkDeleteMerchantCustomAttributesResponse.ts deleted file mode 100644 index e03266980..000000000 --- a/src/models/bulkDeleteMerchantCustomAttributesResponse.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse, - bulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponseSchema, -} from './bulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [BulkDeleteMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkDeleteMerchantCustomAttributes) response, - * which contains a map of responses that each corresponds to an individual delete request. - */ -export interface BulkDeleteMerchantCustomAttributesResponse { - /** - * A map of responses that correspond to individual delete requests. Each response has the - * same key as the corresponding request. - */ - values: Record< - string, - BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse - >; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkDeleteMerchantCustomAttributesResponseSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponseSchema - ) - ), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts b/src/models/bulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts deleted file mode 100644 index f18eafbb6..000000000 --- a/src/models/bulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkDeleteMerchantCustomAttributes) - * request. - */ -export interface BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse { - /** Errors that occurred while processing the individual MerchantCustomAttributeDeleteRequest request */ - errors?: Error[]; -} - -export const bulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/bulkDeleteOrderCustomAttributesRequest.ts b/src/models/bulkDeleteOrderCustomAttributesRequest.ts deleted file mode 100644 index 24f62f155..000000000 --- a/src/models/bulkDeleteOrderCustomAttributesRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute, - bulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeSchema, -} from './bulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute'; - -/** Represents a bulk delete request for one or more order custom attributes. */ -export interface BulkDeleteOrderCustomAttributesRequest { - /** A map of requests that correspond to individual delete operations for custom attributes. */ - values: Record< - string, - BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute - >; -} - -export const bulkDeleteOrderCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeSchema - ) - ), - ], - } -); diff --git a/src/models/bulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts b/src/models/bulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts deleted file mode 100644 index fc3cbee75..000000000 --- a/src/models/bulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Represents one delete within the bulk operation. */ -export interface BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute { - /** - * The key of the custom attribute to delete. This key must match the key - * of an existing custom attribute definition. - */ - key?: string; - /** The ID of the target [order](entity:Order). */ - orderId: string; -} - -export const bulkDeleteOrderCustomAttributesRequestDeleteCustomAttributeSchema: Schema = object( - { key: ['key', optional(string())], orderId: ['order_id', string()] } -); diff --git a/src/models/bulkDeleteOrderCustomAttributesResponse.ts b/src/models/bulkDeleteOrderCustomAttributesResponse.ts deleted file mode 100644 index 6a4df0a12..000000000 --- a/src/models/bulkDeleteOrderCustomAttributesResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - DeleteOrderCustomAttributeResponse, - deleteOrderCustomAttributeResponseSchema, -} from './deleteOrderCustomAttributeResponse'; -import { Error, errorSchema } from './error'; - -/** Represents a response from deleting one or more order custom attributes. */ -export interface BulkDeleteOrderCustomAttributesResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * A map of responses that correspond to individual delete requests. Each response has the same ID - * as the corresponding request and contains either a `custom_attribute` or an `errors` field. - */ - values: Record; -} - -export const bulkDeleteOrderCustomAttributesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - values: [ - 'values', - dict(lazy(() => deleteOrderCustomAttributeResponseSchema)), - ], - } -); diff --git a/src/models/bulkRetrieveBookingsRequest.ts b/src/models/bulkRetrieveBookingsRequest.ts deleted file mode 100644 index 0c7412f95..000000000 --- a/src/models/bulkRetrieveBookingsRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** Request payload for bulk retrieval of bookings. */ -export interface BulkRetrieveBookingsRequest { - /** A non-empty list of [Booking](entity:Booking) IDs specifying bookings to retrieve. */ - bookingIds: string[]; -} - -export const bulkRetrieveBookingsRequestSchema: Schema = object( - { bookingIds: ['booking_ids', array(string())] } -); diff --git a/src/models/bulkRetrieveBookingsResponse.ts b/src/models/bulkRetrieveBookingsResponse.ts deleted file mode 100644 index 575a7df8e..000000000 --- a/src/models/bulkRetrieveBookingsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - RetrieveBookingResponse, - retrieveBookingResponseSchema, -} from './retrieveBookingResponse'; - -/** Response payload for bulk retrieval of bookings. */ -export interface BulkRetrieveBookingsResponse { - /** Requested bookings returned as a map containing `booking_id` as the key and `RetrieveBookingResponse` as the value. */ - bookings?: Record; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkRetrieveBookingsResponseSchema: Schema = object( - { - bookings: [ - 'bookings', - optional(dict(lazy(() => retrieveBookingResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkRetrieveCustomersRequest.ts b/src/models/bulkRetrieveCustomersRequest.ts deleted file mode 100644 index c7ede3c14..000000000 --- a/src/models/bulkRetrieveCustomersRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** - * Defines the body parameters that can be included in requests to the - * [BulkRetrieveCustomers]($e/Customers/BulkRetrieveCustomers) endpoint. - */ -export interface BulkRetrieveCustomersRequest { - /** The IDs of the [customer profiles](entity:Customer) to retrieve. */ - customerIds: string[]; -} - -export const bulkRetrieveCustomersRequestSchema: Schema = object( - { customerIds: ['customer_ids', array(string())] } -); diff --git a/src/models/bulkRetrieveCustomersResponse.ts b/src/models/bulkRetrieveCustomersResponse.ts deleted file mode 100644 index 7f0d6d5c5..000000000 --- a/src/models/bulkRetrieveCustomersResponse.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - RetrieveCustomerResponse, - retrieveCustomerResponseSchema, -} from './retrieveCustomerResponse'; - -/** - * Defines the fields included in the response body from the - * [BulkRetrieveCustomers]($e/Customers/BulkRetrieveCustomers) endpoint. - */ -export interface BulkRetrieveCustomersResponse { - /** - * A map of responses that correspond to individual retrieve requests, represented by - * key-value pairs. - * Each key is the customer ID that was specified for a retrieve request and each value - * is the corresponding response. - * If the request succeeds, the value is the requested customer profile. - * If the request fails, the value contains any errors that occurred during the request. - */ - responses?: Record; - /** Any top-level errors that prevented the bulk operation from running. */ - errors?: Error[]; -} - -export const bulkRetrieveCustomersResponseSchema: Schema = object( - { - responses: [ - 'responses', - optional(dict(lazy(() => retrieveCustomerResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkRetrieveTeamMemberBookingProfilesRequest.ts b/src/models/bulkRetrieveTeamMemberBookingProfilesRequest.ts deleted file mode 100644 index e22b8693d..000000000 --- a/src/models/bulkRetrieveTeamMemberBookingProfilesRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** Request payload for the [BulkRetrieveTeamMemberBookingProfiles]($e/Bookings/BulkRetrieveTeamMemberBookingProfiles) endpoint. */ -export interface BulkRetrieveTeamMemberBookingProfilesRequest { - /** A non-empty list of IDs of team members whose booking profiles you want to retrieve. */ - teamMemberIds: string[]; -} - -export const bulkRetrieveTeamMemberBookingProfilesRequestSchema: Schema = object( - { teamMemberIds: ['team_member_ids', array(string())] } -); diff --git a/src/models/bulkRetrieveTeamMemberBookingProfilesResponse.ts b/src/models/bulkRetrieveTeamMemberBookingProfilesResponse.ts deleted file mode 100644 index c89640d40..000000000 --- a/src/models/bulkRetrieveTeamMemberBookingProfilesResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - RetrieveTeamMemberBookingProfileResponse, - retrieveTeamMemberBookingProfileResponseSchema, -} from './retrieveTeamMemberBookingProfileResponse'; - -/** Response payload for the [BulkRetrieveTeamMemberBookingProfiles]($e/Bookings/BulkRetrieveTeamMemberBookingProfiles) endpoint. */ -export interface BulkRetrieveTeamMemberBookingProfilesResponse { - /** The returned team members' booking profiles, as a map with `team_member_id` as the key and [TeamMemberBookingProfile](entity:TeamMemberBookingProfile) the value. */ - teamMemberBookingProfiles?: Record< - string, - RetrieveTeamMemberBookingProfileResponse - >; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkRetrieveTeamMemberBookingProfilesResponseSchema: Schema = object( - { - teamMemberBookingProfiles: [ - 'team_member_booking_profiles', - optional( - dict(lazy(() => retrieveTeamMemberBookingProfileResponseSchema)) - ), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkRetrieveVendorsRequest.ts b/src/models/bulkRetrieveVendorsRequest.ts deleted file mode 100644 index ac08e5545..000000000 --- a/src/models/bulkRetrieveVendorsRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** Represents an input to a call to [BulkRetrieveVendors]($e/Vendors/BulkRetrieveVendors). */ -export interface BulkRetrieveVendorsRequest { - /** IDs of the [Vendor](entity:Vendor) objects to retrieve. */ - vendorIds?: string[] | null; -} - -export const bulkRetrieveVendorsRequestSchema: Schema = object( - { vendorIds: ['vendor_ids', optional(nullable(array(string())))] } -); diff --git a/src/models/bulkRetrieveVendorsResponse.ts b/src/models/bulkRetrieveVendorsResponse.ts deleted file mode 100644 index 41b99a508..000000000 --- a/src/models/bulkRetrieveVendorsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - RetrieveVendorResponse, - retrieveVendorResponseSchema, -} from './retrieveVendorResponse'; - -/** Represents an output from a call to [BulkRetrieveVendors]($e/Vendors/BulkRetrieveVendors). */ -export interface BulkRetrieveVendorsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The set of [RetrieveVendorResponse](entity:RetrieveVendorResponse) objects encapsulating successfully retrieved [Vendor](entity:Vendor) - * objects or error responses for failed attempts. The set is represented by - * a collection of `Vendor`-ID/`Vendor`-object or `Vendor`-ID/error-object pairs. - */ - responses?: Record; -} - -export const bulkRetrieveVendorsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - responses: [ - 'responses', - optional(dict(lazy(() => retrieveVendorResponseSchema))), - ], - } -); diff --git a/src/models/bulkSwapPlanRequest.ts b/src/models/bulkSwapPlanRequest.ts deleted file mode 100644 index e766d9f8c..000000000 --- a/src/models/bulkSwapPlanRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** - * Defines input parameters in a call to the - * [BulkSwapPlan]($e/Subscriptions/BulkSwapPlan) endpoint. - */ -export interface BulkSwapPlanRequest { - /** - * The ID of the new subscription plan variation. - * This field is required. - */ - newPlanVariationId: string; - /** - * The ID of the plan variation whose subscriptions should be swapped. Active subscriptions - * using this plan variation will be subscribed to the new plan variation on their next billing - * day. - */ - oldPlanVariationId: string; - /** The ID of the location to associate with the swapped subscriptions. */ - locationId: string; -} - -export const bulkSwapPlanRequestSchema: Schema = object({ - newPlanVariationId: ['new_plan_variation_id', string()], - oldPlanVariationId: ['old_plan_variation_id', string()], - locationId: ['location_id', string()], -}); diff --git a/src/models/bulkSwapPlanResponse.ts b/src/models/bulkSwapPlanResponse.ts deleted file mode 100644 index 26b8b8b2c..000000000 --- a/src/models/bulkSwapPlanResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, number, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines output parameters in a response of the - * [BulkSwapPlan]($e/Subscriptions/BulkSwapPlan) endpoint. - */ -export interface BulkSwapPlanResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** The number of affected subscriptions. */ - affectedSubscriptions?: number; -} - -export const bulkSwapPlanResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - affectedSubscriptions: ['affected_subscriptions', optional(number())], -}); diff --git a/src/models/bulkUpdateCustomerData.ts b/src/models/bulkUpdateCustomerData.ts deleted file mode 100644 index 25205f41d..000000000 --- a/src/models/bulkUpdateCustomerData.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { - bigint, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { CustomerTaxIds, customerTaxIdsSchema } from './customerTaxIds'; - -/** - * Defines the customer data provided in individual update requests for a - * [BulkUpdateCustomers]($e/Customers/BulkUpdateCustomers) operation. - */ -export interface BulkUpdateCustomerData { - /** The given name (that is, the first name) associated with the customer profile. */ - givenName?: string | null; - /** The family name (that is, the last name) associated with the customer profile. */ - familyName?: string | null; - /** A business name associated with the customer profile. */ - companyName?: string | null; - /** A nickname for the customer profile. */ - nickname?: string | null; - /** The email address associated with the customer profile. */ - emailAddress?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; - /** - * The phone number associated with the customer profile. The phone number must be valid - * and can contain 9–16 digits, with an optional `+` prefix and country code. For more information, - * see [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). - */ - phoneNumber?: string | null; - /** - * An optional second ID used to associate the customer profile with an - * entity in another system. - */ - referenceId?: string | null; - /** An custom note associates with the customer profile. */ - note?: string | null; - /** - * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. - * For example, specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. - * Birthdays are returned in `YYYY-MM-DD` format, where `YYYY` is the specified birth year or - * `0000` if a birth year is not specified. - */ - birthday?: string | null; - /** - * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. - * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). - */ - taxIds?: CustomerTaxIds; - /** - * The current version of the customer profile. - * As a best practice, you should include this field to enable - * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) - * control. - */ - version?: bigint; -} - -export const bulkUpdateCustomerDataSchema: Schema = object( - { - givenName: ['given_name', optional(nullable(string()))], - familyName: ['family_name', optional(nullable(string()))], - companyName: ['company_name', optional(nullable(string()))], - nickname: ['nickname', optional(nullable(string()))], - emailAddress: ['email_address', optional(nullable(string()))], - address: ['address', optional(lazy(() => addressSchema))], - phoneNumber: ['phone_number', optional(nullable(string()))], - referenceId: ['reference_id', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - birthday: ['birthday', optional(nullable(string()))], - taxIds: ['tax_ids', optional(lazy(() => customerTaxIdsSchema))], - version: ['version', optional(bigint())], - } -); diff --git a/src/models/bulkUpdateCustomersRequest.ts b/src/models/bulkUpdateCustomersRequest.ts deleted file mode 100644 index 61f97b064..000000000 --- a/src/models/bulkUpdateCustomersRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkUpdateCustomerData, - bulkUpdateCustomerDataSchema, -} from './bulkUpdateCustomerData'; - -/** - * Defines the body parameters that can be included in requests to the - * [BulkUpdateCustomers]($e/Customers/BulkUpdateCustomers) endpoint. - */ -export interface BulkUpdateCustomersRequest { - /** - * A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }` - * key-value pairs. - * Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile - * that was created by merging existing profiles, provide the ID of the newly created profile. - * Each value contains the updated customer data. Only new or changed fields are required. To add or - * update a field, specify the new value. To remove a field, specify `null`. - */ - customers: Record; -} - -export const bulkUpdateCustomersRequestSchema: Schema = object( - { customers: ['customers', dict(lazy(() => bulkUpdateCustomerDataSchema))] } -); diff --git a/src/models/bulkUpdateCustomersResponse.ts b/src/models/bulkUpdateCustomersResponse.ts deleted file mode 100644 index 78e99fe7a..000000000 --- a/src/models/bulkUpdateCustomersResponse.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - UpdateCustomerResponse, - updateCustomerResponseSchema, -} from './updateCustomerResponse'; - -/** - * Defines the fields included in the response body from the - * [BulkUpdateCustomers]($e/Customers/BulkUpdateCustomers) endpoint. - */ -export interface BulkUpdateCustomersResponse { - /** - * A map of responses that correspond to individual update requests, represented by - * key-value pairs. - * Each key is the customer ID that was specified for an update request and each value - * is the corresponding response. - * If the request succeeds, the value is the updated customer profile. - * If the request fails, the value contains any errors that occurred during the request. - */ - responses?: Record; - /** Any top-level errors that prevented the bulk operation from running. */ - errors?: Error[]; -} - -export const bulkUpdateCustomersResponseSchema: Schema = object( - { - responses: [ - 'responses', - optional(dict(lazy(() => updateCustomerResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpdateTeamMembersRequest.ts b/src/models/bulkUpdateTeamMembersRequest.ts deleted file mode 100644 index a71573294..000000000 --- a/src/models/bulkUpdateTeamMembersRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - UpdateTeamMemberRequest, - updateTeamMemberRequestSchema, -} from './updateTeamMemberRequest'; - -/** Represents a bulk update request for `TeamMember` objects. */ -export interface BulkUpdateTeamMembersRequest { - /** - * The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. - * The maximum number of update objects is 25. - * For each team member, include the fields to add, change, or clear. Fields can be cleared using a null value. - * To update `wage_setting.job_assignments`, you must provide the complete list of job assignments. If needed, - * call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values. - */ - teamMembers: Record; -} - -export const bulkUpdateTeamMembersRequestSchema: Schema = object( - { - teamMembers: [ - 'team_members', - dict(lazy(() => updateTeamMemberRequestSchema)), - ], - } -); diff --git a/src/models/bulkUpdateTeamMembersResponse.ts b/src/models/bulkUpdateTeamMembersResponse.ts deleted file mode 100644 index a6feb57eb..000000000 --- a/src/models/bulkUpdateTeamMembersResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - UpdateTeamMemberResponse, - updateTeamMemberResponseSchema, -} from './updateTeamMemberResponse'; - -/** Represents a response from a bulk update request containing the updated `TeamMember` objects or error messages. */ -export interface BulkUpdateTeamMembersResponse { - /** The successfully updated `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. */ - teamMembers?: Record; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkUpdateTeamMembersResponseSchema: Schema = object( - { - teamMembers: [ - 'team_members', - optional(dict(lazy(() => updateTeamMemberResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpdateVendorsRequest.ts b/src/models/bulkUpdateVendorsRequest.ts deleted file mode 100644 index d902469cf..000000000 --- a/src/models/bulkUpdateVendorsRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - UpdateVendorRequest, - updateVendorRequestSchema, -} from './updateVendorRequest'; - -/** Represents an input to a call to [BulkUpdateVendors]($e/Vendors/BulkUpdateVendors). */ -export interface BulkUpdateVendorsRequest { - /** - * A set of [UpdateVendorRequest](entity:UpdateVendorRequest) objects encapsulating to-be-updated [Vendor](entity:Vendor) - * objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorRequest`-object pairs. - */ - vendors: Record; -} - -export const bulkUpdateVendorsRequestSchema: Schema = object( - { vendors: ['vendors', dict(lazy(() => updateVendorRequestSchema))] } -); diff --git a/src/models/bulkUpdateVendorsResponse.ts b/src/models/bulkUpdateVendorsResponse.ts deleted file mode 100644 index f4f38d545..000000000 --- a/src/models/bulkUpdateVendorsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - UpdateVendorResponse, - updateVendorResponseSchema, -} from './updateVendorResponse'; - -/** Represents an output from a call to [BulkUpdateVendors]($e/Vendors/BulkUpdateVendors). */ -export interface BulkUpdateVendorsResponse { - /** Errors encountered when the request fails. */ - errors?: Error[]; - /** - * A set of [UpdateVendorResponse](entity:UpdateVendorResponse) objects encapsulating successfully created [Vendor](entity:Vendor) - * objects or error responses for failed attempts. The set is represented by a collection of `Vendor`-ID/`UpdateVendorResponse`-object or - * `Vendor`-ID/error-object pairs. - */ - responses?: Record; -} - -export const bulkUpdateVendorsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - responses: [ - 'responses', - optional(dict(lazy(() => updateVendorResponseSchema))), - ], - } -); diff --git a/src/models/bulkUpsertBookingCustomAttributesRequest.ts b/src/models/bulkUpsertBookingCustomAttributesRequest.ts deleted file mode 100644 index adb650c83..000000000 --- a/src/models/bulkUpsertBookingCustomAttributesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BookingCustomAttributeUpsertRequest, - bookingCustomAttributeUpsertRequestSchema, -} from './bookingCustomAttributeUpsertRequest'; - -/** Represents a [BulkUpsertBookingCustomAttributes]($e/BookingCustomAttributes/BulkUpsertBookingCustomAttributes) request. */ -export interface BulkUpsertBookingCustomAttributesRequest { - /** - * A map containing 1 to 25 individual upsert requests. For each request, provide an - * arbitrary ID that is unique for this `BulkUpsertBookingCustomAttributes` request and the - * information needed to create or update a custom attribute. - */ - values: Record; -} - -export const bulkUpsertBookingCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict(lazy(() => bookingCustomAttributeUpsertRequestSchema)), - ], - } -); diff --git a/src/models/bulkUpsertBookingCustomAttributesResponse.ts b/src/models/bulkUpsertBookingCustomAttributesResponse.ts deleted file mode 100644 index cfc719f7c..000000000 --- a/src/models/bulkUpsertBookingCustomAttributesResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - BookingCustomAttributeUpsertResponse, - bookingCustomAttributeUpsertResponseSchema, -} from './bookingCustomAttributeUpsertResponse'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [BulkUpsertBookingCustomAttributes]($e/BookingCustomAttributes/BulkUpsertBookingCustomAttributes) response, - * which contains a map of responses that each corresponds to an individual upsert request. - */ -export interface BulkUpsertBookingCustomAttributesResponse { - /** - * A map of responses that correspond to individual upsert requests. Each response has the - * same ID as the corresponding request and contains either a `booking_id` and `custom_attribute` or an `errors` field. - */ - values?: Record; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkUpsertBookingCustomAttributesResponseSchema: Schema = object( - { - values: [ - 'values', - optional(dict(lazy(() => bookingCustomAttributeUpsertResponseSchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpsertCustomerCustomAttributesRequest.ts b/src/models/bulkUpsertCustomerCustomAttributesRequest.ts deleted file mode 100644 index bad680b36..000000000 --- a/src/models/bulkUpsertCustomerCustomAttributesRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest, - bulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestSchema, -} from './bulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest'; - -/** Represents a [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) request. */ -export interface BulkUpsertCustomerCustomAttributesRequest { - /** - * A map containing 1 to 25 individual upsert requests. For each request, provide an - * arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the - * information needed to create or update a custom attribute. - */ - values: Record< - string, - BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest - >; -} - -export const bulkUpsertCustomerCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestSchema - ) - ), - ], - } -); diff --git a/src/models/bulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts b/src/models/bulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts deleted file mode 100644 index 9de367d30..000000000 --- a/src/models/bulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** - * Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) - * request. An individual request contains a customer ID, the custom attribute to create or update, - * and an optional idempotency key. - */ -export interface BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest { - /** The ID of the target [customer profile](entity:Customer). */ - customerId: string; - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this individual upsert request, used to ensure idempotency. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const bulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequestSchema: Schema = object( - { - customerId: ['customer_id', string()], - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/bulkUpsertCustomerCustomAttributesResponse.ts b/src/models/bulkUpsertCustomerCustomAttributesResponse.ts deleted file mode 100644 index ccb9f1b23..000000000 --- a/src/models/bulkUpsertCustomerCustomAttributesResponse.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - BulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse, - bulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponseSchema, -} from './bulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) response, - * which contains a map of responses that each corresponds to an individual upsert request. - */ -export interface BulkUpsertCustomerCustomAttributesResponse { - /** - * A map of responses that correspond to individual upsert requests. Each response has the - * same ID as the corresponding request and contains either a `customer_id` and `custom_attribute` or an `errors` field. - */ - values?: Record< - string, - BulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse - >; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkUpsertCustomerCustomAttributesResponseSchema: Schema = object( - { - values: [ - 'values', - optional( - dict( - lazy( - () => - bulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponseSchema - ) - ) - ), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts b/src/models/bulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts deleted file mode 100644 index 5fe34e81d..000000000 --- a/src/models/bulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes]($e/CustomerCustomAttributes/BulkUpsertCustomerCustomAttributes) operation. */ -export interface BulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse { - /** The ID of the customer profile associated with the custom attribute. */ - customerId?: string; - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred while processing the individual request. */ - errors?: Error[]; -} - -export const bulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponseSchema: Schema = object( - { - customerId: ['customer_id', optional(string())], - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpsertLocationCustomAttributesRequest.ts b/src/models/bulkUpsertLocationCustomAttributesRequest.ts deleted file mode 100644 index 33fe782c2..000000000 --- a/src/models/bulkUpsertLocationCustomAttributesRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest, - bulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestSchema, -} from './bulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest'; - -/** Represents a [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) request. */ -export interface BulkUpsertLocationCustomAttributesRequest { - /** - * A map containing 1 to 25 individual upsert requests. For each request, provide an - * arbitrary ID that is unique for this `BulkUpsertLocationCustomAttributes` request and the - * information needed to create or update a custom attribute. - */ - values: Record< - string, - BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest - >; -} - -export const bulkUpsertLocationCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestSchema - ) - ), - ], - } -); diff --git a/src/models/bulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts b/src/models/bulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts deleted file mode 100644 index ef03b2c40..000000000 --- a/src/models/bulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** - * Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) - * request. An individual request contains a location ID, the custom attribute to create or update, - * and an optional idempotency key. - */ -export interface BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest { - /** The ID of the target [location](entity:Location). */ - locationId: string; - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this individual upsert request, used to ensure idempotency. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const bulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequestSchema: Schema = object( - { - locationId: ['location_id', string()], - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/bulkUpsertLocationCustomAttributesResponse.ts b/src/models/bulkUpsertLocationCustomAttributesResponse.ts deleted file mode 100644 index 98f1b9308..000000000 --- a/src/models/bulkUpsertLocationCustomAttributesResponse.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse, - bulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponseSchema, -} from './bulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) response, - * which contains a map of responses that each corresponds to an individual upsert request. - */ -export interface BulkUpsertLocationCustomAttributesResponse { - /** - * A map of responses that correspond to individual upsert requests. Each response has the - * same ID as the corresponding request and contains either a `location_id` and `custom_attribute` or an `errors` field. - */ - values?: Record< - string, - BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse - >; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkUpsertLocationCustomAttributesResponseSchema: Schema = object( - { - values: [ - 'values', - optional( - dict( - lazy( - () => - bulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponseSchema - ) - ) - ), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts b/src/models/bulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts deleted file mode 100644 index 56cbe2ad4..000000000 --- a/src/models/bulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpsertLocationCustomAttributes) operation. */ -export interface BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse { - /** The ID of the location associated with the custom attribute. */ - locationId?: string; - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred while processing the individual request. */ - errors?: Error[]; -} - -export const bulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponseSchema: Schema = object( - { - locationId: ['location_id', optional(string())], - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpsertMerchantCustomAttributesRequest.ts b/src/models/bulkUpsertMerchantCustomAttributesRequest.ts deleted file mode 100644 index 0a3cf16d8..000000000 --- a/src/models/bulkUpsertMerchantCustomAttributesRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest, - bulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestSchema, -} from './bulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest'; - -/** Represents a [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) request. */ -export interface BulkUpsertMerchantCustomAttributesRequest { - /** - * A map containing 1 to 25 individual upsert requests. For each request, provide an - * arbitrary ID that is unique for this `BulkUpsertMerchantCustomAttributes` request and the - * information needed to create or update a custom attribute. - */ - values: Record< - string, - BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest - >; -} - -export const bulkUpsertMerchantCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestSchema - ) - ), - ], - } -); diff --git a/src/models/bulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts b/src/models/bulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts deleted file mode 100644 index 3b73d9e4e..000000000 --- a/src/models/bulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** - * Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) - * request. An individual request contains a merchant ID, the custom attribute to create or update, - * and an optional idempotency key. - */ -export interface BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest { - /** The ID of the target [merchant](entity:Merchant). */ - merchantId: string; - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this individual upsert request, used to ensure idempotency. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const bulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequestSchema: Schema = object( - { - merchantId: ['merchant_id', string()], - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/bulkUpsertMerchantCustomAttributesResponse.ts b/src/models/bulkUpsertMerchantCustomAttributesResponse.ts deleted file mode 100644 index b1270110f..000000000 --- a/src/models/bulkUpsertMerchantCustomAttributesResponse.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { - BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse, - bulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponseSchema, -} from './bulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) response, - * which contains a map of responses that each corresponds to an individual upsert request. - */ -export interface BulkUpsertMerchantCustomAttributesResponse { - /** - * A map of responses that correspond to individual upsert requests. Each response has the - * same ID as the corresponding request and contains either a `merchant_id` and `custom_attribute` or an `errors` field. - */ - values?: Record< - string, - BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse - >; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const bulkUpsertMerchantCustomAttributesResponseSchema: Schema = object( - { - values: [ - 'values', - optional( - dict( - lazy( - () => - bulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponseSchema - ) - ) - ), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts b/src/models/bulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts deleted file mode 100644 index 21335ace7..000000000 --- a/src/models/bulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** Represents a response for an individual upsert request in a [BulkUpsertMerchantCustomAttributes]($e/MerchantCustomAttributes/BulkUpsertMerchantCustomAttributes) operation. */ -export interface BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse { - /** The ID of the merchant associated with the custom attribute. */ - merchantId?: string; - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred while processing the individual request. */ - errors?: Error[]; -} - -export const bulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponseSchema: Schema = object( - { - merchantId: ['merchant_id', optional(string())], - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/bulkUpsertOrderCustomAttributesRequest.ts b/src/models/bulkUpsertOrderCustomAttributesRequest.ts deleted file mode 100644 index 8f89d2a19..000000000 --- a/src/models/bulkUpsertOrderCustomAttributesRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { dict, lazy, object, Schema } from '../schema'; -import { - BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute, - bulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeSchema, -} from './bulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute'; - -/** Represents a bulk upsert request for one or more order custom attributes. */ -export interface BulkUpsertOrderCustomAttributesRequest { - /** A map of requests that correspond to individual upsert operations for custom attributes. */ - values: Record< - string, - BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute - >; -} - -export const bulkUpsertOrderCustomAttributesRequestSchema: Schema = object( - { - values: [ - 'values', - dict( - lazy( - () => - bulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeSchema - ) - ), - ], - } -); diff --git a/src/models/bulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts b/src/models/bulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts deleted file mode 100644 index 40cafe717..000000000 --- a/src/models/bulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** Represents one upsert within the bulk operation. */ -export interface BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this request, used to ensure idempotency. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; - /** The ID of the target [order](entity:Order). */ - orderId: string; -} - -export const bulkUpsertOrderCustomAttributesRequestUpsertCustomAttributeSchema: Schema = object( - { - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - orderId: ['order_id', string()], - } -); diff --git a/src/models/bulkUpsertOrderCustomAttributesResponse.ts b/src/models/bulkUpsertOrderCustomAttributesResponse.ts deleted file mode 100644 index 82616c876..000000000 --- a/src/models/bulkUpsertOrderCustomAttributesResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, dict, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - UpsertOrderCustomAttributeResponse, - upsertOrderCustomAttributeResponseSchema, -} from './upsertOrderCustomAttributeResponse'; - -/** Represents a response from a bulk upsert of order custom attributes. */ -export interface BulkUpsertOrderCustomAttributesResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** A map of responses that correspond to individual upsert operations for custom attributes. */ - values: Record; -} - -export const bulkUpsertOrderCustomAttributesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - values: [ - 'values', - dict(lazy(() => upsertOrderCustomAttributeResponseSchema)), - ], - } -); diff --git a/src/models/businessAppointmentSettings.ts b/src/models/businessAppointmentSettings.ts deleted file mode 100644 index e3cec8560..000000000 --- a/src/models/businessAppointmentSettings.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** The service appointment settings, including where and how the service is provided. */ -export interface BusinessAppointmentSettings { - /** - * Types of the location allowed for bookings. - * See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values - */ - locationTypes?: string[] | null; - /** Time units of a service duration for bookings. */ - alignmentTime?: string; - /** The minimum lead time in seconds before a service can be booked. A booking must be created at least this amount of time before its starting time. */ - minBookingLeadTimeSeconds?: number | null; - /** The maximum lead time in seconds before a service can be booked. A booking must be created at most this amount of time before its starting time. */ - maxBookingLeadTimeSeconds?: number | null; - /** - * Indicates whether a customer can choose from all available time slots and have a staff member assigned - * automatically (`true`) or not (`false`). - */ - anyTeamMemberBookingEnabled?: boolean | null; - /** Indicates whether a customer can book multiple services in a single online booking. */ - multipleServiceBookingEnabled?: boolean | null; - /** Types of daily appointment limits. */ - maxAppointmentsPerDayLimitType?: string; - /** The maximum number of daily appointments per team member or per location. */ - maxAppointmentsPerDayLimit?: number | null; - /** The cut-off time in seconds for allowing clients to cancel or reschedule an appointment. */ - cancellationWindowSeconds?: number | 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. - */ - cancellationFeeMoney?: Money; - /** The category of the seller’s cancellation policy. */ - cancellationPolicy?: string; - /** The free-form text of the seller's cancellation policy. */ - cancellationPolicyText?: string | null; - /** Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`). */ - skipBookingFlowStaffSelection?: boolean | null; -} - -export const businessAppointmentSettingsSchema: Schema = object( - { - locationTypes: ['location_types', optional(nullable(array(string())))], - alignmentTime: ['alignment_time', optional(string())], - minBookingLeadTimeSeconds: [ - 'min_booking_lead_time_seconds', - optional(nullable(number())), - ], - maxBookingLeadTimeSeconds: [ - 'max_booking_lead_time_seconds', - optional(nullable(number())), - ], - anyTeamMemberBookingEnabled: [ - 'any_team_member_booking_enabled', - optional(nullable(boolean())), - ], - multipleServiceBookingEnabled: [ - 'multiple_service_booking_enabled', - optional(nullable(boolean())), - ], - maxAppointmentsPerDayLimitType: [ - 'max_appointments_per_day_limit_type', - optional(string()), - ], - maxAppointmentsPerDayLimit: [ - 'max_appointments_per_day_limit', - optional(nullable(number())), - ], - cancellationWindowSeconds: [ - 'cancellation_window_seconds', - optional(nullable(number())), - ], - cancellationFeeMoney: [ - 'cancellation_fee_money', - optional(lazy(() => moneySchema)), - ], - cancellationPolicy: ['cancellation_policy', optional(string())], - cancellationPolicyText: [ - 'cancellation_policy_text', - optional(nullable(string())), - ], - skipBookingFlowStaffSelection: [ - 'skip_booking_flow_staff_selection', - optional(nullable(boolean())), - ], - } -); diff --git a/src/models/businessBookingProfile.ts b/src/models/businessBookingProfile.ts deleted file mode 100644 index aea74e124..000000000 --- a/src/models/businessBookingProfile.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - BusinessAppointmentSettings, - businessAppointmentSettingsSchema, -} from './businessAppointmentSettings'; - -/** A seller's business booking profile, including booking policy, appointment settings, etc. */ -export interface BusinessBookingProfile { - /** The ID of the seller, obtainable using the Merchants API. */ - sellerId?: string | null; - /** The RFC 3339 timestamp specifying the booking's creation time. */ - createdAt?: string; - /** Indicates whether the seller is open for booking. */ - bookingEnabled?: boolean | null; - /** Choices of customer-facing time zone used for bookings. */ - customerTimezoneChoice?: string; - /** Policies for accepting bookings. */ - bookingPolicy?: string; - /** Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`). */ - allowUserCancel?: boolean | null; - /** The service appointment settings, including where and how the service is provided. */ - businessAppointmentSettings?: BusinessAppointmentSettings; - /** Indicates whether the seller's subscription to Square Appointments supports creating, updating or canceling an appointment through the API (`true`) or not (`false`) using seller permission. */ - supportSellerLevelWrites?: boolean | null; -} - -export const businessBookingProfileSchema: Schema = object( - { - sellerId: ['seller_id', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - bookingEnabled: ['booking_enabled', optional(nullable(boolean()))], - customerTimezoneChoice: ['customer_timezone_choice', optional(string())], - bookingPolicy: ['booking_policy', optional(string())], - allowUserCancel: ['allow_user_cancel', optional(nullable(boolean()))], - businessAppointmentSettings: [ - 'business_appointment_settings', - optional(lazy(() => businessAppointmentSettingsSchema)), - ], - supportSellerLevelWrites: [ - 'support_seller_level_writes', - optional(nullable(boolean())), - ], - } -); diff --git a/src/models/businessHours.ts b/src/models/businessHours.ts deleted file mode 100644 index 4d8cf73c9..000000000 --- a/src/models/businessHours.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, nullable, object, optional, Schema } from '../schema'; -import { - BusinessHoursPeriod, - businessHoursPeriodSchema, -} from './businessHoursPeriod'; - -/** The hours of operation for a location. */ -export interface BusinessHours { - /** The list of time periods during which the business is open. There can be at most 10 periods per day. */ - periods?: BusinessHoursPeriod[] | null; -} - -export const businessHoursSchema: Schema = object({ - periods: [ - 'periods', - optional(nullable(array(lazy(() => businessHoursPeriodSchema)))), - ], -}); diff --git a/src/models/businessHoursPeriod.ts b/src/models/businessHoursPeriod.ts deleted file mode 100644 index 086150d41..000000000 --- a/src/models/businessHoursPeriod.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Represents a period of time during which a business location is open. */ -export interface BusinessHoursPeriod { - /** Indicates the specific day of the week. */ - dayOfWeek?: string; - /** - * The start time of a business hours period, specified in local time using partial-time - * RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning. - * Note that the seconds value is always :00, but it is appended for conformance to the RFC. - */ - startLocalTime?: string | null; - /** - * The end time of a business hours period, specified in local time using partial-time - * RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening. - * Note that the seconds value is always :00, but it is appended for conformance to the RFC. - */ - endLocalTime?: string | null; -} - -export const businessHoursPeriodSchema: Schema = object({ - dayOfWeek: ['day_of_week', optional(string())], - startLocalTime: ['start_local_time', optional(nullable(string()))], - endLocalTime: ['end_local_time', optional(nullable(string()))], -}); diff --git a/src/models/buyNowPayLaterDetails.ts b/src/models/buyNowPayLaterDetails.ts deleted file mode 100644 index 686d2d4f5..000000000 --- a/src/models/buyNowPayLaterDetails.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { AfterpayDetails, afterpayDetailsSchema } from './afterpayDetails'; -import { ClearpayDetails, clearpayDetailsSchema } from './clearpayDetails'; - -/** Additional details about a Buy Now Pay Later payment type. */ -export interface BuyNowPayLaterDetails { - /** - * The brand used for the Buy Now Pay Later payment. - * The brand can be `AFTERPAY`, `CLEARPAY` or `UNKNOWN`. - */ - brand?: string | null; - /** Additional details about Afterpay payments. */ - afterpayDetails?: AfterpayDetails; - /** Additional details about Clearpay payments. */ - clearpayDetails?: ClearpayDetails; -} - -export const buyNowPayLaterDetailsSchema: Schema = object( - { - brand: ['brand', optional(nullable(string()))], - afterpayDetails: [ - 'afterpay_details', - optional(lazy(() => afterpayDetailsSchema)), - ], - clearpayDetails: [ - 'clearpay_details', - optional(lazy(() => clearpayDetailsSchema)), - ], - } -); diff --git a/src/models/calculateLoyaltyPointsRequest.ts b/src/models/calculateLoyaltyPointsRequest.ts deleted file mode 100644 index a47792712..000000000 --- a/src/models/calculateLoyaltyPointsRequest.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents a [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) request. */ -export interface CalculateLoyaltyPointsRequest { - /** - * The [order](entity:Order) ID for which to calculate the points. - * Specify this field if your application uses the Orders API to process orders. - * Otherwise, specify the `transaction_amount_money`. - */ - orderId?: 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. - */ - transactionAmountMoney?: Money; - /** - * The ID of the target [loyalty account](entity:LoyaltyAccount). Optionally specify this field - * if your application uses the Orders API to process orders. - * If specified, the `promotion_points` field in the response shows the number of points the buyer would - * earn from the purchase. In this case, Square uses the account ID to determine whether the promotion's - * `trigger_limit` (the maximum number of times that a buyer can trigger the promotion) has been reached. - * If not specified, the `promotion_points` field shows the number of points the purchase qualifies - * for regardless of the trigger limit. - */ - loyaltyAccountId?: string | null; -} - -export const calculateLoyaltyPointsRequestSchema: Schema = object( - { - orderId: ['order_id', optional(nullable(string()))], - transactionAmountMoney: [ - 'transaction_amount_money', - optional(lazy(() => moneySchema)), - ], - loyaltyAccountId: ['loyalty_account_id', optional(nullable(string()))], - } -); diff --git a/src/models/calculateLoyaltyPointsResponse.ts b/src/models/calculateLoyaltyPointsResponse.ts deleted file mode 100644 index 5bf0a4ed3..000000000 --- a/src/models/calculateLoyaltyPointsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, number, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) response. */ -export interface CalculateLoyaltyPointsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The number of points that the buyer can earn from the base loyalty program. */ - points?: number; - /** - * The number of points that the buyer can earn from a loyalty promotion. To be eligible - * to earn promotion points, the purchase must first qualify for program points. When `order_id` - * is not provided in the request, this value is always 0. - */ - promotionPoints?: number; -} - -export const calculateLoyaltyPointsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - points: ['points', optional(number())], - promotionPoints: ['promotion_points', optional(number())], - } -); diff --git a/src/models/calculateOrderRequest.ts b/src/models/calculateOrderRequest.ts deleted file mode 100644 index b02d903fe..000000000 --- a/src/models/calculateOrderRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, nullable, object, optional, Schema } from '../schema'; -import { Order, orderSchema } from './order'; -import { OrderReward, orderRewardSchema } from './orderReward'; - -export interface CalculateOrderRequest { - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order: Order; - /** - * Identifies one or more loyalty reward tiers to apply during the order calculation. - * The discounts defined by the reward tiers are added to the order only to preview the - * effect of applying the specified rewards. The rewards do not correspond to actual - * redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are - * random strings used only to reference the reward tier. - */ - proposedRewards?: OrderReward[] | null; -} - -export const calculateOrderRequestSchema: Schema = object( - { - order: ['order', lazy(() => orderSchema)], - proposedRewards: [ - 'proposed_rewards', - optional(nullable(array(lazy(() => orderRewardSchema)))), - ], - } -); diff --git a/src/models/calculateOrderResponse.ts b/src/models/calculateOrderResponse.ts deleted file mode 100644 index a6beb6328..000000000 --- a/src/models/calculateOrderResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Order, orderSchema } from './order'; - -export interface CalculateOrderResponse { - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const calculateOrderResponseSchema: Schema = object( - { - order: ['order', optional(lazy(() => orderSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/cancelBookingRequest.ts b/src/models/cancelBookingRequest.ts deleted file mode 100644 index 79eddef20..000000000 --- a/src/models/cancelBookingRequest.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface CancelBookingRequest { - /** A unique key to make this request an idempotent operation. */ - idempotencyKey?: string | null; - /** The revision number for the booking used for optimistic concurrency. */ - bookingVersion?: number | null; -} - -export const cancelBookingRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - bookingVersion: ['booking_version', optional(nullable(number()))], -}); diff --git a/src/models/cancelBookingResponse.ts b/src/models/cancelBookingResponse.ts deleted file mode 100644 index 18afd603a..000000000 --- a/src/models/cancelBookingResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Booking, bookingSchema } from './booking'; -import { Error, errorSchema } from './error'; - -export interface CancelBookingResponse { - /** - * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service - * at a given location to a requesting customer in one or more appointment segments. - */ - booking?: Booking; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const cancelBookingResponseSchema: Schema = object( - { - booking: ['booking', optional(lazy(() => bookingSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/cancelInvoiceRequest.ts b/src/models/cancelInvoiceRequest.ts deleted file mode 100644 index 1e1e58e0f..000000000 --- a/src/models/cancelInvoiceRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { number, object, Schema } from '../schema'; - -/** Describes a `CancelInvoice` request. */ -export interface CancelInvoiceRequest { - /** - * The version of the [invoice](entity:Invoice) to cancel. - * If you do not know the version, you can call - * [GetInvoice](api-endpoint:Invoices-GetInvoice) or [ListInvoices](api-endpoint:Invoices-ListInvoices). - */ - version: number; -} - -export const cancelInvoiceRequestSchema: Schema = object({ - version: ['version', number()], -}); diff --git a/src/models/cancelInvoiceResponse.ts b/src/models/cancelInvoiceResponse.ts deleted file mode 100644 index e551cfeaa..000000000 --- a/src/models/cancelInvoiceResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Invoice, invoiceSchema } from './invoice'; - -/** The response returned by the `CancelInvoice` request. */ -export interface CancelInvoiceResponse { - /** - * Stores information about an invoice. You use the Invoices API to create and manage - * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - */ - invoice?: Invoice; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const cancelInvoiceResponseSchema: Schema = object( - { - invoice: ['invoice', optional(lazy(() => invoiceSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/cancelLoyaltyPromotionResponse.ts b/src/models/cancelLoyaltyPromotionResponse.ts deleted file mode 100644 index be7e3dc4a..000000000 --- a/src/models/cancelLoyaltyPromotionResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyPromotion, loyaltyPromotionSchema } from './loyaltyPromotion'; - -/** - * Represents a [CancelLoyaltyPromotion]($e/Loyalty/CancelLoyaltyPromotion) response. - * Either `loyalty_promotion` or `errors` is present in the response. - */ -export interface CancelLoyaltyPromotionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a promotion for a [loyalty program]($m/LoyaltyProgram). Loyalty promotions enable buyers - * to earn extra points on top of those earned from the base program. - * A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. - */ - loyaltyPromotion?: LoyaltyPromotion; -} - -export const cancelLoyaltyPromotionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - loyaltyPromotion: [ - 'loyalty_promotion', - optional(lazy(() => loyaltyPromotionSchema)), - ], - } -); diff --git a/src/models/cancelPaymentByIdempotencyKeyRequest.ts b/src/models/cancelPaymentByIdempotencyKeyRequest.ts deleted file mode 100644 index 7616aab85..000000000 --- a/src/models/cancelPaymentByIdempotencyKeyRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** - * Describes a request to cancel a payment using - * [CancelPaymentByIdempotencyKey]($e/Payments/CancelPaymentByIdempotencyKey). - */ -export interface CancelPaymentByIdempotencyKeyRequest { - /** The `idempotency_key` identifying the payment to be canceled. */ - idempotencyKey: string; -} - -export const cancelPaymentByIdempotencyKeyRequestSchema: Schema = object( - { idempotencyKey: ['idempotency_key', string()] } -); diff --git a/src/models/cancelPaymentByIdempotencyKeyResponse.ts b/src/models/cancelPaymentByIdempotencyKeyResponse.ts deleted file mode 100644 index 521227d11..000000000 --- a/src/models/cancelPaymentByIdempotencyKeyResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the response returned by - * [CancelPaymentByIdempotencyKey]($e/Payments/CancelPaymentByIdempotencyKey). - * On success, `errors` is empty. - */ -export interface CancelPaymentByIdempotencyKeyResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const cancelPaymentByIdempotencyKeyResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/cancelPaymentResponse.ts b/src/models/cancelPaymentResponse.ts deleted file mode 100644 index aff2f772f..000000000 --- a/src/models/cancelPaymentResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Payment, paymentSchema } from './payment'; - -/** Defines the response returned by [CancelPayment]($e/Payments/CancelPayment). */ -export interface CancelPaymentResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a payment processed by the Square API. */ - payment?: Payment; -} - -export const cancelPaymentResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - payment: ['payment', optional(lazy(() => paymentSchema))], - } -); diff --git a/src/models/cancelSubscriptionResponse.ts b/src/models/cancelSubscriptionResponse.ts deleted file mode 100644 index 1523def68..000000000 --- a/src/models/cancelSubscriptionResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; -import { - SubscriptionAction, - subscriptionActionSchema, -} from './subscriptionAction'; - -/** - * Defines output parameters in a response from the - * [CancelSubscription]($e/Subscriptions/CancelSubscription) endpoint. - */ -export interface CancelSubscriptionResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * 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. */ - actions?: SubscriptionAction[]; -} - -export const cancelSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - actions: ['actions', optional(array(lazy(() => subscriptionActionSchema)))], - } -); diff --git a/src/models/cancelTerminalActionResponse.ts b/src/models/cancelTerminalActionResponse.ts deleted file mode 100644 index c507bc7d2..000000000 --- a/src/models/cancelTerminalActionResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalAction, terminalActionSchema } from './terminalAction'; - -export interface CancelTerminalActionResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** Represents an action processed by the Square Terminal. */ - action?: TerminalAction; -} - -export const cancelTerminalActionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - action: ['action', optional(lazy(() => terminalActionSchema))], - } -); diff --git a/src/models/cancelTerminalCheckoutResponse.ts b/src/models/cancelTerminalCheckoutResponse.ts deleted file mode 100644 index 660ee6f6e..000000000 --- a/src/models/cancelTerminalCheckoutResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalCheckout, terminalCheckoutSchema } from './terminalCheckout'; - -export interface CancelTerminalCheckoutResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a checkout processed by the Square Terminal. */ - checkout?: TerminalCheckout; -} - -export const cancelTerminalCheckoutResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - checkout: ['checkout', optional(lazy(() => terminalCheckoutSchema))], - } -); diff --git a/src/models/cancelTerminalRefundResponse.ts b/src/models/cancelTerminalRefundResponse.ts deleted file mode 100644 index 4f362fda3..000000000 --- a/src/models/cancelTerminalRefundResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalRefund, terminalRefundSchema } from './terminalRefund'; - -export interface CancelTerminalRefundResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. */ - refund?: TerminalRefund; -} - -export const cancelTerminalRefundResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refund: ['refund', optional(lazy(() => terminalRefundSchema))], - } -); diff --git a/src/models/captureTransactionResponse.ts b/src/models/captureTransactionResponse.ts deleted file mode 100644 index 8913b3e2f..000000000 --- a/src/models/captureTransactionResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [CaptureTransaction](api-endpoint:Transactions-CaptureTransaction) endpoint. - */ -export interface CaptureTransactionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const captureTransactionResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/card.ts b/src/models/card.ts deleted file mode 100644 index e40be29a3..000000000 --- a/src/models/card.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { - bigint, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; - -/** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ -export interface Card { - /** Unique ID for this card. Generated by Square. */ - id?: string; - /** Indicates a card's brand, such as `VISA` or `MASTERCARD`. */ - cardBrand?: string; - /** The last 4 digits of the card number. */ - last4?: string; - /** The expiration month of the associated card as an integer between 1 and 12. */ - expMonth?: bigint | null; - /** The four-digit year of the card's expiration date. */ - expYear?: bigint | null; - /** The name of the cardholder. */ - cardholderName?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - billingAddress?: Address; - /** - * Intended as a Square-assigned identifier, based - * on the card number, to identify the card across multiple locations within a - * single application. - */ - fingerprint?: string; - /** **Required** The ID of a customer created using the Customers API to be associated with the card. */ - customerId?: string | null; - /** The ID of the merchant associated with the card. */ - merchantId?: string; - /** - * An optional user-defined reference ID that associates this card with - * another entity in an external system. For example, a customer ID from an - * external customer management system. - */ - referenceId?: string | null; - /** Indicates whether or not a card can be used for payments. */ - enabled?: boolean; - /** Indicates a card's type, such as `CREDIT` or `DEBIT`. */ - cardType?: string; - /** Indicates a card's prepaid type, such as `NOT_PREPAID` or `PREPAID`. */ - prepaidType?: string; - /** - * The first six digits of the card number, known as the Bank Identification Number (BIN). Only the Payments API - * returns this field. - */ - bin?: string; - /** - * Current version number of the card. Increments with each card update. Requests to update an - * existing Card object will be rejected unless the version in the request matches the current - * version for the Card. - */ - version?: bigint; - /** Indicates the brand for a co-branded card. */ - cardCoBrand?: string; -} - -export const cardSchema: Schema = object({ - id: ['id', optional(string())], - cardBrand: ['card_brand', optional(string())], - last4: ['last_4', optional(string())], - expMonth: ['exp_month', optional(nullable(bigint()))], - expYear: ['exp_year', optional(nullable(bigint()))], - cardholderName: ['cardholder_name', optional(nullable(string()))], - billingAddress: ['billing_address', optional(lazy(() => addressSchema))], - fingerprint: ['fingerprint', optional(string())], - customerId: ['customer_id', optional(nullable(string()))], - merchantId: ['merchant_id', optional(string())], - referenceId: ['reference_id', optional(nullable(string()))], - enabled: ['enabled', optional(boolean())], - cardType: ['card_type', optional(string())], - prepaidType: ['prepaid_type', optional(string())], - bin: ['bin', optional(string())], - version: ['version', optional(bigint())], - cardCoBrand: ['card_co_brand', optional(string())], -}); diff --git a/src/models/cardPaymentDetails.ts b/src/models/cardPaymentDetails.ts deleted file mode 100644 index 8588aee10..000000000 --- a/src/models/cardPaymentDetails.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Card, cardSchema } from './card'; -import { - CardPaymentTimeline, - cardPaymentTimelineSchema, -} from './cardPaymentTimeline'; -import { DeviceDetails, deviceDetailsSchema } from './deviceDetails'; -import { Error, errorSchema } from './error'; - -/** Reflects the current status of a card payment. Contains only non-confidential information. */ -export interface CardPaymentDetails { - /** - * The card payment's current state. The state can be AUTHORIZED, CAPTURED, VOIDED, or - * FAILED. - */ - status?: string | null; - /** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ - card?: Card; - /** - * The method used to enter the card's details for the payment. The method can be - * `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`. - */ - entryMethod?: string | null; - /** - * The status code returned from the Card Verification Value (CVV) check. The code can be - * `CVV_ACCEPTED`, `CVV_REJECTED`, or `CVV_NOT_CHECKED`. - */ - cvvStatus?: string | null; - /** - * The status code returned from the Address Verification System (AVS) check. The code can be - * `AVS_ACCEPTED`, `AVS_REJECTED`, or `AVS_NOT_CHECKED`. - */ - avsStatus?: string | null; - /** - * The status code returned by the card issuer that describes the payment's - * authorization status. - */ - authResultCode?: string | null; - /** For EMV payments, the application ID identifies the EMV application used for the payment. */ - applicationIdentifier?: string | null; - /** For EMV payments, the human-readable name of the EMV application used for the payment. */ - applicationName?: string | null; - /** For EMV payments, the cryptogram generated for the payment. */ - applicationCryptogram?: string | null; - /** - * For EMV payments, the method used to verify the cardholder's identity. The method can be - * `PIN`, `SIGNATURE`, `PIN_AND_SIGNATURE`, `ON_DEVICE`, or `NONE`. - */ - verificationMethod?: string | null; - /** - * For EMV payments, the results of the cardholder verification. The result can be - * `SUCCESS`, `FAILURE`, or `UNKNOWN`. - */ - verificationResults?: string | null; - /** - * The statement description sent to the card networks. - * Note: The actual statement description varies and is likely to be truncated and appended with - * additional information on a per issuer basis. - */ - statementDescription?: string | null; - /** Details about the device that took the payment. */ - deviceDetails?: DeviceDetails; - /** The timeline for card payments. */ - cardPaymentTimeline?: CardPaymentTimeline; - /** - * Whether the card must be physically present for the payment to - * be refunded. If set to `true`, the card must be present. - */ - refundRequiresCardPresence?: boolean | null; - /** Information about errors encountered during the request. */ - errors?: Error[] | null; -} - -export const cardPaymentDetailsSchema: Schema = object({ - status: ['status', optional(nullable(string()))], - card: ['card', optional(lazy(() => cardSchema))], - entryMethod: ['entry_method', optional(nullable(string()))], - cvvStatus: ['cvv_status', optional(nullable(string()))], - avsStatus: ['avs_status', optional(nullable(string()))], - authResultCode: ['auth_result_code', optional(nullable(string()))], - applicationIdentifier: [ - 'application_identifier', - optional(nullable(string())), - ], - applicationName: ['application_name', optional(nullable(string()))], - applicationCryptogram: [ - 'application_cryptogram', - optional(nullable(string())), - ], - verificationMethod: ['verification_method', optional(nullable(string()))], - verificationResults: ['verification_results', optional(nullable(string()))], - statementDescription: ['statement_description', optional(nullable(string()))], - deviceDetails: ['device_details', optional(lazy(() => deviceDetailsSchema))], - cardPaymentTimeline: [ - 'card_payment_timeline', - optional(lazy(() => cardPaymentTimelineSchema)), - ], - refundRequiresCardPresence: [ - 'refund_requires_card_presence', - optional(nullable(boolean())), - ], - errors: ['errors', optional(nullable(array(lazy(() => errorSchema))))], -}); diff --git a/src/models/cardPaymentTimeline.ts b/src/models/cardPaymentTimeline.ts deleted file mode 100644 index d97bc1556..000000000 --- a/src/models/cardPaymentTimeline.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** The timeline for card payments. */ -export interface CardPaymentTimeline { - /** The timestamp when the payment was authorized, in RFC 3339 format. */ - authorizedAt?: string | null; - /** The timestamp when the payment was captured, in RFC 3339 format. */ - capturedAt?: string | null; - /** The timestamp when the payment was voided, in RFC 3339 format. */ - voidedAt?: string | null; -} - -export const cardPaymentTimelineSchema: Schema = object({ - authorizedAt: ['authorized_at', optional(nullable(string()))], - capturedAt: ['captured_at', optional(nullable(string()))], - voidedAt: ['voided_at', optional(nullable(string()))], -}); diff --git a/src/models/cashAppDetails.ts b/src/models/cashAppDetails.ts deleted file mode 100644 index de2ab0d9b..000000000 --- a/src/models/cashAppDetails.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Additional details about `WALLET` type payments with the `brand` of `CASH_APP`. */ -export interface CashAppDetails { - /** The name of the Cash App account holder. */ - buyerFullName?: string | null; - /** - * The country of the Cash App account holder, in ISO 3166-1-alpha-2 format. - * For possible values, see [Country](entity:Country). - */ - buyerCountryCode?: string | null; - /** $Cashtag of the Cash App account holder. */ - buyerCashtag?: string; -} - -export const cashAppDetailsSchema: Schema = object({ - buyerFullName: ['buyer_full_name', optional(nullable(string()))], - buyerCountryCode: ['buyer_country_code', optional(nullable(string()))], - buyerCashtag: ['buyer_cashtag', optional(string())], -}); diff --git a/src/models/cashDrawerDevice.ts b/src/models/cashDrawerDevice.ts deleted file mode 100644 index 03376916e..000000000 --- a/src/models/cashDrawerDevice.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface CashDrawerDevice { - /** The device Square-issued ID */ - id?: string; - /** The device merchant-specified name. */ - name?: string | null; -} - -export const cashDrawerDeviceSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', optional(nullable(string()))], -}); diff --git a/src/models/cashDrawerShift.ts b/src/models/cashDrawerShift.ts deleted file mode 100644 index 698d5adfb..000000000 --- a/src/models/cashDrawerShift.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { CashDrawerDevice, cashDrawerDeviceSchema } from './cashDrawerDevice'; -import { Money, moneySchema } from './money'; - -/** - * This model gives the details of a cash drawer shift. - * The cash_payment_money, cash_refund_money, cash_paid_in_money, - * and cash_paid_out_money fields are all computed by summing their respective - * event types. - */ -export interface CashDrawerShift { - /** The shift unique ID. */ - id?: string; - /** The current state of a cash drawer shift. */ - state?: string; - /** The time when the shift began, in ISO 8601 format. */ - openedAt?: string | null; - /** The time when the shift ended, in ISO 8601 format. */ - endedAt?: string | null; - /** The time when the shift was closed, in ISO 8601 format. */ - closedAt?: string | null; - /** The free-form text description of a cash drawer by an employee. */ - description?: 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. - */ - openedCashMoney?: Money; - /** - * 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. - */ - cashPaymentMoney?: Money; - /** - * 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. - */ - cashRefundsMoney?: Money; - /** - * 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. - */ - cashPaidInMoney?: Money; - /** - * 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. - */ - cashPaidOutMoney?: Money; - /** - * 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. - */ - expectedCashMoney?: Money; - /** - * 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. - */ - closedCashMoney?: Money; - device?: CashDrawerDevice; - /** The shift start time in RFC 3339 format. */ - createdAt?: string; - /** The shift updated at time in RFC 3339 format. */ - updatedAt?: string; - /** The ID of the location the cash drawer shift belongs to. */ - locationId?: string; - /** - * The IDs of all team members that were logged into Square Point of Sale at any - * point while the cash drawer shift was open. - */ - teamMemberIds?: string[]; - /** The ID of the team member that started the cash drawer shift. */ - openingTeamMemberId?: string; - /** The ID of the team member that ended the cash drawer shift. */ - endingTeamMemberId?: string; - /** - * The ID of the team member that closed the cash drawer shift by auditing - * the cash drawer contents. - */ - closingTeamMemberId?: string; -} - -export const cashDrawerShiftSchema: Schema = object({ - id: ['id', optional(string())], - state: ['state', optional(string())], - openedAt: ['opened_at', optional(nullable(string()))], - endedAt: ['ended_at', optional(nullable(string()))], - closedAt: ['closed_at', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - openedCashMoney: ['opened_cash_money', optional(lazy(() => moneySchema))], - cashPaymentMoney: ['cash_payment_money', optional(lazy(() => moneySchema))], - cashRefundsMoney: ['cash_refunds_money', optional(lazy(() => moneySchema))], - cashPaidInMoney: ['cash_paid_in_money', optional(lazy(() => moneySchema))], - cashPaidOutMoney: ['cash_paid_out_money', optional(lazy(() => moneySchema))], - expectedCashMoney: ['expected_cash_money', optional(lazy(() => moneySchema))], - closedCashMoney: ['closed_cash_money', optional(lazy(() => moneySchema))], - device: ['device', optional(lazy(() => cashDrawerDeviceSchema))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - locationId: ['location_id', optional(string())], - teamMemberIds: ['team_member_ids', optional(array(string()))], - openingTeamMemberId: ['opening_team_member_id', optional(string())], - endingTeamMemberId: ['ending_team_member_id', optional(string())], - closingTeamMemberId: ['closing_team_member_id', optional(string())], -}); diff --git a/src/models/cashDrawerShiftEvent.ts b/src/models/cashDrawerShiftEvent.ts deleted file mode 100644 index c231d8260..000000000 --- a/src/models/cashDrawerShiftEvent.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -export interface CashDrawerShiftEvent { - /** The unique ID of the event. */ - id?: string; - /** - * The types of events on a CashDrawerShift. - * Each event type represents an employee action on the actual cash drawer - * represented by a CashDrawerShift. - */ - eventType?: string; - /** - * 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. - */ - eventMoney?: Money; - /** The event time in RFC 3339 format. */ - createdAt?: string; - /** - * An optional description of the event, entered by the employee that - * created the event. - */ - description?: string | null; - /** The ID of the team member that created the event. */ - teamMemberId?: string; -} - -export const cashDrawerShiftEventSchema: Schema = object({ - id: ['id', optional(string())], - eventType: ['event_type', optional(string())], - eventMoney: ['event_money', optional(lazy(() => moneySchema))], - createdAt: ['created_at', optional(string())], - description: ['description', optional(nullable(string()))], - teamMemberId: ['team_member_id', optional(string())], -}); diff --git a/src/models/cashDrawerShiftSummary.ts b/src/models/cashDrawerShiftSummary.ts deleted file mode 100644 index bd6d59e93..000000000 --- a/src/models/cashDrawerShiftSummary.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * The summary of a closed cash drawer shift. - * This model contains only the money counted to start a cash drawer shift, counted - * at the end of the shift, and the amount that should be in the drawer at shift - * end based on summing all cash drawer shift events. - */ -export interface CashDrawerShiftSummary { - /** The shift unique ID. */ - id?: string; - /** The current state of a cash drawer shift. */ - state?: string; - /** The shift start time in ISO 8601 format. */ - openedAt?: string | null; - /** The shift end time in ISO 8601 format. */ - endedAt?: string | null; - /** The shift close time in ISO 8601 format. */ - closedAt?: string | null; - /** An employee free-text description of a cash drawer shift. */ - description?: 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. - */ - openedCashMoney?: Money; - /** - * 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. - */ - expectedCashMoney?: Money; - /** - * 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. - */ - closedCashMoney?: Money; - /** The shift start time in RFC 3339 format. */ - createdAt?: string; - /** The shift updated at time in RFC 3339 format. */ - updatedAt?: string; - /** The ID of the location the cash drawer shift belongs to. */ - locationId?: string; -} - -export const cashDrawerShiftSummarySchema: Schema = object( - { - id: ['id', optional(string())], - state: ['state', optional(string())], - openedAt: ['opened_at', optional(nullable(string()))], - endedAt: ['ended_at', optional(nullable(string()))], - closedAt: ['closed_at', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - openedCashMoney: ['opened_cash_money', optional(lazy(() => moneySchema))], - expectedCashMoney: [ - 'expected_cash_money', - optional(lazy(() => moneySchema)), - ], - closedCashMoney: ['closed_cash_money', optional(lazy(() => moneySchema))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - locationId: ['location_id', optional(string())], - } -); diff --git a/src/models/cashPaymentDetails.ts b/src/models/cashPaymentDetails.ts deleted file mode 100644 index 6d2b9170b..000000000 --- a/src/models/cashPaymentDetails.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Stores details about a cash payment. Contains only non-confidential information. For more information, see - * [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). - */ -export interface CashPaymentDetails { - /** - * 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. - */ - buyerSuppliedMoney: Money; - /** - * 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. - */ - changeBackMoney?: Money; -} - -export const cashPaymentDetailsSchema: Schema = object({ - buyerSuppliedMoney: ['buyer_supplied_money', lazy(() => moneySchema)], - changeBackMoney: ['change_back_money', optional(lazy(() => moneySchema))], -}); diff --git a/src/models/catalogAvailabilityPeriod.ts b/src/models/catalogAvailabilityPeriod.ts deleted file mode 100644 index 98666e5d7..000000000 --- a/src/models/catalogAvailabilityPeriod.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Represents a time period of availability. */ -export interface CatalogAvailabilityPeriod { - /** - * The start time of an availability period, specified in local time using partial-time - * RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning. - * Note that the seconds value is always :00, but it is appended for conformance to the RFC. - */ - startLocalTime?: string | null; - /** - * The end time of an availability period, specified in local time using partial-time - * RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening. - * Note that the seconds value is always :00, but it is appended for conformance to the RFC. - */ - endLocalTime?: string | null; - /** Indicates the specific day of the week. */ - dayOfWeek?: string; -} - -export const catalogAvailabilityPeriodSchema: Schema = object( - { - startLocalTime: ['start_local_time', optional(nullable(string()))], - endLocalTime: ['end_local_time', optional(nullable(string()))], - dayOfWeek: ['day_of_week', optional(string())], - } -); diff --git a/src/models/catalogCategory.ts b/src/models/catalogCategory.ts deleted file mode 100644 index 21c6bd2d8..000000000 --- a/src/models/catalogCategory.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CatalogEcomSeoData, - catalogEcomSeoDataSchema, -} from './catalogEcomSeoData'; -import { - CatalogObjectCategory, - catalogObjectCategorySchema, -} from './catalogObjectCategory'; -import { - CategoryPathToRootNode, - categoryPathToRootNodeSchema, -} from './categoryPathToRootNode'; - -/** A category to which a `CatalogItem` instance belongs. */ -export interface CatalogCategory { - /** The category name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. */ - name?: string | null; - /** - * The IDs of images associated with this `CatalogCategory` instance. - * Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications. - */ - imageIds?: string[] | null; - /** Indicates the type of a category. */ - categoryType?: string; - /** - * A category that can be assigned to an item or a parent category that can be assigned - * to another category. For example, a clothing category can be assigned to a t-shirt item or - * be made as the parent category to the pants category. - */ - parentCategory?: CatalogObjectCategory; - /** Indicates whether a category is a top level category, which does not have any parent_category. */ - isTopLevel?: boolean | null; - /** A list of IDs representing channels, such as a Square Online site, where the category can be made visible. */ - channels?: string[] | null; - /** The IDs of the `CatalogAvailabilityPeriod` objects associated with the category. */ - availabilityPeriodIds?: string[] | null; - /** Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites. */ - onlineVisibility?: boolean | null; - /** The top-level category in a category hierarchy. */ - rootCategory?: string; - /** SEO data for for a seller's Square Online store. */ - ecomSeoData?: CatalogEcomSeoData; - /** - * The path from the category to its root category. The first node of the path is the parent of the category - * and the last is the root category. The path is empty if the category is a root category. - */ - pathToRoot?: CategoryPathToRootNode[] | null; -} - -export const catalogCategorySchema: Schema = object({ - name: ['name', optional(nullable(string()))], - imageIds: ['image_ids', optional(nullable(array(string())))], - categoryType: ['category_type', optional(string())], - parentCategory: [ - 'parent_category', - optional(lazy(() => catalogObjectCategorySchema)), - ], - isTopLevel: ['is_top_level', optional(nullable(boolean()))], - channels: ['channels', optional(nullable(array(string())))], - availabilityPeriodIds: [ - 'availability_period_ids', - optional(nullable(array(string()))), - ], - onlineVisibility: ['online_visibility', optional(nullable(boolean()))], - rootCategory: ['root_category', optional(string())], - ecomSeoData: [ - 'ecom_seo_data', - optional(lazy(() => catalogEcomSeoDataSchema)), - ], - pathToRoot: [ - 'path_to_root', - optional(nullable(array(lazy(() => categoryPathToRootNodeSchema)))), - ], -}); diff --git a/src/models/catalogCustomAttributeDefinition.ts b/src/models/catalogCustomAttributeDefinition.ts deleted file mode 100644 index f860b8df7..000000000 --- a/src/models/catalogCustomAttributeDefinition.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CatalogCustomAttributeDefinitionNumberConfig, - catalogCustomAttributeDefinitionNumberConfigSchema, -} from './catalogCustomAttributeDefinitionNumberConfig'; -import { - CatalogCustomAttributeDefinitionSelectionConfig, - catalogCustomAttributeDefinitionSelectionConfigSchema, -} from './catalogCustomAttributeDefinitionSelectionConfig'; -import { - CatalogCustomAttributeDefinitionStringConfig, - catalogCustomAttributeDefinitionStringConfigSchema, -} from './catalogCustomAttributeDefinitionStringConfig'; -import { - SourceApplication, - sourceApplicationSchema, -} from './sourceApplication'; - -/** - * 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) - */ -export interface CatalogCustomAttributeDefinition { - /** Defines the possible types for a custom attribute. */ - type: string; - /** - * The name of this definition for API and seller-facing UI purposes. - * The name must be unique within the (merchant, application) pair. Required. - * May not be empty and may not exceed 255 characters. Can be modified after creation. - */ - name: string; - /** - * Seller-oriented description of the meaning of this Custom Attribute, - * any constraints that the seller should observe, etc. May be displayed as a tooltip in Square UIs. - */ - description?: string | null; - /** Represents information about the application used to generate a change. */ - sourceApplication?: SourceApplication; - /** - * The set of `CatalogObject` types that this custom atttribute may be applied to. - * Currently, only `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, and `CATEGORY` are allowed. At least one type must be included. - * See [CatalogObjectType](#type-catalogobjecttype) for possible values - */ - allowedObjectTypes: string[]; - /** - * Defines the visibility of a custom attribute to sellers in Square - * client applications, Square APIs or in Square UIs (including Square Point - * of Sale applications and Square Dashboard). - */ - sellerVisibility?: string; - /** - * Defines the visibility of a custom attribute to applications other than their - * creating application. - */ - appVisibility?: string; - /** Configuration associated with Custom Attribute Definitions of type `STRING`. */ - stringConfig?: CatalogCustomAttributeDefinitionStringConfig; - numberConfig?: CatalogCustomAttributeDefinitionNumberConfig; - /** Configuration associated with `SELECTION`-type custom attribute definitions. */ - selectionConfig?: CatalogCustomAttributeDefinitionSelectionConfig; - /** - * The number of custom attributes that reference this - * custom attribute definition. Set by the server in response to a ListCatalog - * request with `include_counts` set to `true`. If the actual count is greater - * than 100, `custom_attribute_usage_count` will be set to `100`. - */ - customAttributeUsageCount?: number; - /** - * The name of the desired custom attribute key that can be used to access - * the custom attribute value on catalog objects. Cannot be modified after the - * custom attribute definition has been created. - * Must be between 1 and 60 characters, and may only contain the characters `[a-zA-Z0-9_-]`. - */ - key?: string | null; -} - -export const catalogCustomAttributeDefinitionSchema: Schema = object( - { - type: ['type', string()], - name: ['name', string()], - description: ['description', optional(nullable(string()))], - sourceApplication: [ - 'source_application', - optional(lazy(() => sourceApplicationSchema)), - ], - allowedObjectTypes: ['allowed_object_types', array(string())], - sellerVisibility: ['seller_visibility', optional(string())], - appVisibility: ['app_visibility', optional(string())], - stringConfig: [ - 'string_config', - optional(lazy(() => catalogCustomAttributeDefinitionStringConfigSchema)), - ], - numberConfig: [ - 'number_config', - optional(lazy(() => catalogCustomAttributeDefinitionNumberConfigSchema)), - ], - selectionConfig: [ - 'selection_config', - optional( - lazy(() => catalogCustomAttributeDefinitionSelectionConfigSchema) - ), - ], - customAttributeUsageCount: [ - 'custom_attribute_usage_count', - optional(number()), - ], - key: ['key', optional(nullable(string()))], - } -); diff --git a/src/models/catalogCustomAttributeDefinitionNumberConfig.ts b/src/models/catalogCustomAttributeDefinitionNumberConfig.ts deleted file mode 100644 index c9894b7c1..000000000 --- a/src/models/catalogCustomAttributeDefinitionNumberConfig.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { nullable, number, object, optional, Schema } from '../schema'; - -export interface CatalogCustomAttributeDefinitionNumberConfig { - /** - * An integer between 0 and 5 that represents the maximum number of - * positions allowed after the decimal in number custom attribute values - * For example: - * - if the precision is 0, the quantity can be 1, 2, 3, etc. - * - if the precision is 1, the quantity can be 0.1, 0.2, etc. - * - if the precision is 2, the quantity can be 0.01, 0.12, etc. - * Default: 5 - */ - precision?: number | null; -} - -export const catalogCustomAttributeDefinitionNumberConfigSchema: Schema = object( - { precision: ['precision', optional(nullable(number()))] } -); diff --git a/src/models/catalogCustomAttributeDefinitionSelectionConfig.ts b/src/models/catalogCustomAttributeDefinitionSelectionConfig.ts deleted file mode 100644 index f6bd15361..000000000 --- a/src/models/catalogCustomAttributeDefinitionSelectionConfig.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, -} from '../schema'; -import { - CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection, - catalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelectionSchema, -} from './catalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection'; - -/** Configuration associated with `SELECTION`-type custom attribute definitions. */ -export interface CatalogCustomAttributeDefinitionSelectionConfig { - /** - * The maximum number of selections that can be set. The maximum value for this - * attribute is 100. The default value is 1. The value can be modified, but changing the value will not - * affect existing custom attribute values on objects. Clients need to - * handle custom attributes with more selected values than allowed by this limit. - */ - maxAllowedSelections?: number | null; - /** - * The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100 - * selections can be defined. Can be modified. - */ - allowedSelections?: - | CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[] - | null; -} - -export const catalogCustomAttributeDefinitionSelectionConfigSchema: Schema = object( - { - maxAllowedSelections: [ - 'max_allowed_selections', - optional(nullable(number())), - ], - allowedSelections: [ - 'allowed_selections', - optional( - nullable( - array( - lazy( - () => - catalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelectionSchema - ) - ) - ) - ), - ], - } -); diff --git a/src/models/catalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts b/src/models/catalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts deleted file mode 100644 index a7194586b..000000000 --- a/src/models/catalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** A named selection for this `SELECTION`-type custom attribute definition. */ -export interface CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection { - /** Unique ID set by Square. */ - uid?: string | null; - /** Selection name, unique within `allowed_selections`. */ - name: string; -} - -export const catalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelectionSchema: Schema = object( - { uid: ['uid', optional(nullable(string()))], name: ['name', string()] } -); diff --git a/src/models/catalogCustomAttributeDefinitionStringConfig.ts b/src/models/catalogCustomAttributeDefinitionStringConfig.ts deleted file mode 100644 index ba2e9c60b..000000000 --- a/src/models/catalogCustomAttributeDefinitionStringConfig.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { boolean, nullable, object, optional, Schema } from '../schema'; - -/** Configuration associated with Custom Attribute Definitions of type `STRING`. */ -export interface CatalogCustomAttributeDefinitionStringConfig { - /** - * If true, each Custom Attribute instance associated with this Custom Attribute - * Definition must have a unique value within the seller's catalog. For - * example, this may be used for a value like a SKU that should not be - * duplicated within a seller's catalog. May not be modified after the - * definition has been created. - */ - enforceUniqueness?: boolean | null; -} - -export const catalogCustomAttributeDefinitionStringConfigSchema: Schema = object( - { enforceUniqueness: ['enforce_uniqueness', optional(nullable(boolean()))] } -); diff --git a/src/models/catalogCustomAttributeValue.ts b/src/models/catalogCustomAttributeValue.ts deleted file mode 100644 index d35ee2509..000000000 --- a/src/models/catalogCustomAttributeValue.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { - array, - boolean, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * An instance of a custom attribute. Custom attributes can be defined and - * added to `ITEM` and `ITEM_VARIATION` type catalog objects. - * [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes). - */ -export interface CatalogCustomAttributeValue { - /** The name of the custom attribute. */ - name?: string | null; - /** The string value of the custom attribute. Populated if `type` = `STRING`. */ - stringValue?: string | null; - /** The id of the [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) this value belongs to. */ - customAttributeDefinitionId?: string; - /** Defines the possible types for a custom attribute. */ - type?: string; - /** - * Populated if `type` = `NUMBER`. Contains a string - * representation of a decimal number, using a `.` as the decimal separator. - */ - numberValue?: string | null; - /** A `true` or `false` value. Populated if `type` = `BOOLEAN`. */ - booleanValue?: boolean | null; - /** One or more choices from `allowed_selections`. Populated if `type` = `SELECTION`. */ - selectionUidValues?: string[] | null; - /** - * If the associated `CatalogCustomAttributeDefinition` object is defined by another application, this key is prefixed by the defining application ID. - * For example, if the CatalogCustomAttributeDefinition has a key attribute of "cocoa_brand" and the defining application ID is "abcd1234", this key is "abcd1234:cocoa_brand" - * when the application making the request is different from the application defining the custom attribute definition. Otherwise, the key is simply "cocoa_brand". - */ - key?: string; -} - -export const catalogCustomAttributeValueSchema: Schema = object( - { - name: ['name', optional(nullable(string()))], - stringValue: ['string_value', optional(nullable(string()))], - customAttributeDefinitionId: [ - 'custom_attribute_definition_id', - optional(string()), - ], - type: ['type', optional(string())], - numberValue: ['number_value', optional(nullable(string()))], - booleanValue: ['boolean_value', optional(nullable(boolean()))], - selectionUidValues: [ - 'selection_uid_values', - optional(nullable(array(string()))), - ], - key: ['key', optional(string())], - } -); diff --git a/src/models/catalogDiscount.ts b/src/models/catalogDiscount.ts deleted file mode 100644 index 2a79a48a3..000000000 --- a/src/models/catalogDiscount.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** A discount applicable to items. */ -export interface CatalogDiscount { - /** The discount name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. */ - name?: string | null; - /** How to apply a CatalogDiscount to a CatalogItem. */ - discountType?: string; - /** - * The percentage of the discount as a string representation of a decimal number, using a `.` as the decimal - * separator and without a `%` sign. A value of `7.5` corresponds to `7.5%`. Specify a percentage of `0` if `discount_type` - * is `VARIABLE_PERCENTAGE`. - * Do not use this field for amount-based or variable discounts. - */ - percentage?: 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. - */ - amountMoney?: Money; - /** - * Indicates whether a mobile staff member needs to enter their PIN to apply the - * discount to a payment in the Square Point of Sale app. - */ - pinRequired?: boolean | null; - /** The color of the discount display label in the Square Point of Sale app. This must be a valid hex color code. */ - labelColor?: string | null; - modifyTaxBasis?: string; - /** - * 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. - */ - maximumAmountMoney?: Money; -} - -export const catalogDiscountSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - discountType: ['discount_type', optional(string())], - percentage: ['percentage', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - pinRequired: ['pin_required', optional(nullable(boolean()))], - labelColor: ['label_color', optional(nullable(string()))], - modifyTaxBasis: ['modify_tax_basis', optional(string())], - maximumAmountMoney: [ - 'maximum_amount_money', - optional(lazy(() => moneySchema)), - ], -}); diff --git a/src/models/catalogEcomSeoData.ts b/src/models/catalogEcomSeoData.ts deleted file mode 100644 index ffd548e49..000000000 --- a/src/models/catalogEcomSeoData.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** SEO data for for a seller's Square Online store. */ -export interface CatalogEcomSeoData { - /** The SEO title used for the Square Online store. */ - pageTitle?: string | null; - /** The SEO description used for the Square Online store. */ - pageDescription?: string | null; - /** The SEO permalink used for the Square Online store. */ - permalink?: string | null; -} - -export const catalogEcomSeoDataSchema: Schema = object({ - pageTitle: ['page_title', optional(nullable(string()))], - pageDescription: ['page_description', optional(nullable(string()))], - permalink: ['permalink', optional(nullable(string()))], -}); diff --git a/src/models/catalogIdMapping.ts b/src/models/catalogIdMapping.ts deleted file mode 100644 index 63392f7d0..000000000 --- a/src/models/catalogIdMapping.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * A mapping between a temporary client-supplied ID and a permanent server-generated ID. - * When calling [UpsertCatalogObject]($e/Catalog/UpsertCatalogObject) or - * [BatchUpsertCatalogObjects]($e/Catalog/BatchUpsertCatalogObjects) to - * create a [CatalogObject]($m/CatalogObject) instance, you can supply - * a temporary ID for the to-be-created object, especially when the object is to be referenced - * elsewhere in the same request body. This temporary ID can be any string unique within - * the call, but must be prefixed by "#". - * After the request is submitted and the object created, a permanent server-generated ID is assigned - * to the new object. The permanent ID is unique across the Square catalog. - */ -export interface CatalogIdMapping { - /** The client-supplied temporary `#`-prefixed ID for a new `CatalogObject`. */ - clientObjectId?: string | null; - /** The permanent ID for the CatalogObject created by the server. */ - objectId?: string | null; -} - -export const catalogIdMappingSchema: Schema = object({ - clientObjectId: ['client_object_id', optional(nullable(string()))], - objectId: ['object_id', optional(nullable(string()))], -}); diff --git a/src/models/catalogImage.ts b/src/models/catalogImage.ts deleted file mode 100644 index 833226887..000000000 --- a/src/models/catalogImage.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * 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. - */ -export interface CatalogImage { - /** - * The internal name to identify this image in calls to the Square API. - * This is a searchable attribute for use in applicable query filters - * using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). - * It is not unique and should not be shown in a buyer facing context. - */ - name?: string | null; - /** - * The URL of this image, generated by Square after an image is uploaded - * using the [CreateCatalogImage](api-endpoint:Catalog-CreateCatalogImage) endpoint. - * To modify the image, use the UpdateCatalogImage endpoint. Do not change the URL field. - */ - url?: string | null; - /** - * A caption that describes what is shown in the image. Displayed in the - * Square Online Store. This is a searchable attribute for use in applicable query filters - * using the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). - */ - caption?: string | null; - /** The immutable order ID for this image object created by the Photo Studio service in Square Online Store. */ - photoStudioOrderId?: string | null; -} - -export const catalogImageSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - url: ['url', optional(nullable(string()))], - caption: ['caption', optional(nullable(string()))], - photoStudioOrderId: ['photo_studio_order_id', optional(nullable(string()))], -}); diff --git a/src/models/catalogInfoResponse.ts b/src/models/catalogInfoResponse.ts deleted file mode 100644 index d2298677d..000000000 --- a/src/models/catalogInfoResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CatalogInfoResponseLimits, - catalogInfoResponseLimitsSchema, -} from './catalogInfoResponseLimits'; -import { Error, errorSchema } from './error'; -import { - StandardUnitDescriptionGroup, - standardUnitDescriptionGroupSchema, -} from './standardUnitDescriptionGroup'; - -export interface CatalogInfoResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - limits?: CatalogInfoResponseLimits; - /** Group of standard measurement units. */ - standardUnitDescriptionGroup?: StandardUnitDescriptionGroup; -} - -export const catalogInfoResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - limits: ['limits', optional(lazy(() => catalogInfoResponseLimitsSchema))], - standardUnitDescriptionGroup: [ - 'standard_unit_description_group', - optional(lazy(() => standardUnitDescriptionGroupSchema)), - ], -}); diff --git a/src/models/catalogInfoResponseLimits.ts b/src/models/catalogInfoResponseLimits.ts deleted file mode 100644 index d23e99d16..000000000 --- a/src/models/catalogInfoResponseLimits.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { nullable, number, object, optional, Schema } from '../schema'; - -export interface CatalogInfoResponseLimits { - /** - * The maximum number of objects that may appear within a single batch in a - * `/v2/catalog/batch-upsert` request. - */ - batchUpsertMaxObjectsPerBatch?: number | null; - /** - * The maximum number of objects that may appear across all batches in a - * `/v2/catalog/batch-upsert` request. - */ - batchUpsertMaxTotalObjects?: number | null; - /** - * The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve` - * request. - */ - batchRetrieveMaxObjectIds?: number | null; - /** - * The maximum number of results that may be returned in a page of a - * `/v2/catalog/search` response. - */ - searchMaxPageLimit?: number | null; - /** - * The maximum number of object IDs that may be included in a single - * `/v2/catalog/batch-delete` request. - */ - batchDeleteMaxObjectIds?: number | null; - /** - * The maximum number of item IDs that may be included in a single - * `/v2/catalog/update-item-taxes` request. - */ - updateItemTaxesMaxItemIds?: number | null; - /** - * The maximum number of tax IDs to be enabled that may be included in a single - * `/v2/catalog/update-item-taxes` request. - */ - updateItemTaxesMaxTaxesToEnable?: number | null; - /** - * The maximum number of tax IDs to be disabled that may be included in a single - * `/v2/catalog/update-item-taxes` request. - */ - updateItemTaxesMaxTaxesToDisable?: number | null; - /** - * The maximum number of item IDs that may be included in a single - * `/v2/catalog/update-item-modifier-lists` request. - */ - updateItemModifierListsMaxItemIds?: number | null; - /** - * The maximum number of modifier list IDs to be enabled that may be included in - * a single `/v2/catalog/update-item-modifier-lists` request. - */ - updateItemModifierListsMaxModifierListsToEnable?: number | null; - /** - * The maximum number of modifier list IDs to be disabled that may be included in - * a single `/v2/catalog/update-item-modifier-lists` request. - */ - updateItemModifierListsMaxModifierListsToDisable?: number | null; -} - -export const catalogInfoResponseLimitsSchema: Schema = object( - { - batchUpsertMaxObjectsPerBatch: [ - 'batch_upsert_max_objects_per_batch', - optional(nullable(number())), - ], - batchUpsertMaxTotalObjects: [ - 'batch_upsert_max_total_objects', - optional(nullable(number())), - ], - batchRetrieveMaxObjectIds: [ - 'batch_retrieve_max_object_ids', - optional(nullable(number())), - ], - searchMaxPageLimit: ['search_max_page_limit', optional(nullable(number()))], - batchDeleteMaxObjectIds: [ - 'batch_delete_max_object_ids', - optional(nullable(number())), - ], - updateItemTaxesMaxItemIds: [ - 'update_item_taxes_max_item_ids', - optional(nullable(number())), - ], - updateItemTaxesMaxTaxesToEnable: [ - 'update_item_taxes_max_taxes_to_enable', - optional(nullable(number())), - ], - updateItemTaxesMaxTaxesToDisable: [ - 'update_item_taxes_max_taxes_to_disable', - optional(nullable(number())), - ], - updateItemModifierListsMaxItemIds: [ - 'update_item_modifier_lists_max_item_ids', - optional(nullable(number())), - ], - updateItemModifierListsMaxModifierListsToEnable: [ - 'update_item_modifier_lists_max_modifier_lists_to_enable', - optional(nullable(number())), - ], - updateItemModifierListsMaxModifierListsToDisable: [ - 'update_item_modifier_lists_max_modifier_lists_to_disable', - optional(nullable(number())), - ], - } -); diff --git a/src/models/catalogItem.ts b/src/models/catalogItem.ts deleted file mode 100644 index ea459af1f..000000000 --- a/src/models/catalogItem.ts +++ /dev/null @@ -1,204 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CatalogEcomSeoData, - catalogEcomSeoDataSchema, -} from './catalogEcomSeoData'; -import { - CatalogItemFoodAndBeverageDetails, - catalogItemFoodAndBeverageDetailsSchema, -} from './catalogItemFoodAndBeverageDetails'; -import { - CatalogItemModifierListInfo, - catalogItemModifierListInfoSchema, -} from './catalogItemModifierListInfo'; -import { - CatalogItemOptionForItem, - catalogItemOptionForItemSchema, -} from './catalogItemOptionForItem'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { - CatalogObjectCategory, - catalogObjectCategorySchema, -} from './catalogObjectCategory'; - -/** A [CatalogObject]($m/CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog. */ -export interface CatalogItem { - /** The item's name. This is a searchable attribute for use in applicable query filters, its value must not be empty, and the length is of Unicode code points. */ - name?: string | null; - /** - * The item's description. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. - * Deprecated at 2022-07-20, this field is planned to retire in 6 months. You should migrate to use `description_html` to set the description - * of the [CatalogItem](entity:CatalogItem) instance. The `description` and `description_html` field values are kept in sync. If you try to - * set the both fields, the `description_html` text value overwrites the `description` value. Updates in one field are also reflected in the other, - * except for when you use an early version before Square API 2022-07-20 and `description_html` is set to blank, setting the `description` value to null - * does not nullify `description_html`. - */ - description?: string | null; - /** - * The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. - * This attribute is searchable, and its value length is of Unicode code points. - */ - abbreviation?: string | null; - /** The color of the item's display label in the Square Point of Sale app. This must be a valid hex color code. */ - labelColor?: string | null; - /** Indicates whether the item is taxable (`true`) or non-taxable (`false`). Default is `true`. */ - isTaxable?: boolean | null; - /** If `true`, the item can be added to shipping orders from the merchant's online store. */ - availableOnline?: boolean | null; - /** If `true`, the item can be added to pickup orders from the merchant's online store. */ - availableForPickup?: boolean | null; - /** If `true`, the item can be added to electronically fulfilled orders from the merchant's online store. */ - availableElectronically?: boolean | null; - /** The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead. */ - categoryId?: string | null; - /** - * A set of IDs indicating the taxes enabled for - * this item. When updating an item, any taxes listed here will be added to the item. - * Taxes may also be added to or deleted from an item using `UpdateItemTaxes`. - */ - taxIds?: string[] | null; - /** - * A set of `CatalogItemModifierListInfo` objects - * representing the modifier lists that apply to this item, along with the overrides and min - * and max limits that are specific to this item. Modifier lists - * may also be added to or deleted from an item using `UpdateItemModifierLists`. - */ - modifierListInfo?: CatalogItemModifierListInfo[] | null; - /** - * A list of [CatalogItemVariation](entity:CatalogItemVariation) objects for this item. An item must have - * at least one variation. - */ - variations?: CatalogObject[] | null; - /** The type of a CatalogItem. Connect V2 only allows the creation of `REGULAR` or `APPOINTMENTS_SERVICE` items. */ - productType?: string; - /** - * If `false`, the Square Point of Sale app will present the `CatalogItem`'s - * details screen immediately, allowing the merchant to choose `CatalogModifier`s - * before adding the item to the cart. This is the default behavior. - * If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected - * modifiers, and merchants can edit modifiers by drilling down onto the item's details. - * Third-party clients are encouraged to implement similar behaviors. - */ - skipModifierScreen?: boolean | null; - /** - * List of item options IDs for this item. Used to manage and group item - * variations in a specified order. - * Maximum: 6 item options. - */ - itemOptions?: CatalogItemOptionForItem[] | null; - /** - * The IDs of images associated with this `CatalogItem` instance. - * These images will be shown to customers in Square Online Store. - * The first image will show up as the icon for this item in POS. - */ - imageIds?: string[] | null; - /** - * A name to sort the item by. If this name is unspecified, namely, the `sort_name` field is absent, the regular `name` field is used for sorting. - * Its value must not be empty. - * It is currently supported for sellers of the Japanese locale only. - */ - sortName?: string | null; - /** The list of categories. */ - categories?: CatalogObjectCategory[] | null; - /** - * The item's description as expressed in valid HTML elements. The length of this field value, including those of HTML tags, - * is of Unicode points. With application query filters, the text values of the HTML elements and attributes are searchable. Invalid or - * unsupported HTML elements or attributes are ignored. - * Supported HTML elements include: - * - `a`: Link. Supports linking to website URLs, email address, and telephone numbers. - * - `b`, `strong`: Bold text - * - `br`: Line break - * - `code`: Computer code - * - `div`: Section - * - `h1-h6`: Headings - * - `i`, `em`: Italics - * - `li`: List element - * - `ol`: Numbered list - * - `p`: Paragraph - * - `ul`: Bullet list - * - `u`: Underline - * Supported HTML attributes include: - * - `align`: Alignment of the text content - * - `href`: Link destination - * - `rel`: Relationship between link's target and source - * - `target`: Place to open the linked document - */ - descriptionHtml?: string | null; - /** A server-generated plaintext version of the `description_html` field, without formatting tags. */ - descriptionPlaintext?: string; - /** A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. */ - channels?: string[] | null; - /** Indicates whether this item is archived (`true`) or not (`false`). */ - isArchived?: boolean | null; - /** SEO data for for a seller's Square Online store. */ - ecomSeoData?: CatalogEcomSeoData; - /** The food and beverage-specific details of a `FOOD_AND_BEV` item. */ - foodAndBeverageDetails?: CatalogItemFoodAndBeverageDetails; - /** - * A category that can be assigned to an item or a parent category that can be assigned - * to another category. For example, a clothing category can be assigned to a t-shirt item or - * be made as the parent category to the pants category. - */ - reportingCategory?: CatalogObjectCategory; -} - -export const catalogItemSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - abbreviation: ['abbreviation', optional(nullable(string()))], - labelColor: ['label_color', optional(nullable(string()))], - isTaxable: ['is_taxable', optional(nullable(boolean()))], - availableOnline: ['available_online', optional(nullable(boolean()))], - availableForPickup: ['available_for_pickup', optional(nullable(boolean()))], - availableElectronically: [ - 'available_electronically', - optional(nullable(boolean())), - ], - categoryId: ['category_id', optional(nullable(string()))], - taxIds: ['tax_ids', optional(nullable(array(string())))], - modifierListInfo: [ - 'modifier_list_info', - optional(nullable(array(lazy(() => catalogItemModifierListInfoSchema)))), - ], - variations: [ - 'variations', - optional(nullable(array(lazy(() => catalogObjectSchema)))), - ], - productType: ['product_type', optional(string())], - skipModifierScreen: ['skip_modifier_screen', optional(nullable(boolean()))], - itemOptions: [ - 'item_options', - optional(nullable(array(lazy(() => catalogItemOptionForItemSchema)))), - ], - imageIds: ['image_ids', optional(nullable(array(string())))], - sortName: ['sort_name', optional(nullable(string()))], - categories: [ - 'categories', - optional(nullable(array(lazy(() => catalogObjectCategorySchema)))), - ], - descriptionHtml: ['description_html', optional(nullable(string()))], - descriptionPlaintext: ['description_plaintext', optional(string())], - channels: ['channels', optional(nullable(array(string())))], - isArchived: ['is_archived', optional(nullable(boolean()))], - ecomSeoData: [ - 'ecom_seo_data', - optional(lazy(() => catalogEcomSeoDataSchema)), - ], - foodAndBeverageDetails: [ - 'food_and_beverage_details', - optional(lazy(() => catalogItemFoodAndBeverageDetailsSchema)), - ], - reportingCategory: [ - 'reporting_category', - optional(lazy(() => catalogObjectCategorySchema)), - ], -}); diff --git a/src/models/catalogItemFoodAndBeverageDetails.ts b/src/models/catalogItemFoodAndBeverageDetails.ts deleted file mode 100644 index f91a5e1e6..000000000 --- a/src/models/catalogItemFoodAndBeverageDetails.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, -} from '../schema'; -import { - CatalogItemFoodAndBeverageDetailsDietaryPreference, - catalogItemFoodAndBeverageDetailsDietaryPreferenceSchema, -} from './catalogItemFoodAndBeverageDetailsDietaryPreference'; -import { - CatalogItemFoodAndBeverageDetailsIngredient, - catalogItemFoodAndBeverageDetailsIngredientSchema, -} from './catalogItemFoodAndBeverageDetailsIngredient'; - -/** The food and beverage-specific details of a `FOOD_AND_BEV` item. */ -export interface CatalogItemFoodAndBeverageDetails { - /** The calorie count (in the unit of kcal) for the `FOOD_AND_BEV` type of items. */ - calorieCount?: number | null; - /** The dietary preferences for the `FOOD_AND_BEV` item. */ - dietaryPreferences?: - | CatalogItemFoodAndBeverageDetailsDietaryPreference[] - | null; - /** The ingredients for the `FOOD_AND_BEV` type item. */ - ingredients?: CatalogItemFoodAndBeverageDetailsIngredient[] | null; -} - -export const catalogItemFoodAndBeverageDetailsSchema: Schema = object( - { - calorieCount: ['calorie_count', optional(nullable(number()))], - dietaryPreferences: [ - 'dietary_preferences', - optional( - nullable( - array( - lazy(() => catalogItemFoodAndBeverageDetailsDietaryPreferenceSchema) - ) - ) - ), - ], - ingredients: [ - 'ingredients', - optional( - nullable( - array(lazy(() => catalogItemFoodAndBeverageDetailsIngredientSchema)) - ) - ), - ], - } -); diff --git a/src/models/catalogItemFoodAndBeverageDetailsDietaryPreference.ts b/src/models/catalogItemFoodAndBeverageDetailsDietaryPreference.ts deleted file mode 100644 index 55a292a4e..000000000 --- a/src/models/catalogItemFoodAndBeverageDetailsDietaryPreference.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients. */ -export interface CatalogItemFoodAndBeverageDetailsDietaryPreference { - /** The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. */ - type?: string; - /** Standard dietary preferences for food and beverage items that are recommended on item creation. */ - standardName?: string; - /** The name of a user-defined custom dietary preference. This should be null if it's a standard dietary preference. */ - customName?: string | null; -} - -export const catalogItemFoodAndBeverageDetailsDietaryPreferenceSchema: Schema = object( - { - type: ['type', optional(string())], - standardName: ['standard_name', optional(string())], - customName: ['custom_name', optional(nullable(string()))], - } -); diff --git a/src/models/catalogItemFoodAndBeverageDetailsIngredient.ts b/src/models/catalogItemFoodAndBeverageDetailsIngredient.ts deleted file mode 100644 index d7ae75ae9..000000000 --- a/src/models/catalogItemFoodAndBeverageDetailsIngredient.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Describes the ingredient used in a `FOOD_AND_BEV` item. */ -export interface CatalogItemFoodAndBeverageDetailsIngredient { - /** The type of dietary preference for the `FOOD_AND_BEV` type of items and integredients. */ - type?: string; - /** Standard ingredients for food and beverage items that are recommended on item creation. */ - standardName?: string; - /** The name of a custom user-defined ingredient. This should be null if it's a standard dietary preference. */ - customName?: string | null; -} - -export const catalogItemFoodAndBeverageDetailsIngredientSchema: Schema = object( - { - type: ['type', optional(string())], - standardName: ['standard_name', optional(string())], - customName: ['custom_name', optional(nullable(string()))], - } -); diff --git a/src/models/catalogItemModifierListInfo.ts b/src/models/catalogItemModifierListInfo.ts deleted file mode 100644 index cf2a5c0eb..000000000 --- a/src/models/catalogItemModifierListInfo.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CatalogModifierOverride, - catalogModifierOverrideSchema, -} from './catalogModifierOverride'; - -/** - * References a text-based modifier or a list of non text-based modifiers applied to a `CatalogItem` instance - * and specifies supported behaviors of the application. - */ -export interface CatalogItemModifierListInfo { - /** The ID of the `CatalogModifierList` controlled by this `CatalogModifierListInfo`. */ - modifierListId: string; - /** A set of `CatalogModifierOverride` objects that override whether a given `CatalogModifier` is enabled by default. */ - modifierOverrides?: CatalogModifierOverride[] | null; - /** - * If 0 or larger, the smallest number of `CatalogModifier`s that must be selected from this `CatalogModifierList`. - * The default value is `-1`. - * When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - * and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of - * the `CatalogModifierList` can be selected from the `CatalogModifierList`. - * When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - * and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in - * and can be selected from the `CatalogModifierList` - */ - minSelectedModifiers?: number | null; - /** - * If 0 or larger, the largest number of `CatalogModifier`s that can be selected from this `CatalogModifierList`. - * The default value is `-1`. - * When `CatalogModifierList.selection_type` is `MULTIPLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - * and `CatalogModifierListInfo.max_selected_modifier=-1` means that from zero to the maximum number of modifiers of - * the `CatalogModifierList` can be selected from the `CatalogModifierList`. - * When the `CatalogModifierList.selection_type` is `SINGLE`, `CatalogModifierListInfo.min_selected_modifiers=-1` - * and `CatalogModifierListInfo.max_selected_modifier=-1` means that exactly one modifier must be present in - * and can be selected from the `CatalogModifierList` - */ - maxSelectedModifiers?: number | null; - /** If `true`, enable this `CatalogModifierList`. The default value is `true`. */ - enabled?: boolean | null; - /** - * The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied - * to a `CatalogItem` instance. - */ - ordinal?: number | null; -} - -export const catalogItemModifierListInfoSchema: Schema = object( - { - modifierListId: ['modifier_list_id', string()], - modifierOverrides: [ - 'modifier_overrides', - optional(nullable(array(lazy(() => catalogModifierOverrideSchema)))), - ], - minSelectedModifiers: [ - 'min_selected_modifiers', - optional(nullable(number())), - ], - maxSelectedModifiers: [ - 'max_selected_modifiers', - optional(nullable(number())), - ], - enabled: ['enabled', optional(nullable(boolean()))], - ordinal: ['ordinal', optional(nullable(number()))], - } -); diff --git a/src/models/catalogItemOption.ts b/src/models/catalogItemOption.ts deleted file mode 100644 index 8c9d77ae4..000000000 --- a/src/models/catalogItemOption.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; - -/** A group of variations for a `CatalogItem`. */ -export interface CatalogItemOption { - /** - * The item option's display name for the seller. Must be unique across - * all item options. This is a searchable attribute for use in applicable query filters. - */ - name?: string | null; - /** The item option's display name for the customer. This is a searchable attribute for use in applicable query filters. */ - displayName?: string | null; - /** - * The item option's human-readable description. Displayed in the Square - * Point of Sale app for the seller and in the Online Store or on receipts for - * the buyer. This is a searchable attribute for use in applicable query filters. - */ - description?: string | null; - /** If true, display colors for entries in `values` when present. */ - showColors?: boolean | null; - /** - * A list of CatalogObjects containing the - * `CatalogItemOptionValue`s for this item. - */ - values?: CatalogObject[] | null; -} - -export const catalogItemOptionSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - displayName: ['display_name', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - showColors: ['show_colors', optional(nullable(boolean()))], - values: [ - 'values', - optional(nullable(array(lazy(() => catalogObjectSchema)))), - ], -}); diff --git a/src/models/catalogItemOptionForItem.ts b/src/models/catalogItemOptionForItem.ts deleted file mode 100644 index 668f1c24a..000000000 --- a/src/models/catalogItemOptionForItem.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * An option that can be assigned to an item. - * For example, a t-shirt item may offer a color option or a size option. - */ -export interface CatalogItemOptionForItem { - /** The unique id of the item option, used to form the dimensions of the item option matrix in a specified order. */ - itemOptionId?: string | null; -} - -export const catalogItemOptionForItemSchema: Schema = object( - { itemOptionId: ['item_option_id', optional(nullable(string()))] } -); diff --git a/src/models/catalogItemOptionValue.ts b/src/models/catalogItemOptionValue.ts deleted file mode 100644 index df74ea23e..000000000 --- a/src/models/catalogItemOptionValue.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * An enumerated value that can link a - * `CatalogItemVariation` to an item option as one of - * its item option values. - */ -export interface CatalogItemOptionValue { - /** Unique ID of the associated item option. */ - itemOptionId?: string | null; - /** Name of this item option value. This is a searchable attribute for use in applicable query filters. */ - name?: string | null; - /** A human-readable description for the option value. This is a searchable attribute for use in applicable query filters. */ - description?: string | null; - /** - * The HTML-supported hex color for the item option (e.g., "#ff8d4e85"). - * Only displayed if `show_colors` is enabled on the parent `ItemOption`. When - * left unset, `color` defaults to white ("#ffffff") when `show_colors` is - * enabled on the parent `ItemOption`. - */ - color?: string | null; - /** Determines where this option value appears in a list of option values. */ - ordinal?: number | null; -} - -export const catalogItemOptionValueSchema: Schema = object( - { - itemOptionId: ['item_option_id', optional(nullable(string()))], - name: ['name', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - color: ['color', optional(nullable(string()))], - ordinal: ['ordinal', optional(nullable(number()))], - } -); diff --git a/src/models/catalogItemOptionValueForItemVariation.ts b/src/models/catalogItemOptionValueForItemVariation.ts deleted file mode 100644 index 46146ee2c..000000000 --- a/src/models/catalogItemOptionValueForItemVariation.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * A `CatalogItemOptionValue` links an item variation to an item option as - * an item option value. For example, a t-shirt item may offer a color option and - * a size option. An item option value would represent each variation of t-shirt: - * For example, "Color:Red, Size:Small" or "Color:Blue, Size:Medium". - */ -export interface CatalogItemOptionValueForItemVariation { - /** The unique id of an item option. */ - itemOptionId?: string | null; - /** The unique id of the selected value for the item option. */ - itemOptionValueId?: string | null; -} - -export const catalogItemOptionValueForItemVariationSchema: Schema = object( - { - itemOptionId: ['item_option_id', optional(nullable(string()))], - itemOptionValueId: ['item_option_value_id', optional(nullable(string()))], - } -); diff --git a/src/models/catalogItemVariation.ts b/src/models/catalogItemVariation.ts deleted file mode 100644 index 1370c15d7..000000000 --- a/src/models/catalogItemVariation.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { - array, - bigint, - boolean, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CatalogItemOptionValueForItemVariation, - catalogItemOptionValueForItemVariationSchema, -} from './catalogItemOptionValueForItemVariation'; -import { - CatalogStockConversion, - catalogStockConversionSchema, -} from './catalogStockConversion'; -import { - ItemVariationLocationOverrides, - itemVariationLocationOverridesSchema, -} from './itemVariationLocationOverrides'; -import { Money, moneySchema } from './money'; - -/** - * An item variation, representing a product for sale, in the Catalog object model. Each [item]($m/CatalogItem) must have at least one - * item variation and can have at most 250 item variations. - * An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked - * number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both - * stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass - * variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be - * converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes - * the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count - * decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. - */ -export interface CatalogItemVariation { - /** The ID of the `CatalogItem` associated with this item variation. */ - itemId?: string | null; - /** - * The item variation's name. This is a searchable attribute for use in applicable query filters. - * Its value has a maximum length of 255 Unicode code points. However, when the parent [item](entity:CatalogItem) - * uses [item options](entity:CatalogItemOption), this attribute is auto-generated, read-only, and can be - * longer than 255 Unicode code points. - */ - name?: string | null; - /** The item variation's SKU, if any. This is a searchable attribute for use in applicable query filters. */ - sku?: string | null; - /** - * The universal product code (UPC) of the item variation, if any. This is a searchable attribute for use in applicable query filters. - * The value of this attribute should be a number of 12-14 digits long. This restriction is enforced on the Square Seller Dashboard, - * Square Point of Sale or Retail Point of Sale apps, where this attribute shows in the GTIN field. If a non-compliant UPC value is assigned - * to this attribute using the API, the value is not editable on the Seller Dashboard, Square Point of Sale or Retail Point of Sale apps - * unless it is updated to fit the expected format. - */ - upc?: string | null; - /** - * The order in which this item variation should be displayed. This value is read-only. On writes, the ordinal - * for each item variation within a parent `CatalogItem` is set according to the item variations's - * position. On reads, the value is not guaranteed to be sequential or unique. - */ - ordinal?: number; - /** Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. */ - pricingType?: string; - /** - * 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; - /** Per-location price and inventory overrides. */ - locationOverrides?: ItemVariationLocationOverrides[] | null; - /** If `true`, inventory tracking is active for the variation. */ - trackInventory?: boolean | null; - /** Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. */ - inventoryAlertType?: string; - /** - * If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` - * is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. - * This value is always an integer. - */ - inventoryAlertThreshold?: bigint | null; - /** Arbitrary user metadata to associate with the item variation. This attribute value length is of Unicode code points. */ - userData?: string | null; - /** - * If the `CatalogItem` that owns this item variation is of type - * `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For - * example, a 30 minute appointment would have the value `1800000`, which is equal to - * 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second). - */ - serviceDuration?: bigint | null; - /** - * If the `CatalogItem` that owns this item variation is of type - * `APPOINTMENTS_SERVICE`, a bool representing whether this service is available for booking. - */ - availableForBooking?: boolean | null; - /** - * List of item option values associated with this item variation. Listed - * in the same order as the item options of the parent item. - */ - itemOptionValues?: CatalogItemOptionValueForItemVariation[] | null; - /** - * ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity - * sold of this item variation. If left unset, the item will be sold in - * whole quantities. - */ - measurementUnitId?: string | null; - /** - * Whether this variation can be sold. The inventory count of a sellable variation indicates - * the number of units available for sale. When a variation is both stockable and sellable, - * its sellable inventory count can be smaller than or equal to its stockable count. - */ - sellable?: boolean | null; - /** - * Whether stock is counted directly on this variation (TRUE) or only on its components (FALSE). - * When a variation is both stockable and sellable, the inventory count of a stockable variation keeps track of the number of units of this variation in stock - * and is not an indicator of the number of units of the variation that can be sold. - */ - stockable?: boolean | null; - /** - * The IDs of images associated with this `CatalogItemVariation` instance. - * These images will be shown to customers in Square Online Store. - */ - imageIds?: string[] | null; - /** - * Tokens of employees that can perform the service represented by this variation. Only valid for - * variations of type `APPOINTMENTS_SERVICE`. - */ - teamMemberIds?: string[] | null; - /** - * Represents the rule of conversion between a stockable [CatalogItemVariation]($m/CatalogItemVariation) - * and a non-stockable sell-by or receive-by `CatalogItemVariation` that - * share the same underlying stock. - */ - stockableConversion?: CatalogStockConversion; -} - -export const catalogItemVariationSchema: Schema = object({ - itemId: ['item_id', optional(nullable(string()))], - name: ['name', optional(nullable(string()))], - sku: ['sku', optional(nullable(string()))], - upc: ['upc', optional(nullable(string()))], - ordinal: ['ordinal', optional(number())], - pricingType: ['pricing_type', optional(string())], - priceMoney: ['price_money', optional(lazy(() => moneySchema))], - locationOverrides: [ - 'location_overrides', - optional(nullable(array(lazy(() => itemVariationLocationOverridesSchema)))), - ], - trackInventory: ['track_inventory', optional(nullable(boolean()))], - inventoryAlertType: ['inventory_alert_type', optional(string())], - inventoryAlertThreshold: [ - 'inventory_alert_threshold', - optional(nullable(bigint())), - ], - userData: ['user_data', optional(nullable(string()))], - serviceDuration: ['service_duration', optional(nullable(bigint()))], - availableForBooking: ['available_for_booking', optional(nullable(boolean()))], - itemOptionValues: [ - 'item_option_values', - optional( - nullable(array(lazy(() => catalogItemOptionValueForItemVariationSchema))) - ), - ], - measurementUnitId: ['measurement_unit_id', optional(nullable(string()))], - sellable: ['sellable', optional(nullable(boolean()))], - stockable: ['stockable', optional(nullable(boolean()))], - imageIds: ['image_ids', optional(nullable(array(string())))], - teamMemberIds: ['team_member_ids', optional(nullable(array(string())))], - stockableConversion: [ - 'stockable_conversion', - optional(lazy(() => catalogStockConversionSchema)), - ], -}); diff --git a/src/models/catalogMeasurementUnit.ts b/src/models/catalogMeasurementUnit.ts deleted file mode 100644 index fb4f70b02..000000000 --- a/src/models/catalogMeasurementUnit.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { lazy, nullable, number, object, optional, Schema } from '../schema'; -import { MeasurementUnit, measurementUnitSchema } from './measurementUnit'; - -/** - * Represents the unit used to measure a `CatalogItemVariation` and - * specifies the precision for decimal quantities. - */ -export interface CatalogMeasurementUnit { - /** - * Represents a unit of measurement to use with a quantity, such as ounces - * or inches. Exactly one of the following fields are required: `custom_unit`, - * `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. - */ - measurementUnit?: MeasurementUnit; - /** - * An integer between 0 and 5 that represents the maximum number of - * positions allowed after the decimal in quantities measured with this unit. - * For example: - * - if the precision is 0, the quantity can be 1, 2, 3, etc. - * - if the precision is 1, the quantity can be 0.1, 0.2, etc. - * - if the precision is 2, the quantity can be 0.01, 0.12, etc. - * Default: 3 - */ - precision?: number | null; -} - -export const catalogMeasurementUnitSchema: Schema = object( - { - measurementUnit: [ - 'measurement_unit', - optional(lazy(() => measurementUnitSchema)), - ], - precision: ['precision', optional(nullable(number()))], - } -); diff --git a/src/models/catalogModifier.ts b/src/models/catalogModifier.ts deleted file mode 100644 index 8024e2d18..000000000 --- a/src/models/catalogModifier.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - ModifierLocationOverrides, - modifierLocationOverridesSchema, -} from './modifierLocationOverrides'; -import { Money, moneySchema } from './money'; - -/** A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. */ -export interface CatalogModifier { - /** The modifier name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. */ - name?: 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; - /** Determines where this `CatalogModifier` appears in the `CatalogModifierList`. */ - ordinal?: number | null; - /** The ID of the `CatalogModifierList` associated with this modifier. */ - modifierListId?: string | null; - /** Location-specific price overrides. */ - locationOverrides?: ModifierLocationOverrides[] | null; - /** - * The ID of the image associated with this `CatalogModifier` instance. - * Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications. - */ - imageId?: string | null; -} - -export const catalogModifierSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - priceMoney: ['price_money', optional(lazy(() => moneySchema))], - ordinal: ['ordinal', optional(nullable(number()))], - modifierListId: ['modifier_list_id', optional(nullable(string()))], - locationOverrides: [ - 'location_overrides', - optional(nullable(array(lazy(() => modifierLocationOverridesSchema)))), - ], - imageId: ['image_id', optional(nullable(string()))], -}); diff --git a/src/models/catalogModifierList.ts b/src/models/catalogModifierList.ts deleted file mode 100644 index cf5a8a313..000000000 --- a/src/models/catalogModifierList.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; - -/** - * For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. - * For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied - * text string to be selected for the T-shirt at the time of sale. - * For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items - * at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. - * For example, a "Condiments" modifier list applicable to a "Hot Dog" item - * may contain "Ketchup", "Mustard", and "Relish" modifiers. - * A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field - * is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item - * only once and the `selection_type` field is always set to `SINGLE`. - */ -export interface CatalogModifierList { - /** - * The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of - * Unicode code points. - */ - name?: string | null; - /** The position of this `CatalogModifierList` within a list of `CatalogModifierList` instances. */ - ordinal?: number | null; - /** Indicates whether a CatalogModifierList supports multiple selections. */ - selectionType?: string; - /** - * A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`, - * for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list - * is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes: - * ``` - * { - * "id": "{{catalog_modifier_id}}", - * "type": "MODIFIER", - * "modifier_data": {{a CatalogModifier instance>}} - * } - * ``` - */ - modifiers?: CatalogObject[] | null; - /** - * The IDs of images associated with this `CatalogModifierList` instance. - * Currently these images are not displayed on Square products, but may be displayed in 3rd-party applications. - */ - imageIds?: string[] | null; - /** Defines the type of `CatalogModifierList`. */ - modifierType?: string; - /** - * The maximum length, in Unicode points, of the text string of the text-based modifier as represented by - * this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. - */ - maxLength?: number | null; - /** - * Whether the text string must be a non-empty string (`true`) or not (`false`) for a text-based modifier - * as represented by this `CatalogModifierList` object with the `modifier_type` set to `TEXT`. - */ - textRequired?: boolean | null; - /** - * A note for internal use by the business. - * For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!" - * is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as - * an instruction for the business to follow. - * For non text-based modifiers, this `internal_name` attribute can be - * used to include SKUs, internal codes, or supplemental descriptions for internal use. - */ - internalName?: string | null; -} - -export const catalogModifierListSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - ordinal: ['ordinal', optional(nullable(number()))], - selectionType: ['selection_type', optional(string())], - modifiers: [ - 'modifiers', - optional(nullable(array(lazy(() => catalogObjectSchema)))), - ], - imageIds: ['image_ids', optional(nullable(array(string())))], - modifierType: ['modifier_type', optional(string())], - maxLength: ['max_length', optional(nullable(number()))], - textRequired: ['text_required', optional(nullable(boolean()))], - internalName: ['internal_name', optional(nullable(string()))], -}); diff --git a/src/models/catalogModifierOverride.ts b/src/models/catalogModifierOverride.ts deleted file mode 100644 index 1db7265d9..000000000 --- a/src/models/catalogModifierOverride.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** Options to control how to override the default behavior of the specified modifier. */ -export interface CatalogModifierOverride { - /** The ID of the `CatalogModifier` whose default behavior is being overridden. */ - modifierId: string; - /** If `true`, this `CatalogModifier` should be selected by default for this `CatalogItem`. */ - onByDefault?: boolean | null; -} - -export const catalogModifierOverrideSchema: Schema = object( - { - modifierId: ['modifier_id', string()], - onByDefault: ['on_by_default', optional(nullable(boolean()))], - } -); diff --git a/src/models/catalogObject.ts b/src/models/catalogObject.ts deleted file mode 100644 index 45a41d386..000000000 --- a/src/models/catalogObject.ts +++ /dev/null @@ -1,334 +0,0 @@ -import { - array, - bigint, - boolean, - dict, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CatalogAvailabilityPeriod, - catalogAvailabilityPeriodSchema, -} from './catalogAvailabilityPeriod'; -import { CatalogCategory, catalogCategorySchema } from './catalogCategory'; -import { - CatalogCustomAttributeDefinition, - catalogCustomAttributeDefinitionSchema, -} from './catalogCustomAttributeDefinition'; -import { - CatalogCustomAttributeValue, - catalogCustomAttributeValueSchema, -} from './catalogCustomAttributeValue'; -import { CatalogDiscount, catalogDiscountSchema } from './catalogDiscount'; -import { CatalogImage, catalogImageSchema } from './catalogImage'; -import { CatalogItem, catalogItemSchema } from './catalogItem'; -import { - CatalogItemOption, - catalogItemOptionSchema, -} from './catalogItemOption'; -import { - CatalogItemOptionValue, - catalogItemOptionValueSchema, -} from './catalogItemOptionValue'; -import { - CatalogItemVariation, - catalogItemVariationSchema, -} from './catalogItemVariation'; -import { - CatalogMeasurementUnit, - catalogMeasurementUnitSchema, -} from './catalogMeasurementUnit'; -import { CatalogModifier, catalogModifierSchema } from './catalogModifier'; -import { - CatalogModifierList, - catalogModifierListSchema, -} from './catalogModifierList'; -import { - CatalogPricingRule, - catalogPricingRuleSchema, -} from './catalogPricingRule'; -import { - CatalogProductSet, - catalogProductSetSchema, -} from './catalogProductSet'; -import { - CatalogQuickAmountsSettings, - catalogQuickAmountsSettingsSchema, -} from './catalogQuickAmountsSettings'; -import { - CatalogSubscriptionPlan, - catalogSubscriptionPlanSchema, -} from './catalogSubscriptionPlan'; -import { - CatalogSubscriptionPlanVariation, - catalogSubscriptionPlanVariationSchema, -} from './catalogSubscriptionPlanVariation'; -import { CatalogTax, catalogTaxSchema } from './catalogTax'; -import { - CatalogTimePeriod, - catalogTimePeriodSchema, -} from './catalogTimePeriod'; -import { CatalogV1Id, catalogV1IdSchema } from './catalogV1Id'; - -/** - * The wrapper object for the catalog entries of a given object type. - * Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. - * For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. - * In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. - * For a more detailed discussion of the Catalog data model, please see the - * [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. - */ -export interface CatalogObject { - /** - * Possible types of CatalogObjects returned from the catalog, each - * containing type-specific properties in the `*_data` field corresponding to the specified object type. - */ - type: string; - /** - * An identifier to reference this object in the catalog. When a new `CatalogObject` - * is inserted, the client should set the id to a temporary identifier starting with - * a "`#`" character. Other objects being inserted or updated within the same request - * may use this identifier to refer to the new object. - * When the server receives the new object, it will supply a unique identifier that - * replaces the temporary identifier for all future references. - */ - id: string; - /** - * Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - * would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - */ - updatedAt?: string; - /** - * The version of the object. When updating an object, the version supplied - * must match the version in the database, otherwise the write will be rejected as conflicting. - */ - version?: bigint; - /** - * If `true`, the object has been deleted from the database. Must be `false` for new objects - * being inserted. When deleted, the `updated_at` field will equal the deletion time. - */ - isDeleted?: boolean | null; - /** - * A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - * is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - * value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - * object defined by the application making the request. - * If the `CatalogCustomAttributeDefinition` object is - * defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - * the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - * `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - * if the application making the request is different from the application defining the custom attribute definition. - * Otherwise, the key used in the map is simply `"cocoa_brand"`. - * Application-defined custom attributes are set at a global (location-independent) level. - * Custom attribute values are intended to store additional information about a catalog object - * or associations with an entity in another system. Do not use custom attributes - * to store any sensitive information (personally identifiable information, card details, etc.). - */ - customAttributeValues?: Record | null; - /** - * The Connect v1 IDs for this object at each location where it is present, where they - * differ from the object's Connect V2 ID. The field will only be present for objects that - * have been created or modified by legacy APIs. - */ - catalogV1Ids?: CatalogV1Id[] | null; - /** - * If `true`, this object is present at all locations (including future locations), except where specified in - * the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - * except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - */ - presentAtAllLocations?: boolean | null; - /** - * A list of locations where the object is present, even if `present_at_all_locations` is `false`. - * This can include locations that are deactivated. - */ - presentAtLocationIds?: string[] | null; - /** - * A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - * This can include locations that are deactivated. - */ - absentAtLocationIds?: string[] | null; - /** A [CatalogObject]($m/CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog. */ - itemData?: CatalogItem; - /** A category to which a `CatalogItem` instance belongs. */ - categoryData?: CatalogCategory; - /** - * An item variation, representing a product for sale, in the Catalog object model. Each [item]($m/CatalogItem) must have at least one - * item variation and can have at most 250 item variations. - * An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked - * number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both - * stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass - * variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be - * converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes - * the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count - * decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. - */ - itemVariationData?: CatalogItemVariation; - /** A tax applicable to an item. */ - taxData?: CatalogTax; - /** A discount applicable to items. */ - discountData?: CatalogDiscount; - /** - * For a text-based modifier, this encapsulates the modifier's text when its `modifier_type` is `TEXT`. - * For example, to sell T-shirts with custom prints, a text-based modifier can be used to capture the buyer-supplied - * text string to be selected for the T-shirt at the time of sale. - * For non text-based modifiers, this encapsulates a non-empty list of modifiers applicable to items - * at the time of sale. Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. - * For example, a "Condiments" modifier list applicable to a "Hot Dog" item - * may contain "Ketchup", "Mustard", and "Relish" modifiers. - * A non text-based modifier can be applied to the modified item once or multiple times, if the `selection_type` field - * is set to `SINGLE` or `MULTIPLE`, respectively. On the other hand, a text-based modifier can be applied to the item - * only once and the `selection_type` field is always set to `SINGLE`. - */ - modifierListData?: CatalogModifierList; - /** A modifier applicable to items at the time of sale. An example of a modifier is a Cheese add-on to a Burger item. */ - modifierData?: CatalogModifier; - /** Represents a time period - either a single period or a repeating period. */ - timePeriodData?: CatalogTimePeriod; - /** - * Represents a collection of catalog objects for the purpose of applying a - * `PricingRule`. Including a catalog object will include all of its subtypes. - * For example, including a category in a product set will include all of its - * items and associated item variations in the product set. Including an item in - * a product set will also include its item variations. - */ - productSetData?: CatalogProductSet; - /** - * Defines how discounts are automatically applied to a set of items that match the pricing rule - * during the active time period. - */ - pricingRuleData?: CatalogPricingRule; - /** - * 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. - */ - imageData?: CatalogImage; - /** - * Represents the unit used to measure a `CatalogItemVariation` and - * specifies the precision for decimal quantities. - */ - measurementUnitData?: CatalogMeasurementUnit; - /** - * 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`. */ - itemOptionData?: CatalogItemOption; - /** - * An enumerated value that can link a - * `CatalogItemVariation` to an item option as one of - * its item option values. - */ - itemOptionValueData?: CatalogItemOptionValue; - /** - * 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) - */ - customAttributeDefinitionData?: CatalogCustomAttributeDefinition; - /** A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts. */ - quickAmountsSettingsData?: CatalogQuickAmountsSettings; - /** - * 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). - */ - subscriptionPlanVariationData?: CatalogSubscriptionPlanVariation; - /** Represents a time period of availability. */ - availabilityPeriodData?: CatalogAvailabilityPeriod; -} - -export const catalogObjectSchema: Schema = object({ - type: ['type', string()], - id: ['id', string()], - updatedAt: ['updated_at', optional(string())], - version: ['version', optional(bigint())], - isDeleted: ['is_deleted', optional(nullable(boolean()))], - customAttributeValues: [ - 'custom_attribute_values', - optional(nullable(dict(lazy(() => catalogCustomAttributeValueSchema)))), - ], - catalogV1Ids: [ - 'catalog_v1_ids', - optional(nullable(array(lazy(() => catalogV1IdSchema)))), - ], - presentAtAllLocations: [ - 'present_at_all_locations', - optional(nullable(boolean())), - ], - presentAtLocationIds: [ - 'present_at_location_ids', - optional(nullable(array(string()))), - ], - absentAtLocationIds: [ - 'absent_at_location_ids', - optional(nullable(array(string()))), - ], - itemData: ['item_data', optional(lazy(() => catalogItemSchema))], - categoryData: ['category_data', optional(lazy(() => catalogCategorySchema))], - itemVariationData: [ - 'item_variation_data', - optional(lazy(() => catalogItemVariationSchema)), - ], - taxData: ['tax_data', optional(lazy(() => catalogTaxSchema))], - discountData: ['discount_data', optional(lazy(() => catalogDiscountSchema))], - modifierListData: [ - 'modifier_list_data', - optional(lazy(() => catalogModifierListSchema)), - ], - modifierData: ['modifier_data', optional(lazy(() => catalogModifierSchema))], - timePeriodData: [ - 'time_period_data', - optional(lazy(() => catalogTimePeriodSchema)), - ], - productSetData: [ - 'product_set_data', - optional(lazy(() => catalogProductSetSchema)), - ], - pricingRuleData: [ - 'pricing_rule_data', - optional(lazy(() => catalogPricingRuleSchema)), - ], - imageData: ['image_data', optional(lazy(() => catalogImageSchema))], - measurementUnitData: [ - 'measurement_unit_data', - optional(lazy(() => catalogMeasurementUnitSchema)), - ], - subscriptionPlanData: [ - 'subscription_plan_data', - optional(lazy(() => catalogSubscriptionPlanSchema)), - ], - itemOptionData: [ - 'item_option_data', - optional(lazy(() => catalogItemOptionSchema)), - ], - itemOptionValueData: [ - 'item_option_value_data', - optional(lazy(() => catalogItemOptionValueSchema)), - ], - customAttributeDefinitionData: [ - 'custom_attribute_definition_data', - optional(lazy(() => catalogCustomAttributeDefinitionSchema)), - ], - quickAmountsSettingsData: [ - 'quick_amounts_settings_data', - optional(lazy(() => catalogQuickAmountsSettingsSchema)), - ], - subscriptionPlanVariationData: [ - 'subscription_plan_variation_data', - optional(lazy(() => catalogSubscriptionPlanVariationSchema)), - ], - availabilityPeriodData: [ - 'availability_period_data', - optional(lazy(() => catalogAvailabilityPeriodSchema)), - ], -}); diff --git a/src/models/catalogObjectBatch.ts b/src/models/catalogObjectBatch.ts deleted file mode 100644 index 4ccd6b536..000000000 --- a/src/models/catalogObjectBatch.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, Schema } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; - -/** A batch of catalog objects. */ -export interface CatalogObjectBatch { - /** A list of CatalogObjects belonging to this batch. */ - objects: CatalogObject[]; -} - -export const catalogObjectBatchSchema: Schema = object({ - objects: ['objects', array(lazy(() => catalogObjectSchema))], -}); diff --git a/src/models/catalogObjectCategory.ts b/src/models/catalogObjectCategory.ts deleted file mode 100644 index 0cbec013a..000000000 --- a/src/models/catalogObjectCategory.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { bigint, nullable, object, optional, Schema, string } from '../schema'; - -/** - * A category that can be assigned to an item or a parent category that can be assigned - * to another category. For example, a clothing category can be assigned to a t-shirt item or - * be made as the parent category to the pants category. - */ -export interface CatalogObjectCategory { - /** The ID of the object's category. */ - id?: string; - /** The order of the object within the context of the category. */ - ordinal?: bigint | null; -} - -export const catalogObjectCategorySchema: Schema = object( - { - id: ['id', optional(string())], - ordinal: ['ordinal', optional(nullable(bigint()))], - } -); diff --git a/src/models/catalogObjectReference.ts b/src/models/catalogObjectReference.ts deleted file mode 100644 index 9b3ce239c..000000000 --- a/src/models/catalogObjectReference.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { bigint, nullable, object, optional, Schema, string } from '../schema'; - -/** - * A reference to a Catalog object at a specific version. In general this is - * used as an entry point into a graph of catalog objects, where the objects exist - * at a specific version. - */ -export interface CatalogObjectReference { - /** The ID of the referenced object. */ - objectId?: string | null; - /** The version of the object. */ - catalogVersion?: bigint | null; -} - -export const catalogObjectReferenceSchema: Schema = object( - { - objectId: ['object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - } -); diff --git a/src/models/catalogPricingRule.ts b/src/models/catalogPricingRule.ts deleted file mode 100644 index 44c3e05e8..000000000 --- a/src/models/catalogPricingRule.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Defines how discounts are automatically applied to a set of items that match the pricing rule - * during the active time period. - */ -export interface CatalogPricingRule { - /** - * User-defined name for the pricing rule. For example, "Buy one get one - * free" or "10% off". - */ - name?: string | null; - /** - * A list of unique IDs for the catalog time periods when - * this pricing rule is in effect. If left unset, the pricing rule is always - * in effect. - */ - timePeriodIds?: string[] | null; - /** - * Unique ID for the `CatalogDiscount` to take off - * the price of all matched items. - */ - discountId?: string | null; - /** - * Unique ID for the `CatalogProductSet` that will be matched by this rule. A match rule - * matches within the entire cart, and can match multiple times. This field will always be set. - */ - matchProductsId?: string | null; - /** - * __Deprecated__: Please use the `exclude_products_id` field to apply - * an exclude set instead. Exclude sets allow better control over quantity - * ranges and offer more flexibility for which matched items receive a discount. - * `CatalogProductSet` to apply the pricing to. - * An apply rule matches within the subset of the cart that fits the match rules (the match set). - * An apply rule can only match once in the match set. - * If not supplied, the pricing will be applied to all products in the match set. - * Other products retain their base price, or a price generated by other rules. - */ - applyProductsId?: string | null; - /** - * `CatalogProductSet` to exclude from the pricing rule. - * An exclude rule matches within the subset of the cart that fits the match rules (the match set). - * An exclude rule can only match once in the match set. - * If not supplied, the pricing will be applied to all products in the match set. - * Other products retain their base price, or a price generated by other rules. - */ - excludeProductsId?: string | null; - /** Represents the date the Pricing Rule is valid from. Represented in RFC 3339 full-date format (YYYY-MM-DD). */ - validFromDate?: string | null; - /** - * Represents the local time the pricing rule should be valid from. Represented in RFC 3339 partial-time format - * (HH:MM:SS). Partial seconds will be truncated. - */ - validFromLocalTime?: string | null; - /** Represents the date the Pricing Rule is valid until. Represented in RFC 3339 full-date format (YYYY-MM-DD). */ - validUntilDate?: string | null; - /** - * Represents the local time the pricing rule should be valid until. Represented in RFC 3339 partial-time format - * (HH:MM:SS). Partial seconds will be truncated. - */ - validUntilLocalTime?: string | null; - /** - * Indicates which products matched by a CatalogPricingRule - * will be excluded if the pricing rule uses an exclude set. - */ - excludeStrategy?: string; - /** - * 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. - */ - minimumOrderSubtotalMoney?: Money; - /** - * A list of IDs of customer groups, the members of which are eligible for discounts specified in this pricing rule. - * Notice that a group ID is generated by the Customers API. - * If this field is not set, the specified discount applies to matched products sold to anyone whether the buyer - * has a customer profile created or not. If this `customer_group_ids_any` field is set, the specified discount - * applies only to matched products sold to customers belonging to the specified customer groups. - */ - customerGroupIdsAny?: string[] | null; -} - -export const catalogPricingRuleSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - timePeriodIds: ['time_period_ids', optional(nullable(array(string())))], - discountId: ['discount_id', optional(nullable(string()))], - matchProductsId: ['match_products_id', optional(nullable(string()))], - applyProductsId: ['apply_products_id', optional(nullable(string()))], - excludeProductsId: ['exclude_products_id', optional(nullable(string()))], - validFromDate: ['valid_from_date', optional(nullable(string()))], - validFromLocalTime: ['valid_from_local_time', optional(nullable(string()))], - validUntilDate: ['valid_until_date', optional(nullable(string()))], - validUntilLocalTime: ['valid_until_local_time', optional(nullable(string()))], - excludeStrategy: ['exclude_strategy', optional(string())], - minimumOrderSubtotalMoney: [ - 'minimum_order_subtotal_money', - optional(lazy(() => moneySchema)), - ], - customerGroupIdsAny: [ - 'customer_group_ids_any', - optional(nullable(array(string()))), - ], -}); diff --git a/src/models/catalogProductSet.ts b/src/models/catalogProductSet.ts deleted file mode 100644 index c007d0847..000000000 --- a/src/models/catalogProductSet.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - array, - bigint, - boolean, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * Represents a collection of catalog objects for the purpose of applying a - * `PricingRule`. Including a catalog object will include all of its subtypes. - * For example, including a category in a product set will include all of its - * items and associated item variations in the product set. Including an item in - * a product set will also include its item variations. - */ -export interface CatalogProductSet { - /** - * User-defined name for the product set. For example, "Clearance Items" - * or "Winter Sale Items". - */ - name?: string | null; - /** - * Unique IDs for any `CatalogObject` included in this product set. Any - * number of these catalog objects can be in an order for a pricing rule to apply. - * This can be used with `product_ids_all` in a parent `CatalogProductSet` to - * match groups of products for a bulk discount, such as a discount for an - * entree and side combo. - * Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. - * Max: 500 catalog object IDs. - */ - productIdsAny?: string[] | null; - /** - * Unique IDs for any `CatalogObject` included in this product set. - * All objects in this set must be included in an order for a pricing rule to apply. - * Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. - * Max: 500 catalog object IDs. - */ - productIdsAll?: string[] | null; - /** - * If set, there must be exactly this many items from `products_any` or `products_all` - * in the cart for the discount to apply. - * Cannot be combined with either `quantity_min` or `quantity_max`. - */ - quantityExact?: bigint | null; - /** - * If set, there must be at least this many items from `products_any` or `products_all` - * in a cart for the discount to apply. See `quantity_exact`. Defaults to 0 if - * `quantity_exact`, `quantity_min` and `quantity_max` are all unspecified. - */ - quantityMin?: bigint | null; - /** - * If set, the pricing rule will apply to a maximum of this many items from - * `products_any` or `products_all`. - */ - quantityMax?: bigint | null; - /** - * If set to `true`, the product set will include every item in the catalog. - * Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. - */ - allProducts?: boolean | null; -} - -export const catalogProductSetSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - productIdsAny: ['product_ids_any', optional(nullable(array(string())))], - productIdsAll: ['product_ids_all', optional(nullable(array(string())))], - quantityExact: ['quantity_exact', optional(nullable(bigint()))], - quantityMin: ['quantity_min', optional(nullable(bigint()))], - quantityMax: ['quantity_max', optional(nullable(bigint()))], - allProducts: ['all_products', optional(nullable(boolean()))], -}); diff --git a/src/models/catalogQuery.ts b/src/models/catalogQuery.ts deleted file mode 100644 index 23f741e4a..000000000 --- a/src/models/catalogQuery.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - CatalogQueryExact, - catalogQueryExactSchema, -} from './catalogQueryExact'; -import { - CatalogQueryItemsForItemOptions, - catalogQueryItemsForItemOptionsSchema, -} from './catalogQueryItemsForItemOptions'; -import { - CatalogQueryItemsForModifierList, - catalogQueryItemsForModifierListSchema, -} from './catalogQueryItemsForModifierList'; -import { - CatalogQueryItemsForTax, - catalogQueryItemsForTaxSchema, -} from './catalogQueryItemsForTax'; -import { - CatalogQueryItemVariationsForItemOptionValues, - catalogQueryItemVariationsForItemOptionValuesSchema, -} from './catalogQueryItemVariationsForItemOptionValues'; -import { - CatalogQueryPrefix, - catalogQueryPrefixSchema, -} from './catalogQueryPrefix'; -import { - CatalogQueryRange, - catalogQueryRangeSchema, -} from './catalogQueryRange'; -import { CatalogQuerySet, catalogQuerySetSchema } from './catalogQuerySet'; -import { - CatalogQuerySortedAttribute, - catalogQuerySortedAttributeSchema, -} from './catalogQuerySortedAttribute'; -import { CatalogQueryText, catalogQueryTextSchema } from './catalogQueryText'; - -/** - * A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint. - * Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects). - * Any combination of the following types may be used together: - * - [exact_query]($m/CatalogQueryExact) - * - [prefix_query]($m/CatalogQueryPrefix) - * - [range_query]($m/CatalogQueryRange) - * - [sorted_attribute_query]($m/CatalogQuerySortedAttribute) - * - [text_query]($m/CatalogQueryText) - * All other query types cannot be combined with any others. - * When a query filter is based on an attribute, the attribute must be searchable. - * Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters. - * Searchable attribute and objects queryable by searchable attributes: - * - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue` - * - `description`: `CatalogItem`, `CatalogItemOptionValue` - * - `abbreviation`: `CatalogItem` - * - `upc`: `CatalogItemVariation` - * - `sku`: `CatalogItemVariation` - * - `caption`: `CatalogImage` - * - `display_name`: `CatalogItemOption` - * For example, to search for [CatalogItem]($m/CatalogItem) objects by searchable attributes, you can use - * the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter. - */ -export interface CatalogQuery { - /** The query expression to specify the key to sort search results. */ - sortedAttributeQuery?: CatalogQuerySortedAttribute; - /** The query filter to return the search result by exact match of the specified attribute name and value. */ - exactQuery?: CatalogQueryExact; - /** - * The query filter to return the search result(s) by exact match of the specified `attribute_name` and any of - * the `attribute_values`. - */ - setQuery?: CatalogQuerySet; - /** The query filter to return the search result whose named attribute values are prefixed by the specified attribute value. */ - prefixQuery?: CatalogQueryPrefix; - /** The query filter to return the search result whose named attribute values fall between the specified range. */ - rangeQuery?: CatalogQueryRange; - /** The query filter to return the search result whose searchable attribute values contain all of the specified keywords or tokens, independent of the token order or case. */ - textQuery?: CatalogQueryText; - /** The query filter to return the items containing the specified tax IDs. */ - itemsForTaxQuery?: CatalogQueryItemsForTax; - /** The query filter to return the items containing the specified modifier list IDs. */ - itemsForModifierListQuery?: CatalogQueryItemsForModifierList; - /** The query filter to return the items containing the specified item option IDs. */ - itemsForItemOptionsQuery?: CatalogQueryItemsForItemOptions; - /** The query filter to return the item variations containing the specified item option value IDs. */ - itemVariationsForItemOptionValuesQuery?: CatalogQueryItemVariationsForItemOptionValues; -} - -export const catalogQuerySchema: Schema = object({ - sortedAttributeQuery: [ - 'sorted_attribute_query', - optional(lazy(() => catalogQuerySortedAttributeSchema)), - ], - exactQuery: ['exact_query', optional(lazy(() => catalogQueryExactSchema))], - setQuery: ['set_query', optional(lazy(() => catalogQuerySetSchema))], - prefixQuery: ['prefix_query', optional(lazy(() => catalogQueryPrefixSchema))], - rangeQuery: ['range_query', optional(lazy(() => catalogQueryRangeSchema))], - textQuery: ['text_query', optional(lazy(() => catalogQueryTextSchema))], - itemsForTaxQuery: [ - 'items_for_tax_query', - optional(lazy(() => catalogQueryItemsForTaxSchema)), - ], - itemsForModifierListQuery: [ - 'items_for_modifier_list_query', - optional(lazy(() => catalogQueryItemsForModifierListSchema)), - ], - itemsForItemOptionsQuery: [ - 'items_for_item_options_query', - optional(lazy(() => catalogQueryItemsForItemOptionsSchema)), - ], - itemVariationsForItemOptionValuesQuery: [ - 'item_variations_for_item_option_values_query', - optional(lazy(() => catalogQueryItemVariationsForItemOptionValuesSchema)), - ], -}); diff --git a/src/models/catalogQueryExact.ts b/src/models/catalogQueryExact.ts deleted file mode 100644 index c4927d862..000000000 --- a/src/models/catalogQueryExact.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** The query filter to return the search result by exact match of the specified attribute name and value. */ -export interface CatalogQueryExact { - /** The name of the attribute to be searched. Matching of the attribute name is exact. */ - attributeName: string; - /** - * The desired value of the search attribute. Matching of the attribute value is case insensitive and can be partial. - * For example, if a specified value of "sma", objects with the named attribute value of "Small", "small" are both matched. - */ - attributeValue: string; -} - -export const catalogQueryExactSchema: Schema = object({ - attributeName: ['attribute_name', string()], - attributeValue: ['attribute_value', string()], -}); diff --git a/src/models/catalogQueryItemVariationsForItemOptionValues.ts b/src/models/catalogQueryItemVariationsForItemOptionValues.ts deleted file mode 100644 index 52f7f891a..000000000 --- a/src/models/catalogQueryItemVariationsForItemOptionValues.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** The query filter to return the item variations containing the specified item option value IDs. */ -export interface CatalogQueryItemVariationsForItemOptionValues { - /** - * A set of `CatalogItemOptionValue` IDs to be used to find associated - * `CatalogItemVariation`s. All ItemVariations that contain all of the given - * Item Option Values (in any order) will be returned. - */ - itemOptionValueIds?: string[] | null; -} - -export const catalogQueryItemVariationsForItemOptionValuesSchema: Schema = object( - { - itemOptionValueIds: [ - 'item_option_value_ids', - optional(nullable(array(string()))), - ], - } -); diff --git a/src/models/catalogQueryItemsForItemOptions.ts b/src/models/catalogQueryItemsForItemOptions.ts deleted file mode 100644 index 2cba7dc0c..000000000 --- a/src/models/catalogQueryItemsForItemOptions.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** The query filter to return the items containing the specified item option IDs. */ -export interface CatalogQueryItemsForItemOptions { - /** - * A set of `CatalogItemOption` IDs to be used to find associated - * `CatalogItem`s. All Items that contain all of the given Item Options (in any order) - * will be returned. - */ - itemOptionIds?: string[] | null; -} - -export const catalogQueryItemsForItemOptionsSchema: Schema = object( - { itemOptionIds: ['item_option_ids', optional(nullable(array(string())))] } -); diff --git a/src/models/catalogQueryItemsForModifierList.ts b/src/models/catalogQueryItemsForModifierList.ts deleted file mode 100644 index c6a00fef1..000000000 --- a/src/models/catalogQueryItemsForModifierList.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** The query filter to return the items containing the specified modifier list IDs. */ -export interface CatalogQueryItemsForModifierList { - /** A set of `CatalogModifierList` IDs to be used to find associated `CatalogItem`s. */ - modifierListIds: string[]; -} - -export const catalogQueryItemsForModifierListSchema: Schema = object( - { modifierListIds: ['modifier_list_ids', array(string())] } -); diff --git a/src/models/catalogQueryItemsForTax.ts b/src/models/catalogQueryItemsForTax.ts deleted file mode 100644 index a6ff9b09e..000000000 --- a/src/models/catalogQueryItemsForTax.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** The query filter to return the items containing the specified tax IDs. */ -export interface CatalogQueryItemsForTax { - /** A set of `CatalogTax` IDs to be used to find associated `CatalogItem`s. */ - taxIds: string[]; -} - -export const catalogQueryItemsForTaxSchema: Schema = object( - { taxIds: ['tax_ids', array(string())] } -); diff --git a/src/models/catalogQueryPrefix.ts b/src/models/catalogQueryPrefix.ts deleted file mode 100644 index 60de8edeb..000000000 --- a/src/models/catalogQueryPrefix.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** The query filter to return the search result whose named attribute values are prefixed by the specified attribute value. */ -export interface CatalogQueryPrefix { - /** The name of the attribute to be searched. */ - attributeName: string; - /** The desired prefix of the search attribute value. */ - attributePrefix: string; -} - -export const catalogQueryPrefixSchema: Schema = object({ - attributeName: ['attribute_name', string()], - attributePrefix: ['attribute_prefix', string()], -}); diff --git a/src/models/catalogQueryRange.ts b/src/models/catalogQueryRange.ts deleted file mode 100644 index 2109fe871..000000000 --- a/src/models/catalogQueryRange.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { bigint, nullable, object, optional, Schema, string } from '../schema'; - -/** The query filter to return the search result whose named attribute values fall between the specified range. */ -export interface CatalogQueryRange { - /** The name of the attribute to be searched. */ - attributeName: string; - /** The desired minimum value for the search attribute (inclusive). */ - attributeMinValue?: bigint | null; - /** The desired maximum value for the search attribute (inclusive). */ - attributeMaxValue?: bigint | null; -} - -export const catalogQueryRangeSchema: Schema = object({ - attributeName: ['attribute_name', string()], - attributeMinValue: ['attribute_min_value', optional(nullable(bigint()))], - attributeMaxValue: ['attribute_max_value', optional(nullable(bigint()))], -}); diff --git a/src/models/catalogQuerySet.ts b/src/models/catalogQuerySet.ts deleted file mode 100644 index 8ff6c57aa..000000000 --- a/src/models/catalogQuerySet.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** - * The query filter to return the search result(s) by exact match of the specified `attribute_name` and any of - * the `attribute_values`. - */ -export interface CatalogQuerySet { - /** The name of the attribute to be searched. Matching of the attribute name is exact. */ - attributeName: string; - /** - * The desired values of the search attribute. Matching of the attribute values is exact and case insensitive. - * A maximum of 250 values may be searched in a request. - */ - attributeValues: string[]; -} - -export const catalogQuerySetSchema: Schema = object({ - attributeName: ['attribute_name', string()], - attributeValues: ['attribute_values', array(string())], -}); diff --git a/src/models/catalogQuerySortedAttribute.ts b/src/models/catalogQuerySortedAttribute.ts deleted file mode 100644 index 0d948487c..000000000 --- a/src/models/catalogQuerySortedAttribute.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** The query expression to specify the key to sort search results. */ -export interface CatalogQuerySortedAttribute { - /** The attribute whose value is used as the sort key. */ - attributeName: string; - /** - * The first attribute value to be returned by the query. Ascending sorts will return only - * objects with this value or greater, while descending sorts will return only objects with this value - * or less. If unset, start at the beginning (for ascending sorts) or end (for descending sorts). - */ - initialAttributeValue?: string | null; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; -} - -export const catalogQuerySortedAttributeSchema: Schema = object( - { - attributeName: ['attribute_name', string()], - initialAttributeValue: [ - 'initial_attribute_value', - optional(nullable(string())), - ], - sortOrder: ['sort_order', optional(string())], - } -); diff --git a/src/models/catalogQueryText.ts b/src/models/catalogQueryText.ts deleted file mode 100644 index 7a9c23a99..000000000 --- a/src/models/catalogQueryText.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** The query filter to return the search result whose searchable attribute values contain all of the specified keywords or tokens, independent of the token order or case. */ -export interface CatalogQueryText { - /** A list of 1, 2, or 3 search keywords. Keywords with fewer than 3 alphanumeric characters are ignored. */ - keywords: string[]; -} - -export const catalogQueryTextSchema: Schema = object({ - keywords: ['keywords', array(string())], -}); diff --git a/src/models/catalogQuickAmount.ts b/src/models/catalogQuickAmount.ts deleted file mode 100644 index 04953b7c8..000000000 --- a/src/models/catalogQuickAmount.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - bigint, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents a Quick Amount in the Catalog. */ -export interface CatalogQuickAmount { - /** Determines the type of a specific Quick Amount. */ - type: string; - /** - * 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. - */ - amount: Money; - /** - * Describes the ranking of the Quick Amount provided by machine learning model, in the range [0, 100]. - * MANUAL type amount will always have score = 100. - */ - score?: bigint | null; - /** The order in which this Quick Amount should be displayed. */ - ordinal?: bigint | null; -} - -export const catalogQuickAmountSchema: Schema = object({ - type: ['type', string()], - amount: ['amount', lazy(() => moneySchema)], - score: ['score', optional(nullable(bigint()))], - ordinal: ['ordinal', optional(nullable(bigint()))], -}); diff --git a/src/models/catalogQuickAmountsSettings.ts b/src/models/catalogQuickAmountsSettings.ts deleted file mode 100644 index b56388b35..000000000 --- a/src/models/catalogQuickAmountsSettings.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CatalogQuickAmount, - catalogQuickAmountSchema, -} from './catalogQuickAmount'; - -/** A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts. */ -export interface CatalogQuickAmountsSettings { - /** Determines a seller's option on Quick Amounts feature. */ - option: string; - /** - * Represents location's eligibility for auto amounts - * The boolean should be consistent with whether there are AUTO amounts in the `amounts`. - */ - eligibleForAutoAmounts?: boolean | null; - /** Represents a set of Quick Amounts at this location. */ - amounts?: CatalogQuickAmount[] | null; -} - -export const catalogQuickAmountsSettingsSchema: Schema = object( - { - option: ['option', string()], - eligibleForAutoAmounts: [ - 'eligible_for_auto_amounts', - optional(nullable(boolean())), - ], - amounts: [ - 'amounts', - optional(nullable(array(lazy(() => catalogQuickAmountSchema)))), - ], - } -); diff --git a/src/models/catalogStockConversion.ts b/src/models/catalogStockConversion.ts deleted file mode 100644 index 4d0e3d8d7..000000000 --- a/src/models/catalogStockConversion.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** - * Represents the rule of conversion between a stockable [CatalogItemVariation]($m/CatalogItemVariation) - * and a non-stockable sell-by or receive-by `CatalogItemVariation` that - * share the same underlying stock. - */ -export interface CatalogStockConversion { - /** - * References to the stockable [CatalogItemVariation](entity:CatalogItemVariation) - * for this stock conversion. Selling, receiving or recounting the non-stockable `CatalogItemVariation` - * defined with a stock conversion results in adjustments of this stockable `CatalogItemVariation`. - * This immutable field must reference a stockable `CatalogItemVariation` - * that shares the parent [CatalogItem](entity:CatalogItem) of the converted `CatalogItemVariation.` - */ - stockableItemVariationId: string; - /** - * The quantity of the stockable item variation (as identified by `stockable_item_variation_id`) - * equivalent to the non-stockable item variation quantity (as specified in `nonstockable_quantity`) - * as defined by this stock conversion. It accepts a decimal number in a string format that can take - * up to 10 digits before the decimal point and up to 5 digits after the decimal point. - */ - stockableQuantity: string; - /** - * The converted equivalent quantity of the non-stockable [CatalogItemVariation](entity:CatalogItemVariation) - * in its measurement unit. The `stockable_quantity` value and this `nonstockable_quantity` value together - * define the conversion ratio between stockable item variation and the non-stockable item variation. - * It accepts a decimal number in a string format that can take up to 10 digits before the decimal point - * and up to 5 digits after the decimal point. - */ - nonstockableQuantity: string; -} - -export const catalogStockConversionSchema: Schema = object( - { - stockableItemVariationId: ['stockable_item_variation_id', string()], - stockableQuantity: ['stockable_quantity', string()], - nonstockableQuantity: ['nonstockable_quantity', string()], - } -); diff --git a/src/models/catalogSubscriptionPlan.ts b/src/models/catalogSubscriptionPlan.ts deleted file mode 100644 index 847145fd4..000000000 --- a/src/models/catalogSubscriptionPlan.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { - SubscriptionPhase, - subscriptionPhaseSchema, -} from './subscriptionPhase'; - -/** - * 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. */ - name: string; - /** - * 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 - */ - 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( - { - name: ['name', string()], - phases: [ - '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 deleted file mode 100644 index 0ecf4367a..000000000 --- a/src/models/catalogSubscriptionPlanVariation.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { - array, - bigint, - boolean, - 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; - /** The day of the month the billing period starts. */ - monthlyBillingAnchorDate?: bigint | null; - /** Whether bills for this plan variation can be split for proration. */ - canProrate?: boolean | null; - /** - * The ID of a "successor" plan variation to this one. If the field is set, and this object is disabled at all - * locations, it indicates that this variation is deprecated and the object identified by the successor ID be used in - * its stead. - */ - successorPlanVariationId?: string | null; -} - -export const catalogSubscriptionPlanVariationSchema: Schema = object( - { - name: ['name', string()], - phases: ['phases', array(lazy(() => subscriptionPhaseSchema))], - subscriptionPlanId: ['subscription_plan_id', optional(nullable(string()))], - monthlyBillingAnchorDate: [ - 'monthly_billing_anchor_date', - optional(nullable(bigint())), - ], - canProrate: ['can_prorate', optional(nullable(boolean()))], - successorPlanVariationId: [ - 'successor_plan_variation_id', - optional(nullable(string())), - ], - } -); diff --git a/src/models/catalogTax.ts b/src/models/catalogTax.ts deleted file mode 100644 index 06c58c4d3..000000000 --- a/src/models/catalogTax.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** A tax applicable to an item. */ -export interface CatalogTax { - /** The tax's name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points. */ - name?: string | null; - /** When to calculate the taxes due on a cart. */ - calculationPhase?: string; - /** Whether to the tax amount should be additional to or included in the CatalogItem price. */ - inclusionType?: string; - /** - * The percentage of the tax in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign. - * A value of `7.5` corresponds to 7.5%. For a location-specific tax rate, contact the tax authority of the location or a tax consultant. - */ - percentage?: string | null; - /** - * If `true`, the fee applies to custom amounts entered into the Square Point of Sale - * app that are not associated with a particular `CatalogItem`. - */ - appliesToCustomAmounts?: boolean | null; - /** A Boolean flag to indicate whether the tax is displayed as enabled (`true`) in the Square Point of Sale app or not (`false`). */ - enabled?: boolean | null; - /** The ID of a `CatalogProductSet` object. If set, the tax is applicable to all products in the product set. */ - appliesToProductSetId?: string | null; -} - -export const catalogTaxSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - calculationPhase: ['calculation_phase', optional(string())], - inclusionType: ['inclusion_type', optional(string())], - percentage: ['percentage', optional(nullable(string()))], - appliesToCustomAmounts: [ - 'applies_to_custom_amounts', - optional(nullable(boolean())), - ], - enabled: ['enabled', optional(nullable(boolean()))], - appliesToProductSetId: [ - 'applies_to_product_set_id', - optional(nullable(string())), - ], -}); diff --git a/src/models/catalogTimePeriod.ts b/src/models/catalogTimePeriod.ts deleted file mode 100644 index 4115a73c4..000000000 --- a/src/models/catalogTimePeriod.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Represents a time period - either a single period or a repeating period. */ -export interface CatalogTimePeriod { - /** - * An iCalendar (RFC 5545) [event](https://tools.ietf.org/html/rfc5545#section-3.6.1), which - * specifies the name, timing, duration and recurrence of this time period. - * Example: - * ``` - * DTSTART:20190707T180000 - * DURATION:P2H - * RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR - * ``` - * Only `SUMMARY`, `DTSTART`, `DURATION` and `RRULE` fields are supported. - * `DTSTART` must be in local (unzoned) time format. Note that while `BEGIN:VEVENT` - * and `END:VEVENT` is not required in the request. The response will always - * include them. - */ - event?: string | null; -} - -export const catalogTimePeriodSchema: Schema = object({ - event: ['event', optional(nullable(string()))], -}); diff --git a/src/models/catalogV1Id.ts b/src/models/catalogV1Id.ts deleted file mode 100644 index 275337d04..000000000 --- a/src/models/catalogV1Id.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** A Square API V1 identifier of an item, including the object ID and its associated location ID. */ -export interface CatalogV1Id { - /** The ID for an object used in the Square API V1, if the object ID differs from the Square API V2 object ID. */ - catalogV1Id?: string | null; - /** The ID of the `Location` this Connect V1 ID is associated with. */ - locationId?: string | null; -} - -export const catalogV1IdSchema: Schema = object({ - catalogV1Id: ['catalog_v1_id', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], -}); diff --git a/src/models/categoryPathToRootNode.ts b/src/models/categoryPathToRootNode.ts deleted file mode 100644 index b7d20819e..000000000 --- a/src/models/categoryPathToRootNode.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** A node in the path from a retrieved category to its root node. */ -export interface CategoryPathToRootNode { - /** The category's ID. */ - categoryId?: string | null; - /** The category's name. */ - categoryName?: string | null; -} - -export const categoryPathToRootNodeSchema: Schema = object( - { - categoryId: ['category_id', optional(nullable(string()))], - categoryName: ['category_name', optional(nullable(string()))], - } -); diff --git a/src/models/changeBillingAnchorDateRequest.ts b/src/models/changeBillingAnchorDateRequest.ts deleted file mode 100644 index 9e8f92c66..000000000 --- a/src/models/changeBillingAnchorDateRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Defines input parameters in a request to the - * [ChangeBillingAnchorDate]($e/Subscriptions/ChangeBillingAnchorDate) endpoint. - */ -export interface ChangeBillingAnchorDateRequest { - /** The anchor day for the billing cycle. */ - monthlyBillingAnchorDate?: number | null; - /** - * The `YYYY-MM-DD`-formatted date when the scheduled `BILLING_ANCHOR_CHANGE` action takes - * place on the subscription. - * When this date is unspecified or falls within the current billing cycle, the billing anchor date - * is changed immediately. - */ - effectiveDate?: string | null; -} - -export const changeBillingAnchorDateRequestSchema: Schema = object( - { - monthlyBillingAnchorDate: [ - 'monthly_billing_anchor_date', - optional(nullable(number())), - ], - effectiveDate: ['effective_date', optional(nullable(string()))], - } -); diff --git a/src/models/changeBillingAnchorDateResponse.ts b/src/models/changeBillingAnchorDateResponse.ts deleted file mode 100644 index 193506501..000000000 --- a/src/models/changeBillingAnchorDateResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; -import { - SubscriptionAction, - subscriptionActionSchema, -} from './subscriptionAction'; - -/** - * Defines output parameters in a request to the - * [ChangeBillingAnchorDate]($e/Subscriptions/ChangeBillingAnchorDate) endpoint. - */ -export interface ChangeBillingAnchorDateResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * 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 billing anchor date change for the subscription. */ - actions?: SubscriptionAction[]; -} - -export const changeBillingAnchorDateResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - actions: ['actions', optional(array(lazy(() => subscriptionActionSchema)))], - } -); diff --git a/src/models/chargeRequest.ts b/src/models/chargeRequest.ts deleted file mode 100644 index 133c566de..000000000 --- a/src/models/chargeRequest.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { - ChargeRequestAdditionalRecipient, - chargeRequestAdditionalRecipientSchema, -} from './chargeRequestAdditionalRecipient'; -import { Money, moneySchema } from './money'; - -/** - * Defines the parameters that can be included in the body of - * a request to the [Charge](api-endpoint:Transactions-Charge) endpoint. - * Deprecated - recommend using [CreatePayment](api-endpoint:Payments-CreatePayment) - */ -export interface ChargeRequest { - /** - * A value you specify that uniquely identifies this - * transaction among transactions you've created. - * If you're unsure whether a particular transaction succeeded, - * you can reattempt it with the same idempotency key without - * worrying about double-charging the buyer. - * See [Idempotency keys](https://developer.squareup.com/docs/working-with-apis/idempotency) for more information. - */ - idempotencyKey: string; - /** - * 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. - */ - amountMoney: Money; - /** - * A payment token generated from the [Card.tokenize()](https://developer.squareup.com/reference/sdks/web/payments/objects/Card#Card.tokenize) that represents the card - * to charge. - * The application that provides a payment token to this endpoint must be the - * _same application_ that generated the payment token with the Web Payments SDK. - * Otherwise, the nonce is invalid. - * Do not provide a value for this field if you provide a value for - * `customer_card_id`. - */ - cardNonce?: string | null; - /** - * The ID of the customer card on file to charge. Do - * not provide a value for this field if you provide a value for `card_nonce`. - * If you provide this value, you _must_ also provide a value for - * `customer_id`. - */ - customerCardId?: string | null; - /** - * If `true`, the request will only perform an Auth on the provided - * card. You can then later perform either a Capture (with the - * [CaptureTransaction](api-endpoint:Transactions-CaptureTransaction) endpoint) or a Void - * (with the [VoidTransaction](api-endpoint:Transactions-VoidTransaction) endpoint). - * Default value: `false` - */ - delayCapture?: boolean | null; - /** - * An optional ID you can associate with the transaction for your own - * purposes (such as to associate the transaction with an entity ID in your - * own database). - * This value cannot exceed 40 characters. - */ - referenceId?: string | null; - /** - * An optional note to associate with the transaction. - * This value cannot exceed 60 characters. - */ - note?: string | null; - /** - * The ID of the customer to associate this transaction with. This field - * is required if you provide a value for `customer_card_id`, and optional - * otherwise. - */ - customerId?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - billingAddress?: Address; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - shippingAddress?: Address; - /** - * The buyer's email address, if available. This value is optional, - * but this transaction is ineligible for chargeback protection if it is not - * provided. - */ - buyerEmailAddress?: string | null; - /** - * The ID of the order to associate with this transaction. - * If you provide this value, the `amount_money` value of your request must - * __exactly match__ the value of the order's `total_money` field. - */ - orderId?: string | null; - /** - * The basic primitive of multi-party transaction. The value is optional. - * The transaction facilitated by you can be split from here. - * If you provide this value, the `amount_money` value in your additional_recipients - * must not be more than 90% of the `amount_money` value in the charge request. - * The `location_id` must be the valid location of the app owner merchant. - * This field requires the `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission. - * This field is currently not supported in sandbox. - */ - additionalRecipients?: ChargeRequestAdditionalRecipient[] | null; - /** - * A token generated by SqPaymentForm's verifyBuyer() that represents - * customer's device info and 3ds challenge result. - */ - verificationToken?: string | null; -} - -export const chargeRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', string()], - amountMoney: ['amount_money', lazy(() => moneySchema)], - cardNonce: ['card_nonce', optional(nullable(string()))], - customerCardId: ['customer_card_id', optional(nullable(string()))], - delayCapture: ['delay_capture', optional(nullable(boolean()))], - referenceId: ['reference_id', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - customerId: ['customer_id', optional(nullable(string()))], - billingAddress: ['billing_address', optional(lazy(() => addressSchema))], - shippingAddress: ['shipping_address', optional(lazy(() => addressSchema))], - buyerEmailAddress: ['buyer_email_address', optional(nullable(string()))], - orderId: ['order_id', optional(nullable(string()))], - additionalRecipients: [ - 'additional_recipients', - optional( - nullable(array(lazy(() => chargeRequestAdditionalRecipientSchema))) - ), - ], - verificationToken: ['verification_token', optional(nullable(string()))], -}); diff --git a/src/models/chargeRequestAdditionalRecipient.ts b/src/models/chargeRequestAdditionalRecipient.ts deleted file mode 100644 index bfa1d5251..000000000 --- a/src/models/chargeRequestAdditionalRecipient.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents an additional recipient (other than the merchant) entitled to a portion of the tender. - * Support is currently limited to USD, CAD and GBP currencies - */ -export interface ChargeRequestAdditionalRecipient { - /** The location ID for a recipient (other than the merchant) receiving a portion of the tender. */ - locationId: string; - /** The description of the additional recipient. */ - description: string; - /** - * 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. - */ - amountMoney: Money; -} - -export const chargeRequestAdditionalRecipientSchema: Schema = object( - { - locationId: ['location_id', string()], - description: ['description', string()], - amountMoney: ['amount_money', lazy(() => moneySchema)], - } -); diff --git a/src/models/chargeResponse.ts b/src/models/chargeResponse.ts deleted file mode 100644 index da03a1157..000000000 --- a/src/models/chargeResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Transaction, transactionSchema } from './transaction'; - -/** - * Defines the fields that are included in the response body of - * a request to the [Charge](api-endpoint:Transactions-Charge) endpoint. - * One of `errors` or `transaction` is present in a given response (never both). - */ -export interface ChargeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a transaction processed with Square, either with the - * Connect API or with Square Point of Sale. - * The `tenders` field of this object lists all methods of payment used to pay in - * the transaction. - */ - transaction?: Transaction; -} - -export const chargeResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - transaction: ['transaction', optional(lazy(() => transactionSchema))], -}); diff --git a/src/models/checkout.ts b/src/models/checkout.ts deleted file mode 100644 index 5aa96ef15..000000000 --- a/src/models/checkout.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - AdditionalRecipient, - additionalRecipientSchema, -} from './additionalRecipient'; -import { Address, addressSchema } from './address'; -import { Order, orderSchema } from './order'; - -/** - * Square Checkout lets merchants accept online payments for supported - * payment types using a checkout workflow hosted on squareup.com. - */ -export interface Checkout { - /** ID generated by Square Checkout when a new checkout is requested. */ - id?: string; - /** - * The URL that the buyer's browser should be redirected to after the - * checkout is completed. - */ - checkoutPageUrl?: string | null; - /** - * If `true`, Square Checkout will collect shipping information on your - * behalf and store that information with the transaction information in your - * Square Dashboard. - * Default: `false`. - */ - askForShippingAddress?: boolean | null; - /** - * The email address to display on the Square Checkout confirmation page - * and confirmation email that the buyer can use to contact the merchant. - * If this value is not set, the confirmation page and email will display the - * primary email address associated with the merchant's Square account. - * Default: none; only exists if explicitly set. - */ - merchantSupportEmail?: string | null; - /** - * If provided, the buyer's email is pre-populated on the checkout page - * as an editable text field. - * Default: none; only exists if explicitly set. - */ - prePopulateBuyerEmail?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - prePopulateShippingAddress?: Address; - /** - * The URL to redirect to after checkout is completed with `checkoutId`, - * Square's `orderId`, `transactionId`, and `referenceId` appended as URL - * parameters. For example, if the provided redirect_url is - * `http://www.example.com/order-complete`, a successful transaction redirects - * the customer to: - *
http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx
- * If you do not provide a redirect URL, Square Checkout will display an order - * confirmation page on your behalf; however Square strongly recommends that - * you provide a redirect URL so you can verify the transaction results and - * finalize the order through your existing/normal confirmation workflow. - */ - redirectUrl?: string | null; - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - /** The time when the checkout was created, in RFC 3339 format. */ - createdAt?: string; - /** - * Additional recipients (other than the merchant) receiving a portion of this checkout. - * For example, fees assessed on the purchase by a third party integration. - */ - additionalRecipients?: AdditionalRecipient[] | null; -} - -export const checkoutSchema: Schema = object({ - id: ['id', optional(string())], - checkoutPageUrl: ['checkout_page_url', optional(nullable(string()))], - askForShippingAddress: [ - 'ask_for_shipping_address', - optional(nullable(boolean())), - ], - merchantSupportEmail: [ - 'merchant_support_email', - optional(nullable(string())), - ], - prePopulateBuyerEmail: [ - 'pre_populate_buyer_email', - optional(nullable(string())), - ], - prePopulateShippingAddress: [ - 'pre_populate_shipping_address', - optional(lazy(() => addressSchema)), - ], - redirectUrl: ['redirect_url', optional(nullable(string()))], - order: ['order', optional(lazy(() => orderSchema))], - createdAt: ['created_at', optional(string())], - additionalRecipients: [ - 'additional_recipients', - optional(nullable(array(lazy(() => additionalRecipientSchema)))), - ], -}); diff --git a/src/models/checkoutLocationSettings.ts b/src/models/checkoutLocationSettings.ts deleted file mode 100644 index 3b9c2d899..000000000 --- a/src/models/checkoutLocationSettings.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CheckoutLocationSettingsBranding, - checkoutLocationSettingsBrandingSchema, -} from './checkoutLocationSettingsBranding'; -import { - CheckoutLocationSettingsCoupons, - checkoutLocationSettingsCouponsSchema, -} from './checkoutLocationSettingsCoupons'; -import { - CheckoutLocationSettingsPolicy, - checkoutLocationSettingsPolicySchema, -} from './checkoutLocationSettingsPolicy'; -import { - CheckoutLocationSettingsTipping, - checkoutLocationSettingsTippingSchema, -} from './checkoutLocationSettingsTipping'; - -export interface CheckoutLocationSettings { - /** The ID of the location that these settings apply to. */ - locationId?: string | null; - /** Indicates whether customers are allowed to leave notes at checkout. */ - customerNotesEnabled?: boolean | null; - /** - * Policy information is displayed at the bottom of the checkout pages. - * You can set a maximum of two policies. - */ - policies?: CheckoutLocationSettingsPolicy[] | null; - branding?: CheckoutLocationSettingsBranding; - tipping?: CheckoutLocationSettingsTipping; - coupons?: CheckoutLocationSettingsCoupons; - /** - * The timestamp when the settings were last updated, in RFC 3339 format. - * Examples for January 25th, 2020 6:25:34pm Pacific Standard Time: - * UTC: 2020-01-26T02:25:34Z - * Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00 - */ - updatedAt?: string; -} - -export const checkoutLocationSettingsSchema: Schema = object( - { - locationId: ['location_id', optional(nullable(string()))], - customerNotesEnabled: [ - 'customer_notes_enabled', - optional(nullable(boolean())), - ], - policies: [ - 'policies', - optional( - nullable(array(lazy(() => checkoutLocationSettingsPolicySchema))) - ), - ], - branding: [ - 'branding', - optional(lazy(() => checkoutLocationSettingsBrandingSchema)), - ], - tipping: [ - 'tipping', - optional(lazy(() => checkoutLocationSettingsTippingSchema)), - ], - coupons: [ - 'coupons', - optional(lazy(() => checkoutLocationSettingsCouponsSchema)), - ], - updatedAt: ['updated_at', optional(string())], - } -); diff --git a/src/models/checkoutLocationSettingsBranding.ts b/src/models/checkoutLocationSettingsBranding.ts deleted file mode 100644 index 545b67a5b..000000000 --- a/src/models/checkoutLocationSettingsBranding.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface CheckoutLocationSettingsBranding { - headerType?: string; - /** The HTML-supported hex color for the button on the checkout page (for example, "#FFFFFF"). */ - buttonColor?: string | null; - buttonShape?: string; -} - -export const checkoutLocationSettingsBrandingSchema: Schema = object( - { - headerType: ['header_type', optional(string())], - buttonColor: ['button_color', optional(nullable(string()))], - buttonShape: ['button_shape', optional(string())], - } -); diff --git a/src/models/checkoutLocationSettingsCoupons.ts b/src/models/checkoutLocationSettingsCoupons.ts deleted file mode 100644 index b21ab00ec..000000000 --- a/src/models/checkoutLocationSettingsCoupons.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { boolean, nullable, object, optional, Schema } from '../schema'; - -export interface CheckoutLocationSettingsCoupons { - /** Indicates whether coupons are enabled for this location. */ - enabled?: boolean | null; -} - -export const checkoutLocationSettingsCouponsSchema: Schema = object( - { enabled: ['enabled', optional(nullable(boolean()))] } -); diff --git a/src/models/checkoutLocationSettingsPolicy.ts b/src/models/checkoutLocationSettingsPolicy.ts deleted file mode 100644 index 1f13d5118..000000000 --- a/src/models/checkoutLocationSettingsPolicy.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface CheckoutLocationSettingsPolicy { - /** A unique ID to identify the policy when making changes. You must set the UID for policy updates, but it’s optional when setting new policies. */ - uid?: string | null; - /** The title of the policy. This is required when setting the description, though you can update it in a different request. */ - title?: string | null; - /** The description of the policy. */ - description?: string | null; -} - -export const checkoutLocationSettingsPolicySchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - title: ['title', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - } -); diff --git a/src/models/checkoutLocationSettingsTipping.ts b/src/models/checkoutLocationSettingsTipping.ts deleted file mode 100644 index 7e0366e83..000000000 --- a/src/models/checkoutLocationSettingsTipping.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - number, - object, - optional, - Schema, -} from '../schema'; -import { Money, moneySchema } from './money'; - -export interface CheckoutLocationSettingsTipping { - /** Set three custom percentage amounts that buyers can select at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more. */ - percentages?: number[] | null; - /** - * Enables Smart Tip Amounts. If Smart Tip Amounts is enabled, tipping works as follows: - * If a transaction is less than $10, the available tipping options include No Tip, $1, $2, or $3. - * If a transaction is $10 or more, the available tipping options include No Tip, 15%, 20%, or 25%. - * You can set custom percentage amounts with the `percentages` field. - */ - smartTippingEnabled?: boolean | null; - /** Set the pre-selected percentage amounts that appear at checkout. If Smart Tip is enabled, this only applies to transactions totaling $10 or more. */ - defaultPercent?: number | null; - /** Show the Smart Tip Amounts for this location. */ - smartTips?: Money[] | 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. - */ - defaultSmartTip?: Money; -} - -export const checkoutLocationSettingsTippingSchema: Schema = object( - { - percentages: ['percentages', optional(nullable(array(number())))], - smartTippingEnabled: [ - 'smart_tipping_enabled', - optional(nullable(boolean())), - ], - defaultPercent: ['default_percent', optional(nullable(number()))], - smartTips: [ - 'smart_tips', - optional(nullable(array(lazy(() => moneySchema)))), - ], - defaultSmartTip: ['default_smart_tip', optional(lazy(() => moneySchema))], - } -); diff --git a/src/models/checkoutMerchantSettings.ts b/src/models/checkoutMerchantSettings.ts deleted file mode 100644 index 77952a919..000000000 --- a/src/models/checkoutMerchantSettings.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CheckoutMerchantSettingsPaymentMethods, - checkoutMerchantSettingsPaymentMethodsSchema, -} from './checkoutMerchantSettingsPaymentMethods'; - -export interface CheckoutMerchantSettings { - paymentMethods?: CheckoutMerchantSettingsPaymentMethods; - /** - * The timestamp when the settings were last updated, in RFC 3339 format. - * Examples for January 25th, 2020 6:25:34pm Pacific Standard Time: - * UTC: 2020-01-26T02:25:34Z - * Pacific Standard Time with UTC offset: 2020-01-25T18:25:34-08:00 - */ - updatedAt?: string; -} - -export const checkoutMerchantSettingsSchema: Schema = object( - { - paymentMethods: [ - 'payment_methods', - optional(lazy(() => checkoutMerchantSettingsPaymentMethodsSchema)), - ], - updatedAt: ['updated_at', optional(string())], - } -); diff --git a/src/models/checkoutMerchantSettingsPaymentMethods.ts b/src/models/checkoutMerchantSettingsPaymentMethods.ts deleted file mode 100644 index 61d72cd30..000000000 --- a/src/models/checkoutMerchantSettingsPaymentMethods.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay, - checkoutMerchantSettingsPaymentMethodsAfterpayClearpaySchema, -} from './checkoutMerchantSettingsPaymentMethodsAfterpayClearpay'; -import { - CheckoutMerchantSettingsPaymentMethodsPaymentMethod, - checkoutMerchantSettingsPaymentMethodsPaymentMethodSchema, -} from './checkoutMerchantSettingsPaymentMethodsPaymentMethod'; - -export interface CheckoutMerchantSettingsPaymentMethods { - /** The settings allowed for a payment method. */ - applePay?: CheckoutMerchantSettingsPaymentMethodsPaymentMethod; - /** The settings allowed for a payment method. */ - googlePay?: CheckoutMerchantSettingsPaymentMethodsPaymentMethod; - /** The settings allowed for a payment method. */ - cashApp?: CheckoutMerchantSettingsPaymentMethodsPaymentMethod; - /** The settings allowed for AfterpayClearpay. */ - afterpayClearpay?: CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay; -} - -export const checkoutMerchantSettingsPaymentMethodsSchema: Schema = object( - { - applePay: [ - 'apple_pay', - optional( - lazy(() => checkoutMerchantSettingsPaymentMethodsPaymentMethodSchema) - ), - ], - googlePay: [ - 'google_pay', - optional( - lazy(() => checkoutMerchantSettingsPaymentMethodsPaymentMethodSchema) - ), - ], - cashApp: [ - 'cash_app', - optional( - lazy(() => checkoutMerchantSettingsPaymentMethodsPaymentMethodSchema) - ), - ], - afterpayClearpay: [ - 'afterpay_clearpay', - optional( - lazy(() => checkoutMerchantSettingsPaymentMethodsAfterpayClearpaySchema) - ), - ], - } -); diff --git a/src/models/checkoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts b/src/models/checkoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts deleted file mode 100644 index feb9ffb81..000000000 --- a/src/models/checkoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { boolean, lazy, object, optional, Schema } from '../schema'; -import { - CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange, - checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRangeSchema, -} from './checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange'; - -/** The settings allowed for AfterpayClearpay. */ -export interface CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay { - /** A range of purchase price that qualifies. */ - orderEligibilityRange?: CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange; - /** A range of purchase price that qualifies. */ - itemEligibilityRange?: CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange; - /** Indicates whether the payment method is enabled for the account. */ - enabled?: boolean; -} - -export const checkoutMerchantSettingsPaymentMethodsAfterpayClearpaySchema: Schema = object( - { - orderEligibilityRange: [ - 'order_eligibility_range', - optional( - lazy( - () => - checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRangeSchema - ) - ), - ], - itemEligibilityRange: [ - 'item_eligibility_range', - optional( - lazy( - () => - checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRangeSchema - ) - ), - ], - enabled: ['enabled', optional(boolean())], - } -); diff --git a/src/models/checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts b/src/models/checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts deleted file mode 100644 index 79c49ba87..000000000 --- a/src/models/checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { Money, moneySchema } from './money'; - -/** A range of purchase price that qualifies. */ -export interface CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange { - /** - * 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. - */ - min: Money; - /** - * 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. - */ - max: Money; -} - -export const checkoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRangeSchema: Schema = object( - { - min: ['min', lazy(() => moneySchema)], - max: ['max', lazy(() => moneySchema)], - } -); diff --git a/src/models/checkoutMerchantSettingsPaymentMethodsPaymentMethod.ts b/src/models/checkoutMerchantSettingsPaymentMethodsPaymentMethod.ts deleted file mode 100644 index 20ea25180..000000000 --- a/src/models/checkoutMerchantSettingsPaymentMethodsPaymentMethod.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { boolean, nullable, object, optional, Schema } from '../schema'; - -/** The settings allowed for a payment method. */ -export interface CheckoutMerchantSettingsPaymentMethodsPaymentMethod { - /** Indicates whether the payment method is enabled for the account. */ - enabled?: boolean | null; -} - -export const checkoutMerchantSettingsPaymentMethodsPaymentMethodSchema: Schema = object( - { enabled: ['enabled', optional(nullable(boolean()))] } -); diff --git a/src/models/checkoutOptions.ts b/src/models/checkoutOptions.ts deleted file mode 100644 index 876dd1316..000000000 --- a/src/models/checkoutOptions.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - AcceptedPaymentMethods, - acceptedPaymentMethodsSchema, -} from './acceptedPaymentMethods'; -import { CustomField, customFieldSchema } from './customField'; -import { Money, moneySchema } from './money'; -import { ShippingFee, shippingFeeSchema } from './shippingFee'; - -export interface CheckoutOptions { - /** Indicates whether the payment allows tipping. */ - allowTipping?: boolean | null; - /** The custom fields requesting information from the buyer. */ - customFields?: CustomField[] | null; - /** - * The ID of the subscription plan for the buyer to pay and subscribe. - * For more information, see [Subscription Plan Checkout](https://developer.squareup.com/docs/checkout-api/subscription-plan-checkout). - */ - subscriptionPlanId?: string | null; - /** The confirmation page URL to redirect the buyer to after Square processes the payment. */ - redirectUrl?: string | null; - /** The email address that buyers can use to contact the seller. */ - merchantSupportEmail?: string | null; - /** Indicates whether to include the address fields in the payment form. */ - askForShippingAddress?: boolean | null; - acceptedPaymentMethods?: AcceptedPaymentMethods; - /** - * 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. - */ - 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({ - allowTipping: ['allow_tipping', optional(nullable(boolean()))], - customFields: [ - 'custom_fields', - optional(nullable(array(lazy(() => customFieldSchema)))), - ], - subscriptionPlanId: ['subscription_plan_id', optional(nullable(string()))], - redirectUrl: ['redirect_url', optional(nullable(string()))], - merchantSupportEmail: [ - 'merchant_support_email', - optional(nullable(string())), - ], - askForShippingAddress: [ - 'ask_for_shipping_address', - optional(nullable(boolean())), - ], - acceptedPaymentMethods: [ - 'accepted_payment_methods', - optional(lazy(() => acceptedPaymentMethodsSchema)), - ], - 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/clearpayDetails.ts b/src/models/clearpayDetails.ts deleted file mode 100644 index 42a862a3c..000000000 --- a/src/models/clearpayDetails.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Additional details about Clearpay payments. */ -export interface ClearpayDetails { - /** Email address on the buyer's Clearpay account. */ - emailAddress?: string | null; -} - -export const clearpayDetailsSchema: Schema = object({ - emailAddress: ['email_address', optional(nullable(string()))], -}); diff --git a/src/models/cloneOrderRequest.ts b/src/models/cloneOrderRequest.ts deleted file mode 100644 index 6a4f3f48d..000000000 --- a/src/models/cloneOrderRequest.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Defines the fields that are included in requests to the - * [CloneOrder]($e/Orders/CloneOrder) endpoint. - */ -export interface CloneOrderRequest { - /** The ID of the order to clone. */ - orderId: string; - /** - * An optional order version for concurrency protection. - * If a version is provided, it must match the latest stored version of the order to clone. - * If a version is not provided, the API clones the latest version. - */ - version?: number; - /** - * A value you specify that uniquely identifies this clone request. - * If you are unsure whether a particular order was cloned successfully, - * you can reattempt the call with the same idempotency key without - * worrying about creating duplicate cloned orders. - * The originally cloned order is returned. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const cloneOrderRequestSchema: Schema = object({ - orderId: ['order_id', string()], - version: ['version', optional(number())], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], -}); diff --git a/src/models/cloneOrderResponse.ts b/src/models/cloneOrderResponse.ts deleted file mode 100644 index 09f305686..000000000 --- a/src/models/cloneOrderResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Order, orderSchema } from './order'; - -/** - * Defines the fields that are included in the response body of - * a request to the [CloneOrder]($e/Orders/CloneOrder) endpoint. - */ -export interface CloneOrderResponse { - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const cloneOrderResponseSchema: Schema = object({ - order: ['order', optional(lazy(() => orderSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/collectedData.ts b/src/models/collectedData.ts deleted file mode 100644 index e2eadbb86..000000000 --- a/src/models/collectedData.ts +++ /dev/null @@ -1,10 +0,0 @@ -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/completePaymentRequest.ts b/src/models/completePaymentRequest.ts deleted file mode 100644 index 09f1f857c..000000000 --- a/src/models/completePaymentRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Describes a request to complete (capture) a payment using - * [CompletePayment]($e/Payments/CompletePayment). - * By default, payments are set to `autocomplete` immediately after they are created. - * To complete payments manually, set `autocomplete` to `false`. - */ -export interface CompletePaymentRequest { - /** - * Used for optimistic concurrency. This opaque token identifies the current `Payment` - * version that the caller expects. If the server has a different version of the Payment, - * the update fails and a response with a VERSION_MISMATCH error is returned. - */ - versionToken?: string | null; -} - -export const completePaymentRequestSchema: Schema = object( - { versionToken: ['version_token', optional(nullable(string()))] } -); diff --git a/src/models/completePaymentResponse.ts b/src/models/completePaymentResponse.ts deleted file mode 100644 index 83cc980fd..000000000 --- a/src/models/completePaymentResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Payment, paymentSchema } from './payment'; - -/** Defines the response returned by[CompletePayment]($e/Payments/CompletePayment). */ -export interface CompletePaymentResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a payment processed by the Square API. */ - payment?: Payment; -} - -export const completePaymentResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - payment: ['payment', optional(lazy(() => paymentSchema))], - } -); diff --git a/src/models/component.ts b/src/models/component.ts deleted file mode 100644 index 535603583..000000000 --- a/src/models/component.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - DeviceComponentDetailsApplicationDetails, - deviceComponentDetailsApplicationDetailsSchema, -} from './deviceComponentDetailsApplicationDetails'; -import { - DeviceComponentDetailsBatteryDetails, - deviceComponentDetailsBatteryDetailsSchema, -} from './deviceComponentDetailsBatteryDetails'; -import { - DeviceComponentDetailsCardReaderDetails, - deviceComponentDetailsCardReaderDetailsSchema, -} from './deviceComponentDetailsCardReaderDetails'; -import { - DeviceComponentDetailsEthernetDetails, - deviceComponentDetailsEthernetDetailsSchema, -} from './deviceComponentDetailsEthernetDetails'; -import { - DeviceComponentDetailsWiFiDetails, - deviceComponentDetailsWiFiDetailsSchema, -} from './deviceComponentDetailsWiFiDetails'; - -/** The wrapper object for the component entries of a given component type. */ -export interface Component { - /** An enum for ComponentType. */ - type: string; - applicationDetails?: DeviceComponentDetailsApplicationDetails; - cardReaderDetails?: DeviceComponentDetailsCardReaderDetails; - batteryDetails?: DeviceComponentDetailsBatteryDetails; - wifiDetails?: DeviceComponentDetailsWiFiDetails; - ethernetDetails?: DeviceComponentDetailsEthernetDetails; -} - -export const componentSchema: Schema = object({ - type: ['type', string()], - applicationDetails: [ - 'application_details', - optional(lazy(() => deviceComponentDetailsApplicationDetailsSchema)), - ], - cardReaderDetails: [ - 'card_reader_details', - optional(lazy(() => deviceComponentDetailsCardReaderDetailsSchema)), - ], - batteryDetails: [ - 'battery_details', - optional(lazy(() => deviceComponentDetailsBatteryDetailsSchema)), - ], - wifiDetails: [ - 'wifi_details', - optional(lazy(() => deviceComponentDetailsWiFiDetailsSchema)), - ], - ethernetDetails: [ - 'ethernet_details', - optional(lazy(() => deviceComponentDetailsEthernetDetailsSchema)), - ], -}); diff --git a/src/models/confirmationDecision.ts b/src/models/confirmationDecision.ts deleted file mode 100644 index dca1bcc57..000000000 --- a/src/models/confirmationDecision.ts +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index a4c2a4800..000000000 --- a/src/models/confirmationOptions.ts +++ /dev/null @@ -1,25 +0,0 @@ -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/coordinates.ts b/src/models/coordinates.ts deleted file mode 100644 index 378aa370d..000000000 --- a/src/models/coordinates.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, number, object, optional, Schema } from '../schema'; - -/** Latitude and longitude coordinates. */ -export interface Coordinates { - /** The latitude of the coordinate expressed in degrees. */ - latitude?: number | null; - /** The longitude of the coordinate expressed in degrees. */ - longitude?: number | null; -} - -export const coordinatesSchema: Schema = object({ - latitude: ['latitude', optional(nullable(number()))], - longitude: ['longitude', optional(nullable(number()))], -}); diff --git a/src/models/createBookingCustomAttributeDefinitionRequest.ts b/src/models/createBookingCustomAttributeDefinitionRequest.ts deleted file mode 100644 index 218aeb12b..000000000 --- a/src/models/createBookingCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents a [CreateBookingCustomAttributeDefinition]($e/BookingCustomAttributes/CreateBookingCustomAttributeDefinition) request. */ -export interface CreateBookingCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; -} - -export const createBookingCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(string())], - } -); diff --git a/src/models/createBookingCustomAttributeDefinitionResponse.ts b/src/models/createBookingCustomAttributeDefinitionResponse.ts deleted file mode 100644 index c6c1c39dd..000000000 --- a/src/models/createBookingCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [CreateBookingCustomAttributeDefinition]($e/BookingCustomAttributes/CreateBookingCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface CreateBookingCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createBookingCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createBookingRequest.ts b/src/models/createBookingRequest.ts deleted file mode 100644 index d4cd4dd0d..000000000 --- a/src/models/createBookingRequest.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Booking, bookingSchema } from './booking'; - -export interface CreateBookingRequest { - /** A unique key to make this request an idempotent operation. */ - idempotencyKey?: string; - /** - * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service - * at a given location to a requesting customer in one or more appointment segments. - */ - booking: Booking; -} - -export const createBookingRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', optional(string())], - booking: ['booking', lazy(() => bookingSchema)], -}); diff --git a/src/models/createBookingResponse.ts b/src/models/createBookingResponse.ts deleted file mode 100644 index 4771f2054..000000000 --- a/src/models/createBookingResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Booking, bookingSchema } from './booking'; -import { Error, errorSchema } from './error'; - -export interface CreateBookingResponse { - /** - * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service - * at a given location to a requesting customer in one or more appointment segments. - */ - booking?: Booking; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const createBookingResponseSchema: Schema = object( - { - booking: ['booking', optional(lazy(() => bookingSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createBreakTypeRequest.ts b/src/models/createBreakTypeRequest.ts deleted file mode 100644 index 7b8070f56..000000000 --- a/src/models/createBreakTypeRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { BreakType, breakTypeSchema } from './breakType'; - -/** A request to create a new `BreakType`. */ -export interface CreateBreakTypeRequest { - /** A unique string value to ensure the idempotency of the operation. */ - idempotencyKey?: string; - /** - * A defined break template that sets an expectation for possible `Break` - * instances on a `Shift`. - */ - breakType: BreakType; -} - -export const createBreakTypeRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', optional(string())], - breakType: ['break_type', lazy(() => breakTypeSchema)], - } -); diff --git a/src/models/createBreakTypeResponse.ts b/src/models/createBreakTypeResponse.ts deleted file mode 100644 index 321ffc27d..000000000 --- a/src/models/createBreakTypeResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { BreakType, breakTypeSchema } from './breakType'; -import { Error, errorSchema } from './error'; - -/** - * The response to the request to create a `BreakType`. The response contains - * the created `BreakType` object and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface CreateBreakTypeResponse { - /** - * A defined break template that sets an expectation for possible `Break` - * instances on a `Shift`. - */ - breakType?: BreakType; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createBreakTypeResponseSchema: Schema = object( - { - breakType: ['break_type', optional(lazy(() => breakTypeSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createCardRequest.ts b/src/models/createCardRequest.ts deleted file mode 100644 index e5d99f3c4..000000000 --- a/src/models/createCardRequest.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Card, cardSchema } from './card'; - -/** - * Creates a card from the source (payment token or payment id). Accessible via - * HTTP requests at POST https://connect.squareup.com/v2/cards - */ -export interface CreateCardRequest { - /** - * A unique string that identifies this CreateCard request. Keys can be - * any valid string and must be unique for every request. - * Max: 45 characters - * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - */ - idempotencyKey: string; - /** The ID of the source which represents the card information to be stored. This can be a card nonce or a payment id. */ - sourceId: string; - /** - * An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer). - * Verification tokens encapsulate customer device information and 3-D Secure - * challenge results to indicate that Square has verified the buyer identity. - * See the [SCA Overview](https://developer.squareup.com/docs/sca-overview). - */ - verificationToken?: string; - /** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ - card: Card; -} - -export const createCardRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', string()], - sourceId: ['source_id', string()], - verificationToken: ['verification_token', optional(string())], - card: ['card', lazy(() => cardSchema)], -}); diff --git a/src/models/createCardResponse.ts b/src/models/createCardResponse.ts deleted file mode 100644 index 1213f5097..000000000 --- a/src/models/createCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Card, cardSchema } from './card'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [CreateCard]($e/Cards/CreateCard) endpoint. - * Note: if there are errors processing the request, the card field will not be - * present. - */ -export interface CreateCardResponse { - /** Errors resulting from the request. */ - errors?: Error[]; - /** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ - card?: Card; -} - -export const createCardResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - card: ['card', optional(lazy(() => cardSchema))], -}); diff --git a/src/models/createCatalogImageRequest.ts b/src/models/createCatalogImageRequest.ts deleted file mode 100644 index 5db9fb215..000000000 --- a/src/models/createCatalogImageRequest.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { boolean, lazy, object, optional, Schema, string } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; - -export interface CreateCatalogImageRequest { - /** - * A unique string that identifies this CreateCatalogImage request. - * Keys can be any valid string but must be unique for every CreateCatalogImage request. - * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - */ - idempotencyKey: string; - /** - * Unique ID of the `CatalogObject` to attach this `CatalogImage` object to. Leave this - * field empty to create unattached images, for example if you are building an integration - * where an image can be attached to catalog items at a later time. - */ - objectId?: string; - /** - * The wrapper object for the catalog entries of a given object type. - * Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. - * For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. - * In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. - * For a more detailed discussion of the Catalog data model, please see the - * [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. - */ - image: CatalogObject; - /** - * If this is set to `true`, the image created will be the primary, or first image of the object referenced by `object_id`. - * If the `CatalogObject` already has a primary `CatalogImage`, setting this field to `true` will replace the primary image. - * If this is set to `false` and you use the Square API version 2021-12-15 or later, the image id will be appended to the list of `image_ids` on the object. - * With Square API version 2021-12-15 or later, the default value is `false`. Otherwise, the effective default value is `true`. - */ - isPrimary?: boolean; -} - -export const createCatalogImageRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - objectId: ['object_id', optional(string())], - image: ['image', lazy(() => catalogObjectSchema)], - isPrimary: ['is_primary', optional(boolean())], - } -); diff --git a/src/models/createCatalogImageResponse.ts b/src/models/createCatalogImageResponse.ts deleted file mode 100644 index ec7362d8b..000000000 --- a/src/models/createCatalogImageResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -export interface CreateCatalogImageResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The wrapper object for the catalog entries of a given object type. - * Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. - * For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. - * In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. - * For a more detailed discussion of the Catalog data model, please see the - * [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. - */ - image?: CatalogObject; -} - -export const createCatalogImageResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - image: ['image', optional(lazy(() => catalogObjectSchema))], - } -); diff --git a/src/models/createCheckoutRequest.ts b/src/models/createCheckoutRequest.ts deleted file mode 100644 index 008d14d1c..000000000 --- a/src/models/createCheckoutRequest.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { - array, - boolean, - lazy, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { - ChargeRequestAdditionalRecipient, - chargeRequestAdditionalRecipientSchema, -} from './chargeRequestAdditionalRecipient'; -import { - CreateOrderRequest, - createOrderRequestSchema, -} from './createOrderRequest'; - -/** - * Defines the parameters that can be included in the body of - * a request to the `CreateCheckout` endpoint. - */ -export interface CreateCheckoutRequest { - /** - * A unique string that identifies this checkout among others you have created. It can be - * any valid string but must be unique for every order sent to Square Checkout for a given location ID. - * The idempotency key is used to avoid processing the same order more than once. If you are - * unsure whether a particular checkout was created successfully, you can attempt it again with - * the same idempotency key and all the same other parameters without worrying about creating duplicates. - * You should use a random number/string generator native to the language - * you are working in to generate strings for your idempotency keys. - * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). - */ - idempotencyKey: string; - order: CreateOrderRequest; - /** - * If `true`, Square Checkout collects shipping information on your behalf and stores - * that information with the transaction information in the Square Seller Dashboard. - * Default: `false`. - */ - askForShippingAddress?: boolean; - /** - * The email address to display on the Square Checkout confirmation page - * and confirmation email that the buyer can use to contact the seller. - * If this value is not set, the confirmation page and email display the - * primary email address associated with the seller's Square account. - * Default: none; only exists if explicitly set. - */ - merchantSupportEmail?: string; - /** - * If provided, the buyer's email is prepopulated on the checkout page - * as an editable text field. - * Default: none; only exists if explicitly set. - */ - prePopulateBuyerEmail?: string; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - prePopulateShippingAddress?: Address; - /** - * The URL to redirect to after the checkout is completed with `checkoutId`, - * `transactionId`, and `referenceId` appended as URL parameters. For example, - * if the provided redirect URL is `http://www.example.com/order-complete`, a - * successful transaction redirects the customer to: - * `http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx` - * If you do not provide a redirect URL, Square Checkout displays an order - * confirmation page on your behalf; however, it is strongly recommended that - * you provide a redirect URL so you can verify the transaction results and - * finalize the order through your existing/normal confirmation workflow. - * Default: none; only exists if explicitly set. - */ - redirectUrl?: string; - /** - * The basic primitive of a multi-party transaction. The value is optional. - * The transaction facilitated by you can be split from here. - * If you provide this value, the `amount_money` value in your `additional_recipients` field - * cannot be more than 90% of the `total_money` calculated by Square for your order. - * The `location_id` must be a valid seller location where the checkout is occurring. - * This field requires `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission. - * This field is currently not supported in the Square Sandbox. - */ - additionalRecipients?: ChargeRequestAdditionalRecipient[]; - /** - * An optional note to associate with the `checkout` object. - * This value cannot exceed 60 characters. - */ - note?: string; -} - -export const createCheckoutRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - order: ['order', lazy(() => createOrderRequestSchema)], - askForShippingAddress: ['ask_for_shipping_address', optional(boolean())], - merchantSupportEmail: ['merchant_support_email', optional(string())], - prePopulateBuyerEmail: ['pre_populate_buyer_email', optional(string())], - prePopulateShippingAddress: [ - 'pre_populate_shipping_address', - optional(lazy(() => addressSchema)), - ], - redirectUrl: ['redirect_url', optional(string())], - additionalRecipients: [ - 'additional_recipients', - optional(array(lazy(() => chargeRequestAdditionalRecipientSchema))), - ], - note: ['note', optional(string())], - } -); diff --git a/src/models/createCheckoutResponse.ts b/src/models/createCheckoutResponse.ts deleted file mode 100644 index 894d9e122..000000000 --- a/src/models/createCheckoutResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Checkout, checkoutSchema } from './checkout'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the `CreateCheckout` endpoint. - */ -export interface CreateCheckoutResponse { - /** - * Square Checkout lets merchants accept online payments for supported - * payment types using a checkout workflow hosted on squareup.com. - */ - checkout?: Checkout; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createCheckoutResponseSchema: Schema = object( - { - checkout: ['checkout', optional(lazy(() => checkoutSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createCustomerCardRequest.ts b/src/models/createCustomerCardRequest.ts deleted file mode 100644 index a91ef0bbe..000000000 --- a/src/models/createCustomerCardRequest.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Address, addressSchema } from './address'; - -/** - * Defines the fields that are included in the request body of a request - * to the `CreateCustomerCard` endpoint. - */ -export interface CreateCustomerCardRequest { - /** - * A card nonce representing the credit card to link to the customer. - * Card nonces are generated by the Square payment form when customers enter - * their card information. For more information, see - * [Walkthrough: Integrate Square Payments in a Website](https://developer.squareup.com/docs/web-payments/take-card-payment). - * __NOTE:__ Card nonces generated by digital wallets (such as Apple Pay) - * cannot be used to create a customer card. - */ - cardNonce: string; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - billingAddress?: Address; - /** The full name printed on the credit card. */ - cardholderName?: string; - /** - * An identifying token generated by [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer). - * Verification tokens encapsulate customer device information and 3-D Secure - * challenge results to indicate that Square has verified the buyer identity. - */ - verificationToken?: string; -} - -export const createCustomerCardRequestSchema: Schema = object( - { - cardNonce: ['card_nonce', string()], - billingAddress: ['billing_address', optional(lazy(() => addressSchema))], - cardholderName: ['cardholder_name', optional(string())], - verificationToken: ['verification_token', optional(string())], - } -); diff --git a/src/models/createCustomerCardResponse.ts b/src/models/createCustomerCardResponse.ts deleted file mode 100644 index 127766d11..000000000 --- a/src/models/createCustomerCardResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Card, cardSchema } from './card'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the `CreateCustomerCard` endpoint. - * Either `errors` or `card` is present in a given response (never both). - */ -export interface CreateCustomerCardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ - card?: Card; -} - -export const createCustomerCardResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - card: ['card', optional(lazy(() => cardSchema))], - } -); diff --git a/src/models/createCustomerCustomAttributeDefinitionRequest.ts b/src/models/createCustomerCustomAttributeDefinitionRequest.ts deleted file mode 100644 index f7abd392a..000000000 --- a/src/models/createCustomerCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents a [CreateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/CreateCustomerCustomAttributeDefinition) request. */ -export interface CreateCustomerCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; -} - -export const createCustomerCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(string())], - } -); diff --git a/src/models/createCustomerCustomAttributeDefinitionResponse.ts b/src/models/createCustomerCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 244849d9c..000000000 --- a/src/models/createCustomerCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [CreateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/CreateCustomerCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface CreateCustomerCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createCustomerCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createCustomerGroupRequest.ts b/src/models/createCustomerGroupRequest.ts deleted file mode 100644 index 44145f76c..000000000 --- a/src/models/createCustomerGroupRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { CustomerGroup, customerGroupSchema } from './customerGroup'; - -/** - * Defines the body parameters that can be included in a request to the - * [CreateCustomerGroup]($e/CustomerGroups/CreateCustomerGroup) endpoint. - */ -export interface CreateCustomerGroupRequest { - /** The idempotency key for the request. For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ - idempotencyKey?: string; - /** - * Represents a group of customer profiles. - * Customer groups can be created, be modified, and have their membership defined using - * the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. - */ - group: CustomerGroup; -} - -export const createCustomerGroupRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', optional(string())], - group: ['group', lazy(() => customerGroupSchema)], - } -); diff --git a/src/models/createCustomerGroupResponse.ts b/src/models/createCustomerGroupResponse.ts deleted file mode 100644 index e81462fcc..000000000 --- a/src/models/createCustomerGroupResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomerGroup, customerGroupSchema } from './customerGroup'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [CreateCustomerGroup]($e/CustomerGroups/CreateCustomerGroup) endpoint. - * Either `errors` or `group` is present in a given response (never both). - */ -export interface CreateCustomerGroupResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a group of customer profiles. - * Customer groups can be created, be modified, and have their membership defined using - * the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. - */ - group?: CustomerGroup; -} - -export const createCustomerGroupResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - group: ['group', optional(lazy(() => customerGroupSchema))], - } -); diff --git a/src/models/createCustomerRequest.ts b/src/models/createCustomerRequest.ts deleted file mode 100644 index d4f79fede..000000000 --- a/src/models/createCustomerRequest.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Address, addressSchema } from './address'; -import { CustomerTaxIds, customerTaxIdsSchema } from './customerTaxIds'; - -/** - * Defines the body parameters that can be included in a request to the - * `CreateCustomer` endpoint. - */ -export interface CreateCustomerRequest { - /** - * The idempotency key for the request. For more information, see - * [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; - /** - * The given name (that is, the first name) associated with the customer profile. - * The maximum length for this value is 300 characters. - */ - givenName?: string; - /** - * The family name (that is, the last name) associated with the customer profile. - * The maximum length for this value is 300 characters. - */ - familyName?: string; - /** - * A business name associated with the customer profile. - * The maximum length for this value is 500 characters. - */ - companyName?: string; - /** - * A nickname for the customer profile. - * The maximum length for this value is 100 characters. - */ - nickname?: string; - /** - * The email address associated with the customer profile. - * The maximum length for this value is 254 characters. - */ - emailAddress?: string; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; - /** - * The phone number associated with the customer profile. The phone number must be valid and can contain - * 9–16 digits, with an optional `+` prefix and country code. For more information, see - * [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). - */ - phoneNumber?: string; - /** - * An optional second ID used to associate the customer profile with an - * entity in another system. - * The maximum length for this value is 100 characters. - */ - referenceId?: string; - /** A custom note associated with the customer profile. */ - note?: string; - /** - * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example, - * specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD` - * format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified. - */ - birthday?: string; - /** - * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. - * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). - */ - taxIds?: CustomerTaxIds; -} - -export const createCustomerRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', optional(string())], - givenName: ['given_name', optional(string())], - familyName: ['family_name', optional(string())], - companyName: ['company_name', optional(string())], - nickname: ['nickname', optional(string())], - emailAddress: ['email_address', optional(string())], - address: ['address', optional(lazy(() => addressSchema))], - phoneNumber: ['phone_number', optional(string())], - referenceId: ['reference_id', optional(string())], - note: ['note', optional(string())], - birthday: ['birthday', optional(string())], - taxIds: ['tax_ids', optional(lazy(() => customerTaxIdsSchema))], - } -); diff --git a/src/models/createCustomerResponse.ts b/src/models/createCustomerResponse.ts deleted file mode 100644 index 6a4c525f3..000000000 --- a/src/models/createCustomerResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Customer, customerSchema } from './customer'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [CreateCustomer]($e/Customers/CreateCustomer) or - * [BulkCreateCustomers]($e/Customers/BulkCreateCustomers) endpoint. - * Either `errors` or `customer` is present in a given response (never both). - */ -export interface CreateCustomerResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square customer profile in the Customer Directory of a Square seller. */ - customer?: Customer; -} - -export const createCustomerResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - customer: ['customer', optional(lazy(() => customerSchema))], - } -); diff --git a/src/models/createDeviceCodeRequest.ts b/src/models/createDeviceCodeRequest.ts deleted file mode 100644 index 9378a387f..000000000 --- a/src/models/createDeviceCodeRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { DeviceCode, deviceCodeSchema } from './deviceCode'; - -export interface CreateDeviceCodeRequest { - /** - * A unique string that identifies this CreateDeviceCode request. Keys can - * be any valid string but must be unique for every CreateDeviceCode request. - * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - */ - idempotencyKey: string; - deviceCode: DeviceCode; -} - -export const createDeviceCodeRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - deviceCode: ['device_code', lazy(() => deviceCodeSchema)], - } -); diff --git a/src/models/createDeviceCodeResponse.ts b/src/models/createDeviceCodeResponse.ts deleted file mode 100644 index 7c90e3bd4..000000000 --- a/src/models/createDeviceCodeResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { DeviceCode, deviceCodeSchema } from './deviceCode'; -import { Error, errorSchema } from './error'; - -export interface CreateDeviceCodeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - deviceCode?: DeviceCode; -} - -export const createDeviceCodeResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - deviceCode: ['device_code', optional(lazy(() => deviceCodeSchema))], - } -); diff --git a/src/models/createDisputeEvidenceFileRequest.ts b/src/models/createDisputeEvidenceFileRequest.ts deleted file mode 100644 index af7b6520d..000000000 --- a/src/models/createDisputeEvidenceFileRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Defines the parameters for a `CreateDisputeEvidenceFile` request. */ -export interface CreateDisputeEvidenceFileRequest { - /** A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; - /** The type of the dispute evidence. */ - evidenceType?: string; - /** - * The MIME type of the uploaded file. - * The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff. - */ - contentType?: string; -} - -export const createDisputeEvidenceFileRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - evidenceType: ['evidence_type', optional(string())], - contentType: ['content_type', optional(string())], - } -); diff --git a/src/models/createDisputeEvidenceFileResponse.ts b/src/models/createDisputeEvidenceFileResponse.ts deleted file mode 100644 index 46da86754..000000000 --- a/src/models/createDisputeEvidenceFileResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { DisputeEvidence, disputeEvidenceSchema } from './disputeEvidence'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in a `CreateDisputeEvidenceFile` response. */ -export interface CreateDisputeEvidenceFileResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - evidence?: DisputeEvidence; -} - -export const createDisputeEvidenceFileResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - evidence: ['evidence', optional(lazy(() => disputeEvidenceSchema))], - } -); diff --git a/src/models/createDisputeEvidenceTextRequest.ts b/src/models/createDisputeEvidenceTextRequest.ts deleted file mode 100644 index 64ab3efcf..000000000 --- a/src/models/createDisputeEvidenceTextRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Defines the parameters for a `CreateDisputeEvidenceText` request. */ -export interface CreateDisputeEvidenceTextRequest { - /** A unique key identifying the request. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; - /** The type of the dispute evidence. */ - evidenceType?: string; - /** The evidence string. */ - evidenceText: string; -} - -export const createDisputeEvidenceTextRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - evidenceType: ['evidence_type', optional(string())], - evidenceText: ['evidence_text', string()], - } -); diff --git a/src/models/createDisputeEvidenceTextResponse.ts b/src/models/createDisputeEvidenceTextResponse.ts deleted file mode 100644 index cd3610f61..000000000 --- a/src/models/createDisputeEvidenceTextResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { DisputeEvidence, disputeEvidenceSchema } from './disputeEvidence'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in a `CreateDisputeEvidenceText` response. */ -export interface CreateDisputeEvidenceTextResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - evidence?: DisputeEvidence; -} - -export const createDisputeEvidenceTextResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - evidence: ['evidence', optional(lazy(() => disputeEvidenceSchema))], - } -); diff --git a/src/models/createGiftCardActivityRequest.ts b/src/models/createGiftCardActivityRequest.ts deleted file mode 100644 index e917aecc4..000000000 --- a/src/models/createGiftCardActivityRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { GiftCardActivity, giftCardActivitySchema } from './giftCardActivity'; - -/** A request to create a gift card activity. */ -export interface CreateGiftCardActivityRequest { - /** A unique string that identifies the `CreateGiftCardActivity` request. */ - idempotencyKey: string; - /** - * Represents an action performed on a [gift card]($m/GiftCard) that affects its state or balance. - * A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity - * includes a `redeem_activity_details` field that contains information about the redemption. - */ - giftCardActivity: GiftCardActivity; -} - -export const createGiftCardActivityRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - giftCardActivity: [ - 'gift_card_activity', - lazy(() => giftCardActivitySchema), - ], - } -); diff --git a/src/models/createGiftCardActivityResponse.ts b/src/models/createGiftCardActivityResponse.ts deleted file mode 100644 index dc12b49f0..000000000 --- a/src/models/createGiftCardActivityResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCardActivity, giftCardActivitySchema } from './giftCardActivity'; - -/** - * A response that contains a `GiftCardActivity` that was created. - * The response might contain a set of `Error` objects if the request resulted in errors. - */ -export interface CreateGiftCardActivityResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents an action performed on a [gift card]($m/GiftCard) that affects its state or balance. - * A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity - * includes a `redeem_activity_details` field that contains information about the redemption. - */ - giftCardActivity?: GiftCardActivity; -} - -export const createGiftCardActivityResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCardActivity: [ - 'gift_card_activity', - optional(lazy(() => giftCardActivitySchema)), - ], - } -); diff --git a/src/models/createGiftCardRequest.ts b/src/models/createGiftCardRequest.ts deleted file mode 100644 index e7191e9f6..000000000 --- a/src/models/createGiftCardRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { GiftCard, giftCardSchema } from './giftCard'; - -/** Represents a [CreateGiftCard]($e/GiftCards/CreateGiftCard) request. */ -export interface CreateGiftCardRequest { - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey: string; - /** - * The ID of the [location](entity:Location) where the gift card should be registered for - * reporting purposes. Gift cards can be redeemed at any of the seller's locations. - */ - locationId: string; - /** Represents a Square gift card. */ - giftCard: GiftCard; -} - -export const createGiftCardRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - locationId: ['location_id', string()], - giftCard: ['gift_card', lazy(() => giftCardSchema)], - } -); diff --git a/src/models/createGiftCardResponse.ts b/src/models/createGiftCardResponse.ts deleted file mode 100644 index 2d7de469b..000000000 --- a/src/models/createGiftCardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCard, giftCardSchema } from './giftCard'; - -/** - * A response that contains a `GiftCard`. The response might contain a set of `Error` objects if the request - * resulted in errors. - */ -export interface CreateGiftCardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square gift card. */ - giftCard?: GiftCard; -} - -export const createGiftCardResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCard: ['gift_card', optional(lazy(() => giftCardSchema))], - } -); diff --git a/src/models/createInvoiceAttachmentRequest.ts b/src/models/createInvoiceAttachmentRequest.ts deleted file mode 100644 index 20c368855..000000000 --- a/src/models/createInvoiceAttachmentRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Represents a [CreateInvoiceAttachment]($e/Invoices/CreateInvoiceAttachment) request. */ -export interface CreateInvoiceAttachmentRequest { - /** - * A unique string that identifies the `CreateInvoiceAttachment` request. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; - /** The description of the attachment to display on the invoice. */ - description?: string; -} - -export const createInvoiceAttachmentRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', optional(string())], - description: ['description', optional(string())], - } -); diff --git a/src/models/createInvoiceAttachmentResponse.ts b/src/models/createInvoiceAttachmentResponse.ts deleted file mode 100644 index 69afa6594..000000000 --- a/src/models/createInvoiceAttachmentResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - InvoiceAttachment, - invoiceAttachmentSchema, -} from './invoiceAttachment'; - -/** Represents a [CreateInvoiceAttachment]($e/Invoices/CreateInvoiceAttachment) response. */ -export interface CreateInvoiceAttachmentResponse { - /** Represents a file attached to an [invoice]($m/Invoice). */ - attachment?: InvoiceAttachment; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const createInvoiceAttachmentResponseSchema: Schema = object( - { - attachment: ['attachment', optional(lazy(() => invoiceAttachmentSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createInvoiceRequest.ts b/src/models/createInvoiceRequest.ts deleted file mode 100644 index af35f40f5..000000000 --- a/src/models/createInvoiceRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Invoice, invoiceSchema } from './invoice'; - -/** Describes a `CreateInvoice` request. */ -export interface CreateInvoiceRequest { - /** - * Stores information about an invoice. You use the Invoices API to create and manage - * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - */ - invoice: Invoice; - /** - * A unique string that identifies the `CreateInvoice` request. If you do not - * provide `idempotency_key` (or provide an empty string as the value), the endpoint - * treats each request as independent. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; -} - -export const createInvoiceRequestSchema: Schema = object({ - invoice: ['invoice', lazy(() => invoiceSchema)], - idempotencyKey: ['idempotency_key', optional(string())], -}); diff --git a/src/models/createInvoiceResponse.ts b/src/models/createInvoiceResponse.ts deleted file mode 100644 index 9065833ab..000000000 --- a/src/models/createInvoiceResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Invoice, invoiceSchema } from './invoice'; - -/** The response returned by the `CreateInvoice` request. */ -export interface CreateInvoiceResponse { - /** - * Stores information about an invoice. You use the Invoices API to create and manage - * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - */ - invoice?: Invoice; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const createInvoiceResponseSchema: Schema = object( - { - invoice: ['invoice', optional(lazy(() => invoiceSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createJobRequest.ts b/src/models/createJobRequest.ts deleted file mode 100644 index 7ab5f34ea..000000000 --- a/src/models/createJobRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { Job, jobSchema } from './job'; - -/** Represents a [CreateJob]($e/Team/CreateJob) request. */ -export interface CreateJobRequest { - /** - * Represents a job that can be assigned to [team members]($m/TeamMember). This object defines the - * job's title and tip eligibility. Compensation is defined in a [job assignment]($m/JobAssignment) - * in a team member's wage setting. - */ - job: Job; - /** - * A unique identifier for the `CreateJob` request. Keys can be any valid string, - * but must be unique for each request. For more information, see - * [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey: string; -} - -export const createJobRequestSchema: Schema = object({ - job: ['job', lazy(() => jobSchema)], - idempotencyKey: ['idempotency_key', string()], -}); diff --git a/src/models/createJobResponse.ts b/src/models/createJobResponse.ts deleted file mode 100644 index 79be19007..000000000 --- a/src/models/createJobResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Job, jobSchema } from './job'; - -/** - * Represents a [CreateJob]($e/Team/CreateJob) response. Either `job` or `errors` - * is present in the response. - */ -export interface CreateJobResponse { - /** - * Represents a job that can be assigned to [team members]($m/TeamMember). This object defines the - * job's title and tip eligibility. Compensation is defined in a [job assignment]($m/JobAssignment) - * in a team member's wage setting. - */ - job?: Job; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const createJobResponseSchema: Schema = object({ - job: ['job', optional(lazy(() => jobSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/createLocationCustomAttributeDefinitionRequest.ts b/src/models/createLocationCustomAttributeDefinitionRequest.ts deleted file mode 100644 index bd7f8c45d..000000000 --- a/src/models/createLocationCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents a [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeDefinition) request. */ -export interface CreateLocationCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; -} - -export const createLocationCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(string())], - } -); diff --git a/src/models/createLocationCustomAttributeDefinitionResponse.ts b/src/models/createLocationCustomAttributeDefinitionResponse.ts deleted file mode 100644 index f6f6b48cb..000000000 --- a/src/models/createLocationCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [CreateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/CreateLocationCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface CreateLocationCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createLocationCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createLocationRequest.ts b/src/models/createLocationRequest.ts deleted file mode 100644 index 6a7cbc097..000000000 --- a/src/models/createLocationRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { Location, locationSchema } from './location'; - -/** The request object for the [CreateLocation]($e/Locations/CreateLocation) endpoint. */ -export interface CreateLocationRequest { - /** Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ - location?: Location; -} - -export const createLocationRequestSchema: Schema = object( - { location: ['location', optional(lazy(() => locationSchema))] } -); diff --git a/src/models/createLocationResponse.ts b/src/models/createLocationResponse.ts deleted file mode 100644 index e9e42b82d..000000000 --- a/src/models/createLocationResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Location, locationSchema } from './location'; - -/** The response object returned by the [CreateLocation]($e/Locations/CreateLocation) endpoint. */ -export interface CreateLocationResponse { - /** Information about [errors](https://developer.squareup.com/docs/build-basics/handling-errors) encountered during the request. */ - errors?: Error[]; - /** Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ - location?: Location; -} - -export const createLocationResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - location: ['location', optional(lazy(() => locationSchema))], - } -); diff --git a/src/models/createLoyaltyAccountRequest.ts b/src/models/createLoyaltyAccountRequest.ts deleted file mode 100644 index a74e85266..000000000 --- a/src/models/createLoyaltyAccountRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { LoyaltyAccount, loyaltyAccountSchema } from './loyaltyAccount'; - -/** A request to create a new loyalty account. */ -export interface CreateLoyaltyAccountRequest { - /** - * Describes a loyalty account in a [loyalty program]($m/LoyaltyProgram). For more information, see - * [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). - */ - loyaltyAccount: LoyaltyAccount; - /** - * A unique string that identifies this `CreateLoyaltyAccount` request. - * Keys can be any valid string, but must be unique for every request. - */ - idempotencyKey: string; -} - -export const createLoyaltyAccountRequestSchema: Schema = object( - { - loyaltyAccount: ['loyalty_account', lazy(() => loyaltyAccountSchema)], - idempotencyKey: ['idempotency_key', string()], - } -); diff --git a/src/models/createLoyaltyAccountResponse.ts b/src/models/createLoyaltyAccountResponse.ts deleted file mode 100644 index b0a9c1bfd..000000000 --- a/src/models/createLoyaltyAccountResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyAccount, loyaltyAccountSchema } from './loyaltyAccount'; - -/** A response that includes loyalty account created. */ -export interface CreateLoyaltyAccountResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Describes a loyalty account in a [loyalty program]($m/LoyaltyProgram). For more information, see - * [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). - */ - loyaltyAccount?: LoyaltyAccount; -} - -export const createLoyaltyAccountResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - loyaltyAccount: [ - 'loyalty_account', - optional(lazy(() => loyaltyAccountSchema)), - ], - } -); diff --git a/src/models/createLoyaltyPromotionRequest.ts b/src/models/createLoyaltyPromotionRequest.ts deleted file mode 100644 index 3dc472428..000000000 --- a/src/models/createLoyaltyPromotionRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { LoyaltyPromotion, loyaltyPromotionSchema } from './loyaltyPromotion'; - -/** Represents a [CreateLoyaltyPromotion]($e/Loyalty/CreateLoyaltyPromotion) request. */ -export interface CreateLoyaltyPromotionRequest { - /** - * Represents a promotion for a [loyalty program]($m/LoyaltyProgram). Loyalty promotions enable buyers - * to earn extra points on top of those earned from the base program. - * A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. - */ - loyaltyPromotion: LoyaltyPromotion; - /** - * A unique identifier for this request, which is used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey: string; -} - -export const createLoyaltyPromotionRequestSchema: Schema = object( - { - loyaltyPromotion: ['loyalty_promotion', lazy(() => loyaltyPromotionSchema)], - idempotencyKey: ['idempotency_key', string()], - } -); diff --git a/src/models/createLoyaltyPromotionResponse.ts b/src/models/createLoyaltyPromotionResponse.ts deleted file mode 100644 index 66d276acd..000000000 --- a/src/models/createLoyaltyPromotionResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyPromotion, loyaltyPromotionSchema } from './loyaltyPromotion'; - -/** - * Represents a [CreateLoyaltyPromotion]($e/Loyalty/CreateLoyaltyPromotion) response. - * Either `loyalty_promotion` or `errors` is present in the response. - */ -export interface CreateLoyaltyPromotionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a promotion for a [loyalty program]($m/LoyaltyProgram). Loyalty promotions enable buyers - * to earn extra points on top of those earned from the base program. - * A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. - */ - loyaltyPromotion?: LoyaltyPromotion; -} - -export const createLoyaltyPromotionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - loyaltyPromotion: [ - 'loyalty_promotion', - optional(lazy(() => loyaltyPromotionSchema)), - ], - } -); diff --git a/src/models/createLoyaltyRewardRequest.ts b/src/models/createLoyaltyRewardRequest.ts deleted file mode 100644 index 1355721b4..000000000 --- a/src/models/createLoyaltyRewardRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { LoyaltyReward, loyaltyRewardSchema } from './loyaltyReward'; - -/** A request to create a loyalty reward. */ -export interface CreateLoyaltyRewardRequest { - /** - * Represents a contract to redeem loyalty points for a [reward tier]($m/LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. - * For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). - */ - reward: LoyaltyReward; - /** - * A unique string that identifies this `CreateLoyaltyReward` request. - * Keys can be any valid string, but must be unique for every request. - */ - idempotencyKey: string; -} - -export const createLoyaltyRewardRequestSchema: Schema = object( - { - reward: ['reward', lazy(() => loyaltyRewardSchema)], - idempotencyKey: ['idempotency_key', string()], - } -); diff --git a/src/models/createLoyaltyRewardResponse.ts b/src/models/createLoyaltyRewardResponse.ts deleted file mode 100644 index ba75710a3..000000000 --- a/src/models/createLoyaltyRewardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyReward, loyaltyRewardSchema } from './loyaltyReward'; - -/** A response that includes the loyalty reward created. */ -export interface CreateLoyaltyRewardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a contract to redeem loyalty points for a [reward tier]($m/LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. - * For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). - */ - reward?: LoyaltyReward; -} - -export const createLoyaltyRewardResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - reward: ['reward', optional(lazy(() => loyaltyRewardSchema))], - } -); diff --git a/src/models/createMerchantCustomAttributeDefinitionRequest.ts b/src/models/createMerchantCustomAttributeDefinitionRequest.ts deleted file mode 100644 index 48382b82c..000000000 --- a/src/models/createMerchantCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents a [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/CreateMerchantCustomAttributeDefinition) request. */ -export interface CreateMerchantCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; -} - -export const createMerchantCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(string())], - } -); diff --git a/src/models/createMerchantCustomAttributeDefinitionResponse.ts b/src/models/createMerchantCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 1bd8013c5..000000000 --- a/src/models/createMerchantCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [CreateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/CreateMerchantCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface CreateMerchantCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createMerchantCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createMobileAuthorizationCodeRequest.ts b/src/models/createMobileAuthorizationCodeRequest.ts deleted file mode 100644 index 301cd8610..000000000 --- a/src/models/createMobileAuthorizationCodeRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Defines the body parameters that can be provided in a request to the - * `CreateMobileAuthorizationCode` endpoint. - */ -export interface CreateMobileAuthorizationCodeRequest { - /** The Square location ID that the authorization code should be tied to. */ - locationId?: string; -} - -export const createMobileAuthorizationCodeRequestSchema: Schema = object( - { locationId: ['location_id', optional(string())] } -); diff --git a/src/models/createMobileAuthorizationCodeResponse.ts b/src/models/createMobileAuthorizationCodeResponse.ts deleted file mode 100644 index ee667f566..000000000 --- a/src/models/createMobileAuthorizationCodeResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the `CreateMobileAuthorizationCode` endpoint. - */ -export interface CreateMobileAuthorizationCodeResponse { - /** - * The generated authorization code that connects a mobile application instance - * to a Square account. - */ - authorizationCode?: string; - /** - * The timestamp when `authorization_code` expires, in - * [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, "2016-09-04T23:59:33.123Z"). - */ - expiresAt?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createMobileAuthorizationCodeResponseSchema: Schema = object( - { - authorizationCode: ['authorization_code', optional(string())], - expiresAt: ['expires_at', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createOrderCustomAttributeDefinitionRequest.ts b/src/models/createOrderCustomAttributeDefinitionRequest.ts deleted file mode 100644 index 5b3f8355c..000000000 --- a/src/models/createOrderCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents a create request for an order custom attribute definition. */ -export interface CreateOrderCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; -} - -export const createOrderCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(string())], - } -); diff --git a/src/models/createOrderCustomAttributeDefinitionResponse.ts b/src/models/createOrderCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 74f3e5940..000000000 --- a/src/models/createOrderCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** Represents a response from creating an order custom attribute definition. */ -export interface CreateOrderCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createOrderCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createOrderRequest.ts b/src/models/createOrderRequest.ts deleted file mode 100644 index 40eee105c..000000000 --- a/src/models/createOrderRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Order, orderSchema } from './order'; - -export interface CreateOrderRequest { - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - /** - * A value you specify that uniquely identifies this - * order among orders you have created. - * If you are unsure whether a particular order was created successfully, - * you can try it again with the same idempotency key without - * worrying about creating duplicate orders. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string; -} - -export const createOrderRequestSchema: Schema = object({ - order: ['order', optional(lazy(() => orderSchema))], - idempotencyKey: ['idempotency_key', optional(string())], -}); diff --git a/src/models/createOrderResponse.ts b/src/models/createOrderResponse.ts deleted file mode 100644 index 03ba18df8..000000000 --- a/src/models/createOrderResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Order, orderSchema } from './order'; - -/** - * Defines the fields that are included in the response body of - * a request to the `CreateOrder` endpoint. - * Either `errors` or `order` is present in a given response, but never both. - */ -export interface CreateOrderResponse { - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createOrderResponseSchema: Schema = object({ - order: ['order', optional(lazy(() => orderSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/createPaymentLinkRequest.ts b/src/models/createPaymentLinkRequest.ts deleted file mode 100644 index 63205ee83..000000000 --- a/src/models/createPaymentLinkRequest.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { CheckoutOptions, checkoutOptionsSchema } from './checkoutOptions'; -import { Order, orderSchema } from './order'; -import { PrePopulatedData, prePopulatedDataSchema } from './prePopulatedData'; -import { QuickPay, quickPaySchema } from './quickPay'; - -export interface CreatePaymentLinkRequest { - /** - * A unique string that identifies this `CreatePaymentLinkRequest` 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](https://developer.squareup.com/docs/working-with-apis/idempotency). - */ - idempotencyKey?: string; - /** - * A description of the payment link. You provide this optional description that is useful in your - * application context. It is not used anywhere. - */ - description?: string; - /** - * Describes an ad hoc item and price to generate a quick pay checkout link. - * For more information, - * see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). - */ - quickPay?: QuickPay; - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - checkoutOptions?: CheckoutOptions; - /** - * Describes buyer data to prepopulate in the payment form. - * For more information, - * see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). - */ - prePopulatedData?: PrePopulatedData; - /** A note for the payment. After processing the payment, Square adds this note to the resulting `Payment`. */ - paymentNote?: string; -} - -export const createPaymentLinkRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', optional(string())], - description: ['description', optional(string())], - quickPay: ['quick_pay', optional(lazy(() => quickPaySchema))], - order: ['order', optional(lazy(() => orderSchema))], - checkoutOptions: [ - 'checkout_options', - optional(lazy(() => checkoutOptionsSchema)), - ], - prePopulatedData: [ - 'pre_populated_data', - optional(lazy(() => prePopulatedDataSchema)), - ], - paymentNote: ['payment_note', optional(string())], - } -); diff --git a/src/models/createPaymentLinkResponse.ts b/src/models/createPaymentLinkResponse.ts deleted file mode 100644 index e495c4431..000000000 --- a/src/models/createPaymentLinkResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { PaymentLink, paymentLinkSchema } from './paymentLink'; -import { - PaymentLinkRelatedResources, - paymentLinkRelatedResourcesSchema, -} from './paymentLinkRelatedResources'; - -export interface CreatePaymentLinkResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - paymentLink?: PaymentLink; - relatedResources?: PaymentLinkRelatedResources; -} - -export const createPaymentLinkResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - paymentLink: ['payment_link', optional(lazy(() => paymentLinkSchema))], - relatedResources: [ - 'related_resources', - optional(lazy(() => paymentLinkRelatedResourcesSchema)), - ], - } -); diff --git a/src/models/createPaymentRequest.ts b/src/models/createPaymentRequest.ts deleted file mode 100644 index a0f608563..000000000 --- a/src/models/createPaymentRequest.ts +++ /dev/null @@ -1,227 +0,0 @@ -import { boolean, lazy, object, optional, Schema, string } from '../schema'; -import { Address, addressSchema } from './address'; -import { - CashPaymentDetails, - cashPaymentDetailsSchema, -} from './cashPaymentDetails'; -import { CustomerDetails, customerDetailsSchema } from './customerDetails'; -import { - ExternalPaymentDetails, - externalPaymentDetailsSchema, -} from './externalPaymentDetails'; -import { Money, moneySchema } from './money'; -import { - OfflinePaymentDetails, - offlinePaymentDetailsSchema, -} from './offlinePaymentDetails'; - -/** - * Describes a request to create a payment using - * [CreatePayment]($e/Payments/CreatePayment). - */ -export interface CreatePaymentRequest { - /** - * The ID for the source of funds for this payment. - * This could be a payment token generated by the Web Payments SDK for any of its - * [supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods), - * including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment - * that the seller received outside of Square, specify either "CASH" or "EXTERNAL". - * For more information, see - * [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). - */ - sourceId: string; - /** - * A unique string that identifies this `CreatePayment` request. Keys can be any valid string - * but must be unique for every `CreatePayment` request. - * Note: The number of allowed characters might be less than the stated maximum, if multi-byte - * characters are used. - * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). - */ - idempotencyKey: string; - /** - * 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. - */ - amountMoney?: Money; - /** - * 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. - */ - tipMoney?: Money; - /** - * 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. - */ - appFeeMoney?: Money; - /** - * The duration of time after the payment's creation when Square automatically - * either completes or cancels the payment depending on the `delay_action` field value. - * For more information, see - * [Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold). - * This parameter should be specified as a time duration, in RFC 3339 format. - * Note: This feature is only supported for card payments. This parameter can only be set for a delayed - * capture payment (`autocomplete=false`). - * Default: - * - Card-present payments: "PT36H" (36 hours) from the creation time. - * - Card-not-present payments: "P7D" (7 days) from the creation time. - */ - delayDuration?: string; - /** - * The action to be applied to the payment when the `delay_duration` has elapsed. The action must be - * CANCEL or COMPLETE. For more information, see - * [Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold). - * Default: CANCEL - */ - delayAction?: string; - /** - * If set to `true`, this payment will be completed when possible. If - * set to `false`, this payment is held in an approved state until either - * explicitly completed (captured) or canceled (voided). For more information, see - * [Delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments#delayed-capture-of-a-card-payment). - * Default: true - */ - autocomplete?: boolean; - /** Associates a previously created order with this payment. */ - orderId?: string; - /** - * The [Customer](entity:Customer) ID of the customer associated with the payment. - * This is required if the `source_id` refers to a card on file created using the Cards API. - */ - customerId?: string; - /** - * The location ID to associate with the payment. If not specified, the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location) is - * used. - */ - locationId?: string; - /** - * An optional [TeamMember](entity:TeamMember) ID to associate with - * this payment. - */ - teamMemberId?: string; - /** - * A user-defined ID to associate with the payment. - * You can use this field to associate the payment to an entity in an external system - * (for example, you might specify an order ID that is generated by a third-party shopping cart). - */ - referenceId?: string; - /** - * An identifying token generated by [payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer). - * Verification tokens encapsulate customer device information and 3-D Secure - * challenge results to indicate that Square has verified the buyer identity. - * For more information, see [SCA Overview](https://developer.squareup.com/docs/sca-overview). - */ - verificationToken?: string; - /** - * If set to `true` and charging a Square Gift Card, a payment might be returned with - * `amount_money` equal to less than what was requested. For example, a request for $20 when charging - * a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose - * to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card - * payment. This field cannot be `true` when `autocomplete = true`. - * For more information, see - * [Partial amount with Square Gift Cards](https://developer.squareup.com/docs/payments-api/take-payments#partial-payment-gift-card). - * Default: false - */ - acceptPartialAuthorization?: boolean; - /** The buyer's email address. */ - buyerEmailAddress?: string; - /** - * The buyer's phone number. - * Must follow the following format: - * 1. A leading + symbol (followed by a country code) - * 2. The phone number can contain spaces and the special characters `(` , `)` , `-` , and `.`. - * Alphabetical characters aren't allowed. - * 3. The phone number must contain between 9 and 16 digits. - */ - buyerPhoneNumber?: string; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - billingAddress?: Address; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - shippingAddress?: Address; - /** An optional note to be entered by the developer when creating a payment. */ - note?: string; - /** - * Optional additional payment information to include on the customer's card statement - * as part of the statement description. This can be, for example, an invoice number, ticket number, - * or short description that uniquely identifies the purchase. - * Note that the `statement_description_identifier` might get truncated on the statement description - * to fit the required information including the Square identifier (SQ *) and name of the - * seller taking the payment. - */ - statementDescriptionIdentifier?: string; - /** - * Stores details about a cash payment. Contains only non-confidential information. For more information, see - * [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). - */ - cashDetails?: CashPaymentDetails; - /** - * Stores details about an external payment. Contains only non-confidential information. - * For more information, see - * [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). - */ - externalDetails?: ExternalPaymentDetails; - /** Details about the customer making the payment. */ - customerDetails?: CustomerDetails; - /** Details specific to offline payments. */ - offlinePaymentDetails?: OfflinePaymentDetails; -} - -export const createPaymentRequestSchema: Schema = object({ - sourceId: ['source_id', string()], - idempotencyKey: ['idempotency_key', string()], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - tipMoney: ['tip_money', optional(lazy(() => moneySchema))], - appFeeMoney: ['app_fee_money', optional(lazy(() => moneySchema))], - delayDuration: ['delay_duration', optional(string())], - delayAction: ['delay_action', optional(string())], - autocomplete: ['autocomplete', optional(boolean())], - orderId: ['order_id', optional(string())], - customerId: ['customer_id', optional(string())], - locationId: ['location_id', optional(string())], - teamMemberId: ['team_member_id', optional(string())], - referenceId: ['reference_id', optional(string())], - verificationToken: ['verification_token', optional(string())], - acceptPartialAuthorization: [ - 'accept_partial_authorization', - optional(boolean()), - ], - buyerEmailAddress: ['buyer_email_address', optional(string())], - buyerPhoneNumber: ['buyer_phone_number', optional(string())], - billingAddress: ['billing_address', optional(lazy(() => addressSchema))], - shippingAddress: ['shipping_address', optional(lazy(() => addressSchema))], - note: ['note', optional(string())], - statementDescriptionIdentifier: [ - 'statement_description_identifier', - optional(string()), - ], - cashDetails: ['cash_details', optional(lazy(() => cashPaymentDetailsSchema))], - externalDetails: [ - 'external_details', - optional(lazy(() => externalPaymentDetailsSchema)), - ], - customerDetails: [ - 'customer_details', - optional(lazy(() => customerDetailsSchema)), - ], - offlinePaymentDetails: [ - 'offline_payment_details', - optional(lazy(() => offlinePaymentDetailsSchema)), - ], -}); diff --git a/src/models/createPaymentResponse.ts b/src/models/createPaymentResponse.ts deleted file mode 100644 index 8de863ddb..000000000 --- a/src/models/createPaymentResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Payment, paymentSchema } from './payment'; - -/** - * Defines the response returned by [CreatePayment]($e/Payments/CreatePayment). - * If there are errors processing the request, the `payment` field might not be - * present, or it might be present with a status of `FAILED`. - */ -export interface CreatePaymentResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a payment processed by the Square API. */ - payment?: Payment; -} - -export const createPaymentResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - payment: ['payment', optional(lazy(() => paymentSchema))], - } -); diff --git a/src/models/createRefundRequest.ts b/src/models/createRefundRequest.ts deleted file mode 100644 index 1d2277815..000000000 --- a/src/models/createRefundRequest.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Defines the body parameters that can be included in - * a request to the [CreateRefund](api-endpoint:Transactions-CreateRefund) endpoint. - * Deprecated - recommend using [RefundPayment](api-endpoint:Refunds-RefundPayment) - */ -export interface CreateRefundRequest { - /** - * A value you specify that uniquely identifies this - * refund among refunds you've created for the tender. - * If you're unsure whether a particular refund succeeded, - * you can reattempt it with the same idempotency key without - * worrying about duplicating the refund. - * See [Idempotency keys](https://developer.squareup.com/docs/working-with-apis/idempotency) for more information. - */ - idempotencyKey: string; - /** - * The ID of the tender to refund. - * A [`Transaction`](entity:Transaction) has one or more `tenders` (i.e., methods - * of payment) associated with it, and you refund each tender separately with - * the Connect API. - */ - tenderId: string; - /** - * A description of the reason for the refund. - * Default value: `Refund via API` - */ - reason?: string; - /** - * 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. - */ - amountMoney: Money; -} - -export const createRefundRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', string()], - tenderId: ['tender_id', string()], - reason: ['reason', optional(string())], - amountMoney: ['amount_money', lazy(() => moneySchema)], -}); diff --git a/src/models/createRefundResponse.ts b/src/models/createRefundResponse.ts deleted file mode 100644 index 8ef68bd60..000000000 --- a/src/models/createRefundResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Refund, refundSchema } from './refund'; - -/** - * Defines the fields that are included in the response body of - * a request to the [CreateRefund](api-endpoint:Transactions-CreateRefund) endpoint. - * One of `errors` or `refund` is present in a given response (never both). - */ -export interface CreateRefundResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a refund processed for a Square transaction. */ - refund?: Refund; -} - -export const createRefundResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refund: ['refund', optional(lazy(() => refundSchema))], -}); diff --git a/src/models/createShiftRequest.ts b/src/models/createShiftRequest.ts deleted file mode 100644 index db14d24ec..000000000 --- a/src/models/createShiftRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Shift, shiftSchema } from './shift'; - -/** Represents a request to create a `Shift`. */ -export interface CreateShiftRequest { - /** A unique string value to ensure the idempotency of the operation. */ - idempotencyKey?: string; - /** - * A record of the hourly rate, start, and end times for a single work shift - * for an employee. This might include a record of the start and end times for breaks - * taken during the shift. - */ - shift: Shift; -} - -export const createShiftRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', optional(string())], - shift: ['shift', lazy(() => shiftSchema)], -}); diff --git a/src/models/createShiftResponse.ts b/src/models/createShiftResponse.ts deleted file mode 100644 index f24403cd0..000000000 --- a/src/models/createShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Shift, shiftSchema } from './shift'; - -/** - * The response to a request to create a `Shift`. The response contains - * the created `Shift` object and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface CreateShiftResponse { - /** - * A record of the hourly rate, start, and end times for a single work shift - * for an employee. This might include a record of the start and end times for breaks - * taken during the shift. - */ - shift?: Shift; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const createShiftResponseSchema: Schema = object({ - shift: ['shift', optional(lazy(() => shiftSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/createSubscriptionRequest.ts b/src/models/createSubscriptionRequest.ts deleted file mode 100644 index 2b3e35cbe..000000000 --- a/src/models/createSubscriptionRequest.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { - array, - lazy, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; -import { Phase, phaseSchema } from './phase'; -import { - SubscriptionSource, - subscriptionSourceSchema, -} from './subscriptionSource'; - -/** - * Defines input parameters in a request to the - * [CreateSubscription]($e/Subscriptions/CreateSubscription) endpoint. - */ -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/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 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. - * If it is unspecified, the subscription starts immediately. - */ - 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 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. - */ - canceledDate?: string; - /** - * 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%. - */ - taxPercentage?: string; - /** - * 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. - */ - 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 with a link to pay for their subscription. - */ - cardId?: string; - /** - * 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). - */ - timezone?: string; - /** The origination details of the subscription. */ - source?: SubscriptionSource; - /** The day-of-the-month to change the billing date to. */ - monthlyBillingAnchorDate?: number; - /** array of phases for this subscription */ - phases?: Phase[]; -} - -export const createSubscriptionRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', optional(string())], - locationId: ['location_id', string()], - planVariationId: ['plan_variation_id', optional(string())], - customerId: ['customer_id', string()], - startDate: ['start_date', optional(string())], - canceledDate: ['canceled_date', optional(string())], - taxPercentage: ['tax_percentage', optional(string())], - priceOverrideMoney: [ - 'price_override_money', - optional(lazy(() => moneySchema)), - ], - cardId: ['card_id', optional(string())], - timezone: ['timezone', optional(string())], - source: ['source', optional(lazy(() => subscriptionSourceSchema))], - monthlyBillingAnchorDate: [ - 'monthly_billing_anchor_date', - optional(number()), - ], - phases: ['phases', optional(array(lazy(() => phaseSchema)))], - } -); diff --git a/src/models/createSubscriptionResponse.ts b/src/models/createSubscriptionResponse.ts deleted file mode 100644 index a1015229a..000000000 --- a/src/models/createSubscriptionResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; - -/** - * Defines output parameters in a response from the - * [CreateSubscription]($e/Subscriptions/CreateSubscription) endpoint. - */ -export interface CreateSubscriptionResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * Represents a subscription purchased by a customer. - * For more information, see - * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). - */ - subscription?: Subscription; -} - -export const createSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - } -); diff --git a/src/models/createTeamMemberRequest.ts b/src/models/createTeamMemberRequest.ts deleted file mode 100644 index 30d508e45..000000000 --- a/src/models/createTeamMemberRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { TeamMember, teamMemberSchema } from './teamMember'; - -/** Represents a create request for a `TeamMember` object. */ -export interface CreateTeamMemberRequest { - /** - * A unique string that identifies this `CreateTeamMember` request. - * Keys can be any valid string, but must be unique for every request. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - * The minimum length is 1 and the maximum length is 45. - */ - idempotencyKey?: string; - /** A record representing an individual team member for a business. */ - teamMember?: TeamMember; -} - -export const createTeamMemberRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', optional(string())], - teamMember: ['team_member', optional(lazy(() => teamMemberSchema))], - } -); diff --git a/src/models/createTeamMemberResponse.ts b/src/models/createTeamMemberResponse.ts deleted file mode 100644 index 1e7cba7c4..000000000 --- a/src/models/createTeamMemberResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TeamMember, teamMemberSchema } from './teamMember'; - -/** Represents a response from a create request containing the created `TeamMember` object or error messages. */ -export interface CreateTeamMemberResponse { - /** A record representing an individual team member for a business. */ - teamMember?: TeamMember; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const createTeamMemberResponseSchema: Schema = object( - { - teamMember: ['team_member', optional(lazy(() => teamMemberSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/createTerminalActionRequest.ts b/src/models/createTerminalActionRequest.ts deleted file mode 100644 index f6cb36f94..000000000 --- a/src/models/createTerminalActionRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { TerminalAction, terminalActionSchema } from './terminalAction'; - -export interface CreateTerminalActionRequest { - /** - * A unique string that identifies this `CreateAction` request. Keys can be any valid string - * but must be unique for every `CreateAction` request. - * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more - * information. - */ - idempotencyKey: string; - /** Represents an action processed by the Square Terminal. */ - action: TerminalAction; -} - -export const createTerminalActionRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - action: ['action', lazy(() => terminalActionSchema)], - } -); diff --git a/src/models/createTerminalActionResponse.ts b/src/models/createTerminalActionResponse.ts deleted file mode 100644 index e33476d95..000000000 --- a/src/models/createTerminalActionResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalAction, terminalActionSchema } from './terminalAction'; - -export interface CreateTerminalActionResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** Represents an action processed by the Square Terminal. */ - action?: TerminalAction; -} - -export const createTerminalActionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - action: ['action', optional(lazy(() => terminalActionSchema))], - } -); diff --git a/src/models/createTerminalCheckoutRequest.ts b/src/models/createTerminalCheckoutRequest.ts deleted file mode 100644 index ddbd475dd..000000000 --- a/src/models/createTerminalCheckoutRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { TerminalCheckout, terminalCheckoutSchema } from './terminalCheckout'; - -export interface CreateTerminalCheckoutRequest { - /** - * A unique string that identifies this `CreateCheckout` request. Keys can be any valid string but - * must be unique for every `CreateCheckout` request. - * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - */ - idempotencyKey: string; - /** Represents a checkout processed by the Square Terminal. */ - checkout: TerminalCheckout; -} - -export const createTerminalCheckoutRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - checkout: ['checkout', lazy(() => terminalCheckoutSchema)], - } -); diff --git a/src/models/createTerminalCheckoutResponse.ts b/src/models/createTerminalCheckoutResponse.ts deleted file mode 100644 index 911d59b0f..000000000 --- a/src/models/createTerminalCheckoutResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalCheckout, terminalCheckoutSchema } from './terminalCheckout'; - -export interface CreateTerminalCheckoutResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a checkout processed by the Square Terminal. */ - checkout?: TerminalCheckout; -} - -export const createTerminalCheckoutResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - checkout: ['checkout', optional(lazy(() => terminalCheckoutSchema))], - } -); diff --git a/src/models/createTerminalRefundRequest.ts b/src/models/createTerminalRefundRequest.ts deleted file mode 100644 index de91024a0..000000000 --- a/src/models/createTerminalRefundRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { TerminalRefund, terminalRefundSchema } from './terminalRefund'; - -export interface CreateTerminalRefundRequest { - /** - * A unique string that identifies this `CreateRefund` request. Keys can be any valid string but - * must be unique for every `CreateRefund` request. - * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - */ - idempotencyKey: string; - /** Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. */ - refund?: TerminalRefund; -} - -export const createTerminalRefundRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - refund: ['refund', optional(lazy(() => terminalRefundSchema))], - } -); diff --git a/src/models/createTerminalRefundResponse.ts b/src/models/createTerminalRefundResponse.ts deleted file mode 100644 index b95fe7676..000000000 --- a/src/models/createTerminalRefundResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalRefund, terminalRefundSchema } from './terminalRefund'; - -export interface CreateTerminalRefundResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. */ - refund?: TerminalRefund; -} - -export const createTerminalRefundResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refund: ['refund', optional(lazy(() => terminalRefundSchema))], - } -); diff --git a/src/models/createVendorRequest.ts b/src/models/createVendorRequest.ts deleted file mode 100644 index 64f52c246..000000000 --- a/src/models/createVendorRequest.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Vendor, vendorSchema } from './vendor'; - -/** Represents an input to a call to [CreateVendor]($e/Vendors/CreateVendor). */ -export interface CreateVendorRequest { - /** - * A client-supplied, universally unique identifier (UUID) to make this [CreateVendor](api-endpoint:Vendors-CreateVendor) call idempotent. - * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the - * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more - * information. - */ - idempotencyKey: string; - /** Represents a supplier to a seller. */ - vendor?: Vendor; -} - -export const createVendorRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', string()], - vendor: ['vendor', optional(lazy(() => vendorSchema))], -}); diff --git a/src/models/createVendorResponse.ts b/src/models/createVendorResponse.ts deleted file mode 100644 index bbdb2352e..000000000 --- a/src/models/createVendorResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Vendor, vendorSchema } from './vendor'; - -/** Represents an output from a call to [CreateVendor]($e/Vendors/CreateVendor). */ -export interface CreateVendorResponse { - /** Errors encountered when the request fails. */ - errors?: Error[]; - /** Represents a supplier to a seller. */ - vendor?: Vendor; -} - -export const createVendorResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - vendor: ['vendor', optional(lazy(() => vendorSchema))], -}); diff --git a/src/models/createWebhookSubscriptionRequest.ts b/src/models/createWebhookSubscriptionRequest.ts deleted file mode 100644 index 959e55104..000000000 --- a/src/models/createWebhookSubscriptionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - WebhookSubscription, - webhookSubscriptionSchema, -} from './webhookSubscription'; - -/** Creates a [Subscription]($m/WebhookSubscription). */ -export interface CreateWebhookSubscriptionRequest { - /** A unique string that identifies the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) request. */ - idempotencyKey?: string; - /** - * Represents the details of a webhook subscription, including notification URL, - * event types, and signature key. - */ - subscription: WebhookSubscription; -} - -export const createWebhookSubscriptionRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', optional(string())], - subscription: ['subscription', lazy(() => webhookSubscriptionSchema)], - } -); diff --git a/src/models/createWebhookSubscriptionResponse.ts b/src/models/createWebhookSubscriptionResponse.ts deleted file mode 100644 index d875febd9..000000000 --- a/src/models/createWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - WebhookSubscription, - webhookSubscriptionSchema, -} from './webhookSubscription'; - -/** - * Defines the fields that are included in the response body of - * a request to the [CreateWebhookSubscription]($e/WebhookSubscriptions/CreateWebhookSubscription) endpoint. - * Note: if there are errors processing the request, the [Subscription]($m/WebhookSubscription) will not be - * present. - */ -export interface CreateWebhookSubscriptionResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** - * Represents the details of a webhook subscription, including notification URL, - * event types, and signature key. - */ - subscription?: WebhookSubscription; -} - -export const createWebhookSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: [ - 'subscription', - optional(lazy(() => webhookSubscriptionSchema)), - ], - } -); diff --git a/src/models/customAttribute.ts b/src/models/customAttribute.ts deleted file mode 100644 index ecaf93d76..000000000 --- a/src/models/customAttribute.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { - lazy, - nullable, - number, - object, - optional, - Schema, - string, - unknown, -} from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ -export interface CustomAttribute { - /** - * The identifier - * of the custom attribute definition and its corresponding custom attributes. This value - * can be a simple key, which is the key that is provided when the custom attribute definition - * is created, or a qualified key, if the requesting - * application is not the definition owner. The qualified key consists of the application ID - * of the custom attribute definition owner - * followed by the simple key that was provided when the definition was created. It has the - * format application_id:simple key. - * The value for a simple key can contain up to 60 alphanumeric characters, periods (.), - * underscores (_), and hyphens (-). - */ - key?: string | null; - /** - * The value assigned to the custom attribute. It is validated against the custom - * attribute definition's schema on write operations. For more information about custom - * attribute values, - * see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). - */ - value?: unknown | null; - /** - * Read only. The current version of the custom attribute. This field is incremented when the custom attribute is changed. - * When updating an existing custom attribute value, you can provide this field - * and specify the current version of the custom attribute to enable - * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency). - * This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads, - * see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). - */ - version?: number; - /** - * The level of permission that a seller or other applications requires to - * view this custom attribute definition. - * The `Visibility` field controls who can read and write the custom attribute values - * and custom attribute definition. - */ - visibility?: string; - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - definition?: CustomAttributeDefinition; - /** - * The timestamp that indicates when the custom attribute was created or was most recently - * updated, in RFC 3339 format. - */ - updatedAt?: string; - /** The timestamp that indicates when the custom attribute was created, in RFC 3339 format. */ - createdAt?: string; -} - -export const customAttributeSchema: Schema = object({ - key: ['key', optional(nullable(string()))], - value: ['value', optional(nullable(unknown()))], - version: ['version', optional(number())], - visibility: ['visibility', optional(string())], - definition: [ - 'definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - updatedAt: ['updated_at', optional(string())], - createdAt: ['created_at', optional(string())], -}); diff --git a/src/models/customAttributeDefinition.ts b/src/models/customAttributeDefinition.ts deleted file mode 100644 index f826208fd..000000000 --- a/src/models/customAttributeDefinition.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { - dict, - nullable, - number, - object, - optional, - Schema, - string, - unknown, -} from '../schema'; - -/** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ -export interface CustomAttributeDefinition { - /** - * The identifier - * of the custom attribute definition and its corresponding custom attributes. This value - * can be a simple key, which is the key that is provided when the custom attribute definition - * is created, or a qualified key, if the requesting - * application is not the definition owner. The qualified key consists of the application ID - * of the custom attribute definition owner - * followed by the simple key that was provided when the definition was created. It has the - * format application_id:simple key. - * The value for a simple key can contain up to 60 alphanumeric characters, periods (.), - * underscores (_), and hyphens (-). - * This field can not be changed - * after the custom attribute definition is created. This field is required when creating - * a definition and must be unique per application, seller, and resource type. - */ - key?: string | null; - /** - * The JSON schema for the custom attribute definition, which determines the data type of the corresponding custom attributes. For more information, - * see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). This field is required when creating a definition. - */ - schema?: Record | null; - /** - * The name of the custom attribute definition for API and seller-facing UI purposes. The name must - * be unique within the seller and application pair. This field is required if the - * `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - */ - name?: string | null; - /** - * Seller-oriented description of the custom attribute definition, including any constraints - * that the seller should observe. May be displayed as a tooltip in Square UIs. This field is - * required if the `visibility` field is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. - */ - description?: string | null; - /** - * The level of permission that a seller or other applications requires to - * view this custom attribute definition. - * The `Visibility` field controls who can read and write the custom attribute values - * and custom attribute definition. - */ - visibility?: string; - /** - * Read only. The current version of the custom attribute definition. - * The value is incremented each time the custom attribute definition is updated. - * When updating a custom attribute definition, you can provide this field - * and specify the current version of the custom attribute definition to enable - * [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency). - * On writes, this field must be set to the latest version. Stale writes are rejected. - * This field can also be used to enforce strong consistency for reads. For more information about strong consistency for reads, - * see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). - */ - version?: number; - /** - * The timestamp that indicates when the custom attribute definition was created or most recently updated, - * in RFC 3339 format. - */ - updatedAt?: string; - /** The timestamp that indicates when the custom attribute definition was created, in RFC 3339 format. */ - createdAt?: string; -} - -export const customAttributeDefinitionSchema: Schema = object( - { - key: ['key', optional(nullable(string()))], - schema: ['schema', optional(nullable(dict(unknown())))], - name: ['name', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - visibility: ['visibility', optional(string())], - version: ['version', optional(number())], - updatedAt: ['updated_at', optional(string())], - createdAt: ['created_at', optional(string())], - } -); diff --git a/src/models/customAttributeFilter.ts b/src/models/customAttributeFilter.ts deleted file mode 100644 index 835584807..000000000 --- a/src/models/customAttributeFilter.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Range, rangeSchema } from './range'; - -/** - * Supported custom attribute query expressions for calling the - * [SearchCatalogItems]($e/Catalog/SearchCatalogItems) - * endpoint to search for items or item variations. - */ -export interface CustomAttributeFilter { - /** - * A query expression to filter items or item variations by matching their custom attributes' - * `custom_attribute_definition_id` property value against the the specified id. - * Exactly one of `custom_attribute_definition_id` or `key` must be specified. - */ - customAttributeDefinitionId?: string | null; - /** - * A query expression to filter items or item variations by matching their custom attributes' - * `key` property value against the specified key. - * Exactly one of `custom_attribute_definition_id` or `key` must be specified. - */ - key?: string | null; - /** - * A query expression to filter items or item variations by matching their custom attributes' - * `string_value` property value against the specified text. - * Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. - */ - stringFilter?: string | null; - /** The range of a number value between the specified lower and upper bounds. */ - numberFilter?: Range; - /** - * A query expression to filter items or item variations by matching their custom attributes' - * `selection_uid_values` values against the specified selection uids. - * Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. - */ - selectionUidsFilter?: string[] | null; - /** - * A query expression to filter items or item variations by matching their custom attributes' - * `boolean_value` property values against the specified Boolean expression. - * Exactly one of `string_filter`, `number_filter`, `selection_uids_filter`, or `bool_filter` must be specified. - */ - boolFilter?: boolean | null; -} - -export const customAttributeFilterSchema: Schema = object( - { - customAttributeDefinitionId: [ - 'custom_attribute_definition_id', - optional(nullable(string())), - ], - key: ['key', optional(nullable(string()))], - stringFilter: ['string_filter', optional(nullable(string()))], - numberFilter: ['number_filter', optional(lazy(() => rangeSchema))], - selectionUidsFilter: [ - 'selection_uids_filter', - optional(nullable(array(string()))), - ], - boolFilter: ['bool_filter', optional(nullable(boolean()))], - } -); diff --git a/src/models/customField.ts b/src/models/customField.ts deleted file mode 100644 index 806f94386..000000000 --- a/src/models/customField.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** - * Describes a custom form field to add to the checkout page to collect more information from buyers during checkout. - * For more information, - * see [Specify checkout options](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#specify-checkout-options-1). - */ -export interface CustomField { - /** The title of the custom field. */ - title: string; -} - -export const customFieldSchema: Schema = object({ - title: ['title', string()], -}); diff --git a/src/models/customer.ts b/src/models/customer.ts deleted file mode 100644 index 932ecf0cc..000000000 --- a/src/models/customer.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { - array, - bigint, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { Card, cardSchema } from './card'; -import { - CustomerPreferences, - customerPreferencesSchema, -} from './customerPreferences'; -import { CustomerTaxIds, customerTaxIdsSchema } from './customerTaxIds'; - -/** Represents a Square customer profile in the Customer Directory of a Square seller. */ -export interface Customer { - /** - * A unique Square-assigned ID for the customer profile. - * If you need this ID for an API request, use the ID returned when you created the customer profile or call the [SearchCustomers](api-endpoint:Customers-SearchCustomers) - * or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint. - */ - id?: string; - /** The timestamp when the customer profile was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the customer profile was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** - * Payment details of the credit, debit, and gift cards stored on file for the customer profile. - * DEPRECATED at version 2021-06-16 and will be RETIRED at version 2024-12-18. Replaced by calling [ListCards](api-endpoint:Cards-ListCards) (for credit and debit cards on file) - * or [ListGiftCards](api-endpoint:GiftCards-ListGiftCards) (for gift cards on file) and including the `customer_id` query parameter. - * For more information, see [Migration notes](https://developer.squareup.com/docs/customers-api/what-it-does#migrate-customer-cards). - */ - cards?: Card[] | null; - /** The given name (that is, the first name) associated with the customer profile. */ - givenName?: string | null; - /** The family name (that is, the last name) associated with the customer profile. */ - familyName?: string | null; - /** A nickname for the customer profile. */ - nickname?: string | null; - /** A business name associated with the customer profile. */ - companyName?: string | null; - /** The email address associated with the customer profile. */ - emailAddress?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; - /** The phone number associated with the customer profile. */ - phoneNumber?: string | null; - /** - * The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-21` - * represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year). - */ - birthday?: string | null; - /** - * An optional second ID used to associate the customer profile with an - * entity in another system. - */ - referenceId?: string | null; - /** A custom note associated with the customer profile. */ - note?: string | null; - /** Represents communication preferences for the customer profile. */ - preferences?: CustomerPreferences; - /** Indicates the method used to create the customer profile. */ - creationSource?: string; - /** The IDs of [customer groups](entity:CustomerGroup) the customer belongs to. */ - groupIds?: string[] | null; - /** The IDs of [customer segments](entity:CustomerSegment) the customer belongs to. */ - segmentIds?: string[] | null; - /** The Square-assigned version number of the customer profile. The version number is incremented each time an update is committed to the customer profile, except for changes to customer segment membership and cards on file. */ - version?: bigint; - /** - * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. - * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). - */ - taxIds?: CustomerTaxIds; -} - -export const customerSchema: Schema = object({ - id: ['id', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - cards: ['cards', optional(nullable(array(lazy(() => cardSchema))))], - givenName: ['given_name', optional(nullable(string()))], - familyName: ['family_name', optional(nullable(string()))], - nickname: ['nickname', optional(nullable(string()))], - companyName: ['company_name', optional(nullable(string()))], - emailAddress: ['email_address', optional(nullable(string()))], - address: ['address', optional(lazy(() => addressSchema))], - phoneNumber: ['phone_number', optional(nullable(string()))], - birthday: ['birthday', optional(nullable(string()))], - referenceId: ['reference_id', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - preferences: ['preferences', optional(lazy(() => customerPreferencesSchema))], - creationSource: ['creation_source', optional(string())], - groupIds: ['group_ids', optional(nullable(array(string())))], - segmentIds: ['segment_ids', optional(nullable(array(string())))], - version: ['version', optional(bigint())], - taxIds: ['tax_ids', optional(lazy(() => customerTaxIdsSchema))], -}); diff --git a/src/models/customerAddressFilter.ts b/src/models/customerAddressFilter.ts deleted file mode 100644 index 055c9e1d0..000000000 --- a/src/models/customerAddressFilter.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CustomerTextFilter, - customerTextFilterSchema, -} from './customerTextFilter'; - -/** - * The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue]($m/CustomerCustomAttributeFilterValue) filter when - * searching by an `Address`-type custom attribute. - */ -export interface CustomerAddressFilter { - /** - * A filter to select customers based on exact or fuzzy matching of - * customer attributes against a specified query. Depending on the customer attributes, - * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - */ - postalCode?: CustomerTextFilter; - /** - * Indicates the country associated with another entity, such as a business. - * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). - */ - country?: string; -} - -export const customerAddressFilterSchema: Schema = object( - { - postalCode: ['postal_code', optional(lazy(() => customerTextFilterSchema))], - country: ['country', optional(string())], - } -); diff --git a/src/models/customerCreationSourceFilter.ts b/src/models/customerCreationSourceFilter.ts deleted file mode 100644 index 2fa76ae8f..000000000 --- a/src/models/customerCreationSourceFilter.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** - * The creation source filter. - * If one or more creation sources are set, customer profiles are included in, - * or excluded from, the result if they match at least one of the filter criteria. - */ -export interface CustomerCreationSourceFilter { - /** - * The list of creation sources used as filtering criteria. - * See [CustomerCreationSource](#type-customercreationsource) for possible values - */ - values?: string[] | null; - /** - * Indicates whether customers should be included in, or excluded from, - * the result set when they match the filtering criteria. - */ - rule?: string; -} - -export const customerCreationSourceFilterSchema: Schema = object( - { - values: ['values', optional(nullable(array(string())))], - rule: ['rule', optional(string())], - } -); diff --git a/src/models/customerCustomAttributeFilter.ts b/src/models/customerCustomAttributeFilter.ts deleted file mode 100644 index 77c38db88..000000000 --- a/src/models/customerCustomAttributeFilter.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CustomerCustomAttributeFilterValue, - customerCustomAttributeFilterValueSchema, -} from './customerCustomAttributeFilterValue'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -/** - * The custom attribute filter. Use this filter in a set of [custom attribute filters]($m/CustomerCustomAttributeFilters) to search - * based on the value or last updated date of a customer-related [custom attribute]($m/CustomAttribute). - */ -export interface CustomerCustomAttributeFilter { - /** - * The `key` of the [custom attribute](entity:CustomAttribute) to filter by. The key is the identifier of the custom attribute - * (and the corresponding custom attribute definition) and can be retrieved using the [Customer Custom Attributes API](api:CustomerCustomAttributes). - */ - key: string; - /** - * A type-specific filter used in a [custom attribute filter]($m/CustomerCustomAttributeFilter) to search based on the value - * of a customer-related [custom attribute]($m/CustomAttribute). - */ - filter?: CustomerCustomAttributeFilterValue; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - updatedAt?: TimeRange; -} - -export const customerCustomAttributeFilterSchema: Schema = object( - { - key: ['key', string()], - filter: [ - 'filter', - optional(lazy(() => customerCustomAttributeFilterValueSchema)), - ], - updatedAt: ['updated_at', optional(lazy(() => timeRangeSchema))], - } -); diff --git a/src/models/customerCustomAttributeFilterValue.ts b/src/models/customerCustomAttributeFilterValue.ts deleted file mode 100644 index af6bc606d..000000000 --- a/src/models/customerCustomAttributeFilterValue.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { boolean, lazy, nullable, object, optional, Schema } from '../schema'; -import { - CustomerAddressFilter, - customerAddressFilterSchema, -} from './customerAddressFilter'; -import { - CustomerTextFilter, - customerTextFilterSchema, -} from './customerTextFilter'; -import { FilterValue, filterValueSchema } from './filterValue'; -import { FloatNumberRange, floatNumberRangeSchema } from './floatNumberRange'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -/** - * A type-specific filter used in a [custom attribute filter]($m/CustomerCustomAttributeFilter) to search based on the value - * of a customer-related [custom attribute]($m/CustomAttribute). - */ -export interface CustomerCustomAttributeFilterValue { - /** - * A filter to select customers based on exact or fuzzy matching of - * customer attributes against a specified query. Depending on the customer attributes, - * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - */ - email?: CustomerTextFilter; - /** - * A filter to select customers based on exact or fuzzy matching of - * customer attributes against a specified query. Depending on the customer attributes, - * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - */ - phone?: CustomerTextFilter; - /** - * A filter to select customers based on exact or fuzzy matching of - * customer attributes against a specified query. Depending on the customer attributes, - * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - */ - text?: CustomerTextFilter; - /** - * A filter to select resources based on an exact field value. For any given - * value, the value can only be in one property. Depending on the field, either - * all properties can be set or only a subset will be available. - * Refer to the documentation of the field. - */ - selection?: FilterValue; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - date?: TimeRange; - /** Specifies a decimal number range. */ - number?: FloatNumberRange; - /** A filter for a query based on the value of a `Boolean`-type custom attribute. */ - mBoolean?: boolean | null; - /** - * The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue]($m/CustomerCustomAttributeFilterValue) filter when - * searching by an `Address`-type custom attribute. - */ - address?: CustomerAddressFilter; -} - -export const customerCustomAttributeFilterValueSchema: Schema = object( - { - email: ['email', optional(lazy(() => customerTextFilterSchema))], - phone: ['phone', optional(lazy(() => customerTextFilterSchema))], - text: ['text', optional(lazy(() => customerTextFilterSchema))], - selection: ['selection', optional(lazy(() => filterValueSchema))], - date: ['date', optional(lazy(() => timeRangeSchema))], - number: ['number', optional(lazy(() => floatNumberRangeSchema))], - mBoolean: ['boolean', optional(nullable(boolean()))], - address: ['address', optional(lazy(() => customerAddressFilterSchema))], - } -); diff --git a/src/models/customerCustomAttributeFilters.ts b/src/models/customerCustomAttributeFilters.ts deleted file mode 100644 index ad7786326..000000000 --- a/src/models/customerCustomAttributeFilters.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, lazy, nullable, object, optional, Schema } from '../schema'; -import { - CustomerCustomAttributeFilter, - customerCustomAttributeFilterSchema, -} from './customerCustomAttributeFilter'; - -/** - * The custom attribute filters in a set of [customer filters]($m/CustomerFilter) used in a search query. Use this filter - * to search based on [custom attributes]($m/CustomAttribute) that are assigned to customer profiles. For more information, see - * [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). - */ -export interface CustomerCustomAttributeFilters { - /** - * The custom attribute filters. Each filter must specify `key` and include the `filter` field with a type-specific filter, - * the `updated_at` field, or both. The provided keys must be unique within the list of custom attribute filters. - */ - filters?: CustomerCustomAttributeFilter[] | null; -} - -export const customerCustomAttributeFiltersSchema: Schema = object( - { - filters: [ - 'filters', - optional( - nullable(array(lazy(() => customerCustomAttributeFilterSchema))) - ), - ], - } -); diff --git a/src/models/customerDetails.ts b/src/models/customerDetails.ts deleted file mode 100644 index 006d59fb8..000000000 --- a/src/models/customerDetails.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { boolean, nullable, object, optional, Schema } from '../schema'; - -/** Details about the customer making the payment. */ -export interface CustomerDetails { - /** Indicates whether the customer initiated the payment. */ - customerInitiated?: boolean | null; - /** - * Indicates that the seller keyed in payment details on behalf of the customer. - * This is used to flag a payment as Mail Order / Telephone Order (MOTO). - */ - sellerKeyedIn?: boolean | null; -} - -export const customerDetailsSchema: Schema = object({ - customerInitiated: ['customer_initiated', optional(nullable(boolean()))], - sellerKeyedIn: ['seller_keyed_in', optional(nullable(boolean()))], -}); diff --git a/src/models/customerFilter.ts b/src/models/customerFilter.ts deleted file mode 100644 index 0653f1695..000000000 --- a/src/models/customerFilter.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - CustomerCreationSourceFilter, - customerCreationSourceFilterSchema, -} from './customerCreationSourceFilter'; -import { - CustomerCustomAttributeFilters, - customerCustomAttributeFiltersSchema, -} from './customerCustomAttributeFilters'; -import { - CustomerTextFilter, - customerTextFilterSchema, -} from './customerTextFilter'; -import { FilterValue, filterValueSchema } from './filterValue'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -/** - * Represents the filtering criteria in a [search query]($m/CustomerQuery) that defines how to filter - * customer profiles returned in [SearchCustomers]($e/Customers/SearchCustomers) results. - */ -export interface CustomerFilter { - /** - * The creation source filter. - * If one or more creation sources are set, customer profiles are included in, - * or excluded from, the result if they match at least one of the filter criteria. - */ - creationSource?: CustomerCreationSourceFilter; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - createdAt?: TimeRange; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - updatedAt?: TimeRange; - /** - * A filter to select customers based on exact or fuzzy matching of - * customer attributes against a specified query. Depending on the customer attributes, - * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - */ - emailAddress?: CustomerTextFilter; - /** - * A filter to select customers based on exact or fuzzy matching of - * customer attributes against a specified query. Depending on the customer attributes, - * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - */ - phoneNumber?: CustomerTextFilter; - /** - * A filter to select customers based on exact or fuzzy matching of - * customer attributes against a specified query. Depending on the customer attributes, - * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - */ - referenceId?: CustomerTextFilter; - /** - * A filter to select resources based on an exact field value. For any given - * value, the value can only be in one property. Depending on the field, either - * all properties can be set or only a subset will be available. - * Refer to the documentation of the field. - */ - groupIds?: FilterValue; - /** - * The custom attribute filters in a set of [customer filters]($m/CustomerFilter) used in a search query. Use this filter - * to search based on [custom attributes]($m/CustomAttribute) that are assigned to customer profiles. For more information, see - * [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). - */ - customAttribute?: CustomerCustomAttributeFilters; - /** - * A filter to select resources based on an exact field value. For any given - * value, the value can only be in one property. Depending on the field, either - * all properties can be set or only a subset will be available. - * Refer to the documentation of the field. - */ - segmentIds?: FilterValue; -} - -export const customerFilterSchema: Schema = object({ - creationSource: [ - 'creation_source', - optional(lazy(() => customerCreationSourceFilterSchema)), - ], - createdAt: ['created_at', optional(lazy(() => timeRangeSchema))], - updatedAt: ['updated_at', optional(lazy(() => timeRangeSchema))], - emailAddress: [ - 'email_address', - optional(lazy(() => customerTextFilterSchema)), - ], - phoneNumber: ['phone_number', optional(lazy(() => customerTextFilterSchema))], - referenceId: ['reference_id', optional(lazy(() => customerTextFilterSchema))], - groupIds: ['group_ids', optional(lazy(() => filterValueSchema))], - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customerCustomAttributeFiltersSchema)), - ], - segmentIds: ['segment_ids', optional(lazy(() => filterValueSchema))], -}); diff --git a/src/models/customerGroup.ts b/src/models/customerGroup.ts deleted file mode 100644 index 05e0882a4..000000000 --- a/src/models/customerGroup.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Represents a group of customer profiles. - * Customer groups can be created, be modified, and have their membership defined using - * the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. - */ -export interface CustomerGroup { - /** A unique Square-generated ID for the customer group. */ - id?: string; - /** The name of the customer group. */ - name: string; - /** The timestamp when the customer group was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the customer group was last updated, in RFC 3339 format. */ - updatedAt?: string; -} - -export const customerGroupSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', string()], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/customerPreferences.ts b/src/models/customerPreferences.ts deleted file mode 100644 index 224804647..000000000 --- a/src/models/customerPreferences.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { boolean, nullable, object, optional, Schema } from '../schema'; - -/** Represents communication preferences for the customer profile. */ -export interface CustomerPreferences { - /** Indicates whether the customer has unsubscribed from marketing campaign emails. A value of `true` means that the customer chose to opt out of email marketing from the current Square seller or from all Square sellers. This value is read-only from the Customers API. */ - emailUnsubscribed?: boolean | null; -} - -export const customerPreferencesSchema: Schema = object({ - emailUnsubscribed: ['email_unsubscribed', optional(nullable(boolean()))], -}); diff --git a/src/models/customerQuery.ts b/src/models/customerQuery.ts deleted file mode 100644 index 587a2f3d4..000000000 --- a/src/models/customerQuery.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { CustomerFilter, customerFilterSchema } from './customerFilter'; -import { CustomerSort, customerSortSchema } from './customerSort'; - -/** Represents filtering and sorting criteria for a [SearchCustomers]($e/Customers/SearchCustomers) request. */ -export interface CustomerQuery { - /** - * Represents the filtering criteria in a [search query]($m/CustomerQuery) that defines how to filter - * customer profiles returned in [SearchCustomers]($e/Customers/SearchCustomers) results. - */ - filter?: CustomerFilter; - /** - * Represents the sorting criteria in a [search query]($m/CustomerQuery) that defines how to sort - * customer profiles returned in [SearchCustomers]($e/Customers/SearchCustomers) results. - */ - sort?: CustomerSort; -} - -export const customerQuerySchema: Schema = object({ - filter: ['filter', optional(lazy(() => customerFilterSchema))], - sort: ['sort', optional(lazy(() => customerSortSchema))], -}); diff --git a/src/models/customerSegment.ts b/src/models/customerSegment.ts deleted file mode 100644 index ce9118c62..000000000 --- a/src/models/customerSegment.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Represents a group of customer profiles that match one or more predefined filter criteria. - * Segments (also known as Smart Groups) are defined and created within the Customer Directory in the - * Square Seller Dashboard or Point of Sale. - */ -export interface CustomerSegment { - /** A unique Square-generated ID for the segment. */ - id?: string; - /** The name of the segment. */ - name: string; - /** The timestamp when the segment was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the segment was last updated, in RFC 3339 format. */ - updatedAt?: string; -} - -export const customerSegmentSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', string()], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/customerSort.ts b/src/models/customerSort.ts deleted file mode 100644 index ec3ea712b..000000000 --- a/src/models/customerSort.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Represents the sorting criteria in a [search query]($m/CustomerQuery) that defines how to sort - * customer profiles returned in [SearchCustomers]($e/Customers/SearchCustomers) results. - */ -export interface CustomerSort { - /** Specifies customer attributes as the sort key to customer profiles returned from a search. */ - field?: string; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - order?: string; -} - -export const customerSortSchema: Schema = object({ - field: ['field', optional(string())], - order: ['order', optional(string())], -}); diff --git a/src/models/customerTaxIds.ts b/src/models/customerTaxIds.ts deleted file mode 100644 index b9e91cd20..000000000 --- a/src/models/customerTaxIds.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. - * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). - */ -export interface CustomerTaxIds { - /** The EU VAT identification number for the customer. For example, `IE3426675K`. The ID can contain alphanumeric characters only. */ - euVat?: string | null; -} - -export const customerTaxIdsSchema: Schema = object({ - euVat: ['eu_vat', optional(nullable(string()))], -}); diff --git a/src/models/customerTextFilter.ts b/src/models/customerTextFilter.ts deleted file mode 100644 index f48d50eee..000000000 --- a/src/models/customerTextFilter.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * A filter to select customers based on exact or fuzzy matching of - * customer attributes against a specified query. Depending on the customer attributes, - * the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. - */ -export interface CustomerTextFilter { - /** Use the exact filter to select customers whose attributes match exactly the specified query. */ - exact?: string | null; - /** - * Use the fuzzy filter to select customers whose attributes match the specified query - * in a fuzzy manner. When the fuzzy option is used, search queries are tokenized, and then - * each query token must be matched somewhere in the searched attribute. For single token queries, - * this is effectively the same behavior as a partial match operation. - */ - fuzzy?: string | null; -} - -export const customerTextFilterSchema: Schema = object({ - exact: ['exact', optional(nullable(string()))], - fuzzy: ['fuzzy', optional(nullable(string()))], -}); diff --git a/src/models/dataCollectionOptions.ts b/src/models/dataCollectionOptions.ts deleted file mode 100644 index 4a0482d2a..000000000 --- a/src/models/dataCollectionOptions.ts +++ /dev/null @@ -1,27 +0,0 @@ -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/dateRange.ts b/src/models/dateRange.ts deleted file mode 100644 index af2fdda2d..000000000 --- a/src/models/dateRange.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * A range defined by two dates. Used for filtering a query for Connect v2 - * objects that have date properties. - */ -export interface DateRange { - /** - * A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601 - * extended format for calendar dates. - * The beginning of a date range (inclusive). - */ - startDate?: string | null; - /** - * A string in `YYYY-MM-DD` format, such as `2017-10-31`, per the ISO 8601 - * extended format for calendar dates. - * The end of a date range (inclusive). - */ - endDate?: string | null; -} - -export const dateRangeSchema: Schema = object({ - startDate: ['start_date', optional(nullable(string()))], - endDate: ['end_date', optional(nullable(string()))], -}); diff --git a/src/models/deleteBookingCustomAttributeDefinitionResponse.ts b/src/models/deleteBookingCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 48906885d..000000000 --- a/src/models/deleteBookingCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [DeleteBookingCustomAttributeDefinition]($e/BookingCustomAttributes/DeleteBookingCustomAttributeDefinition) response - * containing error messages when errors occurred during the request. The successful response does not contain any payload. - */ -export interface DeleteBookingCustomAttributeDefinitionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteBookingCustomAttributeDefinitionResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteBookingCustomAttributeResponse.ts b/src/models/deleteBookingCustomAttributeResponse.ts deleted file mode 100644 index 9b6be95f1..000000000 --- a/src/models/deleteBookingCustomAttributeResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [DeleteBookingCustomAttribute]($e/BookingCustomAttributes/DeleteBookingCustomAttribute) response. - * Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. - */ -export interface DeleteBookingCustomAttributeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteBookingCustomAttributeResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteBreakTypeResponse.ts b/src/models/deleteBreakTypeResponse.ts deleted file mode 100644 index 1f987b496..000000000 --- a/src/models/deleteBreakTypeResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * The response to a request to delete a `BreakType`. The response might contain a set - * of `Error` objects if the request resulted in errors. - */ -export interface DeleteBreakTypeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteBreakTypeResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteCatalogObjectResponse.ts b/src/models/deleteCatalogObjectResponse.ts deleted file mode 100644 index 2a98bee34..000000000 --- a/src/models/deleteCatalogObjectResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -export interface DeleteCatalogObjectResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The IDs of all catalog objects deleted by this request. - * Multiple IDs may be returned when associated objects are also deleted, for example - * a catalog item variation will be deleted (and its ID included in this field) - * when its parent catalog item is deleted. - */ - deletedObjectIds?: string[]; - /** - * The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * of this deletion in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. - */ - deletedAt?: string; -} - -export const deleteCatalogObjectResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - deletedObjectIds: ['deleted_object_ids', optional(array(string()))], - deletedAt: ['deleted_at', optional(string())], - } -); diff --git a/src/models/deleteCustomerCardResponse.ts b/src/models/deleteCustomerCardResponse.ts deleted file mode 100644 index 34acdf174..000000000 --- a/src/models/deleteCustomerCardResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the `DeleteCustomerCard` endpoint. - */ -export interface DeleteCustomerCardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteCustomerCardResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteCustomerCustomAttributeDefinitionResponse.ts b/src/models/deleteCustomerCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 0e4e67ccf..000000000 --- a/src/models/deleteCustomerCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a response from a delete request containing error messages if there are any. */ -export interface DeleteCustomerCustomAttributeDefinitionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteCustomerCustomAttributeDefinitionResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteCustomerCustomAttributeResponse.ts b/src/models/deleteCustomerCustomAttributeResponse.ts deleted file mode 100644 index 34c1aeb95..000000000 --- a/src/models/deleteCustomerCustomAttributeResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [DeleteCustomerCustomAttribute]($e/CustomerCustomAttributes/DeleteCustomerCustomAttribute) response. - * Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. - */ -export interface DeleteCustomerCustomAttributeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteCustomerCustomAttributeResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteCustomerGroupResponse.ts b/src/models/deleteCustomerGroupResponse.ts deleted file mode 100644 index bd684932d..000000000 --- a/src/models/deleteCustomerGroupResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [DeleteCustomerGroup]($e/CustomerGroups/DeleteCustomerGroup) endpoint. - */ -export interface DeleteCustomerGroupResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteCustomerGroupResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteCustomerRequest.ts b/src/models/deleteCustomerRequest.ts deleted file mode 100644 index 48f430767..000000000 --- a/src/models/deleteCustomerRequest.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { bigint, object, optional, Schema } from '../schema'; - -/** - * Defines the fields that are included in a request to the `DeleteCustomer` - * endpoint. - */ -export interface DeleteCustomerRequest { - /** - * The current version of the customer profile. - * As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). - */ - version?: bigint; -} - -export const deleteCustomerRequestSchema: Schema = object( - { version: ['version', optional(bigint())] } -); diff --git a/src/models/deleteCustomerResponse.ts b/src/models/deleteCustomerResponse.ts deleted file mode 100644 index 95ac52f27..000000000 --- a/src/models/deleteCustomerResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the `DeleteCustomer` endpoint. - */ -export interface DeleteCustomerResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteCustomerResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteDisputeEvidenceResponse.ts b/src/models/deleteDisputeEvidenceResponse.ts deleted file mode 100644 index 1e7309e26..000000000 --- a/src/models/deleteDisputeEvidenceResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in a `DeleteDisputeEvidence` response. */ -export interface DeleteDisputeEvidenceResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const deleteDisputeEvidenceResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteInvoiceAttachmentResponse.ts b/src/models/deleteInvoiceAttachmentResponse.ts deleted file mode 100644 index cea9b73f6..000000000 --- a/src/models/deleteInvoiceAttachmentResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a [DeleteInvoiceAttachment]($e/Invoices/DeleteInvoiceAttachment) response. */ -export interface DeleteInvoiceAttachmentResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const deleteInvoiceAttachmentResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteInvoiceRequest.ts b/src/models/deleteInvoiceRequest.ts deleted file mode 100644 index 650b01fcd..000000000 --- a/src/models/deleteInvoiceRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { number, object, optional, Schema } from '../schema'; - -/** Describes a `DeleteInvoice` request. */ -export interface DeleteInvoiceRequest { - /** - * The version of the [invoice](entity:Invoice) to delete. - * If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or - * [ListInvoices](api-endpoint:Invoices-ListInvoices). - */ - version?: number; -} - -export const deleteInvoiceRequestSchema: Schema = object({ - version: ['version', optional(number())], -}); diff --git a/src/models/deleteInvoiceResponse.ts b/src/models/deleteInvoiceResponse.ts deleted file mode 100644 index da2139817..000000000 --- a/src/models/deleteInvoiceResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Describes a `DeleteInvoice` response. */ -export interface DeleteInvoiceResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const deleteInvoiceResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteLocationCustomAttributeDefinitionResponse.ts b/src/models/deleteLocationCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 2435c6044..000000000 --- a/src/models/deleteLocationCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a response from a delete request containing error messages if there are any. */ -export interface DeleteLocationCustomAttributeDefinitionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteLocationCustomAttributeDefinitionResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteLocationCustomAttributeResponse.ts b/src/models/deleteLocationCustomAttributeResponse.ts deleted file mode 100644 index 695b6dff6..000000000 --- a/src/models/deleteLocationCustomAttributeResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [DeleteLocationCustomAttribute]($e/LocationCustomAttributes/DeleteLocationCustomAttribute) response. - * Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. - */ -export interface DeleteLocationCustomAttributeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteLocationCustomAttributeResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteLoyaltyRewardResponse.ts b/src/models/deleteLoyaltyRewardResponse.ts deleted file mode 100644 index a069373b1..000000000 --- a/src/models/deleteLoyaltyRewardResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** A response returned by the API call. */ -export interface DeleteLoyaltyRewardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteLoyaltyRewardResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteMerchantCustomAttributeDefinitionResponse.ts b/src/models/deleteMerchantCustomAttributeDefinitionResponse.ts deleted file mode 100644 index df1874d59..000000000 --- a/src/models/deleteMerchantCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a response from a delete request containing error messages if there are any. */ -export interface DeleteMerchantCustomAttributeDefinitionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteMerchantCustomAttributeDefinitionResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteMerchantCustomAttributeResponse.ts b/src/models/deleteMerchantCustomAttributeResponse.ts deleted file mode 100644 index 16e98e2cf..000000000 --- a/src/models/deleteMerchantCustomAttributeResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [DeleteMerchantCustomAttribute]($e/MerchantCustomAttributes/DeleteMerchantCustomAttribute) response. - * Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. - */ -export interface DeleteMerchantCustomAttributeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteMerchantCustomAttributeResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteOrderCustomAttributeDefinitionResponse.ts b/src/models/deleteOrderCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 93d834173..000000000 --- a/src/models/deleteOrderCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a response from deleting an order custom attribute definition. */ -export interface DeleteOrderCustomAttributeDefinitionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteOrderCustomAttributeDefinitionResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteOrderCustomAttributeResponse.ts b/src/models/deleteOrderCustomAttributeResponse.ts deleted file mode 100644 index a15d543fa..000000000 --- a/src/models/deleteOrderCustomAttributeResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a response from deleting an order custom attribute. */ -export interface DeleteOrderCustomAttributeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteOrderCustomAttributeResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deletePaymentLinkResponse.ts b/src/models/deletePaymentLinkResponse.ts deleted file mode 100644 index b503d812d..000000000 --- a/src/models/deletePaymentLinkResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -export interface DeletePaymentLinkResponse { - errors?: Error[]; - /** The ID of the link that is deleted. */ - id?: string; - /** - * The ID of the order that is canceled. When a payment link is deleted, Square updates the - * the `state` (of the order that the checkout link created) to CANCELED. - */ - cancelledOrderId?: string; -} - -export const deletePaymentLinkResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - id: ['id', optional(string())], - cancelledOrderId: ['cancelled_order_id', optional(string())], - } -); diff --git a/src/models/deleteShiftResponse.ts b/src/models/deleteShiftResponse.ts deleted file mode 100644 index 8ef567dd2..000000000 --- a/src/models/deleteShiftResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * The response to a request to delete a `Shift`. The response might contain a set of - * `Error` objects if the request resulted in errors. - */ -export interface DeleteShiftResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteShiftResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/deleteSnippetResponse.ts b/src/models/deleteSnippetResponse.ts deleted file mode 100644 index a0b9bd050..000000000 --- a/src/models/deleteSnippetResponse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** Represents a `DeleteSnippet` response. */ -export interface DeleteSnippetResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const deleteSnippetResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deleteSubscriptionActionResponse.ts b/src/models/deleteSubscriptionActionResponse.ts deleted file mode 100644 index 8cf9ef3c1..000000000 --- a/src/models/deleteSubscriptionActionResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; - -/** - * Defines output parameters in a response of the [DeleteSubscriptionAction]($e/Subscriptions/DeleteSubscriptionAction) - * endpoint. - */ -export interface DeleteSubscriptionActionResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * Represents a subscription purchased by a customer. - * For more information, see - * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). - */ - subscription?: Subscription; -} - -export const deleteSubscriptionActionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - } -); diff --git a/src/models/deleteWebhookSubscriptionResponse.ts b/src/models/deleteWebhookSubscriptionResponse.ts deleted file mode 100644 index 94fb975d5..000000000 --- a/src/models/deleteWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [DeleteWebhookSubscription]($e/WebhookSubscriptions/DeleteWebhookSubscription) endpoint. - */ -export interface DeleteWebhookSubscriptionResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; -} - -export const deleteWebhookSubscriptionResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/deprecatedCreateDisputeEvidenceFileRequest.ts b/src/models/deprecatedCreateDisputeEvidenceFileRequest.ts deleted file mode 100644 index f7d6b84ba..000000000 --- a/src/models/deprecatedCreateDisputeEvidenceFileRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Defines the parameters for a `DeprecatedCreateDisputeEvidenceFile` request. */ -export interface DeprecatedCreateDisputeEvidenceFileRequest { - /** The Unique ID. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; - /** The type of the dispute evidence. */ - evidenceType?: string; - /** - * The MIME type of the uploaded file. - * The type can be image/heic, image/heif, image/jpeg, application/pdf, image/png, or image/tiff. - */ - contentType?: string | null; -} - -export const deprecatedCreateDisputeEvidenceFileRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - evidenceType: ['evidence_type', optional(string())], - contentType: ['content_type', optional(nullable(string()))], - } -); diff --git a/src/models/deprecatedCreateDisputeEvidenceFileResponse.ts b/src/models/deprecatedCreateDisputeEvidenceFileResponse.ts deleted file mode 100644 index a8bbcb465..000000000 --- a/src/models/deprecatedCreateDisputeEvidenceFileResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { DisputeEvidence, disputeEvidenceSchema } from './disputeEvidence'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in a `DeprecatedCreateDisputeEvidenceFile` response. */ -export interface DeprecatedCreateDisputeEvidenceFileResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - evidence?: DisputeEvidence; -} - -export const deprecatedCreateDisputeEvidenceFileResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - evidence: ['evidence', optional(lazy(() => disputeEvidenceSchema))], - } -); diff --git a/src/models/deprecatedCreateDisputeEvidenceTextRequest.ts b/src/models/deprecatedCreateDisputeEvidenceTextRequest.ts deleted file mode 100644 index 94da87b37..000000000 --- a/src/models/deprecatedCreateDisputeEvidenceTextRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Defines the parameters for a `DeprecatedCreateDisputeEvidenceText` request. */ -export interface DeprecatedCreateDisputeEvidenceTextRequest { - /** The Unique ID. For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). */ - idempotencyKey: string; - /** The type of the dispute evidence. */ - evidenceType?: string; - /** The evidence string. */ - evidenceText: string; -} - -export const deprecatedCreateDisputeEvidenceTextRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - evidenceType: ['evidence_type', optional(string())], - evidenceText: ['evidence_text', string()], - } -); diff --git a/src/models/deprecatedCreateDisputeEvidenceTextResponse.ts b/src/models/deprecatedCreateDisputeEvidenceTextResponse.ts deleted file mode 100644 index e0f4d9729..000000000 --- a/src/models/deprecatedCreateDisputeEvidenceTextResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { DisputeEvidence, disputeEvidenceSchema } from './disputeEvidence'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in a `DeprecatedCreateDisputeEvidenceText` response. */ -export interface DeprecatedCreateDisputeEvidenceTextResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - evidence?: DisputeEvidence; -} - -export const deprecatedCreateDisputeEvidenceTextResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - evidence: ['evidence', optional(lazy(() => disputeEvidenceSchema))], - } -); diff --git a/src/models/destination.ts b/src/models/destination.ts deleted file mode 100644 index 3f87743e1..000000000 --- a/src/models/destination.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Information about the destination against which the payout was made. */ -export interface Destination { - /** List of possible destinations against which a payout can be made. */ - type?: string; - /** Square issued unique ID (also known as the instrument ID) associated with this destination. */ - id?: string; -} - -export const destinationSchema: Schema = object({ - type: ['type', optional(string())], - id: ['id', optional(string())], -}); diff --git a/src/models/destinationDetails.ts b/src/models/destinationDetails.ts deleted file mode 100644 index e1f272417..000000000 --- a/src/models/destinationDetails.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - DestinationDetailsCardRefundDetails, - destinationDetailsCardRefundDetailsSchema, -} from './destinationDetailsCardRefundDetails'; -import { - DestinationDetailsCashRefundDetails, - destinationDetailsCashRefundDetailsSchema, -} from './destinationDetailsCashRefundDetails'; -import { - DestinationDetailsExternalRefundDetails, - destinationDetailsExternalRefundDetailsSchema, -} from './destinationDetailsExternalRefundDetails'; - -/** Details about a refund's destination. */ -export interface DestinationDetails { - cardDetails?: DestinationDetailsCardRefundDetails; - /** Stores details about a cash refund. Contains only non-confidential information. */ - cashDetails?: DestinationDetailsCashRefundDetails; - /** Stores details about an external refund. Contains only non-confidential information. */ - externalDetails?: DestinationDetailsExternalRefundDetails; -} - -export const destinationDetailsSchema: Schema = object({ - cardDetails: [ - 'card_details', - optional(lazy(() => destinationDetailsCardRefundDetailsSchema)), - ], - cashDetails: [ - 'cash_details', - optional(lazy(() => destinationDetailsCashRefundDetailsSchema)), - ], - externalDetails: [ - 'external_details', - optional(lazy(() => destinationDetailsExternalRefundDetailsSchema)), - ], -}); diff --git a/src/models/destinationDetailsCardRefundDetails.ts b/src/models/destinationDetailsCardRefundDetails.ts deleted file mode 100644 index ff31e56cd..000000000 --- a/src/models/destinationDetailsCardRefundDetails.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Card, cardSchema } from './card'; - -export interface DestinationDetailsCardRefundDetails { - /** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ - card?: Card; - /** - * The method used to enter the card's details for the refund. The method can be - * `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`. - */ - entryMethod?: string | null; - /** The authorization code provided by the issuer when a refund is approved. */ - authResultCode?: string | null; -} - -export const destinationDetailsCardRefundDetailsSchema: Schema = object( - { - card: ['card', optional(lazy(() => cardSchema))], - entryMethod: ['entry_method', optional(nullable(string()))], - authResultCode: ['auth_result_code', optional(nullable(string()))], - } -); diff --git a/src/models/destinationDetailsCashRefundDetails.ts b/src/models/destinationDetailsCashRefundDetails.ts deleted file mode 100644 index eee1120d2..000000000 --- a/src/models/destinationDetailsCashRefundDetails.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Stores details about a cash refund. Contains only non-confidential information. */ -export interface DestinationDetailsCashRefundDetails { - /** - * 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. - */ - sellerSuppliedMoney: Money; - /** - * 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. - */ - changeBackMoney?: Money; -} - -export const destinationDetailsCashRefundDetailsSchema: Schema = object( - { - sellerSuppliedMoney: ['seller_supplied_money', lazy(() => moneySchema)], - changeBackMoney: ['change_back_money', optional(lazy(() => moneySchema))], - } -); diff --git a/src/models/destinationDetailsExternalRefundDetails.ts b/src/models/destinationDetailsExternalRefundDetails.ts deleted file mode 100644 index 9ab3ccc06..000000000 --- a/src/models/destinationDetailsExternalRefundDetails.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Stores details about an external refund. Contains only non-confidential information. */ -export interface DestinationDetailsExternalRefundDetails { - /** - * The type of external refund the seller paid to the buyer. It can be one of the - * following: - * - CHECK - Refunded using a physical check. - * - BANK_TRANSFER - Refunded using external bank transfer. - * - OTHER\_GIFT\_CARD - Refunded using a non-Square gift card. - * - CRYPTO - Refunded using a crypto currency. - * - SQUARE_CASH - Refunded using Square Cash App. - * - SOCIAL - Refunded using peer-to-peer payment applications. - * - EXTERNAL - A third-party application gathered this refund outside of Square. - * - EMONEY - Refunded using an E-money provider. - * - CARD - A credit or debit card that Square does not support. - * - STORED_BALANCE - Use for house accounts, store credit, and so forth. - * - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals - * - OTHER - A type not listed here. - */ - type: string; - /** - * A description of the external refund source. For example, - * "Food Delivery Service". - */ - source: string; - /** An ID to associate the refund to its originating source. */ - sourceId?: string | null; -} - -export const destinationDetailsExternalRefundDetailsSchema: Schema = object( - { - type: ['type', string()], - source: ['source', string()], - sourceId: ['source_id', optional(nullable(string()))], - } -); diff --git a/src/models/device.ts b/src/models/device.ts deleted file mode 100644 index 13f0cc7b5..000000000 --- a/src/models/device.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Component, componentSchema } from './component'; -import { DeviceAttributes, deviceAttributesSchema } from './deviceAttributes'; -import { DeviceStatus, deviceStatusSchema } from './deviceStatus'; - -export interface Device { - /** - * A synthetic identifier for the device. The identifier includes a standardized prefix and - * is otherwise an opaque id generated from key device fields. - */ - id?: string; - attributes: DeviceAttributes; - /** A list of components applicable to the device. */ - components?: Component[] | null; - status?: DeviceStatus; -} - -export const deviceSchema: Schema = object({ - id: ['id', optional(string())], - attributes: ['attributes', lazy(() => deviceAttributesSchema)], - components: [ - 'components', - optional(nullable(array(lazy(() => componentSchema)))), - ], - status: ['status', optional(lazy(() => deviceStatusSchema))], -}); diff --git a/src/models/deviceAttributes.ts b/src/models/deviceAttributes.ts deleted file mode 100644 index b300832dd..000000000 --- a/src/models/deviceAttributes.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface DeviceAttributes { - /** An enum identifier of the device type. */ - type: string; - /** The maker of the device. */ - manufacturer: string; - /** The specific model of the device. */ - model?: string | null; - /** A seller-specified name for the device. */ - name?: string | null; - /** - * The manufacturer-supplied identifier for the device (where available). In many cases, - * this identifier will be a serial number. - */ - manufacturersId?: string | null; - /** - * The RFC 3339-formatted value of the most recent update to the device information. - * (Could represent any field update on the device.) - */ - updatedAt?: string; - /** The current version of software installed on the device. */ - version?: string; - /** The merchant_token identifying the merchant controlling the device. */ - merchantToken?: string | null; -} - -export const deviceAttributesSchema: Schema = object({ - type: ['type', string()], - manufacturer: ['manufacturer', string()], - model: ['model', optional(nullable(string()))], - name: ['name', optional(nullable(string()))], - manufacturersId: ['manufacturers_id', optional(nullable(string()))], - updatedAt: ['updated_at', optional(string())], - version: ['version', optional(string())], - merchantToken: ['merchant_token', optional(nullable(string()))], -}); diff --git a/src/models/deviceCheckoutOptions.ts b/src/models/deviceCheckoutOptions.ts deleted file mode 100644 index 4e033495b..000000000 --- a/src/models/deviceCheckoutOptions.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { TipSettings, tipSettingsSchema } from './tipSettings'; - -export interface DeviceCheckoutOptions { - /** - * The unique ID of the device intended for this `TerminalCheckout`. - * A list of `DeviceCode` objects can be retrieved from the /v2/devices/codes endpoint. - * Match a `DeviceCode.device_id` value with `device_id` to get the associated device code. - */ - deviceId: string; - /** Instructs the device to skip the receipt screen. Defaults to false. */ - skipReceiptScreen?: boolean | null; - /** Indicates that signature collection is desired during checkout. Defaults to false. */ - collectSignature?: boolean | null; - tipSettings?: TipSettings; - /** - * Show the itemization screen prior to taking a payment. This field is only meaningful when the - * checkout includes an order ID. Defaults to true. - */ - showItemizedCart?: boolean | null; -} - -export const deviceCheckoutOptionsSchema: Schema = object( - { - deviceId: ['device_id', string()], - skipReceiptScreen: ['skip_receipt_screen', optional(nullable(boolean()))], - collectSignature: ['collect_signature', optional(nullable(boolean()))], - tipSettings: ['tip_settings', optional(lazy(() => tipSettingsSchema))], - showItemizedCart: ['show_itemized_cart', optional(nullable(boolean()))], - } -); diff --git a/src/models/deviceCode.ts b/src/models/deviceCode.ts deleted file mode 100644 index dc5af5fbe..000000000 --- a/src/models/deviceCode.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface DeviceCode { - /** The unique id for this device code. */ - id?: string; - /** An optional user-defined name for the device code. */ - name?: string | null; - /** The unique code that can be used to login. */ - code?: string; - /** The unique id of the device that used this code. Populated when the device is paired up. */ - deviceId?: string; - productType: string; - /** The location assigned to this code. */ - locationId?: string | null; - /** DeviceCode.Status enum. */ - status?: string; - /** When this DeviceCode will expire and no longer login. Timestamp in RFC 3339 format. */ - pairBy?: string; - /** When this DeviceCode was created. Timestamp in RFC 3339 format. */ - createdAt?: string; - /** When this DeviceCode's status was last changed. Timestamp in RFC 3339 format. */ - statusChangedAt?: string; - /** When this DeviceCode was paired. Timestamp in RFC 3339 format. */ - pairedAt?: string; -} - -export const deviceCodeSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', optional(nullable(string()))], - code: ['code', optional(string())], - deviceId: ['device_id', optional(string())], - productType: ['product_type', string()], - locationId: ['location_id', optional(nullable(string()))], - status: ['status', optional(string())], - pairBy: ['pair_by', optional(string())], - createdAt: ['created_at', optional(string())], - statusChangedAt: ['status_changed_at', optional(string())], - pairedAt: ['paired_at', optional(string())], -}); diff --git a/src/models/deviceComponentDetailsApplicationDetails.ts b/src/models/deviceComponentDetailsApplicationDetails.ts deleted file mode 100644 index ec1970b20..000000000 --- a/src/models/deviceComponentDetailsApplicationDetails.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface DeviceComponentDetailsApplicationDetails { - applicationType?: string; - /** The version of the application. */ - version?: string; - /** The location_id of the session for the application. */ - sessionLocation?: string | null; - /** The id of the device code that was used to log in to the device. */ - deviceCodeId?: string | null; -} - -export const deviceComponentDetailsApplicationDetailsSchema: Schema = object( - { - applicationType: ['application_type', optional(string())], - version: ['version', optional(string())], - sessionLocation: ['session_location', optional(nullable(string()))], - deviceCodeId: ['device_code_id', optional(nullable(string()))], - } -); diff --git a/src/models/deviceComponentDetailsBatteryDetails.ts b/src/models/deviceComponentDetailsBatteryDetails.ts deleted file mode 100644 index 9825d3b02..000000000 --- a/src/models/deviceComponentDetailsBatteryDetails.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface DeviceComponentDetailsBatteryDetails { - /** The battery charge percentage as displayed on the device. */ - visiblePercent?: number | null; - /** An enum for ExternalPower. */ - externalPower?: string; -} - -export const deviceComponentDetailsBatteryDetailsSchema: Schema = object( - { - visiblePercent: ['visible_percent', optional(nullable(number()))], - externalPower: ['external_power', optional(string())], - } -); diff --git a/src/models/deviceComponentDetailsCardReaderDetails.ts b/src/models/deviceComponentDetailsCardReaderDetails.ts deleted file mode 100644 index a770a851e..000000000 --- a/src/models/deviceComponentDetailsCardReaderDetails.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -export interface DeviceComponentDetailsCardReaderDetails { - /** The version of the card reader. */ - version?: string; -} - -export const deviceComponentDetailsCardReaderDetailsSchema: Schema = object( - { version: ['version', optional(string())] } -); diff --git a/src/models/deviceComponentDetailsEthernetDetails.ts b/src/models/deviceComponentDetailsEthernetDetails.ts deleted file mode 100644 index d2dbc806f..000000000 --- a/src/models/deviceComponentDetailsEthernetDetails.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -export interface DeviceComponentDetailsEthernetDetails { - /** A boolean to represent whether the Ethernet interface is currently active. */ - active?: boolean | null; - /** The string representation of the device’s IPv4 address. */ - ipAddressV4?: string | null; -} - -export const deviceComponentDetailsEthernetDetailsSchema: Schema = object( - { - active: ['active', optional(nullable(boolean()))], - ipAddressV4: ['ip_address_v4', optional(nullable(string()))], - } -); diff --git a/src/models/deviceComponentDetailsMeasurement.ts b/src/models/deviceComponentDetailsMeasurement.ts deleted file mode 100644 index 53d5c03fe..000000000 --- a/src/models/deviceComponentDetailsMeasurement.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, number, object, optional, Schema } from '../schema'; - -/** A value qualified by unit of measure. */ -export interface DeviceComponentDetailsMeasurement { - value?: number | null; -} - -export const deviceComponentDetailsMeasurementSchema: Schema = object( - { value: ['value', optional(nullable(number()))] } -); diff --git a/src/models/deviceComponentDetailsNetworkInterfaceDetails.ts b/src/models/deviceComponentDetailsNetworkInterfaceDetails.ts deleted file mode 100644 index 005ba422d..000000000 --- a/src/models/deviceComponentDetailsNetworkInterfaceDetails.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface DeviceComponentDetailsNetworkInterfaceDetails { - /** The string representation of the device’s IPv4 address. */ - ipAddressV4?: string | null; -} - -export const deviceComponentDetailsNetworkInterfaceDetailsSchema: Schema = object( - { ipAddressV4: ['ip_address_v4', optional(nullable(string()))] } -); diff --git a/src/models/deviceComponentDetailsWiFiDetails.ts b/src/models/deviceComponentDetailsWiFiDetails.ts deleted file mode 100644 index 58999e1cc..000000000 --- a/src/models/deviceComponentDetailsWiFiDetails.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - DeviceComponentDetailsMeasurement, - deviceComponentDetailsMeasurementSchema, -} from './deviceComponentDetailsMeasurement'; - -export interface DeviceComponentDetailsWiFiDetails { - /** A boolean to represent whether the WiFI interface is currently active. */ - active?: boolean | null; - /** The name of the connected WIFI network. */ - ssid?: string | null; - /** The string representation of the device’s IPv4 address. */ - ipAddressV4?: string | null; - /** - * The security protocol for a secure connection (e.g. WPA2). None provided if the connection - * is unsecured. - */ - secureConnection?: string | null; - /** A value qualified by unit of measure. */ - signalStrength?: DeviceComponentDetailsMeasurement; -} - -export const deviceComponentDetailsWiFiDetailsSchema: Schema = object( - { - active: ['active', optional(nullable(boolean()))], - ssid: ['ssid', optional(nullable(string()))], - ipAddressV4: ['ip_address_v4', optional(nullable(string()))], - secureConnection: ['secure_connection', optional(nullable(string()))], - signalStrength: [ - 'signal_strength', - optional(lazy(() => deviceComponentDetailsMeasurementSchema)), - ], - } -); diff --git a/src/models/deviceDetails.ts b/src/models/deviceDetails.ts deleted file mode 100644 index 7a7604737..000000000 --- a/src/models/deviceDetails.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Details about the device that took the payment. */ -export interface DeviceDetails { - /** The Square-issued ID of the device. */ - deviceId?: string | null; - /** The Square-issued installation ID for the device. */ - deviceInstallationId?: string | null; - /** The name of the device set by the seller. */ - deviceName?: string | null; -} - -export const deviceDetailsSchema: Schema = object({ - deviceId: ['device_id', optional(nullable(string()))], - deviceInstallationId: [ - 'device_installation_id', - optional(nullable(string())), - ], - deviceName: ['device_name', optional(nullable(string()))], -}); diff --git a/src/models/deviceMetadata.ts b/src/models/deviceMetadata.ts deleted file mode 100644 index ad3c81429..000000000 --- a/src/models/deviceMetadata.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface DeviceMetadata { - /** The Terminal’s remaining battery percentage, between 1-100. */ - batteryPercentage?: string | null; - /** - * The current charging state of the Terminal. - * Options: `CHARGING`, `NOT_CHARGING` - */ - chargingState?: string | null; - /** The ID of the Square seller business location associated with the Terminal. */ - locationId?: string | null; - /** The ID of the Square merchant account that is currently signed-in to the Terminal. */ - merchantId?: string | null; - /** - * The Terminal’s current network connection type. - * Options: `WIFI`, `ETHERNET` - */ - networkConnectionType?: string | null; - /** The country in which the Terminal is authorized to take payments. */ - paymentRegion?: string | null; - /** - * The unique identifier assigned to the Terminal, which can be found on the lower back - * of the device. - */ - serialNumber?: string | null; - /** The current version of the Terminal’s operating system. */ - osVersion?: string | null; - /** The current version of the application running on the Terminal. */ - appVersion?: string | null; - /** The name of the Wi-Fi network to which the Terminal is connected. */ - wifiNetworkName?: string | null; - /** - * The signal strength of the Wi-FI network connection. - * Options: `POOR`, `FAIR`, `GOOD`, `EXCELLENT` - */ - wifiNetworkStrength?: string | null; - /** The IP address of the Terminal. */ - ipAddress?: string | null; -} - -export const deviceMetadataSchema: Schema = object({ - batteryPercentage: ['battery_percentage', optional(nullable(string()))], - chargingState: ['charging_state', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - merchantId: ['merchant_id', optional(nullable(string()))], - networkConnectionType: [ - 'network_connection_type', - optional(nullable(string())), - ], - paymentRegion: ['payment_region', optional(nullable(string()))], - serialNumber: ['serial_number', optional(nullable(string()))], - osVersion: ['os_version', optional(nullable(string()))], - appVersion: ['app_version', optional(nullable(string()))], - wifiNetworkName: ['wifi_network_name', optional(nullable(string()))], - wifiNetworkStrength: ['wifi_network_strength', optional(nullable(string()))], - ipAddress: ['ip_address', optional(nullable(string()))], -}); diff --git a/src/models/deviceStatus.ts b/src/models/deviceStatus.ts deleted file mode 100644 index 4933c559f..000000000 --- a/src/models/deviceStatus.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -export interface DeviceStatus { - category?: string; -} - -export const deviceStatusSchema: Schema = object({ - category: ['category', optional(string())], -}); diff --git a/src/models/digitalWalletDetails.ts b/src/models/digitalWalletDetails.ts deleted file mode 100644 index 0cea6ee8d..000000000 --- a/src/models/digitalWalletDetails.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CashAppDetails, cashAppDetailsSchema } from './cashAppDetails'; - -/** Additional details about `WALLET` type payments. Contains only non-confidential information. */ -export interface DigitalWalletDetails { - /** - * The status of the `WALLET` payment. The status can be `AUTHORIZED`, `CAPTURED`, `VOIDED`, or - * `FAILED`. - */ - status?: string | null; - /** - * The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`, - * `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY` or `UNKNOWN`. - */ - brand?: string | null; - /** Additional details about `WALLET` type payments with the `brand` of `CASH_APP`. */ - cashAppDetails?: CashAppDetails; -} - -export const digitalWalletDetailsSchema: Schema = object({ - status: ['status', optional(nullable(string()))], - brand: ['brand', optional(nullable(string()))], - cashAppDetails: [ - 'cash_app_details', - optional(lazy(() => cashAppDetailsSchema)), - ], -}); diff --git a/src/models/disableCardResponse.ts b/src/models/disableCardResponse.ts deleted file mode 100644 index 7b8445272..000000000 --- a/src/models/disableCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Card, cardSchema } from './card'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [DisableCard]($e/Cards/DisableCard) endpoint. - * Note: if there are errors processing the request, the card field will not be - * present. - */ -export interface DisableCardResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ - card?: Card; -} - -export const disableCardResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - card: ['card', optional(lazy(() => cardSchema))], -}); diff --git a/src/models/disableEventsResponse.ts b/src/models/disableEventsResponse.ts deleted file mode 100644 index 66893236f..000000000 --- a/src/models/disableEventsResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [DisableEvents]($e/Events/DisableEvents) endpoint. - * Note: if there are errors processing the request, the events field will not be - * present. - */ -export interface DisableEventsResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; -} - -export const disableEventsResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/dismissTerminalActionResponse.ts b/src/models/dismissTerminalActionResponse.ts deleted file mode 100644 index 6f77cba72..000000000 --- a/src/models/dismissTerminalActionResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -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/dismissTerminalCheckoutResponse.ts b/src/models/dismissTerminalCheckoutResponse.ts deleted file mode 100644 index afaee05b1..000000000 --- a/src/models/dismissTerminalCheckoutResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalCheckout, terminalCheckoutSchema } from './terminalCheckout'; - -export interface DismissTerminalCheckoutResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** Represents a checkout processed by the Square Terminal. */ - checkout?: TerminalCheckout; -} - -export const dismissTerminalCheckoutResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - checkout: ['checkout', optional(lazy(() => terminalCheckoutSchema))], - } -); diff --git a/src/models/dismissTerminalRefundResponse.ts b/src/models/dismissTerminalRefundResponse.ts deleted file mode 100644 index 3557c9993..000000000 --- a/src/models/dismissTerminalRefundResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalRefund, terminalRefundSchema } from './terminalRefund'; - -export interface DismissTerminalRefundResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. */ - refund?: TerminalRefund; -} - -export const dismissTerminalRefundResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refund: ['refund', optional(lazy(() => terminalRefundSchema))], - } -); diff --git a/src/models/dispute.ts b/src/models/dispute.ts deleted file mode 100644 index 799ce7699..000000000 --- a/src/models/dispute.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { DisputedPayment, disputedPaymentSchema } from './disputedPayment'; -import { Money, moneySchema } from './money'; - -/** Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. */ -export interface Dispute { - /** The unique ID for this `Dispute`, generated by Square. */ - disputeId?: string | null; - /** The unique ID for this `Dispute`, generated by Square. */ - id?: string; - /** - * 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. - */ - amountMoney?: Money; - /** - * The list of possible reasons why a cardholder might initiate a - * dispute with their bank. - */ - reason?: string; - /** The list of possible dispute states. */ - state?: string; - /** The deadline by which the seller must respond to the dispute, in [RFC 3339 format](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates). */ - dueAt?: string | null; - /** The payment the cardholder disputed. */ - disputedPayment?: DisputedPayment; - /** The IDs of the evidence associated with the dispute. */ - evidenceIds?: string[] | null; - /** Indicates a card's brand, such as `VISA` or `MASTERCARD`. */ - cardBrand?: string; - /** The timestamp when the dispute was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the dispute was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** The ID of the dispute in the card brand system, generated by the card brand. */ - brandDisputeId?: string | null; - /** The timestamp when the dispute was reported, in RFC 3339 format. */ - reportedDate?: string | null; - /** The timestamp when the dispute was reported, in RFC 3339 format. */ - reportedAt?: string | null; - /** The current version of the `Dispute`. */ - version?: number; - /** The ID of the location where the dispute originated. */ - locationId?: string | null; -} - -export const disputeSchema: Schema = object({ - disputeId: ['dispute_id', optional(nullable(string()))], - id: ['id', optional(string())], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - reason: ['reason', optional(string())], - state: ['state', optional(string())], - dueAt: ['due_at', optional(nullable(string()))], - disputedPayment: [ - 'disputed_payment', - optional(lazy(() => disputedPaymentSchema)), - ], - evidenceIds: ['evidence_ids', optional(nullable(array(string())))], - cardBrand: ['card_brand', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - brandDisputeId: ['brand_dispute_id', optional(nullable(string()))], - reportedDate: ['reported_date', optional(nullable(string()))], - reportedAt: ['reported_at', optional(nullable(string()))], - version: ['version', optional(number())], - locationId: ['location_id', optional(nullable(string()))], -}); diff --git a/src/models/disputeEvidence.ts b/src/models/disputeEvidence.ts deleted file mode 100644 index ad92914ac..000000000 --- a/src/models/disputeEvidence.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - DisputeEvidenceFile, - disputeEvidenceFileSchema, -} from './disputeEvidenceFile'; - -export interface DisputeEvidence { - /** The Square-generated ID of the evidence. */ - evidenceId?: string | null; - /** The Square-generated ID of the evidence. */ - id?: string; - /** The ID of the dispute the evidence is associated with. */ - disputeId?: string | null; - /** A file to be uploaded as dispute evidence. */ - evidenceFile?: DisputeEvidenceFile; - /** Raw text */ - evidenceText?: string | null; - /** The time when the evidence was uploaded, in RFC 3339 format. */ - uploadedAt?: string | null; - /** The type of the dispute evidence. */ - evidenceType?: string; -} - -export const disputeEvidenceSchema: Schema = object({ - evidenceId: ['evidence_id', optional(nullable(string()))], - id: ['id', optional(string())], - disputeId: ['dispute_id', optional(nullable(string()))], - evidenceFile: [ - 'evidence_file', - optional(lazy(() => disputeEvidenceFileSchema)), - ], - evidenceText: ['evidence_text', optional(nullable(string()))], - uploadedAt: ['uploaded_at', optional(nullable(string()))], - evidenceType: ['evidence_type', optional(string())], -}); diff --git a/src/models/disputeEvidenceFile.ts b/src/models/disputeEvidenceFile.ts deleted file mode 100644 index eff768ee1..000000000 --- a/src/models/disputeEvidenceFile.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** A file to be uploaded as dispute evidence. */ -export interface DisputeEvidenceFile { - /** The file name including the file extension. For example: "receipt.tiff". */ - filename?: string | null; - /** Dispute evidence files must be application/pdf, image/heic, image/heif, image/jpeg, image/png, or image/tiff formats. */ - filetype?: string | null; -} - -export const disputeEvidenceFileSchema: Schema = object({ - filename: ['filename', optional(nullable(string()))], - filetype: ['filetype', optional(nullable(string()))], -}); diff --git a/src/models/disputedPayment.ts b/src/models/disputedPayment.ts deleted file mode 100644 index 3546cad99..000000000 --- a/src/models/disputedPayment.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** The payment the cardholder disputed. */ -export interface DisputedPayment { - /** Square-generated unique ID of the payment being disputed. */ - paymentId?: string | null; -} - -export const disputedPaymentSchema: Schema = object({ - paymentId: ['payment_id', optional(nullable(string()))], -}); diff --git a/src/models/employee.ts b/src/models/employee.ts deleted file mode 100644 index 791e783ba..000000000 --- a/src/models/employee.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { - array, - boolean, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * An employee object that is used by the external API. - * DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember). - */ -export interface Employee { - /** UUID for this object. */ - id?: string; - /** The employee's first name. */ - firstName?: string | null; - /** The employee's last name. */ - lastName?: string | null; - /** The employee's email address */ - email?: string | null; - /** The employee's phone number in E.164 format, i.e. "+12125554250" */ - phoneNumber?: string | null; - /** A list of location IDs where this employee has access to. */ - locationIds?: string[] | null; - /** - * The status of the Employee being retrieved. - * DEPRECATED at version 2020-08-26. Replaced by [TeamMemberStatus](entity:TeamMemberStatus). - */ - status?: string; - /** - * Whether this employee is the owner of the merchant. Each merchant - * has one owner employee, and that employee has full authority over - * the account. - */ - isOwner?: boolean | null; - /** A read-only timestamp in RFC 3339 format. */ - createdAt?: string; - /** A read-only timestamp in RFC 3339 format. */ - updatedAt?: string; -} - -export const employeeSchema: Schema = object({ - id: ['id', optional(string())], - firstName: ['first_name', optional(nullable(string()))], - lastName: ['last_name', optional(nullable(string()))], - email: ['email', optional(nullable(string()))], - phoneNumber: ['phone_number', optional(nullable(string()))], - locationIds: ['location_ids', optional(nullable(array(string())))], - status: ['status', optional(string())], - isOwner: ['is_owner', optional(nullable(boolean()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/employeeWage.ts b/src/models/employeeWage.ts deleted file mode 100644 index f909aaf5c..000000000 --- a/src/models/employeeWage.ts +++ /dev/null @@ -1,28 +0,0 @@ -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](entity:TeamMemberWage). */ -export interface EmployeeWage { - /** The UUID for this object. */ - id?: string; - /** The `Employee` that this wage is assigned to. */ - employeeId?: string | null; - /** The job title that this wage relates to. */ - title?: 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. - */ - hourlyRate?: Money; -} - -export const employeeWageSchema: Schema = object({ - id: ['id', optional(string())], - employeeId: ['employee_id', optional(nullable(string()))], - title: ['title', optional(nullable(string()))], - hourlyRate: ['hourly_rate', optional(lazy(() => moneySchema))], -}); diff --git a/src/models/enableEventsResponse.ts b/src/models/enableEventsResponse.ts deleted file mode 100644 index 782d3ad4f..000000000 --- a/src/models/enableEventsResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [EnableEvents]($e/Events/EnableEvents) endpoint. - * Note: if there are errors processing the request, the events field will not be - * present. - */ -export interface EnableEventsResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; -} - -export const enableEventsResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/error.ts b/src/models/error.ts deleted file mode 100644 index 8efccdfce..000000000 --- a/src/models/error.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * 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. - */ -export interface Error { - /** - * Indicates which high-level category of error has occurred during a - * request to the Connect API. - */ - category: string; - /** - * Indicates the specific error that occurred during a request to a - * Square API. - */ - code: string; - /** A human-readable description of the error for debugging purposes. */ - detail?: string; - /** - * The name of the field provided in the original request (if any) that - * the error pertains to. - */ - field?: string; -} - -export const errorSchema: Schema = object({ - category: ['category', string()], - code: ['code', string()], - detail: ['detail', optional(string())], - field: ['field', optional(string())], -}); diff --git a/src/models/event.ts b/src/models/event.ts deleted file mode 100644 index 03657e605..000000000 --- a/src/models/event.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { EventData, eventDataSchema } from './eventData'; - -export interface Event { - /** The ID of the target merchant associated with the event. */ - merchantId?: string | null; - /** The ID of the target location associated with the event. */ - locationId?: string | null; - /** The type of event this represents. */ - type?: string | null; - /** A unique ID for the event. */ - eventId?: string | null; - /** Timestamp of when the event was created, in RFC 3339 format. */ - createdAt?: string; - data?: EventData; -} - -export const eventSchema: Schema = object({ - merchantId: ['merchant_id', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - type: ['type', optional(nullable(string()))], - eventId: ['event_id', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - data: ['data', optional(lazy(() => eventDataSchema))], -}); diff --git a/src/models/eventData.ts b/src/models/eventData.ts deleted file mode 100644 index 50b772b13..000000000 --- a/src/models/eventData.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { - boolean, - dict, - nullable, - object, - optional, - Schema, - string, - unknown, -} from '../schema'; - -export interface EventData { - /** The name of the affected object’s type. */ - type?: string | null; - /** The ID of the affected object. */ - id?: string; - /** This is true if the affected object has been deleted; otherwise, it's absent. */ - deleted?: boolean | null; - /** An object containing fields and values relevant to the event. It is absent if the affected object has been deleted. */ - object?: Record | null; -} - -export const eventDataSchema: Schema = object({ - type: ['type', optional(nullable(string()))], - id: ['id', optional(string())], - deleted: ['deleted', optional(nullable(boolean()))], - object: ['object', optional(nullable(dict(unknown())))], -}); diff --git a/src/models/eventMetadata.ts b/src/models/eventMetadata.ts deleted file mode 100644 index e1d2beb03..000000000 --- a/src/models/eventMetadata.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Contains metadata about a particular [Event]($m/Event). */ -export interface EventMetadata { - /** A unique ID for the event. */ - eventId?: string | null; - /** The API version of the event. This corresponds to the default API version of the developer application at the time when the event was created. */ - apiVersion?: string | null; -} - -export const eventMetadataSchema: Schema = object({ - eventId: ['event_id', optional(nullable(string()))], - apiVersion: ['api_version', optional(nullable(string()))], -}); diff --git a/src/models/eventTypeMetadata.ts b/src/models/eventTypeMetadata.ts deleted file mode 100644 index 666c4e987..000000000 --- a/src/models/eventTypeMetadata.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Contains the metadata of a webhook event type. */ -export interface EventTypeMetadata { - /** The event type. */ - eventType?: string; - /** The API version at which the event type was introduced. */ - apiVersionIntroduced?: string; - /** The release status of the event type. */ - releaseStatus?: string; -} - -export const eventTypeMetadataSchema: Schema = object({ - eventType: ['event_type', optional(string())], - apiVersionIntroduced: ['api_version_introduced', optional(string())], - releaseStatus: ['release_status', optional(string())], -}); diff --git a/src/models/externalPaymentDetails.ts b/src/models/externalPaymentDetails.ts deleted file mode 100644 index 14a302bac..000000000 --- a/src/models/externalPaymentDetails.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Stores details about an external payment. Contains only non-confidential information. - * For more information, see - * [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). - */ -export interface ExternalPaymentDetails { - /** - * The type of external payment the seller received. It can be one of the following: - * - CHECK - Paid using a physical check. - * - BANK_TRANSFER - Paid using external bank transfer. - * - OTHER\_GIFT\_CARD - Paid using a non-Square gift card. - * - CRYPTO - Paid using a crypto currency. - * - SQUARE_CASH - Paid using Square Cash App. - * - SOCIAL - Paid using peer-to-peer payment applications. - * - EXTERNAL - A third-party application gathered this payment outside of Square. - * - EMONEY - Paid using an E-money provider. - * - CARD - A credit or debit card that Square does not support. - * - STORED_BALANCE - Use for house accounts, store credit, and so forth. - * - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals - * - OTHER - A type not listed here. - */ - type: string; - /** - * A description of the external payment source. For example, - * "Food Delivery Service". - */ - source: string; - /** An ID to associate the payment to its originating source. */ - sourceId?: 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. - */ - sourceFeeMoney?: Money; -} - -export const externalPaymentDetailsSchema: Schema = object( - { - type: ['type', string()], - source: ['source', string()], - sourceId: ['source_id', optional(nullable(string()))], - sourceFeeMoney: ['source_fee_money', optional(lazy(() => moneySchema))], - } -); diff --git a/src/models/filterValue.ts b/src/models/filterValue.ts deleted file mode 100644 index d2fac7a46..000000000 --- a/src/models/filterValue.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** - * A filter to select resources based on an exact field value. For any given - * value, the value can only be in one property. Depending on the field, either - * all properties can be set or only a subset will be available. - * Refer to the documentation of the field. - */ -export interface FilterValue { - /** A list of terms that must be present on the field of the resource. */ - all?: string[] | null; - /** - * A list of terms where at least one of them must be present on the - * field of the resource. - */ - any?: string[] | null; - /** A list of terms that must not be present on the field the resource */ - none?: string[] | null; -} - -export const filterValueSchema: Schema = object({ - all: ['all', optional(nullable(array(string())))], - any: ['any', optional(nullable(array(string())))], - none: ['none', optional(nullable(array(string())))], -}); diff --git a/src/models/floatNumberRange.ts b/src/models/floatNumberRange.ts deleted file mode 100644 index 1f8626511..000000000 --- a/src/models/floatNumberRange.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Specifies a decimal number range. */ -export interface FloatNumberRange { - /** A decimal value indicating where the range starts. */ - startAt?: string | null; - /** A decimal value indicating where the range ends. */ - endAt?: string | null; -} - -export const floatNumberRangeSchema: Schema = object({ - startAt: ['start_at', optional(nullable(string()))], - endAt: ['end_at', optional(nullable(string()))], -}); diff --git a/src/models/fulfillment.ts b/src/models/fulfillment.ts deleted file mode 100644 index ad9d4a5b1..000000000 --- a/src/models/fulfillment.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { - array, - dict, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - FulfillmentDeliveryDetails, - fulfillmentDeliveryDetailsSchema, -} from './fulfillmentDeliveryDetails'; -import { - FulfillmentFulfillmentEntry, - fulfillmentFulfillmentEntrySchema, -} from './fulfillmentFulfillmentEntry'; -import { - FulfillmentPickupDetails, - fulfillmentPickupDetailsSchema, -} from './fulfillmentPickupDetails'; -import { - FulfillmentShipmentDetails, - fulfillmentShipmentDetailsSchema, -} from './fulfillmentShipmentDetails'; - -/** - * Contains details about how to fulfill this order. - * Orders can only be created with at most one fulfillment using the API. - * However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. - */ -export interface Fulfillment { - /** A unique ID that identifies the fulfillment only within this order. */ - uid?: string | null; - /** The type of fulfillment. */ - type?: string; - /** The current state of this fulfillment. */ - state?: string; - /** - * The `line_item_application` describes what order line items this fulfillment applies - * to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. - */ - lineItemApplication?: string; - /** - * A list of entries pertaining to the fulfillment of an order. Each entry must reference - * a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to - * fulfill. - * Multiple entries can reference the same line item `uid`, as long as the total quantity among - * all fulfillment entries referencing a single line item does not exceed the quantity of the - * order's line item itself. - * An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`, - * `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently - * before order completion. - */ - entries?: FulfillmentFulfillmentEntry[]; - /** - * Application-defined data attached to this fulfillment. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; - /** Contains details necessary to fulfill a pickup order. */ - pickupDetails?: FulfillmentPickupDetails; - /** Contains the details necessary to fulfill a shipment order. */ - shipmentDetails?: FulfillmentShipmentDetails; - /** Describes delivery details of an order fulfillment. */ - deliveryDetails?: FulfillmentDeliveryDetails; -} - -export const fulfillmentSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - type: ['type', optional(string())], - state: ['state', optional(string())], - lineItemApplication: ['line_item_application', optional(string())], - entries: [ - 'entries', - optional(array(lazy(() => fulfillmentFulfillmentEntrySchema))), - ], - metadata: ['metadata', optional(nullable(dict(string())))], - pickupDetails: [ - 'pickup_details', - optional(lazy(() => fulfillmentPickupDetailsSchema)), - ], - shipmentDetails: [ - 'shipment_details', - optional(lazy(() => fulfillmentShipmentDetailsSchema)), - ], - deliveryDetails: [ - 'delivery_details', - optional(lazy(() => fulfillmentDeliveryDetailsSchema)), - ], -}); diff --git a/src/models/fulfillmentDeliveryDetails.ts b/src/models/fulfillmentDeliveryDetails.ts deleted file mode 100644 index 3c735f3e0..000000000 --- a/src/models/fulfillmentDeliveryDetails.ts +++ /dev/null @@ -1,173 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - FulfillmentRecipient, - fulfillmentRecipientSchema, -} from './fulfillmentRecipient'; - -/** Describes delivery details of an order fulfillment. */ -export interface FulfillmentDeliveryDetails { - /** Information about the fulfillment recipient. */ - recipient?: FulfillmentRecipient; - /** The schedule type of the delivery fulfillment. */ - scheduleType?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was placed. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - * Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". - */ - placedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * that represents the start of the delivery period. - * When the fulfillment `schedule_type` is `ASAP`, the field is automatically - * set to the current time plus the `prep_time_duration`. - * Otherwise, the application can set this field while the fulfillment `state` is - * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the - * terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). - * The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - deliverAt?: string | null; - /** - * The duration of time it takes to prepare and deliver this fulfillment. - * The duration must be in RFC 3339 format (for example, "P1W3D"). - */ - prepTimeDuration?: string | null; - /** - * The time period after `deliver_at` in which to deliver the order. - * Applications can set this field when the fulfillment `state` is - * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state - * such as `COMPLETED`, `CANCELED`, and `FAILED`). - * The duration must be in RFC 3339 format (for example, "P1W3D"). - */ - deliveryWindowDuration?: string | null; - /** - * Provides additional instructions about the delivery fulfillment. - * It is displayed in the Square Point of Sale application and set by the API. - */ - note?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicates when the seller completed the fulfillment. - * This field is automatically set when fulfillment `state` changes to `COMPLETED`. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - completedAt?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicates when the seller started processing the fulfillment. - * This field is automatically set when the fulfillment `state` changes to `RESERVED`. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - inProgressAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was rejected. This field is - * automatically set when the fulfillment `state` changes to `FAILED`. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - rejectedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the seller marked the fulfillment as ready for - * courier pickup. This field is automatically set when the fulfillment `state` changes - * to PREPARED. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - readyAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was delivered to the recipient. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - deliveredAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was canceled. This field is automatically - * set when the fulfillment `state` changes to `CANCELED`. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - canceledAt?: string; - /** The delivery cancellation reason. Max length: 100 characters. */ - cancelReason?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when an order can be picked up by the courier for delivery. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - courierPickupAt?: string | null; - /** - * The time period after `courier_pickup_at` in which the courier should pick up the order. - * The duration must be in RFC 3339 format (for example, "P1W3D"). - */ - courierPickupWindowDuration?: string | null; - /** Whether the delivery is preferred to be no contact. */ - isNoContactDelivery?: boolean | null; - /** A note to provide additional instructions about how to deliver the order. */ - dropoffNotes?: string | null; - /** The name of the courier provider. */ - courierProviderName?: string | null; - /** The support phone number of the courier. */ - courierSupportPhoneNumber?: string | null; - /** The identifier for the delivery created by Square. */ - squareDeliveryId?: string | null; - /** The identifier for the delivery created by the third-party courier service. */ - externalDeliveryId?: string | null; - /** - * The flag to indicate the delivery is managed by a third party (ie DoorDash), which means - * we may not receive all recipient information for PII purposes. - */ - managedDelivery?: boolean | null; -} - -export const fulfillmentDeliveryDetailsSchema: Schema = object( - { - recipient: ['recipient', optional(lazy(() => fulfillmentRecipientSchema))], - scheduleType: ['schedule_type', optional(string())], - placedAt: ['placed_at', optional(string())], - deliverAt: ['deliver_at', optional(nullable(string()))], - prepTimeDuration: ['prep_time_duration', optional(nullable(string()))], - deliveryWindowDuration: [ - 'delivery_window_duration', - optional(nullable(string())), - ], - note: ['note', optional(nullable(string()))], - completedAt: ['completed_at', optional(nullable(string()))], - inProgressAt: ['in_progress_at', optional(string())], - rejectedAt: ['rejected_at', optional(string())], - readyAt: ['ready_at', optional(string())], - deliveredAt: ['delivered_at', optional(string())], - canceledAt: ['canceled_at', optional(string())], - cancelReason: ['cancel_reason', optional(nullable(string()))], - courierPickupAt: ['courier_pickup_at', optional(nullable(string()))], - courierPickupWindowDuration: [ - 'courier_pickup_window_duration', - optional(nullable(string())), - ], - isNoContactDelivery: [ - 'is_no_contact_delivery', - optional(nullable(boolean())), - ], - dropoffNotes: ['dropoff_notes', optional(nullable(string()))], - courierProviderName: [ - 'courier_provider_name', - optional(nullable(string())), - ], - courierSupportPhoneNumber: [ - 'courier_support_phone_number', - optional(nullable(string())), - ], - squareDeliveryId: ['square_delivery_id', optional(nullable(string()))], - externalDeliveryId: ['external_delivery_id', optional(nullable(string()))], - managedDelivery: ['managed_delivery', optional(nullable(boolean()))], - } -); diff --git a/src/models/fulfillmentFulfillmentEntry.ts b/src/models/fulfillmentFulfillmentEntry.ts deleted file mode 100644 index 9aa45b9ce..000000000 --- a/src/models/fulfillmentFulfillmentEntry.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { dict, nullable, object, optional, Schema, string } from '../schema'; - -/** - * Links an order line item to a fulfillment. Each entry must reference - * a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to - * fulfill. - */ -export interface FulfillmentFulfillmentEntry { - /** A unique ID that identifies the fulfillment entry only within this order. */ - uid?: string | null; - /** The `uid` from the order line item. */ - lineItemUid: string; - /** - * The quantity of the line item being fulfilled, formatted as a decimal number. - * For example, `"3"`. - * Fulfillments for line items with a `quantity_unit` can have non-integer quantities. - * For example, `"1.70000"`. - */ - quantity: string; - /** - * Application-defined data attached to this fulfillment entry. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; -} - -export const fulfillmentFulfillmentEntrySchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - lineItemUid: ['line_item_uid', string()], - quantity: ['quantity', string()], - metadata: ['metadata', optional(nullable(dict(string())))], - } -); diff --git a/src/models/fulfillmentPickupDetails.ts b/src/models/fulfillmentPickupDetails.ts deleted file mode 100644 index 7657ad4c9..000000000 --- a/src/models/fulfillmentPickupDetails.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - FulfillmentPickupDetailsCurbsidePickupDetails, - fulfillmentPickupDetailsCurbsidePickupDetailsSchema, -} from './fulfillmentPickupDetailsCurbsidePickupDetails'; -import { - FulfillmentRecipient, - fulfillmentRecipientSchema, -} from './fulfillmentRecipient'; - -/** Contains details necessary to fulfill a pickup order. */ -export interface FulfillmentPickupDetails { - /** Information about the fulfillment recipient. */ - recipient?: FulfillmentRecipient; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be - * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set - * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order - * are automatically completed. - */ - expiresAt?: string | null; - /** - * The duration of time after which an in progress pickup fulfillment is automatically moved - * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). - * If not set, this pickup fulfillment remains in progress until it is canceled or completed. - */ - autoCompleteDuration?: string | null; - /** The schedule type of the pickup fulfillment. */ - scheduleType?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., - * "2016-09-04T23:59:33.123Z". - * For fulfillments with the schedule type `ASAP`, this is automatically set - * to the current time plus the expected duration to prepare the fulfillment. - */ - pickupAt?: string | null; - /** - * The window of time in which the order should be picked up after the `pickup_at` timestamp. - * Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an - * informational guideline for merchants. - */ - pickupWindowDuration?: string | null; - /** - * The duration of time it takes to prepare this fulfillment. - * The duration must be in RFC 3339 format (for example, "P1W3D"). - */ - prepTimeDuration?: string | null; - /** - * A note to provide additional instructions about the pickup - * fulfillment displayed in the Square Point of Sale application and set by the API. - */ - note?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - placedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - acceptedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - rejectedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - readyAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment expired. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - expiredAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - pickedUpAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - canceledAt?: string; - /** A description of why the pickup was canceled. The maximum length: 100 characters. */ - cancelReason?: string | null; - /** If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. */ - isCurbsidePickup?: boolean | null; - /** Specific details for curbside pickup. */ - curbsidePickupDetails?: FulfillmentPickupDetailsCurbsidePickupDetails; -} - -export const fulfillmentPickupDetailsSchema: Schema = object( - { - recipient: ['recipient', optional(lazy(() => fulfillmentRecipientSchema))], - expiresAt: ['expires_at', optional(nullable(string()))], - autoCompleteDuration: [ - 'auto_complete_duration', - optional(nullable(string())), - ], - scheduleType: ['schedule_type', optional(string())], - pickupAt: ['pickup_at', optional(nullable(string()))], - pickupWindowDuration: [ - 'pickup_window_duration', - optional(nullable(string())), - ], - prepTimeDuration: ['prep_time_duration', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - placedAt: ['placed_at', optional(string())], - acceptedAt: ['accepted_at', optional(string())], - rejectedAt: ['rejected_at', optional(string())], - readyAt: ['ready_at', optional(string())], - expiredAt: ['expired_at', optional(string())], - pickedUpAt: ['picked_up_at', optional(string())], - canceledAt: ['canceled_at', optional(string())], - cancelReason: ['cancel_reason', optional(nullable(string()))], - isCurbsidePickup: ['is_curbside_pickup', optional(nullable(boolean()))], - curbsidePickupDetails: [ - 'curbside_pickup_details', - optional(lazy(() => fulfillmentPickupDetailsCurbsidePickupDetailsSchema)), - ], - } -); diff --git a/src/models/fulfillmentPickupDetailsCurbsidePickupDetails.ts b/src/models/fulfillmentPickupDetailsCurbsidePickupDetails.ts deleted file mode 100644 index c4f075ac9..000000000 --- a/src/models/fulfillmentPickupDetailsCurbsidePickupDetails.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Specific details for curbside pickup. */ -export interface FulfillmentPickupDetailsCurbsidePickupDetails { - /** Specific details for curbside pickup, such as parking number and vehicle model. */ - curbsideDetails?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - buyerArrivedAt?: string | null; -} - -export const fulfillmentPickupDetailsCurbsidePickupDetailsSchema: Schema = object( - { - curbsideDetails: ['curbside_details', optional(nullable(string()))], - buyerArrivedAt: ['buyer_arrived_at', optional(nullable(string()))], - } -); diff --git a/src/models/fulfillmentRecipient.ts b/src/models/fulfillmentRecipient.ts deleted file mode 100644 index fc727927b..000000000 --- a/src/models/fulfillmentRecipient.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Address, addressSchema } from './address'; - -/** Information about the fulfillment recipient. */ -export interface FulfillmentRecipient { - /** - * The ID of the customer associated with the fulfillment. - * If `customer_id` is provided, the fulfillment recipient's `display_name`, - * `email_address`, and `phone_number` are automatically populated from the - * targeted customer profile. If these fields are set in the request, the request - * values override the information from the customer profile. If the - * targeted customer profile does not contain the necessary information and - * these fields are left unset, the request results in an error. - */ - customerId?: string | null; - /** - * The display name of the fulfillment recipient. This field is required. - * If provided, the display name overrides the corresponding customer profile value - * indicated by `customer_id`. - */ - displayName?: string | null; - /** - * The email address of the fulfillment recipient. - * If provided, the email address overrides the corresponding customer profile value - * indicated by `customer_id`. - */ - emailAddress?: string | null; - /** - * The phone number of the fulfillment recipient. This field is required. - * If provided, the phone number overrides the corresponding customer profile value - * indicated by `customer_id`. - */ - phoneNumber?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; -} - -export const fulfillmentRecipientSchema: Schema = object({ - customerId: ['customer_id', optional(nullable(string()))], - displayName: ['display_name', optional(nullable(string()))], - emailAddress: ['email_address', optional(nullable(string()))], - phoneNumber: ['phone_number', optional(nullable(string()))], - address: ['address', optional(lazy(() => addressSchema))], -}); diff --git a/src/models/fulfillmentShipmentDetails.ts b/src/models/fulfillmentShipmentDetails.ts deleted file mode 100644 index a49afe709..000000000 --- a/src/models/fulfillmentShipmentDetails.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - FulfillmentRecipient, - fulfillmentRecipientSchema, -} from './fulfillmentRecipient'; - -/** Contains the details necessary to fulfill a shipment order. */ -export interface FulfillmentShipmentDetails { - /** Information about the fulfillment recipient. */ - recipient?: FulfillmentRecipient; - /** The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS). */ - carrier?: string | null; - /** A note with additional information for the shipping carrier. */ - shippingNote?: string | null; - /** - * A description of the type of shipping product purchased from the carrier - * (such as First Class, Priority, or Express). - */ - shippingType?: string | null; - /** The reference number provided by the carrier to track the shipment's progress. */ - trackingNumber?: string | null; - /** A link to the tracking webpage on the carrier's website. */ - trackingUrl?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the shipment was requested. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - placedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation - * of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - inProgressAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the - * fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - packagedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the shipment is expected to be delivered to the shipping carrier. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - expectedShippedAt?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that - * the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - shippedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating the shipment was canceled. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - canceledAt?: string | null; - /** A description of why the shipment was canceled. */ - cancelReason?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - failedAt?: string; - /** A description of why the shipment failed to be completed. */ - failureReason?: string | null; -} - -export const fulfillmentShipmentDetailsSchema: Schema = object( - { - recipient: ['recipient', optional(lazy(() => fulfillmentRecipientSchema))], - carrier: ['carrier', optional(nullable(string()))], - shippingNote: ['shipping_note', optional(nullable(string()))], - shippingType: ['shipping_type', optional(nullable(string()))], - trackingNumber: ['tracking_number', optional(nullable(string()))], - trackingUrl: ['tracking_url', optional(nullable(string()))], - placedAt: ['placed_at', optional(string())], - inProgressAt: ['in_progress_at', optional(string())], - packagedAt: ['packaged_at', optional(string())], - expectedShippedAt: ['expected_shipped_at', optional(nullable(string()))], - shippedAt: ['shipped_at', optional(string())], - canceledAt: ['canceled_at', optional(nullable(string()))], - cancelReason: ['cancel_reason', optional(nullable(string()))], - failedAt: ['failed_at', optional(string())], - failureReason: ['failure_reason', optional(nullable(string()))], - } -); diff --git a/src/models/getBankAccountByV1IdResponse.ts b/src/models/getBankAccountByV1IdResponse.ts deleted file mode 100644 index 379a60bce..000000000 --- a/src/models/getBankAccountByV1IdResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { BankAccount, bankAccountSchema } from './bankAccount'; -import { Error, errorSchema } from './error'; - -/** Response object returned by GetBankAccountByV1Id. */ -export interface GetBankAccountByV1IdResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** - * Represents a bank account. For more information about - * linking a bank account to a Square account, see - * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). - */ - bankAccount?: BankAccount; -} - -export const getBankAccountByV1IdResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - bankAccount: ['bank_account', optional(lazy(() => bankAccountSchema))], - } -); diff --git a/src/models/getBankAccountResponse.ts b/src/models/getBankAccountResponse.ts deleted file mode 100644 index a0f265c00..000000000 --- a/src/models/getBankAccountResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { BankAccount, bankAccountSchema } from './bankAccount'; -import { Error, errorSchema } from './error'; - -/** Response object returned by `GetBankAccount`. */ -export interface GetBankAccountResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** - * Represents a bank account. For more information about - * linking a bank account to a Square account, see - * [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). - */ - bankAccount?: BankAccount; -} - -export const getBankAccountResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - bankAccount: ['bank_account', optional(lazy(() => bankAccountSchema))], - } -); diff --git a/src/models/getBreakTypeResponse.ts b/src/models/getBreakTypeResponse.ts deleted file mode 100644 index 13ffbef2b..000000000 --- a/src/models/getBreakTypeResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { BreakType, breakTypeSchema } from './breakType'; -import { Error, errorSchema } from './error'; - -/** - * The response to a request to get a `BreakType`. The response contains - * the requested `BreakType` objects and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface GetBreakTypeResponse { - /** - * A defined break template that sets an expectation for possible `Break` - * instances on a `Shift`. - */ - breakType?: BreakType; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const getBreakTypeResponseSchema: Schema = object({ - breakType: ['break_type', optional(lazy(() => breakTypeSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/getDeviceCodeResponse.ts b/src/models/getDeviceCodeResponse.ts deleted file mode 100644 index 300096a8d..000000000 --- a/src/models/getDeviceCodeResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { DeviceCode, deviceCodeSchema } from './deviceCode'; -import { Error, errorSchema } from './error'; - -export interface GetDeviceCodeResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - deviceCode?: DeviceCode; -} - -export const getDeviceCodeResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - deviceCode: ['device_code', optional(lazy(() => deviceCodeSchema))], - } -); diff --git a/src/models/getDeviceResponse.ts b/src/models/getDeviceResponse.ts deleted file mode 100644 index d7c05b852..000000000 --- a/src/models/getDeviceResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Device, deviceSchema } from './device'; -import { Error, errorSchema } from './error'; - -export interface GetDeviceResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - device?: Device; -} - -export const getDeviceResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - device: ['device', optional(lazy(() => deviceSchema))], -}); diff --git a/src/models/getEmployeeWageResponse.ts b/src/models/getEmployeeWageResponse.ts deleted file mode 100644 index 38f169652..000000000 --- a/src/models/getEmployeeWageResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { EmployeeWage, employeeWageSchema } from './employeeWage'; -import { Error, errorSchema } from './error'; - -/** - * A response to a request to get an `EmployeeWage`. The response contains - * the requested `EmployeeWage` objects and might contain a set of `Error` objects if - * 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](entity:TeamMemberWage). */ - employeeWage?: EmployeeWage; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const getEmployeeWageResponseSchema: Schema = object( - { - employeeWage: ['employee_wage', optional(lazy(() => employeeWageSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/getInvoiceResponse.ts b/src/models/getInvoiceResponse.ts deleted file mode 100644 index 8b6056842..000000000 --- a/src/models/getInvoiceResponse.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Invoice, invoiceSchema } from './invoice'; - -/** Describes a `GetInvoice` response. */ -export interface GetInvoiceResponse { - /** - * Stores information about an invoice. You use the Invoices API to create and manage - * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - */ - invoice?: Invoice; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const getInvoiceResponseSchema: Schema = object({ - invoice: ['invoice', optional(lazy(() => invoiceSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/getPaymentRefundResponse.ts b/src/models/getPaymentRefundResponse.ts deleted file mode 100644 index ef111def5..000000000 --- a/src/models/getPaymentRefundResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { PaymentRefund, paymentRefundSchema } from './paymentRefund'; - -/** - * Defines the response returned by [GetRefund]($e/Refunds/GetPaymentRefund). - * Note: If there are errors processing the request, the refund field might not be - * present or it might be present in a FAILED state. - */ -export interface GetPaymentRefundResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** - * Represents a refund of a payment made using Square. Contains information about - * the original payment and the amount of money refunded. - */ - refund?: PaymentRefund; -} - -export const getPaymentRefundResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refund: ['refund', optional(lazy(() => paymentRefundSchema))], - } -); diff --git a/src/models/getPaymentResponse.ts b/src/models/getPaymentResponse.ts deleted file mode 100644 index 9d27a795b..000000000 --- a/src/models/getPaymentResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Payment, paymentSchema } from './payment'; - -/** Defines the response returned by [GetPayment]($e/Payments/GetPayment). */ -export interface GetPaymentResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a payment processed by the Square API. */ - payment?: Payment; -} - -export const getPaymentResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - payment: ['payment', optional(lazy(() => paymentSchema))], -}); diff --git a/src/models/getPayoutResponse.ts b/src/models/getPayoutResponse.ts deleted file mode 100644 index b2087c214..000000000 --- a/src/models/getPayoutResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Payout, payoutSchema } from './payout'; - -export interface GetPayoutResponse { - /** - * An accounting of the amount owed the seller and record of the actual transfer to their - * external bank account or to the Square balance. - */ - payout?: Payout; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const getPayoutResponseSchema: Schema = object({ - payout: ['payout', optional(lazy(() => payoutSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/getShiftResponse.ts b/src/models/getShiftResponse.ts deleted file mode 100644 index e923ffe40..000000000 --- a/src/models/getShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Shift, shiftSchema } from './shift'; - -/** - * A response to a request to get a `Shift`. The response contains - * the requested `Shift` object and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface GetShiftResponse { - /** - * A record of the hourly rate, start, and end times for a single work shift - * for an employee. This might include a record of the start and end times for breaks - * taken during the shift. - */ - shift?: Shift; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const getShiftResponseSchema: Schema = object({ - shift: ['shift', optional(lazy(() => shiftSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/getTeamMemberWageResponse.ts b/src/models/getTeamMemberWageResponse.ts deleted file mode 100644 index 6e7538cca..000000000 --- a/src/models/getTeamMemberWageResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TeamMemberWage, teamMemberWageSchema } from './teamMemberWage'; - -/** - * A response to a request to get a `TeamMemberWage`. The response contains - * the requested `TeamMemberWage` objects and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface GetTeamMemberWageResponse { - /** - * The hourly wage rate that a team member earns on a `Shift` for doing the job - * specified by the `title` property of this object. - */ - teamMemberWage?: TeamMemberWage; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const getTeamMemberWageResponseSchema: Schema = object( - { - teamMemberWage: [ - 'team_member_wage', - optional(lazy(() => teamMemberWageSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/getTerminalActionResponse.ts b/src/models/getTerminalActionResponse.ts deleted file mode 100644 index 8817a5f40..000000000 --- a/src/models/getTerminalActionResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalAction, terminalActionSchema } from './terminalAction'; - -export interface GetTerminalActionResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** Represents an action processed by the Square Terminal. */ - action?: TerminalAction; -} - -export const getTerminalActionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - action: ['action', optional(lazy(() => terminalActionSchema))], - } -); diff --git a/src/models/getTerminalCheckoutResponse.ts b/src/models/getTerminalCheckoutResponse.ts deleted file mode 100644 index e66af2282..000000000 --- a/src/models/getTerminalCheckoutResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalCheckout, terminalCheckoutSchema } from './terminalCheckout'; - -export interface GetTerminalCheckoutResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a checkout processed by the Square Terminal. */ - checkout?: TerminalCheckout; -} - -export const getTerminalCheckoutResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - checkout: ['checkout', optional(lazy(() => terminalCheckoutSchema))], - } -); diff --git a/src/models/getTerminalRefundResponse.ts b/src/models/getTerminalRefundResponse.ts deleted file mode 100644 index 80ca67c19..000000000 --- a/src/models/getTerminalRefundResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalRefund, terminalRefundSchema } from './terminalRefund'; - -export interface GetTerminalRefundResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. */ - refund?: TerminalRefund; -} - -export const getTerminalRefundResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refund: ['refund', optional(lazy(() => terminalRefundSchema))], - } -); diff --git a/src/models/giftCard.ts b/src/models/giftCard.ts deleted file mode 100644 index f4a0517e7..000000000 --- a/src/models/giftCard.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents a Square gift card. */ -export interface GiftCard { - /** The Square-assigned ID of the gift card. */ - id?: string; - /** Indicates the gift card type. */ - type: string; - /** - * Indicates the source that generated the gift card - * account number (GAN). - */ - ganSource?: string; - /** Indicates the gift card state. */ - state?: string; - /** - * 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. - */ - balanceMoney?: Money; - /** - * The gift card account number (GAN). Buyers can use the GAN to make purchases or check - * the gift card balance. - */ - gan?: string | null; - /** - * The timestamp when the gift card was created, in RFC 3339 format. - * In the case of a digital gift card, it is the time when you create a card - * (using the Square Point of Sale application, Seller Dashboard, or Gift Cards API). - * In the case of a plastic gift card, it is the time when Square associates the card with the - * seller at the time of activation. - */ - createdAt?: string; - /** The IDs of the [customer profiles](entity:Customer) to whom this gift card is linked. */ - customerIds?: string[]; -} - -export const giftCardSchema: Schema = object({ - id: ['id', optional(string())], - type: ['type', string()], - ganSource: ['gan_source', optional(string())], - state: ['state', optional(string())], - balanceMoney: ['balance_money', optional(lazy(() => moneySchema))], - gan: ['gan', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - customerIds: ['customer_ids', optional(array(string()))], -}); diff --git a/src/models/giftCardActivity.ts b/src/models/giftCardActivity.ts deleted file mode 100644 index 2e0aa64b2..000000000 --- a/src/models/giftCardActivity.ts +++ /dev/null @@ -1,204 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - GiftCardActivityActivate, - giftCardActivityActivateSchema, -} from './giftCardActivityActivate'; -import { - GiftCardActivityAdjustDecrement, - giftCardActivityAdjustDecrementSchema, -} from './giftCardActivityAdjustDecrement'; -import { - GiftCardActivityAdjustIncrement, - giftCardActivityAdjustIncrementSchema, -} from './giftCardActivityAdjustIncrement'; -import { - GiftCardActivityBlock, - giftCardActivityBlockSchema, -} from './giftCardActivityBlock'; -import { - GiftCardActivityClearBalance, - giftCardActivityClearBalanceSchema, -} from './giftCardActivityClearBalance'; -import { - GiftCardActivityDeactivate, - giftCardActivityDeactivateSchema, -} from './giftCardActivityDeactivate'; -import { - GiftCardActivityImport, - giftCardActivityImportSchema, -} from './giftCardActivityImport'; -import { - GiftCardActivityImportReversal, - giftCardActivityImportReversalSchema, -} from './giftCardActivityImportReversal'; -import { - GiftCardActivityLoad, - giftCardActivityLoadSchema, -} from './giftCardActivityLoad'; -import { - GiftCardActivityRedeem, - giftCardActivityRedeemSchema, -} from './giftCardActivityRedeem'; -import { - GiftCardActivityRefund, - giftCardActivityRefundSchema, -} from './giftCardActivityRefund'; -import { - GiftCardActivityTransferBalanceFrom, - giftCardActivityTransferBalanceFromSchema, -} from './giftCardActivityTransferBalanceFrom'; -import { - GiftCardActivityTransferBalanceTo, - giftCardActivityTransferBalanceToSchema, -} from './giftCardActivityTransferBalanceTo'; -import { - GiftCardActivityUnblock, - giftCardActivityUnblockSchema, -} from './giftCardActivityUnblock'; -import { - GiftCardActivityUnlinkedActivityRefund, - giftCardActivityUnlinkedActivityRefundSchema, -} from './giftCardActivityUnlinkedActivityRefund'; -import { Money, moneySchema } from './money'; - -/** - * Represents an action performed on a [gift card]($m/GiftCard) that affects its state or balance. - * A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity - * includes a `redeem_activity_details` field that contains information about the redemption. - */ -export interface GiftCardActivity { - /** The Square-assigned ID of the gift card activity. */ - id?: string; - /** Indicates the type of [gift card activity]($m/GiftCardActivity). */ - type: string; - /** The ID of the [business location](entity:Location) where the activity occurred. */ - locationId: string; - /** The timestamp when the gift card activity was created, in RFC 3339 format. */ - createdAt?: string; - /** - * The gift card ID. When creating a gift card activity, `gift_card_id` is not required if - * `gift_card_gan` is specified. - */ - giftCardId?: string | null; - /** - * The gift card account number (GAN). When creating a gift card activity, `gift_card_gan` - * is not required if `gift_card_id` is specified. - */ - giftCardGan?: 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. - */ - giftCardBalanceMoney?: Money; - /** Represents details about a `LOAD` [gift card activity type]($m/GiftCardActivityType). */ - loadActivityDetails?: GiftCardActivityLoad; - /** Represents details about an `ACTIVATE` [gift card activity type]($m/GiftCardActivityType). */ - activateActivityDetails?: GiftCardActivityActivate; - /** Represents details about a `REDEEM` [gift card activity type]($m/GiftCardActivityType). */ - redeemActivityDetails?: GiftCardActivityRedeem; - /** Represents details about a `CLEAR_BALANCE` [gift card activity type]($m/GiftCardActivityType). */ - clearBalanceActivityDetails?: GiftCardActivityClearBalance; - /** Represents details about a `DEACTIVATE` [gift card activity type]($m/GiftCardActivityType). */ - deactivateActivityDetails?: GiftCardActivityDeactivate; - /** Represents details about an `ADJUST_INCREMENT` [gift card activity type]($m/GiftCardActivityType). */ - adjustIncrementActivityDetails?: GiftCardActivityAdjustIncrement; - /** Represents details about an `ADJUST_DECREMENT` [gift card activity type]($m/GiftCardActivityType). */ - adjustDecrementActivityDetails?: GiftCardActivityAdjustDecrement; - /** Represents details about a `REFUND` [gift card activity type]($m/GiftCardActivityType). */ - refundActivityDetails?: GiftCardActivityRefund; - /** Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type]($m/GiftCardActivityType). */ - unlinkedActivityRefundActivityDetails?: GiftCardActivityUnlinkedActivityRefund; - /** - * Represents details about an `IMPORT` [gift card activity type]($m/GiftCardActivityType). - * This activity type is used when Square imports a third-party gift card, in which case the - * `gan_source` of the gift card is set to `OTHER`. - */ - importActivityDetails?: GiftCardActivityImport; - /** Represents details about a `BLOCK` [gift card activity type]($m/GiftCardActivityType). */ - blockActivityDetails?: GiftCardActivityBlock; - /** Represents details about an `UNBLOCK` [gift card activity type]($m/GiftCardActivityType). */ - unblockActivityDetails?: GiftCardActivityUnblock; - /** Represents details about an `IMPORT_REVERSAL` [gift card activity type]($m/GiftCardActivityType). */ - importReversalActivityDetails?: GiftCardActivityImportReversal; - /** Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type]($m/GiftCardActivityType). */ - transferBalanceToActivityDetails?: GiftCardActivityTransferBalanceTo; - /** Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type]($m/GiftCardActivityType). */ - transferBalanceFromActivityDetails?: GiftCardActivityTransferBalanceFrom; -} - -export const giftCardActivitySchema: Schema = object({ - id: ['id', optional(string())], - type: ['type', string()], - locationId: ['location_id', string()], - createdAt: ['created_at', optional(string())], - giftCardId: ['gift_card_id', optional(nullable(string()))], - giftCardGan: ['gift_card_gan', optional(nullable(string()))], - giftCardBalanceMoney: [ - 'gift_card_balance_money', - optional(lazy(() => moneySchema)), - ], - loadActivityDetails: [ - 'load_activity_details', - optional(lazy(() => giftCardActivityLoadSchema)), - ], - activateActivityDetails: [ - 'activate_activity_details', - optional(lazy(() => giftCardActivityActivateSchema)), - ], - redeemActivityDetails: [ - 'redeem_activity_details', - optional(lazy(() => giftCardActivityRedeemSchema)), - ], - clearBalanceActivityDetails: [ - 'clear_balance_activity_details', - optional(lazy(() => giftCardActivityClearBalanceSchema)), - ], - deactivateActivityDetails: [ - 'deactivate_activity_details', - optional(lazy(() => giftCardActivityDeactivateSchema)), - ], - adjustIncrementActivityDetails: [ - 'adjust_increment_activity_details', - optional(lazy(() => giftCardActivityAdjustIncrementSchema)), - ], - adjustDecrementActivityDetails: [ - 'adjust_decrement_activity_details', - optional(lazy(() => giftCardActivityAdjustDecrementSchema)), - ], - refundActivityDetails: [ - 'refund_activity_details', - optional(lazy(() => giftCardActivityRefundSchema)), - ], - unlinkedActivityRefundActivityDetails: [ - 'unlinked_activity_refund_activity_details', - optional(lazy(() => giftCardActivityUnlinkedActivityRefundSchema)), - ], - importActivityDetails: [ - 'import_activity_details', - optional(lazy(() => giftCardActivityImportSchema)), - ], - blockActivityDetails: [ - 'block_activity_details', - optional(lazy(() => giftCardActivityBlockSchema)), - ], - unblockActivityDetails: [ - 'unblock_activity_details', - optional(lazy(() => giftCardActivityUnblockSchema)), - ], - importReversalActivityDetails: [ - 'import_reversal_activity_details', - optional(lazy(() => giftCardActivityImportReversalSchema)), - ], - transferBalanceToActivityDetails: [ - 'transfer_balance_to_activity_details', - optional(lazy(() => giftCardActivityTransferBalanceToSchema)), - ], - transferBalanceFromActivityDetails: [ - 'transfer_balance_from_activity_details', - optional(lazy(() => giftCardActivityTransferBalanceFromSchema)), - ], -}); diff --git a/src/models/giftCardActivityActivate.ts b/src/models/giftCardActivityActivate.ts deleted file mode 100644 index 6bf3ab164..000000000 --- a/src/models/giftCardActivityActivate.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about an `ACTIVATE` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityActivate { - /** - * 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. - */ - amountMoney?: Money; - /** - * The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. - * Applications that use the Square Orders API to process orders must specify the order ID - * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - */ - orderId?: string | null; - /** - * The UID of the `GIFT_CARD` line item in the order that represents the gift card purchase. - * Applications that use the Square Orders API to process orders must specify the line item UID - * in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - */ - lineItemUid?: string | null; - /** - * A client-specified ID that associates the gift card activity with an entity in another system. - * Applications that use a custom order processing system can use this field to track information - * related to an order or payment. - */ - referenceId?: string | null; - /** - * The payment instrument IDs used to process the gift card purchase, such as a credit card ID - * or bank account ID. - * Applications that use a custom order processing system must specify payment instrument IDs in - * the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - * Square uses this information to perform compliance checks. - * For applications that use the Square Orders API to process payments, Square has the necessary - * instrument IDs to perform compliance checks. - * Each buyer payment instrument ID can contain a maximum of 255 characters. - */ - buyerPaymentInstrumentIds?: string[] | null; -} - -export const giftCardActivityActivateSchema: Schema = object( - { - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - orderId: ['order_id', optional(nullable(string()))], - lineItemUid: ['line_item_uid', optional(nullable(string()))], - referenceId: ['reference_id', optional(nullable(string()))], - buyerPaymentInstrumentIds: [ - 'buyer_payment_instrument_ids', - optional(nullable(array(string()))), - ], - } -); diff --git a/src/models/giftCardActivityAdjustDecrement.ts b/src/models/giftCardActivityAdjustDecrement.ts deleted file mode 100644 index ad64c8eeb..000000000 --- a/src/models/giftCardActivityAdjustDecrement.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about an `ADJUST_DECREMENT` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityAdjustDecrement { - /** - * 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. - */ - amountMoney: Money; - /** Indicates the reason for deducting money from a [gift card]($m/GiftCard). */ - reason: string; -} - -export const giftCardActivityAdjustDecrementSchema: Schema = object( - { - amountMoney: ['amount_money', lazy(() => moneySchema)], - reason: ['reason', string()], - } -); diff --git a/src/models/giftCardActivityAdjustIncrement.ts b/src/models/giftCardActivityAdjustIncrement.ts deleted file mode 100644 index 8c190ad37..000000000 --- a/src/models/giftCardActivityAdjustIncrement.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about an `ADJUST_INCREMENT` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityAdjustIncrement { - /** - * 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. - */ - amountMoney: Money; - /** Indicates the reason for adding money to a [gift card]($m/GiftCard). */ - reason: string; -} - -export const giftCardActivityAdjustIncrementSchema: Schema = object( - { - amountMoney: ['amount_money', lazy(() => moneySchema)], - reason: ['reason', string()], - } -); diff --git a/src/models/giftCardActivityBlock.ts b/src/models/giftCardActivityBlock.ts deleted file mode 100644 index 06cbc1f1e..000000000 --- a/src/models/giftCardActivityBlock.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Represents details about a `BLOCK` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityBlock { - /** Indicates the reason for blocking a [gift card]($m/GiftCard). */ - reason: string; -} - -export const giftCardActivityBlockSchema: Schema = object( - { reason: ['reason', string()] } -); diff --git a/src/models/giftCardActivityClearBalance.ts b/src/models/giftCardActivityClearBalance.ts deleted file mode 100644 index daeeae649..000000000 --- a/src/models/giftCardActivityClearBalance.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Represents details about a `CLEAR_BALANCE` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityClearBalance { - /** Indicates the reason for clearing the balance of a [gift card]($m/GiftCard). */ - reason: string; -} - -export const giftCardActivityClearBalanceSchema: Schema = object( - { reason: ['reason', string()] } -); diff --git a/src/models/giftCardActivityDeactivate.ts b/src/models/giftCardActivityDeactivate.ts deleted file mode 100644 index c4e6d9e64..000000000 --- a/src/models/giftCardActivityDeactivate.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Represents details about a `DEACTIVATE` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityDeactivate { - /** Indicates the reason for deactivating a [gift card]($m/GiftCard). */ - reason: string; -} - -export const giftCardActivityDeactivateSchema: Schema = object( - { reason: ['reason', string()] } -); diff --git a/src/models/giftCardActivityImport.ts b/src/models/giftCardActivityImport.ts deleted file mode 100644 index bb1ea3a9a..000000000 --- a/src/models/giftCardActivityImport.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents details about an `IMPORT` [gift card activity type]($m/GiftCardActivityType). - * This activity type is used when Square imports a third-party gift card, in which case the - * `gan_source` of the gift card is set to `OTHER`. - */ -export interface GiftCardActivityImport { - /** - * 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. - */ - amountMoney: Money; -} - -export const giftCardActivityImportSchema: Schema = object( - { amountMoney: ['amount_money', lazy(() => moneySchema)] } -); diff --git a/src/models/giftCardActivityImportReversal.ts b/src/models/giftCardActivityImportReversal.ts deleted file mode 100644 index 1abbb546a..000000000 --- a/src/models/giftCardActivityImportReversal.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about an `IMPORT_REVERSAL` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityImportReversal { - /** - * 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. - */ - amountMoney: Money; -} - -export const giftCardActivityImportReversalSchema: Schema = object( - { amountMoney: ['amount_money', lazy(() => moneySchema)] } -); diff --git a/src/models/giftCardActivityLoad.ts b/src/models/giftCardActivityLoad.ts deleted file mode 100644 index 91308e88b..000000000 --- a/src/models/giftCardActivityLoad.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about a `LOAD` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityLoad { - /** - * 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. - */ - amountMoney?: Money; - /** - * The ID of the [order](entity:Order) that contains the `GIFT_CARD` line item. - * Applications that use the Square Orders API to process orders must specify the order ID in the - * [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - */ - orderId?: string | null; - /** - * The UID of the `GIFT_CARD` line item in the order that represents the additional funds for the gift card. - * Applications that use the Square Orders API to process orders must specify the line item UID - * in the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - */ - lineItemUid?: string | null; - /** - * A client-specified ID that associates the gift card activity with an entity in another system. - * Applications that use a custom order processing system can use this field to track information related to - * an order or payment. - */ - referenceId?: string | null; - /** - * The payment instrument IDs used to process the order for the additional funds, such as a credit card ID - * or bank account ID. - * Applications that use a custom order processing system must specify payment instrument IDs in - * the [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) request. - * Square uses this information to perform compliance checks. - * For applications that use the Square Orders API to process payments, Square has the necessary - * instrument IDs to perform compliance checks. - * Each buyer payment instrument ID can contain a maximum of 255 characters. - */ - buyerPaymentInstrumentIds?: string[] | null; -} - -export const giftCardActivityLoadSchema: Schema = object({ - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - orderId: ['order_id', optional(nullable(string()))], - lineItemUid: ['line_item_uid', optional(nullable(string()))], - referenceId: ['reference_id', optional(nullable(string()))], - buyerPaymentInstrumentIds: [ - 'buyer_payment_instrument_ids', - optional(nullable(array(string()))), - ], -}); diff --git a/src/models/giftCardActivityRedeem.ts b/src/models/giftCardActivityRedeem.ts deleted file mode 100644 index e376c94d1..000000000 --- a/src/models/giftCardActivityRedeem.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about a `REDEEM` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityRedeem { - /** - * 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. - */ - amountMoney: Money; - /** - * The ID of the payment that represents the gift card redemption. Square populates this field - * if the payment was processed by Square. - */ - paymentId?: string; - /** - * A client-specified ID that associates the gift card activity with an entity in another system. - * Applications that use a custom payment processing system can use this field to track information - * related to an order or payment. - */ - referenceId?: string | null; - /** - * Indicates the status of a [gift card]($m/GiftCard) redemption. This status is relevant only for - * redemptions made from Square products (such as Square Point of Sale) because Square products use a - * two-state process. Gift cards redeemed using the Gift Card Activities API always have a `COMPLETED` status. - */ - status?: string; -} - -export const giftCardActivityRedeemSchema: Schema = object( - { - amountMoney: ['amount_money', lazy(() => moneySchema)], - paymentId: ['payment_id', optional(string())], - referenceId: ['reference_id', optional(nullable(string()))], - status: ['status', optional(string())], - } -); diff --git a/src/models/giftCardActivityRefund.ts b/src/models/giftCardActivityRefund.ts deleted file mode 100644 index b40dc15b4..000000000 --- a/src/models/giftCardActivityRefund.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about a `REFUND` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityRefund { - /** - * The ID of the refunded `REDEEM` gift card activity. Square populates this field if the - * `payment_id` in the corresponding [RefundPayment](api-endpoint:Refunds-RefundPayment) request - * represents a gift card redemption. - * For applications that use a custom payment processing system, this field is required when creating - * a `REFUND` activity. The provided `REDEEM` activity ID must be linked to the same gift card. - */ - redeemActivityId?: 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. - */ - amountMoney?: Money; - /** A client-specified ID that associates the gift card activity with an entity in another system. */ - referenceId?: string | null; - /** - * The ID of the refunded payment. Square populates this field if the refund is for a - * payment processed by Square. This field matches the `payment_id` in the corresponding - * [RefundPayment](api-endpoint:Refunds-RefundPayment) request. - */ - paymentId?: string; -} - -export const giftCardActivityRefundSchema: Schema = object( - { - redeemActivityId: ['redeem_activity_id', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - referenceId: ['reference_id', optional(nullable(string()))], - paymentId: ['payment_id', optional(string())], - } -); diff --git a/src/models/giftCardActivityTransferBalanceFrom.ts b/src/models/giftCardActivityTransferBalanceFrom.ts deleted file mode 100644 index 613e816fb..000000000 --- a/src/models/giftCardActivityTransferBalanceFrom.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityTransferBalanceFrom { - /** The ID of the gift card to which the specified amount was transferred. */ - transferToGiftCardId: string; - /** - * 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. - */ - amountMoney: Money; -} - -export const giftCardActivityTransferBalanceFromSchema: Schema = object( - { - transferToGiftCardId: ['transfer_to_gift_card_id', string()], - amountMoney: ['amount_money', lazy(() => moneySchema)], - } -); diff --git a/src/models/giftCardActivityTransferBalanceTo.ts b/src/models/giftCardActivityTransferBalanceTo.ts deleted file mode 100644 index dfef1937f..000000000 --- a/src/models/giftCardActivityTransferBalanceTo.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityTransferBalanceTo { - /** The ID of the gift card from which the specified amount was transferred. */ - transferFromGiftCardId: string; - /** - * 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. - */ - amountMoney: Money; -} - -export const giftCardActivityTransferBalanceToSchema: Schema = object( - { - transferFromGiftCardId: ['transfer_from_gift_card_id', string()], - amountMoney: ['amount_money', lazy(() => moneySchema)], - } -); diff --git a/src/models/giftCardActivityUnblock.ts b/src/models/giftCardActivityUnblock.ts deleted file mode 100644 index 89bb7b7d6..000000000 --- a/src/models/giftCardActivityUnblock.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Represents details about an `UNBLOCK` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityUnblock { - /** Indicates the reason for unblocking a [gift card]($m/GiftCard). */ - reason: string; -} - -export const giftCardActivityUnblockSchema: Schema = object( - { reason: ['reason', string()] } -); diff --git a/src/models/giftCardActivityUnlinkedActivityRefund.ts b/src/models/giftCardActivityUnlinkedActivityRefund.ts deleted file mode 100644 index 288b98d88..000000000 --- a/src/models/giftCardActivityUnlinkedActivityRefund.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type]($m/GiftCardActivityType). */ -export interface GiftCardActivityUnlinkedActivityRefund { - /** - * 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. - */ - amountMoney: Money; - /** A client-specified ID that associates the gift card activity with an entity in another system. */ - referenceId?: string | null; - /** The ID of the refunded payment. This field is not used starting in Square version 2022-06-16. */ - paymentId?: string; -} - -export const giftCardActivityUnlinkedActivityRefundSchema: Schema = object( - { - amountMoney: ['amount_money', lazy(() => moneySchema)], - referenceId: ['reference_id', optional(nullable(string()))], - paymentId: ['payment_id', optional(string())], - } -); diff --git a/src/models/inventoryAdjustment.ts b/src/models/inventoryAdjustment.ts deleted file mode 100644 index a88c84033..000000000 --- a/src/models/inventoryAdjustment.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - InventoryAdjustmentGroup, - inventoryAdjustmentGroupSchema, -} from './inventoryAdjustmentGroup'; -import { Money, moneySchema } from './money'; -import { - SourceApplication, - sourceApplicationSchema, -} from './sourceApplication'; - -/** - * Represents a change in state or quantity of product inventory at a - * particular time and location. - */ -export interface InventoryAdjustment { - /** - * A unique ID generated by Square for the - * `InventoryAdjustment`. - */ - id?: string; - /** - * An optional ID provided by the application to tie the - * `InventoryAdjustment` to an external - * system. - */ - referenceId?: string | null; - /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ - fromState?: string; - /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ - toState?: string; - /** - * The Square-generated ID of the [Location](entity:Location) where the related - * quantity of items is being tracked. - */ - locationId?: string | null; - /** - * The Square-generated ID of the - * [CatalogObject](entity:CatalogObject) being tracked. - */ - catalogObjectId?: string | null; - /** - * The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. - * The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. - * In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app. - */ - catalogObjectType?: string | null; - /** - * The number of items affected by the adjustment as a decimal string. - * Can support up to 5 digits after the decimal point. - */ - quantity?: 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. - */ - totalPriceMoney?: Money; - /** - * A client-generated RFC 3339-formatted timestamp that indicates when - * the inventory adjustment took place. For inventory adjustment updates, the `occurred_at` - * timestamp cannot be older than 24 hours or in the future relative to the - * time of the request. - */ - occurredAt?: string | null; - /** An RFC 3339-formatted timestamp that indicates when the inventory adjustment is received. */ - createdAt?: string; - /** Represents information about the application used to generate a change. */ - source?: SourceApplication; - /** - * The Square-generated ID of the [Employee](entity:Employee) responsible for the - * inventory adjustment. - */ - employeeId?: string | null; - /** - * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the - * inventory adjustment. - */ - teamMemberId?: string | null; - /** - * The Square-generated ID of the [Transaction](entity:Transaction) that - * caused the adjustment. Only relevant for payment-related state - * transitions. - */ - transactionId?: string; - /** - * The Square-generated ID of the [Refund](entity:Refund) that - * caused the adjustment. Only relevant for refund-related state - * transitions. - */ - refundId?: string; - /** - * The Square-generated ID of the purchase order that caused the - * adjustment. Only relevant for state transitions from the Square for Retail - * app. - */ - purchaseOrderId?: string; - /** - * The Square-generated ID of the goods receipt that caused the - * adjustment. Only relevant for state transitions from the Square for Retail - * app. - */ - goodsReceiptId?: string; - adjustmentGroup?: InventoryAdjustmentGroup; -} - -export const inventoryAdjustmentSchema: Schema = object({ - id: ['id', optional(string())], - referenceId: ['reference_id', optional(nullable(string()))], - fromState: ['from_state', optional(string())], - toState: ['to_state', optional(string())], - locationId: ['location_id', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogObjectType: ['catalog_object_type', optional(nullable(string()))], - quantity: ['quantity', optional(nullable(string()))], - totalPriceMoney: ['total_price_money', optional(lazy(() => moneySchema))], - occurredAt: ['occurred_at', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - source: ['source', optional(lazy(() => sourceApplicationSchema))], - employeeId: ['employee_id', optional(nullable(string()))], - teamMemberId: ['team_member_id', optional(nullable(string()))], - transactionId: ['transaction_id', optional(string())], - refundId: ['refund_id', optional(string())], - purchaseOrderId: ['purchase_order_id', optional(string())], - goodsReceiptId: ['goods_receipt_id', optional(string())], - adjustmentGroup: [ - 'adjustment_group', - optional(lazy(() => inventoryAdjustmentGroupSchema)), - ], -}); diff --git a/src/models/inventoryAdjustmentGroup.ts b/src/models/inventoryAdjustmentGroup.ts deleted file mode 100644 index 9ee462e8e..000000000 --- a/src/models/inventoryAdjustmentGroup.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -export interface InventoryAdjustmentGroup { - /** - * A unique ID generated by Square for the - * `InventoryAdjustmentGroup`. - */ - id?: string; - /** The inventory adjustment of the composed variation. */ - rootAdjustmentId?: string; - /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ - fromState?: string; - /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ - toState?: string; -} - -export const inventoryAdjustmentGroupSchema: Schema = object( - { - id: ['id', optional(string())], - rootAdjustmentId: ['root_adjustment_id', optional(string())], - fromState: ['from_state', optional(string())], - toState: ['to_state', optional(string())], - } -); diff --git a/src/models/inventoryChange.ts b/src/models/inventoryChange.ts deleted file mode 100644 index 20e9a5dcd..000000000 --- a/src/models/inventoryChange.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - CatalogMeasurementUnit, - catalogMeasurementUnitSchema, -} from './catalogMeasurementUnit'; -import { - InventoryAdjustment, - inventoryAdjustmentSchema, -} from './inventoryAdjustment'; -import { - InventoryPhysicalCount, - inventoryPhysicalCountSchema, -} from './inventoryPhysicalCount'; -import { - InventoryTransfer, - inventoryTransferSchema, -} from './inventoryTransfer'; - -/** - * Represents a single physical count, inventory, adjustment, or transfer - * that is part of the history of inventory changes for a particular - * [CatalogObject]($m/CatalogObject) instance. - */ -export interface InventoryChange { - /** Indicates how the inventory change was applied to a tracked product quantity. */ - type?: string; - /** - * Represents the quantity of an item variation that is physically present - * at a specific location, verified by a seller or a seller's employee. For example, - * a physical count might come from an employee counting the item variations on - * hand or from syncing with an external system. - */ - physicalCount?: InventoryPhysicalCount; - /** - * Represents a change in state or quantity of product inventory at a - * particular time and location. - */ - adjustment?: InventoryAdjustment; - /** - * Represents the transfer of a quantity of product inventory at a - * particular time from one location to another. - */ - transfer?: InventoryTransfer; - /** - * Represents the unit used to measure a `CatalogItemVariation` and - * specifies the precision for decimal quantities. - */ - measurementUnit?: CatalogMeasurementUnit; - /** The ID of the [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change. */ - measurementUnitId?: string; -} - -export const inventoryChangeSchema: Schema = object({ - type: ['type', optional(string())], - physicalCount: [ - 'physical_count', - optional(lazy(() => inventoryPhysicalCountSchema)), - ], - adjustment: ['adjustment', optional(lazy(() => inventoryAdjustmentSchema))], - transfer: ['transfer', optional(lazy(() => inventoryTransferSchema))], - measurementUnit: [ - 'measurement_unit', - optional(lazy(() => catalogMeasurementUnitSchema)), - ], - measurementUnitId: ['measurement_unit_id', optional(string())], -}); diff --git a/src/models/inventoryCount.ts b/src/models/inventoryCount.ts deleted file mode 100644 index 24d2f5535..000000000 --- a/src/models/inventoryCount.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** - * Represents Square-estimated quantity of items in a particular state at a - * particular seller location based on the known history of physical counts and - * inventory adjustments. - */ -export interface InventoryCount { - /** - * The Square-generated ID of the - * [CatalogObject](entity:CatalogObject) being tracked. - */ - catalogObjectId?: string | null; - /** - * The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. - * The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. - * In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app. - */ - catalogObjectType?: string | null; - /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ - state?: string; - /** - * The Square-generated ID of the [Location](entity:Location) where the related - * quantity of items is being tracked. - */ - locationId?: string | null; - /** - * The number of items affected by the estimated count as a decimal string. - * Can support up to 5 digits after the decimal point. - */ - quantity?: string | null; - /** - * An RFC 3339-formatted timestamp that indicates when the most recent physical count or adjustment affecting - * the estimated count is received. - */ - calculatedAt?: string; - /** - * Whether the inventory count is for composed variation (TRUE) or not (FALSE). If true, the inventory count will not be present in the response of - * any of these endpoints: [BatchChangeInventory]($e/Inventory/BatchChangeInventory), - * [BatchRetrieveInventoryChanges]($e/Inventory/BatchRetrieveInventoryChanges), - * [BatchRetrieveInventoryCounts]($e/Inventory/BatchRetrieveInventoryCounts), and - * [RetrieveInventoryChanges]($e/Inventory/RetrieveInventoryChanges). - */ - isEstimated?: boolean; -} - -export const inventoryCountSchema: Schema = object({ - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogObjectType: ['catalog_object_type', optional(nullable(string()))], - state: ['state', optional(string())], - locationId: ['location_id', optional(nullable(string()))], - quantity: ['quantity', optional(nullable(string()))], - calculatedAt: ['calculated_at', optional(string())], - isEstimated: ['is_estimated', optional(boolean())], -}); diff --git a/src/models/inventoryPhysicalCount.ts b/src/models/inventoryPhysicalCount.ts deleted file mode 100644 index 95cc47fd5..000000000 --- a/src/models/inventoryPhysicalCount.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - SourceApplication, - sourceApplicationSchema, -} from './sourceApplication'; - -/** - * Represents the quantity of an item variation that is physically present - * at a specific location, verified by a seller or a seller's employee. For example, - * a physical count might come from an employee counting the item variations on - * hand or from syncing with an external system. - */ -export interface InventoryPhysicalCount { - /** - * A unique Square-generated ID for the - * [InventoryPhysicalCount](entity:InventoryPhysicalCount). - */ - id?: string; - /** - * An optional ID provided by the application to tie the - * [InventoryPhysicalCount](entity:InventoryPhysicalCount) to an external - * system. - */ - referenceId?: string | null; - /** - * The Square-generated ID of the - * [CatalogObject](entity:CatalogObject) being tracked. - */ - catalogObjectId?: string | null; - /** - * The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. - * The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. - * In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app. - */ - catalogObjectType?: string | null; - /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ - state?: string; - /** - * The Square-generated ID of the [Location](entity:Location) where the related - * quantity of items is being tracked. - */ - locationId?: string | null; - /** - * The number of items affected by the physical count as a decimal string. - * The number can support up to 5 digits after the decimal point. - */ - quantity?: string | null; - /** Represents information about the application used to generate a change. */ - source?: SourceApplication; - /** - * The Square-generated ID of the [Employee](entity:Employee) responsible for the - * physical count. - */ - employeeId?: string | null; - /** - * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the - * physical count. - */ - teamMemberId?: string | null; - /** - * A client-generated RFC 3339-formatted timestamp that indicates when - * the physical count was examined. For physical count updates, the `occurred_at` - * timestamp cannot be older than 24 hours or in the future relative to the - * time of the request. - */ - occurredAt?: string | null; - /** An RFC 3339-formatted timestamp that indicates when the physical count is received. */ - createdAt?: string; -} - -export const inventoryPhysicalCountSchema: Schema = object( - { - id: ['id', optional(string())], - referenceId: ['reference_id', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogObjectType: ['catalog_object_type', optional(nullable(string()))], - state: ['state', optional(string())], - locationId: ['location_id', optional(nullable(string()))], - quantity: ['quantity', optional(nullable(string()))], - source: ['source', optional(lazy(() => sourceApplicationSchema))], - employeeId: ['employee_id', optional(nullable(string()))], - teamMemberId: ['team_member_id', optional(nullable(string()))], - occurredAt: ['occurred_at', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - } -); diff --git a/src/models/inventoryTransfer.ts b/src/models/inventoryTransfer.ts deleted file mode 100644 index 44fbe8e86..000000000 --- a/src/models/inventoryTransfer.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - SourceApplication, - sourceApplicationSchema, -} from './sourceApplication'; - -/** - * Represents the transfer of a quantity of product inventory at a - * particular time from one location to another. - */ -export interface InventoryTransfer { - /** - * A unique ID generated by Square for the - * `InventoryTransfer`. - */ - id?: string; - /** - * An optional ID provided by the application to tie the - * `InventoryTransfer` to an external system. - */ - referenceId?: string | null; - /** Indicates the state of a tracked item quantity in the lifecycle of goods. */ - state?: string; - /** - * The Square-generated ID of the [Location](entity:Location) where the related - * quantity of items was tracked before the transfer. - */ - fromLocationId?: string | null; - /** - * The Square-generated ID of the [Location](entity:Location) where the related - * quantity of items was tracked after the transfer. - */ - toLocationId?: string | null; - /** - * The Square-generated ID of the - * [CatalogObject](entity:CatalogObject) being tracked. - */ - catalogObjectId?: string | null; - /** - * The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked. - * The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value. - * In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app. - */ - catalogObjectType?: string | null; - /** - * The number of items affected by the transfer as a decimal string. - * Can support up to 5 digits after the decimal point. - */ - quantity?: string | null; - /** - * A client-generated RFC 3339-formatted timestamp that indicates when - * the transfer took place. For write actions, the `occurred_at` timestamp - * cannot be older than 24 hours or in the future relative to the time of the - * request. - */ - occurredAt?: string | null; - /** - * An RFC 3339-formatted timestamp that indicates when Square - * received the transfer request. - */ - createdAt?: string; - /** Represents information about the application used to generate a change. */ - source?: SourceApplication; - /** - * The Square-generated ID of the [Employee](entity:Employee) responsible for the - * inventory transfer. - */ - employeeId?: string | null; - /** - * The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the - * inventory transfer. - */ - teamMemberId?: string | null; -} - -export const inventoryTransferSchema: Schema = object({ - id: ['id', optional(string())], - referenceId: ['reference_id', optional(nullable(string()))], - state: ['state', optional(string())], - fromLocationId: ['from_location_id', optional(nullable(string()))], - toLocationId: ['to_location_id', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogObjectType: ['catalog_object_type', optional(nullable(string()))], - quantity: ['quantity', optional(nullable(string()))], - occurredAt: ['occurred_at', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - source: ['source', optional(lazy(() => sourceApplicationSchema))], - employeeId: ['employee_id', optional(nullable(string()))], - teamMemberId: ['team_member_id', optional(nullable(string()))], -}); diff --git a/src/models/invoice.ts b/src/models/invoice.ts deleted file mode 100644 index 3eccf8b76..000000000 --- a/src/models/invoice.ts +++ /dev/null @@ -1,210 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - InvoiceAcceptedPaymentMethods, - invoiceAcceptedPaymentMethodsSchema, -} from './invoiceAcceptedPaymentMethods'; -import { - InvoiceAttachment, - invoiceAttachmentSchema, -} from './invoiceAttachment'; -import { - InvoiceCustomField, - invoiceCustomFieldSchema, -} from './invoiceCustomField'; -import { - InvoicePaymentRequest, - invoicePaymentRequestSchema, -} from './invoicePaymentRequest'; -import { InvoiceRecipient, invoiceRecipientSchema } from './invoiceRecipient'; -import { Money, moneySchema } from './money'; - -/** - * Stores information about an invoice. You use the Invoices API to create and manage - * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - */ -export interface Invoice { - /** The Square-assigned ID of the invoice. */ - id?: string; - /** The Square-assigned version number, which is incremented each time an update is committed to the invoice. */ - version?: number; - /** - * The ID of the location that this invoice is associated with. - * If specified in a `CreateInvoice` request, the value must match the `location_id` of the associated order. - */ - locationId?: string | null; - /** - * The ID of the [order](entity:Order) for which the invoice is created. - * This field is required when creating an invoice, and the order must be in the `OPEN` state. - * To view the line items and other information for the associated order, call the - * [RetrieveOrder](api-endpoint:Orders-RetrieveOrder) endpoint using the order ID. - */ - orderId?: string | null; - /** - * Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice - * and that Square uses to deliver the invoice. - * When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates - * the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published. - * Square updates the customer ID in response to a merge operation, but does not update other fields. - */ - primaryRecipient?: InvoiceRecipient; - /** - * The payment schedule for the invoice, represented by one or more payment requests that - * define payment settings, such as amount due and due date. An invoice supports the following payment request combinations: - * - One balance - * - One deposit with one balance - * - 2–12 installments - * - One deposit with 2–12 installments - * This field is required when creating an invoice. It must contain at least one payment request. - * All payment requests for the invoice must equal the total order amount. For more information, see - * [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). - * Adding `INSTALLMENT` payment requests to an invoice requires an - * [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). - */ - paymentRequests?: InvoicePaymentRequest[] | null; - /** Indicates how Square delivers the [invoice]($m/Invoice) to the customer. */ - deliveryMethod?: string; - /** - * A user-friendly invoice number that is displayed on the invoice. The value is unique within a location. - * If not provided when creating an invoice, Square assigns a value. - * It increments from 1 and is padded with zeros making it 7 characters long - * (for example, 0000001 and 0000002). - */ - invoiceNumber?: string | null; - /** The title of the invoice, which is displayed on the invoice. */ - title?: string | null; - /** The description of the invoice, which is displayed on the invoice. */ - description?: string | null; - /** - * The timestamp when the invoice is scheduled for processing, in RFC 3339 format. - * After the invoice is published, Square processes the invoice on the specified date, - * according to the delivery method and payment request settings. - * If the field is not set, Square processes the invoice immediately after it is published. - */ - scheduledAt?: string | null; - /** - * The URL of the Square-hosted invoice page. - * After you publish the invoice using the `PublishInvoice` endpoint, Square hosts the invoice - * page and returns the page URL in the response. - */ - publicUrl?: string; - /** - * 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. - */ - nextPaymentAmountMoney?: Money; - /** Indicates the status of an invoice. */ - status?: string; - /** - * The time zone used to interpret calendar dates on the invoice, such as `due_date`. - * When an invoice is created, this field is set to the `timezone` specified for the seller - * location. The value cannot be changed. - * For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los\_Angeles - * becomes overdue at midnight on March 9 in America/Los\_Angeles (which equals a UTC timestamp - * of 2021-03-10T08:00:00Z). - */ - timezone?: string; - /** The timestamp when the invoice was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the invoice was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** The payment methods that customers can use to pay an [invoice]($m/Invoice) on the Square-hosted invoice payment page. */ - acceptedPaymentMethods?: InvoiceAcceptedPaymentMethods; - /** - * Additional seller-defined fields that are displayed on the invoice. For more information, see - * [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). - * Adding custom fields to an invoice requires an - * [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). - * Max: 2 custom fields - */ - customFields?: InvoiceCustomField[] | null; - /** - * The ID of the [subscription](entity:Subscription) associated with the invoice. - * This field is present only on subscription billing invoices. - */ - subscriptionId?: string; - /** - * The date of the sale or the date that the service is rendered, in `YYYY-MM-DD` format. - * This field can be used to specify a past or future date which is displayed on the invoice. - */ - saleOrServiceDate?: string | null; - /** - * **France only.** The payment terms and conditions that are displayed on the invoice. For more information, - * see [Payment conditions](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions). - * For countries other than France, Square returns an `INVALID_REQUEST_ERROR` with a `BAD_REQUEST` code and - * "Payment conditions are not supported for this location's country" detail if this field is included in `CreateInvoice` or `UpdateInvoice` requests. - */ - paymentConditions?: string | null; - /** - * Indicates whether to allow a customer to save a credit or debit card as a card on file or a bank transfer as a - * bank account on file. If `true`, Square displays a __Save my card on file__ or __Save my bank on file__ checkbox on the - * invoice payment page. Stored payment information can be used for future automatic payments. The default value is `false`. - */ - storePaymentMethodEnabled?: boolean | null; - /** - * Metadata about the attachments on the invoice. Invoice attachments are managed using the - * [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) and [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) endpoints. - */ - attachments?: InvoiceAttachment[]; -} - -export const invoiceSchema: Schema = object({ - id: ['id', optional(string())], - version: ['version', optional(number())], - locationId: ['location_id', optional(nullable(string()))], - orderId: ['order_id', optional(nullable(string()))], - primaryRecipient: [ - 'primary_recipient', - optional(lazy(() => invoiceRecipientSchema)), - ], - paymentRequests: [ - 'payment_requests', - optional(nullable(array(lazy(() => invoicePaymentRequestSchema)))), - ], - deliveryMethod: ['delivery_method', optional(string())], - invoiceNumber: ['invoice_number', optional(nullable(string()))], - title: ['title', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - scheduledAt: ['scheduled_at', optional(nullable(string()))], - publicUrl: ['public_url', optional(string())], - nextPaymentAmountMoney: [ - 'next_payment_amount_money', - optional(lazy(() => moneySchema)), - ], - status: ['status', optional(string())], - timezone: ['timezone', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - acceptedPaymentMethods: [ - 'accepted_payment_methods', - optional(lazy(() => invoiceAcceptedPaymentMethodsSchema)), - ], - customFields: [ - 'custom_fields', - optional(nullable(array(lazy(() => invoiceCustomFieldSchema)))), - ], - subscriptionId: ['subscription_id', optional(string())], - saleOrServiceDate: ['sale_or_service_date', optional(nullable(string()))], - paymentConditions: ['payment_conditions', optional(nullable(string()))], - storePaymentMethodEnabled: [ - 'store_payment_method_enabled', - optional(nullable(boolean())), - ], - attachments: [ - 'attachments', - optional(array(lazy(() => invoiceAttachmentSchema))), - ], -}); diff --git a/src/models/invoiceAcceptedPaymentMethods.ts b/src/models/invoiceAcceptedPaymentMethods.ts deleted file mode 100644 index e5176d662..000000000 --- a/src/models/invoiceAcceptedPaymentMethods.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { boolean, nullable, object, optional, Schema } from '../schema'; - -/** The payment methods that customers can use to pay an [invoice]($m/Invoice) on the Square-hosted invoice payment page. */ -export interface InvoiceAcceptedPaymentMethods { - /** Indicates whether credit card or debit card payments are accepted. The default value is `false`. */ - card?: boolean | null; - /** Indicates whether Square gift card payments are accepted. The default value is `false`. */ - squareGiftCard?: boolean | null; - /** Indicates whether ACH bank transfer payments are accepted. The default value is `false`. */ - bankAccount?: boolean | null; - /** - * Indicates whether Afterpay (also known as Clearpay) payments are accepted. The default value is `false`. - * This option is allowed only for invoices that have a single payment request of the `BALANCE` type. This payment method is - * supported if the seller account accepts Afterpay payments and the seller location is in a country where Afterpay - * invoice payments are supported. As a best practice, consider enabling an additional payment method when allowing - * `buy_now_pay_later` payments. For more information, including detailed requirements and processing limits, see - * [Buy Now Pay Later payments with Afterpay](https://developer.squareup.com/docs/invoices-api/overview#buy-now-pay-later). - */ - buyNowPayLater?: boolean | null; - /** - * Indicates whether Cash App payments are accepted. The default value is `false`. - * This payment method is supported only for seller [locations](entity:Location) in the United States. - */ - cashAppPay?: boolean | null; -} - -export const invoiceAcceptedPaymentMethodsSchema: Schema = object( - { - card: ['card', optional(nullable(boolean()))], - squareGiftCard: ['square_gift_card', optional(nullable(boolean()))], - bankAccount: ['bank_account', optional(nullable(boolean()))], - buyNowPayLater: ['buy_now_pay_later', optional(nullable(boolean()))], - cashAppPay: ['cash_app_pay', optional(nullable(boolean()))], - } -); diff --git a/src/models/invoiceAttachment.ts b/src/models/invoiceAttachment.ts deleted file mode 100644 index f52814cc6..000000000 --- a/src/models/invoiceAttachment.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { number, object, optional, Schema, string } from '../schema'; - -/** Represents a file attached to an [invoice]($m/Invoice). */ -export interface InvoiceAttachment { - /** The Square-assigned ID of the attachment. */ - id?: string; - /** The file name of the attachment, which is displayed on the invoice. */ - filename?: string; - /** - * The description of the attachment, which is displayed on the invoice. - * This field maps to the seller-defined **Message** field. - */ - description?: string; - /** The file size of the attachment in bytes. */ - filesize?: number; - /** The MD5 hash that was generated from the file contents. */ - hash?: string; - /** - * The mime type of the attachment. - * The following mime types are supported: - * image/gif, image/jpeg, image/png, image/tiff, image/bmp, application/pdf. - */ - mimeType?: string; - /** The timestamp when the attachment was uploaded, in RFC 3339 format. */ - uploadedAt?: string; -} - -export const invoiceAttachmentSchema: Schema = object({ - id: ['id', optional(string())], - filename: ['filename', optional(string())], - description: ['description', optional(string())], - filesize: ['filesize', optional(number())], - hash: ['hash', optional(string())], - mimeType: ['mime_type', optional(string())], - uploadedAt: ['uploaded_at', optional(string())], -}); diff --git a/src/models/invoiceCustomField.ts b/src/models/invoiceCustomField.ts deleted file mode 100644 index 7abb6fdd8..000000000 --- a/src/models/invoiceCustomField.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * An additional seller-defined and customer-facing field to include on the invoice. For more information, - * see [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). - * Adding custom fields to an invoice requires an - * [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). - */ -export interface InvoiceCustomField { - /** The label or title of the custom field. This field is required for a custom field. */ - label?: string | null; - /** The text of the custom field. If omitted, only the label is rendered. */ - value?: string | null; - /** - * Indicates where to render a custom field on the Square-hosted invoice page and in emailed or PDF - * copies of the invoice. - */ - placement?: string; -} - -export const invoiceCustomFieldSchema: Schema = object({ - label: ['label', optional(nullable(string()))], - value: ['value', optional(nullable(string()))], - placement: ['placement', optional(string())], -}); diff --git a/src/models/invoiceFilter.ts b/src/models/invoiceFilter.ts deleted file mode 100644 index 9133410c2..000000000 --- a/src/models/invoiceFilter.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** Describes query filters to apply. */ -export interface InvoiceFilter { - /** - * Limits the search to the specified locations. A location is required. - * In the current implementation, only one location can be specified. - */ - locationIds: string[]; - /** - * Limits the search to the specified customers, within the specified locations. - * Specifying a customer is optional. In the current implementation, - * a maximum of one customer can be specified. - */ - customerIds?: string[] | null; -} - -export const invoiceFilterSchema: Schema = object({ - locationIds: ['location_ids', array(string())], - customerIds: ['customer_ids', optional(nullable(array(string())))], -}); diff --git a/src/models/invoicePaymentReminder.ts b/src/models/invoicePaymentReminder.ts deleted file mode 100644 index 74bcd705d..000000000 --- a/src/models/invoicePaymentReminder.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Describes a payment request reminder (automatic notification) that Square sends - * to the customer. You configure a reminder relative to the payment request - * `due_date`. - */ -export interface InvoicePaymentReminder { - /** - * A Square-assigned ID that uniquely identifies the reminder within the - * `InvoicePaymentRequest`. - */ - uid?: string; - /** - * The number of days before (a negative number) or after (a positive number) - * the payment request `due_date` when the reminder is sent. For example, -3 indicates that - * the reminder should be sent 3 days before the payment request `due_date`. - */ - relativeScheduledDays?: number | null; - /** The reminder message. */ - message?: string | null; - /** The status of a payment request reminder. */ - status?: string; - /** If sent, the timestamp when the reminder was sent, in RFC 3339 format. */ - sentAt?: string; -} - -export const invoicePaymentReminderSchema: Schema = object( - { - uid: ['uid', optional(string())], - relativeScheduledDays: [ - 'relative_scheduled_days', - optional(nullable(number())), - ], - message: ['message', optional(nullable(string()))], - status: ['status', optional(string())], - sentAt: ['sent_at', optional(string())], - } -); diff --git a/src/models/invoicePaymentRequest.ts b/src/models/invoicePaymentRequest.ts deleted file mode 100644 index 5bfc4a4af..000000000 --- a/src/models/invoicePaymentRequest.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - InvoicePaymentReminder, - invoicePaymentReminderSchema, -} from './invoicePaymentReminder'; -import { Money, moneySchema } from './money'; - -/** - * Represents a payment request for an [invoice]($m/Invoice). Invoices can specify a maximum - * of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information, - * see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). - * Adding `INSTALLMENT` payment requests to an invoice requires an - * [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). - */ -export interface InvoicePaymentRequest { - /** The Square-generated ID of the payment request in an [invoice](entity:Invoice). */ - uid?: string | null; - /** - * Specifies the action for Square to take for processing the invoice. For example, - * email the invoice, charge a customer's card on file, or do nothing. DEPRECATED at - * version 2021-01-21. The corresponding `request_method` field is replaced by the - * `Invoice.delivery_method` and `InvoicePaymentRequest.automatic_payment_source` fields. - */ - requestMethod?: string; - /** - * Indicates the type of the payment request. For more information, see - * [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). - */ - requestType?: string; - /** - * The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format. This field - * is required to create a payment request. If an `automatic_payment_source` is defined for the request, Square - * charges the payment source on this date. - * After this date, the invoice becomes overdue. For example, a payment `due_date` of 2021-03-09 with a `timezone` - * of America/Los\_Angeles becomes overdue at midnight on March 9 in America/Los\_Angeles (which equals a UTC - * timestamp of 2021-03-10T08:00:00Z). - */ - dueDate?: 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. - */ - fixedAmountRequestedMoney?: Money; - /** - * Specifies the amount for the payment request in percentage: - * - When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total amount. - * - When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's total less - * the deposit, if requested. The sum of the `percentage_requested` in all installment - * payment requests must be equal to 100. - * You cannot specify this when the payment `request_type` is `BALANCE` or when the - * payment request specifies the `fixed_amount_requested_money` field. - */ - percentageRequested?: string | null; - /** - * If set to true, the Square-hosted invoice page (the `public_url` field of the invoice) - * provides a place for the customer to pay a tip. - * This field is allowed only on the final payment request - * and the payment `request_type` must be `BALANCE` or `INSTALLMENT`. - */ - tippingEnabled?: boolean | null; - /** Indicates the automatic payment method for an [invoice payment request]($m/InvoicePaymentRequest). */ - automaticPaymentSource?: string; - /** - * The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer, - * call [ListCards](api-endpoint:Cards-ListCards) and include the `customer_id` of the invoice recipient. - */ - cardId?: string | null; - /** A list of one or more reminders to send for the payment request. */ - reminders?: InvoicePaymentReminder[] | 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. - */ - computedAmountMoney?: Money; - /** - * 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. - */ - totalCompletedAmountMoney?: Money; - /** - * 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. - */ - roundingAdjustmentIncludedMoney?: Money; -} - -export const invoicePaymentRequestSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - requestMethod: ['request_method', optional(string())], - requestType: ['request_type', optional(string())], - dueDate: ['due_date', optional(nullable(string()))], - fixedAmountRequestedMoney: [ - 'fixed_amount_requested_money', - optional(lazy(() => moneySchema)), - ], - percentageRequested: ['percentage_requested', optional(nullable(string()))], - tippingEnabled: ['tipping_enabled', optional(nullable(boolean()))], - automaticPaymentSource: ['automatic_payment_source', optional(string())], - cardId: ['card_id', optional(nullable(string()))], - reminders: [ - 'reminders', - optional(nullable(array(lazy(() => invoicePaymentReminderSchema)))), - ], - computedAmountMoney: [ - 'computed_amount_money', - optional(lazy(() => moneySchema)), - ], - totalCompletedAmountMoney: [ - 'total_completed_amount_money', - optional(lazy(() => moneySchema)), - ], - roundingAdjustmentIncludedMoney: [ - 'rounding_adjustment_included_money', - optional(lazy(() => moneySchema)), - ], - } -); diff --git a/src/models/invoiceQuery.ts b/src/models/invoiceQuery.ts deleted file mode 100644 index d3bb2e124..000000000 --- a/src/models/invoiceQuery.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { InvoiceFilter, invoiceFilterSchema } from './invoiceFilter'; -import { InvoiceSort, invoiceSortSchema } from './invoiceSort'; - -/** Describes query criteria for searching invoices. */ -export interface InvoiceQuery { - /** Describes query filters to apply. */ - filter: InvoiceFilter; - /** Identifies the sort field and sort order. */ - sort?: InvoiceSort; -} - -export const invoiceQuerySchema: Schema = object({ - filter: ['filter', lazy(() => invoiceFilterSchema)], - sort: ['sort', optional(lazy(() => invoiceSortSchema))], -}); diff --git a/src/models/invoiceRecipient.ts b/src/models/invoiceRecipient.ts deleted file mode 100644 index 59285ecbd..000000000 --- a/src/models/invoiceRecipient.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Address, addressSchema } from './address'; -import { - InvoiceRecipientTaxIds, - invoiceRecipientTaxIdsSchema, -} from './invoiceRecipientTaxIds'; - -/** - * Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice - * and that Square uses to deliver the invoice. - * When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates - * the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published. - * Square updates the customer ID in response to a merge operation, but does not update other fields. - */ -export interface InvoiceRecipient { - /** - * The ID of the customer. This is the customer profile ID that - * you provide when creating a draft invoice. - */ - customerId?: string | null; - /** The recipient's given (that is, first) name. */ - givenName?: string; - /** The recipient's family (that is, last) name. */ - familyName?: string; - /** The recipient's email address. */ - emailAddress?: string; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; - /** The recipient's phone number. */ - phoneNumber?: string; - /** The name of the recipient's company. */ - companyName?: string; - /** - * Represents the tax IDs for an invoice recipient. The country of the seller account determines - * whether the corresponding `tax_ids` field is available for the customer. For more information, - * see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). - */ - taxIds?: InvoiceRecipientTaxIds; -} - -export const invoiceRecipientSchema: Schema = object({ - customerId: ['customer_id', optional(nullable(string()))], - givenName: ['given_name', optional(string())], - familyName: ['family_name', optional(string())], - emailAddress: ['email_address', optional(string())], - address: ['address', optional(lazy(() => addressSchema))], - phoneNumber: ['phone_number', optional(string())], - companyName: ['company_name', optional(string())], - taxIds: ['tax_ids', optional(lazy(() => invoiceRecipientTaxIdsSchema))], -}); diff --git a/src/models/invoiceRecipientTaxIds.ts b/src/models/invoiceRecipientTaxIds.ts deleted file mode 100644 index de5b3eea0..000000000 --- a/src/models/invoiceRecipientTaxIds.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Represents the tax IDs for an invoice recipient. The country of the seller account determines - * whether the corresponding `tax_ids` field is available for the customer. For more information, - * see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). - */ -export interface InvoiceRecipientTaxIds { - /** The EU VAT identification number for the invoice recipient. For example, `IE3426675K`. */ - euVat?: string; -} - -export const invoiceRecipientTaxIdsSchema: Schema = object( - { euVat: ['eu_vat', optional(string())] } -); diff --git a/src/models/invoiceSort.ts b/src/models/invoiceSort.ts deleted file mode 100644 index ddca0d1c9..000000000 --- a/src/models/invoiceSort.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Identifies the sort field and sort order. */ -export interface InvoiceSort { - /** The field to use for sorting. */ - field: string; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - order?: string; -} - -export const invoiceSortSchema: Schema = object({ - field: ['field', string()], - order: ['order', optional(string())], -}); diff --git a/src/models/itemVariationLocationOverrides.ts b/src/models/itemVariationLocationOverrides.ts deleted file mode 100644 index a6b027d6a..000000000 --- a/src/models/itemVariationLocationOverrides.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - bigint, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** Price and inventory alerting overrides for a `CatalogItemVariation` at a specific `Location`. */ -export interface ItemVariationLocationOverrides { - /** The ID of the `Location`. This can include locations that are deactivated. */ - locationId?: 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; - /** Indicates whether the price of a CatalogItemVariation should be entered manually at the time of sale. */ - pricingType?: string; - /** If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`. */ - trackInventory?: boolean | null; - /** Indicates whether Square should alert the merchant when the inventory quantity of a CatalogItemVariation is low. */ - inventoryAlertType?: string; - /** - * If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` - * is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. - * This value is always an integer. - */ - inventoryAlertThreshold?: bigint | null; - /** - * Indicates whether the overridden item variation is sold out at the specified location. - * When inventory tracking is enabled on the item variation either globally or at the specified location, - * the item variation is automatically marked as sold out when its inventory count reaches zero. The seller - * can manually set the item variation as sold out even when the inventory count is greater than zero. - * Attempts by an application to set this attribute are ignored. Regardless how the sold-out status is set, - * applications should treat its inventory count as zero when this attribute value is `true`. - */ - soldOut?: boolean; - /** - * The seller-assigned timestamp, of the RFC 3339 format, to indicate when this sold-out variation - * becomes available again at the specified location. Attempts by an application to set this attribute are ignored. - * When the current time is later than this attribute value, the affected item variation is no longer sold out. - */ - soldOutValidUntil?: string; -} - -export const itemVariationLocationOverridesSchema: Schema = object( - { - locationId: ['location_id', optional(nullable(string()))], - priceMoney: ['price_money', optional(lazy(() => moneySchema))], - pricingType: ['pricing_type', optional(string())], - trackInventory: ['track_inventory', optional(nullable(boolean()))], - inventoryAlertType: ['inventory_alert_type', optional(string())], - inventoryAlertThreshold: [ - 'inventory_alert_threshold', - optional(nullable(bigint())), - ], - soldOut: ['sold_out', optional(boolean())], - soldOutValidUntil: ['sold_out_valid_until', optional(string())], - } -); diff --git a/src/models/job.ts b/src/models/job.ts deleted file mode 100644 index 49befba83..000000000 --- a/src/models/job.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * Represents a job that can be assigned to [team members]($m/TeamMember). This object defines the - * job's title and tip eligibility. Compensation is defined in a [job assignment]($m/JobAssignment) - * in a team member's wage setting. - */ -export interface Job { - /** - * **Read only** The unique Square-assigned ID of the job. If you need a job ID for an API request, - * call [ListJobs](api-endpoint:Team-ListJobs) or use the ID returned when you created the job. - * You can also get job IDs from a team member's wage setting. - */ - id?: string; - /** The title of the job. */ - title?: string | null; - /** Indicates whether team members can earn tips for the job. */ - isTipEligible?: boolean | null; - /** The timestamp when the job was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the job was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** - * **Read only** The current version of the job. Include this field in `UpdateJob` requests to enable - * [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency) - * control and avoid overwrites from concurrent requests. Requests fail if the provided version doesn't - * match the server version at the time of the request. - */ - version?: number; -} - -export const jobSchema: Schema = object({ - id: ['id', optional(string())], - title: ['title', optional(nullable(string()))], - isTipEligible: ['is_tip_eligible', optional(nullable(boolean()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - version: ['version', optional(number())], -}); diff --git a/src/models/jobAssignment.ts b/src/models/jobAssignment.ts deleted file mode 100644 index eda6f606e..000000000 --- a/src/models/jobAssignment.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents a job assigned to a [team member]($m/TeamMember), including the compensation the team - * member earns for the job. Job assignments are listed in the team member's [wage setting]($m/WageSetting). - */ -export interface JobAssignment { - /** The title of the job. */ - jobTitle?: string | null; - /** Enumerates the possible pay types that a job can be assigned. */ - payType: string; - /** - * 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. - */ - hourlyRate?: Money; - /** - * 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. - */ - annualRate?: Money; - /** The planned hours per week for the job. Set if the job `PayType` is `SALARY`. */ - weeklyHours?: number | null; - /** The ID of the [job]($m/Job). */ - jobId?: string | null; -} - -export const jobAssignmentSchema: Schema = object({ - jobTitle: ['job_title', optional(nullable(string()))], - payType: ['pay_type', string()], - hourlyRate: ['hourly_rate', optional(lazy(() => moneySchema))], - annualRate: ['annual_rate', optional(lazy(() => moneySchema))], - weeklyHours: ['weekly_hours', optional(nullable(number()))], - jobId: ['job_id', optional(nullable(string()))], -}); diff --git a/src/models/linkCustomerToGiftCardRequest.ts b/src/models/linkCustomerToGiftCardRequest.ts deleted file mode 100644 index 6d2ac6bd2..000000000 --- a/src/models/linkCustomerToGiftCardRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** A request to link a customer to a gift card. */ -export interface LinkCustomerToGiftCardRequest { - /** The ID of the customer to link to the gift card. */ - customerId: string; -} - -export const linkCustomerToGiftCardRequestSchema: Schema = object( - { customerId: ['customer_id', string()] } -); diff --git a/src/models/linkCustomerToGiftCardResponse.ts b/src/models/linkCustomerToGiftCardResponse.ts deleted file mode 100644 index fe98bd638..000000000 --- a/src/models/linkCustomerToGiftCardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCard, giftCardSchema } from './giftCard'; - -/** - * A response that contains the linked `GiftCard` object. If the request resulted in errors, - * the response contains a set of `Error` objects. - */ -export interface LinkCustomerToGiftCardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square gift card. */ - giftCard?: GiftCard; -} - -export const linkCustomerToGiftCardResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCard: ['gift_card', optional(lazy(() => giftCardSchema))], - } -); diff --git a/src/models/listBankAccountsRequest.ts b/src/models/listBankAccountsRequest.ts deleted file mode 100644 index f7731771e..000000000 --- a/src/models/listBankAccountsRequest.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Request object for fetching all `BankAccount` - * objects linked to a account. - */ -export interface ListBankAccountsRequest { - /** - * The pagination cursor returned by a previous call to this endpoint. - * Use it in the next `ListBankAccounts` request to retrieve the next set - * of results. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string | null; - /** - * Upper limit on the number of bank accounts to return in the response. - * Currently, 1000 is the largest supported limit. You can specify a limit - * of up to 1000 bank accounts. This is also the default limit. - */ - limit?: number | null; - /** - * Location ID. You can specify this optional filter - * to retrieve only the linked bank accounts belonging to a specific location. - */ - locationId?: string | null; -} - -export const listBankAccountsRequestSchema: Schema = object( - { - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - locationId: ['location_id', optional(nullable(string()))], - } -); diff --git a/src/models/listBankAccountsResponse.ts b/src/models/listBankAccountsResponse.ts deleted file mode 100644 index 8cae62da4..000000000 --- a/src/models/listBankAccountsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { BankAccount, bankAccountSchema } from './bankAccount'; -import { Error, errorSchema } from './error'; - -/** Response object returned by ListBankAccounts. */ -export interface ListBankAccountsResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** List of BankAccounts associated with this account. */ - bankAccounts?: BankAccount[]; - /** - * When a response is truncated, it includes a cursor that you can - * use in a subsequent request to fetch next set of bank accounts. - * If empty, this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string; -} - -export const listBankAccountsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - bankAccounts: [ - 'bank_accounts', - optional(array(lazy(() => bankAccountSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listBookingCustomAttributeDefinitionsRequest.ts b/src/models/listBookingCustomAttributeDefinitionsRequest.ts deleted file mode 100644 index b9a63cbd1..000000000 --- a/src/models/listBookingCustomAttributeDefinitionsRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Represents a [ListBookingCustomAttributeDefinitions]($e/BookingCustomAttributes/ListBookingCustomAttributeDefinitions) request. */ -export interface ListBookingCustomAttributeDefinitionsRequest { - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; -} - -export const listBookingCustomAttributeDefinitionsRequestSchema: Schema = object( - { - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listBookingCustomAttributeDefinitionsResponse.ts b/src/models/listBookingCustomAttributeDefinitionsResponse.ts deleted file mode 100644 index f06e1c818..000000000 --- a/src/models/listBookingCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [ListBookingCustomAttributeDefinitions]($e/BookingCustomAttributes/ListBookingCustomAttributeDefinitions) response. - * Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. - * If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. - */ -export interface ListBookingCustomAttributeDefinitionsResponse { - /** - * The retrieved custom attribute definitions. If no custom attribute definitions are found, - * Square returns an empty object (`{}`). - */ - customAttributeDefinitions?: CustomAttributeDefinition[]; - /** - * The cursor to provide in your next call to this endpoint to retrieve the next page of - * results for your original request. This field is present only if the request succeeded and - * additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listBookingCustomAttributeDefinitionsResponseSchema: Schema = object( - { - customAttributeDefinitions: [ - 'custom_attribute_definitions', - optional(array(lazy(() => customAttributeDefinitionSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listBookingCustomAttributesRequest.ts b/src/models/listBookingCustomAttributesRequest.ts deleted file mode 100644 index f325f6c54..000000000 --- a/src/models/listBookingCustomAttributesRequest.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** Represents a [ListBookingCustomAttributes]($e/BookingCustomAttributes/ListBookingCustomAttributes) request. */ -export interface ListBookingCustomAttributesRequest { - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each - * custom attribute. Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The default value is `false`. - */ - withDefinitions?: boolean | null; -} - -export const listBookingCustomAttributesRequestSchema: Schema = object( - { - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - withDefinitions: ['with_definitions', optional(nullable(boolean()))], - } -); diff --git a/src/models/listBookingCustomAttributesResponse.ts b/src/models/listBookingCustomAttributesResponse.ts deleted file mode 100644 index 24d4fbf8f..000000000 --- a/src/models/listBookingCustomAttributesResponse.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [ListBookingCustomAttributes]($e/BookingCustomAttributes/ListBookingCustomAttributes) response. - * Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional - * results are available, the `cursor` field is also present along with `custom_attributes`. - */ -export interface ListBookingCustomAttributesResponse { - /** - * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, - * the custom attribute definition is returned in the `definition` field of each custom attribute. - * If no custom attributes are found, Square returns an empty object (`{}`). - */ - customAttributes?: CustomAttribute[]; - /** - * The cursor to use in your next call to this endpoint to retrieve the next page of results - * for your original request. This field is present only if the request succeeded and additional - * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listBookingCustomAttributesResponseSchema: Schema = object( - { - customAttributes: [ - 'custom_attributes', - optional(array(lazy(() => customAttributeSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listBookingsRequest.ts b/src/models/listBookingsRequest.ts deleted file mode 100644 index e265c901f..000000000 --- a/src/models/listBookingsRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface ListBookingsRequest { - /** The maximum number of results per page to return in a paged response. */ - limit?: number | null; - /** The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. */ - cursor?: string | null; - /** The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all customers are retrieved. */ - customerId?: string | null; - /** The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved. */ - teamMemberId?: string | null; - /** The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved. */ - locationId?: string | null; - /** The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used. */ - startAtMin?: string | null; - /** The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days after `start_at_min` is used. */ - startAtMax?: string | null; -} - -export const listBookingsRequestSchema: Schema = object({ - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - customerId: ['customer_id', optional(nullable(string()))], - teamMemberId: ['team_member_id', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - startAtMin: ['start_at_min', optional(nullable(string()))], - startAtMax: ['start_at_max', optional(nullable(string()))], -}); diff --git a/src/models/listBookingsResponse.ts b/src/models/listBookingsResponse.ts deleted file mode 100644 index 741fd3958..000000000 --- a/src/models/listBookingsResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Booking, bookingSchema } from './booking'; -import { Error, errorSchema } from './error'; - -export interface ListBookingsResponse { - /** The list of targeted bookings. */ - bookings?: Booking[]; - /** The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. */ - cursor?: string; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const listBookingsResponseSchema: Schema = object({ - bookings: ['bookings', optional(array(lazy(() => bookingSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/listBreakTypesRequest.ts b/src/models/listBreakTypesRequest.ts deleted file mode 100644 index 41b46f403..000000000 --- a/src/models/listBreakTypesRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** A request for a filtered set of `BreakType` objects. */ -export interface ListBreakTypesRequest { - /** - * Filter the returned `BreakType` results to only those that are associated with the - * specified location. - */ - locationId?: string | null; - /** - * The maximum number of `BreakType` results to return per page. The number can range between 1 - * and 200. The default is 200. - */ - limit?: number | null; - /** A pointer to the next page of `BreakType` results to fetch. */ - cursor?: string | null; -} - -export const listBreakTypesRequestSchema: Schema = object( - { - locationId: ['location_id', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listBreakTypesResponse.ts b/src/models/listBreakTypesResponse.ts deleted file mode 100644 index 9b77f1fcf..000000000 --- a/src/models/listBreakTypesResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { BreakType, breakTypeSchema } from './breakType'; -import { Error, errorSchema } from './error'; - -/** - * The response to a request for a set of `BreakType` objects. The response contains - * the requested `BreakType` objects and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface ListBreakTypesResponse { - /** A page of `BreakType` results. */ - breakTypes?: BreakType[]; - /** - * The value supplied in the subsequent request to fetch the next page - * of `BreakType` results. - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listBreakTypesResponseSchema: Schema = object( - { - breakTypes: ['break_types', optional(array(lazy(() => breakTypeSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listCardsRequest.ts b/src/models/listCardsRequest.ts deleted file mode 100644 index 63404fd4a..000000000 --- a/src/models/listCardsRequest.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** - * Retrieves details for a specific Card. Accessible via - * HTTP requests at GET https://connect.squareup.com/v2/cards - */ -export interface ListCardsRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for your original query. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string | null; - /** - * Limit results to cards associated with the customer supplied. - * By default, all cards owned by the merchant are returned. - */ - customerId?: string | null; - /** - * Includes disabled cards. - * By default, all enabled cards owned by the merchant are returned. - */ - includeDisabled?: boolean | null; - /** Limit results to cards associated with the reference_id supplied. */ - referenceId?: string | null; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; -} - -export const listCardsRequestSchema: Schema = object({ - cursor: ['cursor', optional(nullable(string()))], - customerId: ['customer_id', optional(nullable(string()))], - includeDisabled: ['include_disabled', optional(nullable(boolean()))], - referenceId: ['reference_id', optional(nullable(string()))], - sortOrder: ['sort_order', optional(string())], -}); diff --git a/src/models/listCardsResponse.ts b/src/models/listCardsResponse.ts deleted file mode 100644 index a5ff4ef2f..000000000 --- a/src/models/listCardsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Card, cardSchema } from './card'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [ListCards]($e/Cards/ListCards) endpoint. - * Note: if there are errors processing the request, the card field will not be - * present. - */ -export interface ListCardsResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** The requested list of `Card`s. */ - cards?: Card[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, - * this is the final response. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string; -} - -export const listCardsResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - cards: ['cards', optional(array(lazy(() => cardSchema)))], - cursor: ['cursor', optional(string())], -}); diff --git a/src/models/listCashDrawerShiftEventsRequest.ts b/src/models/listCashDrawerShiftEventsRequest.ts deleted file mode 100644 index fe92275fe..000000000 --- a/src/models/listCashDrawerShiftEventsRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface ListCashDrawerShiftEventsRequest { - /** The ID of the location to list cash drawer shifts for. */ - locationId: string; - /** - * Number of resources to be returned in a page of results (200 by - * default, 1000 max). - */ - limit?: number | null; - /** Opaque cursor for fetching the next page of results. */ - cursor?: string | null; -} - -export const listCashDrawerShiftEventsRequestSchema: Schema = object( - { - locationId: ['location_id', string()], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listCashDrawerShiftEventsResponse.ts b/src/models/listCashDrawerShiftEventsResponse.ts deleted file mode 100644 index 184bad956..000000000 --- a/src/models/listCashDrawerShiftEventsResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { - CashDrawerShiftEvent, - cashDrawerShiftEventSchema, -} from './cashDrawerShiftEvent'; -import { Error, errorSchema } from './error'; - -export interface ListCashDrawerShiftEventsResponse { - /** - * Opaque cursor for fetching the next page. Cursor is not present in - * the last page of results. - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * All of the events (payments, refunds, etc.) for a cash drawer during - * the shift. - */ - cashDrawerShiftEvents?: CashDrawerShiftEvent[]; -} - -export const listCashDrawerShiftEventsResponseSchema: Schema = object( - { - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - cashDrawerShiftEvents: [ - 'cash_drawer_shift_events', - optional(array(lazy(() => cashDrawerShiftEventSchema))), - ], - } -); diff --git a/src/models/listCashDrawerShiftsRequest.ts b/src/models/listCashDrawerShiftsRequest.ts deleted file mode 100644 index b39bff10c..000000000 --- a/src/models/listCashDrawerShiftsRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface ListCashDrawerShiftsRequest { - /** The ID of the location to query for a list of cash drawer shifts. */ - locationId: string; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** The inclusive start time of the query on opened_at, in ISO 8601 format. */ - beginTime?: string | null; - /** The exclusive end date of the query on opened_at, in ISO 8601 format. */ - endTime?: string | null; - /** - * Number of cash drawer shift events in a page of results (200 by - * default, 1000 max). - */ - limit?: number | null; - /** Opaque cursor for fetching the next page of results. */ - cursor?: string | null; -} - -export const listCashDrawerShiftsRequestSchema: Schema = object( - { - locationId: ['location_id', string()], - sortOrder: ['sort_order', optional(string())], - beginTime: ['begin_time', optional(nullable(string()))], - endTime: ['end_time', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listCashDrawerShiftsResponse.ts b/src/models/listCashDrawerShiftsResponse.ts deleted file mode 100644 index 8c92b217c..000000000 --- a/src/models/listCashDrawerShiftsResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { - CashDrawerShiftSummary, - cashDrawerShiftSummarySchema, -} from './cashDrawerShiftSummary'; -import { Error, errorSchema } from './error'; - -export interface ListCashDrawerShiftsResponse { - /** - * Opaque cursor for fetching the next page of results. Cursor is not - * present in the last page of results. - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * A collection of CashDrawerShiftSummary objects for shifts that match - * the query. - */ - cashDrawerShifts?: CashDrawerShiftSummary[]; -} - -export const listCashDrawerShiftsResponseSchema: Schema = object( - { - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - cashDrawerShifts: [ - 'cash_drawer_shifts', - optional(array(lazy(() => cashDrawerShiftSummarySchema))), - ], - } -); diff --git a/src/models/listCatalogRequest.ts b/src/models/listCatalogRequest.ts deleted file mode 100644 index 02287ee7b..000000000 --- a/src/models/listCatalogRequest.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { bigint, nullable, object, optional, Schema, string } from '../schema'; - -export interface ListCatalogRequest { - /** - * The pagination cursor returned in the previous response. Leave unset for an initial request. - * The page size is currently set to be 100. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string | null; - /** - * An optional case-insensitive, comma-separated list of object types to retrieve. - * The valid values are defined in the [CatalogObjectType](entity:CatalogObjectType) enum, for example, - * `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`, - * `MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc. - * If this is unspecified, the operation returns objects of all the top level types at the version - * of the Square API used to make the request. Object types that are nested onto other object types - * are not included in the defaults. - * At the current API version the default object types are: - * ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, - * PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, - * SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. - */ - types?: string | null; - /** - * The specific version of the catalog objects to be included in the response. - * This allows you to retrieve historical versions of objects. The specified version value is matched against - * the [CatalogObject]($m/CatalogObject)s' `version` attribute. If not included, results will be from the - * current version of the catalog. - */ - catalogVersion?: bigint | null; -} - -export const listCatalogRequestSchema: Schema = object({ - cursor: ['cursor', optional(nullable(string()))], - types: ['types', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], -}); diff --git a/src/models/listCatalogResponse.ts b/src/models/listCatalogResponse.ts deleted file mode 100644 index e1a290710..000000000 --- a/src/models/listCatalogResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -export interface ListCatalogResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The pagination cursor to be used in a subsequent request. If unset, this is the final response. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string; - /** The CatalogObjects returned. */ - objects?: CatalogObject[]; -} - -export const listCatalogResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - cursor: ['cursor', optional(string())], - objects: ['objects', optional(array(lazy(() => catalogObjectSchema)))], -}); diff --git a/src/models/listCustomerCustomAttributeDefinitionsRequest.ts b/src/models/listCustomerCustomAttributeDefinitionsRequest.ts deleted file mode 100644 index caed73f6a..000000000 --- a/src/models/listCustomerCustomAttributeDefinitionsRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Represents a [ListCustomerCustomAttributeDefinitions]($e/CustomerCustomAttributes/ListCustomerCustomAttributeDefinitions) request. */ -export interface ListCustomerCustomAttributeDefinitionsRequest { - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; -} - -export const listCustomerCustomAttributeDefinitionsRequestSchema: Schema = object( - { - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listCustomerCustomAttributeDefinitionsResponse.ts b/src/models/listCustomerCustomAttributeDefinitionsResponse.ts deleted file mode 100644 index 3c1b98203..000000000 --- a/src/models/listCustomerCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [ListCustomerCustomAttributeDefinitions]($e/CustomerCustomAttributes/ListCustomerCustomAttributeDefinitions) response. - * Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. - * If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. - */ -export interface ListCustomerCustomAttributeDefinitionsResponse { - /** - * The retrieved custom attribute definitions. If no custom attribute definitions are found, - * Square returns an empty object (`{}`). - */ - customAttributeDefinitions?: CustomAttributeDefinition[]; - /** - * The cursor to provide in your next call to this endpoint to retrieve the next page of - * results for your original request. This field is present only if the request succeeded and - * additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listCustomerCustomAttributeDefinitionsResponseSchema: Schema = object( - { - customAttributeDefinitions: [ - 'custom_attribute_definitions', - optional(array(lazy(() => customAttributeDefinitionSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listCustomerCustomAttributesRequest.ts b/src/models/listCustomerCustomAttributesRequest.ts deleted file mode 100644 index 9e99a59fc..000000000 --- a/src/models/listCustomerCustomAttributesRequest.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** Represents a [ListCustomerCustomAttributes]($e/CustomerCustomAttributes/ListCustomerCustomAttributes) request. */ -export interface ListCustomerCustomAttributesRequest { - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each - * custom attribute. Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The default value is `false`. - */ - withDefinitions?: boolean | null; -} - -export const listCustomerCustomAttributesRequestSchema: Schema = object( - { - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - withDefinitions: ['with_definitions', optional(nullable(boolean()))], - } -); diff --git a/src/models/listCustomerCustomAttributesResponse.ts b/src/models/listCustomerCustomAttributesResponse.ts deleted file mode 100644 index 3d26315f4..000000000 --- a/src/models/listCustomerCustomAttributesResponse.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [ListCustomerCustomAttributes]($e/CustomerCustomAttributes/ListCustomerCustomAttributes) response. - * Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional - * results are available, the `cursor` field is also present along with `custom_attributes`. - */ -export interface ListCustomerCustomAttributesResponse { - /** - * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, - * the custom attribute definition is returned in the `definition` field of each custom attribute. - * If no custom attributes are found, Square returns an empty object (`{}`). - */ - customAttributes?: CustomAttribute[]; - /** - * The cursor to use in your next call to this endpoint to retrieve the next page of results - * for your original request. This field is present only if the request succeeded and additional - * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listCustomerCustomAttributesResponseSchema: Schema = object( - { - customAttributes: [ - 'custom_attributes', - optional(array(lazy(() => customAttributeSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listCustomerGroupsRequest.ts b/src/models/listCustomerGroupsRequest.ts deleted file mode 100644 index e5c4abfc1..000000000 --- a/src/models/listCustomerGroupsRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Defines the query parameters that can be included in a request to the - * [ListCustomerGroups]($e/CustomerGroups/ListCustomerGroups) endpoint. - */ -export interface ListCustomerGroupsRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for your original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. - * If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; -} - -export const listCustomerGroupsRequestSchema: Schema = object( - { - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listCustomerGroupsResponse.ts b/src/models/listCustomerGroupsResponse.ts deleted file mode 100644 index 5483b9ef6..000000000 --- a/src/models/listCustomerGroupsResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomerGroup, customerGroupSchema } from './customerGroup'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [ListCustomerGroups]($e/CustomerGroups/ListCustomerGroups) endpoint. - * Either `errors` or `groups` is present in a given response (never both). - */ -export interface ListCustomerGroupsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** A list of customer groups belonging to the current seller. */ - groups?: CustomerGroup[]; - /** - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. This value is present only if the request - * succeeded and additional results are available. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listCustomerGroupsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - groups: ['groups', optional(array(lazy(() => customerGroupSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listCustomerSegmentsRequest.ts b/src/models/listCustomerSegmentsRequest.ts deleted file mode 100644 index a2e2a18bc..000000000 --- a/src/models/listCustomerSegmentsRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Defines the valid parameters for requests to the `ListCustomerSegments` endpoint. */ -export interface ListCustomerSegmentsRequest { - /** - * A pagination cursor returned by previous calls to `ListCustomerSegments`. - * This cursor is used to retrieve the next set of query results. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. - * If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; -} - -export const listCustomerSegmentsRequestSchema: Schema = object( - { - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listCustomerSegmentsResponse.ts b/src/models/listCustomerSegmentsResponse.ts deleted file mode 100644 index b99129b54..000000000 --- a/src/models/listCustomerSegmentsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomerSegment, customerSegmentSchema } from './customerSegment'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint. - * Either `errors` or `segments` is present in a given response (never both). - */ -export interface ListCustomerSegmentsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The list of customer segments belonging to the associated Square account. */ - segments?: CustomerSegment[]; - /** - * A pagination cursor to be used in subsequent calls to `ListCustomerSegments` - * to retrieve the next set of query results. The cursor is only present if the request succeeded and - * additional results are available. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listCustomerSegmentsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - segments: ['segments', optional(array(lazy(() => customerSegmentSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listCustomersRequest.ts b/src/models/listCustomersRequest.ts deleted file mode 100644 index d5b11572d..000000000 --- a/src/models/listCustomersRequest.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * Defines the query parameters that can be included in a request to the - * `ListCustomers` endpoint. - */ -export interface ListCustomersRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for your original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. - * If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** Specifies customer attributes as the sort key to customer profiles returned from a search. */ - sortField?: string; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** - * Indicates whether to return the total count of customers in the `count` field of the response. - * The default value is `false`. - */ - count?: boolean | null; -} - -export const listCustomersRequestSchema: Schema = object({ - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - sortField: ['sort_field', optional(string())], - sortOrder: ['sort_order', optional(string())], - count: ['count', optional(nullable(boolean()))], -}); diff --git a/src/models/listCustomersResponse.ts b/src/models/listCustomersResponse.ts deleted file mode 100644 index 37472fdec..000000000 --- a/src/models/listCustomersResponse.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - array, - bigint, - lazy, - object, - optional, - Schema, - string, -} from '../schema'; -import { Customer, customerSchema } from './customer'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the `ListCustomers` endpoint. - * Either `errors` or `customers` is present in a given response (never both). - */ -export interface ListCustomersResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The customer profiles associated with the Square account or an empty object (`{}`) if none are found. - * Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or - * `phone_number`) are included in the response. - */ - customers?: Customer[]; - /** - * A pagination cursor to retrieve the next set of results for the - * original query. A cursor is only present if the request succeeded and additional results - * are available. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** - * The total count of customers associated with the Square account. Only customer profiles with public information - * (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is present - * only if `count` is set to `true` in the request. - */ - count?: bigint; -} - -export const listCustomersResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - customers: ['customers', optional(array(lazy(() => customerSchema)))], - cursor: ['cursor', optional(string())], - count: ['count', optional(bigint())], - } -); diff --git a/src/models/listDeviceCodesRequest.ts b/src/models/listDeviceCodesRequest.ts deleted file mode 100644 index 18aa695a6..000000000 --- a/src/models/listDeviceCodesRequest.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -export interface ListDeviceCodesRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for your original query. - * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - */ - cursor?: string | null; - /** - * If specified, only returns DeviceCodes of the specified location. - * Returns DeviceCodes of all locations if empty. - */ - locationId?: string | null; - productType?: string; - /** - * If specified, returns DeviceCodes with the specified statuses. - * Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. - * See [DeviceCodeStatus](#type-devicecodestatus) for possible values - */ - status?: string[] | null; -} - -export const listDeviceCodesRequestSchema: Schema = object( - { - cursor: ['cursor', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - productType: ['product_type', optional(string())], - status: ['status', optional(nullable(array(string())))], - } -); diff --git a/src/models/listDeviceCodesResponse.ts b/src/models/listDeviceCodesResponse.ts deleted file mode 100644 index d41148d83..000000000 --- a/src/models/listDeviceCodesResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { DeviceCode, deviceCodeSchema } from './deviceCode'; -import { Error, errorSchema } from './error'; - -export interface ListDeviceCodesResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The queried DeviceCode. */ - deviceCodes?: DeviceCode[]; - /** - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. This value is present only if the request - * succeeded and additional results are available. - * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - */ - cursor?: string; -} - -export const listDeviceCodesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - deviceCodes: [ - 'device_codes', - optional(array(lazy(() => deviceCodeSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listDevicesRequest.ts b/src/models/listDevicesRequest.ts deleted file mode 100644 index 286be3691..000000000 --- a/src/models/listDevicesRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface ListDevicesRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string | null; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** The number of results to return in a single page. */ - limit?: number | null; - /** If present, only returns devices at the target location. */ - locationId?: string | null; -} - -export const listDevicesRequestSchema: Schema = object({ - cursor: ['cursor', optional(nullable(string()))], - sortOrder: ['sort_order', optional(string())], - limit: ['limit', optional(nullable(number()))], - locationId: ['location_id', optional(nullable(string()))], -}); diff --git a/src/models/listDevicesResponse.ts b/src/models/listDevicesResponse.ts deleted file mode 100644 index ff549c6bf..000000000 --- a/src/models/listDevicesResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Device, deviceSchema } from './device'; -import { Error, errorSchema } from './error'; - -export interface ListDevicesResponse { - /** Information about errors that occurred during the request. */ - errors?: Error[]; - /** The requested list of `Device` objects. */ - devices?: Device[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, - * this is the final response. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string; -} - -export const listDevicesResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - devices: ['devices', optional(array(lazy(() => deviceSchema)))], - cursor: ['cursor', optional(string())], -}); diff --git a/src/models/listDisputeEvidenceRequest.ts b/src/models/listDisputeEvidenceRequest.ts deleted file mode 100644 index bd0625021..000000000 --- a/src/models/listDisputeEvidenceRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Defines the parameters for a `ListDisputeEvidence` request. */ -export interface ListDisputeEvidenceRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; -} - -export const listDisputeEvidenceRequestSchema: Schema = object( - { cursor: ['cursor', optional(nullable(string()))] } -); diff --git a/src/models/listDisputeEvidenceResponse.ts b/src/models/listDisputeEvidenceResponse.ts deleted file mode 100644 index 93359c754..000000000 --- a/src/models/listDisputeEvidenceResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { DisputeEvidence, disputeEvidenceSchema } from './disputeEvidence'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in a `ListDisputeEvidence` response. */ -export interface ListDisputeEvidenceResponse { - /** The list of evidence previously uploaded to the specified dispute. */ - evidence?: DisputeEvidence[]; - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** - * The pagination cursor to be used in a subsequent request. - * If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listDisputeEvidenceResponseSchema: Schema = object( - { - evidence: ['evidence', optional(array(lazy(() => disputeEvidenceSchema)))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listDisputesRequest.ts b/src/models/listDisputesRequest.ts deleted file mode 100644 index 0320012d0..000000000 --- a/src/models/listDisputesRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** Defines the request parameters for the `ListDisputes` endpoint. */ -export interface ListDisputesRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * The dispute states used to filter the result. If not specified, the endpoint returns all disputes. - * See [DisputeState](#type-disputestate) for possible values - */ - states?: string[] | null; - /** - * The ID of the location for which to return a list of disputes. - * If not specified, the endpoint returns disputes associated with all locations. - */ - locationId?: string | null; -} - -export const listDisputesRequestSchema: Schema = object({ - cursor: ['cursor', optional(nullable(string()))], - states: ['states', optional(nullable(array(string())))], - locationId: ['location_id', optional(nullable(string()))], -}); diff --git a/src/models/listDisputesResponse.ts b/src/models/listDisputesResponse.ts deleted file mode 100644 index e3636bfdc..000000000 --- a/src/models/listDisputesResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Dispute, disputeSchema } from './dispute'; -import { Error, errorSchema } from './error'; - -/** Defines fields in a `ListDisputes` response. */ -export interface ListDisputesResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** The list of disputes. */ - disputes?: Dispute[]; - /** - * The pagination cursor to be used in a subsequent request. - * If unset, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listDisputesResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - disputes: ['disputes', optional(array(lazy(() => disputeSchema)))], - cursor: ['cursor', optional(string())], -}); diff --git a/src/models/listEmployeeWagesRequest.ts b/src/models/listEmployeeWagesRequest.ts deleted file mode 100644 index 85b906624..000000000 --- a/src/models/listEmployeeWagesRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** A request for a set of `EmployeeWage` objects. */ -export interface ListEmployeeWagesRequest { - /** Filter the returned wages to only those that are associated with the specified employee. */ - employeeId?: string | null; - /** - * The maximum number of `EmployeeWage` results to return per page. The number can range between - * 1 and 200. The default is 200. - */ - limit?: number | null; - /** A pointer to the next page of `EmployeeWage` results to fetch. */ - cursor?: string | null; -} - -export const listEmployeeWagesRequestSchema: Schema = object( - { - employeeId: ['employee_id', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listEmployeeWagesResponse.ts b/src/models/listEmployeeWagesResponse.ts deleted file mode 100644 index 56a451a39..000000000 --- a/src/models/listEmployeeWagesResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { EmployeeWage, employeeWageSchema } from './employeeWage'; -import { Error, errorSchema } from './error'; - -/** - * The response to a request for a set of `EmployeeWage` objects. The response contains - * a set of `EmployeeWage` objects. - */ -export interface ListEmployeeWagesResponse { - /** A page of `EmployeeWage` results. */ - employeeWages?: EmployeeWage[]; - /** - * The value supplied in the subsequent request to fetch the next page - * of `EmployeeWage` results. - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listEmployeeWagesResponseSchema: Schema = object( - { - employeeWages: [ - 'employee_wages', - optional(array(lazy(() => employeeWageSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listEmployeesRequest.ts b/src/models/listEmployeesRequest.ts deleted file mode 100644 index 144f36419..000000000 --- a/src/models/listEmployeesRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface ListEmployeesRequest { - locationId?: string | null; - /** - * The status of the Employee being retrieved. - * DEPRECATED at version 2020-08-26. Replaced by [TeamMemberStatus](entity:TeamMemberStatus). - */ - status?: string; - /** The number of employees to be returned on each page. */ - limit?: number | null; - /** The token required to retrieve the specified page of results. */ - cursor?: string | null; -} - -export const listEmployeesRequestSchema: Schema = object({ - locationId: ['location_id', optional(nullable(string()))], - status: ['status', optional(string())], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], -}); diff --git a/src/models/listEmployeesResponse.ts b/src/models/listEmployeesResponse.ts deleted file mode 100644 index 6ddc0d4b1..000000000 --- a/src/models/listEmployeesResponse.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Employee, employeeSchema } from './employee'; -import { Error, errorSchema } from './error'; - -export interface ListEmployeesResponse { - employees?: Employee[]; - /** The token to be used to retrieve the next page of results. */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listEmployeesResponseSchema: Schema = object( - { - employees: ['employees', optional(array(lazy(() => employeeSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listEventTypesRequest.ts b/src/models/listEventTypesRequest.ts deleted file mode 100644 index fa2fc89af..000000000 --- a/src/models/listEventTypesRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Lists all event types that can be subscribed to. */ -export interface ListEventTypesRequest { - /** The API version for which to list event types. Setting this field overrides the default version used by the application. */ - apiVersion?: string | null; -} - -export const listEventTypesRequestSchema: Schema = object( - { apiVersion: ['api_version', optional(nullable(string()))] } -); diff --git a/src/models/listEventTypesResponse.ts b/src/models/listEventTypesResponse.ts deleted file mode 100644 index 76461d0f0..000000000 --- a/src/models/listEventTypesResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { - EventTypeMetadata, - eventTypeMetadataSchema, -} from './eventTypeMetadata'; - -/** - * Defines the fields that are included in the response body of - * a request to the [ListEventTypes]($e/Events/ListEventTypes) endpoint. - * Note: if there are errors processing the request, the event types field will not be - * present. - */ -export interface ListEventTypesResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** The list of event types. */ - eventTypes?: string[]; - /** Contains the metadata of an event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). */ - metadata?: EventTypeMetadata[]; -} - -export const listEventTypesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - eventTypes: ['event_types', optional(array(string()))], - metadata: [ - 'metadata', - optional(array(lazy(() => eventTypeMetadataSchema))), - ], - } -); diff --git a/src/models/listGiftCardActivitiesRequest.ts b/src/models/listGiftCardActivitiesRequest.ts deleted file mode 100644 index e4ce82d4f..000000000 --- a/src/models/listGiftCardActivitiesRequest.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Returns a list of gift card activities. You can optionally specify a filter to retrieve a - * subset of activites. - */ -export interface ListGiftCardActivitiesRequest { - /** - * If a gift card ID is provided, the endpoint returns activities related - * to the specified gift card. Otherwise, the endpoint returns all gift card activities for - * the seller. - */ - giftCardId?: string | null; - /** - * If a [type](entity:GiftCardActivityType) is provided, the endpoint returns gift card activities of the specified type. - * Otherwise, the endpoint returns all types of gift card activities. - */ - type?: string | null; - /** - * If a location ID is provided, the endpoint returns gift card activities for the specified location. - * Otherwise, the endpoint returns gift card activities for all locations. - */ - locationId?: string | null; - /** - * The timestamp for the beginning of the reporting period, in RFC 3339 format. - * This start time is inclusive. The default value is the current time minus one year. - */ - beginTime?: string | null; - /** - * The timestamp for the end of the reporting period, in RFC 3339 format. - * This end time is inclusive. The default value is the current time. - */ - endTime?: string | null; - /** - * If a limit is provided, the endpoint returns the specified number - * of results (or fewer) per page. The maximum value is 100. The default value is 50. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - limit?: number | null; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * If a cursor is not provided, the endpoint returns the first page of the results. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string | null; - /** - * The order in which the endpoint returns the activities, based on `created_at`. - * - `ASC` - Oldest to newest. - * - `DESC` - Newest to oldest (default). - */ - sortOrder?: string | null; -} - -export const listGiftCardActivitiesRequestSchema: Schema = object( - { - giftCardId: ['gift_card_id', optional(nullable(string()))], - type: ['type', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - beginTime: ['begin_time', optional(nullable(string()))], - endTime: ['end_time', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - sortOrder: ['sort_order', optional(nullable(string()))], - } -); diff --git a/src/models/listGiftCardActivitiesResponse.ts b/src/models/listGiftCardActivitiesResponse.ts deleted file mode 100644 index 0e6c3be59..000000000 --- a/src/models/listGiftCardActivitiesResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCardActivity, giftCardActivitySchema } from './giftCardActivity'; - -/** - * A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors, - * the response contains a set of `Error` objects. - */ -export interface ListGiftCardActivitiesResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The requested gift card activities or an empty object if none are found. */ - giftCardActivities?: GiftCardActivity[]; - /** - * When a response is truncated, it includes a cursor that you can use in a - * subsequent request to retrieve the next set of activities. If a cursor is not present, this is - * the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string; -} - -export const listGiftCardActivitiesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCardActivities: [ - 'gift_card_activities', - optional(array(lazy(() => giftCardActivitySchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listGiftCardsRequest.ts b/src/models/listGiftCardsRequest.ts deleted file mode 100644 index 8ceade6ee..000000000 --- a/src/models/listGiftCardsRequest.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * A request to list gift cards. You can optionally specify a filter to retrieve a subset of - * gift cards. - */ -export interface ListGiftCardsRequest { - /** - * If a [type](entity:GiftCardType) is provided, the endpoint returns gift cards of the specified type. - * Otherwise, the endpoint returns gift cards of all types. - */ - type?: string | null; - /** - * If a [state](entity:GiftCardStatus) is provided, the endpoint returns the gift cards in the specified state. - * Otherwise, the endpoint returns the gift cards of all states. - */ - state?: string | null; - /** - * If a limit is provided, the endpoint returns only the specified number of results per page. - * The maximum value is 200. The default value is 30. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - limit?: number | null; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * If a cursor is not provided, the endpoint returns the first page of the results. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string | null; - /** If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer. */ - customerId?: string | null; -} - -export const listGiftCardsRequestSchema: Schema = object({ - type: ['type', optional(nullable(string()))], - state: ['state', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - customerId: ['customer_id', optional(nullable(string()))], -}); diff --git a/src/models/listGiftCardsResponse.ts b/src/models/listGiftCardsResponse.ts deleted file mode 100644 index 3534404ea..000000000 --- a/src/models/listGiftCardsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCard, giftCardSchema } from './giftCard'; - -/** - * A response that contains a list of `GiftCard` objects. If the request resulted in errors, - * the response contains a set of `Error` objects. - */ -export interface ListGiftCardsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The requested gift cards or an empty object if none are found. */ - giftCards?: GiftCard[]; - /** - * When a response is truncated, it includes a cursor that you can use in a - * subsequent request to retrieve the next set of gift cards. If a cursor is not present, this is - * the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string; -} - -export const listGiftCardsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCards: ['gift_cards', optional(array(lazy(() => giftCardSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listInvoicesRequest.ts b/src/models/listInvoicesRequest.ts deleted file mode 100644 index 370c81ef1..000000000 --- a/src/models/listInvoicesRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Describes a `ListInvoice` request. */ -export interface ListInvoicesRequest { - /** The ID of the location for which to list invoices. */ - locationId: string; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for your original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * The maximum number of invoices to return (200 is the maximum `limit`). - * If not provided, the server uses a default limit of 100 invoices. - */ - limit?: number | null; -} - -export const listInvoicesRequestSchema: Schema = object({ - locationId: ['location_id', string()], - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], -}); diff --git a/src/models/listInvoicesResponse.ts b/src/models/listInvoicesResponse.ts deleted file mode 100644 index 7889eb727..000000000 --- a/src/models/listInvoicesResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Invoice, invoiceSchema } from './invoice'; - -/** Describes a `ListInvoice` response. */ -export interface ListInvoicesResponse { - /** The invoices retrieved. */ - invoices?: Invoice[]; - /** - * When a response is truncated, it includes a cursor that you can use in a - * subsequent request to retrieve the next set of invoices. If empty, this is the final - * response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const listInvoicesResponseSchema: Schema = object({ - invoices: ['invoices', optional(array(lazy(() => invoiceSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/listJobsRequest.ts b/src/models/listJobsRequest.ts deleted file mode 100644 index 3d60eb16e..000000000 --- a/src/models/listJobsRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Represents a [ListJobs]($e/Team/ListJobs) request. */ -export interface ListJobsRequest { - /** - * The pagination cursor returned by the previous call to this endpoint. Provide this - * cursor to retrieve the next page of results for your original request. For more information, - * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; -} - -export const listJobsRequestSchema: Schema = object({ - cursor: ['cursor', optional(nullable(string()))], -}); diff --git a/src/models/listJobsResponse.ts b/src/models/listJobsResponse.ts deleted file mode 100644 index 2219e6920..000000000 --- a/src/models/listJobsResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Job, jobSchema } from './job'; - -/** - * Represents a [ListJobs]($e/Team/ListJobs) response. Either `jobs` or `errors` - * is present in the response. If additional results are available, the `cursor` field is also present. - */ -export interface ListJobsResponse { - /** The retrieved jobs. A single paged response contains up to 100 jobs. */ - jobs?: Job[]; - /** - * An opaque cursor used to retrieve the next page of results. This field is present only - * if the request succeeded and additional results are available. For more information, see - * [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const listJobsResponseSchema: Schema = object({ - jobs: ['jobs', optional(array(lazy(() => jobSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/listLocationBookingProfilesRequest.ts b/src/models/listLocationBookingProfilesRequest.ts deleted file mode 100644 index 097690236..000000000 --- a/src/models/listLocationBookingProfilesRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface ListLocationBookingProfilesRequest { - /** The maximum number of results to return in a paged response. */ - limit?: number | null; - /** The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. */ - cursor?: string | null; -} - -export const listLocationBookingProfilesRequestSchema: Schema = object( - { - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listLocationBookingProfilesResponse.ts b/src/models/listLocationBookingProfilesResponse.ts deleted file mode 100644 index 11511e977..000000000 --- a/src/models/listLocationBookingProfilesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { - LocationBookingProfile, - locationBookingProfileSchema, -} from './locationBookingProfile'; - -export interface ListLocationBookingProfilesResponse { - /** The list of a seller's location booking profiles. */ - locationBookingProfiles?: LocationBookingProfile[]; - /** The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. */ - cursor?: string; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const listLocationBookingProfilesResponseSchema: Schema = object( - { - locationBookingProfiles: [ - 'location_booking_profiles', - optional(array(lazy(() => locationBookingProfileSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listLocationCustomAttributeDefinitionsRequest.ts b/src/models/listLocationCustomAttributeDefinitionsRequest.ts deleted file mode 100644 index ea6baeab7..000000000 --- a/src/models/listLocationCustomAttributeDefinitionsRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Represents a [ListLocationCustomAttributeDefinitions]($e/LocationCustomAttributes/ListLocationCustomAttributeDefinitions) request. */ -export interface ListLocationCustomAttributeDefinitionsRequest { - /** Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. */ - visibilityFilter?: string; - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; -} - -export const listLocationCustomAttributeDefinitionsRequestSchema: Schema = object( - { - visibilityFilter: ['visibility_filter', optional(string())], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listLocationCustomAttributeDefinitionsResponse.ts b/src/models/listLocationCustomAttributeDefinitionsResponse.ts deleted file mode 100644 index 2ea78f5f4..000000000 --- a/src/models/listLocationCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [ListLocationCustomAttributeDefinitions]($e/LocationCustomAttributes/ListLocationCustomAttributeDefinitions) response. - * Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. - * If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. - */ -export interface ListLocationCustomAttributeDefinitionsResponse { - /** - * The retrieved custom attribute definitions. If no custom attribute definitions are found, - * Square returns an empty object (`{}`). - */ - customAttributeDefinitions?: CustomAttributeDefinition[]; - /** - * The cursor to provide in your next call to this endpoint to retrieve the next page of - * results for your original request. This field is present only if the request succeeded and - * additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listLocationCustomAttributeDefinitionsResponseSchema: Schema = object( - { - customAttributeDefinitions: [ - 'custom_attribute_definitions', - optional(array(lazy(() => customAttributeDefinitionSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listLocationCustomAttributesRequest.ts b/src/models/listLocationCustomAttributesRequest.ts deleted file mode 100644 index 6498a1e7d..000000000 --- a/src/models/listLocationCustomAttributesRequest.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** Represents a [ListLocationCustomAttributes]($e/LocationCustomAttributes/ListLocationCustomAttributes) request. */ -export interface ListLocationCustomAttributesRequest { - /** Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. */ - visibilityFilter?: string; - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each - * custom attribute. Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The default value is `false`. - */ - withDefinitions?: boolean | null; -} - -export const listLocationCustomAttributesRequestSchema: Schema = object( - { - visibilityFilter: ['visibility_filter', optional(string())], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - withDefinitions: ['with_definitions', optional(nullable(boolean()))], - } -); diff --git a/src/models/listLocationCustomAttributesResponse.ts b/src/models/listLocationCustomAttributesResponse.ts deleted file mode 100644 index 2a8099b66..000000000 --- a/src/models/listLocationCustomAttributesResponse.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [ListLocationCustomAttributes]($e/LocationCustomAttributes/ListLocationCustomAttributes) response. - * Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional - * results are available, the `cursor` field is also present along with `custom_attributes`. - */ -export interface ListLocationCustomAttributesResponse { - /** - * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, - * the custom attribute definition is returned in the `definition` field of each custom attribute. - * If no custom attributes are found, Square returns an empty object (`{}`). - */ - customAttributes?: CustomAttribute[]; - /** - * The cursor to use in your next call to this endpoint to retrieve the next page of results - * for your original request. This field is present only if the request succeeded and additional - * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listLocationCustomAttributesResponseSchema: Schema = object( - { - customAttributes: [ - 'custom_attributes', - optional(array(lazy(() => customAttributeSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listLocationsResponse.ts b/src/models/listLocationsResponse.ts deleted file mode 100644 index 03479a645..000000000 --- a/src/models/listLocationsResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Location, locationSchema } from './location'; - -/** - * Defines the fields that are included in the response body of a request - * to the [ListLocations]($e/Locations/ListLocations) endpoint. - * Either `errors` or `locations` is present in a given response (never both). - */ -export interface ListLocationsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The business locations. */ - locations?: Location[]; -} - -export const listLocationsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - locations: ['locations', optional(array(lazy(() => locationSchema)))], - } -); diff --git a/src/models/listLoyaltyProgramsResponse.ts b/src/models/listLoyaltyProgramsResponse.ts deleted file mode 100644 index 4061f5ffe..000000000 --- a/src/models/listLoyaltyProgramsResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyProgram, loyaltyProgramSchema } from './loyaltyProgram'; - -/** A response that contains all loyalty programs. */ -export interface ListLoyaltyProgramsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** A list of `LoyaltyProgram` for the merchant. */ - programs?: LoyaltyProgram[]; -} - -export const listLoyaltyProgramsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - programs: ['programs', optional(array(lazy(() => loyaltyProgramSchema)))], - } -); diff --git a/src/models/listLoyaltyPromotionsRequest.ts b/src/models/listLoyaltyPromotionsRequest.ts deleted file mode 100644 index d458b7e08..000000000 --- a/src/models/listLoyaltyPromotionsRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Represents a [ListLoyaltyPromotions]($e/Loyalty/ListLoyaltyPromotions) request. */ -export interface ListLoyaltyPromotionsRequest { - /** Indicates the status of a [loyalty promotion]($m/LoyaltyPromotion). */ - status?: string; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * The maximum number of results to return in a single paged response. - * The minimum value is 1 and the maximum value is 30. The default value is 30. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; -} - -export const listLoyaltyPromotionsRequestSchema: Schema = object( - { - status: ['status', optional(string())], - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listLoyaltyPromotionsResponse.ts b/src/models/listLoyaltyPromotionsResponse.ts deleted file mode 100644 index 7ca146e2a..000000000 --- a/src/models/listLoyaltyPromotionsResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyPromotion, loyaltyPromotionSchema } from './loyaltyPromotion'; - -/** - * Represents a [ListLoyaltyPromotions]($e/Loyalty/ListLoyaltyPromotions) response. - * One of `loyalty_promotions`, an empty object, or `errors` is present in the response. - * If additional results are available, the `cursor` field is also present along with `loyalty_promotions`. - */ -export interface ListLoyaltyPromotionsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The retrieved loyalty promotions. */ - loyaltyPromotions?: LoyaltyPromotion[]; - /** - * The cursor to use in your next call to this endpoint to retrieve the next page of results - * for your original request. This field is present only if the request succeeded and additional - * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listLoyaltyPromotionsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - loyaltyPromotions: [ - 'loyalty_promotions', - optional(array(lazy(() => loyaltyPromotionSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listMerchantCustomAttributeDefinitionsRequest.ts b/src/models/listMerchantCustomAttributeDefinitionsRequest.ts deleted file mode 100644 index b80b9eba5..000000000 --- a/src/models/listMerchantCustomAttributeDefinitionsRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Represents a [ListMerchantCustomAttributeDefinitions]($e/MerchantCustomAttributes/ListMerchantCustomAttributeDefinitions) request. */ -export interface ListMerchantCustomAttributeDefinitionsRequest { - /** Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. */ - visibilityFilter?: string; - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; -} - -export const listMerchantCustomAttributeDefinitionsRequestSchema: Schema = object( - { - visibilityFilter: ['visibility_filter', optional(string())], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listMerchantCustomAttributeDefinitionsResponse.ts b/src/models/listMerchantCustomAttributeDefinitionsResponse.ts deleted file mode 100644 index 20916d2a6..000000000 --- a/src/models/listMerchantCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [ListMerchantCustomAttributeDefinitions]($e/MerchantCustomAttributes/ListMerchantCustomAttributeDefinitions) response. - * Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. - * If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. - */ -export interface ListMerchantCustomAttributeDefinitionsResponse { - /** - * The retrieved custom attribute definitions. If no custom attribute definitions are found, - * Square returns an empty object (`{}`). - */ - customAttributeDefinitions?: CustomAttributeDefinition[]; - /** - * The cursor to provide in your next call to this endpoint to retrieve the next page of - * results for your original request. This field is present only if the request succeeded and - * additional results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listMerchantCustomAttributeDefinitionsResponseSchema: Schema = object( - { - customAttributeDefinitions: [ - 'custom_attribute_definitions', - optional(array(lazy(() => customAttributeDefinitionSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listMerchantCustomAttributesRequest.ts b/src/models/listMerchantCustomAttributesRequest.ts deleted file mode 100644 index baaa4e0d3..000000000 --- a/src/models/listMerchantCustomAttributesRequest.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** Represents a [ListMerchantCustomAttributes]($e/MerchantCustomAttributes/ListMerchantCustomAttributes) request. */ -export interface ListMerchantCustomAttributesRequest { - /** Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. */ - visibilityFilter?: string; - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: number | null; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. For more - * information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each - * custom attribute. Set this parameter to `true` to get the name and description of each custom - * attribute, information about the data type, or other definition details. The default value is `false`. - */ - withDefinitions?: boolean | null; -} - -export const listMerchantCustomAttributesRequestSchema: Schema = object( - { - visibilityFilter: ['visibility_filter', optional(string())], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - withDefinitions: ['with_definitions', optional(nullable(boolean()))], - } -); diff --git a/src/models/listMerchantCustomAttributesResponse.ts b/src/models/listMerchantCustomAttributesResponse.ts deleted file mode 100644 index 963ee0a81..000000000 --- a/src/models/listMerchantCustomAttributesResponse.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [ListMerchantCustomAttributes]($e/MerchantCustomAttributes/ListMerchantCustomAttributes) response. - * Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional - * results are available, the `cursor` field is also present along with `custom_attributes`. - */ -export interface ListMerchantCustomAttributesResponse { - /** - * The retrieved custom attributes. If `with_definitions` was set to `true` in the request, - * the custom attribute definition is returned in the `definition` field of each custom attribute. - * If no custom attributes are found, Square returns an empty object (`{}`). - */ - customAttributes?: CustomAttribute[]; - /** - * The cursor to use in your next call to this endpoint to retrieve the next page of results - * for your original request. This field is present only if the request succeeded and additional - * results are available. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listMerchantCustomAttributesResponseSchema: Schema = object( - { - customAttributes: [ - 'custom_attributes', - optional(array(lazy(() => customAttributeSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listMerchantsRequest.ts b/src/models/listMerchantsRequest.ts deleted file mode 100644 index b7e7440cb..000000000 --- a/src/models/listMerchantsRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { nullable, number, object, optional, Schema } from '../schema'; - -/** Request object for the [ListMerchant]($e/Merchants/ListMerchants) endpoint. */ -export interface ListMerchantsRequest { - /** The cursor generated by the previous response. */ - cursor?: number | null; -} - -export const listMerchantsRequestSchema: Schema = object({ - cursor: ['cursor', optional(nullable(number()))], -}); diff --git a/src/models/listMerchantsResponse.ts b/src/models/listMerchantsResponse.ts deleted file mode 100644 index 8d8266d97..000000000 --- a/src/models/listMerchantsResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, number, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Merchant, merchantSchema } from './merchant'; - -/** The response object returned by the [ListMerchant]($e/Merchants/ListMerchants) endpoint. */ -export interface ListMerchantsResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** The requested `Merchant` entities. */ - merchant?: Merchant[]; - /** If the response is truncated, the cursor to use in next request to fetch next set of objects. */ - cursor?: number; -} - -export const listMerchantsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - merchant: ['merchant', optional(array(lazy(() => merchantSchema)))], - cursor: ['cursor', optional(number())], - } -); diff --git a/src/models/listOrderCustomAttributeDefinitionsRequest.ts b/src/models/listOrderCustomAttributeDefinitionsRequest.ts deleted file mode 100644 index 348ddd369..000000000 --- a/src/models/listOrderCustomAttributeDefinitionsRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Represents a list request for order custom attribute definitions. */ -export interface ListOrderCustomAttributeDefinitionsRequest { - /** Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. */ - visibilityFilter?: string; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string | null; - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - limit?: number | null; -} - -export const listOrderCustomAttributeDefinitionsRequestSchema: Schema = object( - { - visibilityFilter: ['visibility_filter', optional(string())], - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listOrderCustomAttributeDefinitionsResponse.ts b/src/models/listOrderCustomAttributeDefinitionsResponse.ts deleted file mode 100644 index 662540848..000000000 --- a/src/models/listOrderCustomAttributeDefinitionsResponse.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** Represents a response from listing order custom attribute definitions. */ -export interface ListOrderCustomAttributeDefinitionsResponse { - /** The retrieved custom attribute definitions. If no custom attribute definitions are found, Square returns an empty object (`{}`). */ - customAttributeDefinitions: CustomAttributeDefinition[]; - /** - * The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request. - * This field is present only if the request succeeded and additional results are available. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listOrderCustomAttributeDefinitionsResponseSchema: Schema = object( - { - customAttributeDefinitions: [ - 'custom_attribute_definitions', - array(lazy(() => customAttributeDefinitionSchema)), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listOrderCustomAttributesRequest.ts b/src/models/listOrderCustomAttributesRequest.ts deleted file mode 100644 index ebc06ea83..000000000 --- a/src/models/listOrderCustomAttributesRequest.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** Represents a list request for order custom attributes. */ -export interface ListOrderCustomAttributesRequest { - /** Enumeration of visibility-filter values used to set the ability to view custom attributes or custom attribute definitions. */ - visibilityFilter?: string; - /** - * The cursor returned in the paged response from the previous call to this endpoint. - * Provide this cursor to retrieve the next page of results for your original request. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string | null; - /** - * The maximum number of results to return in a single paged response. This limit is advisory. - * The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. - * The default value is 20. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - limit?: number | null; - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each - * custom attribute. Set this parameter to `true` to get the name and description of each custom attribute, - * information about the data type, or other definition details. The default value is `false`. - */ - withDefinitions?: boolean | null; -} - -export const listOrderCustomAttributesRequestSchema: Schema = object( - { - visibilityFilter: ['visibility_filter', optional(string())], - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - withDefinitions: ['with_definitions', optional(nullable(boolean()))], - } -); diff --git a/src/models/listOrderCustomAttributesResponse.ts b/src/models/listOrderCustomAttributesResponse.ts deleted file mode 100644 index fb9b8b9a9..000000000 --- a/src/models/listOrderCustomAttributesResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** Represents a response from listing order custom attributes. */ -export interface ListOrderCustomAttributesResponse { - /** The retrieved custom attributes. If no custom attribute are found, Square returns an empty object (`{}`). */ - customAttributes?: CustomAttribute[]; - /** - * The cursor to provide in your next call to this endpoint to retrieve the next page of results for your original request. - * This field is present only if the request succeeded and additional results are available. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listOrderCustomAttributesResponseSchema: Schema = object( - { - customAttributes: [ - 'custom_attributes', - optional(array(lazy(() => customAttributeSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listPaymentLinksRequest.ts b/src/models/listPaymentLinksRequest.ts deleted file mode 100644 index 716d6c864..000000000 --- a/src/models/listPaymentLinksRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface ListPaymentLinksRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * If a cursor is not provided, the endpoint returns the first page of the results. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * A limit on the number of results to return per page. The limit is advisory and - * the implementation might return more or less results. If the supplied limit is negative, zero, or - * greater than the maximum limit of 1000, it is ignored. - * Default value: `100` - */ - limit?: number | null; -} - -export const listPaymentLinksRequestSchema: Schema = object( - { - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listPaymentLinksResponse.ts b/src/models/listPaymentLinksResponse.ts deleted file mode 100644 index d4f6be59a..000000000 --- a/src/models/listPaymentLinksResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { PaymentLink, paymentLinkSchema } from './paymentLink'; - -export interface ListPaymentLinksResponse { - /** Errors that occurred during the request. */ - errors?: Error[]; - /** The list of payment links. */ - paymentLinks?: PaymentLink[]; - /** - * When a response is truncated, it includes a cursor that you can use in a subsequent request - * to retrieve the next set of gift cards. If a cursor is not present, this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listPaymentLinksResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - paymentLinks: [ - 'payment_links', - optional(array(lazy(() => paymentLinkSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listPaymentRefundsRequest.ts b/src/models/listPaymentRefundsRequest.ts deleted file mode 100644 index 6a8007c66..000000000 --- a/src/models/listPaymentRefundsRequest.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Describes a request to list refunds using - * [ListPaymentRefunds]($e/Refunds/ListPaymentRefunds). - * The maximum results per page is 100. - */ -export interface ListPaymentRefundsRequest { - /** - * Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339 - * format. The range is determined using the `created_at` field for each `PaymentRefund`. - * Default: The current time minus one year. - */ - beginTime?: string | null; - /** - * Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339 - * format. The range is determined using the `created_at` field for each `PaymentRefund`. - * Default: The current time. - */ - endTime?: string | null; - /** - * The order in which results are listed by `PaymentRefund.created_at`: - * - `ASC` - Oldest to newest. - * - `DESC` - Newest to oldest (default). - */ - sortOrder?: string | null; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * Limit results to the location supplied. By default, results are returned - * for all locations associated with the seller. - */ - locationId?: string | null; - /** - * If provided, only refunds with the given status are returned. - * For a list of refund status values, see [PaymentRefund](entity:PaymentRefund). - * Default: If omitted, refunds are returned regardless of their status. - */ - status?: string | null; - /** - * If provided, only returns refunds whose payments have the indicated source type. - * Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`. - * For information about these payment source types, see - * [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). - * Default: If omitted, refunds are returned regardless of the source type. - */ - sourceType?: string | null; - /** - * The maximum number of results to be returned in a single page. - * It is possible to receive fewer results than the specified limit on a given page. - * If the supplied value is greater than 100, no more than 100 results are returned. - * Default: 100 - */ - limit?: number | null; -} - -export const listPaymentRefundsRequestSchema: Schema = object( - { - beginTime: ['begin_time', optional(nullable(string()))], - endTime: ['end_time', optional(nullable(string()))], - sortOrder: ['sort_order', optional(nullable(string()))], - cursor: ['cursor', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - status: ['status', optional(nullable(string()))], - sourceType: ['source_type', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listPaymentRefundsResponse.ts b/src/models/listPaymentRefundsResponse.ts deleted file mode 100644 index c74377676..000000000 --- a/src/models/listPaymentRefundsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { PaymentRefund, paymentRefundSchema } from './paymentRefund'; - -/** - * Defines the response returned by [ListPaymentRefunds]($e/Refunds/ListPaymentRefunds). - * Either `errors` or `refunds` is present in a given response (never both). - */ -export interface ListPaymentRefundsResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** The list of requested refunds. */ - refunds?: PaymentRefund[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, - * this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listPaymentRefundsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refunds: ['refunds', optional(array(lazy(() => paymentRefundSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listPaymentsRequest.ts b/src/models/listPaymentsRequest.ts deleted file mode 100644 index 2998ac881..000000000 --- a/src/models/listPaymentsRequest.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { - bigint, - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * Describes a request to list payments using - * [ListPayments]($e/Payments/ListPayments). - * The maximum results per page is 100. - */ -export interface ListPaymentsRequest { - /** - * Indicates the start of the time range to retrieve payments for, in RFC 3339 format. - * The range is determined using the `created_at` field for each Payment. - * Inclusive. Default: The current time minus one year. - */ - beginTime?: string | null; - /** - * Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The - * range is determined using the `created_at` field for each Payment. - * Default: The current time. - */ - endTime?: string | null; - /** - * The order in which results are listed by `ListPaymentsRequest.sort_field`: - * - `ASC` - Oldest to newest. - * - `DESC` - Newest to oldest (default). - */ - sortOrder?: string | null; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * Limit results to the location supplied. By default, results are returned - * for the default (main) location associated with the seller. - */ - locationId?: string | null; - /** The exact amount in the `total_money` for a payment. */ - total?: bigint | null; - /** The last four digits of a payment card. */ - last4?: string | null; - /** The brand of the payment card (for example, VISA). */ - cardBrand?: string | null; - /** - * The maximum number of results to be returned in a single page. - * It is possible to receive fewer results than the specified limit on a given page. - * The default value of 100 is also the maximum allowed value. If the provided value is - * greater than 100, it is ignored and the default value is used instead. - * Default: `100` - */ - limit?: number | null; - /** Whether the payment was taken offline or not. */ - isOfflinePayment?: boolean | null; - /** - * Indicates the start of the time range for which to retrieve offline payments, in RFC 3339 - * format for timestamps. The range is determined using the - * `offline_payment_details.client_created_at` field for each Payment. If set, payments without a - * value set in `offline_payment_details.client_created_at` will not be returned. - * Default: The current time. - */ - offlineBeginTime?: string | null; - /** - * Indicates the end of the time range for which to retrieve offline payments, in RFC 3339 - * format for timestamps. The range is determined using the - * `offline_payment_details.client_created_at` field for each Payment. If set, payments without a - * value set in `offline_payment_details.client_created_at` will not be returned. - * Default: The current time. - */ - offlineEndTime?: string | null; - /** - * Indicates the start of the time range to retrieve payments for, in RFC 3339 format. The - * range is determined using the `updated_at` field for each Payment. - */ - updatedAtBeginTime?: string | null; - /** - * Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The - * range is determined using the `updated_at` field for each Payment. - */ - updatedAtEndTime?: string | null; - sortField?: string; -} - -export const listPaymentsRequestSchema: Schema = object({ - beginTime: ['begin_time', optional(nullable(string()))], - endTime: ['end_time', optional(nullable(string()))], - sortOrder: ['sort_order', optional(nullable(string()))], - cursor: ['cursor', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - total: ['total', optional(nullable(bigint()))], - last4: ['last_4', optional(nullable(string()))], - cardBrand: ['card_brand', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - isOfflinePayment: ['is_offline_payment', optional(nullable(boolean()))], - offlineBeginTime: ['offline_begin_time', optional(nullable(string()))], - offlineEndTime: ['offline_end_time', optional(nullable(string()))], - updatedAtBeginTime: ['updated_at_begin_time', optional(nullable(string()))], - updatedAtEndTime: ['updated_at_end_time', optional(nullable(string()))], - sortField: ['sort_field', optional(string())], -}); diff --git a/src/models/listPaymentsResponse.ts b/src/models/listPaymentsResponse.ts deleted file mode 100644 index 3403bd871..000000000 --- a/src/models/listPaymentsResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Payment, paymentSchema } from './payment'; - -/** Defines the response returned by [ListPayments]($e/Payments/ListPayments). */ -export interface ListPaymentsResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** The requested list of payments. */ - payments?: Payment[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, - * this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listPaymentsResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - payments: ['payments', optional(array(lazy(() => paymentSchema)))], - cursor: ['cursor', optional(string())], -}); diff --git a/src/models/listPayoutEntriesRequest.ts b/src/models/listPayoutEntriesRequest.ts deleted file mode 100644 index 6414ec544..000000000 --- a/src/models/listPayoutEntriesRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface ListPayoutEntriesRequest { - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - * If request parameters change between requests, subsequent results may contain duplicates or missing records. - */ - cursor?: string | null; - /** - * The maximum number of results to be returned in a single page. - * It is possible to receive fewer results than the specified limit on a given page. - * The default value of 100 is also the maximum allowed value. If the provided value is - * greater than 100, it is ignored and the default value is used instead. - * Default: `100` - */ - limit?: number | null; -} - -export const listPayoutEntriesRequestSchema: Schema = object( - { - sortOrder: ['sort_order', optional(string())], - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listPayoutEntriesResponse.ts b/src/models/listPayoutEntriesResponse.ts deleted file mode 100644 index e9f37000f..000000000 --- a/src/models/listPayoutEntriesResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { PayoutEntry, payoutEntrySchema } from './payoutEntry'; - -/** The response to retrieve payout records entries. */ -export interface ListPayoutEntriesResponse { - /** The requested list of payout entries, ordered with the given or default sort order. */ - payoutEntries?: PayoutEntry[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const listPayoutEntriesResponseSchema: Schema = object( - { - payoutEntries: [ - 'payout_entries', - optional(array(lazy(() => payoutEntrySchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listPayoutsRequest.ts b/src/models/listPayoutsRequest.ts deleted file mode 100644 index 8c040f9b0..000000000 --- a/src/models/listPayoutsRequest.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** A request to retrieve payout records. */ -export interface ListPayoutsRequest { - /** - * The ID of the location for which to list the payouts. - * By default, payouts are returned for the default (main) location associated with the seller. - */ - locationId?: string | null; - /** Payout status types */ - status?: string; - /** - * The timestamp for the beginning of the payout creation time, in RFC 3339 format. - * Inclusive. Default: The current time minus one year. - */ - beginTime?: string | null; - /** - * The timestamp for the end of the payout creation time, in RFC 3339 format. - * Default: The current time. - */ - endTime?: string | null; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - * If request parameters change between requests, subsequent results may contain duplicates or missing records. - */ - cursor?: string | null; - /** - * The maximum number of results to be returned in a single page. - * It is possible to receive fewer results than the specified limit on a given page. - * The default value of 100 is also the maximum allowed value. If the provided value is - * greater than 100, it is ignored and the default value is used instead. - * Default: `100` - */ - limit?: number | null; -} - -export const listPayoutsRequestSchema: Schema = object({ - locationId: ['location_id', optional(nullable(string()))], - status: ['status', optional(string())], - beginTime: ['begin_time', optional(nullable(string()))], - endTime: ['end_time', optional(nullable(string()))], - sortOrder: ['sort_order', optional(string())], - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], -}); diff --git a/src/models/listPayoutsResponse.ts b/src/models/listPayoutsResponse.ts deleted file mode 100644 index 2f82469fe..000000000 --- a/src/models/listPayoutsResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Payout, payoutSchema } from './payout'; - -/** The response to retrieve payout records entries. */ -export interface ListPayoutsResponse { - /** The requested list of payouts. */ - payouts?: Payout[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const listPayoutsResponseSchema: Schema = object({ - payouts: ['payouts', optional(array(lazy(() => payoutSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/listRefundsRequest.ts b/src/models/listRefundsRequest.ts deleted file mode 100644 index fbe6d7b28..000000000 --- a/src/models/listRefundsRequest.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Defines the query parameters that can be included in - * a request to the [ListRefunds](api-endpoint:Transactions-ListRefunds) endpoint. - * Deprecated - recommend using [SearchOrders](api-endpoint:Orders-SearchOrders) - */ -export interface ListRefundsRequest { - /** - * The beginning of the requested reporting period, in RFC 3339 format. - * See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. - * Default value: The current time minus one year. - */ - beginTime?: string | null; - /** - * The end of the requested reporting period, in RFC 3339 format. - * See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. - * Default value: The current time. - */ - endTime?: string | null; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for your original query. - * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - */ - cursor?: string | null; -} - -export const listRefundsRequestSchema: Schema = object({ - beginTime: ['begin_time', optional(nullable(string()))], - endTime: ['end_time', optional(nullable(string()))], - sortOrder: ['sort_order', optional(string())], - cursor: ['cursor', optional(nullable(string()))], -}); diff --git a/src/models/listRefundsResponse.ts b/src/models/listRefundsResponse.ts deleted file mode 100644 index 73cd20ad3..000000000 --- a/src/models/listRefundsResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Refund, refundSchema } from './refund'; - -/** - * Defines the fields that are included in the response body of - * a request to the [ListRefunds](api-endpoint:Transactions-ListRefunds) endpoint. - * One of `errors` or `refunds` is present in a given response (never both). - */ -export interface ListRefundsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** An array of refunds that match your query. */ - refunds?: Refund[]; - /** - * A pagination cursor for retrieving the next set of results, - * if any remain. Provide this value as the `cursor` parameter in a subsequent - * request to this endpoint. - * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - */ - cursor?: string; -} - -export const listRefundsResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refunds: ['refunds', optional(array(lazy(() => refundSchema)))], - cursor: ['cursor', optional(string())], -}); diff --git a/src/models/listSitesResponse.ts b/src/models/listSitesResponse.ts deleted file mode 100644 index 6ce7ebc05..000000000 --- a/src/models/listSitesResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Site, siteSchema } from './site'; - -/** Represents a `ListSites` response. The response can include either `sites` or `errors`. */ -export interface ListSitesResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The sites that belong to the seller. */ - sites?: Site[]; -} - -export const listSitesResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - sites: ['sites', optional(array(lazy(() => siteSchema)))], -}); diff --git a/src/models/listSubscriptionEventsRequest.ts b/src/models/listSubscriptionEventsRequest.ts deleted file mode 100644 index 7733fef32..000000000 --- a/src/models/listSubscriptionEventsRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Defines input parameters in a request to the - * [ListSubscriptionEvents]($e/Subscriptions/ListSubscriptionEvents) - * endpoint. - */ -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/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * The upper limit on the number of subscription events to return - * in a paged response. - */ - limit?: number | null; -} - -export const listSubscriptionEventsRequestSchema: Schema = object( - { - cursor: ['cursor', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listSubscriptionEventsResponse.ts b/src/models/listSubscriptionEventsResponse.ts deleted file mode 100644 index 2a0770b20..000000000 --- a/src/models/listSubscriptionEventsResponse.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { - SubscriptionEvent, - subscriptionEventSchema, -} from './subscriptionEvent'; - -/** - * Defines output parameters in a response from the - * [ListSubscriptionEvents]($e/Subscriptions/ListSubscriptionEvents). - */ -export interface ListSubscriptionEventsResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** The retrieved subscription events. */ - subscriptionEvents?: SubscriptionEvent[]; - /** - * 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). - */ - cursor?: string; -} - -export const listSubscriptionEventsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscriptionEvents: [ - 'subscription_events', - optional(array(lazy(() => subscriptionEventSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listTeamMemberBookingProfilesRequest.ts b/src/models/listTeamMemberBookingProfilesRequest.ts deleted file mode 100644 index 505264209..000000000 --- a/src/models/listTeamMemberBookingProfilesRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -export interface ListTeamMemberBookingProfilesRequest { - /** Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`). */ - bookableOnly?: boolean | null; - /** The maximum number of results to return in a paged response. */ - limit?: number | null; - /** The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. */ - cursor?: string | null; - /** Indicates whether to include only team members enabled at the given location in the returned result. */ - locationId?: string | null; -} - -export const listTeamMemberBookingProfilesRequestSchema: Schema = object( - { - bookableOnly: ['bookable_only', optional(nullable(boolean()))], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - } -); diff --git a/src/models/listTeamMemberBookingProfilesResponse.ts b/src/models/listTeamMemberBookingProfilesResponse.ts deleted file mode 100644 index da5f914da..000000000 --- a/src/models/listTeamMemberBookingProfilesResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { - TeamMemberBookingProfile, - teamMemberBookingProfileSchema, -} from './teamMemberBookingProfile'; - -export interface ListTeamMemberBookingProfilesResponse { - /** - * The list of team member booking profiles. The results are returned in the ascending order of the time - * when the team member booking profiles were last updated. Multiple booking profiles updated at the same time - * are further sorted in the ascending order of their IDs. - */ - teamMemberBookingProfiles?: TeamMemberBookingProfile[]; - /** The pagination cursor to be used in the subsequent request to get the next page of the results. Stop retrieving the next page of the results when the cursor is not set. */ - cursor?: string; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const listTeamMemberBookingProfilesResponseSchema: Schema = object( - { - teamMemberBookingProfiles: [ - 'team_member_booking_profiles', - optional(array(lazy(() => teamMemberBookingProfileSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listTeamMemberWagesRequest.ts b/src/models/listTeamMemberWagesRequest.ts deleted file mode 100644 index c6413c857..000000000 --- a/src/models/listTeamMemberWagesRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** A request for a set of `TeamMemberWage` objects. */ -export interface ListTeamMemberWagesRequest { - /** - * Filter the returned wages to only those that are associated with the - * specified team member. - */ - teamMemberId?: string | null; - /** - * The maximum number of `TeamMemberWage` results to return per page. The number can range between - * 1 and 200. The default is 200. - */ - limit?: number | null; - /** A pointer to the next page of `EmployeeWage` results to fetch. */ - cursor?: string | null; -} - -export const listTeamMemberWagesRequestSchema: Schema = object( - { - teamMemberId: ['team_member_id', optional(nullable(string()))], - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listTeamMemberWagesResponse.ts b/src/models/listTeamMemberWagesResponse.ts deleted file mode 100644 index ead485955..000000000 --- a/src/models/listTeamMemberWagesResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { TeamMemberWage, teamMemberWageSchema } from './teamMemberWage'; - -/** - * The response to a request for a set of `TeamMemberWage` objects. The response contains - * a set of `TeamMemberWage` objects. - */ -export interface ListTeamMemberWagesResponse { - /** A page of `TeamMemberWage` results. */ - teamMemberWages?: TeamMemberWage[]; - /** - * The value supplied in the subsequent request to fetch the next page - * of `TeamMemberWage` results. - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listTeamMemberWagesResponseSchema: Schema = object( - { - teamMemberWages: [ - 'team_member_wages', - optional(array(lazy(() => teamMemberWageSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/listTransactionsRequest.ts b/src/models/listTransactionsRequest.ts deleted file mode 100644 index 81ff18cc0..000000000 --- a/src/models/listTransactionsRequest.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Defines the query parameters that can be included in - * a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. - * Deprecated - recommend using [SearchOrders](api-endpoint:Orders-SearchOrders) - */ -export interface ListTransactionsRequest { - /** - * The beginning of the requested reporting period, in RFC 3339 format. - * See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. - * Default value: The current time minus one year. - */ - beginTime?: string | null; - /** - * The end of the requested reporting period, in RFC 3339 format. - * See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity. - * Default value: The current time. - */ - endTime?: string | null; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for your original query. - * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - */ - cursor?: string | null; -} - -export const listTransactionsRequestSchema: Schema = object( - { - beginTime: ['begin_time', optional(nullable(string()))], - endTime: ['end_time', optional(nullable(string()))], - sortOrder: ['sort_order', optional(string())], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listTransactionsResponse.ts b/src/models/listTransactionsResponse.ts deleted file mode 100644 index 30efdfb2a..000000000 --- a/src/models/listTransactionsResponse.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Transaction, transactionSchema } from './transaction'; - -/** - * Defines the fields that are included in the response body of - * a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. - * One of `errors` or `transactions` is present in a given response (never both). - */ -export interface ListTransactionsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** An array of transactions that match your query. */ - transactions?: Transaction[]; - /** - * A pagination cursor for retrieving the next set of results, - * if any remain. Provide this value as the `cursor` parameter in a subsequent - * request to this endpoint. - * See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. - */ - cursor?: string; -} - -export const listTransactionsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - transactions: [ - 'transactions', - optional(array(lazy(() => transactionSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listWebhookEventTypesRequest.ts b/src/models/listWebhookEventTypesRequest.ts deleted file mode 100644 index 972a3d811..000000000 --- a/src/models/listWebhookEventTypesRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Lists all webhook event types that can be subscribed to. */ -export interface ListWebhookEventTypesRequest { - /** The API version for which to list event types. Setting this field overrides the default version used by the application. */ - apiVersion?: string | null; -} - -export const listWebhookEventTypesRequestSchema: Schema = object( - { apiVersion: ['api_version', optional(nullable(string()))] } -); diff --git a/src/models/listWebhookEventTypesResponse.ts b/src/models/listWebhookEventTypesResponse.ts deleted file mode 100644 index 75ced1da0..000000000 --- a/src/models/listWebhookEventTypesResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { - EventTypeMetadata, - eventTypeMetadataSchema, -} from './eventTypeMetadata'; - -/** - * Defines the fields that are included in the response body of - * a request to the [ListWebhookEventTypes]($e/WebhookSubscriptions/ListWebhookEventTypes) endpoint. - * Note: if there are errors processing the request, the event types field will not be - * present. - */ -export interface ListWebhookEventTypesResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** The list of event types. */ - eventTypes?: string[]; - /** Contains the metadata of a webhook event type. For more information, see [EventTypeMetadata](entity:EventTypeMetadata). */ - metadata?: EventTypeMetadata[]; -} - -export const listWebhookEventTypesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - eventTypes: ['event_types', optional(array(string()))], - metadata: [ - 'metadata', - optional(array(lazy(() => eventTypeMetadataSchema))), - ], - } -); diff --git a/src/models/listWebhookSubscriptionsRequest.ts b/src/models/listWebhookSubscriptionsRequest.ts deleted file mode 100644 index 0e0f7c0c9..000000000 --- a/src/models/listWebhookSubscriptionsRequest.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** Lists all [Subscription]($m/WebhookSubscription)s owned by your application. */ -export interface ListWebhookSubscriptionsRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for your original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string | null; - /** - * Includes disabled [Subscription](entity:WebhookSubscription)s. - * By default, all enabled [Subscription](entity:WebhookSubscription)s are returned. - */ - includeDisabled?: boolean | null; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** - * The maximum number of results to be returned in a single page. - * It is possible to receive fewer results than the specified limit on a given page. - * The default value of 100 is also the maximum allowed value. - * Default: 100 - */ - limit?: number | null; -} - -export const listWebhookSubscriptionsRequestSchema: Schema = object( - { - cursor: ['cursor', optional(nullable(string()))], - includeDisabled: ['include_disabled', optional(nullable(boolean()))], - sortOrder: ['sort_order', optional(string())], - limit: ['limit', optional(nullable(number()))], - } -); diff --git a/src/models/listWebhookSubscriptionsResponse.ts b/src/models/listWebhookSubscriptionsResponse.ts deleted file mode 100644 index c2244f8d9..000000000 --- a/src/models/listWebhookSubscriptionsResponse.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { - WebhookSubscription, - webhookSubscriptionSchema, -} from './webhookSubscription'; - -/** - * Defines the fields that are included in the response body of - * a request to the [ListWebhookSubscriptions]($e/WebhookSubscriptions/ListWebhookSubscriptions) endpoint. - * Note: if there are errors processing the request, the subscriptions field will not be - * present. - */ -export interface ListWebhookSubscriptionsResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** The requested list of [Subscription](entity:WebhookSubscription)s. */ - subscriptions?: WebhookSubscription[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, - * this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const listWebhookSubscriptionsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscriptions: [ - 'subscriptions', - optional(array(lazy(() => webhookSubscriptionSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/listWorkweekConfigsRequest.ts b/src/models/listWorkweekConfigsRequest.ts deleted file mode 100644 index e22c97bae..000000000 --- a/src/models/listWorkweekConfigsRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** A request for a set of `WorkweekConfig` objects. */ -export interface ListWorkweekConfigsRequest { - /** The maximum number of `WorkweekConfigs` results to return per page. */ - limit?: number | null; - /** A pointer to the next page of `WorkweekConfig` results to fetch. */ - cursor?: string | null; -} - -export const listWorkweekConfigsRequestSchema: Schema = object( - { - limit: ['limit', optional(nullable(number()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/listWorkweekConfigsResponse.ts b/src/models/listWorkweekConfigsResponse.ts deleted file mode 100644 index a05f5e1e3..000000000 --- a/src/models/listWorkweekConfigsResponse.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { WorkweekConfig, workweekConfigSchema } from './workweekConfig'; - -/** - * The response to a request for a set of `WorkweekConfig` objects. The response contains - * the requested `WorkweekConfig` objects and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface ListWorkweekConfigsResponse { - /** A page of `WorkweekConfig` results. */ - workweekConfigs?: WorkweekConfig[]; - /** - * The value supplied in the subsequent request to fetch the next page of - * `WorkweekConfig` results. - */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const listWorkweekConfigsResponseSchema: Schema = object( - { - workweekConfigs: [ - 'workweek_configs', - optional(array(lazy(() => workweekConfigSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/location.ts b/src/models/location.ts deleted file mode 100644 index e6a5f0f8e..000000000 --- a/src/models/location.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { BusinessHours, businessHoursSchema } from './businessHours'; -import { Coordinates, coordinatesSchema } from './coordinates'; -import { TaxIds, taxIdsSchema } from './taxIds'; - -/** Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ -export interface Location { - /** A short generated string of letters and numbers that uniquely identifies this location instance. */ - id?: string; - /** - * The name of the location. - * This information appears in the Seller Dashboard as the nickname. - * A location name must be unique within a seller account. - */ - name?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; - /** - * The [IANA time zone](https://www.iana.org/time-zones) identifier for - * the time zone of the location. For example, `America/Los_Angeles`. - */ - timezone?: string | null; - /** - * The Square features that are enabled for the location. - * See [LocationCapability](entity:LocationCapability) for possible values. - * See [LocationCapability](#type-locationcapability) for possible values - */ - capabilities?: string[]; - /** A location's status. */ - status?: string; - /** - * The time when the location was created, in RFC 3339 format. - * For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). - */ - createdAt?: string; - /** The ID of the merchant that owns the location. */ - merchantId?: string; - /** - * Indicates the country associated with another entity, such as a business. - * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). - */ - country?: string; - /** - * The language associated with the location, in - * [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). - * For more information, see [Language Preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences). - */ - languageCode?: string | null; - /** - * Indicates the associated currency for an amount of money. Values correspond - * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). - */ - currency?: string; - /** The phone number of the location. For example, `+1 855-700-6000`. */ - phoneNumber?: string | null; - /** The name of the location's overall business. This name is present on receipts and other customer-facing branding, and can be changed no more than three times in a twelve-month period. */ - businessName?: string | null; - /** A location's type. */ - type?: string; - /** The website URL of the location. For example, `https://squareup.com`. */ - websiteUrl?: string | null; - /** The hours of operation for a location. */ - businessHours?: BusinessHours; - /** The email address of the location. This can be unique to the location and is not always the email address for the business owner or administrator. */ - businessEmail?: string | null; - /** The description of the location. For example, `Main Street location`. */ - description?: string | null; - /** The Twitter username of the location without the '@' symbol. For example, `Square`. */ - twitterUsername?: string | null; - /** The Instagram username of the location without the '@' symbol. For example, `square`. */ - instagramUsername?: string | null; - /** The Facebook profile URL of the location. The URL should begin with 'facebook.com/'. For example, `https://www.facebook.com/square`. */ - facebookUrl?: string | null; - /** Latitude and longitude coordinates. */ - coordinates?: Coordinates; - /** - * The URL of the logo image for the location. When configured in the Seller - * Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller. - * This image should have a roughly square (1:1) aspect ratio and should be at least 200x200 pixels. - */ - logoUrl?: string; - /** The URL of the Point of Sale background image for the location. */ - posBackgroundUrl?: string; - /** - * A four-digit number that describes the kind of goods or services sold at the location. - * The [merchant category code (MCC)](https://developer.squareup.com/docs/locations-api#initialize-a-merchant-category-code) of the location as standardized by ISO 18245. - * For example, `5045`, for a location that sells computer goods and software. - */ - mcc?: string | null; - /** - * The URL of a full-format logo image for the location. When configured in the Seller - * Dashboard (Receipts section), the logo appears on transactions (such as receipts and invoices) that Square generates on behalf of the seller. - * This image can be wider than it is tall and should be at least 1280x648 pixels. - */ - fullFormatLogoUrl?: string; - /** Identifiers for the location used by various governments for tax purposes. */ - taxIds?: TaxIds; -} - -export const locationSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', optional(nullable(string()))], - address: ['address', optional(lazy(() => addressSchema))], - timezone: ['timezone', optional(nullable(string()))], - capabilities: ['capabilities', optional(array(string()))], - status: ['status', optional(string())], - createdAt: ['created_at', optional(string())], - merchantId: ['merchant_id', optional(string())], - country: ['country', optional(string())], - languageCode: ['language_code', optional(nullable(string()))], - currency: ['currency', optional(string())], - phoneNumber: ['phone_number', optional(nullable(string()))], - businessName: ['business_name', optional(nullable(string()))], - type: ['type', optional(string())], - websiteUrl: ['website_url', optional(nullable(string()))], - businessHours: ['business_hours', optional(lazy(() => businessHoursSchema))], - businessEmail: ['business_email', optional(nullable(string()))], - description: ['description', optional(nullable(string()))], - twitterUsername: ['twitter_username', optional(nullable(string()))], - instagramUsername: ['instagram_username', optional(nullable(string()))], - facebookUrl: ['facebook_url', optional(nullable(string()))], - coordinates: ['coordinates', optional(lazy(() => coordinatesSchema))], - logoUrl: ['logo_url', optional(string())], - posBackgroundUrl: ['pos_background_url', optional(string())], - mcc: ['mcc', optional(nullable(string()))], - fullFormatLogoUrl: ['full_format_logo_url', optional(string())], - taxIds: ['tax_ids', optional(lazy(() => taxIdsSchema))], -}); diff --git a/src/models/locationBookingProfile.ts b/src/models/locationBookingProfile.ts deleted file mode 100644 index 1c75253cd..000000000 --- a/src/models/locationBookingProfile.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. */ -export interface LocationBookingProfile { - /** The ID of the [location](entity:Location). */ - locationId?: string | null; - /** Url for the online booking site for this location. */ - bookingSiteUrl?: string | null; - /** Indicates whether the location is enabled for online booking. */ - onlineBookingEnabled?: boolean | null; -} - -export const locationBookingProfileSchema: Schema = object( - { - locationId: ['location_id', optional(nullable(string()))], - bookingSiteUrl: ['booking_site_url', optional(nullable(string()))], - onlineBookingEnabled: [ - 'online_booking_enabled', - optional(nullable(boolean())), - ], - } -); diff --git a/src/models/loyaltyAccount.ts b/src/models/loyaltyAccount.ts deleted file mode 100644 index 38cbadde9..000000000 --- a/src/models/loyaltyAccount.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - LoyaltyAccountExpiringPointDeadline, - loyaltyAccountExpiringPointDeadlineSchema, -} from './loyaltyAccountExpiringPointDeadline'; -import { - LoyaltyAccountMapping, - loyaltyAccountMappingSchema, -} from './loyaltyAccountMapping'; - -/** - * Describes a loyalty account in a [loyalty program]($m/LoyaltyProgram). For more information, see - * [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). - */ -export interface LoyaltyAccount { - /** The Square-assigned ID of the loyalty account. */ - id?: string; - /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram) to which the account belongs. */ - programId: string; - /** - * The available point balance in the loyalty account. If points are scheduled to expire, they are listed in the `expiring_point_deadlines` field. - * Your application should be able to handle loyalty accounts that have a negative point balance (`balance` is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange. - */ - balance?: number; - /** The total points accrued during the lifetime of the account. */ - lifetimePoints?: number; - /** The Square-assigned ID of the [customer](entity:Customer) that is associated with the account. */ - customerId?: string | null; - /** - * The timestamp when the buyer joined the loyalty program, in RFC 3339 format. This field is used to display the **Enrolled On** or **Member Since** date in first-party Square products. - * If this field is not set in a `CreateLoyaltyAccount` request, Square populates it after the buyer's first action on their account - * (when `AccumulateLoyaltyPoints` or `CreateLoyaltyReward` is called). In first-party flows, Square populates the field when the buyer agrees to the terms of service in Square Point of Sale. - * This field is typically specified in a `CreateLoyaltyAccount` request when creating a loyalty account for a buyer who already interacted with their account. - * For example, you would set this field when migrating accounts from an external system. The timestamp in the request can represent a current or previous date and time, but it cannot be set for the future. - */ - enrolledAt?: string | null; - /** The timestamp when the loyalty account was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the loyalty account was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** - * Represents the mapping that associates a loyalty account with a buyer. - * Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see - * [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview). - */ - mapping?: LoyaltyAccountMapping; - /** - * The schedule for when points expire in the loyalty account balance. This field is present only if the account has points that are scheduled to expire. - * The total number of points in this field equals the number of points in the `balance` field. - */ - expiringPointDeadlines?: LoyaltyAccountExpiringPointDeadline[] | null; -} - -export const loyaltyAccountSchema: Schema = object({ - id: ['id', optional(string())], - programId: ['program_id', string()], - balance: ['balance', optional(number())], - lifetimePoints: ['lifetime_points', optional(number())], - customerId: ['customer_id', optional(nullable(string()))], - enrolledAt: ['enrolled_at', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - mapping: ['mapping', optional(lazy(() => loyaltyAccountMappingSchema))], - expiringPointDeadlines: [ - 'expiring_point_deadlines', - optional( - nullable(array(lazy(() => loyaltyAccountExpiringPointDeadlineSchema))) - ), - ], -}); diff --git a/src/models/loyaltyAccountExpiringPointDeadline.ts b/src/models/loyaltyAccountExpiringPointDeadline.ts deleted file mode 100644 index 8d31af33e..000000000 --- a/src/models/loyaltyAccountExpiringPointDeadline.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { number, object, Schema, string } from '../schema'; - -/** Represents a set of points for a loyalty account that are scheduled to expire on a specific date. */ -export interface LoyaltyAccountExpiringPointDeadline { - /** The number of points scheduled to expire at the `expires_at` timestamp. */ - points: number; - /** The timestamp of when the points are scheduled to expire, in RFC 3339 format. */ - expiresAt: string; -} - -export const loyaltyAccountExpiringPointDeadlineSchema: Schema = object( - { points: ['points', number()], expiresAt: ['expires_at', string()] } -); diff --git a/src/models/loyaltyAccountMapping.ts b/src/models/loyaltyAccountMapping.ts deleted file mode 100644 index a2318eeb1..000000000 --- a/src/models/loyaltyAccountMapping.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Represents the mapping that associates a loyalty account with a buyer. - * Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see - * [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview). - */ -export interface LoyaltyAccountMapping { - /** The Square-assigned ID of the mapping. */ - id?: string; - /** The timestamp when the mapping was created, in RFC 3339 format. */ - createdAt?: string; - /** The phone number of the buyer, in E.164 format. For example, "+14155551111". */ - phoneNumber?: string | null; -} - -export const loyaltyAccountMappingSchema: Schema = object( - { - id: ['id', optional(string())], - createdAt: ['created_at', optional(string())], - phoneNumber: ['phone_number', optional(nullable(string()))], - } -); diff --git a/src/models/loyaltyEvent.ts b/src/models/loyaltyEvent.ts deleted file mode 100644 index 651a1ce30..000000000 --- a/src/models/loyaltyEvent.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - LoyaltyEventAccumulatePoints, - loyaltyEventAccumulatePointsSchema, -} from './loyaltyEventAccumulatePoints'; -import { - LoyaltyEventAccumulatePromotionPoints, - loyaltyEventAccumulatePromotionPointsSchema, -} from './loyaltyEventAccumulatePromotionPoints'; -import { - LoyaltyEventAdjustPoints, - loyaltyEventAdjustPointsSchema, -} from './loyaltyEventAdjustPoints'; -import { - LoyaltyEventCreateReward, - loyaltyEventCreateRewardSchema, -} from './loyaltyEventCreateReward'; -import { - LoyaltyEventDeleteReward, - loyaltyEventDeleteRewardSchema, -} from './loyaltyEventDeleteReward'; -import { - LoyaltyEventExpirePoints, - loyaltyEventExpirePointsSchema, -} from './loyaltyEventExpirePoints'; -import { - LoyaltyEventOther, - loyaltyEventOtherSchema, -} from './loyaltyEventOther'; -import { - LoyaltyEventRedeemReward, - loyaltyEventRedeemRewardSchema, -} from './loyaltyEventRedeemReward'; - -/** - * Provides information about a loyalty event. - * For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). - */ -export interface LoyaltyEvent { - /** The Square-assigned ID of the loyalty event. */ - id: string; - /** The type of the loyalty event. */ - type: string; - /** The timestamp when the event was created, in RFC 3339 format. */ - createdAt: string; - /** Provides metadata when the event `type` is `ACCUMULATE_POINTS`. */ - accumulatePoints?: LoyaltyEventAccumulatePoints; - /** Provides metadata when the event `type` is `CREATE_REWARD`. */ - createReward?: LoyaltyEventCreateReward; - /** Provides metadata when the event `type` is `REDEEM_REWARD`. */ - redeemReward?: LoyaltyEventRedeemReward; - /** Provides metadata when the event `type` is `DELETE_REWARD`. */ - deleteReward?: LoyaltyEventDeleteReward; - /** Provides metadata when the event `type` is `ADJUST_POINTS`. */ - adjustPoints?: LoyaltyEventAdjustPoints; - /** The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event. */ - loyaltyAccountId: string; - /** The ID of the [location](entity:Location) where the event occurred. */ - locationId?: string; - /** Defines whether the event was generated by the Square Point of Sale. */ - source: string; - /** Provides metadata when the event `type` is `EXPIRE_POINTS`. */ - expirePoints?: LoyaltyEventExpirePoints; - /** Provides metadata when the event `type` is `OTHER`. */ - otherEvent?: LoyaltyEventOther; - /** Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. */ - accumulatePromotionPoints?: LoyaltyEventAccumulatePromotionPoints; -} - -export const loyaltyEventSchema: Schema = object({ - id: ['id', string()], - type: ['type', string()], - createdAt: ['created_at', string()], - accumulatePoints: [ - 'accumulate_points', - optional(lazy(() => loyaltyEventAccumulatePointsSchema)), - ], - createReward: [ - 'create_reward', - optional(lazy(() => loyaltyEventCreateRewardSchema)), - ], - redeemReward: [ - 'redeem_reward', - optional(lazy(() => loyaltyEventRedeemRewardSchema)), - ], - deleteReward: [ - 'delete_reward', - optional(lazy(() => loyaltyEventDeleteRewardSchema)), - ], - adjustPoints: [ - 'adjust_points', - optional(lazy(() => loyaltyEventAdjustPointsSchema)), - ], - loyaltyAccountId: ['loyalty_account_id', string()], - locationId: ['location_id', optional(string())], - source: ['source', string()], - expirePoints: [ - 'expire_points', - optional(lazy(() => loyaltyEventExpirePointsSchema)), - ], - otherEvent: ['other_event', optional(lazy(() => loyaltyEventOtherSchema))], - accumulatePromotionPoints: [ - 'accumulate_promotion_points', - optional(lazy(() => loyaltyEventAccumulatePromotionPointsSchema)), - ], -}); diff --git a/src/models/loyaltyEventAccumulatePoints.ts b/src/models/loyaltyEventAccumulatePoints.ts deleted file mode 100644 index 115252360..000000000 --- a/src/models/loyaltyEventAccumulatePoints.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Provides metadata when the event `type` is `ACCUMULATE_POINTS`. */ -export interface LoyaltyEventAccumulatePoints { - /** The ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; - /** The number of points accumulated by the event. */ - points?: number | null; - /** - * The ID of the [order](entity:Order) for which the buyer accumulated the points. - * This field is returned only if the Orders API is used to process orders. - */ - orderId?: string | null; -} - -export const loyaltyEventAccumulatePointsSchema: Schema = object( - { - loyaltyProgramId: ['loyalty_program_id', optional(string())], - points: ['points', optional(nullable(number()))], - orderId: ['order_id', optional(nullable(string()))], - } -); diff --git a/src/models/loyaltyEventAccumulatePromotionPoints.ts b/src/models/loyaltyEventAccumulatePromotionPoints.ts deleted file mode 100644 index a25c7bc1a..000000000 --- a/src/models/loyaltyEventAccumulatePromotionPoints.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { number, object, optional, Schema, string } from '../schema'; - -/** Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. */ -export interface LoyaltyEventAccumulatePromotionPoints { - /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; - /** The Square-assigned ID of the [loyalty promotion](entity:LoyaltyPromotion). */ - loyaltyPromotionId?: string; - /** The number of points earned by the event. */ - points: number; - /** - * The ID of the [order](entity:Order) for which the buyer earned the promotion points. - * Only applications that use the Orders API to process orders can trigger this event. - */ - orderId: string; -} - -export const loyaltyEventAccumulatePromotionPointsSchema: Schema = object( - { - loyaltyProgramId: ['loyalty_program_id', optional(string())], - loyaltyPromotionId: ['loyalty_promotion_id', optional(string())], - points: ['points', number()], - orderId: ['order_id', string()], - } -); diff --git a/src/models/loyaltyEventAdjustPoints.ts b/src/models/loyaltyEventAdjustPoints.ts deleted file mode 100644 index c2f560f7a..000000000 --- a/src/models/loyaltyEventAdjustPoints.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Provides metadata when the event `type` is `ADJUST_POINTS`. */ -export interface LoyaltyEventAdjustPoints { - /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId?: string; - /** The number of points added or removed. */ - points: number; - /** The reason for the adjustment of points. */ - reason?: string | null; -} - -export const loyaltyEventAdjustPointsSchema: Schema = object( - { - loyaltyProgramId: ['loyalty_program_id', optional(string())], - points: ['points', number()], - reason: ['reason', optional(nullable(string()))], - } -); diff --git a/src/models/loyaltyEventCreateReward.ts b/src/models/loyaltyEventCreateReward.ts deleted file mode 100644 index 31482cd97..000000000 --- a/src/models/loyaltyEventCreateReward.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { number, object, optional, Schema, string } from '../schema'; - -/** Provides metadata when the event `type` is `CREATE_REWARD`. */ -export interface LoyaltyEventCreateReward { - /** The ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId: string; - /** - * The Square-assigned ID of the created [loyalty reward](entity:LoyaltyReward). - * This field is returned only if the event source is `LOYALTY_API`. - */ - rewardId?: string; - /** The loyalty points used to create the reward. */ - points: number; -} - -export const loyaltyEventCreateRewardSchema: Schema = object( - { - loyaltyProgramId: ['loyalty_program_id', string()], - rewardId: ['reward_id', optional(string())], - points: ['points', number()], - } -); diff --git a/src/models/loyaltyEventDateTimeFilter.ts b/src/models/loyaltyEventDateTimeFilter.ts deleted file mode 100644 index a9d0f7aaa..000000000 --- a/src/models/loyaltyEventDateTimeFilter.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -/** Filter events by date time range. */ -export interface LoyaltyEventDateTimeFilter { - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - createdAt: TimeRange; -} - -export const loyaltyEventDateTimeFilterSchema: Schema = object( - { createdAt: ['created_at', lazy(() => timeRangeSchema)] } -); diff --git a/src/models/loyaltyEventDeleteReward.ts b/src/models/loyaltyEventDeleteReward.ts deleted file mode 100644 index 610a002f1..000000000 --- a/src/models/loyaltyEventDeleteReward.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { number, object, optional, Schema, string } from '../schema'; - -/** Provides metadata when the event `type` is `DELETE_REWARD`. */ -export interface LoyaltyEventDeleteReward { - /** The ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId: string; - /** - * The ID of the deleted [loyalty reward](entity:LoyaltyReward). - * This field is returned only if the event source is `LOYALTY_API`. - */ - rewardId?: string; - /** The number of points returned to the loyalty account. */ - points: number; -} - -export const loyaltyEventDeleteRewardSchema: Schema = object( - { - loyaltyProgramId: ['loyalty_program_id', string()], - rewardId: ['reward_id', optional(string())], - points: ['points', number()], - } -); diff --git a/src/models/loyaltyEventExpirePoints.ts b/src/models/loyaltyEventExpirePoints.ts deleted file mode 100644 index 490a852b9..000000000 --- a/src/models/loyaltyEventExpirePoints.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { number, object, Schema, string } from '../schema'; - -/** Provides metadata when the event `type` is `EXPIRE_POINTS`. */ -export interface LoyaltyEventExpirePoints { - /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId: string; - /** The number of points expired. */ - points: number; -} - -export const loyaltyEventExpirePointsSchema: Schema = object( - { - loyaltyProgramId: ['loyalty_program_id', string()], - points: ['points', number()], - } -); diff --git a/src/models/loyaltyEventFilter.ts b/src/models/loyaltyEventFilter.ts deleted file mode 100644 index e5665cedd..000000000 --- a/src/models/loyaltyEventFilter.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - LoyaltyEventDateTimeFilter, - loyaltyEventDateTimeFilterSchema, -} from './loyaltyEventDateTimeFilter'; -import { - LoyaltyEventLocationFilter, - loyaltyEventLocationFilterSchema, -} from './loyaltyEventLocationFilter'; -import { - LoyaltyEventLoyaltyAccountFilter, - loyaltyEventLoyaltyAccountFilterSchema, -} from './loyaltyEventLoyaltyAccountFilter'; -import { - LoyaltyEventOrderFilter, - loyaltyEventOrderFilterSchema, -} from './loyaltyEventOrderFilter'; -import { - LoyaltyEventTypeFilter, - loyaltyEventTypeFilterSchema, -} from './loyaltyEventTypeFilter'; - -/** - * The filtering criteria. If the request specifies multiple filters, - * the endpoint uses a logical AND to evaluate them. - */ -export interface LoyaltyEventFilter { - /** Filter events by loyalty account. */ - loyaltyAccountFilter?: LoyaltyEventLoyaltyAccountFilter; - /** Filter events by event type. */ - typeFilter?: LoyaltyEventTypeFilter; - /** Filter events by date time range. */ - dateTimeFilter?: LoyaltyEventDateTimeFilter; - /** Filter events by location. */ - locationFilter?: LoyaltyEventLocationFilter; - /** Filter events by the order associated with the event. */ - orderFilter?: LoyaltyEventOrderFilter; -} - -export const loyaltyEventFilterSchema: Schema = object({ - loyaltyAccountFilter: [ - 'loyalty_account_filter', - optional(lazy(() => loyaltyEventLoyaltyAccountFilterSchema)), - ], - typeFilter: [ - 'type_filter', - optional(lazy(() => loyaltyEventTypeFilterSchema)), - ], - dateTimeFilter: [ - 'date_time_filter', - optional(lazy(() => loyaltyEventDateTimeFilterSchema)), - ], - locationFilter: [ - 'location_filter', - optional(lazy(() => loyaltyEventLocationFilterSchema)), - ], - orderFilter: [ - 'order_filter', - optional(lazy(() => loyaltyEventOrderFilterSchema)), - ], -}); diff --git a/src/models/loyaltyEventLocationFilter.ts b/src/models/loyaltyEventLocationFilter.ts deleted file mode 100644 index df5be7d4c..000000000 --- a/src/models/loyaltyEventLocationFilter.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** Filter events by location. */ -export interface LoyaltyEventLocationFilter { - /** - * The [location](entity:Location) IDs for loyalty events to query. - * If multiple values are specified, the endpoint uses - * a logical OR to combine them. - */ - locationIds: string[]; -} - -export const loyaltyEventLocationFilterSchema: Schema = object( - { locationIds: ['location_ids', array(string())] } -); diff --git a/src/models/loyaltyEventLoyaltyAccountFilter.ts b/src/models/loyaltyEventLoyaltyAccountFilter.ts deleted file mode 100644 index 0724d4259..000000000 --- a/src/models/loyaltyEventLoyaltyAccountFilter.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Filter events by loyalty account. */ -export interface LoyaltyEventLoyaltyAccountFilter { - /** The ID of the [loyalty account](entity:LoyaltyAccount) associated with loyalty events. */ - loyaltyAccountId: string; -} - -export const loyaltyEventLoyaltyAccountFilterSchema: Schema = object( - { loyaltyAccountId: ['loyalty_account_id', string()] } -); diff --git a/src/models/loyaltyEventOrderFilter.ts b/src/models/loyaltyEventOrderFilter.ts deleted file mode 100644 index 3aa40343a..000000000 --- a/src/models/loyaltyEventOrderFilter.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Filter events by the order associated with the event. */ -export interface LoyaltyEventOrderFilter { - /** The ID of the [order](entity:Order) associated with the event. */ - orderId: string; -} - -export const loyaltyEventOrderFilterSchema: Schema = object( - { orderId: ['order_id', string()] } -); diff --git a/src/models/loyaltyEventOther.ts b/src/models/loyaltyEventOther.ts deleted file mode 100644 index 6649b0bbf..000000000 --- a/src/models/loyaltyEventOther.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { number, object, Schema, string } from '../schema'; - -/** Provides metadata when the event `type` is `OTHER`. */ -export interface LoyaltyEventOther { - /** The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId: string; - /** The number of points added or removed. */ - points: number; -} - -export const loyaltyEventOtherSchema: Schema = object({ - loyaltyProgramId: ['loyalty_program_id', string()], - points: ['points', number()], -}); diff --git a/src/models/loyaltyEventQuery.ts b/src/models/loyaltyEventQuery.ts deleted file mode 100644 index 5b74398a3..000000000 --- a/src/models/loyaltyEventQuery.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - LoyaltyEventFilter, - loyaltyEventFilterSchema, -} from './loyaltyEventFilter'; - -/** Represents a query used to search for loyalty events. */ -export interface LoyaltyEventQuery { - /** - * The filtering criteria. If the request specifies multiple filters, - * the endpoint uses a logical AND to evaluate them. - */ - filter?: LoyaltyEventFilter; -} - -export const loyaltyEventQuerySchema: Schema = object({ - filter: ['filter', optional(lazy(() => loyaltyEventFilterSchema))], -}); diff --git a/src/models/loyaltyEventRedeemReward.ts b/src/models/loyaltyEventRedeemReward.ts deleted file mode 100644 index 1ff4859e8..000000000 --- a/src/models/loyaltyEventRedeemReward.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Provides metadata when the event `type` is `REDEEM_REWARD`. */ -export interface LoyaltyEventRedeemReward { - /** The ID of the [loyalty program](entity:LoyaltyProgram). */ - loyaltyProgramId: string; - /** - * The ID of the redeemed [loyalty reward](entity:LoyaltyReward). - * This field is returned only if the event source is `LOYALTY_API`. - */ - rewardId?: string; - /** - * The ID of the [order](entity:Order) that redeemed the reward. - * This field is returned only if the Orders API is used to process orders. - */ - orderId?: string; -} - -export const loyaltyEventRedeemRewardSchema: Schema = object( - { - loyaltyProgramId: ['loyalty_program_id', string()], - rewardId: ['reward_id', optional(string())], - orderId: ['order_id', optional(string())], - } -); diff --git a/src/models/loyaltyEventTypeFilter.ts b/src/models/loyaltyEventTypeFilter.ts deleted file mode 100644 index d76293eca..000000000 --- a/src/models/loyaltyEventTypeFilter.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** Filter events by event type. */ -export interface LoyaltyEventTypeFilter { - /** - * The loyalty event types used to filter the result. - * If multiple values are specified, the endpoint uses a - * logical OR to combine them. - * See [LoyaltyEventType](#type-loyaltyeventtype) for possible values - */ - types: string[]; -} - -export const loyaltyEventTypeFilterSchema: Schema = object( - { types: ['types', array(string())] } -); diff --git a/src/models/loyaltyProgram.ts b/src/models/loyaltyProgram.ts deleted file mode 100644 index 3433b67e5..000000000 --- a/src/models/loyaltyProgram.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - LoyaltyProgramAccrualRule, - loyaltyProgramAccrualRuleSchema, -} from './loyaltyProgramAccrualRule'; -import { - LoyaltyProgramExpirationPolicy, - loyaltyProgramExpirationPolicySchema, -} from './loyaltyProgramExpirationPolicy'; -import { - LoyaltyProgramRewardTier, - loyaltyProgramRewardTierSchema, -} from './loyaltyProgramRewardTier'; -import { - LoyaltyProgramTerminology, - loyaltyProgramTerminologySchema, -} from './loyaltyProgramTerminology'; - -/** - * Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards. - * Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. - * For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). - */ -export interface LoyaltyProgram { - /** - * The Square-assigned ID of the loyalty program. Updates to - * the loyalty program do not modify the identifier. - */ - id?: string; - /** Indicates whether the program is currently active. */ - status?: string; - /** The list of rewards for buyers, sorted by ascending points. */ - rewardTiers?: LoyaltyProgramRewardTier[] | null; - /** Describes when the loyalty program expires. */ - expirationPolicy?: LoyaltyProgramExpirationPolicy; - /** Represents the naming used for loyalty points. */ - terminology?: LoyaltyProgramTerminology; - /** The [locations](entity:Location) at which the program is active. */ - locationIds?: string[] | null; - /** The timestamp when the program was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the reward was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** - * Defines how buyers can earn loyalty points from the base loyalty program. - * To check for associated [loyalty promotions](entity:LoyaltyPromotion) that enable - * buyers to earn extra points, call [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions). - */ - accrualRules?: LoyaltyProgramAccrualRule[] | null; -} - -export const loyaltyProgramSchema: Schema = object({ - id: ['id', optional(string())], - status: ['status', optional(string())], - rewardTiers: [ - 'reward_tiers', - optional(nullable(array(lazy(() => loyaltyProgramRewardTierSchema)))), - ], - expirationPolicy: [ - 'expiration_policy', - optional(lazy(() => loyaltyProgramExpirationPolicySchema)), - ], - terminology: [ - 'terminology', - optional(lazy(() => loyaltyProgramTerminologySchema)), - ], - locationIds: ['location_ids', optional(nullable(array(string())))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - accrualRules: [ - 'accrual_rules', - optional(nullable(array(lazy(() => loyaltyProgramAccrualRuleSchema)))), - ], -}); diff --git a/src/models/loyaltyProgramAccrualRule.ts b/src/models/loyaltyProgramAccrualRule.ts deleted file mode 100644 index 5ec8eafc8..000000000 --- a/src/models/loyaltyProgramAccrualRule.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - LoyaltyProgramAccrualRuleCategoryData, - loyaltyProgramAccrualRuleCategoryDataSchema, -} from './loyaltyProgramAccrualRuleCategoryData'; -import { - LoyaltyProgramAccrualRuleItemVariationData, - loyaltyProgramAccrualRuleItemVariationDataSchema, -} from './loyaltyProgramAccrualRuleItemVariationData'; -import { - LoyaltyProgramAccrualRuleSpendData, - loyaltyProgramAccrualRuleSpendDataSchema, -} from './loyaltyProgramAccrualRuleSpendData'; -import { - LoyaltyProgramAccrualRuleVisitData, - loyaltyProgramAccrualRuleVisitDataSchema, -} from './loyaltyProgramAccrualRuleVisitData'; - -/** Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program]($m/LoyaltyProgram). */ -export interface LoyaltyProgramAccrualRule { - /** The type of the accrual rule that defines how buyers can earn points. */ - accrualType: string; - /** - * The number of points that - * buyers earn based on the `accrual_type`. - */ - points?: number | null; - /** Represents additional data for rules with the `VISIT` accrual type. */ - visitData?: LoyaltyProgramAccrualRuleVisitData; - /** Represents additional data for rules with the `SPEND` accrual type. */ - spendData?: LoyaltyProgramAccrualRuleSpendData; - /** Represents additional data for rules with the `ITEM_VARIATION` accrual type. */ - itemVariationData?: LoyaltyProgramAccrualRuleItemVariationData; - /** Represents additional data for rules with the `CATEGORY` accrual type. */ - categoryData?: LoyaltyProgramAccrualRuleCategoryData; -} - -export const loyaltyProgramAccrualRuleSchema: Schema = object( - { - accrualType: ['accrual_type', string()], - points: ['points', optional(nullable(number()))], - visitData: [ - 'visit_data', - optional(lazy(() => loyaltyProgramAccrualRuleVisitDataSchema)), - ], - spendData: [ - 'spend_data', - optional(lazy(() => loyaltyProgramAccrualRuleSpendDataSchema)), - ], - itemVariationData: [ - 'item_variation_data', - optional(lazy(() => loyaltyProgramAccrualRuleItemVariationDataSchema)), - ], - categoryData: [ - 'category_data', - optional(lazy(() => loyaltyProgramAccrualRuleCategoryDataSchema)), - ], - } -); diff --git a/src/models/loyaltyProgramAccrualRuleCategoryData.ts b/src/models/loyaltyProgramAccrualRuleCategoryData.ts deleted file mode 100644 index 286022043..000000000 --- a/src/models/loyaltyProgramAccrualRuleCategoryData.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Represents additional data for rules with the `CATEGORY` accrual type. */ -export interface LoyaltyProgramAccrualRuleCategoryData { - /** - * The ID of the `CATEGORY` [catalog object](entity:CatalogObject) that buyers can purchase to earn - * points. - */ - categoryId: string; -} - -export const loyaltyProgramAccrualRuleCategoryDataSchema: Schema = object( - { categoryId: ['category_id', string()] } -); diff --git a/src/models/loyaltyProgramAccrualRuleItemVariationData.ts b/src/models/loyaltyProgramAccrualRuleItemVariationData.ts deleted file mode 100644 index 248686255..000000000 --- a/src/models/loyaltyProgramAccrualRuleItemVariationData.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Represents additional data for rules with the `ITEM_VARIATION` accrual type. */ -export interface LoyaltyProgramAccrualRuleItemVariationData { - /** - * The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to earn - * points. - */ - itemVariationId: string; -} - -export const loyaltyProgramAccrualRuleItemVariationDataSchema: Schema = object( - { itemVariationId: ['item_variation_id', string()] } -); diff --git a/src/models/loyaltyProgramAccrualRuleSpendData.ts b/src/models/loyaltyProgramAccrualRuleSpendData.ts deleted file mode 100644 index 26c5f4991..000000000 --- a/src/models/loyaltyProgramAccrualRuleSpendData.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents additional data for rules with the `SPEND` accrual type. */ -export interface LoyaltyProgramAccrualRuleSpendData { - /** - * 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. - */ - amountMoney: Money; - /** - * The IDs of any `CATEGORY` catalog objects that are excluded from points accrual. - * You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) - * endpoint to retrieve information about the excluded categories. - */ - excludedCategoryIds?: string[] | null; - /** - * The IDs of any `ITEM_VARIATION` catalog objects that are excluded from points accrual. - * You can use the [BatchRetrieveCatalogObjects](api-endpoint:Catalog-BatchRetrieveCatalogObjects) - * endpoint to retrieve information about the excluded item variations. - */ - excludedItemVariationIds?: string[] | null; - /** - * Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual. - * This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. - */ - taxMode: string; -} - -export const loyaltyProgramAccrualRuleSpendDataSchema: Schema = object( - { - amountMoney: ['amount_money', lazy(() => moneySchema)], - excludedCategoryIds: [ - 'excluded_category_ids', - optional(nullable(array(string()))), - ], - excludedItemVariationIds: [ - 'excluded_item_variation_ids', - optional(nullable(array(string()))), - ], - taxMode: ['tax_mode', string()], - } -); diff --git a/src/models/loyaltyProgramAccrualRuleVisitData.ts b/src/models/loyaltyProgramAccrualRuleVisitData.ts deleted file mode 100644 index a9a80cecc..000000000 --- a/src/models/loyaltyProgramAccrualRuleVisitData.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents additional data for rules with the `VISIT` accrual type. */ -export interface LoyaltyProgramAccrualRuleVisitData { - /** - * 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. - */ - minimumAmountMoney?: Money; - /** - * Indicates how taxes should be treated when calculating the purchase amount used for loyalty points accrual. - * This setting applies only to `SPEND` accrual rules or `VISIT` accrual rules that have a minimum spend requirement. - */ - taxMode: string; -} - -export const loyaltyProgramAccrualRuleVisitDataSchema: Schema = object( - { - minimumAmountMoney: [ - 'minimum_amount_money', - optional(lazy(() => moneySchema)), - ], - taxMode: ['tax_mode', string()], - } -); diff --git a/src/models/loyaltyProgramExpirationPolicy.ts b/src/models/loyaltyProgramExpirationPolicy.ts deleted file mode 100644 index e325e96bf..000000000 --- a/src/models/loyaltyProgramExpirationPolicy.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Describes when the loyalty program expires. */ -export interface LoyaltyProgramExpirationPolicy { - /** - * The number of months before points expire, in `P[n]M` RFC 3339 duration format. For example, a value of `P12M` represents a duration of 12 months. - * Points are valid through the last day of the month in which they are scheduled to expire. For example, with a `P12M` duration, points earned on July 6, 2020 expire on August 1, 2021. - */ - expirationDuration: string; -} - -export const loyaltyProgramExpirationPolicySchema: Schema = object( - { expirationDuration: ['expiration_duration', string()] } -); diff --git a/src/models/loyaltyProgramRewardDefinition.ts b/src/models/loyaltyProgramRewardDefinition.ts deleted file mode 100644 index 0a03215eb..000000000 --- a/src/models/loyaltyProgramRewardDefinition.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details - * are now defined using a catalog pricing rule and other catalog objects. For more information, see - * [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). - */ -export interface LoyaltyProgramRewardDefinition { - /** - * Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. Discount details - * are now defined using a catalog pricing rule and other catalog objects. For more information, see - * [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). - */ - scope: string; - /** - * The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. Discount details - * are now defined using a catalog pricing rule and other catalog objects. For more information, see - * [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). - */ - discountType: string; - /** - * The fixed percentage of the discount. Present if `discount_type` is `FIXED_PERCENTAGE`. - * For example, a 7.25% off discount will be represented as "7.25". DEPRECATED at version 2020-12-16. You can find this - * information in the `discount_data.percentage` field of the `DISCOUNT` catalog object referenced by the pricing rule. - */ - percentageDiscount?: string; - /** - * The list of catalog objects to which this reward can be applied. They are either all item-variation ids or category ids, depending on the `type` field. - * DEPRECATED at version 2020-12-16. You can find this information in the `product_set_data.product_ids_any` field - * of the `PRODUCT_SET` catalog object referenced by the pricing rule. - */ - catalogObjectIds?: string[]; - /** - * 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. - */ - fixedDiscountMoney?: Money; - /** - * 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. - */ - maxDiscountMoney?: Money; -} - -export const loyaltyProgramRewardDefinitionSchema: Schema = object( - { - scope: ['scope', string()], - discountType: ['discount_type', string()], - percentageDiscount: ['percentage_discount', optional(string())], - catalogObjectIds: ['catalog_object_ids', optional(array(string()))], - fixedDiscountMoney: [ - 'fixed_discount_money', - optional(lazy(() => moneySchema)), - ], - maxDiscountMoney: ['max_discount_money', optional(lazy(() => moneySchema))], - } -); diff --git a/src/models/loyaltyProgramRewardTier.ts b/src/models/loyaltyProgramRewardTier.ts deleted file mode 100644 index 824f870ee..000000000 --- a/src/models/loyaltyProgramRewardTier.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - CatalogObjectReference, - catalogObjectReferenceSchema, -} from './catalogObjectReference'; -import { - LoyaltyProgramRewardDefinition, - loyaltyProgramRewardDefinitionSchema, -} from './loyaltyProgramRewardDefinition'; - -/** Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers. */ -export interface LoyaltyProgramRewardTier { - /** The Square-assigned ID of the reward tier. */ - id?: string; - /** The points exchanged for the reward tier. */ - points: number; - /** The name of the reward tier. */ - name?: string; - /** - * Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details - * are now defined using a catalog pricing rule and other catalog objects. For more information, see - * [Getting discount details for a reward tier](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards#get-discount-details). - */ - definition?: LoyaltyProgramRewardDefinition; - /** The timestamp when the reward tier was created, in RFC 3339 format. */ - createdAt?: string; - /** - * A reference to a Catalog object at a specific version. In general this is - * used as an entry point into a graph of catalog objects, where the objects exist - * at a specific version. - */ - pricingRuleReference: CatalogObjectReference; -} - -export const loyaltyProgramRewardTierSchema: Schema = object( - { - id: ['id', optional(string())], - points: ['points', number()], - name: ['name', optional(string())], - definition: [ - 'definition', - optional(lazy(() => loyaltyProgramRewardDefinitionSchema)), - ], - createdAt: ['created_at', optional(string())], - pricingRuleReference: [ - 'pricing_rule_reference', - lazy(() => catalogObjectReferenceSchema), - ], - } -); diff --git a/src/models/loyaltyProgramTerminology.ts b/src/models/loyaltyProgramTerminology.ts deleted file mode 100644 index a6118873c..000000000 --- a/src/models/loyaltyProgramTerminology.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Represents the naming used for loyalty points. */ -export interface LoyaltyProgramTerminology { - /** A singular unit for a point (for example, 1 point is called 1 star). */ - one: string; - /** A plural unit for point (for example, 10 points is called 10 stars). */ - other: string; -} - -export const loyaltyProgramTerminologySchema: Schema = object( - { one: ['one', string()], other: ['other', string()] } -); diff --git a/src/models/loyaltyPromotion.ts b/src/models/loyaltyPromotion.ts deleted file mode 100644 index 243e99bcf..000000000 --- a/src/models/loyaltyPromotion.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - LoyaltyPromotionAvailableTimeData, - loyaltyPromotionAvailableTimeDataSchema, -} from './loyaltyPromotionAvailableTimeData'; -import { - LoyaltyPromotionIncentive, - loyaltyPromotionIncentiveSchema, -} from './loyaltyPromotionIncentive'; -import { - LoyaltyPromotionTriggerLimit, - loyaltyPromotionTriggerLimitSchema, -} from './loyaltyPromotionTriggerLimit'; -import { Money, moneySchema } from './money'; - -/** - * Represents a promotion for a [loyalty program]($m/LoyaltyProgram). Loyalty promotions enable buyers - * to earn extra points on top of those earned from the base program. - * A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. - */ -export interface LoyaltyPromotion { - /** The Square-assigned ID of the promotion. */ - id?: string; - /** The name of the promotion. */ - name: string; - /** - * Represents how points for a [loyalty promotion]($m/LoyaltyPromotion) are calculated, - * either by multiplying the points earned from the base program or by adding a specified number - * of points to the points earned from the base program. - */ - incentive: LoyaltyPromotionIncentive; - /** - * Represents scheduling information that determines when purchases can qualify to earn points - * from a [loyalty promotion]($m/LoyaltyPromotion). - */ - availableTime: LoyaltyPromotionAvailableTimeData; - /** - * Represents the number of times a buyer can earn points during a [loyalty promotion]($m/LoyaltyPromotion). - * If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during - * the time that the promotion is available. - * A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. - */ - triggerLimit?: LoyaltyPromotionTriggerLimit; - /** Indicates the status of a [loyalty promotion]($m/LoyaltyPromotion). */ - status?: string; - /** The timestamp of when the promotion was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp of when the promotion was canceled, in RFC 3339 format. */ - canceledAt?: string; - /** The timestamp when the promotion was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** The ID of the [loyalty program](entity:LoyaltyProgram) associated with the promotion. */ - loyaltyProgramId?: string; - /** - * 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. - */ - minimumSpendAmountMoney?: Money; - /** - * The IDs of any qualifying `ITEM_VARIATION` [catalog objects](entity:CatalogObject). If specified, - * the purchase must include at least one of these items to qualify for the promotion. - * This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule. - * With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded. - * You can specify `qualifying_item_variation_ids` or `qualifying_category_ids` for a given promotion, but not both. - */ - qualifyingItemVariationIds?: string[] | null; - /** - * The IDs of any qualifying `CATEGORY` [catalog objects](entity:CatalogObject). If specified, - * the purchase must include at least one item from one of these categories to qualify for the promotion. - * This option is valid only if the base loyalty program uses a `VISIT` or `SPEND` accrual rule. - * With `SPEND` accrual rules, make sure that qualifying promotional items are not excluded. - * You can specify `qualifying_category_ids` or `qualifying_item_variation_ids` for a promotion, but not both. - */ - qualifyingCategoryIds?: string[] | null; -} - -export const loyaltyPromotionSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', string()], - incentive: ['incentive', lazy(() => loyaltyPromotionIncentiveSchema)], - availableTime: [ - 'available_time', - lazy(() => loyaltyPromotionAvailableTimeDataSchema), - ], - triggerLimit: [ - 'trigger_limit', - optional(lazy(() => loyaltyPromotionTriggerLimitSchema)), - ], - status: ['status', optional(string())], - createdAt: ['created_at', optional(string())], - canceledAt: ['canceled_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - loyaltyProgramId: ['loyalty_program_id', optional(string())], - minimumSpendAmountMoney: [ - 'minimum_spend_amount_money', - optional(lazy(() => moneySchema)), - ], - qualifyingItemVariationIds: [ - 'qualifying_item_variation_ids', - optional(nullable(array(string()))), - ], - qualifyingCategoryIds: [ - 'qualifying_category_ids', - optional(nullable(array(string()))), - ], -}); diff --git a/src/models/loyaltyPromotionAvailableTimeData.ts b/src/models/loyaltyPromotionAvailableTimeData.ts deleted file mode 100644 index 8e7422ace..000000000 --- a/src/models/loyaltyPromotionAvailableTimeData.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { array, object, optional, Schema, string } from '../schema'; - -/** - * Represents scheduling information that determines when purchases can qualify to earn points - * from a [loyalty promotion]($m/LoyaltyPromotion). - */ -export interface LoyaltyPromotionAvailableTimeData { - /** - * The date that the promotion starts, in `YYYY-MM-DD` format. Square populates this field - * based on the provided `time_periods`. - */ - startDate?: string; - /** - * The date that the promotion ends, in `YYYY-MM-DD` format. Square populates this field - * based on the provided `time_periods`. If an end date is not specified, an `ACTIVE` promotion - * remains available until it is canceled. - */ - endDate?: string; - /** - * A list of [iCalendar (RFC 5545) events](https://tools.ietf.org/html/rfc5545#section-3.6.1) - * (`VEVENT`). Each event represents an available time period per day or days of the week. - * A day can have a maximum of one available time period. - * Only `DTSTART`, `DURATION`, and `RRULE` are supported. `DTSTART` and `DURATION` are required and - * timestamps must be in local (unzoned) time format. Include `RRULE` to specify recurring promotions, - * an end date (using the `UNTIL` keyword), or both. For more information, see - * [Available time](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#available-time). - * Note that `BEGIN:VEVENT` and `END:VEVENT` are optional in a `CreateLoyaltyPromotion` request - * but are always included in the response. - */ - timePeriods: string[]; -} - -export const loyaltyPromotionAvailableTimeDataSchema: Schema = object( - { - startDate: ['start_date', optional(string())], - endDate: ['end_date', optional(string())], - timePeriods: ['time_periods', array(string())], - } -); diff --git a/src/models/loyaltyPromotionIncentive.ts b/src/models/loyaltyPromotionIncentive.ts deleted file mode 100644 index dba888db4..000000000 --- a/src/models/loyaltyPromotionIncentive.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - LoyaltyPromotionIncentivePointsAdditionData, - loyaltyPromotionIncentivePointsAdditionDataSchema, -} from './loyaltyPromotionIncentivePointsAdditionData'; -import { - LoyaltyPromotionIncentivePointsMultiplierData, - loyaltyPromotionIncentivePointsMultiplierDataSchema, -} from './loyaltyPromotionIncentivePointsMultiplierData'; - -/** - * Represents how points for a [loyalty promotion]($m/LoyaltyPromotion) are calculated, - * either by multiplying the points earned from the base program or by adding a specified number - * of points to the points earned from the base program. - */ -export interface LoyaltyPromotionIncentive { - /** - * Indicates the type of points incentive for a [loyalty promotion]($m/LoyaltyPromotion), - * which is used to determine how buyers can earn points from the promotion. - */ - type: string; - /** Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive]($m/LoyaltyPromotionIncentive). */ - pointsMultiplierData?: LoyaltyPromotionIncentivePointsMultiplierData; - /** Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive]($m/LoyaltyPromotionIncentive). */ - pointsAdditionData?: LoyaltyPromotionIncentivePointsAdditionData; -} - -export const loyaltyPromotionIncentiveSchema: Schema = object( - { - type: ['type', string()], - pointsMultiplierData: [ - 'points_multiplier_data', - optional(lazy(() => loyaltyPromotionIncentivePointsMultiplierDataSchema)), - ], - pointsAdditionData: [ - 'points_addition_data', - optional(lazy(() => loyaltyPromotionIncentivePointsAdditionDataSchema)), - ], - } -); diff --git a/src/models/loyaltyPromotionIncentivePointsAdditionData.ts b/src/models/loyaltyPromotionIncentivePointsAdditionData.ts deleted file mode 100644 index 49f2eac8f..000000000 --- a/src/models/loyaltyPromotionIncentivePointsAdditionData.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { number, object, Schema } from '../schema'; - -/** Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive]($m/LoyaltyPromotionIncentive). */ -export interface LoyaltyPromotionIncentivePointsAdditionData { - /** - * The number of additional points to earn each time the promotion is triggered. For example, - * suppose a purchase qualifies for 5 points from the base loyalty program. If the purchase also - * qualifies for a `POINTS_ADDITION` promotion incentive with a `points_addition` of 3, the buyer - * earns a total of 8 points (5 program points + 3 promotion points = 8 points). - */ - pointsAddition: number; -} - -export const loyaltyPromotionIncentivePointsAdditionDataSchema: Schema = object( - { pointsAddition: ['points_addition', number()] } -); diff --git a/src/models/loyaltyPromotionIncentivePointsMultiplierData.ts b/src/models/loyaltyPromotionIncentivePointsMultiplierData.ts deleted file mode 100644 index 1f1db0e66..000000000 --- a/src/models/loyaltyPromotionIncentivePointsMultiplierData.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive]($m/LoyaltyPromotionIncentive). */ -export interface LoyaltyPromotionIncentivePointsMultiplierData { - /** - * The multiplier used to calculate the number of points earned each time the promotion - * is triggered. For example, suppose a purchase qualifies for 5 points from the base loyalty program. - * If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a `points_multiplier` - * of 3, the buyer earns a total of 15 points (5 program points x 3 promotion multiplier = 15 points). - * DEPRECATED at version 2023-08-16. Replaced by the `multiplier` field. - * One of the following is required when specifying a points multiplier: - * - (Recommended) The `multiplier` field. - * - This deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` - * with the equivalent value. - */ - pointsMultiplier?: number | null; - /** - * The multiplier used to calculate the number of points earned each time the promotion is triggered, - * specified as a string representation of a decimal. Square supports multipliers up to 10x, with three - * point precision for decimal multipliers. For example, suppose a purchase qualifies for 4 points from the - * base loyalty program. If the purchase also qualifies for a `POINTS_MULTIPLIER` promotion incentive with a - * `multiplier` of "1.5", the buyer earns a total of 6 points (4 program points x 1.5 promotion multiplier = 6 points). - * Fractional points are dropped. - * One of the following is required when specifying a points multiplier: - * - (Recommended) This `multiplier` field. - * - The deprecated `points_multiplier` field. If provided in the request, Square also returns `multiplier` - * with the equivalent value. - */ - multiplier?: string | null; -} - -export const loyaltyPromotionIncentivePointsMultiplierDataSchema: Schema = object( - { - pointsMultiplier: ['points_multiplier', optional(nullable(number()))], - multiplier: ['multiplier', optional(nullable(string()))], - } -); diff --git a/src/models/loyaltyPromotionTriggerLimit.ts b/src/models/loyaltyPromotionTriggerLimit.ts deleted file mode 100644 index 7dacb6c05..000000000 --- a/src/models/loyaltyPromotionTriggerLimit.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { number, object, optional, Schema, string } from '../schema'; - -/** - * Represents the number of times a buyer can earn points during a [loyalty promotion]($m/LoyaltyPromotion). - * If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during - * the time that the promotion is available. - * A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. - */ -export interface LoyaltyPromotionTriggerLimit { - /** The maximum number of times a buyer can trigger the promotion during the specified `interval`. */ - times: number; - /** - * Indicates the time period that the [trigger limit]($m/LoyaltyPromotionTriggerLimit) applies to, - * which is used to determine the number of times a buyer can earn points for a [loyalty promotion]($m/LoyaltyPromotion). - */ - interval?: string; -} - -export const loyaltyPromotionTriggerLimitSchema: Schema = object( - { times: ['times', number()], interval: ['interval', optional(string())] } -); diff --git a/src/models/loyaltyReward.ts b/src/models/loyaltyReward.ts deleted file mode 100644 index 3510b2883..000000000 --- a/src/models/loyaltyReward.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Represents a contract to redeem loyalty points for a [reward tier]($m/LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. - * For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). - */ -export interface LoyaltyReward { - /** The Square-assigned ID of the loyalty reward. */ - id?: string; - /** The status of the loyalty reward. */ - status?: string; - /** The Square-assigned ID of the [loyalty account](entity:LoyaltyAccount) to which the reward belongs. */ - loyaltyAccountId: string; - /** The Square-assigned ID of the [reward tier](entity:LoyaltyProgramRewardTier) used to create the reward. */ - rewardTierId: string; - /** The number of loyalty points used for the reward. */ - points?: number; - /** The Square-assigned ID of the [order](entity:Order) to which the reward is attached. */ - orderId?: string | null; - /** The timestamp when the reward was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the reward was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** The timestamp when the reward was redeemed, in RFC 3339 format. */ - redeemedAt?: string; -} - -export const loyaltyRewardSchema: Schema = object({ - id: ['id', optional(string())], - status: ['status', optional(string())], - loyaltyAccountId: ['loyalty_account_id', string()], - rewardTierId: ['reward_tier_id', string()], - points: ['points', optional(number())], - orderId: ['order_id', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - redeemedAt: ['redeemed_at', optional(string())], -}); diff --git a/src/models/measurementUnit.ts b/src/models/measurementUnit.ts deleted file mode 100644 index bbd6693e2..000000000 --- a/src/models/measurementUnit.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - MeasurementUnitCustom, - measurementUnitCustomSchema, -} from './measurementUnitCustom'; - -/** - * Represents a unit of measurement to use with a quantity, such as ounces - * or inches. Exactly one of the following fields are required: `custom_unit`, - * `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. - */ -export interface MeasurementUnit { - /** The information needed to define a custom unit, provided by the seller. */ - customUnit?: MeasurementUnitCustom; - /** Unit of area used to measure a quantity. */ - areaUnit?: string; - /** The unit of length used to measure a quantity. */ - lengthUnit?: string; - /** The unit of volume used to measure a quantity. */ - volumeUnit?: string; - /** Unit of weight used to measure a quantity. */ - weightUnit?: string; - genericUnit?: string; - /** Unit of time used to measure a quantity (a duration). */ - timeUnit?: string; - /** Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. */ - type?: string; -} - -export const measurementUnitSchema: Schema = object({ - customUnit: [ - 'custom_unit', - optional(lazy(() => measurementUnitCustomSchema)), - ], - areaUnit: ['area_unit', optional(string())], - lengthUnit: ['length_unit', optional(string())], - volumeUnit: ['volume_unit', optional(string())], - weightUnit: ['weight_unit', optional(string())], - genericUnit: ['generic_unit', optional(string())], - timeUnit: ['time_unit', optional(string())], - type: ['type', optional(string())], -}); diff --git a/src/models/measurementUnitCustom.ts b/src/models/measurementUnitCustom.ts deleted file mode 100644 index 89ea114b3..000000000 --- a/src/models/measurementUnitCustom.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** The information needed to define a custom unit, provided by the seller. */ -export interface MeasurementUnitCustom { - /** The name of the custom unit, for example "bushel". */ - name: string; - /** - * The abbreviation of the custom unit, such as "bsh" (bushel). This appears - * in the cart for the Point of Sale app, and in reports. - */ - abbreviation: string; -} - -export const measurementUnitCustomSchema: Schema = object( - { name: ['name', string()], abbreviation: ['abbreviation', string()] } -); diff --git a/src/models/merchant.ts b/src/models/merchant.ts deleted file mode 100644 index 8b113f80b..000000000 --- a/src/models/merchant.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Represents a business that sells with Square. */ -export interface Merchant { - /** The Square-issued ID of the merchant. */ - id?: string; - /** The name of the merchant's overall business. */ - businessName?: string | null; - /** - * Indicates the country associated with another entity, such as a business. - * Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). - */ - country: string; - /** The code indicating the [language preferences](https://developer.squareup.com/docs/build-basics/general-considerations/language-preferences) of the merchant, in [BCP 47 format](https://tools.ietf.org/html/bcp47#appendix-A). For example, `en-US` or `fr-CA`. */ - languageCode?: string | null; - /** - * Indicates the associated currency for an amount of money. Values correspond - * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). - */ - currency?: string; - status?: string; - /** The ID of the [main `Location`](https://developer.squareup.com/docs/locations-api#about-the-main-location) for this merchant. */ - mainLocationId?: string | null; - /** - * The time when the merchant was created, in RFC 3339 format. - * For more information, see [Working with Dates](https://developer.squareup.com/docs/build-basics/working-with-dates). - */ - createdAt?: string; -} - -export const merchantSchema: Schema = object({ - id: ['id', optional(string())], - businessName: ['business_name', optional(nullable(string()))], - country: ['country', string()], - languageCode: ['language_code', optional(nullable(string()))], - currency: ['currency', optional(string())], - status: ['status', optional(string())], - mainLocationId: ['main_location_id', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], -}); diff --git a/src/models/modifierLocationOverrides.ts b/src/models/modifierLocationOverrides.ts deleted file mode 100644 index 567ed18c6..000000000 --- a/src/models/modifierLocationOverrides.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** Location-specific overrides for specified properties of a `CatalogModifier` object. */ -export interface ModifierLocationOverrides { - /** The ID of the `Location` object representing the location. This can include a deactivated location. */ - locationId?: 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; - /** - * Indicates whether the modifier is sold out at the specified location or not. As an example, for cheese (modifier) burger (item), when the modifier is sold out, it is the cheese, but not the burger, that is sold out. - * The seller can manually set this sold out status. Attempts by an application to set this attribute are ignored. - */ - soldOut?: boolean; -} - -export const modifierLocationOverridesSchema: Schema = object( - { - locationId: ['location_id', optional(nullable(string()))], - priceMoney: ['price_money', optional(lazy(() => moneySchema))], - soldOut: ['sold_out', optional(boolean())], - } -); diff --git a/src/models/money.ts b/src/models/money.ts deleted file mode 100644 index 155f5ecce..000000000 --- a/src/models/money.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { bigint, nullable, object, optional, Schema, string } from '../schema'; - -/** - * 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. - */ -export interface Money { - /** - * The amount of money, in the smallest denomination of the currency - * indicated by `currency`. For example, when `currency` is `USD`, `amount` is - * in cents. Monetary amounts can be positive or negative. See the specific - * field description to determine the meaning of the sign in a particular case. - */ - amount?: bigint | null; - /** - * Indicates the associated currency for an amount of money. Values correspond - * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). - */ - currency?: string; -} - -export const moneySchema: Schema = object({ - amount: ['amount', optional(nullable(bigint()))], - currency: ['currency', optional(string())], -}); diff --git a/src/models/obtainTokenRequest.ts b/src/models/obtainTokenRequest.ts deleted file mode 100644 index 0d69b6dd3..000000000 --- a/src/models/obtainTokenRequest.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { - array, - boolean, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; - -export interface ObtainTokenRequest { - /** - * 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 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; - /** - * 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. - */ - code?: string | null; - /** 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. - * Valid values are `authorization_code`, `refresh_token`, and `migration_token`. - */ - grantType: string; - /** - * 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. - */ - refreshToken?: string | null; - /** - * 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). - */ - migrationToken?: string | null; - /** - * 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. - */ - scopes?: string[] | null; - /** - * A Boolean indicating a request for a short-lived access token. - * The short-lived access token returned in the response expires in 24 hours. - */ - shortLived?: boolean | null; - /** - * 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; -} - -export const obtainTokenRequestSchema: Schema = object({ - clientId: ['client_id', string()], - clientSecret: ['client_secret', optional(nullable(string()))], - code: ['code', optional(nullable(string()))], - redirectUri: ['redirect_uri', optional(nullable(string()))], - grantType: ['grant_type', string()], - refreshToken: ['refresh_token', optional(nullable(string()))], - migrationToken: ['migration_token', optional(nullable(string()))], - scopes: ['scopes', optional(nullable(array(string())))], - shortLived: ['short_lived', optional(nullable(boolean()))], - codeVerifier: ['code_verifier', optional(nullable(string()))], -}); diff --git a/src/models/obtainTokenResponse.ts b/src/models/obtainTokenResponse.ts deleted file mode 100644 index b48874ecd..000000000 --- a/src/models/obtainTokenResponse.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - array, - boolean, - lazy, - object, - optional, - Schema, - string, -} from '../schema'; -import { Error, errorSchema } from './error'; - -export interface ObtainTokenResponse { - /** - * A valid OAuth access token. - * Provide the access token in a header with every request to Connect API - * endpoints. For more information, see [OAuth API: Walkthrough](https://developer.squareup.com/docs/oauth-api/walkthrough). - */ - accessToken?: string; - /** This value is always _bearer_. */ - tokenType?: string; - /** The date when the `access_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. */ - expiresAt?: string; - /** The ID of the authorizing merchant's business. */ - merchantId?: string; - /** - * __LEGACY FIELD__. The ID of a subscription plan the merchant signed up - * for. The ID is only present if the merchant signed up for a subscription plan during authorization. - */ - subscriptionId?: string; - /** - * __LEGACY FIELD__. The ID of the subscription plan the merchant signed - * up for. The ID is only present if the merchant signed up for a subscription plan during - * authorization. - */ - planId?: string; - /** - * The OpenID token belonging to this person. This token is only present if the - * OPENID scope is included in the authorization request. - */ - idToken?: string; - /** - * A refresh token. - * For more information, see [Refresh, Revoke, and Limit the Scope of OAuth Tokens](https://developer.squareup.com/docs/oauth-api/refresh-revoke-limit-scope). - */ - refreshToken?: string; - /** - * A Boolean indicating that the access token is a short-lived access token. - * The short-lived access token returned in the response expires in 24 hours. - */ - shortLived?: boolean; - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The date when the `refresh_token` expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. */ - refreshTokenExpiresAt?: string; -} - -export const obtainTokenResponseSchema: Schema = object({ - accessToken: ['access_token', optional(string())], - tokenType: ['token_type', optional(string())], - expiresAt: ['expires_at', optional(string())], - merchantId: ['merchant_id', optional(string())], - subscriptionId: ['subscription_id', optional(string())], - planId: ['plan_id', optional(string())], - idToken: ['id_token', optional(string())], - refreshToken: ['refresh_token', optional(string())], - shortLived: ['short_lived', optional(boolean())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refreshTokenExpiresAt: ['refresh_token_expires_at', optional(string())], -}); diff --git a/src/models/offlinePaymentDetails.ts b/src/models/offlinePaymentDetails.ts deleted file mode 100644 index 846fa10d7..000000000 --- a/src/models/offlinePaymentDetails.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Details specific to offline payments. */ -export interface OfflinePaymentDetails { - /** The client-side timestamp of when the offline payment was created, in RFC 3339 format. */ - clientCreatedAt?: string; -} - -export const offlinePaymentDetailsSchema: Schema = object( - { clientCreatedAt: ['client_created_at', optional(string())] } -); diff --git a/src/models/order.ts b/src/models/order.ts deleted file mode 100644 index 84ba9e82a..000000000 --- a/src/models/order.ts +++ /dev/null @@ -1,284 +0,0 @@ -import { - array, - dict, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Fulfillment, fulfillmentSchema } from './fulfillment'; -import { Money, moneySchema } from './money'; -import { OrderLineItem, orderLineItemSchema } from './orderLineItem'; -import { - OrderLineItemDiscount, - orderLineItemDiscountSchema, -} from './orderLineItemDiscount'; -import { OrderLineItemTax, orderLineItemTaxSchema } from './orderLineItemTax'; -import { - OrderMoneyAmounts, - orderMoneyAmountsSchema, -} from './orderMoneyAmounts'; -import { - OrderPricingOptions, - orderPricingOptionsSchema, -} from './orderPricingOptions'; -import { OrderReturn, orderReturnSchema } from './orderReturn'; -import { OrderReward, orderRewardSchema } from './orderReward'; -import { - OrderRoundingAdjustment, - orderRoundingAdjustmentSchema, -} from './orderRoundingAdjustment'; -import { - OrderServiceCharge, - orderServiceChargeSchema, -} from './orderServiceCharge'; -import { OrderSource, orderSourceSchema } from './orderSource'; -import { Refund, refundSchema } from './refund'; -import { Tender, tenderSchema } from './tender'; - -/** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ -export interface Order { - /** The order's unique ID. */ - id?: string; - /** The ID of the seller location that this order is associated with. */ - locationId: string; - /** - * A client-specified ID to associate an entity in another system - * with this order. - */ - referenceId?: string | null; - /** Represents the origination details of an order. */ - source?: OrderSource; - /** - * The ID of the [customer]($m/Customer) associated with the order. - * You should specify a `customer_id` on the order (or the payment) to ensure that transactions - * are reliably linked to customers. Omitting this field might result in the creation of new - * [instant profiles](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles). - */ - customerId?: string | null; - /** The line items included in the order. */ - lineItems?: OrderLineItem[] | null; - /** - * The list of all taxes associated with the order. - * Taxes can be scoped to either `ORDER` or `LINE_ITEM`. For taxes with `LINE_ITEM` scope, an - * `OrderLineItemAppliedTax` must be added to each line item that the tax applies to. For taxes - * with `ORDER` scope, the server generates an `OrderLineItemAppliedTax` for every line item. - * On reads, each tax in the list includes the total amount of that tax applied to the order. - * __IMPORTANT__: If `LINE_ITEM` scope is set on any taxes in this field, using the deprecated - * `line_items.taxes` field results in an error. Use `line_items.applied_taxes` - * instead. - */ - taxes?: OrderLineItemTax[] | null; - /** - * The list of all discounts associated with the order. - * Discounts can be scoped to either `ORDER` or `LINE_ITEM`. For discounts scoped to `LINE_ITEM`, - * an `OrderLineItemAppliedDiscount` must be added to each line item that the discount applies to. - * For discounts with `ORDER` scope, the server generates an `OrderLineItemAppliedDiscount` - * for every line item. - * __IMPORTANT__: If `LINE_ITEM` scope is set on any discounts in this field, using the deprecated - * `line_items.discounts` field results in an error. Use `line_items.applied_discounts` - * instead. - */ - discounts?: OrderLineItemDiscount[] | null; - /** A list of service charges applied to the order. */ - serviceCharges?: OrderServiceCharge[] | null; - /** - * Details about order fulfillment. - * Orders can only be created with at most one fulfillment. However, orders returned - * by the API might contain multiple fulfillments. - */ - fulfillments?: Fulfillment[] | null; - /** - * A collection of items from sale orders being returned in this one. Normally part of an - * itemized return or exchange. There is exactly one `Return` object per sale `Order` being - * referenced. - */ - returns?: OrderReturn[]; - /** A collection of various money amounts. */ - returnAmounts?: OrderMoneyAmounts; - /** A collection of various money amounts. */ - netAmounts?: OrderMoneyAmounts; - /** - * A rounding adjustment of the money being returned. Commonly used to apply cash rounding - * when the minimum unit of the account is smaller than the lowest physical denomination of the currency. - */ - roundingAdjustment?: OrderRoundingAdjustment; - /** The tenders that were used to pay for the order. */ - tenders?: Tender[]; - /** The refunds that are part of this order. */ - refunds?: Refund[]; - /** - * Application-defined data attached to this order. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; - /** The timestamp for when the order was created, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). */ - createdAt?: string; - /** The timestamp for when the order was last updated, at server side, in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). */ - updatedAt?: string; - /** The timestamp for when the order reached a terminal [state](entity:OrderState), in RFC 3339 format (for example "2016-09-04T23:59:33.123Z"). */ - closedAt?: string; - /** The state of the order. */ - state?: string; - /** - * The version number, which is incremented each time an update is committed to the order. - * Orders not created through the API do not include a version number and - * therefore cannot be updated. - * [Read more about working with versions](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders). - */ - version?: number; - /** - * 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. - */ - totalMoney?: Money; - /** - * 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. - */ - totalTaxMoney?: Money; - /** - * 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. - */ - totalDiscountMoney?: Money; - /** - * 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. - */ - totalTipMoney?: Money; - /** - * 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. - */ - totalServiceChargeMoney?: Money; - /** - * A short-term identifier for the order (such as a customer first name, - * table number, or auto-generated order number that resets daily). - */ - ticketName?: string | null; - /** - * Pricing options for an order. The options affect how the order's price is calculated. - * They can be used, for example, to apply automatic price adjustments that are based on preconfigured - * [pricing rules]($m/CatalogPricingRule). - */ - pricingOptions?: OrderPricingOptions; - /** A set-like list of Rewards that have been added to the Order. */ - rewards?: OrderReward[]; - /** - * 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. - */ - netAmountDueMoney?: Money; -} - -export const orderSchema: Schema = object({ - id: ['id', optional(string())], - locationId: ['location_id', string()], - referenceId: ['reference_id', optional(nullable(string()))], - source: ['source', optional(lazy(() => orderSourceSchema))], - customerId: ['customer_id', optional(nullable(string()))], - lineItems: [ - 'line_items', - optional(nullable(array(lazy(() => orderLineItemSchema)))), - ], - taxes: [ - 'taxes', - optional(nullable(array(lazy(() => orderLineItemTaxSchema)))), - ], - discounts: [ - 'discounts', - optional(nullable(array(lazy(() => orderLineItemDiscountSchema)))), - ], - serviceCharges: [ - 'service_charges', - optional(nullable(array(lazy(() => orderServiceChargeSchema)))), - ], - fulfillments: [ - 'fulfillments', - optional(nullable(array(lazy(() => fulfillmentSchema)))), - ], - returns: ['returns', optional(array(lazy(() => orderReturnSchema)))], - returnAmounts: [ - 'return_amounts', - optional(lazy(() => orderMoneyAmountsSchema)), - ], - netAmounts: ['net_amounts', optional(lazy(() => orderMoneyAmountsSchema))], - roundingAdjustment: [ - 'rounding_adjustment', - optional(lazy(() => orderRoundingAdjustmentSchema)), - ], - tenders: ['tenders', optional(array(lazy(() => tenderSchema)))], - refunds: ['refunds', optional(array(lazy(() => refundSchema)))], - metadata: ['metadata', optional(nullable(dict(string())))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - closedAt: ['closed_at', optional(string())], - state: ['state', optional(string())], - version: ['version', optional(number())], - totalMoney: ['total_money', optional(lazy(() => moneySchema))], - totalTaxMoney: ['total_tax_money', optional(lazy(() => moneySchema))], - totalDiscountMoney: [ - 'total_discount_money', - optional(lazy(() => moneySchema)), - ], - totalTipMoney: ['total_tip_money', optional(lazy(() => moneySchema))], - totalServiceChargeMoney: [ - 'total_service_charge_money', - optional(lazy(() => moneySchema)), - ], - ticketName: ['ticket_name', optional(nullable(string()))], - pricingOptions: [ - 'pricing_options', - optional(lazy(() => orderPricingOptionsSchema)), - ], - rewards: ['rewards', optional(array(lazy(() => orderRewardSchema)))], - netAmountDueMoney: [ - 'net_amount_due_money', - optional(lazy(() => moneySchema)), - ], -}); diff --git a/src/models/orderCreated.ts b/src/models/orderCreated.ts deleted file mode 100644 index 40e34a2b7..000000000 --- a/src/models/orderCreated.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface OrderCreated { - /** The order's unique ID. */ - orderId?: string | null; - /** - * The version number, which is incremented each time an update is committed to the order. - * Orders that were not created through the API do not include a version number and - * therefore cannot be updated. - * [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) - */ - version?: number; - /** The ID of the seller location that this order is associated with. */ - locationId?: string | null; - /** The state of the order. */ - state?: string; - /** The timestamp for when the order was created, in RFC 3339 format. */ - createdAt?: string; -} - -export const orderCreatedSchema: Schema = object({ - orderId: ['order_id', optional(nullable(string()))], - version: ['version', optional(number())], - locationId: ['location_id', optional(nullable(string()))], - state: ['state', optional(string())], - createdAt: ['created_at', optional(string())], -}); diff --git a/src/models/orderCreatedObject.ts b/src/models/orderCreatedObject.ts deleted file mode 100644 index ac3222088..000000000 --- a/src/models/orderCreatedObject.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { OrderCreated, orderCreatedSchema } from './orderCreated'; - -export interface OrderCreatedObject { - orderCreated?: OrderCreated; -} - -export const orderCreatedObjectSchema: Schema = object({ - orderCreated: ['order_created', optional(lazy(() => orderCreatedSchema))], -}); diff --git a/src/models/orderEntry.ts b/src/models/orderEntry.ts deleted file mode 100644 index 1318f94b8..000000000 --- a/src/models/orderEntry.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * A lightweight description of an [order]($m/Order) that is returned when - * `returned_entries` is `true` on a [SearchOrdersRequest]($e/Orders/SearchOrders). - */ -export interface OrderEntry { - /** The ID of the order. */ - orderId?: string | null; - /** - * The version number, which is incremented each time an update is committed to the order. - * Orders that were not created through the API do not include a version number and - * therefore cannot be updated. - * [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) - */ - version?: number; - /** The location ID the order belongs to. */ - locationId?: string | null; -} - -export const orderEntrySchema: Schema = object({ - orderId: ['order_id', optional(nullable(string()))], - version: ['version', optional(number())], - locationId: ['location_id', optional(nullable(string()))], -}); diff --git a/src/models/orderFulfillment.ts b/src/models/orderFulfillment.ts deleted file mode 100644 index 9529f2821..000000000 --- a/src/models/orderFulfillment.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { - array, - dict, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - OrderFulfillmentDeliveryDetails, - orderFulfillmentDeliveryDetailsSchema, -} from './orderFulfillmentDeliveryDetails'; -import { - OrderFulfillmentFulfillmentEntry, - orderFulfillmentFulfillmentEntrySchema, -} from './orderFulfillmentFulfillmentEntry'; -import { - OrderFulfillmentPickupDetails, - orderFulfillmentPickupDetailsSchema, -} from './orderFulfillmentPickupDetails'; -import { - OrderFulfillmentShipmentDetails, - orderFulfillmentShipmentDetailsSchema, -} from './orderFulfillmentShipmentDetails'; - -/** - * Contains details about how to fulfill this order. - * Orders can only be created with at most one fulfillment using the API. - * However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. - */ -export interface OrderFulfillment { - /** A unique ID that identifies the fulfillment only within this order. */ - uid?: string | null; - /** The type of fulfillment. */ - type?: string; - /** The current state of this fulfillment. */ - state?: string; - /** - * The `line_item_application` describes what order line items this fulfillment applies - * to. It can be `ALL` or `ENTRY_LIST` with a supplied list of fulfillment entries. - */ - lineItemApplication?: string; - /** - * A list of entries pertaining to the fulfillment of an order. Each entry must reference - * a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to - * fulfill. - * Multiple entries can reference the same line item `uid`, as long as the total quantity among - * all fulfillment entries referencing a single line item does not exceed the quantity of the - * order's line item itself. - * An order cannot be marked as `COMPLETED` before all fulfillments are `COMPLETED`, - * `CANCELED`, or `FAILED`. Fulfillments can be created and completed independently - * before order completion. - */ - entries?: OrderFulfillmentFulfillmentEntry[]; - /** - * Application-defined data attached to this fulfillment. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; - /** Contains details necessary to fulfill a pickup order. */ - pickupDetails?: OrderFulfillmentPickupDetails; - /** Contains the details necessary to fulfill a shipment order. */ - shipmentDetails?: OrderFulfillmentShipmentDetails; - /** Describes delivery details of an order fulfillment. */ - deliveryDetails?: OrderFulfillmentDeliveryDetails; -} - -export const orderFulfillmentSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - type: ['type', optional(string())], - state: ['state', optional(string())], - lineItemApplication: ['line_item_application', optional(string())], - entries: [ - 'entries', - optional(array(lazy(() => orderFulfillmentFulfillmentEntrySchema))), - ], - metadata: ['metadata', optional(nullable(dict(string())))], - pickupDetails: [ - 'pickup_details', - optional(lazy(() => orderFulfillmentPickupDetailsSchema)), - ], - shipmentDetails: [ - 'shipment_details', - optional(lazy(() => orderFulfillmentShipmentDetailsSchema)), - ], - deliveryDetails: [ - 'delivery_details', - optional(lazy(() => orderFulfillmentDeliveryDetailsSchema)), - ], -}); diff --git a/src/models/orderFulfillmentDeliveryDetails.ts b/src/models/orderFulfillmentDeliveryDetails.ts deleted file mode 100644 index 966499ae5..000000000 --- a/src/models/orderFulfillmentDeliveryDetails.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - OrderFulfillmentRecipient, - orderFulfillmentRecipientSchema, -} from './orderFulfillmentRecipient'; - -/** Describes delivery details of an order fulfillment. */ -export interface OrderFulfillmentDeliveryDetails { - /** Information about the fulfillment recipient. */ - recipient?: OrderFulfillmentRecipient; - /** The schedule type of the delivery fulfillment. */ - scheduleType?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was placed. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - * Must be in RFC 3339 timestamp format, e.g., "2016-09-04T23:59:33.123Z". - */ - placedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * that represents the start of the delivery period. - * When the fulfillment `schedule_type` is `ASAP`, the field is automatically - * set to the current time plus the `prep_time_duration`. - * Otherwise, the application can set this field while the fulfillment `state` is - * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the - * terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). - * The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - deliverAt?: string | null; - /** - * The duration of time it takes to prepare and deliver this fulfillment. - * The duration must be in RFC 3339 format (for example, "P1W3D"). - */ - prepTimeDuration?: string | null; - /** - * The time period after `deliver_at` in which to deliver the order. - * Applications can set this field when the fulfillment `state` is - * `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state - * such as `COMPLETED`, `CANCELED`, and `FAILED`). - * The duration must be in RFC 3339 format (for example, "P1W3D"). - */ - deliveryWindowDuration?: string | null; - /** - * Provides additional instructions about the delivery fulfillment. - * It is displayed in the Square Point of Sale application and set by the API. - */ - note?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicates when the seller completed the fulfillment. - * This field is automatically set when fulfillment `state` changes to `COMPLETED`. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - completedAt?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicates when the seller started processing the fulfillment. - * This field is automatically set when the fulfillment `state` changes to `RESERVED`. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - inProgressAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was rejected. This field is - * automatically set when the fulfillment `state` changes to `FAILED`. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - rejectedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the seller marked the fulfillment as ready for - * courier pickup. This field is automatically set when the fulfillment `state` changes - * to PREPARED. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - readyAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was delivered to the recipient. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - deliveredAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was canceled. This field is automatically - * set when the fulfillment `state` changes to `CANCELED`. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - canceledAt?: string; - /** The delivery cancellation reason. Max length: 100 characters. */ - cancelReason?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when an order can be picked up by the courier for delivery. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - courierPickupAt?: string | null; - /** - * The time period after `courier_pickup_at` in which the courier should pick up the order. - * The duration must be in RFC 3339 format (for example, "P1W3D"). - */ - courierPickupWindowDuration?: string | null; - /** Whether the delivery is preferred to be no contact. */ - isNoContactDelivery?: boolean | null; - /** A note to provide additional instructions about how to deliver the order. */ - dropoffNotes?: string | null; - /** The name of the courier provider. */ - courierProviderName?: string | null; - /** The support phone number of the courier. */ - courierSupportPhoneNumber?: string | null; - /** The identifier for the delivery created by Square. */ - squareDeliveryId?: string | null; - /** The identifier for the delivery created by the third-party courier service. */ - externalDeliveryId?: string | null; - /** - * The flag to indicate the delivery is managed by a third party (ie DoorDash), which means - * we may not receive all recipient information for PII purposes. - */ - managedDelivery?: boolean | null; -} - -export const orderFulfillmentDeliveryDetailsSchema: Schema = object( - { - recipient: [ - 'recipient', - optional(lazy(() => orderFulfillmentRecipientSchema)), - ], - scheduleType: ['schedule_type', optional(string())], - placedAt: ['placed_at', optional(string())], - deliverAt: ['deliver_at', optional(nullable(string()))], - prepTimeDuration: ['prep_time_duration', optional(nullable(string()))], - deliveryWindowDuration: [ - 'delivery_window_duration', - optional(nullable(string())), - ], - note: ['note', optional(nullable(string()))], - completedAt: ['completed_at', optional(nullable(string()))], - inProgressAt: ['in_progress_at', optional(string())], - rejectedAt: ['rejected_at', optional(string())], - readyAt: ['ready_at', optional(string())], - deliveredAt: ['delivered_at', optional(string())], - canceledAt: ['canceled_at', optional(string())], - cancelReason: ['cancel_reason', optional(nullable(string()))], - courierPickupAt: ['courier_pickup_at', optional(nullable(string()))], - courierPickupWindowDuration: [ - 'courier_pickup_window_duration', - optional(nullable(string())), - ], - isNoContactDelivery: [ - 'is_no_contact_delivery', - optional(nullable(boolean())), - ], - dropoffNotes: ['dropoff_notes', optional(nullable(string()))], - courierProviderName: [ - 'courier_provider_name', - optional(nullable(string())), - ], - courierSupportPhoneNumber: [ - 'courier_support_phone_number', - optional(nullable(string())), - ], - squareDeliveryId: ['square_delivery_id', optional(nullable(string()))], - externalDeliveryId: ['external_delivery_id', optional(nullable(string()))], - managedDelivery: ['managed_delivery', optional(nullable(boolean()))], - } -); diff --git a/src/models/orderFulfillmentFulfillmentEntry.ts b/src/models/orderFulfillmentFulfillmentEntry.ts deleted file mode 100644 index 7e38c7589..000000000 --- a/src/models/orderFulfillmentFulfillmentEntry.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { dict, nullable, object, optional, Schema, string } from '../schema'; - -/** - * Links an order line item to a fulfillment. Each entry must reference - * a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to - * fulfill. - */ -export interface OrderFulfillmentFulfillmentEntry { - /** A unique ID that identifies the fulfillment entry only within this order. */ - uid?: string | null; - /** The `uid` from the order line item. */ - lineItemUid: string; - /** - * The quantity of the line item being fulfilled, formatted as a decimal number. - * For example, `"3"`. - * Fulfillments for line items with a `quantity_unit` can have non-integer quantities. - * For example, `"1.70000"`. - */ - quantity: string; - /** - * Application-defined data attached to this fulfillment entry. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; -} - -export const orderFulfillmentFulfillmentEntrySchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - lineItemUid: ['line_item_uid', string()], - quantity: ['quantity', string()], - metadata: ['metadata', optional(nullable(dict(string())))], - } -); diff --git a/src/models/orderFulfillmentPickupDetails.ts b/src/models/orderFulfillmentPickupDetails.ts deleted file mode 100644 index 35c7bbaef..000000000 --- a/src/models/orderFulfillmentPickupDetails.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - OrderFulfillmentPickupDetailsCurbsidePickupDetails, - orderFulfillmentPickupDetailsCurbsidePickupDetailsSchema, -} from './orderFulfillmentPickupDetailsCurbsidePickupDetails'; -import { - OrderFulfillmentRecipient, - orderFulfillmentRecipientSchema, -} from './orderFulfillmentRecipient'; - -/** Contains details necessary to fulfill a pickup order. */ -export interface OrderFulfillmentPickupDetails { - /** Information about the fulfillment recipient. */ - recipient?: OrderFulfillmentRecipient; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment expires if it is not marked in progress. The timestamp must be - * in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). The expiration time can only be set - * up to 7 days in the future. If `expires_at` is not set, any new payments attached to the order - * are automatically completed. - */ - expiresAt?: string | null; - /** - * The duration of time after which an in progress pickup fulfillment is automatically moved - * to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). - * If not set, this pickup fulfillment remains in progress until it is canceled or completed. - */ - autoCompleteDuration?: string | null; - /** The schedule type of the pickup fulfillment. */ - scheduleType?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., - * "2016-09-04T23:59:33.123Z". - * For fulfillments with the schedule type `ASAP`, this is automatically set - * to the current time plus the expected duration to prepare the fulfillment. - */ - pickupAt?: string | null; - /** - * The window of time in which the order should be picked up after the `pickup_at` timestamp. - * Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an - * informational guideline for merchants. - */ - pickupWindowDuration?: string | null; - /** - * The duration of time it takes to prepare this fulfillment. - * The duration must be in RFC 3339 format (for example, "P1W3D"). - */ - prepTimeDuration?: string | null; - /** - * A note to provide additional instructions about the pickup - * fulfillment displayed in the Square Point of Sale application and set by the API. - */ - note?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - placedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was marked in progress. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - acceptedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was rejected. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - rejectedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment is marked as ready for pickup. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - readyAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment expired. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - expiredAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was picked up by the recipient. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - pickedUpAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the fulfillment was canceled. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - canceledAt?: string; - /** A description of why the pickup was canceled. The maximum length: 100 characters. */ - cancelReason?: string | null; - /** If set to `true`, indicates that this pickup order is for curbside pickup, not in-store pickup. */ - isCurbsidePickup?: boolean | null; - /** Specific details for curbside pickup. */ - curbsidePickupDetails?: OrderFulfillmentPickupDetailsCurbsidePickupDetails; -} - -export const orderFulfillmentPickupDetailsSchema: Schema = object( - { - recipient: [ - 'recipient', - optional(lazy(() => orderFulfillmentRecipientSchema)), - ], - expiresAt: ['expires_at', optional(nullable(string()))], - autoCompleteDuration: [ - 'auto_complete_duration', - optional(nullable(string())), - ], - scheduleType: ['schedule_type', optional(string())], - pickupAt: ['pickup_at', optional(nullable(string()))], - pickupWindowDuration: [ - 'pickup_window_duration', - optional(nullable(string())), - ], - prepTimeDuration: ['prep_time_duration', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - placedAt: ['placed_at', optional(string())], - acceptedAt: ['accepted_at', optional(string())], - rejectedAt: ['rejected_at', optional(string())], - readyAt: ['ready_at', optional(string())], - expiredAt: ['expired_at', optional(string())], - pickedUpAt: ['picked_up_at', optional(string())], - canceledAt: ['canceled_at', optional(string())], - cancelReason: ['cancel_reason', optional(nullable(string()))], - isCurbsidePickup: ['is_curbside_pickup', optional(nullable(boolean()))], - curbsidePickupDetails: [ - 'curbside_pickup_details', - optional( - lazy(() => orderFulfillmentPickupDetailsCurbsidePickupDetailsSchema) - ), - ], - } -); diff --git a/src/models/orderFulfillmentPickupDetailsCurbsidePickupDetails.ts b/src/models/orderFulfillmentPickupDetailsCurbsidePickupDetails.ts deleted file mode 100644 index 90e8b2a1b..000000000 --- a/src/models/orderFulfillmentPickupDetailsCurbsidePickupDetails.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Specific details for curbside pickup. */ -export interface OrderFulfillmentPickupDetailsCurbsidePickupDetails { - /** Specific details for curbside pickup, such as parking number and vehicle model. */ - curbsideDetails?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the buyer arrived and is waiting for pickup. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - buyerArrivedAt?: string | null; -} - -export const orderFulfillmentPickupDetailsCurbsidePickupDetailsSchema: Schema = object( - { - curbsideDetails: ['curbside_details', optional(nullable(string()))], - buyerArrivedAt: ['buyer_arrived_at', optional(nullable(string()))], - } -); diff --git a/src/models/orderFulfillmentRecipient.ts b/src/models/orderFulfillmentRecipient.ts deleted file mode 100644 index bbc67ed63..000000000 --- a/src/models/orderFulfillmentRecipient.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Address, addressSchema } from './address'; - -/** Information about the fulfillment recipient. */ -export interface OrderFulfillmentRecipient { - /** - * The ID of the customer associated with the fulfillment. - * If `customer_id` is provided, the fulfillment recipient's `display_name`, - * `email_address`, and `phone_number` are automatically populated from the - * targeted customer profile. If these fields are set in the request, the request - * values override the information from the customer profile. If the - * targeted customer profile does not contain the necessary information and - * these fields are left unset, the request results in an error. - */ - customerId?: string | null; - /** - * The display name of the fulfillment recipient. This field is required. - * If provided, the display name overrides the corresponding customer profile value - * indicated by `customer_id`. - */ - displayName?: string | null; - /** - * The email address of the fulfillment recipient. - * If provided, the email address overrides the corresponding customer profile value - * indicated by `customer_id`. - */ - emailAddress?: string | null; - /** - * The phone number of the fulfillment recipient. This field is required. - * If provided, the phone number overrides the corresponding customer profile value - * indicated by `customer_id`. - */ - phoneNumber?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; -} - -export const orderFulfillmentRecipientSchema: Schema = object( - { - customerId: ['customer_id', optional(nullable(string()))], - displayName: ['display_name', optional(nullable(string()))], - emailAddress: ['email_address', optional(nullable(string()))], - phoneNumber: ['phone_number', optional(nullable(string()))], - address: ['address', optional(lazy(() => addressSchema))], - } -); diff --git a/src/models/orderFulfillmentShipmentDetails.ts b/src/models/orderFulfillmentShipmentDetails.ts deleted file mode 100644 index 600d844f7..000000000 --- a/src/models/orderFulfillmentShipmentDetails.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - OrderFulfillmentRecipient, - orderFulfillmentRecipientSchema, -} from './orderFulfillmentRecipient'; - -/** Contains the details necessary to fulfill a shipment order. */ -export interface OrderFulfillmentShipmentDetails { - /** Information about the fulfillment recipient. */ - recipient?: OrderFulfillmentRecipient; - /** The shipping carrier being used to ship this fulfillment (such as UPS, FedEx, or USPS). */ - carrier?: string | null; - /** A note with additional information for the shipping carrier. */ - shippingNote?: string | null; - /** - * A description of the type of shipping product purchased from the carrier - * (such as First Class, Priority, or Express). - */ - shippingType?: string | null; - /** The reference number provided by the carrier to track the shipment's progress. */ - trackingNumber?: string | null; - /** A link to the tracking webpage on the carrier's website. */ - trackingUrl?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the shipment was requested. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - placedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment was moved to the `RESERVED` state, which indicates that preparation - * of this shipment has begun. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - inProgressAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment was moved to the `PREPARED` state, which indicates that the - * fulfillment is packaged. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - packagedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the shipment is expected to be delivered to the shipping carrier. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - expectedShippedAt?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when this fulfillment was moved to the `COMPLETED` state, which indicates that - * the fulfillment has been given to the shipping carrier. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - shippedAt?: string; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating the shipment was canceled. - * The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - canceledAt?: string | null; - /** A description of why the shipment was canceled. */ - cancelReason?: string | null; - /** - * The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) - * indicating when the shipment failed to be completed. The timestamp must be in RFC 3339 format - * (for example, "2016-09-04T23:59:33.123Z"). - */ - failedAt?: string; - /** A description of why the shipment failed to be completed. */ - failureReason?: string | null; -} - -export const orderFulfillmentShipmentDetailsSchema: Schema = object( - { - recipient: [ - 'recipient', - optional(lazy(() => orderFulfillmentRecipientSchema)), - ], - carrier: ['carrier', optional(nullable(string()))], - shippingNote: ['shipping_note', optional(nullable(string()))], - shippingType: ['shipping_type', optional(nullable(string()))], - trackingNumber: ['tracking_number', optional(nullable(string()))], - trackingUrl: ['tracking_url', optional(nullable(string()))], - placedAt: ['placed_at', optional(string())], - inProgressAt: ['in_progress_at', optional(string())], - packagedAt: ['packaged_at', optional(string())], - expectedShippedAt: ['expected_shipped_at', optional(nullable(string()))], - shippedAt: ['shipped_at', optional(string())], - canceledAt: ['canceled_at', optional(nullable(string()))], - cancelReason: ['cancel_reason', optional(nullable(string()))], - failedAt: ['failed_at', optional(string())], - failureReason: ['failure_reason', optional(nullable(string()))], - } -); diff --git a/src/models/orderFulfillmentUpdated.ts b/src/models/orderFulfillmentUpdated.ts deleted file mode 100644 index b41b6e125..000000000 --- a/src/models/orderFulfillmentUpdated.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - OrderFulfillmentUpdatedUpdate, - orderFulfillmentUpdatedUpdateSchema, -} from './orderFulfillmentUpdatedUpdate'; - -export interface OrderFulfillmentUpdated { - /** The order's unique ID. */ - orderId?: string | null; - /** - * The version number, which is incremented each time an update is committed to the order. - * Orders that were not created through the API do not include a version number and - * therefore cannot be updated. - * [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) - */ - version?: number; - /** The ID of the seller location that this order is associated with. */ - locationId?: string | null; - /** The state of the order. */ - state?: string; - /** The timestamp for when the order was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp for when the order was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** The fulfillments that were updated with this version change. */ - fulfillmentUpdate?: OrderFulfillmentUpdatedUpdate[] | null; -} - -export const orderFulfillmentUpdatedSchema: Schema = object( - { - orderId: ['order_id', optional(nullable(string()))], - version: ['version', optional(number())], - locationId: ['location_id', optional(nullable(string()))], - state: ['state', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - fulfillmentUpdate: [ - 'fulfillment_update', - optional( - nullable(array(lazy(() => orderFulfillmentUpdatedUpdateSchema))) - ), - ], - } -); diff --git a/src/models/orderFulfillmentUpdatedObject.ts b/src/models/orderFulfillmentUpdatedObject.ts deleted file mode 100644 index 2077b60ed..000000000 --- a/src/models/orderFulfillmentUpdatedObject.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - OrderFulfillmentUpdated, - orderFulfillmentUpdatedSchema, -} from './orderFulfillmentUpdated'; - -export interface OrderFulfillmentUpdatedObject { - orderFulfillmentUpdated?: OrderFulfillmentUpdated; -} - -export const orderFulfillmentUpdatedObjectSchema: Schema = object( - { - orderFulfillmentUpdated: [ - 'order_fulfillment_updated', - optional(lazy(() => orderFulfillmentUpdatedSchema)), - ], - } -); diff --git a/src/models/orderFulfillmentUpdatedUpdate.ts b/src/models/orderFulfillmentUpdatedUpdate.ts deleted file mode 100644 index abf4f5a98..000000000 --- a/src/models/orderFulfillmentUpdatedUpdate.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Information about fulfillment updates. */ -export interface OrderFulfillmentUpdatedUpdate { - /** A unique ID that identifies the fulfillment only within this order. */ - fulfillmentUid?: string | null; - /** The current state of this fulfillment. */ - oldState?: string; - /** The current state of this fulfillment. */ - newState?: string; -} - -export const orderFulfillmentUpdatedUpdateSchema: Schema = object( - { - fulfillmentUid: ['fulfillment_uid', optional(nullable(string()))], - oldState: ['old_state', optional(string())], - newState: ['new_state', optional(string())], - } -); diff --git a/src/models/orderLineItem.ts b/src/models/orderLineItem.ts deleted file mode 100644 index 20d983366..000000000 --- a/src/models/orderLineItem.ts +++ /dev/null @@ -1,244 +0,0 @@ -import { - array, - bigint, - dict, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; -import { - OrderLineItemAppliedDiscount, - orderLineItemAppliedDiscountSchema, -} from './orderLineItemAppliedDiscount'; -import { - OrderLineItemAppliedServiceCharge, - orderLineItemAppliedServiceChargeSchema, -} from './orderLineItemAppliedServiceCharge'; -import { - OrderLineItemAppliedTax, - orderLineItemAppliedTaxSchema, -} from './orderLineItemAppliedTax'; -import { - OrderLineItemModifier, - orderLineItemModifierSchema, -} from './orderLineItemModifier'; -import { - OrderLineItemPricingBlocklists, - orderLineItemPricingBlocklistsSchema, -} from './orderLineItemPricingBlocklists'; -import { - OrderQuantityUnit, - orderQuantityUnitSchema, -} from './orderQuantityUnit'; - -/** - * Represents a line item in an order. Each line item describes a different - * product to purchase, with its own quantity and price details. - */ -export interface OrderLineItem { - /** A unique ID that identifies the line item only within this order. */ - uid?: string | null; - /** The name of the line item. */ - name?: string | null; - /** - * The count, or measurement, of a line item being purchased: - * If `quantity` is a whole number, and `quantity_unit` is not specified, then `quantity` denotes an item count. For example: `3` apples. - * If `quantity` is a whole or decimal number, and `quantity_unit` is also specified, then `quantity` denotes a measurement. For example: `2.25` pounds of broccoli. - * For more information, see [Specify item quantity and measurement unit](https://developer.squareup.com/docs/orders-api/create-orders#specify-item-quantity-and-measurement-unit). - * Line items with a quantity of `0` are automatically removed - * when paying for or otherwise completing the order. - */ - quantity: string; - /** - * Contains the measurement unit for a quantity and a precision that - * specifies the number of digits after the decimal point for decimal quantities. - */ - quantityUnit?: OrderQuantityUnit; - /** An optional note associated with the line item. */ - note?: string | null; - /** The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this line item. */ - catalogObjectId?: string | null; - /** The version of the catalog object that this line item references. */ - catalogVersion?: bigint | null; - /** The name of the variation applied to this line item. */ - variationName?: string | null; - /** Represents the line item type. */ - itemType?: string; - /** - * Application-defined data attached to this line item. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; - /** The [CatalogModifier](entity:CatalogModifier)s applied to this line item. */ - modifiers?: OrderLineItemModifier[] | null; - /** - * The list of references to taxes applied to this line item. Each - * `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a - * top-level `OrderLineItemTax` applied to the line item. On reads, the - * amount applied is populated. - * An `OrderLineItemAppliedTax` is automatically created on every line - * item for all `ORDER` scoped taxes added to the order. `OrderLineItemAppliedTax` - * records for `LINE_ITEM` scoped taxes must be added in requests for the tax - * to apply to any line items. - * To change the amount of a tax, modify the referenced top-level tax. - */ - appliedTaxes?: OrderLineItemAppliedTax[] | null; - /** - * The list of references to discounts applied to this line item. Each - * `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level - * `OrderLineItemDiscounts` applied to the line item. On reads, the amount - * applied is populated. - * An `OrderLineItemAppliedDiscount` is automatically created on every line item for all - * `ORDER` scoped discounts that are added to the order. `OrderLineItemAppliedDiscount` records - * for `LINE_ITEM` scoped discounts must be added in requests for the discount to apply to any - * line items. - * To change the amount of a discount, modify the referenced top-level discount. - */ - appliedDiscounts?: OrderLineItemAppliedDiscount[] | null; - /** - * The list of references to service charges applied to this line item. Each - * `OrderLineItemAppliedServiceCharge` has a `service_charge_id` that references the `uid` of a - * top-level `OrderServiceCharge` applied to the line item. On reads, the amount applied is - * populated. - * To change the amount of a service charge, modify the referenced top-level service charge. - */ - appliedServiceCharges?: OrderLineItemAppliedServiceCharge[] | 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. - */ - basePriceMoney?: Money; - /** - * 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. - */ - variationTotalPriceMoney?: Money; - /** - * 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. - */ - grossSalesMoney?: Money; - /** - * 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. - */ - totalTaxMoney?: Money; - /** - * 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. - */ - totalDiscountMoney?: Money; - /** - * 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. - */ - totalMoney?: Money; - /** - * Describes pricing adjustments that are blocked from automatic - * application to a line item. For more information, see - * [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). - */ - pricingBlocklists?: OrderLineItemPricingBlocklists; - /** - * 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. - */ - totalServiceChargeMoney?: Money; -} - -export const orderLineItemSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - name: ['name', optional(nullable(string()))], - quantity: ['quantity', string()], - quantityUnit: [ - 'quantity_unit', - optional(lazy(() => orderQuantityUnitSchema)), - ], - note: ['note', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - variationName: ['variation_name', optional(nullable(string()))], - itemType: ['item_type', optional(string())], - metadata: ['metadata', optional(nullable(dict(string())))], - modifiers: [ - 'modifiers', - optional(nullable(array(lazy(() => orderLineItemModifierSchema)))), - ], - appliedTaxes: [ - 'applied_taxes', - optional(nullable(array(lazy(() => orderLineItemAppliedTaxSchema)))), - ], - appliedDiscounts: [ - 'applied_discounts', - optional(nullable(array(lazy(() => orderLineItemAppliedDiscountSchema)))), - ], - appliedServiceCharges: [ - 'applied_service_charges', - optional( - nullable(array(lazy(() => orderLineItemAppliedServiceChargeSchema))) - ), - ], - basePriceMoney: ['base_price_money', optional(lazy(() => moneySchema))], - variationTotalPriceMoney: [ - 'variation_total_price_money', - optional(lazy(() => moneySchema)), - ], - grossSalesMoney: ['gross_sales_money', optional(lazy(() => moneySchema))], - totalTaxMoney: ['total_tax_money', optional(lazy(() => moneySchema))], - totalDiscountMoney: [ - 'total_discount_money', - optional(lazy(() => moneySchema)), - ], - totalMoney: ['total_money', optional(lazy(() => moneySchema))], - pricingBlocklists: [ - 'pricing_blocklists', - optional(lazy(() => orderLineItemPricingBlocklistsSchema)), - ], - totalServiceChargeMoney: [ - 'total_service_charge_money', - optional(lazy(() => moneySchema)), - ], -}); diff --git a/src/models/orderLineItemAppliedDiscount.ts b/src/models/orderLineItemAppliedDiscount.ts deleted file mode 100644 index 1a558466b..000000000 --- a/src/models/orderLineItemAppliedDiscount.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents an applied portion of a discount to a line item in an order. - * Order scoped discounts have automatically applied discounts present for each line item. - * Line-item scoped discounts must have applied discounts added manually for any applicable line - * items. The corresponding applied money is automatically computed based on participating - * line items. - */ -export interface OrderLineItemAppliedDiscount { - /** A unique ID that identifies the applied discount only within this order. */ - uid?: string | null; - /** - * The `uid` of the discount that the applied discount represents. It must - * reference a discount present in the `order.discounts` field. - * This field is immutable. To change which discounts apply to a line item, - * you must delete the discount and re-add it as a new `OrderLineItemAppliedDiscount`. - */ - discountUid: string; - /** - * 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. - */ - appliedMoney?: Money; -} - -export const orderLineItemAppliedDiscountSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - discountUid: ['discount_uid', string()], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - } -); diff --git a/src/models/orderLineItemAppliedServiceCharge.ts b/src/models/orderLineItemAppliedServiceCharge.ts deleted file mode 100644 index 852c6d997..000000000 --- a/src/models/orderLineItemAppliedServiceCharge.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -export interface OrderLineItemAppliedServiceCharge { - /** A unique ID that identifies the applied service charge only within this order. */ - uid?: string | null; - /** - * The `uid` of the service charge that the applied service charge represents. It must - * reference a service charge present in the `order.service_charges` field. - * This field is immutable. To change which service charges apply to a line item, - * delete and add a new `OrderLineItemAppliedServiceCharge`. - */ - serviceChargeUid: string; - /** - * 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. - */ - appliedMoney?: Money; -} - -export const orderLineItemAppliedServiceChargeSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - serviceChargeUid: ['service_charge_uid', string()], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - } -); diff --git a/src/models/orderLineItemAppliedTax.ts b/src/models/orderLineItemAppliedTax.ts deleted file mode 100644 index 4035c367e..000000000 --- a/src/models/orderLineItemAppliedTax.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents an applied portion of a tax to a line item in an order. - * Order-scoped taxes automatically include the applied taxes in each line item. - * Line item taxes must be referenced from any applicable line items. - * The corresponding applied money is automatically computed, based on the - * set of participating line items. - */ -export interface OrderLineItemAppliedTax { - /** A unique ID that identifies the applied tax only within this order. */ - uid?: string | null; - /** - * The `uid` of the tax for which this applied tax represents. It must reference - * a tax present in the `order.taxes` field. - * This field is immutable. To change which taxes apply to a line item, delete and add a new - * `OrderLineItemAppliedTax`. - */ - taxUid: string; - /** - * 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. - */ - appliedMoney?: Money; -} - -export const orderLineItemAppliedTaxSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - taxUid: ['tax_uid', string()], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - } -); diff --git a/src/models/orderLineItemDiscount.ts b/src/models/orderLineItemDiscount.ts deleted file mode 100644 index 1e83446f4..000000000 --- a/src/models/orderLineItemDiscount.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { - array, - bigint, - dict, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents a discount that applies to one or more line items in an - * order. - * Fixed-amount, order-scoped discounts are distributed across all non-zero line item totals. - * The amount distributed to each line item is relative to the - * amount contributed by the item to the order subtotal. - */ -export interface OrderLineItemDiscount { - /** A unique ID that identifies the discount only within this order. */ - uid?: string | null; - /** The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). */ - catalogObjectId?: string | null; - /** The version of the catalog object that this discount references. */ - catalogVersion?: bigint | null; - /** The discount's name. */ - name?: string | null; - /** Indicates how the discount is applied to the associated line item or order. */ - type?: string; - /** - * The percentage of the discount, as a string representation of a decimal number. - * A value of `7.25` corresponds to a percentage of 7.25%. - * `percentage` is not set for amount-based discounts. - */ - percentage?: 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. - */ - amountMoney?: Money; - /** - * 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. - */ - appliedMoney?: Money; - /** - * Application-defined data attached to this discount. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; - /** Indicates whether this is a line-item or order-level discount. */ - scope?: string; - /** - * The reward IDs corresponding to this discount. The application and - * specification of discounts that have `reward_ids` are completely controlled by the backing - * criteria corresponding to the reward tiers of the rewards that are added to the order - * through the Loyalty API. To manually unapply discounts that are the result of added rewards, - * the rewards must be removed from the order through the Loyalty API. - */ - rewardIds?: string[]; - /** - * The object ID of a [pricing rule](entity:CatalogPricingRule) to be applied - * automatically to this discount. The specification and application of the discounts, to - * which a `pricing_rule_id` is assigned, are completely controlled by the corresponding - * pricing rule. - */ - pricingRuleId?: string; -} - -export const orderLineItemDiscountSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - name: ['name', optional(nullable(string()))], - type: ['type', optional(string())], - percentage: ['percentage', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - metadata: ['metadata', optional(nullable(dict(string())))], - scope: ['scope', optional(string())], - rewardIds: ['reward_ids', optional(array(string()))], - pricingRuleId: ['pricing_rule_id', optional(string())], - } -); diff --git a/src/models/orderLineItemModifier.ts b/src/models/orderLineItemModifier.ts deleted file mode 100644 index 7dcd0658c..000000000 --- a/src/models/orderLineItemModifier.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { - bigint, - dict, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** A [CatalogModifier]($m/CatalogModifier). */ -export interface OrderLineItemModifier { - /** A unique ID that identifies the modifier only within this order. */ - uid?: string | null; - /** The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). */ - catalogObjectId?: string | null; - /** The version of the catalog object that this modifier references. */ - catalogVersion?: bigint | null; - /** The name of the item modifier. */ - name?: string | null; - /** - * The quantity of the line item modifier. The modifier quantity can be 0 or more. - * For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders - * this item, the restaurant records the purchase by creating an `Order` object with a line item - * for a burger. The line item includes a line item modifier: the name is cheese and the quantity - * is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses - * the extra cheese option, the modifier quantity increases to 2. If the buyer does not want - * any cheese, the modifier quantity is set to 0. - */ - quantity?: 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. - */ - basePriceMoney?: Money; - /** - * 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. - */ - totalPriceMoney?: Money; - /** - * Application-defined data attached to this order. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; -} - -export const orderLineItemModifierSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - name: ['name', optional(nullable(string()))], - quantity: ['quantity', optional(nullable(string()))], - basePriceMoney: ['base_price_money', optional(lazy(() => moneySchema))], - totalPriceMoney: ['total_price_money', optional(lazy(() => moneySchema))], - metadata: ['metadata', optional(nullable(dict(string())))], - } -); diff --git a/src/models/orderLineItemPricingBlocklists.ts b/src/models/orderLineItemPricingBlocklists.ts deleted file mode 100644 index 4fdd2bef2..000000000 --- a/src/models/orderLineItemPricingBlocklists.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { array, lazy, nullable, object, optional, Schema } from '../schema'; -import { - OrderLineItemPricingBlocklistsBlockedDiscount, - orderLineItemPricingBlocklistsBlockedDiscountSchema, -} from './orderLineItemPricingBlocklistsBlockedDiscount'; -import { - OrderLineItemPricingBlocklistsBlockedTax, - orderLineItemPricingBlocklistsBlockedTaxSchema, -} from './orderLineItemPricingBlocklistsBlockedTax'; - -/** - * Describes pricing adjustments that are blocked from automatic - * application to a line item. For more information, see - * [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). - */ -export interface OrderLineItemPricingBlocklists { - /** - * A list of discounts blocked from applying to the line item. - * Discounts can be blocked by the `discount_uid` (for ad hoc discounts) or - * the `discount_catalog_object_id` (for catalog discounts). - */ - blockedDiscounts?: OrderLineItemPricingBlocklistsBlockedDiscount[] | null; - /** - * A list of taxes blocked from applying to the line item. - * Taxes can be blocked by the `tax_uid` (for ad hoc taxes) or - * the `tax_catalog_object_id` (for catalog taxes). - */ - blockedTaxes?: OrderLineItemPricingBlocklistsBlockedTax[] | null; -} - -export const orderLineItemPricingBlocklistsSchema: Schema = object( - { - blockedDiscounts: [ - 'blocked_discounts', - optional( - nullable( - array(lazy(() => orderLineItemPricingBlocklistsBlockedDiscountSchema)) - ) - ), - ], - blockedTaxes: [ - 'blocked_taxes', - optional( - nullable( - array(lazy(() => orderLineItemPricingBlocklistsBlockedTaxSchema)) - ) - ), - ], - } -); diff --git a/src/models/orderLineItemPricingBlocklistsBlockedDiscount.ts b/src/models/orderLineItemPricingBlocklistsBlockedDiscount.ts deleted file mode 100644 index 6381f90e5..000000000 --- a/src/models/orderLineItemPricingBlocklistsBlockedDiscount.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * A discount to block from applying to a line item. The discount must be - * identified by either `discount_uid` or `discount_catalog_object_id`, but not both. - */ -export interface OrderLineItemPricingBlocklistsBlockedDiscount { - /** A unique ID of the `BlockedDiscount` within the order. */ - uid?: string | null; - /** - * The `uid` of the discount that should be blocked. Use this field to block - * ad hoc discounts. For catalog discounts, use the `discount_catalog_object_id` field. - */ - discountUid?: string | null; - /** - * The `catalog_object_id` of the discount that should be blocked. - * Use this field to block catalog discounts. For ad hoc discounts, use the - * `discount_uid` field. - */ - discountCatalogObjectId?: string | null; -} - -export const orderLineItemPricingBlocklistsBlockedDiscountSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - discountUid: ['discount_uid', optional(nullable(string()))], - discountCatalogObjectId: [ - 'discount_catalog_object_id', - optional(nullable(string())), - ], - } -); diff --git a/src/models/orderLineItemPricingBlocklistsBlockedTax.ts b/src/models/orderLineItemPricingBlocklistsBlockedTax.ts deleted file mode 100644 index 34ef3e5ce..000000000 --- a/src/models/orderLineItemPricingBlocklistsBlockedTax.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * A tax to block from applying to a line item. The tax must be - * identified by either `tax_uid` or `tax_catalog_object_id`, but not both. - */ -export interface OrderLineItemPricingBlocklistsBlockedTax { - /** A unique ID of the `BlockedTax` within the order. */ - uid?: string | null; - /** - * The `uid` of the tax that should be blocked. Use this field to block - * ad hoc taxes. For catalog, taxes use the `tax_catalog_object_id` field. - */ - taxUid?: string | null; - /** - * The `catalog_object_id` of the tax that should be blocked. - * Use this field to block catalog taxes. For ad hoc taxes, use the - * `tax_uid` field. - */ - taxCatalogObjectId?: string | null; -} - -export const orderLineItemPricingBlocklistsBlockedTaxSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - taxUid: ['tax_uid', optional(nullable(string()))], - taxCatalogObjectId: ['tax_catalog_object_id', optional(nullable(string()))], - } -); diff --git a/src/models/orderLineItemTax.ts b/src/models/orderLineItemTax.ts deleted file mode 100644 index e0d4b862a..000000000 --- a/src/models/orderLineItemTax.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { - bigint, - boolean, - dict, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents a tax that applies to one or more line item in the order. - * Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals. - * The amount distributed to each line item is relative to the amount the item - * contributes to the order subtotal. - */ -export interface OrderLineItemTax { - /** A unique ID that identifies the tax only within this order. */ - uid?: string | null; - /** The catalog object ID referencing [CatalogTax](entity:CatalogTax). */ - catalogObjectId?: string | null; - /** The version of the catalog object that this tax references. */ - catalogVersion?: bigint | null; - /** The tax's name. */ - name?: string | null; - /** Indicates how the tax is applied to the associated line item or order. */ - type?: string; - /** - * The percentage of the tax, as a string representation of a decimal - * number. For example, a value of `"7.25"` corresponds to a percentage of - * 7.25%. - */ - percentage?: string | null; - /** - * Application-defined data attached to this tax. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | 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. - */ - appliedMoney?: Money; - /** Indicates whether this is a line-item or order-level tax. */ - scope?: string; - /** - * Determines whether the tax was automatically applied to the order based on - * the catalog configuration. For an example, see - * [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes). - */ - autoApplied?: boolean; -} - -export const orderLineItemTaxSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - name: ['name', optional(nullable(string()))], - type: ['type', optional(string())], - percentage: ['percentage', optional(nullable(string()))], - metadata: ['metadata', optional(nullable(dict(string())))], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - scope: ['scope', optional(string())], - autoApplied: ['auto_applied', optional(boolean())], -}); diff --git a/src/models/orderMoneyAmounts.ts b/src/models/orderMoneyAmounts.ts deleted file mode 100644 index 07a087605..000000000 --- a/src/models/orderMoneyAmounts.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { Money, moneySchema } from './money'; - -/** A collection of various money amounts. */ -export interface OrderMoneyAmounts { - /** - * 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. - */ - totalMoney?: Money; - /** - * 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. - */ - taxMoney?: Money; - /** - * 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. - */ - discountMoney?: Money; - /** - * 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. - */ - tipMoney?: Money; - /** - * 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. - */ - serviceChargeMoney?: Money; -} - -export const orderMoneyAmountsSchema: Schema = object({ - totalMoney: ['total_money', optional(lazy(() => moneySchema))], - taxMoney: ['tax_money', optional(lazy(() => moneySchema))], - discountMoney: ['discount_money', optional(lazy(() => moneySchema))], - tipMoney: ['tip_money', optional(lazy(() => moneySchema))], - serviceChargeMoney: [ - 'service_charge_money', - optional(lazy(() => moneySchema)), - ], -}); diff --git a/src/models/orderPricingOptions.ts b/src/models/orderPricingOptions.ts deleted file mode 100644 index b9f64019f..000000000 --- a/src/models/orderPricingOptions.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { boolean, nullable, object, optional, Schema } from '../schema'; - -/** - * Pricing options for an order. The options affect how the order's price is calculated. - * They can be used, for example, to apply automatic price adjustments that are based on preconfigured - * [pricing rules]($m/CatalogPricingRule). - */ -export interface OrderPricingOptions { - /** - * The option to determine whether pricing rule-based - * discounts are automatically applied to an order. - */ - autoApplyDiscounts?: boolean | null; - /** - * The option to determine whether rule-based taxes are automatically - * applied to an order when the criteria of the corresponding rules are met. - */ - autoApplyTaxes?: boolean | null; -} - -export const orderPricingOptionsSchema: Schema = object({ - autoApplyDiscounts: ['auto_apply_discounts', optional(nullable(boolean()))], - autoApplyTaxes: ['auto_apply_taxes', optional(nullable(boolean()))], -}); diff --git a/src/models/orderQuantityUnit.ts b/src/models/orderQuantityUnit.ts deleted file mode 100644 index 1fd9da60e..000000000 --- a/src/models/orderQuantityUnit.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { - bigint, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { MeasurementUnit, measurementUnitSchema } from './measurementUnit'; - -/** - * Contains the measurement unit for a quantity and a precision that - * specifies the number of digits after the decimal point for decimal quantities. - */ -export interface OrderQuantityUnit { - /** - * Represents a unit of measurement to use with a quantity, such as ounces - * or inches. Exactly one of the following fields are required: `custom_unit`, - * `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. - */ - measurementUnit?: MeasurementUnit; - /** - * For non-integer quantities, represents the number of digits after the decimal point that are - * recorded for this quantity. - * For example, a precision of 1 allows quantities such as `"1.0"` and `"1.1"`, but not `"1.01"`. - * Min: 0. Max: 5. - */ - precision?: number | null; - /** - * The catalog object ID referencing the - * [CatalogMeasurementUnit](entity:CatalogMeasurementUnit). - * This field is set when this is a catalog-backed measurement unit. - */ - catalogObjectId?: string | null; - /** - * The version of the catalog object that this measurement unit references. - * This field is set when this is a catalog-backed measurement unit. - */ - catalogVersion?: bigint | null; -} - -export const orderQuantityUnitSchema: Schema = object({ - measurementUnit: [ - 'measurement_unit', - optional(lazy(() => measurementUnitSchema)), - ], - precision: ['precision', optional(nullable(number()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], -}); diff --git a/src/models/orderReturn.ts b/src/models/orderReturn.ts deleted file mode 100644 index e63802261..000000000 --- a/src/models/orderReturn.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - OrderMoneyAmounts, - orderMoneyAmountsSchema, -} from './orderMoneyAmounts'; -import { - OrderReturnDiscount, - orderReturnDiscountSchema, -} from './orderReturnDiscount'; -import { - OrderReturnLineItem, - orderReturnLineItemSchema, -} from './orderReturnLineItem'; -import { - OrderReturnServiceCharge, - orderReturnServiceChargeSchema, -} from './orderReturnServiceCharge'; -import { OrderReturnTax, orderReturnTaxSchema } from './orderReturnTax'; -import { OrderReturnTip, orderReturnTipSchema } from './orderReturnTip'; -import { - OrderRoundingAdjustment, - orderRoundingAdjustmentSchema, -} from './orderRoundingAdjustment'; - -/** The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order. */ -export interface OrderReturn { - /** A unique ID that identifies the return only within this order. */ - uid?: string | null; - /** - * An order that contains the original sale of these return line items. This is unset - * for unlinked returns. - */ - sourceOrderId?: string | null; - /** A collection of line items that are being returned. */ - returnLineItems?: OrderReturnLineItem[] | null; - /** A collection of service charges that are being returned. */ - returnServiceCharges?: OrderReturnServiceCharge[] | null; - /** - * A collection of references to taxes being returned for an order, including the total - * applied tax amount to be returned. The taxes must reference a top-level tax ID from the source - * order. - */ - returnTaxes?: OrderReturnTax[]; - /** - * A collection of references to discounts being returned for an order, including the total - * applied discount amount to be returned. The discounts must reference a top-level discount ID - * from the source order. - */ - returnDiscounts?: OrderReturnDiscount[]; - /** A collection of references to tips being returned for an order. */ - returnTips?: OrderReturnTip[] | null; - /** - * A rounding adjustment of the money being returned. Commonly used to apply cash rounding - * when the minimum unit of the account is smaller than the lowest physical denomination of the currency. - */ - roundingAdjustment?: OrderRoundingAdjustment; - /** A collection of various money amounts. */ - returnAmounts?: OrderMoneyAmounts; -} - -export const orderReturnSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - sourceOrderId: ['source_order_id', optional(nullable(string()))], - returnLineItems: [ - 'return_line_items', - optional(nullable(array(lazy(() => orderReturnLineItemSchema)))), - ], - returnServiceCharges: [ - 'return_service_charges', - optional(nullable(array(lazy(() => orderReturnServiceChargeSchema)))), - ], - returnTaxes: [ - 'return_taxes', - optional(array(lazy(() => orderReturnTaxSchema))), - ], - returnDiscounts: [ - 'return_discounts', - optional(array(lazy(() => orderReturnDiscountSchema))), - ], - returnTips: [ - 'return_tips', - optional(nullable(array(lazy(() => orderReturnTipSchema)))), - ], - roundingAdjustment: [ - 'rounding_adjustment', - optional(lazy(() => orderRoundingAdjustmentSchema)), - ], - returnAmounts: [ - 'return_amounts', - optional(lazy(() => orderMoneyAmountsSchema)), - ], -}); diff --git a/src/models/orderReturnDiscount.ts b/src/models/orderReturnDiscount.ts deleted file mode 100644 index a08f9cbb2..000000000 --- a/src/models/orderReturnDiscount.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { - bigint, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents a discount being returned that applies to one or more return line items in an - * order. - * Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals. - * The amount distributed to each return line item is relative to that item’s contribution to the - * order subtotal. - */ -export interface OrderReturnDiscount { - /** A unique ID that identifies the returned discount only within this order. */ - uid?: string | null; - /** The discount `uid` from the order that contains the original application of this discount. */ - sourceDiscountUid?: string | null; - /** The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount). */ - catalogObjectId?: string | null; - /** The version of the catalog object that this discount references. */ - catalogVersion?: bigint | null; - /** The discount's name. */ - name?: string | null; - /** Indicates how the discount is applied to the associated line item or order. */ - type?: string; - /** - * The percentage of the tax, as a string representation of a decimal number. - * A value of `"7.25"` corresponds to a percentage of 7.25%. - * `percentage` is not set for amount-based discounts. - */ - percentage?: 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. - */ - amountMoney?: Money; - /** - * 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. - */ - appliedMoney?: Money; - /** Indicates whether this is a line-item or order-level discount. */ - scope?: string; -} - -export const orderReturnDiscountSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - sourceDiscountUid: ['source_discount_uid', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - name: ['name', optional(nullable(string()))], - type: ['type', optional(string())], - percentage: ['percentage', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - scope: ['scope', optional(string())], -}); diff --git a/src/models/orderReturnLineItem.ts b/src/models/orderReturnLineItem.ts deleted file mode 100644 index a9dbf5fb4..000000000 --- a/src/models/orderReturnLineItem.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { - array, - bigint, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; -import { - OrderLineItemAppliedDiscount, - orderLineItemAppliedDiscountSchema, -} from './orderLineItemAppliedDiscount'; -import { - OrderLineItemAppliedServiceCharge, - orderLineItemAppliedServiceChargeSchema, -} from './orderLineItemAppliedServiceCharge'; -import { - OrderLineItemAppliedTax, - orderLineItemAppliedTaxSchema, -} from './orderLineItemAppliedTax'; -import { - OrderQuantityUnit, - orderQuantityUnitSchema, -} from './orderQuantityUnit'; -import { - OrderReturnLineItemModifier, - orderReturnLineItemModifierSchema, -} from './orderReturnLineItemModifier'; - -/** The line item being returned in an order. */ -export interface OrderReturnLineItem { - /** A unique ID for this return line-item entry. */ - uid?: string | null; - /** The `uid` of the line item in the original sale order. */ - sourceLineItemUid?: string | null; - /** The name of the line item. */ - name?: string | null; - /** - * The quantity returned, formatted as a decimal number. - * For example, `"3"`. - * Line items with a `quantity_unit` can have non-integer quantities. - * For example, `"1.70000"`. - */ - quantity: string; - /** - * Contains the measurement unit for a quantity and a precision that - * specifies the number of digits after the decimal point for decimal quantities. - */ - quantityUnit?: OrderQuantityUnit; - /** The note of the return line item. */ - note?: string | null; - /** The [CatalogItemVariation](entity:CatalogItemVariation) ID applied to this return line item. */ - catalogObjectId?: string | null; - /** The version of the catalog object that this line item references. */ - catalogVersion?: bigint | null; - /** The name of the variation applied to this return line item. */ - variationName?: string | null; - /** Represents the line item type. */ - itemType?: string; - /** The [CatalogModifier](entity:CatalogModifier)s applied to this line item. */ - returnModifiers?: OrderReturnLineItemModifier[] | null; - /** - * The list of references to `OrderReturnTax` entities applied to the return line item. Each - * `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level - * `OrderReturnTax` applied to the return line item. On reads, the applied amount - * is populated. - */ - appliedTaxes?: OrderLineItemAppliedTax[] | null; - /** - * The list of references to `OrderReturnDiscount` entities applied to the return line item. Each - * `OrderLineItemAppliedDiscount` has a `discount_uid` that references the `uid` of a top-level - * `OrderReturnDiscount` applied to the return line item. On reads, the applied amount - * is populated. - */ - appliedDiscounts?: OrderLineItemAppliedDiscount[] | 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. - */ - basePriceMoney?: Money; - /** - * 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. - */ - variationTotalPriceMoney?: Money; - /** - * 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. - */ - grossReturnMoney?: Money; - /** - * 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. - */ - totalTaxMoney?: Money; - /** - * 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. - */ - totalDiscountMoney?: Money; - /** - * 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. - */ - totalMoney?: Money; - /** - * The list of references to `OrderReturnServiceCharge` entities applied to the return - * line item. Each `OrderLineItemAppliedServiceCharge` has a `service_charge_uid` that - * references the `uid` of a top-level `OrderReturnServiceCharge` applied to the return line - * item. On reads, the applied amount is populated. - */ - appliedServiceCharges?: OrderLineItemAppliedServiceCharge[] | 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. - */ - totalServiceChargeMoney?: Money; -} - -export const orderReturnLineItemSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - sourceLineItemUid: ['source_line_item_uid', optional(nullable(string()))], - name: ['name', optional(nullable(string()))], - quantity: ['quantity', string()], - quantityUnit: [ - 'quantity_unit', - optional(lazy(() => orderQuantityUnitSchema)), - ], - note: ['note', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - variationName: ['variation_name', optional(nullable(string()))], - itemType: ['item_type', optional(string())], - returnModifiers: [ - 'return_modifiers', - optional(nullable(array(lazy(() => orderReturnLineItemModifierSchema)))), - ], - appliedTaxes: [ - 'applied_taxes', - optional(nullable(array(lazy(() => orderLineItemAppliedTaxSchema)))), - ], - appliedDiscounts: [ - 'applied_discounts', - optional(nullable(array(lazy(() => orderLineItemAppliedDiscountSchema)))), - ], - basePriceMoney: ['base_price_money', optional(lazy(() => moneySchema))], - variationTotalPriceMoney: [ - 'variation_total_price_money', - optional(lazy(() => moneySchema)), - ], - grossReturnMoney: ['gross_return_money', optional(lazy(() => moneySchema))], - totalTaxMoney: ['total_tax_money', optional(lazy(() => moneySchema))], - totalDiscountMoney: [ - 'total_discount_money', - optional(lazy(() => moneySchema)), - ], - totalMoney: ['total_money', optional(lazy(() => moneySchema))], - appliedServiceCharges: [ - 'applied_service_charges', - optional( - nullable(array(lazy(() => orderLineItemAppliedServiceChargeSchema))) - ), - ], - totalServiceChargeMoney: [ - 'total_service_charge_money', - optional(lazy(() => moneySchema)), - ], -}); diff --git a/src/models/orderReturnLineItemModifier.ts b/src/models/orderReturnLineItemModifier.ts deleted file mode 100644 index fc995ad0a..000000000 --- a/src/models/orderReturnLineItemModifier.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - bigint, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** A line item modifier being returned. */ -export interface OrderReturnLineItemModifier { - /** A unique ID that identifies the return modifier only within this order. */ - uid?: string | null; - /** - * The modifier `uid` from the order's line item that contains the - * original sale of this line item modifier. - */ - sourceModifierUid?: string | null; - /** The catalog object ID referencing [CatalogModifier](entity:CatalogModifier). */ - catalogObjectId?: string | null; - /** The version of the catalog object that this line item modifier references. */ - catalogVersion?: bigint | null; - /** The name of the item modifier. */ - name?: 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. - */ - basePriceMoney?: Money; - /** - * 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. - */ - totalPriceMoney?: Money; - /** - * The quantity of the line item modifier. The modifier quantity can be 0 or more. - * For example, suppose a restaurant offers a cheeseburger on the menu. When a buyer orders - * this item, the restaurant records the purchase by creating an `Order` object with a line item - * for a burger. The line item includes a line item modifier: the name is cheese and the quantity - * is 1. The buyer has the option to order extra cheese (or no cheese). If the buyer chooses - * the extra cheese option, the modifier quantity increases to 2. If the buyer does not want - * any cheese, the modifier quantity is set to 0. - */ - quantity?: string | null; -} - -export const orderReturnLineItemModifierSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - sourceModifierUid: ['source_modifier_uid', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - name: ['name', optional(nullable(string()))], - basePriceMoney: ['base_price_money', optional(lazy(() => moneySchema))], - totalPriceMoney: ['total_price_money', optional(lazy(() => moneySchema))], - quantity: ['quantity', optional(nullable(string()))], - } -); diff --git a/src/models/orderReturnServiceCharge.ts b/src/models/orderReturnServiceCharge.ts deleted file mode 100644 index b49bcdec9..000000000 --- a/src/models/orderReturnServiceCharge.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { - array, - bigint, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; -import { - OrderLineItemAppliedTax, - orderLineItemAppliedTaxSchema, -} from './orderLineItemAppliedTax'; - -/** Represents the service charge applied to the original order. */ -export interface OrderReturnServiceCharge { - /** A unique ID that identifies the return service charge only within this order. */ - uid?: string | null; - /** - * The service charge `uid` from the order containing the original - * service charge. `source_service_charge_uid` is `null` for - * unlinked returns. - */ - sourceServiceChargeUid?: string | null; - /** The name of the service charge. */ - name?: string | null; - /** The catalog object ID of the associated [OrderServiceCharge](entity:OrderServiceCharge). */ - catalogObjectId?: string | null; - /** The version of the catalog object that this service charge references. */ - catalogVersion?: bigint | null; - /** - * The percentage of the service charge, as a string representation of - * a decimal number. For example, a value of `"7.25"` corresponds to a - * percentage of 7.25%. - * Either `percentage` or `amount_money` should be set, but not both. - */ - percentage?: 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. - */ - amountMoney?: Money; - /** - * 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. - */ - appliedMoney?: Money; - /** - * 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. - */ - totalMoney?: Money; - /** - * 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. - */ - totalTaxMoney?: Money; - /** - * Represents a phase in the process of calculating order totals. - * Service charges are applied after the indicated phase. - * [Read more about how order totals are calculated.](https://developer.squareup.com/docs/orders-api/how-it-works#how-totals-are-calculated) - */ - calculationPhase?: string; - /** - * Indicates whether the surcharge can be taxed. Service charges - * calculated in the `TOTAL_PHASE` cannot be marked as taxable. - */ - taxable?: boolean | null; - /** - * The list of references to `OrderReturnTax` entities applied to the - * `OrderReturnServiceCharge`. Each `OrderLineItemAppliedTax` has a `tax_uid` - * that references the `uid` of a top-level `OrderReturnTax` that is being - * applied to the `OrderReturnServiceCharge`. On reads, the applied amount is - * populated. - */ - appliedTaxes?: OrderLineItemAppliedTax[] | null; - /** - * Indicates whether the service charge will be treated as a value-holding line item or - * apportioned toward a line item. - */ - treatmentType?: string; - /** - * Indicates whether this is a line-item or order-level apportioned - * service charge. - */ - scope?: string; -} - -export const orderReturnServiceChargeSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - sourceServiceChargeUid: [ - 'source_service_charge_uid', - optional(nullable(string())), - ], - name: ['name', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - percentage: ['percentage', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - totalMoney: ['total_money', optional(lazy(() => moneySchema))], - totalTaxMoney: ['total_tax_money', optional(lazy(() => moneySchema))], - calculationPhase: ['calculation_phase', optional(string())], - taxable: ['taxable', optional(nullable(boolean()))], - appliedTaxes: [ - 'applied_taxes', - optional(nullable(array(lazy(() => orderLineItemAppliedTaxSchema)))), - ], - treatmentType: ['treatment_type', optional(string())], - scope: ['scope', optional(string())], - } -); diff --git a/src/models/orderReturnTax.ts b/src/models/orderReturnTax.ts deleted file mode 100644 index f7b82579e..000000000 --- a/src/models/orderReturnTax.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { - bigint, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Represents a tax being returned that applies to one or more return line items in an order. - * Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals. - * The amount distributed to each return line item is relative to that item’s contribution to the - * order subtotal. - */ -export interface OrderReturnTax { - /** A unique ID that identifies the returned tax only within this order. */ - uid?: string | null; - /** The tax `uid` from the order that contains the original tax charge. */ - sourceTaxUid?: string | null; - /** The catalog object ID referencing [CatalogTax](entity:CatalogTax). */ - catalogObjectId?: string | null; - /** The version of the catalog object that this tax references. */ - catalogVersion?: bigint | null; - /** The tax's name. */ - name?: string | null; - /** Indicates how the tax is applied to the associated line item or order. */ - type?: string; - /** - * The percentage of the tax, as a string representation of a decimal number. - * For example, a value of `"7.25"` corresponds to a percentage of 7.25%. - */ - percentage?: 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. - */ - appliedMoney?: Money; - /** Indicates whether this is a line-item or order-level tax. */ - scope?: string; -} - -export const orderReturnTaxSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - sourceTaxUid: ['source_tax_uid', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - name: ['name', optional(nullable(string()))], - type: ['type', optional(string())], - percentage: ['percentage', optional(nullable(string()))], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - scope: ['scope', optional(string())], -}); diff --git a/src/models/orderReturnTip.ts b/src/models/orderReturnTip.ts deleted file mode 100644 index 57e3d5d15..000000000 --- a/src/models/orderReturnTip.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** A tip being returned. */ -export interface OrderReturnTip { - /** A unique ID that identifies the tip only within this order. */ - uid?: 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. - */ - appliedMoney?: Money; - /** The tender `uid` from the order that contains the original application of this tip. */ - sourceTenderUid?: string | null; - /** The tender `id` from the order that contains the original application of this tip. */ - sourceTenderId?: string | null; -} - -export const orderReturnTipSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - sourceTenderUid: ['source_tender_uid', optional(nullable(string()))], - sourceTenderId: ['source_tender_id', optional(nullable(string()))], -}); diff --git a/src/models/orderReward.ts b/src/models/orderReward.ts deleted file mode 100644 index 0410df480..000000000 --- a/src/models/orderReward.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** - * Represents a reward that can be applied to an order if the necessary - * reward tier criteria are met. Rewards are created through the Loyalty API. - */ -export interface OrderReward { - /** The identifier of the reward. */ - id: string; - /** The identifier of the reward tier corresponding to this reward. */ - rewardTierId: string; -} - -export const orderRewardSchema: Schema = object({ - id: ['id', string()], - rewardTierId: ['reward_tier_id', string()], -}); diff --git a/src/models/orderRoundingAdjustment.ts b/src/models/orderRoundingAdjustment.ts deleted file mode 100644 index f5a574924..000000000 --- a/src/models/orderRoundingAdjustment.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * A rounding adjustment of the money being returned. Commonly used to apply cash rounding - * when the minimum unit of the account is smaller than the lowest physical denomination of the currency. - */ -export interface OrderRoundingAdjustment { - /** A unique ID that identifies the rounding adjustment only within this order. */ - uid?: string | null; - /** The name of the rounding adjustment from the original sale order. */ - name?: 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. - */ - amountMoney?: Money; -} - -export const orderRoundingAdjustmentSchema: Schema = object( - { - uid: ['uid', optional(nullable(string()))], - name: ['name', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - } -); diff --git a/src/models/orderServiceCharge.ts b/src/models/orderServiceCharge.ts deleted file mode 100644 index 895831c11..000000000 --- a/src/models/orderServiceCharge.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { - array, - bigint, - boolean, - dict, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; -import { - OrderLineItemAppliedTax, - orderLineItemAppliedTaxSchema, -} from './orderLineItemAppliedTax'; - -/** Represents a service charge applied to an order. */ -export interface OrderServiceCharge { - /** A unique ID that identifies the service charge only within this order. */ - uid?: string | null; - /** The name of the service charge. */ - name?: string | null; - /** The catalog object ID referencing the service charge [CatalogObject](entity:CatalogObject). */ - catalogObjectId?: string | null; - /** The version of the catalog object that this service charge references. */ - catalogVersion?: bigint | null; - /** - * The service charge percentage as a string representation of a - * decimal number. For example, `"7.25"` indicates a service charge of 7.25%. - * Exactly 1 of `percentage` or `amount_money` should be set. - */ - percentage?: 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. - */ - amountMoney?: Money; - /** - * 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. - */ - appliedMoney?: Money; - /** - * 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. - */ - totalMoney?: Money; - /** - * 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. - */ - totalTaxMoney?: Money; - /** - * Represents a phase in the process of calculating order totals. - * Service charges are applied after the indicated phase. - * [Read more about how order totals are calculated.](https://developer.squareup.com/docs/orders-api/how-it-works#how-totals-are-calculated) - */ - calculationPhase?: string; - /** - * Indicates whether the service charge can be taxed. If set to `true`, - * order-level taxes automatically apply to the service charge. Note that - * service charges calculated in the `TOTAL_PHASE` cannot be marked as taxable. - */ - taxable?: boolean | null; - /** - * The list of references to the taxes applied to this service charge. Each - * `OrderLineItemAppliedTax` has a `tax_uid` that references the `uid` of a top-level - * `OrderLineItemTax` that is being applied to this service charge. On reads, the amount applied - * is populated. - * An `OrderLineItemAppliedTax` is automatically created on every taxable service charge - * for all `ORDER` scoped taxes that are added to the order. `OrderLineItemAppliedTax` records - * for `LINE_ITEM` scoped taxes must be added in requests for the tax to apply to any taxable - * service charge. Taxable service charges have the `taxable` field set to `true` and calculated - * in the `SUBTOTAL_PHASE`. - * To change the amount of a tax, modify the referenced top-level tax. - */ - appliedTaxes?: OrderLineItemAppliedTax[] | null; - /** - * Application-defined data attached to this service charge. Metadata fields are intended - * to store descriptive references or associations with an entity in another system or store brief - * information about the object. Square does not process this field; it only stores and returns it - * in relevant API calls. Do not use metadata to store any sensitive information (such as personally - * identifiable information or card details). - * Keys written by applications must be 60 characters or less and must be in the character set - * `[a-zA-Z0-9_-]`. Entries can also include metadata generated by Square. These keys are prefixed - * with a namespace, separated from the key with a ':' character. - * Values have a maximum length of 255 characters. - * An application can have up to 10 entries per metadata field. - * Entries written by applications are private and can only be read or modified by the same - * application. - * For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata). - */ - metadata?: Record | null; - type?: string; - /** - * Indicates whether the service charge will be treated as a value-holding line item or - * apportioned toward a line item. - */ - treatmentType?: string; - /** - * Indicates whether this is a line-item or order-level apportioned - * service charge. - */ - scope?: string; -} - -export const orderServiceChargeSchema: Schema = object({ - uid: ['uid', optional(nullable(string()))], - name: ['name', optional(nullable(string()))], - catalogObjectId: ['catalog_object_id', optional(nullable(string()))], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - percentage: ['percentage', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - appliedMoney: ['applied_money', optional(lazy(() => moneySchema))], - totalMoney: ['total_money', optional(lazy(() => moneySchema))], - totalTaxMoney: ['total_tax_money', optional(lazy(() => moneySchema))], - calculationPhase: ['calculation_phase', optional(string())], - taxable: ['taxable', optional(nullable(boolean()))], - appliedTaxes: [ - 'applied_taxes', - optional(nullable(array(lazy(() => orderLineItemAppliedTaxSchema)))), - ], - metadata: ['metadata', optional(nullable(dict(string())))], - type: ['type', optional(string())], - treatmentType: ['treatment_type', optional(string())], - scope: ['scope', optional(string())], -}); diff --git a/src/models/orderSource.ts b/src/models/orderSource.ts deleted file mode 100644 index eb71cb5b5..000000000 --- a/src/models/orderSource.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Represents the origination details of an order. */ -export interface OrderSource { - /** - * The name used to identify the place (physical or digital) that an order originates. - * If unset, the name defaults to the name of the application that created the order. - */ - name?: string | null; -} - -export const orderSourceSchema: Schema = object({ - name: ['name', optional(nullable(string()))], -}); diff --git a/src/models/orderUpdated.ts b/src/models/orderUpdated.ts deleted file mode 100644 index 2fab53726..000000000 --- a/src/models/orderUpdated.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface OrderUpdated { - /** The order's unique ID. */ - orderId?: string | null; - /** - * The version number, which is incremented each time an update is committed to the order. - * Orders that were not created through the API do not include a version number and - * therefore cannot be updated. - * [Read more about working with versions.](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders) - */ - version?: number; - /** The ID of the seller location that this order is associated with. */ - locationId?: string | null; - /** The state of the order. */ - state?: string; - /** The timestamp for when the order was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp for when the order was last updated, in RFC 3339 format. */ - updatedAt?: string; -} - -export const orderUpdatedSchema: Schema = object({ - orderId: ['order_id', optional(nullable(string()))], - version: ['version', optional(number())], - locationId: ['location_id', optional(nullable(string()))], - state: ['state', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/orderUpdatedObject.ts b/src/models/orderUpdatedObject.ts deleted file mode 100644 index 9f1890446..000000000 --- a/src/models/orderUpdatedObject.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { OrderUpdated, orderUpdatedSchema } from './orderUpdated'; - -export interface OrderUpdatedObject { - orderUpdated?: OrderUpdated; -} - -export const orderUpdatedObjectSchema: Schema = object({ - orderUpdated: ['order_updated', optional(lazy(() => orderUpdatedSchema))], -}); diff --git a/src/models/paginationCursor.ts b/src/models/paginationCursor.ts deleted file mode 100644 index 54850da9f..000000000 --- a/src/models/paginationCursor.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Used *internally* to encapsulate pagination details. The resulting proto will be base62 encoded - * in order to produce a cursor that can be used externally. - */ -export interface PaginationCursor { - /** - * The ID of the last resource in the current page. The page can be in an ascending or - * descending order - */ - orderValue?: string | null; -} - -export const paginationCursorSchema: Schema = object({ - orderValue: ['order_value', optional(nullable(string()))], -}); diff --git a/src/models/pauseSubscriptionRequest.ts b/src/models/pauseSubscriptionRequest.ts deleted file mode 100644 index ff0054d48..000000000 --- a/src/models/pauseSubscriptionRequest.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { bigint, nullable, object, optional, Schema, string } from '../schema'; - -/** - * Defines input parameters in a request to the - * [PauseSubscription]($e/Subscriptions/PauseSubscription) endpoint. - */ -export interface PauseSubscriptionRequest { - /** - * The `YYYY-MM-DD`-formatted date when the scheduled `PAUSE` action takes place on the subscription. - * When this date is unspecified or falls within the current billing cycle, the subscription is paused - * on the starting date of the next billing cycle. - */ - pauseEffectiveDate?: string | null; - /** - * The number of billing cycles the subscription will be paused before it is reactivated. - * When this is set, a `RESUME` action is also scheduled to take place on the subscription at - * the end of the specified pause cycle duration. In this case, neither `resume_effective_date` - * nor `resume_change_timing` may be specified. - */ - pauseCycleDuration?: bigint | null; - /** - * The date when the subscription is reactivated by a scheduled `RESUME` action. - * This date must be at least one billing cycle ahead of `pause_effective_date`. - */ - resumeEffectiveDate?: string | null; - /** Supported timings when a pending change, as an action, takes place to a subscription. */ - resumeChangeTiming?: string; - /** The user-provided reason to pause the subscription. */ - pauseReason?: string | null; -} - -export const pauseSubscriptionRequestSchema: Schema = object( - { - pauseEffectiveDate: ['pause_effective_date', optional(nullable(string()))], - pauseCycleDuration: ['pause_cycle_duration', optional(nullable(bigint()))], - resumeEffectiveDate: [ - 'resume_effective_date', - optional(nullable(string())), - ], - resumeChangeTiming: ['resume_change_timing', optional(string())], - pauseReason: ['pause_reason', optional(nullable(string()))], - } -); diff --git a/src/models/pauseSubscriptionResponse.ts b/src/models/pauseSubscriptionResponse.ts deleted file mode 100644 index cceb532b0..000000000 --- a/src/models/pauseSubscriptionResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; -import { - SubscriptionAction, - subscriptionActionSchema, -} from './subscriptionAction'; - -/** - * Defines output parameters in a response from the - * [PauseSubscription]($e/Subscriptions/PauseSubscription) endpoint. - */ -export interface PauseSubscriptionResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * 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. */ - actions?: SubscriptionAction[]; -} - -export const pauseSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - actions: ['actions', optional(array(lazy(() => subscriptionActionSchema)))], - } -); diff --git a/src/models/payOrderRequest.ts b/src/models/payOrderRequest.ts deleted file mode 100644 index 085f92ecb..000000000 --- a/src/models/payOrderRequest.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { - array, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * Defines the fields that are included in requests to the - * [PayOrder]($e/Orders/PayOrder) endpoint. - */ -export interface PayOrderRequest { - /** - * A value you specify that uniquely identifies this request among requests you have sent. If - * you are unsure whether a particular payment request was completed successfully, you can reattempt - * it with the same idempotency key without worrying about duplicate payments. - * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). - */ - idempotencyKey: string; - /** The version of the order being paid. If not supplied, the latest version will be paid. */ - orderVersion?: number | null; - /** - * The IDs of the [payments](entity:Payment) to collect. - * The payment total must match the order total. - */ - paymentIds?: string[] | null; -} - -export const payOrderRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', string()], - orderVersion: ['order_version', optional(nullable(number()))], - paymentIds: ['payment_ids', optional(nullable(array(string())))], -}); diff --git a/src/models/payOrderResponse.ts b/src/models/payOrderResponse.ts deleted file mode 100644 index d9bb1704e..000000000 --- a/src/models/payOrderResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Order, orderSchema } from './order'; - -/** - * Defines the fields that are included in the response body of a request to the - * [PayOrder]($e/Orders/PayOrder) endpoint. - */ -export interface PayOrderResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; -} - -export const payOrderResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - order: ['order', optional(lazy(() => orderSchema))], -}); diff --git a/src/models/payment.ts b/src/models/payment.ts deleted file mode 100644 index 7967de9b3..000000000 --- a/src/models/payment.ts +++ /dev/null @@ -1,348 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { - ApplicationDetails, - applicationDetailsSchema, -} from './applicationDetails'; -import { - BankAccountPaymentDetails, - bankAccountPaymentDetailsSchema, -} from './bankAccountPaymentDetails'; -import { - BuyNowPayLaterDetails, - buyNowPayLaterDetailsSchema, -} from './buyNowPayLaterDetails'; -import { - CardPaymentDetails, - cardPaymentDetailsSchema, -} from './cardPaymentDetails'; -import { - CashPaymentDetails, - cashPaymentDetailsSchema, -} from './cashPaymentDetails'; -import { DeviceDetails, deviceDetailsSchema } from './deviceDetails'; -import { - DigitalWalletDetails, - digitalWalletDetailsSchema, -} from './digitalWalletDetails'; -import { - ExternalPaymentDetails, - externalPaymentDetailsSchema, -} from './externalPaymentDetails'; -import { Money, moneySchema } from './money'; -import { - OfflinePaymentDetails, - offlinePaymentDetailsSchema, -} from './offlinePaymentDetails'; -import { ProcessingFee, processingFeeSchema } from './processingFee'; -import { RiskEvaluation, riskEvaluationSchema } from './riskEvaluation'; -import { - SquareAccountDetails, - squareAccountDetailsSchema, -} from './squareAccountDetails'; - -/** Represents a payment processed by the Square API. */ -export interface Payment { - /** A unique ID for the payment. */ - id?: string; - /** The timestamp of when the payment was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp of when the payment was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** - * 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. - */ - amountMoney?: Money; - /** - * 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. - */ - tipMoney?: Money; - /** - * 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. - */ - totalMoney?: Money; - /** - * 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. - */ - appFeeMoney?: Money; - /** - * 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. - */ - approvedMoney?: Money; - /** The processing fees and fee adjustments assessed by Square for this payment. */ - processingFee?: ProcessingFee[]; - /** - * 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. - */ - refundedMoney?: Money; - /** Indicates whether the payment is APPROVED, PENDING, COMPLETED, CANCELED, or FAILED. */ - status?: string; - /** - * The duration of time after the payment's creation when Square automatically applies the - * `delay_action` to the payment. This automatic `delay_action` applies only to payments that - * do not reach a terminal state (COMPLETED, CANCELED, or FAILED) before the `delay_duration` - * time period. - * This field is specified as a time duration, in RFC 3339 format. - * Notes: - * This feature is only supported for card payments. - * Default: - * - Card-present payments: "PT36H" (36 hours) from the creation time. - * - Card-not-present payments: "P7D" (7 days) from the creation time. - */ - delayDuration?: string; - /** - * The action to be applied to the payment when the `delay_duration` has elapsed. - * Current values include `CANCEL` and `COMPLETE`. - */ - delayAction?: string | null; - /** - * The read-only timestamp of when the `delay_action` is automatically applied, - * in RFC 3339 format. - * Note that this field is calculated by summing the payment's `delay_duration` and `created_at` - * fields. The `created_at` field is generated by Square and might not exactly match the - * time on your local machine. - */ - delayedUntil?: string; - /** - * The source type for this payment. - * Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `SQUARE_ACCOUNT`, - * `CASH` and `EXTERNAL`. For information about these payment source types, - * see [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments). - */ - sourceType?: string; - /** Reflects the current status of a card payment. Contains only non-confidential information. */ - cardDetails?: CardPaymentDetails; - /** - * Stores details about a cash payment. Contains only non-confidential information. For more information, see - * [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). - */ - cashDetails?: CashPaymentDetails; - /** Additional details about BANK_ACCOUNT type payments. */ - bankAccountDetails?: BankAccountPaymentDetails; - /** - * Stores details about an external payment. Contains only non-confidential information. - * For more information, see - * [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). - */ - externalDetails?: ExternalPaymentDetails; - /** Additional details about `WALLET` type payments. Contains only non-confidential information. */ - walletDetails?: DigitalWalletDetails; - /** Additional details about a Buy Now Pay Later payment type. */ - buyNowPayLaterDetails?: BuyNowPayLaterDetails; - /** Additional details about Square Account payments. */ - squareAccountDetails?: SquareAccountDetails; - /** The ID of the location associated with the payment. */ - locationId?: string; - /** The ID of the order associated with the payment. */ - orderId?: string; - /** - * An optional ID that associates the payment with an entity in - * another system. - */ - referenceId?: string; - /** - * The ID of the customer associated with the payment. If the ID is - * not provided in the `CreatePayment` request that was used to create the `Payment`, - * Square may use information in the request - * (such as the billing and shipping address, email address, and payment source) - * to identify a matching customer profile in the Customer Directory. - * If found, the profile ID is used. If a profile is not found, the - * API attempts to create an - * [instant profile](https://developer.squareup.com/docs/customers-api/what-it-does#instant-profiles). - * If the API cannot create an - * instant profile (either because the seller has disabled it or the - * seller's region prevents creating it), this field remains unset. Note that - * this process is asynchronous and it may take some time before a - * customer ID is added to the payment. - */ - customerId?: string; - /** - * __Deprecated__: Use `Payment.team_member_id` instead. - * An optional ID of the employee associated with taking the payment. - */ - employeeId?: string; - /** An optional ID of the [TeamMember](entity:TeamMember) associated with taking the payment. */ - teamMemberId?: string | null; - /** A list of `refund_id`s identifying refunds for the payment. */ - refundIds?: string[]; - /** - * Represents fraud risk information for the associated payment. - * When you take a payment through Square's Payments API (using the `CreatePayment` - * endpoint), Square evaluates it and assigns a risk level to the payment. Sellers - * can use this information to determine the course of action (for example, - * provide the goods/services or refund the payment). - */ - riskEvaluation?: RiskEvaluation; - /** An optional ID for a Terminal checkout that is associated with the payment. */ - terminalCheckoutId?: string; - /** The buyer's email address. */ - buyerEmailAddress?: string; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - billingAddress?: Address; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - shippingAddress?: Address; - /** An optional note to include when creating a payment. */ - note?: string; - /** - * Additional payment information that gets added to the customer's card statement - * as part of the statement description. - * Note that the `statement_description_identifier` might get truncated on the statement description - * to fit the required information including the Square identifier (SQ *) and the name of the - * seller taking the payment. - */ - statementDescriptionIdentifier?: string; - /** - * Actions that can be performed on this payment: - * - `EDIT_AMOUNT_UP` - The payment amount can be edited up. - * - `EDIT_AMOUNT_DOWN` - The payment amount can be edited down. - * - `EDIT_TIP_AMOUNT_UP` - The tip amount can be edited up. - * - `EDIT_TIP_AMOUNT_DOWN` - The tip amount can be edited down. - * - `EDIT_DELAY_ACTION` - The delay_action can be edited. - */ - capabilities?: string[]; - /** - * The payment's receipt number. - * The field is missing if a payment is canceled. - */ - receiptNumber?: string; - /** - * The URL for the payment's receipt. - * The field is only populated for COMPLETED payments. - */ - receiptUrl?: string; - /** Details about the device that took the payment. */ - deviceDetails?: DeviceDetails; - /** Details about the application that took the payment. */ - applicationDetails?: ApplicationDetails; - /** Whether or not this payment was taken offline. */ - isOfflinePayment?: boolean; - /** Details specific to offline payments. */ - offlinePaymentDetails?: OfflinePaymentDetails; - /** - * Used for optimistic concurrency. This opaque token identifies a specific version of the - * `Payment` object. - */ - versionToken?: string | null; -} - -export const paymentSchema: Schema = object({ - id: ['id', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - tipMoney: ['tip_money', optional(lazy(() => moneySchema))], - totalMoney: ['total_money', optional(lazy(() => moneySchema))], - appFeeMoney: ['app_fee_money', optional(lazy(() => moneySchema))], - approvedMoney: ['approved_money', optional(lazy(() => moneySchema))], - processingFee: [ - 'processing_fee', - optional(array(lazy(() => processingFeeSchema))), - ], - refundedMoney: ['refunded_money', optional(lazy(() => moneySchema))], - status: ['status', optional(string())], - delayDuration: ['delay_duration', optional(string())], - delayAction: ['delay_action', optional(nullable(string()))], - delayedUntil: ['delayed_until', optional(string())], - sourceType: ['source_type', optional(string())], - cardDetails: ['card_details', optional(lazy(() => cardPaymentDetailsSchema))], - cashDetails: ['cash_details', optional(lazy(() => cashPaymentDetailsSchema))], - bankAccountDetails: [ - 'bank_account_details', - optional(lazy(() => bankAccountPaymentDetailsSchema)), - ], - externalDetails: [ - 'external_details', - optional(lazy(() => externalPaymentDetailsSchema)), - ], - walletDetails: [ - 'wallet_details', - optional(lazy(() => digitalWalletDetailsSchema)), - ], - buyNowPayLaterDetails: [ - 'buy_now_pay_later_details', - optional(lazy(() => buyNowPayLaterDetailsSchema)), - ], - squareAccountDetails: [ - 'square_account_details', - optional(lazy(() => squareAccountDetailsSchema)), - ], - locationId: ['location_id', optional(string())], - orderId: ['order_id', optional(string())], - referenceId: ['reference_id', optional(string())], - customerId: ['customer_id', optional(string())], - employeeId: ['employee_id', optional(string())], - teamMemberId: ['team_member_id', optional(nullable(string()))], - refundIds: ['refund_ids', optional(array(string()))], - riskEvaluation: [ - 'risk_evaluation', - optional(lazy(() => riskEvaluationSchema)), - ], - terminalCheckoutId: ['terminal_checkout_id', optional(string())], - buyerEmailAddress: ['buyer_email_address', optional(string())], - billingAddress: ['billing_address', optional(lazy(() => addressSchema))], - shippingAddress: ['shipping_address', optional(lazy(() => addressSchema))], - note: ['note', optional(string())], - statementDescriptionIdentifier: [ - 'statement_description_identifier', - optional(string()), - ], - capabilities: ['capabilities', optional(array(string()))], - receiptNumber: ['receipt_number', optional(string())], - receiptUrl: ['receipt_url', optional(string())], - deviceDetails: ['device_details', optional(lazy(() => deviceDetailsSchema))], - applicationDetails: [ - 'application_details', - optional(lazy(() => applicationDetailsSchema)), - ], - isOfflinePayment: ['is_offline_payment', optional(boolean())], - offlinePaymentDetails: [ - 'offline_payment_details', - optional(lazy(() => offlinePaymentDetailsSchema)), - ], - versionToken: ['version_token', optional(nullable(string()))], -}); diff --git a/src/models/paymentBalanceActivityAppFeeRefundDetail.ts b/src/models/paymentBalanceActivityAppFeeRefundDetail.ts deleted file mode 100644 index f41e28e3a..000000000 --- a/src/models/paymentBalanceActivityAppFeeRefundDetail.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityAppFeeRefundDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The ID of the refund associated with this activity. */ - refundId?: string | null; - /** The ID of the location of the merchant associated with the payment refund activity */ - locationId?: string | null; -} - -export const paymentBalanceActivityAppFeeRefundDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - refundId: ['refund_id', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - } -); diff --git a/src/models/paymentBalanceActivityAppFeeRevenueDetail.ts b/src/models/paymentBalanceActivityAppFeeRevenueDetail.ts deleted file mode 100644 index 1514d1515..000000000 --- a/src/models/paymentBalanceActivityAppFeeRevenueDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityAppFeeRevenueDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The ID of the location of the merchant associated with the payment activity */ - locationId?: string | null; -} - -export const paymentBalanceActivityAppFeeRevenueDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - } -); diff --git a/src/models/paymentBalanceActivityAutomaticSavingsDetail.ts b/src/models/paymentBalanceActivityAutomaticSavingsDetail.ts deleted file mode 100644 index f5c719718..000000000 --- a/src/models/paymentBalanceActivityAutomaticSavingsDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityAutomaticSavingsDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The ID of the payout associated with this activity. */ - payoutId?: string | null; -} - -export const paymentBalanceActivityAutomaticSavingsDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - payoutId: ['payout_id', optional(nullable(string()))], - } -); diff --git a/src/models/paymentBalanceActivityAutomaticSavingsReversedDetail.ts b/src/models/paymentBalanceActivityAutomaticSavingsReversedDetail.ts deleted file mode 100644 index ab59fb3fb..000000000 --- a/src/models/paymentBalanceActivityAutomaticSavingsReversedDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityAutomaticSavingsReversedDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The ID of the payout associated with this activity. */ - payoutId?: string | null; -} - -export const paymentBalanceActivityAutomaticSavingsReversedDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - payoutId: ['payout_id', optional(nullable(string()))], - } -); diff --git a/src/models/paymentBalanceActivityChargeDetail.ts b/src/models/paymentBalanceActivityChargeDetail.ts deleted file mode 100644 index dc3466910..000000000 --- a/src/models/paymentBalanceActivityChargeDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityChargeDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityChargeDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityDepositFeeDetail.ts b/src/models/paymentBalanceActivityDepositFeeDetail.ts deleted file mode 100644 index 2c0cc6608..000000000 --- a/src/models/paymentBalanceActivityDepositFeeDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityDepositFeeDetail { - /** The ID of the payout that triggered this deposit fee activity. */ - payoutId?: string | null; -} - -export const paymentBalanceActivityDepositFeeDetailSchema: Schema = object( - { payoutId: ['payout_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityDepositFeeReversedDetail.ts b/src/models/paymentBalanceActivityDepositFeeReversedDetail.ts deleted file mode 100644 index 7291424b0..000000000 --- a/src/models/paymentBalanceActivityDepositFeeReversedDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityDepositFeeReversedDetail { - /** The ID of the payout that triggered this deposit fee activity. */ - payoutId?: string | null; -} - -export const paymentBalanceActivityDepositFeeReversedDetailSchema: Schema = object( - { payoutId: ['payout_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityDisputeDetail.ts b/src/models/paymentBalanceActivityDisputeDetail.ts deleted file mode 100644 index 14f488343..000000000 --- a/src/models/paymentBalanceActivityDisputeDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityDisputeDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The ID of the dispute associated with this activity. */ - disputeId?: string | null; -} - -export const paymentBalanceActivityDisputeDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - disputeId: ['dispute_id', optional(nullable(string()))], - } -); diff --git a/src/models/paymentBalanceActivityFeeDetail.ts b/src/models/paymentBalanceActivityFeeDetail.ts deleted file mode 100644 index b80506fe4..000000000 --- a/src/models/paymentBalanceActivityFeeDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityFeeDetail { - /** - * The ID of the payment associated with this activity - * This will only be populated when a principal LedgerEntryToken is also populated. - * If the fee is independent (there is no principal LedgerEntryToken) then this will likely not - * be populated. - */ - paymentId?: string | null; -} - -export const paymentBalanceActivityFeeDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityFreeProcessingDetail.ts b/src/models/paymentBalanceActivityFreeProcessingDetail.ts deleted file mode 100644 index 319654774..000000000 --- a/src/models/paymentBalanceActivityFreeProcessingDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityFreeProcessingDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityFreeProcessingDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityHoldAdjustmentDetail.ts b/src/models/paymentBalanceActivityHoldAdjustmentDetail.ts deleted file mode 100644 index 3296167c1..000000000 --- a/src/models/paymentBalanceActivityHoldAdjustmentDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityHoldAdjustmentDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityHoldAdjustmentDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityOpenDisputeDetail.ts b/src/models/paymentBalanceActivityOpenDisputeDetail.ts deleted file mode 100644 index b4eeb87f5..000000000 --- a/src/models/paymentBalanceActivityOpenDisputeDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityOpenDisputeDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The ID of the dispute associated with this activity. */ - disputeId?: string | null; -} - -export const paymentBalanceActivityOpenDisputeDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - disputeId: ['dispute_id', optional(nullable(string()))], - } -); diff --git a/src/models/paymentBalanceActivityOtherAdjustmentDetail.ts b/src/models/paymentBalanceActivityOtherAdjustmentDetail.ts deleted file mode 100644 index a0ec45b5a..000000000 --- a/src/models/paymentBalanceActivityOtherAdjustmentDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityOtherAdjustmentDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityOtherAdjustmentDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityOtherDetail.ts b/src/models/paymentBalanceActivityOtherDetail.ts deleted file mode 100644 index 10976285c..000000000 --- a/src/models/paymentBalanceActivityOtherDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityOtherDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityOtherDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityRefundDetail.ts b/src/models/paymentBalanceActivityRefundDetail.ts deleted file mode 100644 index 4627d5f62..000000000 --- a/src/models/paymentBalanceActivityRefundDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityRefundDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The ID of the refund associated with this activity. */ - refundId?: string | null; -} - -export const paymentBalanceActivityRefundDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - refundId: ['refund_id', optional(nullable(string()))], - } -); diff --git a/src/models/paymentBalanceActivityReleaseAdjustmentDetail.ts b/src/models/paymentBalanceActivityReleaseAdjustmentDetail.ts deleted file mode 100644 index 932d40424..000000000 --- a/src/models/paymentBalanceActivityReleaseAdjustmentDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityReleaseAdjustmentDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityReleaseAdjustmentDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityReserveHoldDetail.ts b/src/models/paymentBalanceActivityReserveHoldDetail.ts deleted file mode 100644 index 5aba1f79d..000000000 --- a/src/models/paymentBalanceActivityReserveHoldDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityReserveHoldDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityReserveHoldDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityReserveReleaseDetail.ts b/src/models/paymentBalanceActivityReserveReleaseDetail.ts deleted file mode 100644 index 14f5da439..000000000 --- a/src/models/paymentBalanceActivityReserveReleaseDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityReserveReleaseDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityReserveReleaseDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivitySquareCapitalPaymentDetail.ts b/src/models/paymentBalanceActivitySquareCapitalPaymentDetail.ts deleted file mode 100644 index 7c879df8b..000000000 --- a/src/models/paymentBalanceActivitySquareCapitalPaymentDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivitySquareCapitalPaymentDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivitySquareCapitalPaymentDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivitySquareCapitalReversedPaymentDetail.ts b/src/models/paymentBalanceActivitySquareCapitalReversedPaymentDetail.ts deleted file mode 100644 index ba02a1653..000000000 --- a/src/models/paymentBalanceActivitySquareCapitalReversedPaymentDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivitySquareCapitalReversedPaymentDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivitySquareCapitalReversedPaymentDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivitySquarePayrollTransferDetail.ts b/src/models/paymentBalanceActivitySquarePayrollTransferDetail.ts deleted file mode 100644 index 9361c6d84..000000000 --- a/src/models/paymentBalanceActivitySquarePayrollTransferDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivitySquarePayrollTransferDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivitySquarePayrollTransferDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivitySquarePayrollTransferReversedDetail.ts b/src/models/paymentBalanceActivitySquarePayrollTransferReversedDetail.ts deleted file mode 100644 index 5b5662f10..000000000 --- a/src/models/paymentBalanceActivitySquarePayrollTransferReversedDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivitySquarePayrollTransferReversedDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivitySquarePayrollTransferReversedDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityTaxOnFeeDetail.ts b/src/models/paymentBalanceActivityTaxOnFeeDetail.ts deleted file mode 100644 index 8997e5cbd..000000000 --- a/src/models/paymentBalanceActivityTaxOnFeeDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityTaxOnFeeDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The description of the tax rate being applied. For example: "GST", "HST". */ - taxRateDescription?: string | null; -} - -export const paymentBalanceActivityTaxOnFeeDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - taxRateDescription: ['tax_rate_description', optional(nullable(string()))], - } -); diff --git a/src/models/paymentBalanceActivityThirdPartyFeeDetail.ts b/src/models/paymentBalanceActivityThirdPartyFeeDetail.ts deleted file mode 100644 index 9d0f4d0b8..000000000 --- a/src/models/paymentBalanceActivityThirdPartyFeeDetail.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityThirdPartyFeeDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; -} - -export const paymentBalanceActivityThirdPartyFeeDetailSchema: Schema = object( - { paymentId: ['payment_id', optional(nullable(string()))] } -); diff --git a/src/models/paymentBalanceActivityThirdPartyFeeRefundDetail.ts b/src/models/paymentBalanceActivityThirdPartyFeeRefundDetail.ts deleted file mode 100644 index dac59ed40..000000000 --- a/src/models/paymentBalanceActivityThirdPartyFeeRefundDetail.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentBalanceActivityThirdPartyFeeRefundDetail { - /** The ID of the payment associated with this activity. */ - paymentId?: string | null; - /** The public refund id associated with this activity. */ - refundId?: string | null; -} - -export const paymentBalanceActivityThirdPartyFeeRefundDetailSchema: Schema = object( - { - paymentId: ['payment_id', optional(nullable(string()))], - refundId: ['refund_id', optional(nullable(string()))], - } -); diff --git a/src/models/paymentLink.ts b/src/models/paymentLink.ts deleted file mode 100644 index 8f8e47e93..000000000 --- a/src/models/paymentLink.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { CheckoutOptions, checkoutOptionsSchema } from './checkoutOptions'; -import { PrePopulatedData, prePopulatedDataSchema } from './prePopulatedData'; - -export interface PaymentLink { - /** The Square-assigned ID of the payment link. */ - id?: string; - /** The Square-assigned version number, which is incremented each time an update is committed to the payment link. */ - version: number; - /** - * The optional description of the `payment_link` object. - * It is primarily for use by your application and is not used anywhere. - */ - description?: string | null; - /** The ID of the order associated with the payment link. */ - orderId?: string; - checkoutOptions?: CheckoutOptions; - /** - * Describes buyer data to prepopulate in the payment form. - * For more information, - * see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). - */ - prePopulatedData?: PrePopulatedData; - /** The shortened URL of the payment link. */ - url?: string; - /** The long URL of the payment link. */ - longUrl?: string; - /** The timestamp when the payment link was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the payment link was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** - * An optional note. After Square processes the payment, this note is added to the - * resulting `Payment`. - */ - paymentNote?: string | null; -} - -export const paymentLinkSchema: Schema = object({ - id: ['id', optional(string())], - version: ['version', number()], - description: ['description', optional(nullable(string()))], - orderId: ['order_id', optional(string())], - checkoutOptions: [ - 'checkout_options', - optional(lazy(() => checkoutOptionsSchema)), - ], - prePopulatedData: [ - 'pre_populated_data', - optional(lazy(() => prePopulatedDataSchema)), - ], - url: ['url', optional(string())], - longUrl: ['long_url', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - paymentNote: ['payment_note', optional(nullable(string()))], -}); diff --git a/src/models/paymentLinkRelatedResources.ts b/src/models/paymentLinkRelatedResources.ts deleted file mode 100644 index 2101ff575..000000000 --- a/src/models/paymentLinkRelatedResources.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, nullable, object, optional, Schema } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Order, orderSchema } from './order'; - -export interface PaymentLinkRelatedResources { - /** The order associated with the payment link. */ - orders?: Order[] | null; - /** The subscription plan associated with the payment link. */ - subscriptionPlans?: CatalogObject[] | null; -} - -export const paymentLinkRelatedResourcesSchema: Schema = object( - { - orders: ['orders', optional(nullable(array(lazy(() => orderSchema))))], - subscriptionPlans: [ - 'subscription_plans', - optional(nullable(array(lazy(() => catalogObjectSchema)))), - ], - } -); diff --git a/src/models/paymentOptions.ts b/src/models/paymentOptions.ts deleted file mode 100644 index 1d4a231b3..000000000 --- a/src/models/paymentOptions.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -export interface PaymentOptions { - /** - * Indicates whether the `Payment` objects created from this `TerminalCheckout` are automatically - * `COMPLETED` or left in an `APPROVED` state for later modification. - */ - autocomplete?: boolean | null; - /** - * The duration of time after the payment's creation when Square automatically cancels the - * payment. This automatic cancellation applies only to payments that do not reach a terminal state - * (COMPLETED or CANCELED) before the `delay_duration` time period. - * This parameter should be specified as a time duration, in RFC 3339 format, with a minimum value - * of 1 minute. - * Note: This feature is only supported for card payments. This parameter can only be set for a delayed - * capture payment (`autocomplete=false`). - * Default: - * - Card-present payments: "PT36H" (36 hours) from the creation time. - * - Card-not-present payments: "P7D" (7 days) from the creation time. - */ - delayDuration?: string | null; - /** - * If set to `true` and charging a Square Gift Card, a payment might be returned with - * `amount_money` equal to less than what was requested. For example, a request for $20 when charging - * a Square Gift Card with a balance of $5 results in an APPROVED payment of $5. You might choose - * to prompt the buyer for an additional payment to cover the remainder or cancel the Gift Card - * payment. - * This field cannot be `true` when `autocomplete = true`. - * This field cannot be `true` when an `order_id` isn't specified. - * For more information, see - * [Take Partial Payments](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/partial-payments-with-gift-cards). - * Default: false - */ - acceptPartialAuthorization?: boolean | null; - /** - * Describes the action to be applied to a delayed capture payment when the delay_duration - * has elapsed. - */ - delayAction?: string; -} - -export const paymentOptionsSchema: Schema = object({ - autocomplete: ['autocomplete', optional(nullable(boolean()))], - delayDuration: ['delay_duration', optional(nullable(string()))], - acceptPartialAuthorization: [ - 'accept_partial_authorization', - optional(nullable(boolean())), - ], - delayAction: ['delay_action', optional(string())], -}); diff --git a/src/models/paymentRefund.ts b/src/models/paymentRefund.ts deleted file mode 100644 index d7dce378a..000000000 --- a/src/models/paymentRefund.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - DestinationDetails, - destinationDetailsSchema, -} from './destinationDetails'; -import { Money, moneySchema } from './money'; -import { ProcessingFee, processingFeeSchema } from './processingFee'; - -/** - * Represents a refund of a payment made using Square. Contains information about - * the original payment and the amount of money refunded. - */ -export interface PaymentRefund { - /** The unique ID for this refund, generated by Square. */ - id: string; - /** - * The refund's status: - * - `PENDING` - Awaiting approval. - * - `COMPLETED` - Successfully completed. - * - `REJECTED` - The refund was rejected. - * - `FAILED` - An error occurred. - */ - status?: string | null; - /** The location ID associated with the payment this refund is attached to. */ - locationId?: string | null; - /** Flag indicating whether or not the refund is linked to an existing payment in Square. */ - unlinked?: boolean; - /** - * The destination type for this refund. - * Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`, - * `EXTERNAL`, and `SQUARE_ACCOUNT`. - */ - destinationType?: string | null; - /** Details about a refund's destination. */ - destinationDetails?: DestinationDetails; - /** - * 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. - */ - amountMoney: Money; - /** - * 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. - */ - appFeeMoney?: Money; - /** Processing fees and fee adjustments assessed by Square for this refund. */ - processingFee?: ProcessingFee[] | null; - /** The ID of the payment associated with this refund. */ - paymentId?: string | null; - /** The ID of the order associated with the refund. */ - orderId?: string | null; - /** The reason for the refund. */ - reason?: string | null; - /** The timestamp of when the refund was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp of when the refund was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** An optional ID of the team member associated with taking the payment. */ - teamMemberId?: string; - /** An optional ID for a Terminal refund. */ - terminalRefundId?: string; -} - -export const paymentRefundSchema: Schema = object({ - id: ['id', string()], - status: ['status', optional(nullable(string()))], - locationId: ['location_id', optional(nullable(string()))], - unlinked: ['unlinked', optional(boolean())], - destinationType: ['destination_type', optional(nullable(string()))], - destinationDetails: [ - 'destination_details', - optional(lazy(() => destinationDetailsSchema)), - ], - amountMoney: ['amount_money', lazy(() => moneySchema)], - appFeeMoney: ['app_fee_money', optional(lazy(() => moneySchema))], - processingFee: [ - 'processing_fee', - optional(nullable(array(lazy(() => processingFeeSchema)))), - ], - paymentId: ['payment_id', optional(nullable(string()))], - orderId: ['order_id', optional(nullable(string()))], - reason: ['reason', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - teamMemberId: ['team_member_id', optional(string())], - terminalRefundId: ['terminal_refund_id', optional(string())], -}); diff --git a/src/models/payout.ts b/src/models/payout.ts deleted file mode 100644 index 00a3a049e..000000000 --- a/src/models/payout.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Destination, destinationSchema } from './destination'; -import { Money, moneySchema } from './money'; -import { PayoutFee, payoutFeeSchema } from './payoutFee'; - -/** - * An accounting of the amount owed the seller and record of the actual transfer to their - * external bank account or to the Square balance. - */ -export interface Payout { - /** A unique ID for the payout. */ - id: string; - /** Payout status types */ - status?: string; - /** The ID of the location associated with the payout. */ - locationId: string; - /** The timestamp of when the payout was created and submitted for deposit to the seller's banking destination, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp of when the payout was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** - * 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. - */ - amountMoney?: Money; - /** Information about the destination against which the payout was made. */ - destination?: Destination; - /** - * The version number, which is incremented each time an update is made to this payout record. - * The version number helps developers receive event notifications or feeds out of order. - */ - version?: number; - /** - * 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. - */ - type?: string; - /** A list of transfer fees and any taxes on the fees assessed by Square for this 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({ - id: ['id', string()], - status: ['status', optional(string())], - locationId: ['location_id', string()], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - destination: ['destination', optional(lazy(() => destinationSchema))], - version: ['version', optional(number())], - type: ['type', optional(string())], - payoutFee: [ - 'payout_fee', - optional(nullable(array(lazy(() => payoutFeeSchema)))), - ], - arrivalDate: ['arrival_date', optional(nullable(string()))], - endToEndId: ['end_to_end_id', optional(nullable(string()))], -}); diff --git a/src/models/payoutEntry.ts b/src/models/payoutEntry.ts deleted file mode 100644 index 29d31b2e1..000000000 --- a/src/models/payoutEntry.ts +++ /dev/null @@ -1,290 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; -import { - PaymentBalanceActivityAppFeeRefundDetail, - paymentBalanceActivityAppFeeRefundDetailSchema, -} from './paymentBalanceActivityAppFeeRefundDetail'; -import { - PaymentBalanceActivityAppFeeRevenueDetail, - paymentBalanceActivityAppFeeRevenueDetailSchema, -} from './paymentBalanceActivityAppFeeRevenueDetail'; -import { - PaymentBalanceActivityAutomaticSavingsDetail, - paymentBalanceActivityAutomaticSavingsDetailSchema, -} from './paymentBalanceActivityAutomaticSavingsDetail'; -import { - PaymentBalanceActivityAutomaticSavingsReversedDetail, - paymentBalanceActivityAutomaticSavingsReversedDetailSchema, -} from './paymentBalanceActivityAutomaticSavingsReversedDetail'; -import { - PaymentBalanceActivityChargeDetail, - paymentBalanceActivityChargeDetailSchema, -} from './paymentBalanceActivityChargeDetail'; -import { - PaymentBalanceActivityDepositFeeDetail, - paymentBalanceActivityDepositFeeDetailSchema, -} from './paymentBalanceActivityDepositFeeDetail'; -import { - PaymentBalanceActivityDepositFeeReversedDetail, - paymentBalanceActivityDepositFeeReversedDetailSchema, -} from './paymentBalanceActivityDepositFeeReversedDetail'; -import { - PaymentBalanceActivityDisputeDetail, - paymentBalanceActivityDisputeDetailSchema, -} from './paymentBalanceActivityDisputeDetail'; -import { - PaymentBalanceActivityFeeDetail, - paymentBalanceActivityFeeDetailSchema, -} from './paymentBalanceActivityFeeDetail'; -import { - PaymentBalanceActivityFreeProcessingDetail, - paymentBalanceActivityFreeProcessingDetailSchema, -} from './paymentBalanceActivityFreeProcessingDetail'; -import { - PaymentBalanceActivityHoldAdjustmentDetail, - paymentBalanceActivityHoldAdjustmentDetailSchema, -} from './paymentBalanceActivityHoldAdjustmentDetail'; -import { - PaymentBalanceActivityOpenDisputeDetail, - paymentBalanceActivityOpenDisputeDetailSchema, -} from './paymentBalanceActivityOpenDisputeDetail'; -import { - PaymentBalanceActivityOtherAdjustmentDetail, - paymentBalanceActivityOtherAdjustmentDetailSchema, -} from './paymentBalanceActivityOtherAdjustmentDetail'; -import { - PaymentBalanceActivityOtherDetail, - paymentBalanceActivityOtherDetailSchema, -} from './paymentBalanceActivityOtherDetail'; -import { - PaymentBalanceActivityRefundDetail, - paymentBalanceActivityRefundDetailSchema, -} from './paymentBalanceActivityRefundDetail'; -import { - PaymentBalanceActivityReleaseAdjustmentDetail, - paymentBalanceActivityReleaseAdjustmentDetailSchema, -} from './paymentBalanceActivityReleaseAdjustmentDetail'; -import { - PaymentBalanceActivityReserveHoldDetail, - paymentBalanceActivityReserveHoldDetailSchema, -} from './paymentBalanceActivityReserveHoldDetail'; -import { - PaymentBalanceActivityReserveReleaseDetail, - paymentBalanceActivityReserveReleaseDetailSchema, -} from './paymentBalanceActivityReserveReleaseDetail'; -import { - PaymentBalanceActivitySquareCapitalPaymentDetail, - paymentBalanceActivitySquareCapitalPaymentDetailSchema, -} from './paymentBalanceActivitySquareCapitalPaymentDetail'; -import { - PaymentBalanceActivitySquareCapitalReversedPaymentDetail, - paymentBalanceActivitySquareCapitalReversedPaymentDetailSchema, -} from './paymentBalanceActivitySquareCapitalReversedPaymentDetail'; -import { - PaymentBalanceActivitySquarePayrollTransferDetail, - paymentBalanceActivitySquarePayrollTransferDetailSchema, -} from './paymentBalanceActivitySquarePayrollTransferDetail'; -import { - PaymentBalanceActivitySquarePayrollTransferReversedDetail, - paymentBalanceActivitySquarePayrollTransferReversedDetailSchema, -} from './paymentBalanceActivitySquarePayrollTransferReversedDetail'; -import { - PaymentBalanceActivityTaxOnFeeDetail, - paymentBalanceActivityTaxOnFeeDetailSchema, -} from './paymentBalanceActivityTaxOnFeeDetail'; -import { - PaymentBalanceActivityThirdPartyFeeDetail, - paymentBalanceActivityThirdPartyFeeDetailSchema, -} from './paymentBalanceActivityThirdPartyFeeDetail'; -import { - PaymentBalanceActivityThirdPartyFeeRefundDetail, - paymentBalanceActivityThirdPartyFeeRefundDetailSchema, -} from './paymentBalanceActivityThirdPartyFeeRefundDetail'; - -/** - * One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity. - * The total amount of the payout will equal the sum of the payout entries for a batch payout - */ -export interface PayoutEntry { - /** A unique ID for the payout entry. */ - id: string; - /** The ID of the payout entries’ associated payout. */ - payoutId: string; - /** The timestamp of when the payout entry affected the balance, in RFC 3339 format. */ - effectiveAt?: string | null; - type?: string; - /** - * 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. - */ - grossAmountMoney?: Money; - /** - * 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. - */ - feeAmountMoney?: Money; - /** - * 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. - */ - netAmountMoney?: Money; - typeAppFeeRevenueDetails?: PaymentBalanceActivityAppFeeRevenueDetail; - typeAppFeeRefundDetails?: PaymentBalanceActivityAppFeeRefundDetail; - typeAutomaticSavingsDetails?: PaymentBalanceActivityAutomaticSavingsDetail; - typeAutomaticSavingsReversedDetails?: PaymentBalanceActivityAutomaticSavingsReversedDetail; - typeChargeDetails?: PaymentBalanceActivityChargeDetail; - typeDepositFeeDetails?: PaymentBalanceActivityDepositFeeDetail; - typeDepositFeeReversedDetails?: PaymentBalanceActivityDepositFeeReversedDetail; - typeDisputeDetails?: PaymentBalanceActivityDisputeDetail; - typeFeeDetails?: PaymentBalanceActivityFeeDetail; - typeFreeProcessingDetails?: PaymentBalanceActivityFreeProcessingDetail; - typeHoldAdjustmentDetails?: PaymentBalanceActivityHoldAdjustmentDetail; - typeOpenDisputeDetails?: PaymentBalanceActivityOpenDisputeDetail; - typeOtherDetails?: PaymentBalanceActivityOtherDetail; - typeOtherAdjustmentDetails?: PaymentBalanceActivityOtherAdjustmentDetail; - typeRefundDetails?: PaymentBalanceActivityRefundDetail; - typeReleaseAdjustmentDetails?: PaymentBalanceActivityReleaseAdjustmentDetail; - typeReserveHoldDetails?: PaymentBalanceActivityReserveHoldDetail; - typeReserveReleaseDetails?: PaymentBalanceActivityReserveReleaseDetail; - typeSquareCapitalPaymentDetails?: PaymentBalanceActivitySquareCapitalPaymentDetail; - typeSquareCapitalReversedPaymentDetails?: PaymentBalanceActivitySquareCapitalReversedPaymentDetail; - typeTaxOnFeeDetails?: PaymentBalanceActivityTaxOnFeeDetail; - typeThirdPartyFeeDetails?: PaymentBalanceActivityThirdPartyFeeDetail; - typeThirdPartyFeeRefundDetails?: PaymentBalanceActivityThirdPartyFeeRefundDetail; - typeSquarePayrollTransferDetails?: PaymentBalanceActivitySquarePayrollTransferDetail; - typeSquarePayrollTransferReversedDetails?: PaymentBalanceActivitySquarePayrollTransferReversedDetail; -} - -export const payoutEntrySchema: Schema = object({ - id: ['id', string()], - payoutId: ['payout_id', string()], - effectiveAt: ['effective_at', optional(nullable(string()))], - type: ['type', optional(string())], - grossAmountMoney: ['gross_amount_money', optional(lazy(() => moneySchema))], - feeAmountMoney: ['fee_amount_money', optional(lazy(() => moneySchema))], - netAmountMoney: ['net_amount_money', optional(lazy(() => moneySchema))], - typeAppFeeRevenueDetails: [ - 'type_app_fee_revenue_details', - optional(lazy(() => paymentBalanceActivityAppFeeRevenueDetailSchema)), - ], - typeAppFeeRefundDetails: [ - 'type_app_fee_refund_details', - optional(lazy(() => paymentBalanceActivityAppFeeRefundDetailSchema)), - ], - typeAutomaticSavingsDetails: [ - 'type_automatic_savings_details', - optional(lazy(() => paymentBalanceActivityAutomaticSavingsDetailSchema)), - ], - typeAutomaticSavingsReversedDetails: [ - 'type_automatic_savings_reversed_details', - optional( - lazy(() => paymentBalanceActivityAutomaticSavingsReversedDetailSchema) - ), - ], - typeChargeDetails: [ - 'type_charge_details', - optional(lazy(() => paymentBalanceActivityChargeDetailSchema)), - ], - typeDepositFeeDetails: [ - 'type_deposit_fee_details', - optional(lazy(() => paymentBalanceActivityDepositFeeDetailSchema)), - ], - typeDepositFeeReversedDetails: [ - 'type_deposit_fee_reversed_details', - optional(lazy(() => paymentBalanceActivityDepositFeeReversedDetailSchema)), - ], - typeDisputeDetails: [ - 'type_dispute_details', - optional(lazy(() => paymentBalanceActivityDisputeDetailSchema)), - ], - typeFeeDetails: [ - 'type_fee_details', - optional(lazy(() => paymentBalanceActivityFeeDetailSchema)), - ], - typeFreeProcessingDetails: [ - 'type_free_processing_details', - optional(lazy(() => paymentBalanceActivityFreeProcessingDetailSchema)), - ], - typeHoldAdjustmentDetails: [ - 'type_hold_adjustment_details', - optional(lazy(() => paymentBalanceActivityHoldAdjustmentDetailSchema)), - ], - typeOpenDisputeDetails: [ - 'type_open_dispute_details', - optional(lazy(() => paymentBalanceActivityOpenDisputeDetailSchema)), - ], - typeOtherDetails: [ - 'type_other_details', - optional(lazy(() => paymentBalanceActivityOtherDetailSchema)), - ], - typeOtherAdjustmentDetails: [ - 'type_other_adjustment_details', - optional(lazy(() => paymentBalanceActivityOtherAdjustmentDetailSchema)), - ], - typeRefundDetails: [ - 'type_refund_details', - optional(lazy(() => paymentBalanceActivityRefundDetailSchema)), - ], - typeReleaseAdjustmentDetails: [ - 'type_release_adjustment_details', - optional(lazy(() => paymentBalanceActivityReleaseAdjustmentDetailSchema)), - ], - typeReserveHoldDetails: [ - 'type_reserve_hold_details', - optional(lazy(() => paymentBalanceActivityReserveHoldDetailSchema)), - ], - typeReserveReleaseDetails: [ - 'type_reserve_release_details', - optional(lazy(() => paymentBalanceActivityReserveReleaseDetailSchema)), - ], - typeSquareCapitalPaymentDetails: [ - 'type_square_capital_payment_details', - optional( - lazy(() => paymentBalanceActivitySquareCapitalPaymentDetailSchema) - ), - ], - typeSquareCapitalReversedPaymentDetails: [ - 'type_square_capital_reversed_payment_details', - optional( - lazy(() => paymentBalanceActivitySquareCapitalReversedPaymentDetailSchema) - ), - ], - typeTaxOnFeeDetails: [ - 'type_tax_on_fee_details', - optional(lazy(() => paymentBalanceActivityTaxOnFeeDetailSchema)), - ], - typeThirdPartyFeeDetails: [ - 'type_third_party_fee_details', - optional(lazy(() => paymentBalanceActivityThirdPartyFeeDetailSchema)), - ], - typeThirdPartyFeeRefundDetails: [ - 'type_third_party_fee_refund_details', - optional(lazy(() => paymentBalanceActivityThirdPartyFeeRefundDetailSchema)), - ], - typeSquarePayrollTransferDetails: [ - 'type_square_payroll_transfer_details', - optional( - lazy(() => paymentBalanceActivitySquarePayrollTransferDetailSchema) - ), - ], - typeSquarePayrollTransferReversedDetails: [ - 'type_square_payroll_transfer_reversed_details', - optional( - lazy( - () => paymentBalanceActivitySquarePayrollTransferReversedDetailSchema - ) - ), - ], -}); diff --git a/src/models/payoutFee.ts b/src/models/payoutFee.ts deleted file mode 100644 index 083510a97..000000000 --- a/src/models/payoutFee.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents a payout fee that can incur as part of a payout. */ -export interface PayoutFee { - /** - * 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. - */ - amountMoney?: Money; - /** The timestamp of when the fee takes effect, in RFC 3339 format. */ - effectiveAt?: string | null; - /** Represents the type of payout fee that can incur as part of a payout. */ - type?: string; -} - -export const payoutFeeSchema: Schema = object({ - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - effectiveAt: ['effective_at', optional(nullable(string()))], - type: ['type', optional(string())], -}); diff --git a/src/models/phase.ts b/src/models/phase.ts deleted file mode 100644 index 26914f977..000000000 --- a/src/models/phase.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { bigint, nullable, 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?: bigint | 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(bigint()))], - 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 deleted file mode 100644 index f841a738f..000000000 --- a/src/models/phaseInput.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { bigint, nullable, 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: bigint; - /** id of order to be used in billing */ - orderTemplateId?: string | null; -} - -export const phaseInputSchema: Schema = object({ - ordinal: ['ordinal', bigint()], - orderTemplateId: ['order_template_id', optional(nullable(string()))], -}); diff --git a/src/models/prePopulatedData.ts b/src/models/prePopulatedData.ts deleted file mode 100644 index 5247549f9..000000000 --- a/src/models/prePopulatedData.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Address, addressSchema } from './address'; - -/** - * Describes buyer data to prepopulate in the payment form. - * For more information, - * see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). - */ -export interface PrePopulatedData { - /** The buyer email to prepopulate in the payment form. */ - buyerEmail?: string | null; - /** The buyer phone number to prepopulate in the payment form. */ - buyerPhoneNumber?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - buyerAddress?: Address; -} - -export const prePopulatedDataSchema: Schema = object({ - buyerEmail: ['buyer_email', optional(nullable(string()))], - buyerPhoneNumber: ['buyer_phone_number', optional(nullable(string()))], - buyerAddress: ['buyer_address', optional(lazy(() => addressSchema))], -}); diff --git a/src/models/processingFee.ts b/src/models/processingFee.ts deleted file mode 100644 index c134e2892..000000000 --- a/src/models/processingFee.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents the Square processing fee. */ -export interface ProcessingFee { - /** The timestamp of when the fee takes effect, in RFC 3339 format. */ - effectiveAt?: string | null; - /** The type of fee assessed or adjusted. The fee type can be `INITIAL` or `ADJUSTMENT`. */ - type?: 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. - */ - amountMoney?: Money; -} - -export const processingFeeSchema: Schema = object({ - effectiveAt: ['effective_at', optional(nullable(string()))], - type: ['type', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], -}); diff --git a/src/models/publishInvoiceRequest.ts b/src/models/publishInvoiceRequest.ts deleted file mode 100644 index 96dde18f0..000000000 --- a/src/models/publishInvoiceRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** Describes a `PublishInvoice` request. */ -export interface PublishInvoiceRequest { - /** - * The version of the [invoice](entity:Invoice) to publish. - * This must match the current version of the invoice; otherwise, the request is rejected. - */ - version: number; - /** - * A unique string that identifies the `PublishInvoice` request. If you do not - * provide `idempotency_key` (or provide an empty string as the value), the endpoint - * treats each request as independent. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const publishInvoiceRequestSchema: Schema = object( - { - version: ['version', number()], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/publishInvoiceResponse.ts b/src/models/publishInvoiceResponse.ts deleted file mode 100644 index 07d2514f4..000000000 --- a/src/models/publishInvoiceResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Invoice, invoiceSchema } from './invoice'; - -/** Describes a `PublishInvoice` response. */ -export interface PublishInvoiceResponse { - /** - * Stores information about an invoice. You use the Invoices API to create and manage - * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - */ - invoice?: Invoice; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const publishInvoiceResponseSchema: Schema = object( - { - invoice: ['invoice', optional(lazy(() => invoiceSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/qrCodeOptions.ts b/src/models/qrCodeOptions.ts deleted file mode 100644 index 47d6b2e48..000000000 --- a/src/models/qrCodeOptions.ts +++ /dev/null @@ -1,20 +0,0 @@ -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/quantityRatio.ts b/src/models/quantityRatio.ts deleted file mode 100644 index 28021f771..000000000 --- a/src/models/quantityRatio.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { nullable, number, object, optional, Schema } from '../schema'; - -/** A whole number or unreduced fractional ratio. */ -export interface QuantityRatio { - /** The whole or fractional quantity as the numerator. */ - quantity?: number | null; - /** - * The whole or fractional quantity as the denominator. - * With fractional quantity this field is the denominator and quantity is the numerator. - * The default value is `1`. For example, when `quantity=3` and `quantity_denominator` is unspecified, - * the quantity ratio is `3` or `3/1`. - */ - quantityDenominator?: number | null; -} - -export const quantityRatioSchema: Schema = object({ - quantity: ['quantity', optional(nullable(number()))], - quantityDenominator: ['quantity_denominator', optional(nullable(number()))], -}); diff --git a/src/models/quickPay.ts b/src/models/quickPay.ts deleted file mode 100644 index bd058cdf4..000000000 --- a/src/models/quickPay.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * Describes an ad hoc item and price to generate a quick pay checkout link. - * For more information, - * see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). - */ -export interface QuickPay { - /** The ad hoc item name. In the resulting `Order`, this name appears as the line item name. */ - name: string; - /** - * 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; - /** The ID of the business location the checkout is associated with. */ - locationId: string; -} - -export const quickPaySchema: Schema = object({ - name: ['name', string()], - priceMoney: ['price_money', lazy(() => moneySchema)], - locationId: ['location_id', string()], -}); diff --git a/src/models/range.ts b/src/models/range.ts deleted file mode 100644 index 42a73ca3c..000000000 --- a/src/models/range.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** The range of a number value between the specified lower and upper bounds. */ -export interface Range { - /** - * The lower bound of the number range. At least one of `min` or `max` must be specified. - * If unspecified, the results will have no minimum value. - */ - min?: string | null; - /** - * The upper bound of the number range. At least one of `min` or `max` must be specified. - * If unspecified, the results will have no maximum value. - */ - max?: string | null; -} - -export const rangeSchema: Schema = object({ - min: ['min', optional(nullable(string()))], - max: ['max', optional(nullable(string()))], -}); diff --git a/src/models/receiptOptions.ts b/src/models/receiptOptions.ts deleted file mode 100644 index 421f2b2f8..000000000 --- a/src/models/receiptOptions.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** Describes receipt action fields. */ -export interface ReceiptOptions { - /** The reference to the Square payment ID for the receipt. */ - paymentId: string; - /** - * Instructs the device to print the receipt without displaying the receipt selection screen. - * Requires `printer_enabled` set to true. - * Defaults to false. - */ - printOnly?: boolean | null; - /** - * Identify the receipt as a reprint rather than an original receipt. - * Defaults to false. - */ - isDuplicate?: boolean | null; -} - -export const receiptOptionsSchema: Schema = object({ - paymentId: ['payment_id', string()], - printOnly: ['print_only', optional(nullable(boolean()))], - isDuplicate: ['is_duplicate', optional(nullable(boolean()))], -}); diff --git a/src/models/redeemLoyaltyRewardRequest.ts b/src/models/redeemLoyaltyRewardRequest.ts deleted file mode 100644 index a79416ecb..000000000 --- a/src/models/redeemLoyaltyRewardRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** A request to redeem a loyalty reward. */ -export interface RedeemLoyaltyRewardRequest { - /** - * A unique string that identifies this `RedeemLoyaltyReward` request. - * Keys can be any valid string, but must be unique for every request. - */ - idempotencyKey: string; - /** The ID of the [location](entity:Location) where the reward is redeemed. */ - locationId: string; -} - -export const redeemLoyaltyRewardRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - locationId: ['location_id', string()], - } -); diff --git a/src/models/redeemLoyaltyRewardResponse.ts b/src/models/redeemLoyaltyRewardResponse.ts deleted file mode 100644 index dcb9025b3..000000000 --- a/src/models/redeemLoyaltyRewardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyEvent, loyaltyEventSchema } from './loyaltyEvent'; - -/** A response that includes the `LoyaltyEvent` published for redeeming the reward. */ -export interface RedeemLoyaltyRewardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Provides information about a loyalty event. - * For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). - */ - event?: LoyaltyEvent; -} - -export const redeemLoyaltyRewardResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - event: ['event', optional(lazy(() => loyaltyEventSchema))], - } -); diff --git a/src/models/refund.ts b/src/models/refund.ts deleted file mode 100644 index 8dd2bd1ee..000000000 --- a/src/models/refund.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - AdditionalRecipient, - additionalRecipientSchema, -} from './additionalRecipient'; -import { Money, moneySchema } from './money'; - -/** Represents a refund processed for a Square transaction. */ -export interface Refund { - /** The refund's unique ID. */ - id: string; - /** The ID of the refund's associated location. */ - locationId: string; - /** The ID of the transaction that the refunded tender is part of. */ - transactionId?: string | null; - /** The ID of the refunded tender. */ - tenderId?: string; - /** The timestamp for when the refund was created, in RFC 3339 format. */ - createdAt?: string; - /** The reason for the refund being issued. */ - reason: string; - /** - * 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. - */ - amountMoney: Money; - /** Indicates a refund's current status. */ - status: string; - /** - * 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. - */ - processingFeeMoney?: Money; - /** - * Additional recipients (other than the merchant) receiving a portion of this refund. - * For example, fees assessed on a refund of a purchase by a third party integration. - */ - additionalRecipients?: AdditionalRecipient[] | null; -} - -export const refundSchema: Schema = object({ - id: ['id', string()], - locationId: ['location_id', string()], - transactionId: ['transaction_id', optional(nullable(string()))], - tenderId: ['tender_id', optional(string())], - createdAt: ['created_at', optional(string())], - reason: ['reason', string()], - amountMoney: ['amount_money', lazy(() => moneySchema)], - status: ['status', string()], - processingFeeMoney: [ - 'processing_fee_money', - optional(lazy(() => moneySchema)), - ], - additionalRecipients: [ - 'additional_recipients', - optional(nullable(array(lazy(() => additionalRecipientSchema)))), - ], -}); diff --git a/src/models/refundPaymentRequest.ts b/src/models/refundPaymentRequest.ts deleted file mode 100644 index 9dc4b731a..000000000 --- a/src/models/refundPaymentRequest.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - DestinationDetailsCashRefundDetails, - destinationDetailsCashRefundDetailsSchema, -} from './destinationDetailsCashRefundDetails'; -import { - DestinationDetailsExternalRefundDetails, - destinationDetailsExternalRefundDetailsSchema, -} from './destinationDetailsExternalRefundDetails'; -import { Money, moneySchema } from './money'; - -/** Describes a request to refund a payment using [RefundPayment]($e/Refunds/RefundPayment). */ -export interface RefundPaymentRequest { - /** - * A unique string that identifies this `RefundPayment` request. The key can be any valid string - * but must be unique for every `RefundPayment` request. - * Keys are limited to a max of 45 characters - however, the number of allowed characters might be - * less than 45, if multi-byte characters are used. - * For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). - */ - idempotencyKey: string; - /** - * 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. - */ - amountMoney: Money; - /** - * 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. - */ - appFeeMoney?: Money; - /** - * The unique ID of the payment being refunded. - * Required when unlinked=false, otherwise must not be set. - */ - paymentId?: string | null; - /** - * The ID indicating where funds will be refunded to. Required for unlinked refunds. For more - * information, see [Process an Unlinked Refund](https://developer.squareup.com/docs/refunds-api/unlinked-refunds). - * For refunds linked to Square payments, `destination_id` is usually omitted; in this case, funds - * will be returned to the original payment source. The field may be specified in order to request - * a cross-method refund to a gift card. For more information, - * see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards). - */ - destinationId?: string | null; - /** - * Indicates that the refund is not linked to a Square payment. - * If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not - * be provided. - */ - unlinked?: boolean | null; - /** - * The location ID associated with the unlinked refund. - * Required for requests specifying `unlinked=true`. - * Otherwise, if included when `unlinked=false`, will throw an error. - */ - locationId?: string | null; - /** - * The [Customer](entity:Customer) ID of the customer associated with the refund. - * This is required if the `destination_id` refers to a card on file created using the Cards - * API. Only allowed when `unlinked=true`. - */ - customerId?: string | null; - /** A description of the reason for the refund. */ - reason?: string | null; - /** - * Used for optimistic concurrency. This opaque token identifies the current `Payment` - * version that the caller expects. If the server has a different version of the Payment, - * the update fails and a response with a VERSION_MISMATCH error is returned. - * If the versions match, or the field is not provided, the refund proceeds as normal. - */ - paymentVersionToken?: string | null; - /** An optional [TeamMember](entity:TeamMember) ID to associate with this refund. */ - teamMemberId?: string | null; - /** Stores details about a cash refund. Contains only non-confidential information. */ - cashDetails?: DestinationDetailsCashRefundDetails; - /** Stores details about an external refund. Contains only non-confidential information. */ - externalDetails?: DestinationDetailsExternalRefundDetails; -} - -export const refundPaymentRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', string()], - amountMoney: ['amount_money', lazy(() => moneySchema)], - appFeeMoney: ['app_fee_money', optional(lazy(() => moneySchema))], - paymentId: ['payment_id', optional(nullable(string()))], - destinationId: ['destination_id', optional(nullable(string()))], - unlinked: ['unlinked', optional(nullable(boolean()))], - locationId: ['location_id', optional(nullable(string()))], - customerId: ['customer_id', optional(nullable(string()))], - reason: ['reason', optional(nullable(string()))], - paymentVersionToken: ['payment_version_token', optional(nullable(string()))], - teamMemberId: ['team_member_id', optional(nullable(string()))], - cashDetails: [ - 'cash_details', - optional(lazy(() => destinationDetailsCashRefundDetailsSchema)), - ], - externalDetails: [ - 'external_details', - optional(lazy(() => destinationDetailsExternalRefundDetailsSchema)), - ], -}); diff --git a/src/models/refundPaymentResponse.ts b/src/models/refundPaymentResponse.ts deleted file mode 100644 index 18ba010d4..000000000 --- a/src/models/refundPaymentResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { PaymentRefund, paymentRefundSchema } from './paymentRefund'; - -/** - * Defines the response returned by - * [RefundPayment]($e/Refunds/RefundPayment). - * If there are errors processing the request, the `refund` field might not be - * present, or it might be present with a status of `FAILED`. - */ -export interface RefundPaymentResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** - * Represents a refund of a payment made using Square. Contains information about - * the original payment and the amount of money refunded. - */ - refund?: PaymentRefund; -} - -export const refundPaymentResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refund: ['refund', optional(lazy(() => paymentRefundSchema))], - } -); diff --git a/src/models/registerDomainRequest.ts b/src/models/registerDomainRequest.ts deleted file mode 100644 index 8fcf62f7a..000000000 --- a/src/models/registerDomainRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** - * Defines the parameters that can be included in the body of - * a request to the [RegisterDomain]($e/ApplePay/RegisterDomain) endpoint. - */ -export interface RegisterDomainRequest { - /** A domain name as described in RFC-1034 that will be registered with ApplePay. */ - domainName: string; -} - -export const registerDomainRequestSchema: Schema = object( - { domainName: ['domain_name', string()] } -); diff --git a/src/models/registerDomainResponse.ts b/src/models/registerDomainResponse.ts deleted file mode 100644 index 9070177a3..000000000 --- a/src/models/registerDomainResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [RegisterDomain]($e/ApplePay/RegisterDomain) endpoint. - * Either `errors` or `status` are present in a given response (never both). - */ -export interface RegisterDomainResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The status of the domain registration. */ - status?: string; -} - -export const registerDomainResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - status: ['status', optional(string())], - } -); diff --git a/src/models/removeGroupFromCustomerResponse.ts b/src/models/removeGroupFromCustomerResponse.ts deleted file mode 100644 index ca5673149..000000000 --- a/src/models/removeGroupFromCustomerResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [RemoveGroupFromCustomer]($e/Customers/RemoveGroupFromCustomer) - * endpoint. - */ -export interface RemoveGroupFromCustomerResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const removeGroupFromCustomerResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/resumeSubscriptionRequest.ts b/src/models/resumeSubscriptionRequest.ts deleted file mode 100644 index 4d11c70bc..000000000 --- a/src/models/resumeSubscriptionRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Defines input parameters in a request to the - * [ResumeSubscription]($e/Subscriptions/ResumeSubscription) endpoint. - */ -export interface ResumeSubscriptionRequest { - /** The `YYYY-MM-DD`-formatted date when the subscription reactivated. */ - resumeEffectiveDate?: string | null; - /** Supported timings when a pending change, as an action, takes place to a subscription. */ - resumeChangeTiming?: string; -} - -export const resumeSubscriptionRequestSchema: Schema = object( - { - resumeEffectiveDate: [ - 'resume_effective_date', - optional(nullable(string())), - ], - resumeChangeTiming: ['resume_change_timing', optional(string())], - } -); diff --git a/src/models/resumeSubscriptionResponse.ts b/src/models/resumeSubscriptionResponse.ts deleted file mode 100644 index 37cc64c57..000000000 --- a/src/models/resumeSubscriptionResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; -import { - SubscriptionAction, - subscriptionActionSchema, -} from './subscriptionAction'; - -/** - * Defines output parameters in a response from the - * [ResumeSubscription]($e/Subscriptions/ResumeSubscription) endpoint. - */ -export interface ResumeSubscriptionResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * 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. */ - actions?: SubscriptionAction[]; -} - -export const resumeSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - actions: ['actions', optional(array(lazy(() => subscriptionActionSchema)))], - } -); diff --git a/src/models/retrieveBookingCustomAttributeDefinitionRequest.ts b/src/models/retrieveBookingCustomAttributeDefinitionRequest.ts deleted file mode 100644 index 9ee4fe72c..000000000 --- a/src/models/retrieveBookingCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { number, object, optional, Schema } from '../schema'; - -/** Represents a [RetrieveBookingCustomAttributeDefinition]($e/BookingCustomAttributes/RetrieveBookingCustomAttributeDefinition) request. */ -export interface RetrieveBookingCustomAttributeDefinitionRequest { - /** - * The current version of the custom attribute definition, which is used for strongly consistent - * reads to guarantee that you receive the most up-to-date data. When included in the request, - * Square returns the specified version or a higher version if one exists. If the specified version - * is higher than the current version, Square returns a `BAD_REQUEST` error. - */ - version?: number; -} - -export const retrieveBookingCustomAttributeDefinitionRequestSchema: Schema = object( - { version: ['version', optional(number())] } -); diff --git a/src/models/retrieveBookingCustomAttributeDefinitionResponse.ts b/src/models/retrieveBookingCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 1a185e72f..000000000 --- a/src/models/retrieveBookingCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [RetrieveBookingCustomAttributeDefinition]($e/BookingCustomAttributes/RetrieveBookingCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface RetrieveBookingCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveBookingCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveBookingCustomAttributeRequest.ts b/src/models/retrieveBookingCustomAttributeRequest.ts deleted file mode 100644 index 3d33038e6..000000000 --- a/src/models/retrieveBookingCustomAttributeRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { boolean, nullable, number, object, optional, Schema } from '../schema'; - -/** Represents a [RetrieveBookingCustomAttribute]($e/BookingCustomAttributes/RetrieveBookingCustomAttribute) request. */ -export interface RetrieveBookingCustomAttributeRequest { - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of - * the custom attribute. Set this parameter to `true` to get the name and description of the custom - * attribute, information about the data type, or other definition details. The default value is `false`. - */ - withDefinition?: boolean | null; - /** - * The current version of the custom attribute, which is used for strongly consistent reads to - * guarantee that you receive the most up-to-date data. When included in the request, Square - * returns the specified version or a higher version if one exists. If the specified version is - * higher than the current version, Square returns a `BAD_REQUEST` error. - */ - version?: number; -} - -export const retrieveBookingCustomAttributeRequestSchema: Schema = object( - { - withDefinition: ['with_definition', optional(nullable(boolean()))], - version: ['version', optional(number())], - } -); diff --git a/src/models/retrieveBookingCustomAttributeResponse.ts b/src/models/retrieveBookingCustomAttributeResponse.ts deleted file mode 100644 index 9b25718aa..000000000 --- a/src/models/retrieveBookingCustomAttributeResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [RetrieveBookingCustomAttribute]($e/BookingCustomAttributes/RetrieveBookingCustomAttribute) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface RetrieveBookingCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveBookingCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveBookingResponse.ts b/src/models/retrieveBookingResponse.ts deleted file mode 100644 index 63b1503c9..000000000 --- a/src/models/retrieveBookingResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Booking, bookingSchema } from './booking'; -import { Error, errorSchema } from './error'; - -export interface RetrieveBookingResponse { - /** - * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service - * at a given location to a requesting customer in one or more appointment segments. - */ - booking?: Booking; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveBookingResponseSchema: Schema = object( - { - booking: ['booking', optional(lazy(() => bookingSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveBusinessBookingProfileResponse.ts b/src/models/retrieveBusinessBookingProfileResponse.ts deleted file mode 100644 index d0470339e..000000000 --- a/src/models/retrieveBusinessBookingProfileResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - BusinessBookingProfile, - businessBookingProfileSchema, -} from './businessBookingProfile'; -import { Error, errorSchema } from './error'; - -export interface RetrieveBusinessBookingProfileResponse { - /** A seller's business booking profile, including booking policy, appointment settings, etc. */ - businessBookingProfile?: BusinessBookingProfile; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveBusinessBookingProfileResponseSchema: Schema = object( - { - businessBookingProfile: [ - 'business_booking_profile', - optional(lazy(() => businessBookingProfileSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveCardResponse.ts b/src/models/retrieveCardResponse.ts deleted file mode 100644 index 0963a47e6..000000000 --- a/src/models/retrieveCardResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Card, cardSchema } from './card'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [RetrieveCard]($e/Cards/RetrieveCard) endpoint. - * Note: if there are errors processing the request, the card field will not be - * present. - */ -export interface RetrieveCardResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ - card?: Card; -} - -export const retrieveCardResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - card: ['card', optional(lazy(() => cardSchema))], -}); diff --git a/src/models/retrieveCashDrawerShiftRequest.ts b/src/models/retrieveCashDrawerShiftRequest.ts deleted file mode 100644 index 3b59a07a3..000000000 --- a/src/models/retrieveCashDrawerShiftRequest.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { object, Schema, string } from '../schema'; - -export interface RetrieveCashDrawerShiftRequest { - /** The ID of the location to retrieve cash drawer shifts from. */ - locationId: string; -} - -export const retrieveCashDrawerShiftRequestSchema: Schema = object( - { locationId: ['location_id', string()] } -); diff --git a/src/models/retrieveCashDrawerShiftResponse.ts b/src/models/retrieveCashDrawerShiftResponse.ts deleted file mode 100644 index 93a5ca80c..000000000 --- a/src/models/retrieveCashDrawerShiftResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CashDrawerShift, cashDrawerShiftSchema } from './cashDrawerShift'; -import { Error, errorSchema } from './error'; - -export interface RetrieveCashDrawerShiftResponse { - /** - * This model gives the details of a cash drawer shift. - * The cash_payment_money, cash_refund_money, cash_paid_in_money, - * and cash_paid_out_money fields are all computed by summing their respective - * event types. - */ - cashDrawerShift?: CashDrawerShift; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveCashDrawerShiftResponseSchema: Schema = object( - { - cashDrawerShift: [ - 'cash_drawer_shift', - optional(lazy(() => cashDrawerShiftSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveCatalogObjectRequest.ts b/src/models/retrieveCatalogObjectRequest.ts deleted file mode 100644 index a19048634..000000000 --- a/src/models/retrieveCatalogObjectRequest.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { bigint, boolean, nullable, object, optional, Schema } from '../schema'; - -export interface RetrieveCatalogObjectRequest { - /** - * If `true`, the response will include additional objects that are related to the - * requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field - * of the response. These objects are put in the `related_objects` field. Setting this to `true` is - * helpful when the objects are needed for immediate display to a user. - * This process only goes one level deep. Objects referenced by the related objects will not be included. For example, - * if the `objects` field of the response contains a CatalogItem, its associated - * CatalogCategory objects, CatalogTax objects, CatalogImage objects and - * CatalogModifierLists will be returned in the `related_objects` field of the - * response. If the `objects` field of the response contains a CatalogItemVariation, - * its parent CatalogItem will be returned in the `related_objects` field of - * the response. - * Default value: `false` - */ - includeRelatedObjects?: boolean | null; - /** - * Requests objects as of a specific version of the catalog. This allows you to retrieve historical - * versions of objects. The value to retrieve a specific version of an object can be found - * in the version field of [CatalogObject]($m/CatalogObject)s. If not included, results will - * be from the current version of the catalog. - */ - catalogVersion?: bigint | null; - /** - * Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists - * of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category - * and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned - * in the response payload. - */ - includeCategoryPathToRoot?: boolean | null; -} - -export const retrieveCatalogObjectRequestSchema: Schema = object( - { - includeRelatedObjects: [ - 'include_related_objects', - optional(nullable(boolean())), - ], - catalogVersion: ['catalog_version', optional(nullable(bigint()))], - includeCategoryPathToRoot: [ - 'include_category_path_to_root', - optional(nullable(boolean())), - ], - } -); diff --git a/src/models/retrieveCatalogObjectResponse.ts b/src/models/retrieveCatalogObjectResponse.ts deleted file mode 100644 index e492d5ad3..000000000 --- a/src/models/retrieveCatalogObjectResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -export interface RetrieveCatalogObjectResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The wrapper object for the catalog entries of a given object type. - * Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. - * For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. - * In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. - * For a more detailed discussion of the Catalog data model, please see the - * [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. - */ - object?: CatalogObject; - /** A list of `CatalogObject`s referenced by the object in the `object` field. */ - relatedObjects?: CatalogObject[]; -} - -export const retrieveCatalogObjectResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - object: ['object', optional(lazy(() => catalogObjectSchema))], - relatedObjects: [ - 'related_objects', - optional(array(lazy(() => catalogObjectSchema))), - ], - } -); diff --git a/src/models/retrieveCustomerCustomAttributeDefinitionRequest.ts b/src/models/retrieveCustomerCustomAttributeDefinitionRequest.ts deleted file mode 100644 index 248514e41..000000000 --- a/src/models/retrieveCustomerCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { number, object, optional, Schema } from '../schema'; - -/** Represents a [RetrieveCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/RetrieveCustomerCustomAttributeDefinition) request. */ -export interface RetrieveCustomerCustomAttributeDefinitionRequest { - /** - * The current version of the custom attribute definition, which is used for strongly consistent - * reads to guarantee that you receive the most up-to-date data. When included in the request, - * Square returns the specified version or a higher version if one exists. If the specified version - * is higher than the current version, Square returns a `BAD_REQUEST` error. - */ - version?: number; -} - -export const retrieveCustomerCustomAttributeDefinitionRequestSchema: Schema = object( - { version: ['version', optional(number())] } -); diff --git a/src/models/retrieveCustomerCustomAttributeDefinitionResponse.ts b/src/models/retrieveCustomerCustomAttributeDefinitionResponse.ts deleted file mode 100644 index c2c837c5a..000000000 --- a/src/models/retrieveCustomerCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [RetrieveCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/RetrieveCustomerCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface RetrieveCustomerCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveCustomerCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveCustomerCustomAttributeRequest.ts b/src/models/retrieveCustomerCustomAttributeRequest.ts deleted file mode 100644 index bd74c60aa..000000000 --- a/src/models/retrieveCustomerCustomAttributeRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { boolean, nullable, number, object, optional, Schema } from '../schema'; - -/** Represents a [RetrieveCustomerCustomAttribute]($e/CustomerCustomAttributes/RetrieveCustomerCustomAttribute) request. */ -export interface RetrieveCustomerCustomAttributeRequest { - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of - * the custom attribute. Set this parameter to `true` to get the name and description of the custom - * attribute, information about the data type, or other definition details. The default value is `false`. - */ - withDefinition?: boolean | null; - /** - * The current version of the custom attribute, which is used for strongly consistent reads to - * guarantee that you receive the most up-to-date data. When included in the request, Square - * returns the specified version or a higher version if one exists. If the specified version is - * higher than the current version, Square returns a `BAD_REQUEST` error. - */ - version?: number; -} - -export const retrieveCustomerCustomAttributeRequestSchema: Schema = object( - { - withDefinition: ['with_definition', optional(nullable(boolean()))], - version: ['version', optional(number())], - } -); diff --git a/src/models/retrieveCustomerCustomAttributeResponse.ts b/src/models/retrieveCustomerCustomAttributeResponse.ts deleted file mode 100644 index 7fb654d2d..000000000 --- a/src/models/retrieveCustomerCustomAttributeResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [RetrieveCustomerCustomAttribute]($e/CustomerCustomAttributes/RetrieveCustomerCustomAttribute) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface RetrieveCustomerCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveCustomerCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveCustomerGroupResponse.ts b/src/models/retrieveCustomerGroupResponse.ts deleted file mode 100644 index 394803929..000000000 --- a/src/models/retrieveCustomerGroupResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomerGroup, customerGroupSchema } from './customerGroup'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [RetrieveCustomerGroup]($e/CustomerGroups/RetrieveCustomerGroup) endpoint. - * Either `errors` or `group` is present in a given response (never both). - */ -export interface RetrieveCustomerGroupResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a group of customer profiles. - * Customer groups can be created, be modified, and have their membership defined using - * the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. - */ - group?: CustomerGroup; -} - -export const retrieveCustomerGroupResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - group: ['group', optional(lazy(() => customerGroupSchema))], - } -); diff --git a/src/models/retrieveCustomerResponse.ts b/src/models/retrieveCustomerResponse.ts deleted file mode 100644 index 1d7502b94..000000000 --- a/src/models/retrieveCustomerResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Customer, customerSchema } from './customer'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the `RetrieveCustomer` endpoint. - * Either `errors` or `customer` is present in a given response (never both). - */ -export interface RetrieveCustomerResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square customer profile in the Customer Directory of a Square seller. */ - customer?: Customer; -} - -export const retrieveCustomerResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - customer: ['customer', optional(lazy(() => customerSchema))], - } -); diff --git a/src/models/retrieveCustomerSegmentResponse.ts b/src/models/retrieveCustomerSegmentResponse.ts deleted file mode 100644 index fae011441..000000000 --- a/src/models/retrieveCustomerSegmentResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomerSegment, customerSegmentSchema } from './customerSegment'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint. - * Either `errors` or `segment` is present in a given response (never both). - */ -export interface RetrieveCustomerSegmentResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a group of customer profiles that match one or more predefined filter criteria. - * Segments (also known as Smart Groups) are defined and created within the Customer Directory in the - * Square Seller Dashboard or Point of Sale. - */ - segment?: CustomerSegment; -} - -export const retrieveCustomerSegmentResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - segment: ['segment', optional(lazy(() => customerSegmentSchema))], - } -); diff --git a/src/models/retrieveDisputeEvidenceResponse.ts b/src/models/retrieveDisputeEvidenceResponse.ts deleted file mode 100644 index 13f8e8023..000000000 --- a/src/models/retrieveDisputeEvidenceResponse.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { DisputeEvidence, disputeEvidenceSchema } from './disputeEvidence'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in a `RetrieveDisputeEvidence` response. */ -export interface RetrieveDisputeEvidenceResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - evidence?: DisputeEvidence; -} - -export const retrieveDisputeEvidenceResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - evidence: ['evidence', optional(lazy(() => disputeEvidenceSchema))], - } -); diff --git a/src/models/retrieveDisputeResponse.ts b/src/models/retrieveDisputeResponse.ts deleted file mode 100644 index c9693325a..000000000 --- a/src/models/retrieveDisputeResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Dispute, disputeSchema } from './dispute'; -import { Error, errorSchema } from './error'; - -/** Defines fields in a `RetrieveDispute` response. */ -export interface RetrieveDisputeResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. */ - dispute?: Dispute; -} - -export const retrieveDisputeResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - dispute: ['dispute', optional(lazy(() => disputeSchema))], - } -); diff --git a/src/models/retrieveEmployeeResponse.ts b/src/models/retrieveEmployeeResponse.ts deleted file mode 100644 index 0bc76da56..000000000 --- a/src/models/retrieveEmployeeResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Employee, employeeSchema } from './employee'; -import { Error, errorSchema } from './error'; - -export interface RetrieveEmployeeResponse { - /** - * An employee object that is used by the external API. - * DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember). - */ - employee?: Employee; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveEmployeeResponseSchema: Schema = object( - { - employee: ['employee', optional(lazy(() => employeeSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveGiftCardFromGANRequest.ts b/src/models/retrieveGiftCardFromGANRequest.ts deleted file mode 100644 index 9e7db5e3f..000000000 --- a/src/models/retrieveGiftCardFromGANRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** A request to retrieve gift cards by their GANs. */ -export interface RetrieveGiftCardFromGANRequest { - /** - * The gift card account number (GAN) of the gift card to retrieve. - * The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported. - * Square-issued gift cards have 16-digit GANs. - */ - gan: string; -} - -export const retrieveGiftCardFromGANRequestSchema: Schema = object( - { gan: ['gan', string()] } -); diff --git a/src/models/retrieveGiftCardFromGANResponse.ts b/src/models/retrieveGiftCardFromGANResponse.ts deleted file mode 100644 index 894998c85..000000000 --- a/src/models/retrieveGiftCardFromGANResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCard, giftCardSchema } from './giftCard'; - -/** - * A response that contains a `GiftCard`. This response might contain a set of `Error` objects - * if the request resulted in errors. - */ -export interface RetrieveGiftCardFromGANResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square gift card. */ - giftCard?: GiftCard; -} - -export const retrieveGiftCardFromGANResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCard: ['gift_card', optional(lazy(() => giftCardSchema))], - } -); diff --git a/src/models/retrieveGiftCardFromNonceRequest.ts b/src/models/retrieveGiftCardFromNonceRequest.ts deleted file mode 100644 index 61670e9e6..000000000 --- a/src/models/retrieveGiftCardFromNonceRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** A request to retrieve a gift card by using a payment token. */ -export interface RetrieveGiftCardFromNonceRequest { - /** - * The payment token of the gift card to retrieve. Payment tokens are generated by the - * Web Payments SDK or In-App Payments SDK. - */ - nonce: string; -} - -export const retrieveGiftCardFromNonceRequestSchema: Schema = object( - { nonce: ['nonce', string()] } -); diff --git a/src/models/retrieveGiftCardFromNonceResponse.ts b/src/models/retrieveGiftCardFromNonceResponse.ts deleted file mode 100644 index cc82f2bf4..000000000 --- a/src/models/retrieveGiftCardFromNonceResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCard, giftCardSchema } from './giftCard'; - -/** - * A response that contains a `GiftCard` object. If the request resulted in errors, - * the response contains a set of `Error` objects. - */ -export interface RetrieveGiftCardFromNonceResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square gift card. */ - giftCard?: GiftCard; -} - -export const retrieveGiftCardFromNonceResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCard: ['gift_card', optional(lazy(() => giftCardSchema))], - } -); diff --git a/src/models/retrieveGiftCardResponse.ts b/src/models/retrieveGiftCardResponse.ts deleted file mode 100644 index a7867bae4..000000000 --- a/src/models/retrieveGiftCardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCard, giftCardSchema } from './giftCard'; - -/** - * A response that contains a `GiftCard`. The response might contain a set of `Error` objects - * if the request resulted in errors. - */ -export interface RetrieveGiftCardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square gift card. */ - giftCard?: GiftCard; -} - -export const retrieveGiftCardResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCard: ['gift_card', optional(lazy(() => giftCardSchema))], - } -); diff --git a/src/models/retrieveInventoryAdjustmentResponse.ts b/src/models/retrieveInventoryAdjustmentResponse.ts deleted file mode 100644 index c33f7cd69..000000000 --- a/src/models/retrieveInventoryAdjustmentResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - InventoryAdjustment, - inventoryAdjustmentSchema, -} from './inventoryAdjustment'; - -export interface RetrieveInventoryAdjustmentResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a change in state or quantity of product inventory at a - * particular time and location. - */ - adjustment?: InventoryAdjustment; -} - -export const retrieveInventoryAdjustmentResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - adjustment: ['adjustment', optional(lazy(() => inventoryAdjustmentSchema))], - } -); diff --git a/src/models/retrieveInventoryChangesRequest.ts b/src/models/retrieveInventoryChangesRequest.ts deleted file mode 100644 index 6a333a80b..000000000 --- a/src/models/retrieveInventoryChangesRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface RetrieveInventoryChangesRequest { - /** - * The [Location](entity:Location) IDs to look up as a comma-separated - * list. An empty list queries all locations. - */ - locationIds?: string | null; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for the original query. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string | null; -} - -export const retrieveInventoryChangesRequestSchema: Schema = object( - { - locationIds: ['location_ids', optional(nullable(string()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/retrieveInventoryChangesResponse.ts b/src/models/retrieveInventoryChangesResponse.ts deleted file mode 100644 index 8ba7201b5..000000000 --- a/src/models/retrieveInventoryChangesResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { InventoryChange, inventoryChangeSchema } from './inventoryChange'; - -export interface RetrieveInventoryChangesResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The set of inventory changes for the requested object and locations. */ - changes?: InventoryChange[]; - /** - * The pagination cursor to be used in a subsequent request. If unset, - * this is the final response. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string; -} - -export const retrieveInventoryChangesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - changes: ['changes', optional(array(lazy(() => inventoryChangeSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/retrieveInventoryCountRequest.ts b/src/models/retrieveInventoryCountRequest.ts deleted file mode 100644 index f3cb74306..000000000 --- a/src/models/retrieveInventoryCountRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface RetrieveInventoryCountRequest { - /** - * The [Location](entity:Location) IDs to look up as a comma-separated - * list. An empty list queries all locations. - */ - locationIds?: string | null; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for the original query. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string | null; -} - -export const retrieveInventoryCountRequestSchema: Schema = object( - { - locationIds: ['location_ids', optional(nullable(string()))], - cursor: ['cursor', optional(nullable(string()))], - } -); diff --git a/src/models/retrieveInventoryCountResponse.ts b/src/models/retrieveInventoryCountResponse.ts deleted file mode 100644 index 5a917f472..000000000 --- a/src/models/retrieveInventoryCountResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { InventoryCount, inventoryCountSchema } from './inventoryCount'; - -export interface RetrieveInventoryCountResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The current calculated inventory counts for the requested object and - * locations. - */ - counts?: InventoryCount[]; - /** - * The pagination cursor to be used in a subsequent request. If unset, - * this is the final response. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string; -} - -export const retrieveInventoryCountResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - counts: ['counts', optional(array(lazy(() => inventoryCountSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/retrieveInventoryPhysicalCountResponse.ts b/src/models/retrieveInventoryPhysicalCountResponse.ts deleted file mode 100644 index 37d030dd5..000000000 --- a/src/models/retrieveInventoryPhysicalCountResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - InventoryPhysicalCount, - inventoryPhysicalCountSchema, -} from './inventoryPhysicalCount'; - -export interface RetrieveInventoryPhysicalCountResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents the quantity of an item variation that is physically present - * at a specific location, verified by a seller or a seller's employee. For example, - * a physical count might come from an employee counting the item variations on - * hand or from syncing with an external system. - */ - count?: InventoryPhysicalCount; -} - -export const retrieveInventoryPhysicalCountResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - count: ['count', optional(lazy(() => inventoryPhysicalCountSchema))], - } -); diff --git a/src/models/retrieveInventoryTransferResponse.ts b/src/models/retrieveInventoryTransferResponse.ts deleted file mode 100644 index b1699d5a3..000000000 --- a/src/models/retrieveInventoryTransferResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - InventoryTransfer, - inventoryTransferSchema, -} from './inventoryTransfer'; - -export interface RetrieveInventoryTransferResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents the transfer of a quantity of product inventory at a - * particular time from one location to another. - */ - transfer?: InventoryTransfer; -} - -export const retrieveInventoryTransferResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - transfer: ['transfer', optional(lazy(() => inventoryTransferSchema))], - } -); diff --git a/src/models/retrieveJobResponse.ts b/src/models/retrieveJobResponse.ts deleted file mode 100644 index 5e0ea4f75..000000000 --- a/src/models/retrieveJobResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Job, jobSchema } from './job'; - -/** - * Represents a [RetrieveJob]($e/Team/RetrieveJob) response. Either `job` or `errors` - * is present in the response. - */ -export interface RetrieveJobResponse { - /** - * Represents a job that can be assigned to [team members]($m/TeamMember). This object defines the - * job's title and tip eligibility. Compensation is defined in a [job assignment]($m/JobAssignment) - * in a team member's wage setting. - */ - job?: Job; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveJobResponseSchema: Schema = object({ - job: ['job', optional(lazy(() => jobSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/retrieveLocationBookingProfileResponse.ts b/src/models/retrieveLocationBookingProfileResponse.ts deleted file mode 100644 index 9ab6c158a..000000000 --- a/src/models/retrieveLocationBookingProfileResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - LocationBookingProfile, - locationBookingProfileSchema, -} from './locationBookingProfile'; - -export interface RetrieveLocationBookingProfileResponse { - /** The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. */ - locationBookingProfile?: LocationBookingProfile; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveLocationBookingProfileResponseSchema: Schema = object( - { - locationBookingProfile: [ - 'location_booking_profile', - optional(lazy(() => locationBookingProfileSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveLocationCustomAttributeDefinitionRequest.ts b/src/models/retrieveLocationCustomAttributeDefinitionRequest.ts deleted file mode 100644 index 5e771d120..000000000 --- a/src/models/retrieveLocationCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { number, object, optional, Schema } from '../schema'; - -/** Represents a [RetrieveLocationCustomAttributeDefinition]($e/LocationCustomAttributes/RetrieveLocationCustomAttributeDefinition) request. */ -export interface RetrieveLocationCustomAttributeDefinitionRequest { - /** - * The current version of the custom attribute definition, which is used for strongly consistent - * reads to guarantee that you receive the most up-to-date data. When included in the request, - * Square returns the specified version or a higher version if one exists. If the specified version - * is higher than the current version, Square returns a `BAD_REQUEST` error. - */ - version?: number; -} - -export const retrieveLocationCustomAttributeDefinitionRequestSchema: Schema = object( - { version: ['version', optional(number())] } -); diff --git a/src/models/retrieveLocationCustomAttributeDefinitionResponse.ts b/src/models/retrieveLocationCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 72d8c022b..000000000 --- a/src/models/retrieveLocationCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [RetrieveLocationCustomAttributeDefinition]($e/LocationCustomAttributes/RetrieveLocationCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface RetrieveLocationCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveLocationCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveLocationCustomAttributeRequest.ts b/src/models/retrieveLocationCustomAttributeRequest.ts deleted file mode 100644 index 4e0038765..000000000 --- a/src/models/retrieveLocationCustomAttributeRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { boolean, nullable, number, object, optional, Schema } from '../schema'; - -/** Represents a [RetrieveLocationCustomAttribute]($e/LocationCustomAttributes/RetrieveLocationCustomAttribute) request. */ -export interface RetrieveLocationCustomAttributeRequest { - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of - * the custom attribute. Set this parameter to `true` to get the name and description of the custom - * attribute, information about the data type, or other definition details. The default value is `false`. - */ - withDefinition?: boolean | null; - /** - * The current version of the custom attribute, which is used for strongly consistent reads to - * guarantee that you receive the most up-to-date data. When included in the request, Square - * returns the specified version or a higher version if one exists. If the specified version is - * higher than the current version, Square returns a `BAD_REQUEST` error. - */ - version?: number; -} - -export const retrieveLocationCustomAttributeRequestSchema: Schema = object( - { - withDefinition: ['with_definition', optional(nullable(boolean()))], - version: ['version', optional(number())], - } -); diff --git a/src/models/retrieveLocationCustomAttributeResponse.ts b/src/models/retrieveLocationCustomAttributeResponse.ts deleted file mode 100644 index c107f357a..000000000 --- a/src/models/retrieveLocationCustomAttributeResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [RetrieveLocationCustomAttribute]($e/LocationCustomAttributes/RetrieveLocationCustomAttribute) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface RetrieveLocationCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveLocationCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveLocationResponse.ts b/src/models/retrieveLocationResponse.ts deleted file mode 100644 index 2f8e64639..000000000 --- a/src/models/retrieveLocationResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Location, locationSchema } from './location'; - -/** - * Defines the fields that the [RetrieveLocation]($e/Locations/RetrieveLocation) - * endpoint returns in a response. - */ -export interface RetrieveLocationResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ - location?: Location; -} - -export const retrieveLocationResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - location: ['location', optional(lazy(() => locationSchema))], - } -); diff --git a/src/models/retrieveLocationSettingsResponse.ts b/src/models/retrieveLocationSettingsResponse.ts deleted file mode 100644 index 38f8b5ac1..000000000 --- a/src/models/retrieveLocationSettingsResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CheckoutLocationSettings, - checkoutLocationSettingsSchema, -} from './checkoutLocationSettings'; -import { Error, errorSchema } from './error'; - -export interface RetrieveLocationSettingsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - locationSettings?: CheckoutLocationSettings; -} - -export const retrieveLocationSettingsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - locationSettings: [ - 'location_settings', - optional(lazy(() => checkoutLocationSettingsSchema)), - ], - } -); diff --git a/src/models/retrieveLoyaltyAccountResponse.ts b/src/models/retrieveLoyaltyAccountResponse.ts deleted file mode 100644 index cb8e2ece6..000000000 --- a/src/models/retrieveLoyaltyAccountResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyAccount, loyaltyAccountSchema } from './loyaltyAccount'; - -/** A response that includes the loyalty account. */ -export interface RetrieveLoyaltyAccountResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Describes a loyalty account in a [loyalty program]($m/LoyaltyProgram). For more information, see - * [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). - */ - loyaltyAccount?: LoyaltyAccount; -} - -export const retrieveLoyaltyAccountResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - loyaltyAccount: [ - 'loyalty_account', - optional(lazy(() => loyaltyAccountSchema)), - ], - } -); diff --git a/src/models/retrieveLoyaltyProgramResponse.ts b/src/models/retrieveLoyaltyProgramResponse.ts deleted file mode 100644 index 7b27288bb..000000000 --- a/src/models/retrieveLoyaltyProgramResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyProgram, loyaltyProgramSchema } from './loyaltyProgram'; - -/** A response that contains the loyalty program. */ -export interface RetrieveLoyaltyProgramResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards. - * Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. - * For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). - */ - program?: LoyaltyProgram; -} - -export const retrieveLoyaltyProgramResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - program: ['program', optional(lazy(() => loyaltyProgramSchema))], - } -); diff --git a/src/models/retrieveLoyaltyPromotionResponse.ts b/src/models/retrieveLoyaltyPromotionResponse.ts deleted file mode 100644 index e585a8b98..000000000 --- a/src/models/retrieveLoyaltyPromotionResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyPromotion, loyaltyPromotionSchema } from './loyaltyPromotion'; - -/** Represents a [RetrieveLoyaltyPromotionPromotions]($e/Loyalty/RetrieveLoyaltyPromotion) response. */ -export interface RetrieveLoyaltyPromotionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a promotion for a [loyalty program]($m/LoyaltyProgram). Loyalty promotions enable buyers - * to earn extra points on top of those earned from the base program. - * A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. - */ - loyaltyPromotion?: LoyaltyPromotion; -} - -export const retrieveLoyaltyPromotionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - loyaltyPromotion: [ - 'loyalty_promotion', - optional(lazy(() => loyaltyPromotionSchema)), - ], - } -); diff --git a/src/models/retrieveLoyaltyRewardResponse.ts b/src/models/retrieveLoyaltyRewardResponse.ts deleted file mode 100644 index 493402dd7..000000000 --- a/src/models/retrieveLoyaltyRewardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyReward, loyaltyRewardSchema } from './loyaltyReward'; - -/** A response that includes the loyalty reward. */ -export interface RetrieveLoyaltyRewardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a contract to redeem loyalty points for a [reward tier]($m/LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. - * For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). - */ - reward?: LoyaltyReward; -} - -export const retrieveLoyaltyRewardResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - reward: ['reward', optional(lazy(() => loyaltyRewardSchema))], - } -); diff --git a/src/models/retrieveMerchantCustomAttributeDefinitionRequest.ts b/src/models/retrieveMerchantCustomAttributeDefinitionRequest.ts deleted file mode 100644 index b7619b764..000000000 --- a/src/models/retrieveMerchantCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { number, object, optional, Schema } from '../schema'; - -/** Represents a [RetrieveMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/RetrieveMerchantCustomAttributeDefinition) request. */ -export interface RetrieveMerchantCustomAttributeDefinitionRequest { - /** - * The current version of the custom attribute definition, which is used for strongly consistent - * reads to guarantee that you receive the most up-to-date data. When included in the request, - * Square returns the specified version or a higher version if one exists. If the specified version - * is higher than the current version, Square returns a `BAD_REQUEST` error. - */ - version?: number; -} - -export const retrieveMerchantCustomAttributeDefinitionRequestSchema: Schema = object( - { version: ['version', optional(number())] } -); diff --git a/src/models/retrieveMerchantCustomAttributeDefinitionResponse.ts b/src/models/retrieveMerchantCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 63b5d6135..000000000 --- a/src/models/retrieveMerchantCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [RetrieveMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/RetrieveMerchantCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface RetrieveMerchantCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveMerchantCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveMerchantCustomAttributeRequest.ts b/src/models/retrieveMerchantCustomAttributeRequest.ts deleted file mode 100644 index d367e8f82..000000000 --- a/src/models/retrieveMerchantCustomAttributeRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { boolean, nullable, number, object, optional, Schema } from '../schema'; - -/** Represents a [RetrieveMerchantCustomAttribute]($e/MerchantCustomAttributes/RetrieveMerchantCustomAttribute) request. */ -export interface RetrieveMerchantCustomAttributeRequest { - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of - * the custom attribute. Set this parameter to `true` to get the name and description of the custom - * attribute, information about the data type, or other definition details. The default value is `false`. - */ - withDefinition?: boolean | null; - /** - * The current version of the custom attribute, which is used for strongly consistent reads to - * guarantee that you receive the most up-to-date data. When included in the request, Square - * returns the specified version or a higher version if one exists. If the specified version is - * higher than the current version, Square returns a `BAD_REQUEST` error. - */ - version?: number; -} - -export const retrieveMerchantCustomAttributeRequestSchema: Schema = object( - { - withDefinition: ['with_definition', optional(nullable(boolean()))], - version: ['version', optional(number())], - } -); diff --git a/src/models/retrieveMerchantCustomAttributeResponse.ts b/src/models/retrieveMerchantCustomAttributeResponse.ts deleted file mode 100644 index fec85d994..000000000 --- a/src/models/retrieveMerchantCustomAttributeResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents a [RetrieveMerchantCustomAttribute]($e/MerchantCustomAttributes/RetrieveMerchantCustomAttribute) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface RetrieveMerchantCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveMerchantCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveMerchantResponse.ts b/src/models/retrieveMerchantResponse.ts deleted file mode 100644 index 15363d8b6..000000000 --- a/src/models/retrieveMerchantResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Merchant, merchantSchema } from './merchant'; - -/** The response object returned by the [RetrieveMerchant]($e/Merchants/RetrieveMerchant) endpoint. */ -export interface RetrieveMerchantResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** Represents a business that sells with Square. */ - merchant?: Merchant; -} - -export const retrieveMerchantResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - merchant: ['merchant', optional(lazy(() => merchantSchema))], - } -); diff --git a/src/models/retrieveMerchantSettingsResponse.ts b/src/models/retrieveMerchantSettingsResponse.ts deleted file mode 100644 index 2bbdefd74..000000000 --- a/src/models/retrieveMerchantSettingsResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CheckoutMerchantSettings, - checkoutMerchantSettingsSchema, -} from './checkoutMerchantSettings'; -import { Error, errorSchema } from './error'; - -export interface RetrieveMerchantSettingsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - merchantSettings?: CheckoutMerchantSettings; -} - -export const retrieveMerchantSettingsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - merchantSettings: [ - 'merchant_settings', - optional(lazy(() => checkoutMerchantSettingsSchema)), - ], - } -); diff --git a/src/models/retrieveOrderCustomAttributeDefinitionRequest.ts b/src/models/retrieveOrderCustomAttributeDefinitionRequest.ts deleted file mode 100644 index 535a6ec89..000000000 --- a/src/models/retrieveOrderCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { number, object, optional, Schema } from '../schema'; - -/** Represents a get request for an order custom attribute definition. */ -export interface RetrieveOrderCustomAttributeDefinitionRequest { - /** - * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) - * control, include this optional field and specify the current version of the custom attribute. - */ - version?: number; -} - -export const retrieveOrderCustomAttributeDefinitionRequestSchema: Schema = object( - { version: ['version', optional(number())] } -); diff --git a/src/models/retrieveOrderCustomAttributeDefinitionResponse.ts b/src/models/retrieveOrderCustomAttributeDefinitionResponse.ts deleted file mode 100644 index c722d1372..000000000 --- a/src/models/retrieveOrderCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** Represents a response from getting an order custom attribute definition. */ -export interface RetrieveOrderCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveOrderCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveOrderCustomAttributeRequest.ts b/src/models/retrieveOrderCustomAttributeRequest.ts deleted file mode 100644 index 063497fd3..000000000 --- a/src/models/retrieveOrderCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { boolean, nullable, number, object, optional, Schema } from '../schema'; - -/** Represents a get request for an order custom attribute. */ -export interface RetrieveOrderCustomAttributeRequest { - /** - * To enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) - * control, include this optional field and specify the current version of the custom attribute. - */ - version?: number; - /** - * Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each - * custom attribute. Set this parameter to `true` to get the name and description of each custom attribute, - * information about the data type, or other definition details. The default value is `false`. - */ - withDefinition?: boolean | null; -} - -export const retrieveOrderCustomAttributeRequestSchema: Schema = object( - { - version: ['version', optional(number())], - withDefinition: ['with_definition', optional(nullable(boolean()))], - } -); diff --git a/src/models/retrieveOrderCustomAttributeResponse.ts b/src/models/retrieveOrderCustomAttributeResponse.ts deleted file mode 100644 index 84a7f2307..000000000 --- a/src/models/retrieveOrderCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** Represents a response from getting an order custom attribute. */ -export interface RetrieveOrderCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveOrderCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveOrderResponse.ts b/src/models/retrieveOrderResponse.ts deleted file mode 100644 index 96b05dd4e..000000000 --- a/src/models/retrieveOrderResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Order, orderSchema } from './order'; - -export interface RetrieveOrderResponse { - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveOrderResponseSchema: Schema = object( - { - order: ['order', optional(lazy(() => orderSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrievePaymentLinkResponse.ts b/src/models/retrievePaymentLinkResponse.ts deleted file mode 100644 index 0bf09834b..000000000 --- a/src/models/retrievePaymentLinkResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { PaymentLink, paymentLinkSchema } from './paymentLink'; - -export interface RetrievePaymentLinkResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - paymentLink?: PaymentLink; -} - -export const retrievePaymentLinkResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - paymentLink: ['payment_link', optional(lazy(() => paymentLinkSchema))], - } -); diff --git a/src/models/retrieveSnippetResponse.ts b/src/models/retrieveSnippetResponse.ts deleted file mode 100644 index 3b8ab38d3..000000000 --- a/src/models/retrieveSnippetResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Snippet, snippetSchema } from './snippet'; - -/** Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`. */ -export interface RetrieveSnippetResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. */ - snippet?: Snippet; -} - -export const retrieveSnippetResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - snippet: ['snippet', optional(lazy(() => snippetSchema))], - } -); diff --git a/src/models/retrieveSubscriptionRequest.ts b/src/models/retrieveSubscriptionRequest.ts deleted file mode 100644 index 40bdbb4fe..000000000 --- a/src/models/retrieveSubscriptionRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Defines input parameters in a request to the - * [RetrieveSubscription]($e/Subscriptions/RetrieveSubscription) endpoint. - */ -export interface RetrieveSubscriptionRequest { - /** - * A query parameter to specify related information to be included in the response. - * The supported query parameter values are: - * - `actions`: to include scheduled actions on the targeted subscription. - */ - include?: string | null; -} - -export const retrieveSubscriptionRequestSchema: Schema = object( - { include: ['include', optional(nullable(string()))] } -); diff --git a/src/models/retrieveSubscriptionResponse.ts b/src/models/retrieveSubscriptionResponse.ts deleted file mode 100644 index ee2ea078b..000000000 --- a/src/models/retrieveSubscriptionResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; - -/** - * Defines output parameters in a response from the - * [RetrieveSubscription]($e/Subscriptions/RetrieveSubscription) endpoint. - */ -export interface RetrieveSubscriptionResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * Represents a subscription purchased by a customer. - * For more information, see - * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). - */ - subscription?: Subscription; -} - -export const retrieveSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - } -); diff --git a/src/models/retrieveTeamMemberBookingProfileResponse.ts b/src/models/retrieveTeamMemberBookingProfileResponse.ts deleted file mode 100644 index c966291c7..000000000 --- a/src/models/retrieveTeamMemberBookingProfileResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - TeamMemberBookingProfile, - teamMemberBookingProfileSchema, -} from './teamMemberBookingProfile'; - -export interface RetrieveTeamMemberBookingProfileResponse { - /** The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. */ - teamMemberBookingProfile?: TeamMemberBookingProfile; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveTeamMemberBookingProfileResponseSchema: Schema = object( - { - teamMemberBookingProfile: [ - 'team_member_booking_profile', - optional(lazy(() => teamMemberBookingProfileSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveTeamMemberResponse.ts b/src/models/retrieveTeamMemberResponse.ts deleted file mode 100644 index 8965d836c..000000000 --- a/src/models/retrieveTeamMemberResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TeamMember, teamMemberSchema } from './teamMember'; - -/** Represents a response from a retrieve request containing a `TeamMember` object or error messages. */ -export interface RetrieveTeamMemberResponse { - /** A record representing an individual team member for a business. */ - teamMember?: TeamMember; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveTeamMemberResponseSchema: Schema = object( - { - teamMember: ['team_member', optional(lazy(() => teamMemberSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveTokenStatusResponse.ts b/src/models/retrieveTokenStatusResponse.ts deleted file mode 100644 index cb01459eb..000000000 --- a/src/models/retrieveTokenStatusResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * 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 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; - /** The ID of the authorizing merchant's business. */ - merchantId?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveTokenStatusResponseSchema: Schema = object( - { - scopes: ['scopes', optional(array(string()))], - expiresAt: ['expires_at', optional(string())], - clientId: ['client_id', optional(string())], - merchantId: ['merchant_id', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveTransactionResponse.ts b/src/models/retrieveTransactionResponse.ts deleted file mode 100644 index 568802fc5..000000000 --- a/src/models/retrieveTransactionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Transaction, transactionSchema } from './transaction'; - -/** - * Defines the fields that are included in the response body of - * a request to the [RetrieveTransaction](api-endpoint:Transactions-RetrieveTransaction) endpoint. - * One of `errors` or `transaction` is present in a given response (never both). - */ -export interface RetrieveTransactionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a transaction processed with Square, either with the - * Connect API or with Square Point of Sale. - * The `tenders` field of this object lists all methods of payment used to pay in - * the transaction. - */ - transaction?: Transaction; -} - -export const retrieveTransactionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - transaction: ['transaction', optional(lazy(() => transactionSchema))], - } -); diff --git a/src/models/retrieveVendorResponse.ts b/src/models/retrieveVendorResponse.ts deleted file mode 100644 index de60c391b..000000000 --- a/src/models/retrieveVendorResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Vendor, vendorSchema } from './vendor'; - -/** Represents an output from a call to [RetrieveVendor]($e/Vendors/RetrieveVendor). */ -export interface RetrieveVendorResponse { - /** Errors encountered when the request fails. */ - errors?: Error[]; - /** Represents a supplier to a seller. */ - vendor?: Vendor; -} - -export const retrieveVendorResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - vendor: ['vendor', optional(lazy(() => vendorSchema))], - } -); diff --git a/src/models/retrieveWageSettingResponse.ts b/src/models/retrieveWageSettingResponse.ts deleted file mode 100644 index 2d052b809..000000000 --- a/src/models/retrieveWageSettingResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { WageSetting, wageSettingSchema } from './wageSetting'; - -/** Represents a response from a retrieve request containing the specified `WageSetting` object or error messages. */ -export interface RetrieveWageSettingResponse { - /** - * Represents information about the overtime exemption status, job assignments, and compensation - * for a [team member]($m/TeamMember). - */ - wageSetting?: WageSetting; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const retrieveWageSettingResponseSchema: Schema = object( - { - wageSetting: ['wage_setting', optional(lazy(() => wageSettingSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/retrieveWebhookSubscriptionResponse.ts b/src/models/retrieveWebhookSubscriptionResponse.ts deleted file mode 100644 index 3a95cc5a3..000000000 --- a/src/models/retrieveWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - WebhookSubscription, - webhookSubscriptionSchema, -} from './webhookSubscription'; - -/** - * Defines the fields that are included in the response body of - * a request to the [RetrieveWebhookSubscription]($e/WebhookSubscriptions/RetrieveWebhookSubscription) endpoint. - * Note: if there are errors processing the request, the [Subscription]($m/WebhookSubscription) will not be - * present. - */ -export interface RetrieveWebhookSubscriptionResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** - * Represents the details of a webhook subscription, including notification URL, - * event types, and signature key. - */ - subscription?: WebhookSubscription; -} - -export const retrieveWebhookSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: [ - 'subscription', - optional(lazy(() => webhookSubscriptionSchema)), - ], - } -); diff --git a/src/models/revokeTokenRequest.ts b/src/models/revokeTokenRequest.ts deleted file mode 100644 index f77b7962d..000000000 --- a/src/models/revokeTokenRequest.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -export interface RevokeTokenRequest { - /** - * 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; - /** - * 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. - */ - accessToken?: string | null; - /** - * The ID of the merchant whose token you want to revoke. - * Do not provide a value for `access_token` if you provide this parameter. - */ - merchantId?: string | null; - /** - * If `true`, terminate the given single access token, but do not - * terminate the entire authorization. - * Default: `false` - */ - revokeOnlyAccessToken?: boolean | null; -} - -export const revokeTokenRequestSchema: Schema = object({ - clientId: ['client_id', optional(nullable(string()))], - accessToken: ['access_token', optional(nullable(string()))], - merchantId: ['merchant_id', optional(nullable(string()))], - revokeOnlyAccessToken: [ - 'revoke_only_access_token', - optional(nullable(boolean())), - ], -}); diff --git a/src/models/revokeTokenResponse.ts b/src/models/revokeTokenResponse.ts deleted file mode 100644 index 91c584780..000000000 --- a/src/models/revokeTokenResponse.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { array, boolean, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -export interface RevokeTokenResponse { - /** If the request is successful, this is `true`. */ - success?: boolean; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const revokeTokenResponseSchema: Schema = object({ - success: ['success', optional(boolean())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/riskEvaluation.ts b/src/models/riskEvaluation.ts deleted file mode 100644 index 950f03e08..000000000 --- a/src/models/riskEvaluation.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Represents fraud risk information for the associated payment. - * When you take a payment through Square's Payments API (using the `CreatePayment` - * endpoint), Square evaluates it and assigns a risk level to the payment. Sellers - * can use this information to determine the course of action (for example, - * provide the goods/services or refund the payment). - */ -export interface RiskEvaluation { - /** The timestamp when payment risk was evaluated, in RFC 3339 format. */ - createdAt?: string; - riskLevel?: string; -} - -export const riskEvaluationSchema: Schema = object({ - createdAt: ['created_at', optional(string())], - riskLevel: ['risk_level', optional(string())], -}); diff --git a/src/models/saveCardOptions.ts b/src/models/saveCardOptions.ts deleted file mode 100644 index 6ddf2be7b..000000000 --- a/src/models/saveCardOptions.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Describes save-card action fields. */ -export interface SaveCardOptions { - /** The square-assigned ID of the customer linked to the saved card. */ - customerId: string; - /** The id of the created card-on-file. */ - cardId?: string; - /** - * An optional user-defined reference ID that can be used to associate - * this `Card` to another entity in an external system. For example, a customer - * ID generated by a third-party system. - */ - referenceId?: string | null; -} - -export const saveCardOptionsSchema: Schema = object({ - customerId: ['customer_id', string()], - cardId: ['card_id', optional(string())], - referenceId: ['reference_id', optional(nullable(string()))], -}); diff --git a/src/models/searchAvailabilityFilter.ts b/src/models/searchAvailabilityFilter.ts deleted file mode 100644 index 2e57ce949..000000000 --- a/src/models/searchAvailabilityFilter.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { SegmentFilter, segmentFilterSchema } from './segmentFilter'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -/** A query filter to search for buyer-accessible availabilities by. */ -export interface SearchAvailabilityFilter { - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - startAtRange: TimeRange; - /** - * The query expression to search for buyer-accessible availabilities with their location IDs matching the specified location ID. - * This query expression cannot be set if `booking_id` is set. - */ - locationId?: string | null; - /** - * The query expression to search for buyer-accessible availabilities matching the specified list of segment filters. - * If the size of the `segment_filters` list is `n`, the search returns availabilities with `n` segments per availability. - * This query expression cannot be set if `booking_id` is set. - */ - segmentFilters?: SegmentFilter[] | null; - /** - * The query expression to search for buyer-accessible availabilities for an existing booking by matching the specified `booking_id` value. - * This is commonly used to reschedule an appointment. - * If this expression is set, the `location_id` and `segment_filters` expressions cannot be set. - */ - bookingId?: string | null; -} - -export const searchAvailabilityFilterSchema: Schema = object( - { - startAtRange: ['start_at_range', lazy(() => timeRangeSchema)], - locationId: ['location_id', optional(nullable(string()))], - segmentFilters: [ - 'segment_filters', - optional(nullable(array(lazy(() => segmentFilterSchema)))), - ], - bookingId: ['booking_id', optional(nullable(string()))], - } -); diff --git a/src/models/searchAvailabilityQuery.ts b/src/models/searchAvailabilityQuery.ts deleted file mode 100644 index ad450919d..000000000 --- a/src/models/searchAvailabilityQuery.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { - SearchAvailabilityFilter, - searchAvailabilityFilterSchema, -} from './searchAvailabilityFilter'; - -/** The query used to search for buyer-accessible availabilities of bookings. */ -export interface SearchAvailabilityQuery { - /** A query filter to search for buyer-accessible availabilities by. */ - filter: SearchAvailabilityFilter; -} - -export const searchAvailabilityQuerySchema: Schema = object( - { filter: ['filter', lazy(() => searchAvailabilityFilterSchema)] } -); diff --git a/src/models/searchAvailabilityRequest.ts b/src/models/searchAvailabilityRequest.ts deleted file mode 100644 index 1d34cf7ad..000000000 --- a/src/models/searchAvailabilityRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { - SearchAvailabilityQuery, - searchAvailabilityQuerySchema, -} from './searchAvailabilityQuery'; - -export interface SearchAvailabilityRequest { - /** The query used to search for buyer-accessible availabilities of bookings. */ - query: SearchAvailabilityQuery; -} - -export const searchAvailabilityRequestSchema: Schema = object( - { query: ['query', lazy(() => searchAvailabilityQuerySchema)] } -); diff --git a/src/models/searchAvailabilityResponse.ts b/src/models/searchAvailabilityResponse.ts deleted file mode 100644 index a3f6b5538..000000000 --- a/src/models/searchAvailabilityResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Availability, availabilitySchema } from './availability'; -import { Error, errorSchema } from './error'; - -export interface SearchAvailabilityResponse { - /** List of appointment slots available for booking. */ - availabilities?: Availability[]; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const searchAvailabilityResponseSchema: Schema = object( - { - availabilities: [ - 'availabilities', - optional(array(lazy(() => availabilitySchema))), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/searchCatalogItemsRequest.ts b/src/models/searchCatalogItemsRequest.ts deleted file mode 100644 index 8f3d5da3e..000000000 --- a/src/models/searchCatalogItemsRequest.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - array, - lazy, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - CustomAttributeFilter, - customAttributeFilterSchema, -} from './customAttributeFilter'; - -/** Defines the request body for the [SearchCatalogItems]($e/Catalog/SearchCatalogItems) endpoint. */ -export interface SearchCatalogItemsRequest { - /** - * The text filter expression to return items or item variations containing specified text in - * the `name`, `description`, or `abbreviation` attribute value of an item, or in - * the `name`, `sku`, or `upc` attribute value of an item variation. - */ - textFilter?: string; - /** The category id query expression to return items containing the specified category IDs. */ - categoryIds?: string[]; - /** - * The stock-level query expression to return item variations with the specified stock levels. - * See [SearchCatalogItemsRequestStockLevel](#type-searchcatalogitemsrequeststocklevel) for possible values - */ - stockLevels?: string[]; - /** The enabled-location query expression to return items and item variations having specified enabled locations. */ - enabledLocationIds?: string[]; - /** The pagination token, returned in the previous response, used to fetch the next batch of pending results. */ - cursor?: string; - /** The maximum number of results to return per page. The default value is 100. */ - limit?: number; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; - /** The product types query expression to return items or item variations having the specified product types. */ - productTypes?: string[]; - /** - * The customer-attribute filter to return items or item variations matching the specified - * custom attribute expressions. A maximum number of 10 custom attribute expressions are supported in - * a single call to the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint. - */ - customAttributeFilters?: CustomAttributeFilter[]; - /** - * Defines the values for the `archived_state` query expression - * used in [SearchCatalogItems]($e/Catalog/SearchCatalogItems) - * to return the archived, not archived or either type of catalog items. - */ - archivedState?: string; -} - -export const searchCatalogItemsRequestSchema: Schema = object( - { - textFilter: ['text_filter', optional(string())], - categoryIds: ['category_ids', optional(array(string()))], - stockLevels: ['stock_levels', optional(array(string()))], - enabledLocationIds: ['enabled_location_ids', optional(array(string()))], - cursor: ['cursor', optional(string())], - limit: ['limit', optional(number())], - sortOrder: ['sort_order', optional(string())], - productTypes: ['product_types', optional(array(string()))], - customAttributeFilters: [ - 'custom_attribute_filters', - optional(array(lazy(() => customAttributeFilterSchema))), - ], - archivedState: ['archived_state', optional(string())], - } -); diff --git a/src/models/searchCatalogItemsResponse.ts b/src/models/searchCatalogItemsResponse.ts deleted file mode 100644 index 8f3862e3a..000000000 --- a/src/models/searchCatalogItemsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -/** Defines the response body returned from the [SearchCatalogItems]($e/Catalog/SearchCatalogItems) endpoint. */ -export interface SearchCatalogItemsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Returned items matching the specified query expressions. */ - items?: CatalogObject[]; - /** Pagination token used in the next request to return more of the search result. */ - cursor?: string; - /** Ids of returned item variations matching the specified query expression. */ - matchedVariationIds?: string[]; -} - -export const searchCatalogItemsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - items: ['items', optional(array(lazy(() => catalogObjectSchema)))], - cursor: ['cursor', optional(string())], - matchedVariationIds: ['matched_variation_ids', optional(array(string()))], - } -); diff --git a/src/models/searchCatalogObjectsRequest.ts b/src/models/searchCatalogObjectsRequest.ts deleted file mode 100644 index 738dff927..000000000 --- a/src/models/searchCatalogObjectsRequest.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { - array, - boolean, - lazy, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { CatalogQuery, catalogQuerySchema } from './catalogQuery'; - -export interface SearchCatalogObjectsRequest { - /** - * The pagination cursor returned in the previous response. Leave unset for an initial request. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string; - /** - * The desired set of object types to appear in the search results. - * If this is unspecified, the operation returns objects of all the top level types at the version - * of the Square API used to make the request. Object types that are nested onto other object types - * are not included in the defaults. - * At the current API version the default object types are: - * ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, - * PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT, - * SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. - * Note that if you wish for the query to return objects belonging to nested types (i.e., COMPONENT, IMAGE, - * ITEM_OPTION_VAL, ITEM_VARIATION, or MODIFIER), you must explicitly include all the types of interest - * in this field. - */ - objectTypes?: string[]; - /** - * If `true`, deleted objects will be included in the results. Deleted objects will have their - * `is_deleted` field set to `true`. - */ - includeDeletedObjects?: boolean; - /** - * If `true`, the response will include additional objects that are related to the - * requested objects. Related objects are objects that are referenced by object ID by the objects - * in the response. This is helpful if the objects are being fetched for immediate display to a user. - * This process only goes one level deep. Objects referenced by the related objects will not be included. - * For example: - * If the `objects` field of the response contains a CatalogItem, its associated - * CatalogCategory objects, CatalogTax objects, CatalogImage objects and - * CatalogModifierLists will be returned in the `related_objects` field of the - * response. If the `objects` field of the response contains a CatalogItemVariation, - * its parent CatalogItem will be returned in the `related_objects` field of - * the response. - * Default value: `false` - */ - includeRelatedObjects?: boolean; - /** - * Return objects modified after this [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), in RFC 3339 - * format, e.g., `2016-09-04T23:59:33.123Z`. The timestamp is exclusive - objects with a - * timestamp equal to `begin_time` will not be included in the response. - */ - beginTime?: string; - /** - * A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint. - * Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects). - * Any combination of the following types may be used together: - * - [exact_query]($m/CatalogQueryExact) - * - [prefix_query]($m/CatalogQueryPrefix) - * - [range_query]($m/CatalogQueryRange) - * - [sorted_attribute_query]($m/CatalogQuerySortedAttribute) - * - [text_query]($m/CatalogQueryText) - * All other query types cannot be combined with any others. - * When a query filter is based on an attribute, the attribute must be searchable. - * Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters. - * Searchable attribute and objects queryable by searchable attributes: - * - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue` - * - `description`: `CatalogItem`, `CatalogItemOptionValue` - * - `abbreviation`: `CatalogItem` - * - `upc`: `CatalogItemVariation` - * - `sku`: `CatalogItemVariation` - * - `caption`: `CatalogImage` - * - `display_name`: `CatalogItemOption` - * For example, to search for [CatalogItem]($m/CatalogItem) objects by searchable attributes, you can use - * the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter. - */ - query?: CatalogQuery; - /** - * A limit on the number of results to be returned in a single page. The limit is advisory - - * the implementation may return more or fewer results. If the supplied limit is negative, zero, or - * is higher than the maximum limit of 1,000, it will be ignored. - */ - limit?: number; - /** - * Specifies whether or not to include the `path_to_root` list for each returned category instance. The `path_to_root` list consists - * of `CategoryPathToRootNode` objects and specifies the path that starts with the immediate parent category of the returned category - * and ends with its root category. If the returned category is a top-level category, the `path_to_root` list is empty and is not returned - * in the response payload. - */ - includeCategoryPathToRoot?: boolean; -} - -export const searchCatalogObjectsRequestSchema: Schema = object( - { - cursor: ['cursor', optional(string())], - objectTypes: ['object_types', optional(array(string()))], - includeDeletedObjects: ['include_deleted_objects', optional(boolean())], - includeRelatedObjects: ['include_related_objects', optional(boolean())], - beginTime: ['begin_time', optional(string())], - query: ['query', optional(lazy(() => catalogQuerySchema))], - limit: ['limit', optional(number())], - includeCategoryPathToRoot: [ - 'include_category_path_to_root', - optional(boolean()), - ], - } -); diff --git a/src/models/searchCatalogObjectsResponse.ts b/src/models/searchCatalogObjectsResponse.ts deleted file mode 100644 index f81243008..000000000 --- a/src/models/searchCatalogObjectsResponse.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -export interface SearchCatalogObjectsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The pagination cursor to be used in a subsequent request. If unset, this is the final response. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string; - /** The CatalogObjects returned. */ - objects?: CatalogObject[]; - /** A list of CatalogObjects referenced by the objects in the `objects` field. */ - relatedObjects?: CatalogObject[]; - /** - * When the associated product catalog was last updated. Will - * match the value for `end_time` or `cursor` if either field is included in the `SearchCatalog` request. - */ - latestTime?: string; -} - -export const searchCatalogObjectsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - cursor: ['cursor', optional(string())], - objects: ['objects', optional(array(lazy(() => catalogObjectSchema)))], - relatedObjects: [ - 'related_objects', - optional(array(lazy(() => catalogObjectSchema))), - ], - latestTime: ['latest_time', optional(string())], - } -); diff --git a/src/models/searchCustomersRequest.ts b/src/models/searchCustomersRequest.ts deleted file mode 100644 index dee8c2070..000000000 --- a/src/models/searchCustomersRequest.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - bigint, - boolean, - lazy, - object, - optional, - Schema, - string, -} from '../schema'; -import { CustomerQuery, customerQuerySchema } from './customerQuery'; - -/** - * Defines the fields that are included in the request body of a request to the - * `SearchCustomers` endpoint. - */ -export interface SearchCustomersRequest { - /** - * Include the pagination cursor in subsequent calls to this endpoint to retrieve - * the next set of results associated with the original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** - * The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. - * If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - limit?: bigint; - /** Represents filtering and sorting criteria for a [SearchCustomers]($e/Customers/SearchCustomers) request. */ - query?: CustomerQuery; - /** - * Indicates whether to return the total count of matching customers in the `count` field of the response. - * The default value is `false`. - */ - count?: boolean; -} - -export const searchCustomersRequestSchema: Schema = object( - { - cursor: ['cursor', optional(string())], - limit: ['limit', optional(bigint())], - query: ['query', optional(lazy(() => customerQuerySchema))], - count: ['count', optional(boolean())], - } -); diff --git a/src/models/searchCustomersResponse.ts b/src/models/searchCustomersResponse.ts deleted file mode 100644 index fa03ec571..000000000 --- a/src/models/searchCustomersResponse.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - array, - bigint, - lazy, - object, - optional, - Schema, - string, -} from '../schema'; -import { Customer, customerSchema } from './customer'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the `SearchCustomers` endpoint. - * Either `errors` or `customers` is present in a given response (never both). - */ -export interface SearchCustomersResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The customer profiles that match the search query. If any search condition is not met, the result is an empty object (`{}`). - * Only customer profiles with public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) - * are included in the response. - */ - customers?: Customer[]; - /** - * A pagination cursor that can be used during subsequent calls - * to `SearchCustomers` to retrieve the next set of results associated - * with the original query. Pagination cursors are only present when - * a request succeeds and additional results are available. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** - * The total count of customers associated with the Square account that match the search query. Only customer profiles with - * public information (`given_name`, `family_name`, `company_name`, `email_address`, or `phone_number`) are counted. This field is - * present only if `count` is set to `true` in the request. - */ - count?: bigint; -} - -export const searchCustomersResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - customers: ['customers', optional(array(lazy(() => customerSchema)))], - cursor: ['cursor', optional(string())], - count: ['count', optional(bigint())], - } -); diff --git a/src/models/searchEventsFilter.ts b/src/models/searchEventsFilter.ts deleted file mode 100644 index 758a70660..000000000 --- a/src/models/searchEventsFilter.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -/** Criteria to filter events by. */ -export interface SearchEventsFilter { - /** Filter events by event types. */ - eventTypes?: string[] | null; - /** Filter events by merchant. */ - merchantIds?: string[] | null; - /** Filter events by location. */ - locationIds?: string[] | null; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - createdAt?: TimeRange; -} - -export const searchEventsFilterSchema: Schema = object({ - eventTypes: ['event_types', optional(nullable(array(string())))], - merchantIds: ['merchant_ids', optional(nullable(array(string())))], - locationIds: ['location_ids', optional(nullable(array(string())))], - createdAt: ['created_at', optional(lazy(() => timeRangeSchema))], -}); diff --git a/src/models/searchEventsQuery.ts b/src/models/searchEventsQuery.ts deleted file mode 100644 index 30c12ae16..000000000 --- a/src/models/searchEventsQuery.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - SearchEventsFilter, - searchEventsFilterSchema, -} from './searchEventsFilter'; -import { SearchEventsSort, searchEventsSortSchema } from './searchEventsSort'; - -/** Contains query criteria for the search. */ -export interface SearchEventsQuery { - /** Criteria to filter events by. */ - filter?: SearchEventsFilter; - /** Criteria to sort events by. */ - sort?: SearchEventsSort; -} - -export const searchEventsQuerySchema: Schema = object({ - filter: ['filter', optional(lazy(() => searchEventsFilterSchema))], - sort: ['sort', optional(lazy(() => searchEventsSortSchema))], -}); diff --git a/src/models/searchEventsRequest.ts b/src/models/searchEventsRequest.ts deleted file mode 100644 index 0da67a67b..000000000 --- a/src/models/searchEventsRequest.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - SearchEventsQuery, - searchEventsQuerySchema, -} from './searchEventsQuery'; - -/** Searches [Event]($m/Event)s for your application. */ -export interface SearchEventsRequest { - /** - * A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of events for your original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** - * The maximum number of events to return in a single page. The response might contain fewer events. The default value is 100, which is also the maximum allowed value. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - * Default: 100 - */ - limit?: number; - /** Contains query criteria for the search. */ - query?: SearchEventsQuery; -} - -export const searchEventsRequestSchema: Schema = object({ - cursor: ['cursor', optional(string())], - limit: ['limit', optional(number())], - query: ['query', optional(lazy(() => searchEventsQuerySchema))], -}); diff --git a/src/models/searchEventsResponse.ts b/src/models/searchEventsResponse.ts deleted file mode 100644 index 1afed6490..000000000 --- a/src/models/searchEventsResponse.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Event, eventSchema } from './event'; -import { EventMetadata, eventMetadataSchema } from './eventMetadata'; - -/** - * Defines the fields that are included in the response body of - * a request to the [SearchEvents]($e/Events/SearchEvents) endpoint. - * Note: if there are errors processing the request, the events field will not be - * present. - */ -export interface SearchEventsResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** The list of [Event](entity:Event)s returned by the search. */ - events?: Event[]; - /** Contains the metadata of an event. For more information, see [Event](entity:Event). */ - metadata?: EventMetadata[]; - /** - * When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch the next set of events. If empty, this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const searchEventsResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - events: ['events', optional(array(lazy(() => eventSchema)))], - metadata: ['metadata', optional(array(lazy(() => eventMetadataSchema)))], - cursor: ['cursor', optional(string())], -}); diff --git a/src/models/searchEventsSort.ts b/src/models/searchEventsSort.ts deleted file mode 100644 index c47c3d4d2..000000000 --- a/src/models/searchEventsSort.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Criteria to sort events by. */ -export interface SearchEventsSort { - /** Specifies the sort key for events returned from a search. */ - field?: string; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - order?: string; -} - -export const searchEventsSortSchema: Schema = object({ - field: ['field', optional(string())], - order: ['order', optional(string())], -}); diff --git a/src/models/searchInvoicesRequest.ts b/src/models/searchInvoicesRequest.ts deleted file mode 100644 index 7ec5bac1b..000000000 --- a/src/models/searchInvoicesRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { InvoiceQuery, invoiceQuerySchema } from './invoiceQuery'; - -/** Describes a `SearchInvoices` request. */ -export interface SearchInvoicesRequest { - /** Describes query criteria for searching invoices. */ - query: InvoiceQuery; - /** - * The maximum number of invoices to return (200 is the maximum `limit`). - * If not provided, the server uses a default limit of 100 invoices. - */ - limit?: number; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for your original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const searchInvoicesRequestSchema: Schema = object( - { - query: ['query', lazy(() => invoiceQuerySchema)], - limit: ['limit', optional(number())], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchInvoicesResponse.ts b/src/models/searchInvoicesResponse.ts deleted file mode 100644 index 5d507bb45..000000000 --- a/src/models/searchInvoicesResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Invoice, invoiceSchema } from './invoice'; - -/** Describes a `SearchInvoices` response. */ -export interface SearchInvoicesResponse { - /** The list of invoices returned by the search. */ - invoices?: Invoice[]; - /** - * When a response is truncated, it includes a cursor that you can use in a - * subsequent request to fetch the next set of invoices. If empty, this is the final - * response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const searchInvoicesResponseSchema: Schema = object( - { - invoices: ['invoices', optional(array(lazy(() => invoiceSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/searchLoyaltyAccountsRequest.ts b/src/models/searchLoyaltyAccountsRequest.ts deleted file mode 100644 index 40434f1ef..000000000 --- a/src/models/searchLoyaltyAccountsRequest.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - SearchLoyaltyAccountsRequestLoyaltyAccountQuery, - searchLoyaltyAccountsRequestLoyaltyAccountQuerySchema, -} from './searchLoyaltyAccountsRequestLoyaltyAccountQuery'; - -/** A request to search for loyalty accounts. */ -export interface SearchLoyaltyAccountsRequest { - /** The search criteria for the loyalty accounts. */ - query?: SearchLoyaltyAccountsRequestLoyaltyAccountQuery; - /** The maximum number of results to include in the response. The default value is 30. */ - limit?: number; - /** - * A pagination cursor returned by a previous call to - * this endpoint. Provide this to retrieve the next set of - * results for the original query. - * For more information, - * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const searchLoyaltyAccountsRequestSchema: Schema = object( - { - query: [ - 'query', - optional( - lazy(() => searchLoyaltyAccountsRequestLoyaltyAccountQuerySchema) - ), - ], - limit: ['limit', optional(number())], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchLoyaltyAccountsRequestLoyaltyAccountQuery.ts b/src/models/searchLoyaltyAccountsRequestLoyaltyAccountQuery.ts deleted file mode 100644 index b8494426d..000000000 --- a/src/models/searchLoyaltyAccountsRequestLoyaltyAccountQuery.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - LoyaltyAccountMapping, - loyaltyAccountMappingSchema, -} from './loyaltyAccountMapping'; - -/** The search criteria for the loyalty accounts. */ -export interface SearchLoyaltyAccountsRequestLoyaltyAccountQuery { - /** - * The set of mappings to use in the loyalty account search. - * This cannot be combined with `customer_ids`. - * Max: 30 mappings - */ - mappings?: LoyaltyAccountMapping[] | null; - /** - * The set of customer IDs to use in the loyalty account search. - * This cannot be combined with `mappings`. - * Max: 30 customer IDs - */ - customerIds?: string[] | null; -} - -export const searchLoyaltyAccountsRequestLoyaltyAccountQuerySchema: Schema = object( - { - mappings: [ - 'mappings', - optional(nullable(array(lazy(() => loyaltyAccountMappingSchema)))), - ], - customerIds: ['customer_ids', optional(nullable(array(string())))], - } -); diff --git a/src/models/searchLoyaltyAccountsResponse.ts b/src/models/searchLoyaltyAccountsResponse.ts deleted file mode 100644 index ce4c985eb..000000000 --- a/src/models/searchLoyaltyAccountsResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyAccount, loyaltyAccountSchema } from './loyaltyAccount'; - -/** A response that includes loyalty accounts that satisfy the search criteria. */ -export interface SearchLoyaltyAccountsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The loyalty accounts that met the search criteria, - * in order of creation date. - */ - loyaltyAccounts?: LoyaltyAccount[]; - /** - * The pagination cursor to use in a subsequent - * request. If empty, this is the final response. - * For more information, - * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const searchLoyaltyAccountsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - loyaltyAccounts: [ - 'loyalty_accounts', - optional(array(lazy(() => loyaltyAccountSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchLoyaltyEventsRequest.ts b/src/models/searchLoyaltyEventsRequest.ts deleted file mode 100644 index 6f4654fbf..000000000 --- a/src/models/searchLoyaltyEventsRequest.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - LoyaltyEventQuery, - loyaltyEventQuerySchema, -} from './loyaltyEventQuery'; - -/** A request to search for loyalty events. */ -export interface SearchLoyaltyEventsRequest { - /** Represents a query used to search for loyalty events. */ - query?: LoyaltyEventQuery; - /** - * The maximum number of results to include in the response. - * The last page might contain fewer events. - * The default is 30 events. - */ - limit?: number; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for your original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const searchLoyaltyEventsRequestSchema: Schema = object( - { - query: ['query', optional(lazy(() => loyaltyEventQuerySchema))], - limit: ['limit', optional(number())], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchLoyaltyEventsResponse.ts b/src/models/searchLoyaltyEventsResponse.ts deleted file mode 100644 index cb40bc2fc..000000000 --- a/src/models/searchLoyaltyEventsResponse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyEvent, loyaltyEventSchema } from './loyaltyEvent'; - -/** - * A response that contains loyalty events that satisfy the search - * criteria, in order by the `created_at` date. - */ -export interface SearchLoyaltyEventsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The loyalty events that satisfy the search criteria. */ - events?: LoyaltyEvent[]; - /** - * The pagination cursor to be used in a subsequent - * request. If empty, this is the final response. - * For more information, - * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const searchLoyaltyEventsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - events: ['events', optional(array(lazy(() => loyaltyEventSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchLoyaltyRewardsRequest.ts b/src/models/searchLoyaltyRewardsRequest.ts deleted file mode 100644 index 705513a3b..000000000 --- a/src/models/searchLoyaltyRewardsRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - SearchLoyaltyRewardsRequestLoyaltyRewardQuery, - searchLoyaltyRewardsRequestLoyaltyRewardQuerySchema, -} from './searchLoyaltyRewardsRequestLoyaltyRewardQuery'; - -/** A request to search for loyalty rewards. */ -export interface SearchLoyaltyRewardsRequest { - /** The set of search requirements. */ - query?: SearchLoyaltyRewardsRequestLoyaltyRewardQuery; - /** The maximum number of results to return in the response. The default value is 30. */ - limit?: number; - /** - * A pagination cursor returned by a previous call to - * this endpoint. Provide this to retrieve the next set of - * results for the original query. - * For more information, - * see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; -} - -export const searchLoyaltyRewardsRequestSchema: Schema = object( - { - query: [ - 'query', - optional(lazy(() => searchLoyaltyRewardsRequestLoyaltyRewardQuerySchema)), - ], - limit: ['limit', optional(number())], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchLoyaltyRewardsRequestLoyaltyRewardQuery.ts b/src/models/searchLoyaltyRewardsRequestLoyaltyRewardQuery.ts deleted file mode 100644 index 7c7499f66..000000000 --- a/src/models/searchLoyaltyRewardsRequestLoyaltyRewardQuery.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** The set of search requirements. */ -export interface SearchLoyaltyRewardsRequestLoyaltyRewardQuery { - /** The ID of the [loyalty account](entity:LoyaltyAccount) to which the loyalty reward belongs. */ - loyaltyAccountId: string; - /** The status of the loyalty reward. */ - status?: string; -} - -export const searchLoyaltyRewardsRequestLoyaltyRewardQuerySchema: Schema = object( - { - loyaltyAccountId: ['loyalty_account_id', string()], - status: ['status', optional(string())], - } -); diff --git a/src/models/searchLoyaltyRewardsResponse.ts b/src/models/searchLoyaltyRewardsResponse.ts deleted file mode 100644 index f38ab91cf..000000000 --- a/src/models/searchLoyaltyRewardsResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { LoyaltyReward, loyaltyRewardSchema } from './loyaltyReward'; - -/** A response that includes the loyalty rewards satisfying the search criteria. */ -export interface SearchLoyaltyRewardsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The loyalty rewards that satisfy the search criteria. - * These are returned in descending order by `updated_at`. - */ - rewards?: LoyaltyReward[]; - /** - * The pagination cursor to be used in a subsequent - * request. If empty, this is the final response. - */ - cursor?: string; -} - -export const searchLoyaltyRewardsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - rewards: ['rewards', optional(array(lazy(() => loyaltyRewardSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchOrdersCustomerFilter.ts b/src/models/searchOrdersCustomerFilter.ts deleted file mode 100644 index 2205e6194..000000000 --- a/src/models/searchOrdersCustomerFilter.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** - * A filter based on the order `customer_id` and any tender `customer_id` - * associated with the order. It does not filter based on the - * [FulfillmentRecipient]($m/FulfillmentRecipient) `customer_id`. - */ -export interface SearchOrdersCustomerFilter { - /** - * A list of customer IDs to filter by. - * Max: 10 customer ids. - */ - customerIds?: string[] | null; -} - -export const searchOrdersCustomerFilterSchema: Schema = object( - { customerIds: ['customer_ids', optional(nullable(array(string())))] } -); diff --git a/src/models/searchOrdersDateTimeFilter.ts b/src/models/searchOrdersDateTimeFilter.ts deleted file mode 100644 index f7086fe1d..000000000 --- a/src/models/searchOrdersDateTimeFilter.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -/** - * Filter for `Order` objects based on whether their `CREATED_AT`, - * `CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range. - * You can specify the time range and which timestamp to filter for. You can filter - * for only one time range at a time. - * For each time range, the start time and end time are inclusive. If the end time - * is absent, it defaults to the time of the first request for the cursor. - * __Important:__ If you use the `DateTimeFilter` in a `SearchOrders` query, - * you must set the `sort_field` in [OrdersSort]($m/SearchOrdersSort) - * to the same field you filter for. For example, if you set the `CLOSED_AT` field - * in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to - * `CLOSED_AT`. Otherwise, `SearchOrders` throws an error. - * [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) - */ -export interface SearchOrdersDateTimeFilter { - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - createdAt?: TimeRange; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - updatedAt?: TimeRange; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - closedAt?: TimeRange; -} - -export const searchOrdersDateTimeFilterSchema: Schema = object( - { - createdAt: ['created_at', optional(lazy(() => timeRangeSchema))], - updatedAt: ['updated_at', optional(lazy(() => timeRangeSchema))], - closedAt: ['closed_at', optional(lazy(() => timeRangeSchema))], - } -); diff --git a/src/models/searchOrdersFilter.ts b/src/models/searchOrdersFilter.ts deleted file mode 100644 index 65291e48a..000000000 --- a/src/models/searchOrdersFilter.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - SearchOrdersCustomerFilter, - searchOrdersCustomerFilterSchema, -} from './searchOrdersCustomerFilter'; -import { - SearchOrdersDateTimeFilter, - searchOrdersDateTimeFilterSchema, -} from './searchOrdersDateTimeFilter'; -import { - SearchOrdersFulfillmentFilter, - searchOrdersFulfillmentFilterSchema, -} from './searchOrdersFulfillmentFilter'; -import { - SearchOrdersSourceFilter, - searchOrdersSourceFilterSchema, -} from './searchOrdersSourceFilter'; -import { - SearchOrdersStateFilter, - searchOrdersStateFilterSchema, -} from './searchOrdersStateFilter'; - -/** - * Filtering criteria to use for a `SearchOrders` request. Multiple filters - * are ANDed together. - */ -export interface SearchOrdersFilter { - /** Filter by the current order `state`. */ - stateFilter?: SearchOrdersStateFilter; - /** - * Filter for `Order` objects based on whether their `CREATED_AT`, - * `CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range. - * You can specify the time range and which timestamp to filter for. You can filter - * for only one time range at a time. - * For each time range, the start time and end time are inclusive. If the end time - * is absent, it defaults to the time of the first request for the cursor. - * __Important:__ If you use the `DateTimeFilter` in a `SearchOrders` query, - * you must set the `sort_field` in [OrdersSort]($m/SearchOrdersSort) - * to the same field you filter for. For example, if you set the `CLOSED_AT` field - * in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to - * `CLOSED_AT`. Otherwise, `SearchOrders` throws an error. - * [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) - */ - dateTimeFilter?: SearchOrdersDateTimeFilter; - /** Filter based on [order fulfillment]($m/Fulfillment) information. */ - fulfillmentFilter?: SearchOrdersFulfillmentFilter; - /** A filter based on order `source` information. */ - sourceFilter?: SearchOrdersSourceFilter; - /** - * A filter based on the order `customer_id` and any tender `customer_id` - * associated with the order. It does not filter based on the - * [FulfillmentRecipient]($m/FulfillmentRecipient) `customer_id`. - */ - customerFilter?: SearchOrdersCustomerFilter; -} - -export const searchOrdersFilterSchema: Schema = object({ - stateFilter: [ - 'state_filter', - optional(lazy(() => searchOrdersStateFilterSchema)), - ], - dateTimeFilter: [ - 'date_time_filter', - optional(lazy(() => searchOrdersDateTimeFilterSchema)), - ], - fulfillmentFilter: [ - 'fulfillment_filter', - optional(lazy(() => searchOrdersFulfillmentFilterSchema)), - ], - sourceFilter: [ - 'source_filter', - optional(lazy(() => searchOrdersSourceFilterSchema)), - ], - customerFilter: [ - 'customer_filter', - optional(lazy(() => searchOrdersCustomerFilterSchema)), - ], -}); diff --git a/src/models/searchOrdersFulfillmentFilter.ts b/src/models/searchOrdersFulfillmentFilter.ts deleted file mode 100644 index 1e34940be..000000000 --- a/src/models/searchOrdersFulfillmentFilter.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** Filter based on [order fulfillment]($m/Fulfillment) information. */ -export interface SearchOrdersFulfillmentFilter { - /** - * A list of [fulfillment types](entity:FulfillmentType) to filter - * for. The list returns orders if any of its fulfillments match any of the fulfillment types - * listed in this field. - * See [FulfillmentType](#type-fulfillmenttype) for possible values - */ - fulfillmentTypes?: string[] | null; - /** - * A list of [fulfillment states](entity:FulfillmentState) to filter - * for. The list returns orders if any of its fulfillments match any of the - * fulfillment states listed in this field. - * See [FulfillmentState](#type-fulfillmentstate) for possible values - */ - fulfillmentStates?: string[] | null; -} - -export const searchOrdersFulfillmentFilterSchema: Schema = object( - { - fulfillmentTypes: [ - 'fulfillment_types', - optional(nullable(array(string()))), - ], - fulfillmentStates: [ - 'fulfillment_states', - optional(nullable(array(string()))), - ], - } -); diff --git a/src/models/searchOrdersQuery.ts b/src/models/searchOrdersQuery.ts deleted file mode 100644 index 9abf247b1..000000000 --- a/src/models/searchOrdersQuery.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - SearchOrdersFilter, - searchOrdersFilterSchema, -} from './searchOrdersFilter'; -import { SearchOrdersSort, searchOrdersSortSchema } from './searchOrdersSort'; - -/** Contains query criteria for the search. */ -export interface SearchOrdersQuery { - /** - * Filtering criteria to use for a `SearchOrders` request. Multiple filters - * are ANDed together. - */ - filter?: SearchOrdersFilter; - /** - * Sorting criteria for a `SearchOrders` request. Results can only be sorted - * by a timestamp field. - */ - sort?: SearchOrdersSort; -} - -export const searchOrdersQuerySchema: Schema = object({ - filter: ['filter', optional(lazy(() => searchOrdersFilterSchema))], - sort: ['sort', optional(lazy(() => searchOrdersSortSchema))], -}); diff --git a/src/models/searchOrdersRequest.ts b/src/models/searchOrdersRequest.ts deleted file mode 100644 index 9c3ebaabe..000000000 --- a/src/models/searchOrdersRequest.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { - array, - boolean, - lazy, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - SearchOrdersQuery, - searchOrdersQuerySchema, -} from './searchOrdersQuery'; - -export interface SearchOrdersRequest { - /** - * The location IDs for the orders to query. All locations must belong to - * the same merchant. - * Max: 10 location IDs. - */ - locationIds?: string[]; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for your original query. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** Contains query criteria for the search. */ - query?: SearchOrdersQuery; - /** - * The maximum number of results to be returned in a single page. - * Default: `500` - * Max: `1000` - */ - limit?: number; - /** - * A Boolean that controls the format of the search results. If `true`, - * `SearchOrders` returns [OrderEntry](entity:OrderEntry) objects. If `false`, `SearchOrders` - * returns complete order objects. - * Default: `false`. - */ - returnEntries?: boolean; -} - -export const searchOrdersRequestSchema: Schema = object({ - locationIds: ['location_ids', optional(array(string()))], - cursor: ['cursor', optional(string())], - query: ['query', optional(lazy(() => searchOrdersQuerySchema))], - limit: ['limit', optional(number())], - returnEntries: ['return_entries', optional(boolean())], -}); diff --git a/src/models/searchOrdersResponse.ts b/src/models/searchOrdersResponse.ts deleted file mode 100644 index cd7ab79b0..000000000 --- a/src/models/searchOrdersResponse.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Order, orderSchema } from './order'; -import { OrderEntry, orderEntrySchema } from './orderEntry'; - -/** - * Either the `order_entries` or `orders` field is set, depending on whether - * `return_entries` is set on the [SearchOrdersRequest]($e/Orders/SearchOrders). - */ -export interface SearchOrdersResponse { - /** - * A list of [OrderEntries](entity:OrderEntry) that fit the query - * conditions. The list is populated only if `return_entries` is set to `true` in the request. - */ - orderEntries?: OrderEntry[]; - /** - * A list of - * [Order](entity:Order) objects that match the query conditions. The list is populated only if - * `return_entries` is set to `false` in the request. - */ - orders?: Order[]; - /** - * The pagination cursor to be used in a subsequent request. If unset, - * this is the final response. - * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** [Errors](entity:Error) encountered during the search. */ - errors?: Error[]; -} - -export const searchOrdersResponseSchema: Schema = object({ - orderEntries: [ - 'order_entries', - optional(array(lazy(() => orderEntrySchema))), - ], - orders: ['orders', optional(array(lazy(() => orderSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/searchOrdersSort.ts b/src/models/searchOrdersSort.ts deleted file mode 100644 index 81d0eb419..000000000 --- a/src/models/searchOrdersSort.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Sorting criteria for a `SearchOrders` request. Results can only be sorted - * by a timestamp field. - */ -export interface SearchOrdersSort { - /** Specifies which timestamp to use to sort `SearchOrder` results. */ - sortField: string; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; -} - -export const searchOrdersSortSchema: Schema = object({ - sortField: ['sort_field', string()], - sortOrder: ['sort_order', optional(string())], -}); diff --git a/src/models/searchOrdersSourceFilter.ts b/src/models/searchOrdersSourceFilter.ts deleted file mode 100644 index fbd071c98..000000000 --- a/src/models/searchOrdersSourceFilter.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** A filter based on order `source` information. */ -export interface SearchOrdersSourceFilter { - /** - * Filters by the [Source](entity:OrderSource) `name`. The filter returns any orders - * with a `source.name` that matches any of the listed source names. - * Max: 10 source names. - */ - sourceNames?: string[] | null; -} - -export const searchOrdersSourceFilterSchema: Schema = object( - { sourceNames: ['source_names', optional(nullable(array(string())))] } -); diff --git a/src/models/searchOrdersStateFilter.ts b/src/models/searchOrdersStateFilter.ts deleted file mode 100644 index 241d7b8b2..000000000 --- a/src/models/searchOrdersStateFilter.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { array, object, Schema, string } from '../schema'; - -/** Filter by the current order `state`. */ -export interface SearchOrdersStateFilter { - /** - * States to filter for. - * See [OrderState](#type-orderstate) for possible values - */ - states: string[]; -} - -export const searchOrdersStateFilterSchema: Schema = object( - { states: ['states', array(string())] } -); diff --git a/src/models/searchShiftsRequest.ts b/src/models/searchShiftsRequest.ts deleted file mode 100644 index a5de60e2f..000000000 --- a/src/models/searchShiftsRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { ShiftQuery, shiftQuerySchema } from './shiftQuery'; - -/** A request for a filtered and sorted set of `Shift` objects. */ -export interface SearchShiftsRequest { - /** The parameters of a `Shift` search query, which includes filter and sort options. */ - query?: ShiftQuery; - /** The number of resources in a page (200 by default). */ - limit?: number; - /** An opaque cursor for fetching the next page. */ - cursor?: string; -} - -export const searchShiftsRequestSchema: Schema = object({ - query: ['query', optional(lazy(() => shiftQuerySchema))], - limit: ['limit', optional(number())], - cursor: ['cursor', optional(string())], -}); diff --git a/src/models/searchShiftsResponse.ts b/src/models/searchShiftsResponse.ts deleted file mode 100644 index 1571bef02..000000000 --- a/src/models/searchShiftsResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Shift, shiftSchema } from './shift'; - -/** - * The response to a request for `Shift` objects. The response contains - * the requested `Shift` objects and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface SearchShiftsResponse { - /** Shifts. */ - shifts?: Shift[]; - /** An opaque cursor for fetching the next page. */ - cursor?: string; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const searchShiftsResponseSchema: Schema = object({ - shifts: ['shifts', optional(array(lazy(() => shiftSchema)))], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/searchSubscriptionsFilter.ts b/src/models/searchSubscriptionsFilter.ts deleted file mode 100644 index c0808c0e5..000000000 --- a/src/models/searchSubscriptionsFilter.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** - * Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by - * the [SearchSubscriptions]($e/Subscriptions/SearchSubscriptions) endpoint. - */ -export interface SearchSubscriptionsFilter { - /** A filter to select subscriptions based on the subscribing customer IDs. */ - customerIds?: string[] | null; - /** A filter to select subscriptions based on the location. */ - locationIds?: string[] | null; - /** A filter to select subscriptions based on the source application. */ - sourceNames?: string[] | null; -} - -export const searchSubscriptionsFilterSchema: Schema = object( - { - customerIds: ['customer_ids', optional(nullable(array(string())))], - locationIds: ['location_ids', optional(nullable(array(string())))], - sourceNames: ['source_names', optional(nullable(array(string())))], - } -); diff --git a/src/models/searchSubscriptionsQuery.ts b/src/models/searchSubscriptionsQuery.ts deleted file mode 100644 index 85e5749c7..000000000 --- a/src/models/searchSubscriptionsQuery.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - SearchSubscriptionsFilter, - searchSubscriptionsFilterSchema, -} from './searchSubscriptionsFilter'; - -/** Represents a query, consisting of specified query expressions, used to search for subscriptions. */ -export interface SearchSubscriptionsQuery { - /** - * Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by - * the [SearchSubscriptions]($e/Subscriptions/SearchSubscriptions) endpoint. - */ - filter?: SearchSubscriptionsFilter; -} - -export const searchSubscriptionsQuerySchema: Schema = object( - { filter: ['filter', optional(lazy(() => searchSubscriptionsFilterSchema))] } -); diff --git a/src/models/searchSubscriptionsRequest.ts b/src/models/searchSubscriptionsRequest.ts deleted file mode 100644 index 59a007ae0..000000000 --- a/src/models/searchSubscriptionsRequest.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { - array, - lazy, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { - SearchSubscriptionsQuery, - searchSubscriptionsQuerySchema, -} from './searchSubscriptionsQuery'; - -/** - * Defines input parameters in a request to the - * [SearchSubscriptions]($e/Subscriptions/SearchSubscriptions) endpoint. - */ -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/build-basics/common-api-patterns/pagination). - */ - cursor?: string; - /** - * The upper limit on the number of subscriptions to return - * in a paged response. - */ - limit?: number; - /** Represents a query, consisting of specified query expressions, used to search for subscriptions. */ - query?: SearchSubscriptionsQuery; - /** - * An option to include related information in the response. - * The supported values are: - * - `actions`: to include scheduled actions on the targeted subscriptions. - */ - include?: string[]; -} - -export const searchSubscriptionsRequestSchema: Schema = object( - { - cursor: ['cursor', optional(string())], - limit: ['limit', optional(number())], - query: ['query', optional(lazy(() => searchSubscriptionsQuerySchema))], - include: ['include', optional(array(string()))], - } -); diff --git a/src/models/searchSubscriptionsResponse.ts b/src/models/searchSubscriptionsResponse.ts deleted file mode 100644 index 72886ad1e..000000000 --- a/src/models/searchSubscriptionsResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; - -/** - * Defines output parameters in a response from the - * [SearchSubscriptions]($e/Subscriptions/SearchSubscriptions) endpoint. - */ -export interface SearchSubscriptionsResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** The subscriptions matching the specified query expressions. */ - subscriptions?: Subscription[]; - /** - * 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). - */ - cursor?: string; -} - -export const searchSubscriptionsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscriptions: [ - 'subscriptions', - optional(array(lazy(() => subscriptionSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchTeamMembersFilter.ts b/src/models/searchTeamMembersFilter.ts deleted file mode 100644 index ec80d073b..000000000 --- a/src/models/searchTeamMembersFilter.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - array, - boolean, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied - * between the individual fields, and `OR` logic is applied within list-based fields. - * For example, setting this filter value: - * ``` - * filter = (locations_ids = ["A", "B"], status = ACTIVE) - * ``` - * returns only active team members assigned to either location "A" or "B". - */ -export interface SearchTeamMembersFilter { - /** - * When present, filters by team members assigned to the specified locations. - * When empty, includes team members assigned to any location. - */ - locationIds?: string[] | null; - /** Enumerates the possible statuses the team member can have within a business. */ - status?: string; - /** When present and set to true, returns the team member who is the owner of the Square account. */ - isOwner?: boolean | null; -} - -export const searchTeamMembersFilterSchema: Schema = object( - { - locationIds: ['location_ids', optional(nullable(array(string())))], - status: ['status', optional(string())], - isOwner: ['is_owner', optional(nullable(boolean()))], - } -); diff --git a/src/models/searchTeamMembersQuery.ts b/src/models/searchTeamMembersQuery.ts deleted file mode 100644 index 6d1293292..000000000 --- a/src/models/searchTeamMembersQuery.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - SearchTeamMembersFilter, - searchTeamMembersFilterSchema, -} from './searchTeamMembersFilter'; - -/** Represents the parameters in a search for `TeamMember` objects. */ -export interface SearchTeamMembersQuery { - /** - * Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied - * between the individual fields, and `OR` logic is applied within list-based fields. - * For example, setting this filter value: - * ``` - * filter = (locations_ids = ["A", "B"], status = ACTIVE) - * ``` - * returns only active team members assigned to either location "A" or "B". - */ - filter?: SearchTeamMembersFilter; -} - -export const searchTeamMembersQuerySchema: Schema = object( - { filter: ['filter', optional(lazy(() => searchTeamMembersFilterSchema))] } -); diff --git a/src/models/searchTeamMembersRequest.ts b/src/models/searchTeamMembersRequest.ts deleted file mode 100644 index 4f4121b27..000000000 --- a/src/models/searchTeamMembersRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - SearchTeamMembersQuery, - searchTeamMembersQuerySchema, -} from './searchTeamMembersQuery'; - -/** Represents a search request for a filtered list of `TeamMember` objects. */ -export interface SearchTeamMembersRequest { - /** Represents the parameters in a search for `TeamMember` objects. */ - query?: SearchTeamMembersQuery; - /** The maximum number of `TeamMember` objects in a page (100 by default). */ - limit?: number; - /** - * The opaque cursor for fetching the next page. For more information, see - * [pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string; -} - -export const searchTeamMembersRequestSchema: Schema = object( - { - query: ['query', optional(lazy(() => searchTeamMembersQuerySchema))], - limit: ['limit', optional(number())], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchTeamMembersResponse.ts b/src/models/searchTeamMembersResponse.ts deleted file mode 100644 index b7671b7f4..000000000 --- a/src/models/searchTeamMembersResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { TeamMember, teamMemberSchema } from './teamMember'; - -/** Represents a response from a search request containing a filtered list of `TeamMember` objects. */ -export interface SearchTeamMembersResponse { - /** The filtered list of `TeamMember` objects. */ - teamMembers?: TeamMember[]; - /** - * The opaque cursor for fetching the next page. For more information, see - * [pagination](https://developer.squareup.com/docs/working-with-apis/pagination). - */ - cursor?: string; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const searchTeamMembersResponseSchema: Schema = object( - { - teamMembers: [ - 'team_members', - optional(array(lazy(() => teamMemberSchema))), - ], - cursor: ['cursor', optional(string())], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/searchTerminalActionsRequest.ts b/src/models/searchTerminalActionsRequest.ts deleted file mode 100644 index d0656cc58..000000000 --- a/src/models/searchTerminalActionsRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - TerminalActionQuery, - terminalActionQuerySchema, -} from './terminalActionQuery'; - -export interface SearchTerminalActionsRequest { - query?: TerminalActionQuery; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for the original query. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more - * information. - */ - cursor?: string; - /** Limit the number of results returned for a single request. */ - limit?: number; -} - -export const searchTerminalActionsRequestSchema: Schema = object( - { - query: ['query', optional(lazy(() => terminalActionQuerySchema))], - cursor: ['cursor', optional(string())], - limit: ['limit', optional(number())], - } -); diff --git a/src/models/searchTerminalActionsResponse.ts b/src/models/searchTerminalActionsResponse.ts deleted file mode 100644 index 19390dfcf..000000000 --- a/src/models/searchTerminalActionsResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalAction, terminalActionSchema } from './terminalAction'; - -export interface SearchTerminalActionsResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** The requested search result of `TerminalAction`s. */ - action?: TerminalAction[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, - * this is the final response. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more - * information. - */ - cursor?: string; -} - -export const searchTerminalActionsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - action: ['action', optional(array(lazy(() => terminalActionSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchTerminalCheckoutsRequest.ts b/src/models/searchTerminalCheckoutsRequest.ts deleted file mode 100644 index 926d9a761..000000000 --- a/src/models/searchTerminalCheckoutsRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - TerminalCheckoutQuery, - terminalCheckoutQuerySchema, -} from './terminalCheckoutQuery'; - -export interface SearchTerminalCheckoutsRequest { - query?: TerminalCheckoutQuery; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string; - /** Limits the number of results returned for a single request. */ - limit?: number; -} - -export const searchTerminalCheckoutsRequestSchema: Schema = object( - { - query: ['query', optional(lazy(() => terminalCheckoutQuerySchema))], - cursor: ['cursor', optional(string())], - limit: ['limit', optional(number())], - } -); diff --git a/src/models/searchTerminalCheckoutsResponse.ts b/src/models/searchTerminalCheckoutsResponse.ts deleted file mode 100644 index 2a8e5f1e6..000000000 --- a/src/models/searchTerminalCheckoutsResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalCheckout, terminalCheckoutSchema } from './terminalCheckout'; - -export interface SearchTerminalCheckoutsResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** The requested search result of `TerminalCheckout` objects. */ - checkouts?: TerminalCheckout[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, - * this is the final response. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string; -} - -export const searchTerminalCheckoutsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - checkouts: [ - 'checkouts', - optional(array(lazy(() => terminalCheckoutSchema))), - ], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchTerminalRefundsRequest.ts b/src/models/searchTerminalRefundsRequest.ts deleted file mode 100644 index b4b38d279..000000000 --- a/src/models/searchTerminalRefundsRequest.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - TerminalRefundQuery, - terminalRefundQuerySchema, -} from './terminalRefundQuery'; - -export interface SearchTerminalRefundsRequest { - query?: TerminalRefundQuery; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this cursor to retrieve the next set of results for the original query. - */ - cursor?: string; - /** Limits the number of results returned for a single request. */ - limit?: number; -} - -export const searchTerminalRefundsRequestSchema: Schema = object( - { - query: ['query', optional(lazy(() => terminalRefundQuerySchema))], - cursor: ['cursor', optional(string())], - limit: ['limit', optional(number())], - } -); diff --git a/src/models/searchTerminalRefundsResponse.ts b/src/models/searchTerminalRefundsResponse.ts deleted file mode 100644 index 1c7e08e99..000000000 --- a/src/models/searchTerminalRefundsResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { TerminalRefund, terminalRefundSchema } from './terminalRefund'; - -export interface SearchTerminalRefundsResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** The requested search result of `TerminalRefund` objects. */ - refunds?: TerminalRefund[]; - /** - * The pagination cursor to be used in a subsequent request. If empty, - * this is the final response. - * See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination) for more information. - */ - cursor?: string; -} - -export const searchTerminalRefundsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - refunds: ['refunds', optional(array(lazy(() => terminalRefundSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/searchVendorsRequest.ts b/src/models/searchVendorsRequest.ts deleted file mode 100644 index 04641f0ed..000000000 --- a/src/models/searchVendorsRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { - SearchVendorsRequestFilter, - searchVendorsRequestFilterSchema, -} from './searchVendorsRequestFilter'; -import { - SearchVendorsRequestSort, - searchVendorsRequestSortSchema, -} from './searchVendorsRequestSort'; - -/** Represents an input into a call to [SearchVendors]($e/Vendors/SearchVendors). */ -export interface SearchVendorsRequest { - /** Defines supported query expressions to search for vendors by. */ - filter?: SearchVendorsRequestFilter; - /** Defines a sorter used to sort results from [SearchVendors]($e/Vendors/SearchVendors). */ - sort?: SearchVendorsRequestSort; - /** - * A pagination cursor returned by a previous call to this endpoint. - * Provide this to retrieve the next set of results for the original query. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string; -} - -export const searchVendorsRequestSchema: Schema = object({ - filter: ['filter', optional(lazy(() => searchVendorsRequestFilterSchema))], - sort: ['sort', optional(lazy(() => searchVendorsRequestSortSchema))], - cursor: ['cursor', optional(string())], -}); diff --git a/src/models/searchVendorsRequestFilter.ts b/src/models/searchVendorsRequestFilter.ts deleted file mode 100644 index 86b89e982..000000000 --- a/src/models/searchVendorsRequestFilter.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** Defines supported query expressions to search for vendors by. */ -export interface SearchVendorsRequestFilter { - /** The names of the [Vendor](entity:Vendor) objects to retrieve. */ - name?: string[] | null; - /** - * The statuses of the [Vendor](entity:Vendor) objects to retrieve. - * See [VendorStatus](#type-vendorstatus) for possible values - */ - status?: string[] | null; -} - -export const searchVendorsRequestFilterSchema: Schema = object( - { - name: ['name', optional(nullable(array(string())))], - status: ['status', optional(nullable(array(string())))], - } -); diff --git a/src/models/searchVendorsRequestSort.ts b/src/models/searchVendorsRequestSort.ts deleted file mode 100644 index 822fe1f11..000000000 --- a/src/models/searchVendorsRequestSort.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Defines a sorter used to sort results from [SearchVendors]($e/Vendors/SearchVendors). */ -export interface SearchVendorsRequestSort { - /** The field to sort the returned [Vendor]($m/Vendor) objects by. */ - field?: string; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - order?: string; -} - -export const searchVendorsRequestSortSchema: Schema = object( - { field: ['field', optional(string())], order: ['order', optional(string())] } -); diff --git a/src/models/searchVendorsResponse.ts b/src/models/searchVendorsResponse.ts deleted file mode 100644 index df829bd14..000000000 --- a/src/models/searchVendorsResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; -import { Vendor, vendorSchema } from './vendor'; - -/** Represents an output from a call to [SearchVendors]($e/Vendors/SearchVendors). */ -export interface SearchVendorsResponse { - /** Errors encountered when the request fails. */ - errors?: Error[]; - /** The [Vendor](entity:Vendor) objects matching the specified search filter. */ - vendors?: Vendor[]; - /** - * The pagination cursor to be used in a subsequent request. If unset, - * this is the final response. - * See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. - */ - cursor?: string; -} - -export const searchVendorsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - vendors: ['vendors', optional(array(lazy(() => vendorSchema)))], - cursor: ['cursor', optional(string())], - } -); diff --git a/src/models/segmentFilter.ts b/src/models/segmentFilter.ts deleted file mode 100644 index 5cb57e4ff..000000000 --- a/src/models/segmentFilter.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { FilterValue, filterValueSchema } from './filterValue'; - -/** A query filter to search for buyer-accessible appointment segments by. */ -export interface SegmentFilter { - /** The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service booked in this segment. */ - serviceVariationId: string; - /** - * A filter to select resources based on an exact field value. For any given - * value, the value can only be in one property. Depending on the field, either - * all properties can be set or only a subset will be available. - * Refer to the documentation of the field. - */ - teamMemberIdFilter?: FilterValue; -} - -export const segmentFilterSchema: Schema = object({ - serviceVariationId: ['service_variation_id', string()], - teamMemberIdFilter: [ - 'team_member_id_filter', - optional(lazy(() => filterValueSchema)), - ], -}); diff --git a/src/models/selectOption.ts b/src/models/selectOption.ts deleted file mode 100644 index f79e173bf..000000000 --- a/src/models/selectOption.ts +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index 735e6382c..000000000 --- a/src/models/selectOptions.ts +++ /dev/null @@ -1,19 +0,0 @@ -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/shift.ts b/src/models/shift.ts deleted file mode 100644 index 975db9974..000000000 --- a/src/models/shift.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Break, breakSchema } from './break'; -import { Money, moneySchema } from './money'; -import { ShiftWage, shiftWageSchema } from './shiftWage'; - -/** - * A record of the hourly rate, start, and end times for a single work shift - * for an employee. This might include a record of the start and end times for breaks - * taken during the shift. - */ -export interface Shift { - /** The UUID for this object. */ - id?: string; - /** The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id` instead. */ - employeeId?: string | null; - /** - * The ID of the location this shift occurred at. The location should be based on - * where the employee clocked in. - */ - locationId: string; - /** - * The read-only convenience value that is calculated from the location based - * on the `location_id`. Format: the IANA timezone database identifier for the - * location timezone. - */ - timezone?: string | null; - /** - * RFC 3339; shifted to the location timezone + offset. Precision up to the - * minute is respected; seconds are truncated. - */ - startAt: string; - /** - * RFC 3339; shifted to the timezone + offset. Precision up to the minute is - * respected; seconds are truncated. - */ - endAt?: string | null; - /** The hourly wage rate used to compensate an employee for this shift. */ - wage?: ShiftWage; - /** A list of all the paid or unpaid breaks that were taken during this shift. */ - breaks?: Break[] | null; - /** Enumerates the possible status of a `Shift`. */ - status?: string; - /** - * Used for resolving concurrency issues. The request fails if the version - * provided does not match the server version at the time of the request. If not provided, - * Square executes a blind write; potentially overwriting data from another - * write. - */ - version?: number; - /** A read-only timestamp in RFC 3339 format; presented in UTC. */ - createdAt?: string; - /** A read-only timestamp in RFC 3339 format; presented in UTC. */ - updatedAt?: string; - /** The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26". */ - teamMemberId?: 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. - */ - declaredCashTipMoney?: Money; -} - -export const shiftSchema: Schema = object({ - id: ['id', optional(string())], - employeeId: ['employee_id', optional(nullable(string()))], - locationId: ['location_id', string()], - timezone: ['timezone', optional(nullable(string()))], - startAt: ['start_at', string()], - endAt: ['end_at', optional(nullable(string()))], - wage: ['wage', optional(lazy(() => shiftWageSchema))], - breaks: ['breaks', optional(nullable(array(lazy(() => breakSchema))))], - status: ['status', optional(string())], - version: ['version', optional(number())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - teamMemberId: ['team_member_id', optional(nullable(string()))], - declaredCashTipMoney: [ - 'declared_cash_tip_money', - optional(lazy(() => moneySchema)), - ], -}); diff --git a/src/models/shiftFilter.ts b/src/models/shiftFilter.ts deleted file mode 100644 index 153311752..000000000 --- a/src/models/shiftFilter.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { ShiftWorkday, shiftWorkdaySchema } from './shiftWorkday'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -/** - * Defines a filter used in a search for `Shift` records. `AND` logic is - * used by Square's servers to apply each filter property specified. - */ -export interface ShiftFilter { - /** Fetch shifts for the specified location. */ - locationIds?: string[] | null; - /** Fetch shifts for the specified employees. DEPRECATED at version 2020-08-26. Use `team_member_ids` instead. */ - employeeIds?: string[] | null; - /** Specifies the `status` of `Shift` records to be returned. */ - status?: string; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - start?: TimeRange; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - end?: TimeRange; - /** - * A `Shift` search query filter parameter that sets a range of days that - * a `Shift` must start or end in before passing the filter condition. - */ - workday?: ShiftWorkday; - /** Fetch shifts for the specified team members. Replaced `employee_ids` at version "2020-08-26". */ - teamMemberIds?: string[] | null; -} - -export const shiftFilterSchema: Schema = object({ - locationIds: ['location_ids', optional(nullable(array(string())))], - employeeIds: ['employee_ids', optional(nullable(array(string())))], - status: ['status', optional(string())], - start: ['start', optional(lazy(() => timeRangeSchema))], - end: ['end', optional(lazy(() => timeRangeSchema))], - workday: ['workday', optional(lazy(() => shiftWorkdaySchema))], - teamMemberIds: ['team_member_ids', optional(nullable(array(string())))], -}); diff --git a/src/models/shiftQuery.ts b/src/models/shiftQuery.ts deleted file mode 100644 index 32bd4a6c4..000000000 --- a/src/models/shiftQuery.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { ShiftFilter, shiftFilterSchema } from './shiftFilter'; -import { ShiftSort, shiftSortSchema } from './shiftSort'; - -/** The parameters of a `Shift` search query, which includes filter and sort options. */ -export interface ShiftQuery { - /** - * Defines a filter used in a search for `Shift` records. `AND` logic is - * used by Square's servers to apply each filter property specified. - */ - filter?: ShiftFilter; - /** Sets the sort order of search results. */ - sort?: ShiftSort; -} - -export const shiftQuerySchema: Schema = object({ - filter: ['filter', optional(lazy(() => shiftFilterSchema))], - sort: ['sort', optional(lazy(() => shiftSortSchema))], -}); diff --git a/src/models/shiftSort.ts b/src/models/shiftSort.ts deleted file mode 100644 index e7a9d99ad..000000000 --- a/src/models/shiftSort.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Sets the sort order of search results. */ -export interface ShiftSort { - /** Enumerates the `Shift` fields to sort on. */ - field?: string; - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - order?: string; -} - -export const shiftSortSchema: Schema = object({ - field: ['field', optional(string())], - order: ['order', optional(string())], -}); diff --git a/src/models/shiftWage.ts b/src/models/shiftWage.ts deleted file mode 100644 index 83ef07526..000000000 --- a/src/models/shiftWage.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -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. */ - title?: 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. - */ - 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; - /** Whether team members are eligible for tips when working this job. */ - tipEligible?: boolean | null; -} - -export const shiftWageSchema: Schema = object({ - title: ['title', optional(nullable(string()))], - hourlyRate: ['hourly_rate', optional(lazy(() => moneySchema))], - jobId: ['job_id', optional(string())], - tipEligible: ['tip_eligible', optional(nullable(boolean()))], -}); diff --git a/src/models/shiftWorkday.ts b/src/models/shiftWorkday.ts deleted file mode 100644 index b20918f7f..000000000 --- a/src/models/shiftWorkday.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { DateRange, dateRangeSchema } from './dateRange'; - -/** - * A `Shift` search query filter parameter that sets a range of days that - * a `Shift` must start or end in before passing the filter condition. - */ -export interface ShiftWorkday { - /** - * A range defined by two dates. Used for filtering a query for Connect v2 - * objects that have date properties. - */ - dateRange?: DateRange; - /** Defines the logic used to apply a workday filter. */ - matchShiftsBy?: string; - /** - * Location-specific timezones convert workdays to datetime filters. - * Every location included in the query must have a timezone or this field - * must be provided as a fallback. Format: the IANA timezone database - * identifier for the relevant timezone. - */ - defaultTimezone?: string | null; -} - -export const shiftWorkdaySchema: Schema = object({ - dateRange: ['date_range', optional(lazy(() => dateRangeSchema))], - matchShiftsBy: ['match_shifts_by', optional(string())], - defaultTimezone: ['default_timezone', optional(nullable(string()))], -}); diff --git a/src/models/shippingFee.ts b/src/models/shippingFee.ts deleted file mode 100644 index 9a136e706..000000000 --- a/src/models/shippingFee.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -export interface ShippingFee { - /** The name for the shipping fee. */ - name?: 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. - */ - charge: Money; -} - -export const shippingFeeSchema: Schema = object({ - name: ['name', optional(nullable(string()))], - charge: ['charge', lazy(() => moneySchema)], -}); diff --git a/src/models/signatureImage.ts b/src/models/signatureImage.ts deleted file mode 100644 index e656e05a6..000000000 --- a/src/models/signatureImage.ts +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 1194b82ba..000000000 --- a/src/models/signatureOptions.ts +++ /dev/null @@ -1,17 +0,0 @@ -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/site.ts b/src/models/site.ts deleted file mode 100644 index cc192c2bc..000000000 --- a/src/models/site.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** Represents a Square Online site, which is an online store for a Square seller. */ -export interface Site { - /** The Square-assigned ID of the site. */ - id?: string; - /** The title of the site. */ - siteTitle?: string | null; - /** The domain of the site (without the protocol). For example, `mysite1.square.site`. */ - domain?: string | null; - /** Indicates whether the site is published. */ - isPublished?: boolean | null; - /** The timestamp of when the site was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp of when the site was last updated, in RFC 3339 format. */ - updatedAt?: string; -} - -export const siteSchema: Schema = object({ - id: ['id', optional(string())], - siteTitle: ['site_title', optional(nullable(string()))], - domain: ['domain', optional(nullable(string()))], - isPublished: ['is_published', optional(nullable(boolean()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/snippet.ts b/src/models/snippet.ts deleted file mode 100644 index 9d6cf6545..000000000 --- a/src/models/snippet.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. */ -export interface Snippet { - /** The Square-assigned ID for the snippet. */ - id?: string; - /** The ID of the site that contains the snippet. */ - siteId?: string; - /** The snippet code, which can contain valid HTML, JavaScript, or both. */ - content: string; - /** The timestamp of when the snippet was initially added to the site, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp of when the snippet was last updated on the site, in RFC 3339 format. */ - updatedAt?: string; -} - -export const snippetSchema: Schema = object({ - id: ['id', optional(string())], - siteId: ['site_id', optional(string())], - content: ['content', string()], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/snippetResponse.ts b/src/models/snippetResponse.ts deleted file mode 100644 index 4b97ef6cf..000000000 --- a/src/models/snippetResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Snippet, snippetSchema } from './snippet'; - -export interface SnippetResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. */ - snippet?: Snippet; -} - -export const snippetResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - snippet: ['snippet', optional(lazy(() => snippetSchema))], -}); diff --git a/src/models/sourceApplication.ts b/src/models/sourceApplication.ts deleted file mode 100644 index 5525bb691..000000000 --- a/src/models/sourceApplication.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Represents information about the application used to generate a change. */ -export interface SourceApplication { - /** Indicates the Square product used to generate a change. */ - product?: string; - /** - * __Read only__ The Square-assigned ID of the application. This field is used only if the - * [product](entity:Product) type is `EXTERNAL_API`. - */ - applicationId?: string | null; - /** - * __Read only__ The display name of the application - * (for example, `"Custom Application"` or `"Square POS 4.74 for Android"`). - */ - name?: string | null; -} - -export const sourceApplicationSchema: Schema = object({ - product: ['product', optional(string())], - applicationId: ['application_id', optional(nullable(string()))], - name: ['name', optional(nullable(string()))], -}); diff --git a/src/models/squareAccountDetails.ts b/src/models/squareAccountDetails.ts deleted file mode 100644 index a0c205a66..000000000 --- a/src/models/squareAccountDetails.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Error, errorSchema } from './error'; - -/** Additional details about Square Account payments. */ -export interface SquareAccountDetails { - /** Unique identifier for the payment source used for this payment. */ - paymentSourceToken?: string | null; - /** Information about errors encountered during the request. */ - errors?: Error[] | null; -} - -export const squareAccountDetailsSchema: Schema = object({ - paymentSourceToken: ['payment_source_token', optional(nullable(string()))], - errors: ['errors', optional(nullable(array(lazy(() => errorSchema))))], -}); diff --git a/src/models/standardUnitDescription.ts b/src/models/standardUnitDescription.ts deleted file mode 100644 index 753d0456b..000000000 --- a/src/models/standardUnitDescription.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { MeasurementUnit, measurementUnitSchema } from './measurementUnit'; - -/** Contains the name and abbreviation for standard measurement unit. */ -export interface StandardUnitDescription { - /** - * Represents a unit of measurement to use with a quantity, such as ounces - * or inches. Exactly one of the following fields are required: `custom_unit`, - * `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. - */ - unit?: MeasurementUnit; - /** UI display name of the measurement unit. For example, 'Pound'. */ - name?: string | null; - /** UI display abbreviation for the measurement unit. For example, 'lb'. */ - abbreviation?: string | null; -} - -export const standardUnitDescriptionSchema: Schema = object( - { - unit: ['unit', optional(lazy(() => measurementUnitSchema))], - name: ['name', optional(nullable(string()))], - abbreviation: ['abbreviation', optional(nullable(string()))], - } -); diff --git a/src/models/standardUnitDescriptionGroup.ts b/src/models/standardUnitDescriptionGroup.ts deleted file mode 100644 index 0c4c93692..000000000 --- a/src/models/standardUnitDescriptionGroup.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - StandardUnitDescription, - standardUnitDescriptionSchema, -} from './standardUnitDescription'; - -/** Group of standard measurement units. */ -export interface StandardUnitDescriptionGroup { - /** List of standard (non-custom) measurement units in this description group. */ - standardUnitDescriptions?: StandardUnitDescription[] | null; - /** IETF language tag. */ - languageCode?: string | null; -} - -export const standardUnitDescriptionGroupSchema: Schema = object( - { - standardUnitDescriptions: [ - 'standard_unit_descriptions', - optional(nullable(array(lazy(() => standardUnitDescriptionSchema)))), - ], - languageCode: ['language_code', optional(nullable(string()))], - } -); diff --git a/src/models/submitEvidenceResponse.ts b/src/models/submitEvidenceResponse.ts deleted file mode 100644 index 986323f03..000000000 --- a/src/models/submitEvidenceResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Dispute, disputeSchema } from './dispute'; -import { Error, errorSchema } from './error'; - -/** Defines the fields in a `SubmitEvidence` response. */ -export interface SubmitEvidenceResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. */ - dispute?: Dispute; -} - -export const submitEvidenceResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - dispute: ['dispute', optional(lazy(() => disputeSchema))], - } -); diff --git a/src/models/subscription.ts b/src/models/subscription.ts deleted file mode 100644 index 8c5077838..000000000 --- a/src/models/subscription.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { - array, - bigint, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; -import { Phase, phaseSchema } from './phase'; -import { - SubscriptionAction, - subscriptionActionSchema, -} from './subscriptionAction'; -import { - SubscriptionSource, - subscriptionSourceSchema, -} from './subscriptionSource'; - -/** - * 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 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. */ - startDate?: string; - /** - * 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. - */ - canceledDate?: string | null; - /** - * The `YYYY-MM-DD`-formatted date up to when the subscriber is invoiced for the - * subscription. - * After the invoice is sent for a given billing period, - * this date will be the last day of the billing period. - * For example, - * suppose for the month of May a subscriber gets an invoice - * (or charged the card) on May 1. For the monthly billing scenario, - * this date is then set to May 31. - */ - chargedThroughDate?: string; - /** Supported subscription statuses. */ - status?: string; - /** - * The tax amount applied 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%. - */ - taxPercentage?: string | null; - /** - * The IDs of the [invoices](entity:Invoice) created for the - * subscription, listed in order when the invoices were created - * (newest invoices appear first). - */ - invoiceIds?: string[]; - /** - * 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. - */ - priceOverrideMoney?: Money; - /** - * The version of the object. When updating an object, the version - * supplied must match the version in the database, otherwise the write will - * be rejected as conflicting. - */ - version?: bigint; - /** The timestamp when the subscription was created, in RFC 3339 format. */ - createdAt?: string; - /** - * The ID of the [subscriber's](entity:Customer) [card](entity:Card) - * used to charge for the subscription. - */ - cardId?: string | null; - /** - * 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`). - */ - timezone?: string; - /** The origination details of the subscription. */ - source?: SubscriptionSource; - /** - * The list of scheduled actions on this subscription. It is set only in the response from - * [RetrieveSubscription]($e/Subscriptions/RetrieveSubscription) with the query parameter - * of `include=actions` or from - * [SearchSubscriptions]($e/Subscriptions/SearchSubscriptions) with the input parameter - * of `include:["actions"]`. - */ - actions?: SubscriptionAction[] | null; - /** The day of the month on which the subscription will issue invoices and publish orders. */ - monthlyBillingAnchorDate?: number; - /** array of phases for this subscription */ - phases?: Phase[]; -} - -export const subscriptionSchema: Schema = object({ - id: ['id', optional(string())], - locationId: ['location_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()))], - chargedThroughDate: ['charged_through_date', optional(string())], - status: ['status', optional(string())], - taxPercentage: ['tax_percentage', optional(nullable(string()))], - invoiceIds: ['invoice_ids', optional(array(string()))], - priceOverrideMoney: [ - 'price_override_money', - optional(lazy(() => moneySchema)), - ], - version: ['version', optional(bigint())], - createdAt: ['created_at', optional(string())], - cardId: ['card_id', optional(nullable(string()))], - timezone: ['timezone', optional(string())], - source: ['source', optional(lazy(() => subscriptionSourceSchema))], - actions: [ - 'actions', - optional(nullable(array(lazy(() => subscriptionActionSchema)))), - ], - monthlyBillingAnchorDate: ['monthly_billing_anchor_date', optional(number())], - phases: ['phases', optional(array(lazy(() => phaseSchema)))], -}); diff --git a/src/models/subscriptionAction.ts b/src/models/subscriptionAction.ts deleted file mode 100644 index 17d6b82a2..000000000 --- a/src/models/subscriptionAction.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Phase, phaseSchema } from './phase'; - -/** Represents an action as a pending change to a subscription. */ -export interface SubscriptionAction { - /** The ID of an action scoped to a subscription. */ - id?: string; - /** Supported types of an action as a pending change to a subscription. */ - type?: string; - /** The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. */ - effectiveDate?: string | null; - /** The new billing anchor day value, for a `CHANGE_BILLING_ANCHOR_DATE` action. */ - monthlyBillingAnchorDate?: number | 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()))], - monthlyBillingAnchorDate: [ - 'monthly_billing_anchor_date', - optional(nullable(number())), - ], - 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 deleted file mode 100644 index da5159e5f..000000000 --- a/src/models/subscriptionEvent.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Phase, phaseSchema } from './phase'; -import { - SubscriptionEventInfo, - subscriptionEventInfoSchema, -} from './subscriptionEventInfo'; - -/** Describes changes to a subscription and the subscription status. */ -export interface SubscriptionEvent { - /** The ID of the subscription event. */ - id: string; - /** Supported types of an event occurred to a subscription. */ - subscriptionEventType: string; - /** The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred. */ - effectiveDate: string; - /** The day-of-the-month the billing anchor date was changed to, if applicable. */ - monthlyBillingAnchorDate?: number; - /** 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()], - monthlyBillingAnchorDate: ['monthly_billing_anchor_date', optional(number())], - info: ['info', optional(lazy(() => subscriptionEventInfoSchema))], - phases: ['phases', optional(nullable(array(lazy(() => phaseSchema))))], - planVariationId: ['plan_variation_id', string()], -}); diff --git a/src/models/subscriptionEventInfo.ts b/src/models/subscriptionEventInfo.ts deleted file mode 100644 index 3de0c71fc..000000000 --- a/src/models/subscriptionEventInfo.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Provides information about the subscription event. */ -export interface SubscriptionEventInfo { - /** A human-readable explanation for the event. */ - detail?: string | null; - /** Supported info codes of a subscription event. */ - code?: string; -} - -export const subscriptionEventInfoSchema: Schema = object( - { - detail: ['detail', optional(nullable(string()))], - code: ['code', optional(string())], - } -); diff --git a/src/models/subscriptionPhase.ts b/src/models/subscriptionPhase.ts deleted file mode 100644 index 6079e163f..000000000 --- a/src/models/subscriptionPhase.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - bigint, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; -import { - SubscriptionPricing, - subscriptionPricingSchema, -} from './subscriptionPricing'; - -/** 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; - /** Determines the billing cadence of a [Subscription]($m/Subscription) */ - cadence: string; - /** 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. */ - periods?: number | 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. - */ - 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({ - uid: ['uid', optional(nullable(string()))], - cadence: ['cadence', string()], - periods: ['periods', optional(nullable(number()))], - recurringPriceMoney: [ - 'recurring_price_money', - 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 deleted file mode 100644 index 6dcae580e..000000000 --- a/src/models/subscriptionPricing.ts +++ /dev/null @@ -1,33 +0,0 @@ -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 deleted file mode 100644 index e1c4a3729..000000000 --- a/src/models/subscriptionSource.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** The origination details of the subscription. */ -export interface SubscriptionSource { - /** - * The name used to identify the place (physical or digital) that - * a subscription originates. If unset, the name defaults to the name - * of the application that created the subscription. - */ - name?: string | null; -} - -export const subscriptionSourceSchema: Schema = object({ - name: ['name', optional(nullable(string()))], -}); diff --git a/src/models/subscriptionTestResult.ts b/src/models/subscriptionTestResult.ts deleted file mode 100644 index ab0236bf0..000000000 --- a/src/models/subscriptionTestResult.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -/** - * Represents the details of a webhook subscription, including notification URL, - * event types, and signature key. - */ -export interface SubscriptionTestResult { - /** A Square-generated unique ID for the subscription test result. */ - id?: string; - /** The status code returned by the subscription notification URL. */ - statusCode?: number | null; - /** An object containing the payload of the test event. For example, a `payment.created` event. */ - payload?: string | null; - /** - * The timestamp of when the subscription was created, in RFC 3339 format. - * For example, "2016-09-04T23:59:33.123Z". - */ - createdAt?: string; - /** - * The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". - * Because a subscription test result is unique, this field is the same as the `created_at` field. - */ - updatedAt?: string; -} - -export const subscriptionTestResultSchema: Schema = object( - { - id: ['id', optional(string())], - statusCode: ['status_code', optional(nullable(number()))], - payload: ['payload', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - } -); diff --git a/src/models/swapPlanRequest.ts b/src/models/swapPlanRequest.ts deleted file mode 100644 index 447cb64a3..000000000 --- a/src/models/swapPlanRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -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 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({ - 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 deleted file mode 100644 index ecefbe3ce..000000000 --- a/src/models/swapPlanResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; -import { - SubscriptionAction, - subscriptionActionSchema, -} from './subscriptionAction'; - -/** - * Defines output parameters in a response of the - * [SwapPlan]($e/Subscriptions/SwapPlan) endpoint. - */ -export interface SwapPlanResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * 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. */ - actions?: SubscriptionAction[]; -} - -export const swapPlanResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - actions: ['actions', optional(array(lazy(() => subscriptionActionSchema)))], -}); diff --git a/src/models/taxIds.ts b/src/models/taxIds.ts deleted file mode 100644 index a066d4171..000000000 --- a/src/models/taxIds.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Identifiers for the location used by various governments for tax purposes. */ -export interface TaxIds { - /** - * The EU VAT number for this location. For example, `IE3426675K`. - * If the EU VAT number is present, it is well-formed and has been - * validated with VIES, the VAT Information Exchange System. - */ - euVat?: string; - /** - * The SIRET (Système d'Identification du Répertoire des Entreprises et de leurs Etablissements) - * number is a 14-digit code issued by the French INSEE. For example, `39922799000021`. - */ - frSiret?: string; - /** - * The French government uses the NAF (Nomenclature des Activités Françaises) to display and - * track economic statistical data. This is also called the APE (Activite Principale de l’Entreprise) code. - * For example, `6910Z`. - */ - frNaf?: string; - /** - * The NIF (Numero de Identificacion Fiscal) number is a nine-character tax identifier used in Spain. - * If it is present, it has been validated. For example, `73628495A`. - */ - esNif?: string; - /** - * The QII (Qualified Invoice Issuer) number is a 14-character tax identifier used in Japan. - * For example, `T1234567890123`. - */ - jpQii?: string; -} - -export const taxIdsSchema: Schema = object({ - euVat: ['eu_vat', optional(string())], - frSiret: ['fr_siret', optional(string())], - frNaf: ['fr_naf', optional(string())], - esNif: ['es_nif', optional(string())], - jpQii: ['jp_qii', optional(string())], -}); diff --git a/src/models/teamMember.ts b/src/models/teamMember.ts deleted file mode 100644 index d06f8974b..000000000 --- a/src/models/teamMember.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - TeamMemberAssignedLocations, - teamMemberAssignedLocationsSchema, -} from './teamMemberAssignedLocations'; -import { WageSetting, wageSettingSchema } from './wageSetting'; - -/** A record representing an individual team member for a business. */ -export interface TeamMember { - /** The unique ID for the team member. */ - id?: string; - /** A second ID used to associate the team member with an entity in another system. */ - referenceId?: string | null; - /** Whether the team member is the owner of the Square account. */ - isOwner?: boolean; - /** Enumerates the possible statuses the team member can have within a business. */ - status?: string; - /** The given name (that is, the first name) associated with the team member. */ - givenName?: string | null; - /** The family name (that is, the last name) associated with the team member. */ - familyName?: string | null; - /** - * The email address associated with the team member. After accepting the invitation - * from Square, only the team member can change this value. - */ - emailAddress?: string | null; - /** - * The team member's phone number, in E.164 format. For example: - * +14155552671 - the country code is 1 for US - * +551155256325 - the country code is 55 for BR - */ - phoneNumber?: string | null; - /** The timestamp when the team member was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the team member was last updated, in RFC 3339 format. */ - updatedAt?: string; - /** An object that represents a team member's assignment to locations. */ - assignedLocations?: TeamMemberAssignedLocations; - /** - * Represents information about the overtime exemption status, job assignments, and compensation - * for a [team member]($m/TeamMember). - */ - wageSetting?: WageSetting; -} - -export const teamMemberSchema: Schema = object({ - id: ['id', optional(string())], - referenceId: ['reference_id', optional(nullable(string()))], - isOwner: ['is_owner', optional(boolean())], - status: ['status', optional(string())], - givenName: ['given_name', optional(nullable(string()))], - familyName: ['family_name', optional(nullable(string()))], - emailAddress: ['email_address', optional(nullable(string()))], - phoneNumber: ['phone_number', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - assignedLocations: [ - 'assigned_locations', - optional(lazy(() => teamMemberAssignedLocationsSchema)), - ], - wageSetting: ['wage_setting', optional(lazy(() => wageSettingSchema))], -}); diff --git a/src/models/teamMemberAssignedLocations.ts b/src/models/teamMemberAssignedLocations.ts deleted file mode 100644 index f39a64f26..000000000 --- a/src/models/teamMemberAssignedLocations.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -/** An object that represents a team member's assignment to locations. */ -export interface TeamMemberAssignedLocations { - /** Enumerates the possible assignment types that the team member can have. */ - assignmentType?: string; - /** The explicit locations that the team member is assigned to. */ - locationIds?: string[] | null; -} - -export const teamMemberAssignedLocationsSchema: Schema = object( - { - assignmentType: ['assignment_type', optional(string())], - locationIds: ['location_ids', optional(nullable(array(string())))], - } -); diff --git a/src/models/teamMemberBookingProfile.ts b/src/models/teamMemberBookingProfile.ts deleted file mode 100644 index 9e4688db1..000000000 --- a/src/models/teamMemberBookingProfile.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { boolean, nullable, object, optional, Schema, string } from '../schema'; - -/** The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. */ -export interface TeamMemberBookingProfile { - /** The ID of the [TeamMember](entity:TeamMember) object for the team member associated with the booking profile. */ - teamMemberId?: string; - /** The description of the team member. */ - description?: string; - /** The display name of the team member. */ - displayName?: string; - /** Indicates whether the team member can be booked through the Bookings API or the seller's online booking channel or site (`true`) or not (`false`). */ - isBookable?: boolean | null; - /** The URL of the team member's image for the bookings profile. */ - profileImageUrl?: string; -} - -export const teamMemberBookingProfileSchema: Schema = object( - { - teamMemberId: ['team_member_id', optional(string())], - description: ['description', optional(string())], - displayName: ['display_name', optional(string())], - isBookable: ['is_bookable', optional(nullable(boolean()))], - profileImageUrl: ['profile_image_url', optional(string())], - } -); diff --git a/src/models/teamMemberWage.ts b/src/models/teamMemberWage.ts deleted file mode 100644 index 26ff0339d..000000000 --- a/src/models/teamMemberWage.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Money, moneySchema } from './money'; - -/** - * The hourly wage rate that a team member earns on a `Shift` for doing the job - * specified by the `title` property of this object. - */ -export interface TeamMemberWage { - /** The UUID for this object. */ - id?: string; - /** The `TeamMember` that this wage is assigned to. */ - teamMemberId?: string | null; - /** The job title that this wage relates to. */ - title?: 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. - */ - hourlyRate?: Money; - /** - * An identifier for the job that this wage relates to. This cannot be - * used to retrieve the job. - */ - jobId?: string | null; - /** Whether team members are eligible for tips when working this job. */ - tipEligible?: boolean | null; -} - -export const teamMemberWageSchema: Schema = object({ - id: ['id', optional(string())], - teamMemberId: ['team_member_id', optional(nullable(string()))], - title: ['title', optional(nullable(string()))], - hourlyRate: ['hourly_rate', optional(lazy(() => moneySchema))], - jobId: ['job_id', optional(nullable(string()))], - tipEligible: ['tip_eligible', optional(nullable(boolean()))], -}); diff --git a/src/models/tender.ts b/src/models/tender.ts deleted file mode 100644 index 53c182fb5..000000000 --- a/src/models/tender.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - AdditionalRecipient, - additionalRecipientSchema, -} from './additionalRecipient'; -import { Money, moneySchema } from './money'; -import { - TenderBankAccountDetails, - tenderBankAccountDetailsSchema, -} from './tenderBankAccountDetails'; -import { - TenderBuyNowPayLaterDetails, - tenderBuyNowPayLaterDetailsSchema, -} from './tenderBuyNowPayLaterDetails'; -import { - TenderCardDetails, - tenderCardDetailsSchema, -} from './tenderCardDetails'; -import { - TenderCashDetails, - tenderCashDetailsSchema, -} from './tenderCashDetails'; -import { - TenderSquareAccountDetails, - tenderSquareAccountDetailsSchema, -} from './tenderSquareAccountDetails'; - -/** Represents a tender (i.e., a method of payment) used in a Square transaction. */ -export interface Tender { - /** The tender's unique ID. It is the associated payment ID. */ - id?: string; - /** The ID of the transaction's associated location. */ - locationId?: string | null; - /** The ID of the tender's associated transaction. */ - transactionId?: string | null; - /** The timestamp for when the tender was created, in RFC 3339 format. */ - createdAt?: string; - /** An optional note associated with the tender at the time of payment. */ - note?: 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. - */ - amountMoney?: Money; - /** - * 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. - */ - tipMoney?: Money; - /** - * 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. - */ - processingFeeMoney?: Money; - /** - * If the tender is associated with a customer or represents a customer's card on file, - * this is the ID of the associated customer. - */ - customerId?: string | null; - /** Indicates a tender's type. */ - type: string; - /** Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` */ - cardDetails?: TenderCardDetails; - /** Represents the details of a tender with `type` `CASH`. */ - cashDetails?: TenderCashDetails; - /** - * Represents the details of a tender with `type` `BANK_ACCOUNT`. - * See [BankAccountPaymentDetails]($m/BankAccountPaymentDetails) - * for more exposed details of a bank account payment. - */ - bankAccountDetails?: TenderBankAccountDetails; - /** Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. */ - buyNowPayLaterDetails?: TenderBuyNowPayLaterDetails; - /** Represents the details of a tender with `type` `SQUARE_ACCOUNT`. */ - squareAccountDetails?: TenderSquareAccountDetails; - /** - * Additional recipients (other than the merchant) receiving a portion of this tender. - * For example, fees assessed on the purchase by a third party integration. - */ - additionalRecipients?: AdditionalRecipient[] | null; - /** - * The ID of the [Payment](entity:Payment) that corresponds to this tender. - * This value is only present for payments created with the v2 Payments API. - */ - paymentId?: string | null; -} - -export const tenderSchema: Schema = object({ - id: ['id', optional(string())], - locationId: ['location_id', optional(nullable(string()))], - transactionId: ['transaction_id', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - note: ['note', optional(nullable(string()))], - amountMoney: ['amount_money', optional(lazy(() => moneySchema))], - tipMoney: ['tip_money', optional(lazy(() => moneySchema))], - processingFeeMoney: [ - 'processing_fee_money', - optional(lazy(() => moneySchema)), - ], - customerId: ['customer_id', optional(nullable(string()))], - type: ['type', string()], - cardDetails: ['card_details', optional(lazy(() => tenderCardDetailsSchema))], - cashDetails: ['cash_details', optional(lazy(() => tenderCashDetailsSchema))], - bankAccountDetails: [ - 'bank_account_details', - optional(lazy(() => tenderBankAccountDetailsSchema)), - ], - buyNowPayLaterDetails: [ - 'buy_now_pay_later_details', - optional(lazy(() => tenderBuyNowPayLaterDetailsSchema)), - ], - squareAccountDetails: [ - 'square_account_details', - optional(lazy(() => tenderSquareAccountDetailsSchema)), - ], - additionalRecipients: [ - 'additional_recipients', - optional(nullable(array(lazy(() => additionalRecipientSchema)))), - ], - paymentId: ['payment_id', optional(nullable(string()))], -}); diff --git a/src/models/tenderBankAccountDetails.ts b/src/models/tenderBankAccountDetails.ts deleted file mode 100644 index 4d33742eb..000000000 --- a/src/models/tenderBankAccountDetails.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** - * Represents the details of a tender with `type` `BANK_ACCOUNT`. - * See [BankAccountPaymentDetails]($m/BankAccountPaymentDetails) - * for more exposed details of a bank account payment. - */ -export interface TenderBankAccountDetails { - /** Indicates the bank account payment's current status. */ - status?: string; -} - -export const tenderBankAccountDetailsSchema: Schema = object( - { status: ['status', optional(string())] } -); diff --git a/src/models/tenderBuyNowPayLaterDetails.ts b/src/models/tenderBuyNowPayLaterDetails.ts deleted file mode 100644 index 39858faa5..000000000 --- a/src/models/tenderBuyNowPayLaterDetails.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. */ -export interface TenderBuyNowPayLaterDetails { - buyNowPayLaterBrand?: string; - status?: string; -} - -export const tenderBuyNowPayLaterDetailsSchema: Schema = object( - { - buyNowPayLaterBrand: ['buy_now_pay_later_brand', optional(string())], - status: ['status', optional(string())], - } -); diff --git a/src/models/tenderCardDetails.ts b/src/models/tenderCardDetails.ts deleted file mode 100644 index 5c95b0eb6..000000000 --- a/src/models/tenderCardDetails.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Card, cardSchema } from './card'; - -/** Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` */ -export interface TenderCardDetails { - /** Indicates the card transaction's current status. */ - status?: string; - /** - * Represents the payment details of a card to be used for payments. These - * details are determined by the payment token generated by Web Payments SDK. - */ - card?: Card; - /** Indicates the method used to enter the card's details. */ - entryMethod?: string; -} - -export const tenderCardDetailsSchema: Schema = object({ - status: ['status', optional(string())], - card: ['card', optional(lazy(() => cardSchema))], - entryMethod: ['entry_method', optional(string())], -}); diff --git a/src/models/tenderCashDetails.ts b/src/models/tenderCashDetails.ts deleted file mode 100644 index 4ac81e067..000000000 --- a/src/models/tenderCashDetails.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents the details of a tender with `type` `CASH`. */ -export interface TenderCashDetails { - /** - * 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. - */ - buyerTenderedMoney?: Money; - /** - * 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. - */ - changeBackMoney?: Money; -} - -export const tenderCashDetailsSchema: Schema = object({ - buyerTenderedMoney: [ - 'buyer_tendered_money', - optional(lazy(() => moneySchema)), - ], - changeBackMoney: ['change_back_money', optional(lazy(() => moneySchema))], -}); diff --git a/src/models/tenderSquareAccountDetails.ts b/src/models/tenderSquareAccountDetails.ts deleted file mode 100644 index 711431f78..000000000 --- a/src/models/tenderSquareAccountDetails.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** Represents the details of a tender with `type` `SQUARE_ACCOUNT`. */ -export interface TenderSquareAccountDetails { - status?: string; -} - -export const tenderSquareAccountDetailsSchema: Schema = object( - { status: ['status', optional(string())] } -); diff --git a/src/models/terminalAction.ts b/src/models/terminalAction.ts deleted file mode 100644 index c4d58c7fa..000000000 --- a/src/models/terminalAction.ts +++ /dev/null @@ -1,126 +0,0 @@ -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 { - /** A unique ID for this `TerminalAction`. */ - id?: string; - /** - * The unique Id of the device intended for this `TerminalAction`. - * The Id can be retrieved from /v2/devices api. - */ - deviceId?: string | null; - /** - * The duration as an RFC 3339 duration, after which the action will be automatically canceled. - * TerminalActions that are `PENDING` will be automatically `CANCELED` and have a cancellation reason - * of `TIMED_OUT` - * Default: 5 minutes from creation - * Maximum: 5 minutes - */ - deadlineDuration?: string | null; - /** - * The status of the `TerminalAction`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` - */ - status?: string; - cancelReason?: string; - /** The time when the `TerminalAction` was created as an RFC 3339 timestamp. */ - createdAt?: string; - /** The time when the `TerminalAction` was last updated as an RFC 3339 timestamp. */ - updatedAt?: string; - /** The ID of the application that created the action. */ - appId?: string; - /** The location id the action is attached to, if a link can be made. */ - locationId?: 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({ - id: ['id', optional(string())], - deviceId: ['device_id', optional(nullable(string()))], - deadlineDuration: ['deadline_duration', optional(nullable(string()))], - status: ['status', optional(string())], - cancelReason: ['cancel_reason', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - appId: ['app_id', optional(string())], - locationId: ['location_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/terminalActionQuery.ts b/src/models/terminalActionQuery.ts deleted file mode 100644 index ead135616..000000000 --- a/src/models/terminalActionQuery.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - TerminalActionQueryFilter, - terminalActionQueryFilterSchema, -} from './terminalActionQueryFilter'; -import { - TerminalActionQuerySort, - terminalActionQuerySortSchema, -} from './terminalActionQuerySort'; - -export interface TerminalActionQuery { - filter?: TerminalActionQueryFilter; - sort?: TerminalActionQuerySort; -} - -export const terminalActionQuerySchema: Schema = object({ - filter: ['filter', optional(lazy(() => terminalActionQueryFilterSchema))], - sort: ['sort', optional(lazy(() => terminalActionQuerySortSchema))], -}); diff --git a/src/models/terminalActionQueryFilter.ts b/src/models/terminalActionQueryFilter.ts deleted file mode 100644 index 8ba104547..000000000 --- a/src/models/terminalActionQueryFilter.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -export interface TerminalActionQueryFilter { - /** - * `TerminalAction`s associated with a specific device. If no device is specified then all - * `TerminalAction`s for the merchant will be displayed. - */ - deviceId?: string | null; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - createdAt?: TimeRange; - /** - * Filter results with the desired status of the `TerminalAction` - * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` - */ - status?: string | null; - /** Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. */ - type?: string; -} - -export const terminalActionQueryFilterSchema: Schema = object( - { - deviceId: ['device_id', optional(nullable(string()))], - createdAt: ['created_at', optional(lazy(() => timeRangeSchema))], - status: ['status', optional(nullable(string()))], - type: ['type', optional(string())], - } -); diff --git a/src/models/terminalActionQuerySort.ts b/src/models/terminalActionQuerySort.ts deleted file mode 100644 index 474b73e52..000000000 --- a/src/models/terminalActionQuerySort.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -export interface TerminalActionQuerySort { - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; -} - -export const terminalActionQuerySortSchema: Schema = object( - { sortOrder: ['sort_order', optional(string())] } -); diff --git a/src/models/terminalCheckout.ts b/src/models/terminalCheckout.ts deleted file mode 100644 index d993ab541..000000000 --- a/src/models/terminalCheckout.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { - DeviceCheckoutOptions, - deviceCheckoutOptionsSchema, -} from './deviceCheckoutOptions'; -import { Money, moneySchema } from './money'; -import { PaymentOptions, paymentOptionsSchema } from './paymentOptions'; - -/** Represents a checkout processed by the Square Terminal. */ -export interface TerminalCheckout { - /** A unique ID for this `TerminalCheckout`. */ - id?: string; - /** - * 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. - */ - amountMoney: Money; - /** - * An optional user-defined reference ID that can be used to associate - * this `TerminalCheckout` to another entity in an external system. For example, an order - * ID generated by a third-party shopping cart. The ID is also associated with any payments - * used to complete the checkout. - */ - referenceId?: string | null; - /** - * An optional note to associate with the checkout, as well as with any payments used to complete the checkout. - * Note: maximum 500 characters - */ - note?: string | null; - /** The reference to the Square order ID for the checkout request. Supported only in the US. */ - orderId?: string | null; - paymentOptions?: PaymentOptions; - deviceOptions: DeviceCheckoutOptions; - /** - * An RFC 3339 duration, after which the checkout is automatically canceled. - * A `TerminalCheckout` that is `PENDING` is automatically `CANCELED` and has a cancellation reason - * of `TIMED_OUT`. - * Default: 5 minutes from creation - * Maximum: 5 minutes - */ - deadlineDuration?: string | null; - /** - * The status of the `TerminalCheckout`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` - */ - status?: string; - cancelReason?: string; - /** A list of IDs for payments created by this `TerminalCheckout`. */ - paymentIds?: string[]; - /** The time when the `TerminalCheckout` was created, as an RFC 3339 timestamp. */ - createdAt?: string; - /** The time when the `TerminalCheckout` was last updated, as an RFC 3339 timestamp. */ - updatedAt?: string; - /** The ID of the application that created the checkout. */ - appId?: string; - /** The location of the device where the `TerminalCheckout` was directed. */ - locationId?: string; - paymentType?: string; - /** An optional ID of the team member associated with creating the checkout. */ - teamMemberId?: string | null; - /** An optional ID of the customer associated with the checkout. */ - customerId?: 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. - */ - appFeeMoney?: Money; - /** - * Optional additional payment information to include on the customer's card statement as - * part of the statement description. This can be, for example, an invoice number, ticket number, - * or short description that uniquely identifies the purchase. Supported only in the US. - */ - statementDescriptionIdentifier?: 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. - */ - tipMoney?: Money; -} - -export const terminalCheckoutSchema: Schema = object({ - id: ['id', optional(string())], - amountMoney: ['amount_money', lazy(() => moneySchema)], - referenceId: ['reference_id', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - orderId: ['order_id', optional(nullable(string()))], - paymentOptions: [ - 'payment_options', - optional(lazy(() => paymentOptionsSchema)), - ], - deviceOptions: ['device_options', lazy(() => deviceCheckoutOptionsSchema)], - deadlineDuration: ['deadline_duration', optional(nullable(string()))], - status: ['status', optional(string())], - cancelReason: ['cancel_reason', optional(string())], - paymentIds: ['payment_ids', optional(array(string()))], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - appId: ['app_id', optional(string())], - locationId: ['location_id', optional(string())], - paymentType: ['payment_type', optional(string())], - teamMemberId: ['team_member_id', optional(nullable(string()))], - customerId: ['customer_id', optional(nullable(string()))], - appFeeMoney: ['app_fee_money', optional(lazy(() => moneySchema))], - statementDescriptionIdentifier: [ - 'statement_description_identifier', - optional(nullable(string())), - ], - tipMoney: ['tip_money', optional(lazy(() => moneySchema))], -}); diff --git a/src/models/terminalCheckoutQuery.ts b/src/models/terminalCheckoutQuery.ts deleted file mode 100644 index a7ad2099a..000000000 --- a/src/models/terminalCheckoutQuery.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - TerminalCheckoutQueryFilter, - terminalCheckoutQueryFilterSchema, -} from './terminalCheckoutQueryFilter'; -import { - TerminalCheckoutQuerySort, - terminalCheckoutQuerySortSchema, -} from './terminalCheckoutQuerySort'; - -export interface TerminalCheckoutQuery { - filter?: TerminalCheckoutQueryFilter; - sort?: TerminalCheckoutQuerySort; -} - -export const terminalCheckoutQuerySchema: Schema = object( - { - filter: ['filter', optional(lazy(() => terminalCheckoutQueryFilterSchema))], - sort: ['sort', optional(lazy(() => terminalCheckoutQuerySortSchema))], - } -); diff --git a/src/models/terminalCheckoutQueryFilter.ts b/src/models/terminalCheckoutQueryFilter.ts deleted file mode 100644 index cedebea95..000000000 --- a/src/models/terminalCheckoutQueryFilter.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -export interface TerminalCheckoutQueryFilter { - /** - * The `TerminalCheckout` objects associated with a specific device. If no device is specified, then all - * `TerminalCheckout` objects for the merchant are displayed. - */ - deviceId?: string | null; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - createdAt?: TimeRange; - /** - * Filtered results with the desired status of the `TerminalCheckout`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED` - */ - status?: string | null; -} - -export const terminalCheckoutQueryFilterSchema: Schema = object( - { - deviceId: ['device_id', optional(nullable(string()))], - createdAt: ['created_at', optional(lazy(() => timeRangeSchema))], - status: ['status', optional(nullable(string()))], - } -); diff --git a/src/models/terminalCheckoutQuerySort.ts b/src/models/terminalCheckoutQuerySort.ts deleted file mode 100644 index 4930e2837..000000000 --- a/src/models/terminalCheckoutQuerySort.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -export interface TerminalCheckoutQuerySort { - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - sortOrder?: string; -} - -export const terminalCheckoutQuerySortSchema: Schema = object( - { sortOrder: ['sort_order', optional(string())] } -); diff --git a/src/models/terminalRefund.ts b/src/models/terminalRefund.ts deleted file mode 100644 index 5949336e3..000000000 --- a/src/models/terminalRefund.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Money, moneySchema } from './money'; - -/** Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. */ -export interface TerminalRefund { - /** A unique ID for this `TerminalRefund`. */ - id?: string; - /** The reference to the payment refund created by completing this `TerminalRefund`. */ - refundId?: string; - /** The unique ID of the payment being refunded. */ - paymentId: string; - /** The reference to the Square order ID for the payment identified by the `payment_id`. */ - orderId?: string; - /** - * 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. - */ - amountMoney: Money; - /** A description of the reason for the refund. */ - reason: string; - /** - * The unique ID of the device intended for this `TerminalRefund`. - * The Id can be retrieved from /v2/devices api. - */ - deviceId: string; - /** - * The RFC 3339 duration, after which the refund is automatically canceled. - * A `TerminalRefund` that is `PENDING` is automatically `CANCELED` and has a cancellation reason - * of `TIMED_OUT`. - * Default: 5 minutes from creation. - * Maximum: 5 minutes - */ - deadlineDuration?: string | null; - /** - * The status of the `TerminalRefund`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. - */ - status?: string; - cancelReason?: string; - /** The time when the `TerminalRefund` was created, as an RFC 3339 timestamp. */ - createdAt?: string; - /** The time when the `TerminalRefund` was last updated, as an RFC 3339 timestamp. */ - updatedAt?: string; - /** The ID of the application that created the refund. */ - appId?: string; - /** The location of the device where the `TerminalRefund` was directed. */ - locationId?: string; -} - -export const terminalRefundSchema: Schema = object({ - id: ['id', optional(string())], - refundId: ['refund_id', optional(string())], - paymentId: ['payment_id', string()], - orderId: ['order_id', optional(string())], - amountMoney: ['amount_money', lazy(() => moneySchema)], - reason: ['reason', string()], - deviceId: ['device_id', string()], - deadlineDuration: ['deadline_duration', optional(nullable(string()))], - status: ['status', optional(string())], - cancelReason: ['cancel_reason', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - appId: ['app_id', optional(string())], - locationId: ['location_id', optional(string())], -}); diff --git a/src/models/terminalRefundQuery.ts b/src/models/terminalRefundQuery.ts deleted file mode 100644 index bacdcb3fd..000000000 --- a/src/models/terminalRefundQuery.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - TerminalRefundQueryFilter, - terminalRefundQueryFilterSchema, -} from './terminalRefundQueryFilter'; -import { - TerminalRefundQuerySort, - terminalRefundQuerySortSchema, -} from './terminalRefundQuerySort'; - -export interface TerminalRefundQuery { - filter?: TerminalRefundQueryFilter; - sort?: TerminalRefundQuerySort; -} - -export const terminalRefundQuerySchema: Schema = object({ - filter: ['filter', optional(lazy(() => terminalRefundQueryFilterSchema))], - sort: ['sort', optional(lazy(() => terminalRefundQuerySortSchema))], -}); diff --git a/src/models/terminalRefundQueryFilter.ts b/src/models/terminalRefundQueryFilter.ts deleted file mode 100644 index 122f83ca4..000000000 --- a/src/models/terminalRefundQueryFilter.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { TimeRange, timeRangeSchema } from './timeRange'; - -export interface TerminalRefundQueryFilter { - /** - * `TerminalRefund` objects associated with a specific device. If no device is specified, then all - * `TerminalRefund` objects for the signed-in account are displayed. - */ - deviceId?: string | null; - /** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ - createdAt?: TimeRange; - /** - * Filtered results with the desired status of the `TerminalRefund`. - * Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, or `COMPLETED`. - */ - status?: string | null; -} - -export const terminalRefundQueryFilterSchema: Schema = object( - { - deviceId: ['device_id', optional(nullable(string()))], - createdAt: ['created_at', optional(lazy(() => timeRangeSchema))], - status: ['status', optional(nullable(string()))], - } -); diff --git a/src/models/terminalRefundQuerySort.ts b/src/models/terminalRefundQuerySort.ts deleted file mode 100644 index b2fe4620a..000000000 --- a/src/models/terminalRefundQuerySort.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface TerminalRefundQuerySort { - /** - * The order in which results are listed. - * - `ASC` - Oldest to newest. - * - `DESC` - Newest to oldest (default). - */ - sortOrder?: string | null; -} - -export const terminalRefundQuerySortSchema: Schema = object( - { sortOrder: ['sort_order', optional(nullable(string()))] } -); diff --git a/src/models/testWebhookSubscriptionRequest.ts b/src/models/testWebhookSubscriptionRequest.ts deleted file mode 100644 index 776357741..000000000 --- a/src/models/testWebhookSubscriptionRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Tests a [Subscription]($m/WebhookSubscription) by sending a test event to its notification URL. */ -export interface TestWebhookSubscriptionRequest { - /** - * The event type that will be used to test the [Subscription](entity:WebhookSubscription). The event type must be - * contained in the list of event types in the [Subscription](entity:WebhookSubscription). - */ - eventType?: string | null; -} - -export const testWebhookSubscriptionRequestSchema: Schema = object( - { eventType: ['event_type', optional(nullable(string()))] } -); diff --git a/src/models/testWebhookSubscriptionResponse.ts b/src/models/testWebhookSubscriptionResponse.ts deleted file mode 100644 index 13fb8b8af..000000000 --- a/src/models/testWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - SubscriptionTestResult, - subscriptionTestResultSchema, -} from './subscriptionTestResult'; - -/** - * Defines the fields that are included in the response body of - * a request to the [TestWebhookSubscription]($e/WebhookSubscriptions/TestWebhookSubscription) endpoint. - * Note: If there are errors processing the request, the [SubscriptionTestResult]($m/SubscriptionTestResult) field is not - * present. - */ -export interface TestWebhookSubscriptionResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** - * Represents the details of a webhook subscription, including notification URL, - * event types, and signature key. - */ - subscriptionTestResult?: SubscriptionTestResult; -} - -export const testWebhookSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscriptionTestResult: [ - 'subscription_test_result', - optional(lazy(() => subscriptionTestResultSchema)), - ], - } -); diff --git a/src/models/timeRange.ts b/src/models/timeRange.ts deleted file mode 100644 index 15ed89350..000000000 --- a/src/models/timeRange.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** - * Represents a generic time range. The start and end values are - * represented in RFC 3339 format. Time ranges are customized to be - * inclusive or exclusive based on the needs of a particular endpoint. - * Refer to the relevant endpoint-specific documentation to determine - * how time ranges are handled. - */ -export interface TimeRange { - /** - * A datetime value in RFC 3339 format indicating when the time range - * starts. - */ - startAt?: string | null; - /** - * A datetime value in RFC 3339 format indicating when the time range - * ends. - */ - endAt?: string | null; -} - -export const timeRangeSchema: Schema = object({ - startAt: ['start_at', optional(nullable(string()))], - endAt: ['end_at', optional(nullable(string()))], -}); diff --git a/src/models/tipSettings.ts b/src/models/tipSettings.ts deleted file mode 100644 index 877c3b07c..000000000 --- a/src/models/tipSettings.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { - array, - boolean, - nullable, - number, - object, - optional, - Schema, -} from '../schema'; - -export interface TipSettings { - /** Indicates whether tipping is enabled for this checkout. Defaults to false. */ - allowTipping?: boolean | null; - /** - * Indicates whether tip options should be presented on the screen before presenting - * the signature screen during card payment. Defaults to false. - */ - separateTipScreen?: boolean | null; - /** Indicates whether custom tip amounts are allowed during the checkout flow. Defaults to false. */ - customTipField?: boolean | null; - /** - * A list of tip percentages that should be presented during the checkout flow, specified as - * up to 3 non-negative integers from 0 to 100 (inclusive). Defaults to 15, 20, and 25. - */ - tipPercentages?: number[] | null; - /** - * Enables the "Smart Tip Amounts" behavior. - * Exact tipping options depend on the region in which the Square seller is active. - * For payments under 10.00, in the Australia, Canada, Ireland, United Kingdom, and United States, tipping options are presented as no tip, .50, 1.00 or 2.00. - * For payment amounts of 10.00 or greater, tipping options are presented as the following percentages: 0%, 5%, 10%, 15%. - * If set to true, the `tip_percentages` settings is ignored. - * Defaults to false. - * To learn more about smart tipping, see [Accept Tips with the Square App](https://squareup.com/help/us/en/article/5069-accept-tips-with-the-square-app). - */ - smartTipping?: boolean | null; -} - -export const tipSettingsSchema: Schema = object({ - allowTipping: ['allow_tipping', optional(nullable(boolean()))], - separateTipScreen: ['separate_tip_screen', optional(nullable(boolean()))], - customTipField: ['custom_tip_field', optional(nullable(boolean()))], - tipPercentages: ['tip_percentages', optional(nullable(array(number())))], - smartTipping: ['smart_tipping', optional(nullable(boolean()))], -}); diff --git a/src/models/transaction.ts b/src/models/transaction.ts deleted file mode 100644 index 59876c444..000000000 --- a/src/models/transaction.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { Refund, refundSchema } from './refund'; -import { Tender, tenderSchema } from './tender'; - -/** - * Represents a transaction processed with Square, either with the - * Connect API or with Square Point of Sale. - * The `tenders` field of this object lists all methods of payment used to pay in - * the transaction. - */ -export interface Transaction { - /** The transaction's unique ID, issued by Square payments servers. */ - id?: string; - /** The ID of the transaction's associated location. */ - locationId?: string | null; - /** The timestamp for when the transaction was created, in RFC 3339 format. */ - createdAt?: string; - /** The tenders used to pay in the transaction. */ - tenders?: Tender[] | null; - /** Refunds that have been applied to any tender in the transaction. */ - refunds?: Refund[] | null; - /** - * If the transaction was created with the [Charge](api-endpoint:Transactions-Charge) - * endpoint, this value is the same as the value provided for the `reference_id` - * parameter in the request to that endpoint. Otherwise, it is not set. - */ - referenceId?: string | null; - /** Indicates the Square product used to process a transaction. */ - product?: string; - /** - * If the transaction was created in the Square Point of Sale app, this value - * is the ID generated for the transaction by Square Point of Sale. - * This ID has no relationship to the transaction's canonical `id`, which is - * generated by Square's backend servers. This value is generated for bookkeeping - * purposes, in case the transaction cannot immediately be completed (for example, - * if the transaction is processed in offline mode). - * It is not currently possible with the Connect API to perform a transaction - * lookup by this value. - */ - clientId?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - shippingAddress?: Address; - /** The order_id is an identifier for the order associated with this transaction, if any. */ - orderId?: string | null; -} - -export const transactionSchema: Schema = object({ - id: ['id', optional(string())], - locationId: ['location_id', optional(nullable(string()))], - createdAt: ['created_at', optional(string())], - tenders: ['tenders', optional(nullable(array(lazy(() => tenderSchema))))], - refunds: ['refunds', optional(nullable(array(lazy(() => refundSchema))))], - referenceId: ['reference_id', optional(nullable(string()))], - product: ['product', optional(string())], - clientId: ['client_id', optional(nullable(string()))], - shippingAddress: ['shipping_address', optional(lazy(() => addressSchema))], - orderId: ['order_id', optional(nullable(string()))], -}); diff --git a/src/models/unlinkCustomerFromGiftCardRequest.ts b/src/models/unlinkCustomerFromGiftCardRequest.ts deleted file mode 100644 index e3cf3b785..000000000 --- a/src/models/unlinkCustomerFromGiftCardRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** A request to unlink a customer from a gift card. */ -export interface UnlinkCustomerFromGiftCardRequest { - /** The ID of the customer to unlink from the gift card. */ - customerId: string; -} - -export const unlinkCustomerFromGiftCardRequestSchema: Schema = object( - { customerId: ['customer_id', string()] } -); diff --git a/src/models/unlinkCustomerFromGiftCardResponse.ts b/src/models/unlinkCustomerFromGiftCardResponse.ts deleted file mode 100644 index 724e615ed..000000000 --- a/src/models/unlinkCustomerFromGiftCardResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { GiftCard, giftCardSchema } from './giftCard'; - -/** - * A response that contains the unlinked `GiftCard` object. If the request resulted in errors, - * the response contains a set of `Error` objects. - */ -export interface UnlinkCustomerFromGiftCardResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square gift card. */ - giftCard?: GiftCard; -} - -export const unlinkCustomerFromGiftCardResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - giftCard: ['gift_card', optional(lazy(() => giftCardSchema))], - } -); diff --git a/src/models/updateBookingCustomAttributeDefinitionRequest.ts b/src/models/updateBookingCustomAttributeDefinitionRequest.ts deleted file mode 100644 index e33d534af..000000000 --- a/src/models/updateBookingCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents an [UpdateBookingCustomAttributeDefinition]($e/BookingCustomAttributes/UpdateBookingCustomAttributeDefinition) request. */ -export interface UpdateBookingCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const updateBookingCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/updateBookingCustomAttributeDefinitionResponse.ts b/src/models/updateBookingCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 00e495e18..000000000 --- a/src/models/updateBookingCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents an [UpdateBookingCustomAttributeDefinition]($e/BookingCustomAttributes/UpdateBookingCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface UpdateBookingCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateBookingCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateBookingRequest.ts b/src/models/updateBookingRequest.ts deleted file mode 100644 index f6ac2d870..000000000 --- a/src/models/updateBookingRequest.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Booking, bookingSchema } from './booking'; - -export interface UpdateBookingRequest { - /** A unique key to make this request an idempotent operation. */ - idempotencyKey?: string | null; - /** - * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service - * at a given location to a requesting customer in one or more appointment segments. - */ - booking: Booking; -} - -export const updateBookingRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - booking: ['booking', lazy(() => bookingSchema)], -}); diff --git a/src/models/updateBookingResponse.ts b/src/models/updateBookingResponse.ts deleted file mode 100644 index 3009393a8..000000000 --- a/src/models/updateBookingResponse.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Booking, bookingSchema } from './booking'; -import { Error, errorSchema } from './error'; - -export interface UpdateBookingResponse { - /** - * Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service - * at a given location to a requesting customer in one or more appointment segments. - */ - booking?: Booking; - /** Errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateBookingResponseSchema: Schema = object( - { - booking: ['booking', optional(lazy(() => bookingSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateBreakTypeRequest.ts b/src/models/updateBreakTypeRequest.ts deleted file mode 100644 index 2a8f8cd18..000000000 --- a/src/models/updateBreakTypeRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { BreakType, breakTypeSchema } from './breakType'; - -/** A request to update a `BreakType`. */ -export interface UpdateBreakTypeRequest { - /** - * A defined break template that sets an expectation for possible `Break` - * instances on a `Shift`. - */ - breakType: BreakType; -} - -export const updateBreakTypeRequestSchema: Schema = object( - { breakType: ['break_type', lazy(() => breakTypeSchema)] } -); diff --git a/src/models/updateBreakTypeResponse.ts b/src/models/updateBreakTypeResponse.ts deleted file mode 100644 index 3bad6b2bf..000000000 --- a/src/models/updateBreakTypeResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { BreakType, breakTypeSchema } from './breakType'; -import { Error, errorSchema } from './error'; - -/** - * A response to a request to update a `BreakType`. The response contains - * the requested `BreakType` objects and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface UpdateBreakTypeResponse { - /** - * A defined break template that sets an expectation for possible `Break` - * instances on a `Shift`. - */ - breakType?: BreakType; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateBreakTypeResponseSchema: Schema = object( - { - breakType: ['break_type', optional(lazy(() => breakTypeSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateCatalogImageRequest.ts b/src/models/updateCatalogImageRequest.ts deleted file mode 100644 index ed5097663..000000000 --- a/src/models/updateCatalogImageRequest.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -export interface UpdateCatalogImageRequest { - /** - * A unique string that identifies this UpdateCatalogImage request. - * Keys can be any valid string but must be unique for every UpdateCatalogImage request. - * See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - */ - idempotencyKey: string; -} - -export const updateCatalogImageRequestSchema: Schema = object( - { idempotencyKey: ['idempotency_key', string()] } -); diff --git a/src/models/updateCatalogImageResponse.ts b/src/models/updateCatalogImageResponse.ts deleted file mode 100644 index 21836197b..000000000 --- a/src/models/updateCatalogImageResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -export interface UpdateCatalogImageResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The wrapper object for the catalog entries of a given object type. - * Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. - * For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. - * In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. - * For a more detailed discussion of the Catalog data model, please see the - * [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. - */ - image?: CatalogObject; -} - -export const updateCatalogImageResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - image: ['image', optional(lazy(() => catalogObjectSchema))], - } -); diff --git a/src/models/updateCustomerCustomAttributeDefinitionRequest.ts b/src/models/updateCustomerCustomAttributeDefinitionRequest.ts deleted file mode 100644 index e1e667888..000000000 --- a/src/models/updateCustomerCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents an [UpdateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/UpdateCustomerCustomAttributeDefinition) request. */ -export interface UpdateCustomerCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const updateCustomerCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/updateCustomerCustomAttributeDefinitionResponse.ts b/src/models/updateCustomerCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 8f32b1205..000000000 --- a/src/models/updateCustomerCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents an [UpdateCustomerCustomAttributeDefinition]($e/CustomerCustomAttributes/UpdateCustomerCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface UpdateCustomerCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateCustomerCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateCustomerGroupRequest.ts b/src/models/updateCustomerGroupRequest.ts deleted file mode 100644 index 7118dfbdd..000000000 --- a/src/models/updateCustomerGroupRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { CustomerGroup, customerGroupSchema } from './customerGroup'; - -/** - * Defines the body parameters that can be included in a request to the - * [UpdateCustomerGroup]($e/CustomerGroups/UpdateCustomerGroup) endpoint. - */ -export interface UpdateCustomerGroupRequest { - /** - * Represents a group of customer profiles. - * Customer groups can be created, be modified, and have their membership defined using - * the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. - */ - group: CustomerGroup; -} - -export const updateCustomerGroupRequestSchema: Schema = object( - { group: ['group', lazy(() => customerGroupSchema)] } -); diff --git a/src/models/updateCustomerGroupResponse.ts b/src/models/updateCustomerGroupResponse.ts deleted file mode 100644 index c34ec9e53..000000000 --- a/src/models/updateCustomerGroupResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomerGroup, customerGroupSchema } from './customerGroup'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [UpdateCustomerGroup]($e/CustomerGroups/UpdateCustomerGroup) endpoint. - * Either `errors` or `group` is present in a given response (never both). - */ -export interface UpdateCustomerGroupResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * Represents a group of customer profiles. - * Customer groups can be created, be modified, and have their membership defined using - * the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. - */ - group?: CustomerGroup; -} - -export const updateCustomerGroupResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - group: ['group', optional(lazy(() => customerGroupSchema))], - } -); diff --git a/src/models/updateCustomerRequest.ts b/src/models/updateCustomerRequest.ts deleted file mode 100644 index 230fceb40..000000000 --- a/src/models/updateCustomerRequest.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - bigint, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { CustomerTaxIds, customerTaxIdsSchema } from './customerTaxIds'; - -/** - * Defines the body parameters that can be included in a request to the - * `UpdateCustomer` endpoint. - */ -export interface UpdateCustomerRequest { - /** - * The given name (that is, the first name) associated with the customer profile. - * The maximum length for this value is 300 characters. - */ - givenName?: string | null; - /** - * The family name (that is, the last name) associated with the customer profile. - * The maximum length for this value is 300 characters. - */ - familyName?: string | null; - /** - * A business name associated with the customer profile. - * The maximum length for this value is 500 characters. - */ - companyName?: string | null; - /** - * A nickname for the customer profile. - * The maximum length for this value is 100 characters. - */ - nickname?: string | null; - /** - * The email address associated with the customer profile. - * The maximum length for this value is 254 characters. - */ - emailAddress?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; - /** - * The phone number associated with the customer profile. The phone number must be valid and can contain - * 9–16 digits, with an optional `+` prefix and country code. For more information, see - * [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number). - */ - phoneNumber?: string | null; - /** - * An optional second ID used to associate the customer profile with an - * entity in another system. - * The maximum length for this value is 100 characters. - */ - referenceId?: string | null; - /** A custom note associated with the customer profile. */ - note?: string | null; - /** - * The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example, - * specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD` - * format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified. - */ - birthday?: string | null; - /** - * The current version of the customer profile. - * As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile). - */ - version?: bigint; - /** - * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. - * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). - */ - taxIds?: CustomerTaxIds; -} - -export const updateCustomerRequestSchema: Schema = object( - { - givenName: ['given_name', optional(nullable(string()))], - familyName: ['family_name', optional(nullable(string()))], - companyName: ['company_name', optional(nullable(string()))], - nickname: ['nickname', optional(nullable(string()))], - emailAddress: ['email_address', optional(nullable(string()))], - address: ['address', optional(lazy(() => addressSchema))], - phoneNumber: ['phone_number', optional(nullable(string()))], - referenceId: ['reference_id', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - birthday: ['birthday', optional(nullable(string()))], - version: ['version', optional(bigint())], - taxIds: ['tax_ids', optional(lazy(() => customerTaxIdsSchema))], - } -); diff --git a/src/models/updateCustomerResponse.ts b/src/models/updateCustomerResponse.ts deleted file mode 100644 index 691536daa..000000000 --- a/src/models/updateCustomerResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Customer, customerSchema } from './customer'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [UpdateCustomer]($e/Customers/UpdateCustomer) or - * [BulkUpdateCustomers]($e/Customers/BulkUpdateCustomers) endpoint. - * Either `errors` or `customer` is present in a given response (never both). - */ -export interface UpdateCustomerResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a Square customer profile in the Customer Directory of a Square seller. */ - customer?: Customer; -} - -export const updateCustomerResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - customer: ['customer', optional(lazy(() => customerSchema))], - } -); diff --git a/src/models/updateInvoiceRequest.ts b/src/models/updateInvoiceRequest.ts deleted file mode 100644 index 632a5e5ad..000000000 --- a/src/models/updateInvoiceRequest.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Invoice, invoiceSchema } from './invoice'; - -/** Describes a `UpdateInvoice` request. */ -export interface UpdateInvoiceRequest { - /** - * Stores information about an invoice. You use the Invoices API to create and manage - * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - */ - invoice: Invoice; - /** - * A unique string that identifies the `UpdateInvoice` request. If you do not - * provide `idempotency_key` (or provide an empty string as the value), the endpoint - * treats each request as independent. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; - /** - * The list of fields to clear. Although this field is currently supported, we - * recommend using null values or the `remove` field when possible. For examples, see - * [Update an Invoice](https://developer.squareup.com/docs/invoices-api/update-invoices). - */ - fieldsToClear?: string[] | null; -} - -export const updateInvoiceRequestSchema: Schema = object({ - invoice: ['invoice', lazy(() => invoiceSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - fieldsToClear: ['fields_to_clear', optional(nullable(array(string())))], -}); diff --git a/src/models/updateInvoiceResponse.ts b/src/models/updateInvoiceResponse.ts deleted file mode 100644 index ff6f390d8..000000000 --- a/src/models/updateInvoiceResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Invoice, invoiceSchema } from './invoice'; - -/** Describes a `UpdateInvoice` response. */ -export interface UpdateInvoiceResponse { - /** - * Stores information about an invoice. You use the Invoices API to create and manage - * invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). - */ - invoice?: Invoice; - /** Information about errors encountered during the request. */ - errors?: Error[]; -} - -export const updateInvoiceResponseSchema: Schema = object( - { - invoice: ['invoice', optional(lazy(() => invoiceSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateItemModifierListsRequest.ts b/src/models/updateItemModifierListsRequest.ts deleted file mode 100644 index 499edf651..000000000 --- a/src/models/updateItemModifierListsRequest.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -export interface UpdateItemModifierListsRequest { - /** The IDs of the catalog items associated with the CatalogModifierList objects being updated. */ - itemIds: string[]; - /** - * The IDs of the CatalogModifierList objects to enable for the CatalogItem. - * At least one of `modifier_lists_to_enable` or `modifier_lists_to_disable` must be specified. - */ - modifierListsToEnable?: string[] | null; - /** - * The IDs of the CatalogModifierList objects to disable for the CatalogItem. - * At least one of `modifier_lists_to_enable` or `modifier_lists_to_disable` must be specified. - */ - modifierListsToDisable?: string[] | null; -} - -export const updateItemModifierListsRequestSchema: Schema = object( - { - itemIds: ['item_ids', array(string())], - modifierListsToEnable: [ - 'modifier_lists_to_enable', - optional(nullable(array(string()))), - ], - modifierListsToDisable: [ - 'modifier_lists_to_disable', - optional(nullable(array(string()))), - ], - } -); diff --git a/src/models/updateItemModifierListsResponse.ts b/src/models/updateItemModifierListsResponse.ts deleted file mode 100644 index 53c33bbab..000000000 --- a/src/models/updateItemModifierListsResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -export interface UpdateItemModifierListsResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The database [timestamp](https://developer.squareup.com/docs/build-basics/common-data-types/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. */ - updatedAt?: string; -} - -export const updateItemModifierListsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - updatedAt: ['updated_at', optional(string())], - } -); diff --git a/src/models/updateItemTaxesRequest.ts b/src/models/updateItemTaxesRequest.ts deleted file mode 100644 index e531beb47..000000000 --- a/src/models/updateItemTaxesRequest.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, nullable, object, optional, Schema, string } from '../schema'; - -export interface UpdateItemTaxesRequest { - /** - * IDs for the CatalogItems associated with the CatalogTax objects being updated. - * No more than 1,000 IDs may be provided. - */ - itemIds: string[]; - /** - * IDs of the CatalogTax objects to enable. - * At least one of `taxes_to_enable` or `taxes_to_disable` must be specified. - */ - taxesToEnable?: string[] | null; - /** - * IDs of the CatalogTax objects to disable. - * At least one of `taxes_to_enable` or `taxes_to_disable` must be specified. - */ - taxesToDisable?: string[] | null; -} - -export const updateItemTaxesRequestSchema: Schema = object( - { - itemIds: ['item_ids', array(string())], - taxesToEnable: ['taxes_to_enable', optional(nullable(array(string())))], - taxesToDisable: ['taxes_to_disable', optional(nullable(array(string())))], - } -); diff --git a/src/models/updateItemTaxesResponse.ts b/src/models/updateItemTaxesResponse.ts deleted file mode 100644 index 4ebca7d25..000000000 --- a/src/models/updateItemTaxesResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -export interface UpdateItemTaxesResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., `2016-09-04T23:59:33.123Z`. */ - updatedAt?: string; -} - -export const updateItemTaxesResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - updatedAt: ['updated_at', optional(string())], - } -); diff --git a/src/models/updateJobRequest.ts b/src/models/updateJobRequest.ts deleted file mode 100644 index 1ea9e6662..000000000 --- a/src/models/updateJobRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { Job, jobSchema } from './job'; - -/** Represents an [UpdateJob]($e/Team/UpdateJob) request. */ -export interface UpdateJobRequest { - /** - * Represents a job that can be assigned to [team members]($m/TeamMember). This object defines the - * job's title and tip eligibility. Compensation is defined in a [job assignment]($m/JobAssignment) - * in a team member's wage setting. - */ - job: Job; -} - -export const updateJobRequestSchema: Schema = object({ - job: ['job', lazy(() => jobSchema)], -}); diff --git a/src/models/updateJobResponse.ts b/src/models/updateJobResponse.ts deleted file mode 100644 index c60c53b61..000000000 --- a/src/models/updateJobResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Job, jobSchema } from './job'; - -/** - * Represents an [UpdateJob]($e/Team/UpdateJob) response. Either `job` or `errors` - * is present in the response. - */ -export interface UpdateJobResponse { - /** - * Represents a job that can be assigned to [team members]($m/TeamMember). This object defines the - * job's title and tip eligibility. Compensation is defined in a [job assignment]($m/JobAssignment) - * in a team member's wage setting. - */ - job?: Job; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateJobResponseSchema: Schema = object({ - job: ['job', optional(lazy(() => jobSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/updateLocationCustomAttributeDefinitionRequest.ts b/src/models/updateLocationCustomAttributeDefinitionRequest.ts deleted file mode 100644 index 5d6e3cb15..000000000 --- a/src/models/updateLocationCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents an [UpdateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/UpdateLocationCustomAttributeDefinition) request. */ -export interface UpdateLocationCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const updateLocationCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/updateLocationCustomAttributeDefinitionResponse.ts b/src/models/updateLocationCustomAttributeDefinitionResponse.ts deleted file mode 100644 index 19a086cc8..000000000 --- a/src/models/updateLocationCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents an [UpdateLocationCustomAttributeDefinition]($e/LocationCustomAttributes/UpdateLocationCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface UpdateLocationCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateLocationCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateLocationRequest.ts b/src/models/updateLocationRequest.ts deleted file mode 100644 index f5b96ea31..000000000 --- a/src/models/updateLocationRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { Location, locationSchema } from './location'; - -/** The request object for the [UpdateLocation]($e/Locations/UpdateLocation) endpoint. */ -export interface UpdateLocationRequest { - /** Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ - location?: Location; -} - -export const updateLocationRequestSchema: Schema = object( - { location: ['location', optional(lazy(() => locationSchema))] } -); diff --git a/src/models/updateLocationResponse.ts b/src/models/updateLocationResponse.ts deleted file mode 100644 index 12f918b8b..000000000 --- a/src/models/updateLocationResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Location, locationSchema } from './location'; - -/** The response object returned by the [UpdateLocation]($e/Locations/UpdateLocation) endpoint. */ -export interface UpdateLocationResponse { - /** Information about errors encountered during the request. */ - errors?: Error[]; - /** Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). */ - location?: Location; -} - -export const updateLocationResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - location: ['location', optional(lazy(() => locationSchema))], - } -); diff --git a/src/models/updateLocationSettingsRequest.ts b/src/models/updateLocationSettingsRequest.ts deleted file mode 100644 index b6f4ed3ed..000000000 --- a/src/models/updateLocationSettingsRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { - CheckoutLocationSettings, - checkoutLocationSettingsSchema, -} from './checkoutLocationSettings'; - -export interface UpdateLocationSettingsRequest { - locationSettings: CheckoutLocationSettings; -} - -export const updateLocationSettingsRequestSchema: Schema = object( - { - locationSettings: [ - 'location_settings', - lazy(() => checkoutLocationSettingsSchema), - ], - } -); diff --git a/src/models/updateLocationSettingsResponse.ts b/src/models/updateLocationSettingsResponse.ts deleted file mode 100644 index 1f90301a2..000000000 --- a/src/models/updateLocationSettingsResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CheckoutLocationSettings, - checkoutLocationSettingsSchema, -} from './checkoutLocationSettings'; -import { Error, errorSchema } from './error'; - -export interface UpdateLocationSettingsResponse { - /** Any errors that occurred when updating the location settings. */ - errors?: Error[]; - locationSettings?: CheckoutLocationSettings; -} - -export const updateLocationSettingsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - locationSettings: [ - 'location_settings', - optional(lazy(() => checkoutLocationSettingsSchema)), - ], - } -); diff --git a/src/models/updateMerchantCustomAttributeDefinitionRequest.ts b/src/models/updateMerchantCustomAttributeDefinitionRequest.ts deleted file mode 100644 index ad773757f..000000000 --- a/src/models/updateMerchantCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents an [UpdateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/UpdateMerchantCustomAttributeDefinition) request. */ -export interface UpdateMerchantCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const updateMerchantCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/updateMerchantCustomAttributeDefinitionResponse.ts b/src/models/updateMerchantCustomAttributeDefinitionResponse.ts deleted file mode 100644 index b0273d67b..000000000 --- a/src/models/updateMerchantCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** - * Represents an [UpdateMerchantCustomAttributeDefinition]($e/MerchantCustomAttributes/UpdateMerchantCustomAttributeDefinition) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface UpdateMerchantCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateMerchantCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateMerchantSettingsRequest.ts b/src/models/updateMerchantSettingsRequest.ts deleted file mode 100644 index ee62f7f61..000000000 --- a/src/models/updateMerchantSettingsRequest.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { - CheckoutMerchantSettings, - checkoutMerchantSettingsSchema, -} from './checkoutMerchantSettings'; - -export interface UpdateMerchantSettingsRequest { - merchantSettings: CheckoutMerchantSettings; -} - -export const updateMerchantSettingsRequestSchema: Schema = object( - { - merchantSettings: [ - 'merchant_settings', - lazy(() => checkoutMerchantSettingsSchema), - ], - } -); diff --git a/src/models/updateMerchantSettingsResponse.ts b/src/models/updateMerchantSettingsResponse.ts deleted file mode 100644 index 66343c9cf..000000000 --- a/src/models/updateMerchantSettingsResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CheckoutMerchantSettings, - checkoutMerchantSettingsSchema, -} from './checkoutMerchantSettings'; -import { Error, errorSchema } from './error'; - -export interface UpdateMerchantSettingsResponse { - /** Any errors that occurred when updating the merchant settings. */ - errors?: Error[]; - merchantSettings?: CheckoutMerchantSettings; -} - -export const updateMerchantSettingsResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - merchantSettings: [ - 'merchant_settings', - optional(lazy(() => checkoutMerchantSettingsSchema)), - ], - } -); diff --git a/src/models/updateOrderCustomAttributeDefinitionRequest.ts b/src/models/updateOrderCustomAttributeDefinitionRequest.ts deleted file mode 100644 index d98bf6a1f..000000000 --- a/src/models/updateOrderCustomAttributeDefinitionRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; - -/** Represents an update request for an order custom attribute definition. */ -export interface UpdateOrderCustomAttributeDefinitionRequest { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition: CustomAttributeDefinition; - /** - * A unique identifier for this request, used to ensure idempotency. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const updateOrderCustomAttributeDefinitionRequestSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - lazy(() => customAttributeDefinitionSchema), - ], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/updateOrderCustomAttributeDefinitionResponse.ts b/src/models/updateOrderCustomAttributeDefinitionResponse.ts deleted file mode 100644 index d5f177d11..000000000 --- a/src/models/updateOrderCustomAttributeDefinitionResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from './customAttributeDefinition'; -import { Error, errorSchema } from './error'; - -/** Represents a response from updating an order custom attribute definition. */ -export interface UpdateOrderCustomAttributeDefinitionResponse { - /** - * Represents a definition for custom attribute values. A custom attribute definition - * specifies the key, visibility, schema, and other properties for a custom attribute. - */ - customAttributeDefinition?: CustomAttributeDefinition; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateOrderCustomAttributeDefinitionResponseSchema: Schema = object( - { - customAttributeDefinition: [ - 'custom_attribute_definition', - optional(lazy(() => customAttributeDefinitionSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateOrderRequest.ts b/src/models/updateOrderRequest.ts deleted file mode 100644 index 668dea9c8..000000000 --- a/src/models/updateOrderRequest.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { - array, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { Order, orderSchema } from './order'; - -/** - * Defines the fields that are included in requests to the - * [UpdateOrder]($e/Orders/UpdateOrder) endpoint. - */ -export interface UpdateOrderRequest { - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - /** - * The [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete) - * fields to clear. For example, `line_items[uid].note`. - * For more information, see [Deleting fields](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#deleting-fields). - */ - fieldsToClear?: string[] | null; - /** - * A value you specify that uniquely identifies this update request. - * If you are unsure whether a particular update was applied to an order successfully, - * you can reattempt it with the same idempotency key without - * worrying about creating duplicate updates to the order. - * The latest order version is returned. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const updateOrderRequestSchema: Schema = object({ - order: ['order', optional(lazy(() => orderSchema))], - fieldsToClear: ['fields_to_clear', optional(nullable(array(string())))], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], -}); diff --git a/src/models/updateOrderResponse.ts b/src/models/updateOrderResponse.ts deleted file mode 100644 index dbbef49d6..000000000 --- a/src/models/updateOrderResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Order, orderSchema } from './order'; - -/** - * Defines the fields that are included in the response body of - * a request to the [UpdateOrder]($e/Orders/UpdateOrder) endpoint. - */ -export interface UpdateOrderResponse { - /** - * Contains all information related to a single order to process with Square, - * including line items that specify the products to purchase. `Order` objects also - * include information about any associated tenders, refunds, and returns. - * All Connect V2 Transactions have all been converted to Orders including all associated - * itemization data. - */ - order?: Order; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateOrderResponseSchema: Schema = object({ - order: ['order', optional(lazy(() => orderSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/updatePaymentLinkRequest.ts b/src/models/updatePaymentLinkRequest.ts deleted file mode 100644 index bc8c845dc..000000000 --- a/src/models/updatePaymentLinkRequest.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { PaymentLink, paymentLinkSchema } from './paymentLink'; - -export interface UpdatePaymentLinkRequest { - paymentLink: PaymentLink; -} - -export const updatePaymentLinkRequestSchema: Schema = object( - { paymentLink: ['payment_link', lazy(() => paymentLinkSchema)] } -); diff --git a/src/models/updatePaymentLinkResponse.ts b/src/models/updatePaymentLinkResponse.ts deleted file mode 100644 index 65b4989a8..000000000 --- a/src/models/updatePaymentLinkResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { PaymentLink, paymentLinkSchema } from './paymentLink'; - -export interface UpdatePaymentLinkResponse { - /** Any errors that occurred when updating the payment link. */ - errors?: Error[]; - paymentLink?: PaymentLink; -} - -export const updatePaymentLinkResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - paymentLink: ['payment_link', optional(lazy(() => paymentLinkSchema))], - } -); diff --git a/src/models/updatePaymentRequest.ts b/src/models/updatePaymentRequest.ts deleted file mode 100644 index 22df1e311..000000000 --- a/src/models/updatePaymentRequest.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { lazy, object, optional, Schema, string } from '../schema'; -import { Payment, paymentSchema } from './payment'; - -/** - * Describes a request to update a payment using - * [UpdatePayment]($e/Payments/UpdatePayment). - */ -export interface UpdatePaymentRequest { - /** Represents a payment processed by the Square API. */ - payment?: Payment; - /** - * A unique string that identifies this `UpdatePayment` request. Keys can be any valid string - * but must be unique for every `UpdatePayment` request. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey: string; -} - -export const updatePaymentRequestSchema: Schema = object({ - payment: ['payment', optional(lazy(() => paymentSchema))], - idempotencyKey: ['idempotency_key', string()], -}); diff --git a/src/models/updatePaymentResponse.ts b/src/models/updatePaymentResponse.ts deleted file mode 100644 index 1cd55ab91..000000000 --- a/src/models/updatePaymentResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Payment, paymentSchema } from './payment'; - -/** - * Defines the response returned by - * [UpdatePayment]($e/Payments/UpdatePayment). - */ -export interface UpdatePaymentResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents a payment processed by the Square API. */ - payment?: Payment; -} - -export const updatePaymentResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - payment: ['payment', optional(lazy(() => paymentSchema))], - } -); diff --git a/src/models/updateShiftRequest.ts b/src/models/updateShiftRequest.ts deleted file mode 100644 index 5b198c0e5..000000000 --- a/src/models/updateShiftRequest.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { Shift, shiftSchema } from './shift'; - -/** A request to update a `Shift` object. */ -export interface UpdateShiftRequest { - /** - * A record of the hourly rate, start, and end times for a single work shift - * for an employee. This might include a record of the start and end times for breaks - * taken during the shift. - */ - shift: Shift; -} - -export const updateShiftRequestSchema: Schema = object({ - shift: ['shift', lazy(() => shiftSchema)], -}); diff --git a/src/models/updateShiftResponse.ts b/src/models/updateShiftResponse.ts deleted file mode 100644 index 872c230e2..000000000 --- a/src/models/updateShiftResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Shift, shiftSchema } from './shift'; - -/** - * The response to a request to update a `Shift`. The response contains - * the updated `Shift` object and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface UpdateShiftResponse { - /** - * A record of the hourly rate, start, and end times for a single work shift - * for an employee. This might include a record of the start and end times for breaks - * taken during the shift. - */ - shift?: Shift; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateShiftResponseSchema: Schema = object({ - shift: ['shift', optional(lazy(() => shiftSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], -}); diff --git a/src/models/updateSubscriptionRequest.ts b/src/models/updateSubscriptionRequest.ts deleted file mode 100644 index 48c3a8a44..000000000 --- a/src/models/updateSubscriptionRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { Subscription, subscriptionSchema } from './subscription'; - -/** - * Defines input parameters in a request to the - * [UpdateSubscription]($e/Subscriptions/UpdateSubscription) endpoint. - */ -export interface UpdateSubscriptionRequest { - /** - * Represents a subscription purchased by a customer. - * For more information, see - * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). - */ - subscription?: Subscription; -} - -export const updateSubscriptionRequestSchema: Schema = object( - { subscription: ['subscription', optional(lazy(() => subscriptionSchema))] } -); diff --git a/src/models/updateSubscriptionResponse.ts b/src/models/updateSubscriptionResponse.ts deleted file mode 100644 index e7dc5f443..000000000 --- a/src/models/updateSubscriptionResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Subscription, subscriptionSchema } from './subscription'; - -/** - * Defines output parameters in a response from the - * [UpdateSubscription]($e/Subscriptions/UpdateSubscription) endpoint. - */ -export interface UpdateSubscriptionResponse { - /** Errors encountered during the request. */ - errors?: Error[]; - /** - * Represents a subscription purchased by a customer. - * For more information, see - * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). - */ - subscription?: Subscription; -} - -export const updateSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: ['subscription', optional(lazy(() => subscriptionSchema))], - } -); diff --git a/src/models/updateTeamMemberRequest.ts b/src/models/updateTeamMemberRequest.ts deleted file mode 100644 index 4bbc129b9..000000000 --- a/src/models/updateTeamMemberRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { TeamMember, teamMemberSchema } from './teamMember'; - -/** Represents an update request for a `TeamMember` object. */ -export interface UpdateTeamMemberRequest { - /** A record representing an individual team member for a business. */ - teamMember?: TeamMember; -} - -export const updateTeamMemberRequestSchema: Schema = object( - { teamMember: ['team_member', optional(lazy(() => teamMemberSchema))] } -); diff --git a/src/models/updateTeamMemberResponse.ts b/src/models/updateTeamMemberResponse.ts deleted file mode 100644 index 537234239..000000000 --- a/src/models/updateTeamMemberResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { TeamMember, teamMemberSchema } from './teamMember'; - -/** Represents a response from an update request containing the updated `TeamMember` object or error messages. */ -export interface UpdateTeamMemberResponse { - /** A record representing an individual team member for a business. */ - teamMember?: TeamMember; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateTeamMemberResponseSchema: Schema = object( - { - teamMember: ['team_member', optional(lazy(() => teamMemberSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateVendorRequest.ts b/src/models/updateVendorRequest.ts deleted file mode 100644 index b21809d5c..000000000 --- a/src/models/updateVendorRequest.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { Vendor, vendorSchema } from './vendor'; - -/** Represents an input to a call to [UpdateVendor]($e/Vendors/UpdateVendor). */ -export interface UpdateVendorRequest { - /** - * A client-supplied, universally unique identifier (UUID) for the - * request. - * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the - * [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more - * information. - */ - idempotencyKey?: string | null; - /** Represents a supplier to a seller. */ - vendor: Vendor; -} - -export const updateVendorRequestSchema: Schema = object({ - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - vendor: ['vendor', lazy(() => vendorSchema)], -}); diff --git a/src/models/updateVendorResponse.ts b/src/models/updateVendorResponse.ts deleted file mode 100644 index 53c55c84f..000000000 --- a/src/models/updateVendorResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Vendor, vendorSchema } from './vendor'; - -/** Represents an output from a call to [UpdateVendor]($e/Vendors/UpdateVendor). */ -export interface UpdateVendorResponse { - /** Errors occurred when the request fails. */ - errors?: Error[]; - /** Represents a supplier to a seller. */ - vendor?: Vendor; -} - -export const updateVendorResponseSchema: Schema = object({ - errors: ['errors', optional(array(lazy(() => errorSchema)))], - vendor: ['vendor', optional(lazy(() => vendorSchema))], -}); diff --git a/src/models/updateWageSettingRequest.ts b/src/models/updateWageSettingRequest.ts deleted file mode 100644 index 48e3018b8..000000000 --- a/src/models/updateWageSettingRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { WageSetting, wageSettingSchema } from './wageSetting'; - -/** Represents an update request for the `WageSetting` object describing a `TeamMember`. */ -export interface UpdateWageSettingRequest { - /** - * Represents information about the overtime exemption status, job assignments, and compensation - * for a [team member]($m/TeamMember). - */ - wageSetting: WageSetting; -} - -export const updateWageSettingRequestSchema: Schema = object( - { wageSetting: ['wage_setting', lazy(() => wageSettingSchema)] } -); diff --git a/src/models/updateWageSettingResponse.ts b/src/models/updateWageSettingResponse.ts deleted file mode 100644 index 76f711caf..000000000 --- a/src/models/updateWageSettingResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { WageSetting, wageSettingSchema } from './wageSetting'; - -/** - * Represents a response from an update request containing the updated `WageSetting` object - * or error messages. - */ -export interface UpdateWageSettingResponse { - /** - * Represents information about the overtime exemption status, job assignments, and compensation - * for a [team member]($m/TeamMember). - */ - wageSetting?: WageSetting; - /** The errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateWageSettingResponseSchema: Schema = object( - { - wageSetting: ['wage_setting', optional(lazy(() => wageSettingSchema))], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/updateWebhookSubscriptionRequest.ts b/src/models/updateWebhookSubscriptionRequest.ts deleted file mode 100644 index de9d9b364..000000000 --- a/src/models/updateWebhookSubscriptionRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, object, optional, Schema } from '../schema'; -import { - WebhookSubscription, - webhookSubscriptionSchema, -} from './webhookSubscription'; - -/** Updates a [Subscription]($m/WebhookSubscription). */ -export interface UpdateWebhookSubscriptionRequest { - /** - * Represents the details of a webhook subscription, including notification URL, - * event types, and signature key. - */ - subscription?: WebhookSubscription; -} - -export const updateWebhookSubscriptionRequestSchema: Schema = object( - { - subscription: [ - 'subscription', - optional(lazy(() => webhookSubscriptionSchema)), - ], - } -); diff --git a/src/models/updateWebhookSubscriptionResponse.ts b/src/models/updateWebhookSubscriptionResponse.ts deleted file mode 100644 index 0fd376383..000000000 --- a/src/models/updateWebhookSubscriptionResponse.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { - WebhookSubscription, - webhookSubscriptionSchema, -} from './webhookSubscription'; - -/** - * Defines the fields that are included in the response body of - * a request to the [UpdateWebhookSubscription]($e/WebhookSubscriptions/UpdateWebhookSubscription) endpoint. - * Note: If there are errors processing the request, the [Subscription]($m/WebhookSubscription) is not - * present. - */ -export interface UpdateWebhookSubscriptionResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** - * Represents the details of a webhook subscription, including notification URL, - * event types, and signature key. - */ - subscription?: WebhookSubscription; -} - -export const updateWebhookSubscriptionResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - subscription: [ - 'subscription', - optional(lazy(() => webhookSubscriptionSchema)), - ], - } -); diff --git a/src/models/updateWebhookSubscriptionSignatureKeyRequest.ts b/src/models/updateWebhookSubscriptionSignatureKeyRequest.ts deleted file mode 100644 index 6d3894ec8..000000000 --- a/src/models/updateWebhookSubscriptionSignatureKeyRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** Updates a [Subscription]($m/WebhookSubscription) by replacing the existing signature key with a new one. */ -export interface UpdateWebhookSubscriptionSignatureKeyRequest { - /** A unique string that identifies the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) request. */ - idempotencyKey?: string | null; -} - -export const updateWebhookSubscriptionSignatureKeyRequestSchema: Schema = object( - { idempotencyKey: ['idempotency_key', optional(nullable(string()))] } -); diff --git a/src/models/updateWebhookSubscriptionSignatureKeyResponse.ts b/src/models/updateWebhookSubscriptionSignatureKeyResponse.ts deleted file mode 100644 index 8f97d5166..000000000 --- a/src/models/updateWebhookSubscriptionSignatureKeyResponse.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { array, lazy, object, optional, Schema, string } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [UpdateWebhookSubscriptionSignatureKey]($e/WebhookSubscriptions/UpdateWebhookSubscriptionSignatureKey) endpoint. - * Note: If there are errors processing the request, the [Subscription]($m/WebhookSubscription) is not - * present. - */ -export interface UpdateWebhookSubscriptionSignatureKeyResponse { - /** Information on errors encountered during the request. */ - errors?: Error[]; - /** The new Square-generated signature key used to validate the origin of the webhook event. */ - signatureKey?: string; -} - -export const updateWebhookSubscriptionSignatureKeyResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - signatureKey: ['signature_key', optional(string())], - } -); diff --git a/src/models/updateWorkweekConfigRequest.ts b/src/models/updateWorkweekConfigRequest.ts deleted file mode 100644 index 299fbcfce..000000000 --- a/src/models/updateWorkweekConfigRequest.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { WorkweekConfig, workweekConfigSchema } from './workweekConfig'; - -/** A request to update a `WorkweekConfig` object. */ -export interface UpdateWorkweekConfigRequest { - /** - * Sets the day of the week and hour of the day that a business starts a - * workweek. This is used to calculate overtime pay. - */ - workweekConfig: WorkweekConfig; -} - -export const updateWorkweekConfigRequestSchema: Schema = object( - { workweekConfig: ['workweek_config', lazy(() => workweekConfigSchema)] } -); diff --git a/src/models/updateWorkweekConfigResponse.ts b/src/models/updateWorkweekConfigResponse.ts deleted file mode 100644 index 23c234b78..000000000 --- a/src/models/updateWorkweekConfigResponse.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { WorkweekConfig, workweekConfigSchema } from './workweekConfig'; - -/** - * The response to a request to update a `WorkweekConfig` object. The response contains - * the updated `WorkweekConfig` object and might contain a set of `Error` objects if - * the request resulted in errors. - */ -export interface UpdateWorkweekConfigResponse { - /** - * Sets the day of the week and hour of the day that a business starts a - * workweek. This is used to calculate overtime pay. - */ - workweekConfig?: WorkweekConfig; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const updateWorkweekConfigResponseSchema: Schema = object( - { - workweekConfig: [ - 'workweek_config', - optional(lazy(() => workweekConfigSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/upsertBookingCustomAttributeRequest.ts b/src/models/upsertBookingCustomAttributeRequest.ts deleted file mode 100644 index 962b7f587..000000000 --- a/src/models/upsertBookingCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** Represents an [UpsertBookingCustomAttribute]($e/BookingCustomAttributes/UpsertBookingCustomAttribute) request. */ -export interface UpsertBookingCustomAttributeRequest { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const upsertBookingCustomAttributeRequestSchema: Schema = object( - { - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/upsertBookingCustomAttributeResponse.ts b/src/models/upsertBookingCustomAttributeResponse.ts deleted file mode 100644 index f737b828b..000000000 --- a/src/models/upsertBookingCustomAttributeResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents an [UpsertBookingCustomAttribute]($e/BookingCustomAttributes/UpsertBookingCustomAttribute) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface UpsertBookingCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const upsertBookingCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/upsertCatalogObjectRequest.ts b/src/models/upsertCatalogObjectRequest.ts deleted file mode 100644 index 3a763292b..000000000 --- a/src/models/upsertCatalogObjectRequest.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { lazy, object, Schema, string } from '../schema'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; - -export interface UpsertCatalogObjectRequest { - /** - * A value you specify that uniquely identifies this - * request among all your requests. A common way to create - * a valid idempotency key is to use a Universally unique - * identifier (UUID). - * If you're unsure whether a particular request was successful, - * you can reattempt it with the same idempotency key without - * worrying about creating duplicate objects. - * See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. - */ - idempotencyKey: string; - /** - * The wrapper object for the catalog entries of a given object type. - * Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. - * For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. - * In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. - * For a more detailed discussion of the Catalog data model, please see the - * [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. - */ - object: CatalogObject; -} - -export const upsertCatalogObjectRequestSchema: Schema = object( - { - idempotencyKey: ['idempotency_key', string()], - object: ['object', lazy(() => catalogObjectSchema)], - } -); diff --git a/src/models/upsertCatalogObjectResponse.ts b/src/models/upsertCatalogObjectResponse.ts deleted file mode 100644 index 1355027b4..000000000 --- a/src/models/upsertCatalogObjectResponse.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CatalogIdMapping, catalogIdMappingSchema } from './catalogIdMapping'; -import { CatalogObject, catalogObjectSchema } from './catalogObject'; -import { Error, errorSchema } from './error'; - -export interface UpsertCatalogObjectResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** - * The wrapper object for the catalog entries of a given object type. - * Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. - * For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. - * In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. - * For a more detailed discussion of the Catalog data model, please see the - * [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. - */ - catalogObject?: CatalogObject; - /** The mapping between client and server IDs for this upsert. */ - idMappings?: CatalogIdMapping[]; -} - -export const upsertCatalogObjectResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - catalogObject: [ - 'catalog_object', - optional(lazy(() => catalogObjectSchema)), - ], - idMappings: [ - 'id_mappings', - optional(array(lazy(() => catalogIdMappingSchema))), - ], - } -); diff --git a/src/models/upsertCustomerCustomAttributeRequest.ts b/src/models/upsertCustomerCustomAttributeRequest.ts deleted file mode 100644 index be27673f3..000000000 --- a/src/models/upsertCustomerCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** Represents an [UpsertCustomerCustomAttribute]($e/CustomerCustomAttributes/UpsertCustomerCustomAttribute) request. */ -export interface UpsertCustomerCustomAttributeRequest { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const upsertCustomerCustomAttributeRequestSchema: Schema = object( - { - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/upsertCustomerCustomAttributeResponse.ts b/src/models/upsertCustomerCustomAttributeResponse.ts deleted file mode 100644 index 2caa71ad1..000000000 --- a/src/models/upsertCustomerCustomAttributeResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents an [UpsertCustomerCustomAttribute]($e/CustomerCustomAttributes/UpsertCustomerCustomAttribute) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface UpsertCustomerCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const upsertCustomerCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/upsertLocationCustomAttributeRequest.ts b/src/models/upsertLocationCustomAttributeRequest.ts deleted file mode 100644 index 7a0e15cc7..000000000 --- a/src/models/upsertLocationCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** Represents an [UpsertLocationCustomAttribute]($e/LocationCustomAttributes/UpsertLocationCustomAttribute) request. */ -export interface UpsertLocationCustomAttributeRequest { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const upsertLocationCustomAttributeRequestSchema: Schema = object( - { - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/upsertLocationCustomAttributeResponse.ts b/src/models/upsertLocationCustomAttributeResponse.ts deleted file mode 100644 index 1a7090b58..000000000 --- a/src/models/upsertLocationCustomAttributeResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents an [UpsertLocationCustomAttribute]($e/LocationCustomAttributes/UpsertLocationCustomAttribute) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface UpsertLocationCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const upsertLocationCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/upsertMerchantCustomAttributeRequest.ts b/src/models/upsertMerchantCustomAttributeRequest.ts deleted file mode 100644 index ecde9e025..000000000 --- a/src/models/upsertMerchantCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** Represents an [UpsertMerchantCustomAttribute]($e/MerchantCustomAttributes/UpsertMerchantCustomAttribute) request. */ -export interface UpsertMerchantCustomAttributeRequest { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this request, used to ensure idempotency. For more information, - * see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const upsertMerchantCustomAttributeRequestSchema: Schema = object( - { - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/upsertMerchantCustomAttributeResponse.ts b/src/models/upsertMerchantCustomAttributeResponse.ts deleted file mode 100644 index 348f9716d..000000000 --- a/src/models/upsertMerchantCustomAttributeResponse.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** - * Represents an [UpsertMerchantCustomAttribute]($e/MerchantCustomAttributes/UpsertMerchantCustomAttribute) response. - * Either `custom_attribute_definition` or `errors` is present in the response. - */ -export interface UpsertMerchantCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const upsertMerchantCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/upsertOrderCustomAttributeRequest.ts b/src/models/upsertOrderCustomAttributeRequest.ts deleted file mode 100644 index 8d5f3399c..000000000 --- a/src/models/upsertOrderCustomAttributeRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; - -/** Represents an upsert request for an order custom attribute. */ -export interface UpsertOrderCustomAttributeRequest { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute: CustomAttribute; - /** - * A unique identifier for this request, used to ensure idempotency. - * For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). - */ - idempotencyKey?: string | null; -} - -export const upsertOrderCustomAttributeRequestSchema: Schema = object( - { - customAttribute: ['custom_attribute', lazy(() => customAttributeSchema)], - idempotencyKey: ['idempotency_key', optional(nullable(string()))], - } -); diff --git a/src/models/upsertOrderCustomAttributeResponse.ts b/src/models/upsertOrderCustomAttributeResponse.ts deleted file mode 100644 index af5bc77e2..000000000 --- a/src/models/upsertOrderCustomAttributeResponse.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { CustomAttribute, customAttributeSchema } from './customAttribute'; -import { Error, errorSchema } from './error'; - -/** Represents a response from upserting order custom attribute definitions. */ -export interface UpsertOrderCustomAttributeResponse { - /** - * A custom attribute value. Each custom attribute value has a corresponding - * `CustomAttributeDefinition` object. - */ - customAttribute?: CustomAttribute; - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const upsertOrderCustomAttributeResponseSchema: Schema = object( - { - customAttribute: [ - 'custom_attribute', - optional(lazy(() => customAttributeSchema)), - ], - errors: ['errors', optional(array(lazy(() => errorSchema)))], - } -); diff --git a/src/models/upsertSnippetRequest.ts b/src/models/upsertSnippetRequest.ts deleted file mode 100644 index a609ebf6a..000000000 --- a/src/models/upsertSnippetRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { lazy, object, Schema } from '../schema'; -import { Snippet, snippetSchema } from './snippet'; - -/** Represents an `UpsertSnippet` request. */ -export interface UpsertSnippetRequest { - /** Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. */ - snippet: Snippet; -} - -export const upsertSnippetRequestSchema: Schema = object({ - snippet: ['snippet', lazy(() => snippetSchema)], -}); diff --git a/src/models/upsertSnippetResponse.ts b/src/models/upsertSnippetResponse.ts deleted file mode 100644 index 40259b05d..000000000 --- a/src/models/upsertSnippetResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; -import { Snippet, snippetSchema } from './snippet'; - -/** Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`. */ -export interface UpsertSnippetResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; - /** Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. */ - snippet?: Snippet; -} - -export const upsertSnippetResponseSchema: Schema = object( - { - errors: ['errors', optional(array(lazy(() => errorSchema)))], - snippet: ['snippet', optional(lazy(() => snippetSchema))], - } -); diff --git a/src/models/v1Device.ts b/src/models/v1Device.ts deleted file mode 100644 index cb2787652..000000000 --- a/src/models/v1Device.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -export interface V1Device { - /** The device's Square-issued ID. */ - id?: string; - /** The device's merchant-specified name. */ - name?: string | null; -} - -export const v1DeviceSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', optional(nullable(string()))], -}); diff --git a/src/models/v1ListOrdersRequest.ts b/src/models/v1ListOrdersRequest.ts deleted file mode 100644 index 6e44e4996..000000000 --- a/src/models/v1ListOrdersRequest.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface V1ListOrdersRequest { - /** The order (e.g., chronological or alphabetical) in which results from a request are returned. */ - order?: string; - /** The maximum number of payments to return in a single response. This value cannot exceed 200. */ - limit?: number | null; - /** - * A pagination cursor to retrieve the next set of results for your - * original query to the endpoint. - */ - batchToken?: string | null; -} - -export const v1ListOrdersRequestSchema: Schema = object({ - order: ['order', optional(string())], - limit: ['limit', optional(nullable(number()))], - batchToken: ['batch_token', optional(nullable(string()))], -}); diff --git a/src/models/v1ListOrdersResponse.ts b/src/models/v1ListOrdersResponse.ts deleted file mode 100644 index 820bbe4cc..000000000 --- a/src/models/v1ListOrdersResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { V1Order, v1OrderSchema } from './v1Order'; - -export interface V1ListOrdersResponse { - items?: V1Order[]; -} - -export const v1ListOrdersResponseSchema: Schema = object({ - items: ['items', optional(array(lazy(() => v1OrderSchema)))], -}); diff --git a/src/models/v1Money.ts b/src/models/v1Money.ts deleted file mode 100644 index edec01a9c..000000000 --- a/src/models/v1Money.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { nullable, number, object, optional, Schema, string } from '../schema'; - -export interface V1Money { - /** - * Amount in the lowest denominated value of this Currency. E.g. in USD - * these are cents, in JPY they are Yen (which do not have a 'cent' concept). - */ - amount?: number | null; - /** - * Indicates the associated currency for an amount of money. Values correspond - * to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). - */ - currencyCode?: string; -} - -export const v1MoneySchema: Schema = object({ - amount: ['amount', optional(nullable(number()))], - currencyCode: ['currency_code', optional(string())], -}); diff --git a/src/models/v1Order.ts b/src/models/v1Order.ts deleted file mode 100644 index c740dc984..000000000 --- a/src/models/v1Order.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { Error, errorSchema } from './error'; -import { V1Money, v1MoneySchema } from './v1Money'; -import { - V1OrderHistoryEntry, - v1OrderHistoryEntrySchema, -} from './v1OrderHistoryEntry'; -import { V1Tender, v1TenderSchema } from './v1Tender'; - -/** V1Order */ -export interface V1Order { - /** Any errors that occurred during the request. */ - errors?: Error[] | null; - /** The order's unique identifier. */ - id?: string; - /** The email address of the order's buyer. */ - buyerEmail?: string | null; - /** The name of the order's buyer. */ - recipientName?: string | null; - /** The phone number to use for the order's delivery. */ - recipientPhoneNumber?: string | null; - state?: string; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - shippingAddress?: Address; - subtotalMoney?: V1Money; - totalShippingMoney?: V1Money; - totalTaxMoney?: V1Money; - totalPriceMoney?: V1Money; - totalDiscountMoney?: V1Money; - /** The time when the order was created, in ISO 8601 format. */ - createdAt?: string; - /** The time when the order was last modified, in ISO 8601 format. */ - updatedAt?: string; - /** The time when the order expires if no action is taken, in ISO 8601 format. */ - expiresAt?: string | null; - /** The unique identifier of the payment associated with the order. */ - paymentId?: string | null; - /** A note provided by the buyer when the order was created, if any. */ - buyerNote?: string | null; - /** A note provided by the merchant when the order's state was set to COMPLETED, if any */ - completedNote?: string | null; - /** A note provided by the merchant when the order's state was set to REFUNDED, if any. */ - refundedNote?: string | null; - /** A note provided by the merchant when the order's state was set to CANCELED, if any. */ - canceledNote?: string | null; - /** - * A tender represents a discrete monetary exchange. Square represents this - * exchange as a money object with a specific currency and amount, where the - * amount is given in the smallest denomination of the given currency. - * Square POS can accept more than one form of tender for a single payment (such - * as by splitting a bill between a credit card and a gift card). The `tender` - * field of the Payment object lists all forms of tender used for the payment. - * Split tender payments behave slightly differently from single tender payments: - * The receipt_url for a split tender corresponds only to the first tender listed - * in the tender field. To get the receipt URLs for the remaining tenders, use - * the receipt_url fields of the corresponding Tender objects. - * *A note on gift cards**: when a customer purchases a Square gift card from a - * merchant, the merchant receives the full amount of the gift card in the - * associated payment. - * When that gift card is used as a tender, the balance of the gift card is - * reduced and the merchant receives no funds. A `Tender` object with a type of - * `SQUARE_GIFT_CARD` indicates a gift card was used for some or all of the - * associated payment. - */ - tender?: V1Tender; - /** The history of actions associated with the order. */ - orderHistory?: V1OrderHistoryEntry[] | null; - /** The promo code provided by the buyer, if any. */ - promoCode?: string | null; - /** For Bitcoin transactions, the address that the buyer sent Bitcoin to. */ - btcReceiveAddress?: string | null; - /** For Bitcoin transactions, the price of the buyer's order in satoshi (100 million satoshi equals 1 BTC). */ - btcPriceSatoshi?: number | null; -} - -export const v1OrderSchema: Schema = object({ - errors: ['errors', optional(nullable(array(lazy(() => errorSchema))))], - id: ['id', optional(string())], - buyerEmail: ['buyer_email', optional(nullable(string()))], - recipientName: ['recipient_name', optional(nullable(string()))], - recipientPhoneNumber: [ - 'recipient_phone_number', - optional(nullable(string())), - ], - state: ['state', optional(string())], - shippingAddress: ['shipping_address', optional(lazy(() => addressSchema))], - subtotalMoney: ['subtotal_money', optional(lazy(() => v1MoneySchema))], - totalShippingMoney: [ - 'total_shipping_money', - optional(lazy(() => v1MoneySchema)), - ], - totalTaxMoney: ['total_tax_money', optional(lazy(() => v1MoneySchema))], - totalPriceMoney: ['total_price_money', optional(lazy(() => v1MoneySchema))], - totalDiscountMoney: [ - 'total_discount_money', - optional(lazy(() => v1MoneySchema)), - ], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - expiresAt: ['expires_at', optional(nullable(string()))], - paymentId: ['payment_id', optional(nullable(string()))], - buyerNote: ['buyer_note', optional(nullable(string()))], - completedNote: ['completed_note', optional(nullable(string()))], - refundedNote: ['refunded_note', optional(nullable(string()))], - canceledNote: ['canceled_note', optional(nullable(string()))], - tender: ['tender', optional(lazy(() => v1TenderSchema))], - orderHistory: [ - 'order_history', - optional(nullable(array(lazy(() => v1OrderHistoryEntrySchema)))), - ], - promoCode: ['promo_code', optional(nullable(string()))], - btcReceiveAddress: ['btc_receive_address', optional(nullable(string()))], - btcPriceSatoshi: ['btc_price_satoshi', optional(nullable(number()))], -}); diff --git a/src/models/v1OrderHistoryEntry.ts b/src/models/v1OrderHistoryEntry.ts deleted file mode 100644 index 8dd970d0c..000000000 --- a/src/models/v1OrderHistoryEntry.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { object, optional, Schema, string } from '../schema'; - -/** V1OrderHistoryEntry */ -export interface V1OrderHistoryEntry { - action?: string; - /** The time when the action was performed, in ISO 8601 format. */ - createdAt?: string; -} - -export const v1OrderHistoryEntrySchema: Schema = object({ - action: ['action', optional(string())], - createdAt: ['created_at', optional(string())], -}); diff --git a/src/models/v1PhoneNumber.ts b/src/models/v1PhoneNumber.ts deleted file mode 100644 index e3dacf476..000000000 --- a/src/models/v1PhoneNumber.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { object, Schema, string } from '../schema'; - -/** Represents a phone number. */ -export interface V1PhoneNumber { - /** The phone number's international calling code. For US phone numbers, this value is +1. */ - callingCode: string; - /** The phone number. */ - number: string; -} - -export const v1PhoneNumberSchema: Schema = object({ - callingCode: ['calling_code', string()], - number: ['number', string()], -}); diff --git a/src/models/v1Tender.ts b/src/models/v1Tender.ts deleted file mode 100644 index 3835460d9..000000000 --- a/src/models/v1Tender.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { - boolean, - lazy, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; -import { V1Money, v1MoneySchema } from './v1Money'; - -/** - * A tender represents a discrete monetary exchange. Square represents this - * exchange as a money object with a specific currency and amount, where the - * amount is given in the smallest denomination of the given currency. - * Square POS can accept more than one form of tender for a single payment (such - * as by splitting a bill between a credit card and a gift card). The `tender` - * field of the Payment object lists all forms of tender used for the payment. - * Split tender payments behave slightly differently from single tender payments: - * The receipt_url for a split tender corresponds only to the first tender listed - * in the tender field. To get the receipt URLs for the remaining tenders, use - * the receipt_url fields of the corresponding Tender objects. - * *A note on gift cards**: when a customer purchases a Square gift card from a - * merchant, the merchant receives the full amount of the gift card in the - * associated payment. - * When that gift card is used as a tender, the balance of the gift card is - * reduced and the merchant receives no funds. A `Tender` object with a type of - * `SQUARE_GIFT_CARD` indicates a gift card was used for some or all of the - * associated payment. - */ -export interface V1Tender { - /** The tender's unique ID. */ - id?: string; - type?: string; - /** A human-readable description of the tender. */ - name?: string | null; - /** The ID of the employee that processed the tender. */ - employeeId?: string | null; - /** The URL of the receipt for the tender. */ - receiptUrl?: string | null; - /** The brand of a credit card. */ - cardBrand?: string; - /** The last four digits of the provided credit card's account number. */ - panSuffix?: string | null; - entryMethod?: string; - /** Notes entered by the merchant about the tender at the time of payment, if any. Typically only present for tender with the type: OTHER. */ - paymentNote?: string | null; - totalMoney?: V1Money; - tenderedMoney?: V1Money; - /** The time when the tender was created, in ISO 8601 format. */ - tenderedAt?: string | null; - /** The time when the tender was settled, in ISO 8601 format. */ - settledAt?: string | null; - changeBackMoney?: V1Money; - refundedMoney?: V1Money; - /** Indicates whether or not the tender is associated with an exchange. If is_exchange is true, the tender represents the value of goods returned in an exchange not the actual money paid. The exchange value reduces the tender amounts needed to pay for items purchased in the exchange. */ - isExchange?: boolean | null; -} - -export const v1TenderSchema: Schema = object({ - id: ['id', optional(string())], - type: ['type', optional(string())], - name: ['name', optional(nullable(string()))], - employeeId: ['employee_id', optional(nullable(string()))], - receiptUrl: ['receipt_url', optional(nullable(string()))], - cardBrand: ['card_brand', optional(string())], - panSuffix: ['pan_suffix', optional(nullable(string()))], - entryMethod: ['entry_method', optional(string())], - paymentNote: ['payment_note', optional(nullable(string()))], - totalMoney: ['total_money', optional(lazy(() => v1MoneySchema))], - tenderedMoney: ['tendered_money', optional(lazy(() => v1MoneySchema))], - tenderedAt: ['tendered_at', optional(nullable(string()))], - settledAt: ['settled_at', optional(nullable(string()))], - changeBackMoney: ['change_back_money', optional(lazy(() => v1MoneySchema))], - refundedMoney: ['refunded_money', optional(lazy(() => v1MoneySchema))], - isExchange: ['is_exchange', optional(nullable(boolean()))], -}); diff --git a/src/models/v1UpdateOrderRequest.ts b/src/models/v1UpdateOrderRequest.ts deleted file mode 100644 index 980d77f1d..000000000 --- a/src/models/v1UpdateOrderRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { nullable, object, optional, Schema, string } from '../schema'; - -/** V1UpdateOrderRequest */ -export interface V1UpdateOrderRequest { - action: string; - /** The tracking number of the shipment associated with the order. Only valid if action is COMPLETE. */ - shippedTrackingNumber?: string | null; - /** A merchant-specified note about the completion of the order. Only valid if action is COMPLETE. */ - completedNote?: string | null; - /** A merchant-specified note about the refunding of the order. Only valid if action is REFUND. */ - refundedNote?: string | null; - /** A merchant-specified note about the canceling of the order. Only valid if action is CANCEL. */ - canceledNote?: string | null; -} - -export const v1UpdateOrderRequestSchema: Schema = object({ - action: ['action', string()], - shippedTrackingNumber: [ - 'shipped_tracking_number', - optional(nullable(string())), - ], - completedNote: ['completed_note', optional(nullable(string()))], - refundedNote: ['refunded_note', optional(nullable(string()))], - canceledNote: ['canceled_note', optional(nullable(string()))], -}); diff --git a/src/models/vendor.ts b/src/models/vendor.ts deleted file mode 100644 index ef25b2c62..000000000 --- a/src/models/vendor.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - array, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { Address, addressSchema } from './address'; -import { VendorContact, vendorContactSchema } from './vendorContact'; - -/** Represents a supplier to a seller. */ -export interface Vendor { - /** - * A unique Square-generated ID for the [Vendor](entity:Vendor). - * This field is required when attempting to update a [Vendor](entity:Vendor). - */ - id?: string; - /** - * An RFC 3339-formatted timestamp that indicates when the - * [Vendor](entity:Vendor) was created. - */ - createdAt?: string; - /** - * An RFC 3339-formatted timestamp that indicates when the - * [Vendor](entity:Vendor) was last updated. - */ - updatedAt?: string; - /** - * The name of the [Vendor](entity:Vendor). - * This field is required when attempting to create or update a [Vendor](entity:Vendor). - */ - name?: string | null; - /** - * Represents a postal address in a country. - * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). - */ - address?: Address; - /** The contacts of the [Vendor](entity:Vendor). */ - contacts?: VendorContact[] | null; - /** The account number of the [Vendor](entity:Vendor). */ - accountNumber?: string | null; - /** A note detailing information about the [Vendor](entity:Vendor). */ - note?: string | null; - /** The version of the [Vendor](entity:Vendor). */ - version?: number; - /** - * The status of the [Vendor]($m/Vendor), - * whether a [Vendor]($m/Vendor) is active or inactive. - */ - status?: string; -} - -export const vendorSchema: Schema = object({ - id: ['id', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], - name: ['name', optional(nullable(string()))], - address: ['address', optional(lazy(() => addressSchema))], - contacts: [ - 'contacts', - optional(nullable(array(lazy(() => vendorContactSchema)))), - ], - accountNumber: ['account_number', optional(nullable(string()))], - note: ['note', optional(nullable(string()))], - version: ['version', optional(number())], - status: ['status', optional(string())], -}); diff --git a/src/models/vendorContact.ts b/src/models/vendorContact.ts deleted file mode 100644 index 289400d85..000000000 --- a/src/models/vendorContact.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { - boolean, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; - -/** Represents a contact of a [Vendor]($m/Vendor). */ -export interface VendorContact { - /** - * A unique Square-generated ID for the [VendorContact](entity:VendorContact). - * This field is required when attempting to update a [VendorContact](entity:VendorContact). - */ - id?: string; - /** - * The name of the [VendorContact](entity:VendorContact). - * This field is required when attempting to create a [Vendor](entity:Vendor). - */ - name?: string | null; - /** The email address of the [VendorContact](entity:VendorContact). */ - emailAddress?: string | null; - /** The phone number of the [VendorContact](entity:VendorContact). */ - phoneNumber?: string | null; - /** The state of the [VendorContact](entity:VendorContact). */ - removed?: boolean | null; - /** The ordinal of the [VendorContact](entity:VendorContact). */ - ordinal: number; -} - -export const vendorContactSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', optional(nullable(string()))], - emailAddress: ['email_address', optional(nullable(string()))], - phoneNumber: ['phone_number', optional(nullable(string()))], - removed: ['removed', optional(nullable(boolean()))], - ordinal: ['ordinal', number()], -}); diff --git a/src/models/voidTransactionResponse.ts b/src/models/voidTransactionResponse.ts deleted file mode 100644 index 29381949c..000000000 --- a/src/models/voidTransactionResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { array, lazy, object, optional, Schema } from '../schema'; -import { Error, errorSchema } from './error'; - -/** - * Defines the fields that are included in the response body of - * a request to the [VoidTransaction](api-endpoint:Transactions-VoidTransaction) endpoint. - */ -export interface VoidTransactionResponse { - /** Any errors that occurred during the request. */ - errors?: Error[]; -} - -export const voidTransactionResponseSchema: Schema = object( - { errors: ['errors', optional(array(lazy(() => errorSchema)))] } -); diff --git a/src/models/wageSetting.ts b/src/models/wageSetting.ts deleted file mode 100644 index 8697d902f..000000000 --- a/src/models/wageSetting.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - array, - boolean, - lazy, - nullable, - number, - object, - optional, - Schema, - string, -} from '../schema'; -import { JobAssignment, jobAssignmentSchema } from './jobAssignment'; - -/** - * Represents information about the overtime exemption status, job assignments, and compensation - * for a [team member]($m/TeamMember). - */ -export interface WageSetting { - /** The ID of the team member associated with the wage setting. */ - teamMemberId?: string | null; - /** - * **Required** The ordered list of jobs that the team member is assigned to. - * The first job assignment is considered the team member's primary job. - */ - jobAssignments?: JobAssignment[] | null; - /** Whether the team member is exempt from the overtime rules of the seller's country. */ - isOvertimeExempt?: boolean | null; - /** - * **Read only** Used for resolving concurrency issues. The request fails if the version - * provided does not match the server version at the time of the request. If not provided, - * Square executes a blind write, potentially overwriting data from another write. For more information, - * see [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency). - */ - version?: number; - /** The timestamp when the wage setting was created, in RFC 3339 format. */ - createdAt?: string; - /** The timestamp when the wage setting was last updated, in RFC 3339 format. */ - updatedAt?: string; -} - -export const wageSettingSchema: Schema = object({ - teamMemberId: ['team_member_id', optional(nullable(string()))], - jobAssignments: [ - 'job_assignments', - optional(nullable(array(lazy(() => jobAssignmentSchema)))), - ], - isOvertimeExempt: ['is_overtime_exempt', optional(nullable(boolean()))], - version: ['version', optional(number())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/webhookSubscription.ts b/src/models/webhookSubscription.ts deleted file mode 100644 index a6ea862e2..000000000 --- a/src/models/webhookSubscription.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - array, - boolean, - nullable, - object, - optional, - Schema, - string, -} from '../schema'; - -/** - * Represents the details of a webhook subscription, including notification URL, - * event types, and signature key. - */ -export interface WebhookSubscription { - /** A Square-generated unique ID for the subscription. */ - id?: string; - /** The name of this subscription. */ - name?: string | null; - /** Indicates whether the subscription is enabled (`true`) or not (`false`). */ - enabled?: boolean | null; - /** The event types associated with this subscription. */ - eventTypes?: string[] | null; - /** The URL to which webhooks are sent. */ - notificationUrl?: string | null; - /** - * The API version of the subscription. - * This field is optional for `CreateWebhookSubscription`. - * The value defaults to the API version used by the application. - */ - apiVersion?: string | null; - /** The Square-generated signature key used to validate the origin of the webhook event. */ - signatureKey?: string; - /** The timestamp of when the subscription was created, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". */ - createdAt?: string; - /** - * The timestamp of when the subscription was last updated, in RFC 3339 format. - * For example, "2016-09-04T23:59:33.123Z". - */ - updatedAt?: string; -} - -export const webhookSubscriptionSchema: Schema = object({ - id: ['id', optional(string())], - name: ['name', optional(nullable(string()))], - enabled: ['enabled', optional(nullable(boolean()))], - eventTypes: ['event_types', optional(nullable(array(string())))], - notificationUrl: ['notification_url', optional(nullable(string()))], - apiVersion: ['api_version', optional(nullable(string()))], - signatureKey: ['signature_key', optional(string())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/models/workweekConfig.ts b/src/models/workweekConfig.ts deleted file mode 100644 index 1b03ed123..000000000 --- a/src/models/workweekConfig.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { number, object, optional, Schema, string } from '../schema'; - -/** - * Sets the day of the week and hour of the day that a business starts a - * workweek. This is used to calculate overtime pay. - */ -export interface WorkweekConfig { - /** The UUID for this object. */ - id?: string; - /** The days of the week. */ - startOfWeek: string; - /** - * The local time at which a business week starts. Represented as a - * string in `HH:MM` format (`HH:MM:SS` is also accepted, but seconds are - * truncated). - */ - startOfDayLocalTime: string; - /** - * Used for resolving concurrency issues. The request fails if the version - * provided does not match the server version at the time of the request. If not provided, - * Square executes a blind write; potentially overwriting data from another - * write. - */ - version?: number; - /** A read-only timestamp in RFC 3339 format; presented in UTC. */ - createdAt?: string; - /** A read-only timestamp in RFC 3339 format; presented in UTC. */ - updatedAt?: string; -} - -export const workweekConfigSchema: Schema = object({ - id: ['id', optional(string())], - startOfWeek: ['start_of_week', string()], - startOfDayLocalTime: ['start_of_day_local_time', string()], - version: ['version', optional(number())], - createdAt: ['created_at', optional(string())], - updatedAt: ['updated_at', optional(string())], -}); diff --git a/src/schema.ts b/src/schema.ts deleted file mode 100644 index cbbb6ef4c..000000000 --- a/src/schema.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '@apimatic/schema'; diff --git a/src/serialization/index.ts b/src/serialization/index.ts new file mode 100644 index 000000000..3ce0a3e38 --- /dev/null +++ b/src/serialization/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./resources"; diff --git a/src/serialization/resources/applePay/client/index.ts b/src/serialization/resources/applePay/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/applePay/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/applePay/client/requests/RegisterDomainRequest.ts b/src/serialization/resources/applePay/client/requests/RegisterDomainRequest.ts new file mode 100644 index 000000000..97287234c --- /dev/null +++ b/src/serialization/resources/applePay/client/requests/RegisterDomainRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const RegisterDomainRequest: core.serialization.Schema< + serializers.RegisterDomainRequest.Raw, + Square.RegisterDomainRequest +> = core.serialization.object({ + domainName: core.serialization.property("domain_name", core.serialization.string()), +}); + +export declare namespace RegisterDomainRequest { + export interface Raw { + domain_name: string; + } +} diff --git a/src/serialization/resources/applePay/client/requests/index.ts b/src/serialization/resources/applePay/client/requests/index.ts new file mode 100644 index 000000000..6896539da --- /dev/null +++ b/src/serialization/resources/applePay/client/requests/index.ts @@ -0,0 +1 @@ +export { RegisterDomainRequest } from "./RegisterDomainRequest"; diff --git a/src/serialization/resources/applePay/index.ts b/src/serialization/resources/applePay/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/applePay/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/bookings/client/index.ts b/src/serialization/resources/bookings/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/bookings/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts b/src/serialization/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts new file mode 100644 index 000000000..e6488498f --- /dev/null +++ b/src/serialization/resources/bookings/client/requests/BulkRetrieveBookingsRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BulkRetrieveBookingsRequest: core.serialization.Schema< + serializers.BulkRetrieveBookingsRequest.Raw, + Square.BulkRetrieveBookingsRequest +> = core.serialization.object({ + bookingIds: core.serialization.property("booking_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace BulkRetrieveBookingsRequest { + export interface Raw { + booking_ids: string[]; + } +} diff --git a/src/serialization/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts b/src/serialization/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts new file mode 100644 index 000000000..539faef24 --- /dev/null +++ b/src/serialization/resources/bookings/client/requests/BulkRetrieveTeamMemberBookingProfilesRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BulkRetrieveTeamMemberBookingProfilesRequest: core.serialization.Schema< + serializers.BulkRetrieveTeamMemberBookingProfilesRequest.Raw, + Square.BulkRetrieveTeamMemberBookingProfilesRequest +> = core.serialization.object({ + teamMemberIds: core.serialization.property("team_member_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace BulkRetrieveTeamMemberBookingProfilesRequest { + export interface Raw { + team_member_ids: string[]; + } +} diff --git a/src/serialization/resources/bookings/client/requests/CancelBookingRequest.ts b/src/serialization/resources/bookings/client/requests/CancelBookingRequest.ts new file mode 100644 index 000000000..f56a21f2b --- /dev/null +++ b/src/serialization/resources/bookings/client/requests/CancelBookingRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const CancelBookingRequest: core.serialization.Schema< + serializers.CancelBookingRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), + bookingVersion: core.serialization.property("booking_version", core.serialization.number().optionalNullable()), +}); + +export declare namespace CancelBookingRequest { + export interface Raw { + idempotency_key?: (string | null) | null; + booking_version?: (number | null) | null; + } +} diff --git a/src/serialization/resources/bookings/client/requests/CreateBookingRequest.ts b/src/serialization/resources/bookings/client/requests/CreateBookingRequest.ts new file mode 100644 index 000000000..922b63ca0 --- /dev/null +++ b/src/serialization/resources/bookings/client/requests/CreateBookingRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Booking } from "../../../../types/Booking"; + +export const CreateBookingRequest: core.serialization.Schema< + serializers.CreateBookingRequest.Raw, + Square.CreateBookingRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + booking: Booking, +}); + +export declare namespace CreateBookingRequest { + export interface Raw { + idempotency_key?: string | null; + booking: Booking.Raw; + } +} diff --git a/src/serialization/resources/bookings/client/requests/SearchAvailabilityRequest.ts b/src/serialization/resources/bookings/client/requests/SearchAvailabilityRequest.ts new file mode 100644 index 000000000..6b06472e8 --- /dev/null +++ b/src/serialization/resources/bookings/client/requests/SearchAvailabilityRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { SearchAvailabilityQuery } from "../../../../types/SearchAvailabilityQuery"; + +export const SearchAvailabilityRequest: core.serialization.Schema< + serializers.SearchAvailabilityRequest.Raw, + Square.SearchAvailabilityRequest +> = core.serialization.object({ + query: SearchAvailabilityQuery, +}); + +export declare namespace SearchAvailabilityRequest { + export interface Raw { + query: SearchAvailabilityQuery.Raw; + } +} diff --git a/src/serialization/resources/bookings/client/requests/UpdateBookingRequest.ts b/src/serialization/resources/bookings/client/requests/UpdateBookingRequest.ts new file mode 100644 index 000000000..2aa348a18 --- /dev/null +++ b/src/serialization/resources/bookings/client/requests/UpdateBookingRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Booking } from "../../../../types/Booking"; + +export const UpdateBookingRequest: core.serialization.Schema< + serializers.UpdateBookingRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), + booking: Booking, +}); + +export declare namespace UpdateBookingRequest { + export interface Raw { + idempotency_key?: (string | null) | null; + booking: Booking.Raw; + } +} diff --git a/src/serialization/resources/bookings/client/requests/index.ts b/src/serialization/resources/bookings/client/requests/index.ts new file mode 100644 index 000000000..1aaa5675b --- /dev/null +++ b/src/serialization/resources/bookings/client/requests/index.ts @@ -0,0 +1,6 @@ +export { CreateBookingRequest } from "./CreateBookingRequest"; +export { SearchAvailabilityRequest } from "./SearchAvailabilityRequest"; +export { BulkRetrieveBookingsRequest } from "./BulkRetrieveBookingsRequest"; +export { BulkRetrieveTeamMemberBookingProfilesRequest } from "./BulkRetrieveTeamMemberBookingProfilesRequest"; +export { UpdateBookingRequest } from "./UpdateBookingRequest"; +export { CancelBookingRequest } from "./CancelBookingRequest"; diff --git a/src/serialization/resources/bookings/index.ts b/src/serialization/resources/bookings/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/bookings/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/index.ts b/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts b/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..a52133bc1 --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/CreateBookingCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const CreateBookingCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.bookings.CreateBookingCustomAttributeDefinitionRequest.Raw, + Square.bookings.CreateBookingCustomAttributeDefinitionRequest +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), +}); + +export declare namespace CreateBookingCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: string | null; + } +} diff --git a/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts b/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..03dbdbd47 --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/UpdateBookingCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const UpdateBookingCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.bookings.UpdateBookingCustomAttributeDefinitionRequest.Raw, + Omit +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpdateBookingCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts b/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..d490fe8a8 --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateBookingCustomAttributeDefinitionRequest } from "./CreateBookingCustomAttributeDefinitionRequest"; +export { UpdateBookingCustomAttributeDefinitionRequest } from "./UpdateBookingCustomAttributeDefinitionRequest"; diff --git a/src/serialization/resources/bookings/resources/customAttributeDefinitions/index.ts b/src/serialization/resources/bookings/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/bookings/resources/customAttributes/client/index.ts b/src/serialization/resources/bookings/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts b/src/serialization/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts new file mode 100644 index 000000000..5e7d7c93b --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributes/client/requests/BulkDeleteBookingCustomAttributesRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BookingCustomAttributeDeleteRequest } from "../../../../../../types/BookingCustomAttributeDeleteRequest"; + +export const BulkDeleteBookingCustomAttributesRequest: core.serialization.Schema< + serializers.bookings.BulkDeleteBookingCustomAttributesRequest.Raw, + Square.bookings.BulkDeleteBookingCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record(core.serialization.string(), BookingCustomAttributeDeleteRequest), +}); + +export declare namespace BulkDeleteBookingCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts b/src/serialization/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts new file mode 100644 index 000000000..0c2323579 --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributes/client/requests/BulkUpsertBookingCustomAttributesRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BookingCustomAttributeUpsertRequest } from "../../../../../../types/BookingCustomAttributeUpsertRequest"; + +export const BulkUpsertBookingCustomAttributesRequest: core.serialization.Schema< + serializers.bookings.BulkUpsertBookingCustomAttributesRequest.Raw, + Square.bookings.BulkUpsertBookingCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record(core.serialization.string(), BookingCustomAttributeUpsertRequest), +}); + +export declare namespace BulkUpsertBookingCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts b/src/serialization/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts new file mode 100644 index 000000000..178e21f1e --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributes/client/requests/UpsertBookingCustomAttributeRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttribute } from "../../../../../../types/CustomAttribute"; + +export const UpsertBookingCustomAttributeRequest: core.serialization.Schema< + serializers.bookings.UpsertBookingCustomAttributeRequest.Raw, + Omit +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpsertBookingCustomAttributeRequest { + export interface Raw { + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/bookings/resources/customAttributes/client/requests/index.ts b/src/serialization/resources/bookings/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..e0e5f9d3d --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,3 @@ +export { BulkDeleteBookingCustomAttributesRequest } from "./BulkDeleteBookingCustomAttributesRequest"; +export { BulkUpsertBookingCustomAttributesRequest } from "./BulkUpsertBookingCustomAttributesRequest"; +export { UpsertBookingCustomAttributeRequest } from "./UpsertBookingCustomAttributeRequest"; diff --git a/src/serialization/resources/bookings/resources/customAttributes/index.ts b/src/serialization/resources/bookings/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/bookings/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/bookings/resources/index.ts b/src/serialization/resources/bookings/resources/index.ts new file mode 100644 index 000000000..96153bc82 --- /dev/null +++ b/src/serialization/resources/bookings/resources/index.ts @@ -0,0 +1,4 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * from "./customAttributeDefinitions/client/requests"; +export * as customAttributes from "./customAttributes"; +export * from "./customAttributes/client/requests"; diff --git a/src/serialization/resources/cards/client/index.ts b/src/serialization/resources/cards/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/cards/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/cards/client/requests/CreateCardRequest.ts b/src/serialization/resources/cards/client/requests/CreateCardRequest.ts new file mode 100644 index 000000000..73ff67ad7 --- /dev/null +++ b/src/serialization/resources/cards/client/requests/CreateCardRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Card } from "../../../../types/Card"; + +export const CreateCardRequest: core.serialization.Schema = + core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + sourceId: core.serialization.property("source_id", core.serialization.string()), + verificationToken: core.serialization.property("verification_token", core.serialization.string().optional()), + card: Card, + }); + +export declare namespace CreateCardRequest { + export interface Raw { + idempotency_key: string; + source_id: string; + verification_token?: string | null; + card: Card.Raw; + } +} diff --git a/src/serialization/resources/cards/client/requests/index.ts b/src/serialization/resources/cards/client/requests/index.ts new file mode 100644 index 000000000..76287dee2 --- /dev/null +++ b/src/serialization/resources/cards/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateCardRequest } from "./CreateCardRequest"; diff --git a/src/serialization/resources/cards/index.ts b/src/serialization/resources/cards/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/cards/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/catalog/client/index.ts b/src/serialization/resources/catalog/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/catalog/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts b/src/serialization/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts new file mode 100644 index 000000000..93bfb12f7 --- /dev/null +++ b/src/serialization/resources/catalog/client/requests/BatchDeleteCatalogObjectsRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BatchDeleteCatalogObjectsRequest: core.serialization.Schema< + serializers.BatchDeleteCatalogObjectsRequest.Raw, + Square.BatchDeleteCatalogObjectsRequest +> = core.serialization.object({ + objectIds: core.serialization.property( + "object_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace BatchDeleteCatalogObjectsRequest { + export interface Raw { + object_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts b/src/serialization/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts new file mode 100644 index 000000000..f926078f4 --- /dev/null +++ b/src/serialization/resources/catalog/client/requests/BatchGetCatalogObjectsRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BatchGetCatalogObjectsRequest: core.serialization.Schema< + serializers.BatchGetCatalogObjectsRequest.Raw, + Square.BatchGetCatalogObjectsRequest +> = core.serialization.object({ + objectIds: core.serialization.property("object_ids", core.serialization.list(core.serialization.string())), + includeRelatedObjects: core.serialization.property( + "include_related_objects", + core.serialization.boolean().optionalNullable(), + ), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + includeDeletedObjects: core.serialization.property( + "include_deleted_objects", + core.serialization.boolean().optionalNullable(), + ), + includeCategoryPathToRoot: core.serialization.property( + "include_category_path_to_root", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace BatchGetCatalogObjectsRequest { + export interface Raw { + object_ids: string[]; + include_related_objects?: (boolean | null) | null; + catalog_version?: ((bigint | number) | null) | null; + include_deleted_objects?: (boolean | null) | null; + include_category_path_to_root?: (boolean | null) | null; + } +} diff --git a/src/serialization/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts b/src/serialization/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts new file mode 100644 index 000000000..406212100 --- /dev/null +++ b/src/serialization/resources/catalog/client/requests/BatchUpsertCatalogObjectsRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CatalogObjectBatch } from "../../../../types/CatalogObjectBatch"; + +export const BatchUpsertCatalogObjectsRequest: core.serialization.Schema< + serializers.BatchUpsertCatalogObjectsRequest.Raw, + Square.BatchUpsertCatalogObjectsRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + batches: core.serialization.list(CatalogObjectBatch), +}); + +export declare namespace BatchUpsertCatalogObjectsRequest { + export interface Raw { + idempotency_key: string; + batches: CatalogObjectBatch.Raw[]; + } +} diff --git a/src/serialization/resources/catalog/client/requests/SearchCatalogItemsRequest.ts b/src/serialization/resources/catalog/client/requests/SearchCatalogItemsRequest.ts new file mode 100644 index 000000000..cee9e8946 --- /dev/null +++ b/src/serialization/resources/catalog/client/requests/SearchCatalogItemsRequest.ts @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { SearchCatalogItemsRequestStockLevel } from "../../../../types/SearchCatalogItemsRequestStockLevel"; +import { SortOrder } from "../../../../types/SortOrder"; +import { CatalogItemProductType } from "../../../../types/CatalogItemProductType"; +import { CustomAttributeFilter } from "../../../../types/CustomAttributeFilter"; +import { ArchivedState } from "../../../../types/ArchivedState"; + +export const SearchCatalogItemsRequest: core.serialization.Schema< + serializers.SearchCatalogItemsRequest.Raw, + Square.SearchCatalogItemsRequest +> = core.serialization.object({ + textFilter: core.serialization.property("text_filter", core.serialization.string().optional()), + categoryIds: core.serialization.property( + "category_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + stockLevels: core.serialization.property( + "stock_levels", + core.serialization.list(SearchCatalogItemsRequestStockLevel).optional(), + ), + enabledLocationIds: core.serialization.property( + "enabled_location_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + cursor: core.serialization.string().optional(), + limit: core.serialization.number().optional(), + sortOrder: core.serialization.property("sort_order", SortOrder.optional()), + productTypes: core.serialization.property( + "product_types", + core.serialization.list(CatalogItemProductType).optional(), + ), + customAttributeFilters: core.serialization.property( + "custom_attribute_filters", + core.serialization.list(CustomAttributeFilter).optional(), + ), + archivedState: core.serialization.property("archived_state", ArchivedState.optional()), +}); + +export declare namespace SearchCatalogItemsRequest { + export interface Raw { + text_filter?: string | null; + category_ids?: string[] | null; + stock_levels?: SearchCatalogItemsRequestStockLevel.Raw[] | null; + enabled_location_ids?: string[] | null; + cursor?: string | null; + limit?: number | null; + sort_order?: SortOrder.Raw | null; + product_types?: CatalogItemProductType.Raw[] | null; + custom_attribute_filters?: CustomAttributeFilter.Raw[] | null; + archived_state?: ArchivedState.Raw | null; + } +} diff --git a/src/serialization/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts b/src/serialization/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts new file mode 100644 index 000000000..12c4e5e08 --- /dev/null +++ b/src/serialization/resources/catalog/client/requests/SearchCatalogObjectsRequest.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CatalogObjectType } from "../../../../types/CatalogObjectType"; +import { CatalogQuery } from "../../../../types/CatalogQuery"; + +export const SearchCatalogObjectsRequest: core.serialization.Schema< + serializers.SearchCatalogObjectsRequest.Raw, + Square.SearchCatalogObjectsRequest +> = core.serialization.object({ + cursor: core.serialization.string().optional(), + objectTypes: core.serialization.property("object_types", core.serialization.list(CatalogObjectType).optional()), + includeDeletedObjects: core.serialization.property( + "include_deleted_objects", + core.serialization.boolean().optional(), + ), + includeRelatedObjects: core.serialization.property( + "include_related_objects", + core.serialization.boolean().optional(), + ), + beginTime: core.serialization.property("begin_time", core.serialization.string().optional()), + query: CatalogQuery.optional(), + limit: core.serialization.number().optional(), + includeCategoryPathToRoot: core.serialization.property( + "include_category_path_to_root", + core.serialization.boolean().optional(), + ), +}); + +export declare namespace SearchCatalogObjectsRequest { + export interface Raw { + cursor?: string | null; + object_types?: CatalogObjectType.Raw[] | null; + include_deleted_objects?: boolean | null; + include_related_objects?: boolean | null; + begin_time?: string | null; + query?: CatalogQuery.Raw | null; + limit?: number | null; + include_category_path_to_root?: boolean | null; + } +} diff --git a/src/serialization/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts b/src/serialization/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts new file mode 100644 index 000000000..21947e2ce --- /dev/null +++ b/src/serialization/resources/catalog/client/requests/UpdateItemModifierListsRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const UpdateItemModifierListsRequest: core.serialization.Schema< + serializers.UpdateItemModifierListsRequest.Raw, + Square.UpdateItemModifierListsRequest +> = core.serialization.object({ + itemIds: core.serialization.property("item_ids", core.serialization.list(core.serialization.string())), + modifierListsToEnable: core.serialization.property( + "modifier_lists_to_enable", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + modifierListsToDisable: core.serialization.property( + "modifier_lists_to_disable", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace UpdateItemModifierListsRequest { + export interface Raw { + item_ids: string[]; + modifier_lists_to_enable?: (string[] | null) | null; + modifier_lists_to_disable?: (string[] | null) | null; + } +} diff --git a/src/serialization/resources/catalog/client/requests/UpdateItemTaxesRequest.ts b/src/serialization/resources/catalog/client/requests/UpdateItemTaxesRequest.ts new file mode 100644 index 000000000..c73ede6bf --- /dev/null +++ b/src/serialization/resources/catalog/client/requests/UpdateItemTaxesRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const UpdateItemTaxesRequest: core.serialization.Schema< + serializers.UpdateItemTaxesRequest.Raw, + Square.UpdateItemTaxesRequest +> = core.serialization.object({ + itemIds: core.serialization.property("item_ids", core.serialization.list(core.serialization.string())), + taxesToEnable: core.serialization.property( + "taxes_to_enable", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + taxesToDisable: core.serialization.property( + "taxes_to_disable", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace UpdateItemTaxesRequest { + export interface Raw { + item_ids: string[]; + taxes_to_enable?: (string[] | null) | null; + taxes_to_disable?: (string[] | null) | null; + } +} diff --git a/src/serialization/resources/catalog/client/requests/index.ts b/src/serialization/resources/catalog/client/requests/index.ts new file mode 100644 index 000000000..b6dd6da9f --- /dev/null +++ b/src/serialization/resources/catalog/client/requests/index.ts @@ -0,0 +1,7 @@ +export { BatchDeleteCatalogObjectsRequest } from "./BatchDeleteCatalogObjectsRequest"; +export { BatchGetCatalogObjectsRequest } from "./BatchGetCatalogObjectsRequest"; +export { BatchUpsertCatalogObjectsRequest } from "./BatchUpsertCatalogObjectsRequest"; +export { SearchCatalogObjectsRequest } from "./SearchCatalogObjectsRequest"; +export { SearchCatalogItemsRequest } from "./SearchCatalogItemsRequest"; +export { UpdateItemModifierListsRequest } from "./UpdateItemModifierListsRequest"; +export { UpdateItemTaxesRequest } from "./UpdateItemTaxesRequest"; diff --git a/src/serialization/resources/catalog/index.ts b/src/serialization/resources/catalog/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/catalog/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/catalog/resources/index.ts b/src/serialization/resources/catalog/resources/index.ts new file mode 100644 index 000000000..5aa921606 --- /dev/null +++ b/src/serialization/resources/catalog/resources/index.ts @@ -0,0 +1,2 @@ +export * as object from "./object"; +export * from "./object/client/requests"; diff --git a/src/serialization/resources/catalog/resources/object/client/index.ts b/src/serialization/resources/catalog/resources/object/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/catalog/resources/object/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts b/src/serialization/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts new file mode 100644 index 000000000..23e780a0c --- /dev/null +++ b/src/serialization/resources/catalog/resources/object/client/requests/UpsertCatalogObjectRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; + +export const UpsertCatalogObjectRequest: core.serialization.Schema< + serializers.catalog.UpsertCatalogObjectRequest.Raw, + Square.catalog.UpsertCatalogObjectRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + object: core.serialization.lazy(() => serializers.CatalogObject), +}); + +export declare namespace UpsertCatalogObjectRequest { + export interface Raw { + idempotency_key: string; + object: serializers.CatalogObject.Raw; + } +} diff --git a/src/serialization/resources/catalog/resources/object/client/requests/index.ts b/src/serialization/resources/catalog/resources/object/client/requests/index.ts new file mode 100644 index 000000000..346a52b67 --- /dev/null +++ b/src/serialization/resources/catalog/resources/object/client/requests/index.ts @@ -0,0 +1 @@ +export { UpsertCatalogObjectRequest } from "./UpsertCatalogObjectRequest"; diff --git a/src/serialization/resources/catalog/resources/object/index.ts b/src/serialization/resources/catalog/resources/object/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/catalog/resources/object/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/checkout/client/index.ts b/src/serialization/resources/checkout/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/checkout/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts b/src/serialization/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts new file mode 100644 index 000000000..f6714b1b2 --- /dev/null +++ b/src/serialization/resources/checkout/client/requests/UpdateLocationSettingsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CheckoutLocationSettings } from "../../../../types/CheckoutLocationSettings"; + +export const UpdateLocationSettingsRequest: core.serialization.Schema< + serializers.UpdateLocationSettingsRequest.Raw, + Omit +> = core.serialization.object({ + locationSettings: core.serialization.property("location_settings", CheckoutLocationSettings), +}); + +export declare namespace UpdateLocationSettingsRequest { + export interface Raw { + location_settings: CheckoutLocationSettings.Raw; + } +} diff --git a/src/serialization/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts b/src/serialization/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts new file mode 100644 index 000000000..669eefeb1 --- /dev/null +++ b/src/serialization/resources/checkout/client/requests/UpdateMerchantSettingsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CheckoutMerchantSettings } from "../../../../types/CheckoutMerchantSettings"; + +export const UpdateMerchantSettingsRequest: core.serialization.Schema< + serializers.UpdateMerchantSettingsRequest.Raw, + Square.UpdateMerchantSettingsRequest +> = core.serialization.object({ + merchantSettings: core.serialization.property("merchant_settings", CheckoutMerchantSettings), +}); + +export declare namespace UpdateMerchantSettingsRequest { + export interface Raw { + merchant_settings: CheckoutMerchantSettings.Raw; + } +} diff --git a/src/serialization/resources/checkout/client/requests/index.ts b/src/serialization/resources/checkout/client/requests/index.ts new file mode 100644 index 000000000..1b1b417cc --- /dev/null +++ b/src/serialization/resources/checkout/client/requests/index.ts @@ -0,0 +1,2 @@ +export { UpdateLocationSettingsRequest } from "./UpdateLocationSettingsRequest"; +export { UpdateMerchantSettingsRequest } from "./UpdateMerchantSettingsRequest"; diff --git a/src/serialization/resources/checkout/index.ts b/src/serialization/resources/checkout/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/checkout/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/checkout/resources/index.ts b/src/serialization/resources/checkout/resources/index.ts new file mode 100644 index 000000000..5f3efa0d0 --- /dev/null +++ b/src/serialization/resources/checkout/resources/index.ts @@ -0,0 +1,2 @@ +export * as paymentLinks from "./paymentLinks"; +export * from "./paymentLinks/client/requests"; diff --git a/src/serialization/resources/checkout/resources/paymentLinks/client/index.ts b/src/serialization/resources/checkout/resources/paymentLinks/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/checkout/resources/paymentLinks/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts b/src/serialization/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts new file mode 100644 index 000000000..be573a9cd --- /dev/null +++ b/src/serialization/resources/checkout/resources/paymentLinks/client/requests/CreatePaymentLinkRequest.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { QuickPay } from "../../../../../../types/QuickPay"; +import { Order } from "../../../../../../types/Order"; +import { CheckoutOptions } from "../../../../../../types/CheckoutOptions"; +import { PrePopulatedData } from "../../../../../../types/PrePopulatedData"; + +export const CreatePaymentLinkRequest: core.serialization.Schema< + serializers.checkout.CreatePaymentLinkRequest.Raw, + Square.checkout.CreatePaymentLinkRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + description: core.serialization.string().optional(), + quickPay: core.serialization.property("quick_pay", QuickPay.optional()), + order: Order.optional(), + checkoutOptions: core.serialization.property("checkout_options", CheckoutOptions.optional()), + prePopulatedData: core.serialization.property("pre_populated_data", PrePopulatedData.optional()), + paymentNote: core.serialization.property("payment_note", core.serialization.string().optional()), +}); + +export declare namespace CreatePaymentLinkRequest { + export interface Raw { + idempotency_key?: string | null; + description?: string | null; + quick_pay?: QuickPay.Raw | null; + order?: Order.Raw | null; + checkout_options?: CheckoutOptions.Raw | null; + pre_populated_data?: PrePopulatedData.Raw | null; + payment_note?: string | null; + } +} diff --git a/src/serialization/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts b/src/serialization/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts new file mode 100644 index 000000000..6e19fa86d --- /dev/null +++ b/src/serialization/resources/checkout/resources/paymentLinks/client/requests/UpdatePaymentLinkRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { PaymentLink } from "../../../../../../types/PaymentLink"; + +export const UpdatePaymentLinkRequest: core.serialization.Schema< + serializers.checkout.UpdatePaymentLinkRequest.Raw, + Omit +> = core.serialization.object({ + paymentLink: core.serialization.property("payment_link", PaymentLink), +}); + +export declare namespace UpdatePaymentLinkRequest { + export interface Raw { + payment_link: PaymentLink.Raw; + } +} diff --git a/src/serialization/resources/checkout/resources/paymentLinks/client/requests/index.ts b/src/serialization/resources/checkout/resources/paymentLinks/client/requests/index.ts new file mode 100644 index 000000000..7e82ca744 --- /dev/null +++ b/src/serialization/resources/checkout/resources/paymentLinks/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreatePaymentLinkRequest } from "./CreatePaymentLinkRequest"; +export { UpdatePaymentLinkRequest } from "./UpdatePaymentLinkRequest"; diff --git a/src/serialization/resources/checkout/resources/paymentLinks/index.ts b/src/serialization/resources/checkout/resources/paymentLinks/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/checkout/resources/paymentLinks/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/customers/client/index.ts b/src/serialization/resources/customers/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/customers/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/customers/client/requests/BulkCreateCustomersRequest.ts b/src/serialization/resources/customers/client/requests/BulkCreateCustomersRequest.ts new file mode 100644 index 000000000..d42b1ff21 --- /dev/null +++ b/src/serialization/resources/customers/client/requests/BulkCreateCustomersRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { BulkCreateCustomerData } from "../../../../types/BulkCreateCustomerData"; + +export const BulkCreateCustomersRequest: core.serialization.Schema< + serializers.BulkCreateCustomersRequest.Raw, + Square.BulkCreateCustomersRequest +> = core.serialization.object({ + customers: core.serialization.record(core.serialization.string(), BulkCreateCustomerData), +}); + +export declare namespace BulkCreateCustomersRequest { + export interface Raw { + customers: Record; + } +} diff --git a/src/serialization/resources/customers/client/requests/BulkDeleteCustomersRequest.ts b/src/serialization/resources/customers/client/requests/BulkDeleteCustomersRequest.ts new file mode 100644 index 000000000..8894849f1 --- /dev/null +++ b/src/serialization/resources/customers/client/requests/BulkDeleteCustomersRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BulkDeleteCustomersRequest: core.serialization.Schema< + serializers.BulkDeleteCustomersRequest.Raw, + Square.BulkDeleteCustomersRequest +> = core.serialization.object({ + customerIds: core.serialization.property("customer_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace BulkDeleteCustomersRequest { + export interface Raw { + customer_ids: string[]; + } +} diff --git a/src/serialization/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts b/src/serialization/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts new file mode 100644 index 000000000..d37cd7f6d --- /dev/null +++ b/src/serialization/resources/customers/client/requests/BulkRetrieveCustomersRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BulkRetrieveCustomersRequest: core.serialization.Schema< + serializers.BulkRetrieveCustomersRequest.Raw, + Square.BulkRetrieveCustomersRequest +> = core.serialization.object({ + customerIds: core.serialization.property("customer_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace BulkRetrieveCustomersRequest { + export interface Raw { + customer_ids: string[]; + } +} diff --git a/src/serialization/resources/customers/client/requests/BulkUpdateCustomersRequest.ts b/src/serialization/resources/customers/client/requests/BulkUpdateCustomersRequest.ts new file mode 100644 index 000000000..510ce5a1b --- /dev/null +++ b/src/serialization/resources/customers/client/requests/BulkUpdateCustomersRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { BulkUpdateCustomerData } from "../../../../types/BulkUpdateCustomerData"; + +export const BulkUpdateCustomersRequest: core.serialization.Schema< + serializers.BulkUpdateCustomersRequest.Raw, + Square.BulkUpdateCustomersRequest +> = core.serialization.object({ + customers: core.serialization.record(core.serialization.string(), BulkUpdateCustomerData), +}); + +export declare namespace BulkUpdateCustomersRequest { + export interface Raw { + customers: Record; + } +} diff --git a/src/serialization/resources/customers/client/requests/CreateCustomerRequest.ts b/src/serialization/resources/customers/client/requests/CreateCustomerRequest.ts new file mode 100644 index 000000000..95935b7f1 --- /dev/null +++ b/src/serialization/resources/customers/client/requests/CreateCustomerRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Address } from "../../../../types/Address"; +import { CustomerTaxIds } from "../../../../types/CustomerTaxIds"; + +export const CreateCustomerRequest: core.serialization.Schema< + serializers.CreateCustomerRequest.Raw, + Square.CreateCustomerRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + givenName: core.serialization.property("given_name", core.serialization.string().optional()), + familyName: core.serialization.property("family_name", core.serialization.string().optional()), + companyName: core.serialization.property("company_name", core.serialization.string().optional()), + nickname: core.serialization.string().optional(), + emailAddress: core.serialization.property("email_address", core.serialization.string().optional()), + address: Address.optional(), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optional()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optional()), + note: core.serialization.string().optional(), + birthday: core.serialization.string().optional(), + taxIds: core.serialization.property("tax_ids", CustomerTaxIds.optional()), +}); + +export declare namespace CreateCustomerRequest { + export interface Raw { + idempotency_key?: string | null; + given_name?: string | null; + family_name?: string | null; + company_name?: string | null; + nickname?: string | null; + email_address?: string | null; + address?: Address.Raw | null; + phone_number?: string | null; + reference_id?: string | null; + note?: string | null; + birthday?: string | null; + tax_ids?: CustomerTaxIds.Raw | null; + } +} diff --git a/src/serialization/resources/customers/client/requests/SearchCustomersRequest.ts b/src/serialization/resources/customers/client/requests/SearchCustomersRequest.ts new file mode 100644 index 000000000..349ab95d6 --- /dev/null +++ b/src/serialization/resources/customers/client/requests/SearchCustomersRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CustomerQuery } from "../../../../types/CustomerQuery"; + +export const SearchCustomersRequest: core.serialization.Schema< + serializers.SearchCustomersRequest.Raw, + Square.SearchCustomersRequest +> = core.serialization.object({ + cursor: core.serialization.string().optional(), + limit: core.serialization.bigint().optional(), + query: CustomerQuery.optional(), + count: core.serialization.boolean().optional(), +}); + +export declare namespace SearchCustomersRequest { + export interface Raw { + cursor?: string | null; + limit?: (bigint | number) | null; + query?: CustomerQuery.Raw | null; + count?: boolean | null; + } +} diff --git a/src/serialization/resources/customers/client/requests/UpdateCustomerRequest.ts b/src/serialization/resources/customers/client/requests/UpdateCustomerRequest.ts new file mode 100644 index 000000000..bbf9cb37f --- /dev/null +++ b/src/serialization/resources/customers/client/requests/UpdateCustomerRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Address } from "../../../../types/Address"; +import { CustomerTaxIds } from "../../../../types/CustomerTaxIds"; + +export const UpdateCustomerRequest: core.serialization.Schema< + serializers.UpdateCustomerRequest.Raw, + Omit +> = core.serialization.object({ + givenName: core.serialization.property("given_name", core.serialization.string().optionalNullable()), + familyName: core.serialization.property("family_name", core.serialization.string().optionalNullable()), + companyName: core.serialization.property("company_name", core.serialization.string().optionalNullable()), + nickname: core.serialization.string().optionalNullable(), + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + address: Address.optional(), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + note: core.serialization.string().optionalNullable(), + birthday: core.serialization.string().optionalNullable(), + version: core.serialization.bigint().optional(), + taxIds: core.serialization.property("tax_ids", CustomerTaxIds.optional()), +}); + +export declare namespace UpdateCustomerRequest { + export interface Raw { + given_name?: (string | null) | null; + family_name?: (string | null) | null; + company_name?: (string | null) | null; + nickname?: (string | null) | null; + email_address?: (string | null) | null; + address?: Address.Raw | null; + phone_number?: (string | null) | null; + reference_id?: (string | null) | null; + note?: (string | null) | null; + birthday?: (string | null) | null; + version?: (bigint | number) | null; + tax_ids?: CustomerTaxIds.Raw | null; + } +} diff --git a/src/serialization/resources/customers/client/requests/index.ts b/src/serialization/resources/customers/client/requests/index.ts new file mode 100644 index 000000000..636aa1ff9 --- /dev/null +++ b/src/serialization/resources/customers/client/requests/index.ts @@ -0,0 +1,7 @@ +export { CreateCustomerRequest } from "./CreateCustomerRequest"; +export { BulkCreateCustomersRequest } from "./BulkCreateCustomersRequest"; +export { BulkDeleteCustomersRequest } from "./BulkDeleteCustomersRequest"; +export { BulkRetrieveCustomersRequest } from "./BulkRetrieveCustomersRequest"; +export { BulkUpdateCustomersRequest } from "./BulkUpdateCustomersRequest"; +export { SearchCustomersRequest } from "./SearchCustomersRequest"; +export { UpdateCustomerRequest } from "./UpdateCustomerRequest"; diff --git a/src/serialization/resources/customers/index.ts b/src/serialization/resources/customers/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/customers/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/customers/resources/cards/client/index.ts b/src/serialization/resources/customers/resources/cards/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/customers/resources/cards/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts b/src/serialization/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts new file mode 100644 index 000000000..0ea65fbb0 --- /dev/null +++ b/src/serialization/resources/customers/resources/cards/client/requests/CreateCustomerCardRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { Address } from "../../../../../../types/Address"; + +export const CreateCustomerCardRequest: core.serialization.Schema< + serializers.customers.CreateCustomerCardRequest.Raw, + Omit +> = core.serialization.object({ + cardNonce: core.serialization.property("card_nonce", core.serialization.string()), + billingAddress: core.serialization.property("billing_address", Address.optional()), + cardholderName: core.serialization.property("cardholder_name", core.serialization.string().optional()), + verificationToken: core.serialization.property("verification_token", core.serialization.string().optional()), +}); + +export declare namespace CreateCustomerCardRequest { + export interface Raw { + card_nonce: string; + billing_address?: Address.Raw | null; + cardholder_name?: string | null; + verification_token?: string | null; + } +} diff --git a/src/serialization/resources/customers/resources/cards/client/requests/index.ts b/src/serialization/resources/customers/resources/cards/client/requests/index.ts new file mode 100644 index 000000000..9c9512545 --- /dev/null +++ b/src/serialization/resources/customers/resources/cards/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateCustomerCardRequest } from "./CreateCustomerCardRequest"; diff --git a/src/serialization/resources/customers/resources/cards/index.ts b/src/serialization/resources/customers/resources/cards/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/customers/resources/cards/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/index.ts b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts new file mode 100644 index 000000000..23170882a --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/BatchUpsertCustomerCustomAttributesRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest } from "../../../../../../types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest"; + +export const BatchUpsertCustomerCustomAttributesRequest: core.serialization.Schema< + serializers.customers.BatchUpsertCustomerCustomAttributesRequest.Raw, + Square.customers.BatchUpsertCustomerCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest, + ), +}); + +export declare namespace BatchUpsertCustomerCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..43afb4dfe --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/CreateCustomerCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const CreateCustomerCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.customers.CreateCustomerCustomAttributeDefinitionRequest.Raw, + Square.customers.CreateCustomerCustomAttributeDefinitionRequest +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), +}); + +export declare namespace CreateCustomerCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: string | null; + } +} diff --git a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..f68b95d9b --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/UpdateCustomerCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const UpdateCustomerCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.customers.UpdateCustomerCustomAttributeDefinitionRequest.Raw, + Omit +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpdateCustomerCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..3e6e7c1f4 --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,3 @@ +export { CreateCustomerCustomAttributeDefinitionRequest } from "./CreateCustomerCustomAttributeDefinitionRequest"; +export { UpdateCustomerCustomAttributeDefinitionRequest } from "./UpdateCustomerCustomAttributeDefinitionRequest"; +export { BatchUpsertCustomerCustomAttributesRequest } from "./BatchUpsertCustomerCustomAttributesRequest"; diff --git a/src/serialization/resources/customers/resources/customAttributeDefinitions/index.ts b/src/serialization/resources/customers/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/customers/resources/customAttributes/client/index.ts b/src/serialization/resources/customers/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts b/src/serialization/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts new file mode 100644 index 000000000..b7fb5cecf --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributes/client/requests/UpsertCustomerCustomAttributeRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttribute } from "../../../../../../types/CustomAttribute"; + +export const UpsertCustomerCustomAttributeRequest: core.serialization.Schema< + serializers.customers.UpsertCustomerCustomAttributeRequest.Raw, + Omit +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpsertCustomerCustomAttributeRequest { + export interface Raw { + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/customers/resources/customAttributes/client/requests/index.ts b/src/serialization/resources/customers/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..49d14a9fc --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributes/client/requests/index.ts @@ -0,0 +1 @@ +export { UpsertCustomerCustomAttributeRequest } from "./UpsertCustomerCustomAttributeRequest"; diff --git a/src/serialization/resources/customers/resources/customAttributes/index.ts b/src/serialization/resources/customers/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/customers/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/customers/resources/groups/client/index.ts b/src/serialization/resources/customers/resources/groups/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/customers/resources/groups/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts b/src/serialization/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts new file mode 100644 index 000000000..489367bda --- /dev/null +++ b/src/serialization/resources/customers/resources/groups/client/requests/CreateCustomerGroupRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomerGroup } from "../../../../../../types/CustomerGroup"; + +export const CreateCustomerGroupRequest: core.serialization.Schema< + serializers.customers.CreateCustomerGroupRequest.Raw, + Square.customers.CreateCustomerGroupRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + group: CustomerGroup, +}); + +export declare namespace CreateCustomerGroupRequest { + export interface Raw { + idempotency_key?: string | null; + group: CustomerGroup.Raw; + } +} diff --git a/src/serialization/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts b/src/serialization/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts new file mode 100644 index 000000000..763aaf1cc --- /dev/null +++ b/src/serialization/resources/customers/resources/groups/client/requests/UpdateCustomerGroupRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomerGroup } from "../../../../../../types/CustomerGroup"; + +export const UpdateCustomerGroupRequest: core.serialization.Schema< + serializers.customers.UpdateCustomerGroupRequest.Raw, + Omit +> = core.serialization.object({ + group: CustomerGroup, +}); + +export declare namespace UpdateCustomerGroupRequest { + export interface Raw { + group: CustomerGroup.Raw; + } +} diff --git a/src/serialization/resources/customers/resources/groups/client/requests/index.ts b/src/serialization/resources/customers/resources/groups/client/requests/index.ts new file mode 100644 index 000000000..539dd5e06 --- /dev/null +++ b/src/serialization/resources/customers/resources/groups/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateCustomerGroupRequest } from "./CreateCustomerGroupRequest"; +export { UpdateCustomerGroupRequest } from "./UpdateCustomerGroupRequest"; diff --git a/src/serialization/resources/customers/resources/groups/index.ts b/src/serialization/resources/customers/resources/groups/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/customers/resources/groups/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/customers/resources/index.ts b/src/serialization/resources/customers/resources/index.ts new file mode 100644 index 000000000..033a7b15f --- /dev/null +++ b/src/serialization/resources/customers/resources/index.ts @@ -0,0 +1,8 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * from "./customAttributeDefinitions/client/requests"; +export * as groups from "./groups"; +export * from "./groups/client/requests"; +export * as cards from "./cards"; +export * from "./cards/client/requests"; +export * as customAttributes from "./customAttributes"; +export * from "./customAttributes/client/requests"; diff --git a/src/serialization/resources/devices/index.ts b/src/serialization/resources/devices/index.ts new file mode 100644 index 000000000..3e5335fe4 --- /dev/null +++ b/src/serialization/resources/devices/index.ts @@ -0,0 +1 @@ +export * from "./resources"; diff --git a/src/serialization/resources/devices/resources/codes/client/index.ts b/src/serialization/resources/devices/resources/codes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/devices/resources/codes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts b/src/serialization/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts new file mode 100644 index 000000000..de9feaac0 --- /dev/null +++ b/src/serialization/resources/devices/resources/codes/client/requests/CreateDeviceCodeRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { DeviceCode } from "../../../../../../types/DeviceCode"; + +export const CreateDeviceCodeRequest: core.serialization.Schema< + serializers.devices.CreateDeviceCodeRequest.Raw, + Square.devices.CreateDeviceCodeRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + deviceCode: core.serialization.property("device_code", DeviceCode), +}); + +export declare namespace CreateDeviceCodeRequest { + export interface Raw { + idempotency_key: string; + device_code: DeviceCode.Raw; + } +} diff --git a/src/serialization/resources/devices/resources/codes/client/requests/index.ts b/src/serialization/resources/devices/resources/codes/client/requests/index.ts new file mode 100644 index 000000000..56752258f --- /dev/null +++ b/src/serialization/resources/devices/resources/codes/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateDeviceCodeRequest } from "./CreateDeviceCodeRequest"; diff --git a/src/serialization/resources/devices/resources/codes/index.ts b/src/serialization/resources/devices/resources/codes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/devices/resources/codes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/devices/resources/index.ts b/src/serialization/resources/devices/resources/index.ts new file mode 100644 index 000000000..b75af3b53 --- /dev/null +++ b/src/serialization/resources/devices/resources/index.ts @@ -0,0 +1,2 @@ +export * as codes from "./codes"; +export * from "./codes/client/requests"; diff --git a/src/serialization/resources/disputes/client/index.ts b/src/serialization/resources/disputes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/disputes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts b/src/serialization/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts new file mode 100644 index 000000000..bcb89e5ab --- /dev/null +++ b/src/serialization/resources/disputes/client/requests/CreateDisputeEvidenceTextRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { DisputeEvidenceType } from "../../../../types/DisputeEvidenceType"; + +export const CreateDisputeEvidenceTextRequest: core.serialization.Schema< + serializers.CreateDisputeEvidenceTextRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + evidenceType: core.serialization.property("evidence_type", DisputeEvidenceType.optional()), + evidenceText: core.serialization.property("evidence_text", core.serialization.string()), +}); + +export declare namespace CreateDisputeEvidenceTextRequest { + export interface Raw { + idempotency_key: string; + evidence_type?: DisputeEvidenceType.Raw | null; + evidence_text: string; + } +} diff --git a/src/serialization/resources/disputes/client/requests/index.ts b/src/serialization/resources/disputes/client/requests/index.ts new file mode 100644 index 000000000..519f5bba0 --- /dev/null +++ b/src/serialization/resources/disputes/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateDisputeEvidenceTextRequest } from "./CreateDisputeEvidenceTextRequest"; diff --git a/src/serialization/resources/disputes/index.ts b/src/serialization/resources/disputes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/disputes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/events/client/index.ts b/src/serialization/resources/events/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/events/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/events/client/requests/SearchEventsRequest.ts b/src/serialization/resources/events/client/requests/SearchEventsRequest.ts new file mode 100644 index 000000000..9b03e2afd --- /dev/null +++ b/src/serialization/resources/events/client/requests/SearchEventsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { SearchEventsQuery } from "../../../../types/SearchEventsQuery"; + +export const SearchEventsRequest: core.serialization.Schema< + serializers.SearchEventsRequest.Raw, + Square.SearchEventsRequest +> = core.serialization.object({ + cursor: core.serialization.string().optional(), + limit: core.serialization.number().optional(), + query: SearchEventsQuery.optional(), +}); + +export declare namespace SearchEventsRequest { + export interface Raw { + cursor?: string | null; + limit?: number | null; + query?: SearchEventsQuery.Raw | null; + } +} diff --git a/src/serialization/resources/events/client/requests/index.ts b/src/serialization/resources/events/client/requests/index.ts new file mode 100644 index 000000000..c01d7b10c --- /dev/null +++ b/src/serialization/resources/events/client/requests/index.ts @@ -0,0 +1 @@ +export { SearchEventsRequest } from "./SearchEventsRequest"; diff --git a/src/serialization/resources/events/index.ts b/src/serialization/resources/events/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/events/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/giftCards/client/index.ts b/src/serialization/resources/giftCards/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/giftCards/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/giftCards/client/requests/CreateGiftCardRequest.ts b/src/serialization/resources/giftCards/client/requests/CreateGiftCardRequest.ts new file mode 100644 index 000000000..dfbbc7aa6 --- /dev/null +++ b/src/serialization/resources/giftCards/client/requests/CreateGiftCardRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { GiftCard } from "../../../../types/GiftCard"; + +export const CreateGiftCardRequest: core.serialization.Schema< + serializers.CreateGiftCardRequest.Raw, + Square.CreateGiftCardRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + locationId: core.serialization.property("location_id", core.serialization.string()), + giftCard: core.serialization.property("gift_card", GiftCard), +}); + +export declare namespace CreateGiftCardRequest { + export interface Raw { + idempotency_key: string; + location_id: string; + gift_card: GiftCard.Raw; + } +} diff --git a/src/serialization/resources/giftCards/client/requests/GetGiftCardFromGanRequest.ts b/src/serialization/resources/giftCards/client/requests/GetGiftCardFromGanRequest.ts new file mode 100644 index 000000000..809c07825 --- /dev/null +++ b/src/serialization/resources/giftCards/client/requests/GetGiftCardFromGanRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const GetGiftCardFromGanRequest: core.serialization.Schema< + serializers.GetGiftCardFromGanRequest.Raw, + Square.GetGiftCardFromGanRequest +> = core.serialization.object({ + gan: core.serialization.string(), +}); + +export declare namespace GetGiftCardFromGanRequest { + export interface Raw { + gan: string; + } +} diff --git a/src/serialization/resources/giftCards/client/requests/GetGiftCardFromNonceRequest.ts b/src/serialization/resources/giftCards/client/requests/GetGiftCardFromNonceRequest.ts new file mode 100644 index 000000000..7bb8cfb6b --- /dev/null +++ b/src/serialization/resources/giftCards/client/requests/GetGiftCardFromNonceRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const GetGiftCardFromNonceRequest: core.serialization.Schema< + serializers.GetGiftCardFromNonceRequest.Raw, + Square.GetGiftCardFromNonceRequest +> = core.serialization.object({ + nonce: core.serialization.string(), +}); + +export declare namespace GetGiftCardFromNonceRequest { + export interface Raw { + nonce: string; + } +} diff --git a/src/serialization/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts b/src/serialization/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts new file mode 100644 index 000000000..e04b837c1 --- /dev/null +++ b/src/serialization/resources/giftCards/client/requests/LinkCustomerToGiftCardRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const LinkCustomerToGiftCardRequest: core.serialization.Schema< + serializers.LinkCustomerToGiftCardRequest.Raw, + Omit +> = core.serialization.object({ + customerId: core.serialization.property("customer_id", core.serialization.string()), +}); + +export declare namespace LinkCustomerToGiftCardRequest { + export interface Raw { + customer_id: string; + } +} diff --git a/src/serialization/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts b/src/serialization/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts new file mode 100644 index 000000000..bd9fba99e --- /dev/null +++ b/src/serialization/resources/giftCards/client/requests/UnlinkCustomerFromGiftCardRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const UnlinkCustomerFromGiftCardRequest: core.serialization.Schema< + serializers.UnlinkCustomerFromGiftCardRequest.Raw, + Omit +> = core.serialization.object({ + customerId: core.serialization.property("customer_id", core.serialization.string()), +}); + +export declare namespace UnlinkCustomerFromGiftCardRequest { + export interface Raw { + customer_id: string; + } +} diff --git a/src/serialization/resources/giftCards/client/requests/index.ts b/src/serialization/resources/giftCards/client/requests/index.ts new file mode 100644 index 000000000..05bfa3ca0 --- /dev/null +++ b/src/serialization/resources/giftCards/client/requests/index.ts @@ -0,0 +1,5 @@ +export { CreateGiftCardRequest } from "./CreateGiftCardRequest"; +export { GetGiftCardFromGanRequest } from "./GetGiftCardFromGanRequest"; +export { GetGiftCardFromNonceRequest } from "./GetGiftCardFromNonceRequest"; +export { LinkCustomerToGiftCardRequest } from "./LinkCustomerToGiftCardRequest"; +export { UnlinkCustomerFromGiftCardRequest } from "./UnlinkCustomerFromGiftCardRequest"; diff --git a/src/serialization/resources/giftCards/index.ts b/src/serialization/resources/giftCards/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/giftCards/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/giftCards/resources/activities/client/index.ts b/src/serialization/resources/giftCards/resources/activities/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/giftCards/resources/activities/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts b/src/serialization/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts new file mode 100644 index 000000000..9b8efe404 --- /dev/null +++ b/src/serialization/resources/giftCards/resources/activities/client/requests/CreateGiftCardActivityRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { GiftCardActivity } from "../../../../../../types/GiftCardActivity"; + +export const CreateGiftCardActivityRequest: core.serialization.Schema< + serializers.giftCards.CreateGiftCardActivityRequest.Raw, + Square.giftCards.CreateGiftCardActivityRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + giftCardActivity: core.serialization.property("gift_card_activity", GiftCardActivity), +}); + +export declare namespace CreateGiftCardActivityRequest { + export interface Raw { + idempotency_key: string; + gift_card_activity: GiftCardActivity.Raw; + } +} diff --git a/src/serialization/resources/giftCards/resources/activities/client/requests/index.ts b/src/serialization/resources/giftCards/resources/activities/client/requests/index.ts new file mode 100644 index 000000000..6983d1fde --- /dev/null +++ b/src/serialization/resources/giftCards/resources/activities/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateGiftCardActivityRequest } from "./CreateGiftCardActivityRequest"; diff --git a/src/serialization/resources/giftCards/resources/activities/index.ts b/src/serialization/resources/giftCards/resources/activities/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/giftCards/resources/activities/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/giftCards/resources/index.ts b/src/serialization/resources/giftCards/resources/index.ts new file mode 100644 index 000000000..b1095905e --- /dev/null +++ b/src/serialization/resources/giftCards/resources/index.ts @@ -0,0 +1,2 @@ +export * as activities from "./activities"; +export * from "./activities/client/requests"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts new file mode 100644 index 000000000..83b9997cd --- /dev/null +++ b/src/serialization/resources/index.ts @@ -0,0 +1,51 @@ +export * as v1Transactions from "./v1Transactions"; +export * as mobile from "./mobile"; +export * from "./mobile/client/requests"; +export * as oAuth from "./oAuth"; +export * from "./oAuth/client/requests"; +export * from "./v1Transactions/client/requests"; +export * as applePay from "./applePay"; +export * from "./applePay/client/requests"; +export * as bookings from "./bookings"; +export * from "./bookings/client/requests"; +export * as cards from "./cards"; +export * from "./cards/client/requests"; +export * as catalog from "./catalog"; +export * from "./catalog/client/requests"; +export * as customers from "./customers"; +export * from "./customers/client/requests"; +export * as disputes from "./disputes"; +export * from "./disputes/client/requests"; +export * as events from "./events"; +export * from "./events/client/requests"; +export * as giftCards from "./giftCards"; +export * from "./giftCards/client/requests"; +export * as invoices from "./invoices"; +export * from "./invoices/client/requests"; +export * as locations from "./locations"; +export * from "./locations/client/requests"; +export * as loyalty from "./loyalty"; +export * from "./loyalty/client/requests"; +export * as checkout from "./checkout"; +export * from "./checkout/client/requests"; +export * as orders from "./orders"; +export * from "./orders/client/requests"; +export * as payments from "./payments"; +export * from "./payments/client/requests"; +export * as refunds from "./refunds"; +export * from "./refunds/client/requests"; +export * as snippets from "./snippets"; +export * from "./snippets/client/requests"; +export * as subscriptions from "./subscriptions"; +export * from "./subscriptions/client/requests"; +export * as teamMembers from "./teamMembers"; +export * from "./teamMembers/client/requests"; +export * as team from "./team"; +export * from "./team/client/requests"; +export * as vendors from "./vendors"; +export * from "./vendors/client/requests"; +export * as devices from "./devices"; +export * as labor from "./labor"; +export * as merchants from "./merchants"; +export * as terminal from "./terminal"; +export * as webhooks from "./webhooks"; diff --git a/src/serialization/resources/invoices/client/index.ts b/src/serialization/resources/invoices/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/invoices/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/invoices/client/requests/CancelInvoiceRequest.ts b/src/serialization/resources/invoices/client/requests/CancelInvoiceRequest.ts new file mode 100644 index 000000000..6500b6ab0 --- /dev/null +++ b/src/serialization/resources/invoices/client/requests/CancelInvoiceRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const CancelInvoiceRequest: core.serialization.Schema< + serializers.CancelInvoiceRequest.Raw, + Omit +> = core.serialization.object({ + version: core.serialization.number(), +}); + +export declare namespace CancelInvoiceRequest { + export interface Raw { + version: number; + } +} diff --git a/src/serialization/resources/invoices/client/requests/CreateInvoiceRequest.ts b/src/serialization/resources/invoices/client/requests/CreateInvoiceRequest.ts new file mode 100644 index 000000000..42bcf7e22 --- /dev/null +++ b/src/serialization/resources/invoices/client/requests/CreateInvoiceRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Invoice } from "../../../../types/Invoice"; + +export const CreateInvoiceRequest: core.serialization.Schema< + serializers.CreateInvoiceRequest.Raw, + Square.CreateInvoiceRequest +> = core.serialization.object({ + invoice: Invoice, + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), +}); + +export declare namespace CreateInvoiceRequest { + export interface Raw { + invoice: Invoice.Raw; + idempotency_key?: string | null; + } +} diff --git a/src/serialization/resources/invoices/client/requests/PublishInvoiceRequest.ts b/src/serialization/resources/invoices/client/requests/PublishInvoiceRequest.ts new file mode 100644 index 000000000..28315e6e4 --- /dev/null +++ b/src/serialization/resources/invoices/client/requests/PublishInvoiceRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const PublishInvoiceRequest: core.serialization.Schema< + serializers.PublishInvoiceRequest.Raw, + Omit +> = core.serialization.object({ + version: core.serialization.number(), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace PublishInvoiceRequest { + export interface Raw { + version: number; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/invoices/client/requests/SearchInvoicesRequest.ts b/src/serialization/resources/invoices/client/requests/SearchInvoicesRequest.ts new file mode 100644 index 000000000..e4dee2e6b --- /dev/null +++ b/src/serialization/resources/invoices/client/requests/SearchInvoicesRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { InvoiceQuery } from "../../../../types/InvoiceQuery"; + +export const SearchInvoicesRequest: core.serialization.Schema< + serializers.SearchInvoicesRequest.Raw, + Square.SearchInvoicesRequest +> = core.serialization.object({ + query: InvoiceQuery, + limit: core.serialization.number().optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchInvoicesRequest { + export interface Raw { + query: InvoiceQuery.Raw; + limit?: number | null; + cursor?: string | null; + } +} diff --git a/src/serialization/resources/invoices/client/requests/UpdateInvoiceRequest.ts b/src/serialization/resources/invoices/client/requests/UpdateInvoiceRequest.ts new file mode 100644 index 000000000..750087321 --- /dev/null +++ b/src/serialization/resources/invoices/client/requests/UpdateInvoiceRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Invoice } from "../../../../types/Invoice"; + +export const UpdateInvoiceRequest: core.serialization.Schema< + serializers.UpdateInvoiceRequest.Raw, + Omit +> = core.serialization.object({ + invoice: Invoice, + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), + fieldsToClear: core.serialization.property( + "fields_to_clear", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace UpdateInvoiceRequest { + export interface Raw { + invoice: Invoice.Raw; + idempotency_key?: (string | null) | null; + fields_to_clear?: (string[] | null) | null; + } +} diff --git a/src/serialization/resources/invoices/client/requests/index.ts b/src/serialization/resources/invoices/client/requests/index.ts new file mode 100644 index 000000000..ecb9f5b77 --- /dev/null +++ b/src/serialization/resources/invoices/client/requests/index.ts @@ -0,0 +1,5 @@ +export { CreateInvoiceRequest } from "./CreateInvoiceRequest"; +export { SearchInvoicesRequest } from "./SearchInvoicesRequest"; +export { UpdateInvoiceRequest } from "./UpdateInvoiceRequest"; +export { CancelInvoiceRequest } from "./CancelInvoiceRequest"; +export { PublishInvoiceRequest } from "./PublishInvoiceRequest"; diff --git a/src/serialization/resources/invoices/index.ts b/src/serialization/resources/invoices/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/invoices/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/labor/index.ts b/src/serialization/resources/labor/index.ts new file mode 100644 index 000000000..3e5335fe4 --- /dev/null +++ b/src/serialization/resources/labor/index.ts @@ -0,0 +1 @@ +export * from "./resources"; diff --git a/src/serialization/resources/labor/resources/breakTypes/client/index.ts b/src/serialization/resources/labor/resources/breakTypes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/labor/resources/breakTypes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts b/src/serialization/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts new file mode 100644 index 000000000..61d162374 --- /dev/null +++ b/src/serialization/resources/labor/resources/breakTypes/client/requests/CreateBreakTypeRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BreakType } from "../../../../../../types/BreakType"; + +export const CreateBreakTypeRequest: core.serialization.Schema< + serializers.labor.CreateBreakTypeRequest.Raw, + Square.labor.CreateBreakTypeRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + breakType: core.serialization.property("break_type", BreakType), +}); + +export declare namespace CreateBreakTypeRequest { + export interface Raw { + idempotency_key?: string | null; + break_type: BreakType.Raw; + } +} diff --git a/src/serialization/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts b/src/serialization/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts new file mode 100644 index 000000000..4fbe34a90 --- /dev/null +++ b/src/serialization/resources/labor/resources/breakTypes/client/requests/UpdateBreakTypeRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BreakType } from "../../../../../../types/BreakType"; + +export const UpdateBreakTypeRequest: core.serialization.Schema< + serializers.labor.UpdateBreakTypeRequest.Raw, + Omit +> = core.serialization.object({ + breakType: core.serialization.property("break_type", BreakType), +}); + +export declare namespace UpdateBreakTypeRequest { + export interface Raw { + break_type: BreakType.Raw; + } +} diff --git a/src/serialization/resources/labor/resources/breakTypes/client/requests/index.ts b/src/serialization/resources/labor/resources/breakTypes/client/requests/index.ts new file mode 100644 index 000000000..a7266d971 --- /dev/null +++ b/src/serialization/resources/labor/resources/breakTypes/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateBreakTypeRequest } from "./CreateBreakTypeRequest"; +export { UpdateBreakTypeRequest } from "./UpdateBreakTypeRequest"; diff --git a/src/serialization/resources/labor/resources/breakTypes/index.ts b/src/serialization/resources/labor/resources/breakTypes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/labor/resources/breakTypes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/labor/resources/index.ts b/src/serialization/resources/labor/resources/index.ts new file mode 100644 index 000000000..d79b4c040 --- /dev/null +++ b/src/serialization/resources/labor/resources/index.ts @@ -0,0 +1,6 @@ +export * as breakTypes from "./breakTypes"; +export * from "./breakTypes/client/requests"; +export * as shifts from "./shifts"; +export * from "./shifts/client/requests"; +export * as workweekConfigs from "./workweekConfigs"; +export * from "./workweekConfigs/client/requests"; diff --git a/src/serialization/resources/labor/resources/shifts/client/index.ts b/src/serialization/resources/labor/resources/shifts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/labor/resources/shifts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts b/src/serialization/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts new file mode 100644 index 000000000..60eda2e1c --- /dev/null +++ b/src/serialization/resources/labor/resources/shifts/client/requests/CreateShiftRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { Shift } from "../../../../../../types/Shift"; + +export const CreateShiftRequest: core.serialization.Schema< + serializers.labor.CreateShiftRequest.Raw, + Square.labor.CreateShiftRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + shift: Shift, +}); + +export declare namespace CreateShiftRequest { + export interface Raw { + idempotency_key?: string | null; + shift: Shift.Raw; + } +} diff --git a/src/serialization/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts b/src/serialization/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts new file mode 100644 index 000000000..867f740ed --- /dev/null +++ b/src/serialization/resources/labor/resources/shifts/client/requests/SearchShiftsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { ShiftQuery } from "../../../../../../types/ShiftQuery"; + +export const SearchShiftsRequest: core.serialization.Schema< + serializers.labor.SearchShiftsRequest.Raw, + Square.labor.SearchShiftsRequest +> = core.serialization.object({ + query: ShiftQuery.optional(), + limit: core.serialization.number().optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchShiftsRequest { + export interface Raw { + query?: ShiftQuery.Raw | null; + limit?: number | null; + cursor?: string | null; + } +} diff --git a/src/serialization/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts b/src/serialization/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts new file mode 100644 index 000000000..42026820b --- /dev/null +++ b/src/serialization/resources/labor/resources/shifts/client/requests/UpdateShiftRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { Shift } from "../../../../../../types/Shift"; + +export const UpdateShiftRequest: core.serialization.Schema< + serializers.labor.UpdateShiftRequest.Raw, + Omit +> = core.serialization.object({ + shift: Shift, +}); + +export declare namespace UpdateShiftRequest { + export interface Raw { + shift: Shift.Raw; + } +} diff --git a/src/serialization/resources/labor/resources/shifts/client/requests/index.ts b/src/serialization/resources/labor/resources/shifts/client/requests/index.ts new file mode 100644 index 000000000..1745caefa --- /dev/null +++ b/src/serialization/resources/labor/resources/shifts/client/requests/index.ts @@ -0,0 +1,3 @@ +export { CreateShiftRequest } from "./CreateShiftRequest"; +export { SearchShiftsRequest } from "./SearchShiftsRequest"; +export { UpdateShiftRequest } from "./UpdateShiftRequest"; diff --git a/src/serialization/resources/labor/resources/shifts/index.ts b/src/serialization/resources/labor/resources/shifts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/labor/resources/shifts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/labor/resources/workweekConfigs/client/index.ts b/src/serialization/resources/labor/resources/workweekConfigs/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/labor/resources/workweekConfigs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts b/src/serialization/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts new file mode 100644 index 000000000..605b45209 --- /dev/null +++ b/src/serialization/resources/labor/resources/workweekConfigs/client/requests/UpdateWorkweekConfigRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { WorkweekConfig } from "../../../../../../types/WorkweekConfig"; + +export const UpdateWorkweekConfigRequest: core.serialization.Schema< + serializers.labor.UpdateWorkweekConfigRequest.Raw, + Omit +> = core.serialization.object({ + workweekConfig: core.serialization.property("workweek_config", WorkweekConfig), +}); + +export declare namespace UpdateWorkweekConfigRequest { + export interface Raw { + workweek_config: WorkweekConfig.Raw; + } +} diff --git a/src/serialization/resources/labor/resources/workweekConfigs/client/requests/index.ts b/src/serialization/resources/labor/resources/workweekConfigs/client/requests/index.ts new file mode 100644 index 000000000..80294bc4a --- /dev/null +++ b/src/serialization/resources/labor/resources/workweekConfigs/client/requests/index.ts @@ -0,0 +1 @@ +export { UpdateWorkweekConfigRequest } from "./UpdateWorkweekConfigRequest"; diff --git a/src/serialization/resources/labor/resources/workweekConfigs/index.ts b/src/serialization/resources/labor/resources/workweekConfigs/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/labor/resources/workweekConfigs/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/locations/client/index.ts b/src/serialization/resources/locations/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/locations/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/locations/client/requests/CreateCheckoutRequest.ts b/src/serialization/resources/locations/client/requests/CreateCheckoutRequest.ts new file mode 100644 index 000000000..b72bce12d --- /dev/null +++ b/src/serialization/resources/locations/client/requests/CreateCheckoutRequest.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CreateOrderRequest } from "../../../../types/CreateOrderRequest"; +import { Address } from "../../../../types/Address"; +import { ChargeRequestAdditionalRecipient } from "../../../../types/ChargeRequestAdditionalRecipient"; + +export const CreateCheckoutRequest: core.serialization.Schema< + serializers.CreateCheckoutRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + order: CreateOrderRequest, + askForShippingAddress: core.serialization.property( + "ask_for_shipping_address", + core.serialization.boolean().optional(), + ), + merchantSupportEmail: core.serialization.property("merchant_support_email", core.serialization.string().optional()), + prePopulateBuyerEmail: core.serialization.property( + "pre_populate_buyer_email", + core.serialization.string().optional(), + ), + prePopulateShippingAddress: core.serialization.property("pre_populate_shipping_address", Address.optional()), + redirectUrl: core.serialization.property("redirect_url", core.serialization.string().optional()), + additionalRecipients: core.serialization.property( + "additional_recipients", + core.serialization.list(ChargeRequestAdditionalRecipient).optional(), + ), + note: core.serialization.string().optional(), +}); + +export declare namespace CreateCheckoutRequest { + export interface Raw { + idempotency_key: string; + order: CreateOrderRequest.Raw; + ask_for_shipping_address?: boolean | null; + merchant_support_email?: string | null; + pre_populate_buyer_email?: string | null; + pre_populate_shipping_address?: Address.Raw | null; + redirect_url?: string | null; + additional_recipients?: ChargeRequestAdditionalRecipient.Raw[] | null; + note?: string | null; + } +} diff --git a/src/serialization/resources/locations/client/requests/CreateLocationRequest.ts b/src/serialization/resources/locations/client/requests/CreateLocationRequest.ts new file mode 100644 index 000000000..8f2206ff5 --- /dev/null +++ b/src/serialization/resources/locations/client/requests/CreateLocationRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Location } from "../../../../types/Location"; + +export const CreateLocationRequest: core.serialization.Schema< + serializers.CreateLocationRequest.Raw, + Square.CreateLocationRequest +> = core.serialization.object({ + location: Location.optional(), +}); + +export declare namespace CreateLocationRequest { + export interface Raw { + location?: Location.Raw | null; + } +} diff --git a/src/serialization/resources/locations/client/requests/UpdateLocationRequest.ts b/src/serialization/resources/locations/client/requests/UpdateLocationRequest.ts new file mode 100644 index 000000000..994c21745 --- /dev/null +++ b/src/serialization/resources/locations/client/requests/UpdateLocationRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Location } from "../../../../types/Location"; + +export const UpdateLocationRequest: core.serialization.Schema< + serializers.UpdateLocationRequest.Raw, + Omit +> = core.serialization.object({ + location: Location.optional(), +}); + +export declare namespace UpdateLocationRequest { + export interface Raw { + location?: Location.Raw | null; + } +} diff --git a/src/serialization/resources/locations/client/requests/index.ts b/src/serialization/resources/locations/client/requests/index.ts new file mode 100644 index 000000000..7527b14b5 --- /dev/null +++ b/src/serialization/resources/locations/client/requests/index.ts @@ -0,0 +1,3 @@ +export { CreateLocationRequest } from "./CreateLocationRequest"; +export { UpdateLocationRequest } from "./UpdateLocationRequest"; +export { CreateCheckoutRequest } from "./CreateCheckoutRequest"; diff --git a/src/serialization/resources/locations/index.ts b/src/serialization/resources/locations/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/locations/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/locations/resources/customAttributeDefinitions/client/index.ts b/src/serialization/resources/locations/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts b/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..00faaf3fb --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/CreateLocationCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const CreateLocationCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.locations.CreateLocationCustomAttributeDefinitionRequest.Raw, + Square.locations.CreateLocationCustomAttributeDefinitionRequest +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), +}); + +export declare namespace CreateLocationCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: string | null; + } +} diff --git a/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts b/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..8b6169e08 --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/UpdateLocationCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const UpdateLocationCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.locations.UpdateLocationCustomAttributeDefinitionRequest.Raw, + Omit +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpdateLocationCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts b/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..16cc477e6 --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateLocationCustomAttributeDefinitionRequest } from "./CreateLocationCustomAttributeDefinitionRequest"; +export { UpdateLocationCustomAttributeDefinitionRequest } from "./UpdateLocationCustomAttributeDefinitionRequest"; diff --git a/src/serialization/resources/locations/resources/customAttributeDefinitions/index.ts b/src/serialization/resources/locations/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/locations/resources/customAttributes/client/index.ts b/src/serialization/resources/locations/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts b/src/serialization/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts new file mode 100644 index 000000000..bf41571ed --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributes/client/requests/BulkDeleteLocationCustomAttributesRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest } from "../../../../../../types/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest"; + +export const BulkDeleteLocationCustomAttributesRequest: core.serialization.Schema< + serializers.locations.BulkDeleteLocationCustomAttributesRequest.Raw, + Square.locations.BulkDeleteLocationCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest, + ), +}); + +export declare namespace BulkDeleteLocationCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts b/src/serialization/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts new file mode 100644 index 000000000..57f14749a --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributes/client/requests/BulkUpsertLocationCustomAttributesRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest } from "../../../../../../types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest"; + +export const BulkUpsertLocationCustomAttributesRequest: core.serialization.Schema< + serializers.locations.BulkUpsertLocationCustomAttributesRequest.Raw, + Square.locations.BulkUpsertLocationCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest, + ), +}); + +export declare namespace BulkUpsertLocationCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts b/src/serialization/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts new file mode 100644 index 000000000..c20535527 --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributes/client/requests/UpsertLocationCustomAttributeRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttribute } from "../../../../../../types/CustomAttribute"; + +export const UpsertLocationCustomAttributeRequest: core.serialization.Schema< + serializers.locations.UpsertLocationCustomAttributeRequest.Raw, + Omit +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpsertLocationCustomAttributeRequest { + export interface Raw { + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/locations/resources/customAttributes/client/requests/index.ts b/src/serialization/resources/locations/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..9eb87414b --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,3 @@ +export { BulkDeleteLocationCustomAttributesRequest } from "./BulkDeleteLocationCustomAttributesRequest"; +export { BulkUpsertLocationCustomAttributesRequest } from "./BulkUpsertLocationCustomAttributesRequest"; +export { UpsertLocationCustomAttributeRequest } from "./UpsertLocationCustomAttributeRequest"; diff --git a/src/serialization/resources/locations/resources/customAttributes/index.ts b/src/serialization/resources/locations/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/locations/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/locations/resources/index.ts b/src/serialization/resources/locations/resources/index.ts new file mode 100644 index 000000000..96153bc82 --- /dev/null +++ b/src/serialization/resources/locations/resources/index.ts @@ -0,0 +1,4 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * from "./customAttributeDefinitions/client/requests"; +export * as customAttributes from "./customAttributes"; +export * from "./customAttributes/client/requests"; diff --git a/src/serialization/resources/loyalty/client/index.ts b/src/serialization/resources/loyalty/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/loyalty/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts b/src/serialization/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts new file mode 100644 index 000000000..4a9cb5831 --- /dev/null +++ b/src/serialization/resources/loyalty/client/requests/SearchLoyaltyEventsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { LoyaltyEventQuery } from "../../../../types/LoyaltyEventQuery"; + +export const SearchLoyaltyEventsRequest: core.serialization.Schema< + serializers.SearchLoyaltyEventsRequest.Raw, + Square.SearchLoyaltyEventsRequest +> = core.serialization.object({ + query: LoyaltyEventQuery.optional(), + limit: core.serialization.number().optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchLoyaltyEventsRequest { + export interface Raw { + query?: LoyaltyEventQuery.Raw | null; + limit?: number | null; + cursor?: string | null; + } +} diff --git a/src/serialization/resources/loyalty/client/requests/index.ts b/src/serialization/resources/loyalty/client/requests/index.ts new file mode 100644 index 000000000..a7380530e --- /dev/null +++ b/src/serialization/resources/loyalty/client/requests/index.ts @@ -0,0 +1 @@ +export { SearchLoyaltyEventsRequest } from "./SearchLoyaltyEventsRequest"; diff --git a/src/serialization/resources/loyalty/index.ts b/src/serialization/resources/loyalty/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/loyalty/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/loyalty/resources/accounts/client/index.ts b/src/serialization/resources/loyalty/resources/accounts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/loyalty/resources/accounts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts b/src/serialization/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts new file mode 100644 index 000000000..82798bad6 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/accounts/client/requests/AccumulateLoyaltyPointsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { LoyaltyEventAccumulatePoints } from "../../../../../../types/LoyaltyEventAccumulatePoints"; + +export const AccumulateLoyaltyPointsRequest: core.serialization.Schema< + serializers.loyalty.AccumulateLoyaltyPointsRequest.Raw, + Omit +> = core.serialization.object({ + accumulatePoints: core.serialization.property("accumulate_points", LoyaltyEventAccumulatePoints), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + locationId: core.serialization.property("location_id", core.serialization.string()), +}); + +export declare namespace AccumulateLoyaltyPointsRequest { + export interface Raw { + accumulate_points: LoyaltyEventAccumulatePoints.Raw; + idempotency_key: string; + location_id: string; + } +} diff --git a/src/serialization/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts b/src/serialization/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts new file mode 100644 index 000000000..dd917764d --- /dev/null +++ b/src/serialization/resources/loyalty/resources/accounts/client/requests/AdjustLoyaltyPointsRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { LoyaltyEventAdjustPoints } from "../../../../../../types/LoyaltyEventAdjustPoints"; + +export const AdjustLoyaltyPointsRequest: core.serialization.Schema< + serializers.loyalty.AdjustLoyaltyPointsRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + adjustPoints: core.serialization.property("adjust_points", LoyaltyEventAdjustPoints), + allowNegativeBalance: core.serialization.property( + "allow_negative_balance", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace AdjustLoyaltyPointsRequest { + export interface Raw { + idempotency_key: string; + adjust_points: LoyaltyEventAdjustPoints.Raw; + allow_negative_balance?: (boolean | null) | null; + } +} diff --git a/src/serialization/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts b/src/serialization/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts new file mode 100644 index 000000000..ed4e98e0a --- /dev/null +++ b/src/serialization/resources/loyalty/resources/accounts/client/requests/CreateLoyaltyAccountRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { LoyaltyAccount } from "../../../../../../types/LoyaltyAccount"; + +export const CreateLoyaltyAccountRequest: core.serialization.Schema< + serializers.loyalty.CreateLoyaltyAccountRequest.Raw, + Square.loyalty.CreateLoyaltyAccountRequest +> = core.serialization.object({ + loyaltyAccount: core.serialization.property("loyalty_account", LoyaltyAccount), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), +}); + +export declare namespace CreateLoyaltyAccountRequest { + export interface Raw { + loyalty_account: LoyaltyAccount.Raw; + idempotency_key: string; + } +} diff --git a/src/serialization/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts b/src/serialization/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts new file mode 100644 index 000000000..45d7d4b8b --- /dev/null +++ b/src/serialization/resources/loyalty/resources/accounts/client/requests/SearchLoyaltyAccountsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { SearchLoyaltyAccountsRequestLoyaltyAccountQuery } from "../../../../../../types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery"; + +export const SearchLoyaltyAccountsRequest: core.serialization.Schema< + serializers.loyalty.SearchLoyaltyAccountsRequest.Raw, + Square.loyalty.SearchLoyaltyAccountsRequest +> = core.serialization.object({ + query: SearchLoyaltyAccountsRequestLoyaltyAccountQuery.optional(), + limit: core.serialization.number().optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchLoyaltyAccountsRequest { + export interface Raw { + query?: SearchLoyaltyAccountsRequestLoyaltyAccountQuery.Raw | null; + limit?: number | null; + cursor?: string | null; + } +} diff --git a/src/serialization/resources/loyalty/resources/accounts/client/requests/index.ts b/src/serialization/resources/loyalty/resources/accounts/client/requests/index.ts new file mode 100644 index 000000000..03227b225 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/accounts/client/requests/index.ts @@ -0,0 +1,4 @@ +export { CreateLoyaltyAccountRequest } from "./CreateLoyaltyAccountRequest"; +export { SearchLoyaltyAccountsRequest } from "./SearchLoyaltyAccountsRequest"; +export { AccumulateLoyaltyPointsRequest } from "./AccumulateLoyaltyPointsRequest"; +export { AdjustLoyaltyPointsRequest } from "./AdjustLoyaltyPointsRequest"; diff --git a/src/serialization/resources/loyalty/resources/accounts/index.ts b/src/serialization/resources/loyalty/resources/accounts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/loyalty/resources/accounts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/loyalty/resources/index.ts b/src/serialization/resources/loyalty/resources/index.ts new file mode 100644 index 000000000..98cded2c5 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/index.ts @@ -0,0 +1,6 @@ +export * as accounts from "./accounts"; +export * from "./accounts/client/requests"; +export * as programs from "./programs"; +export * from "./programs/client/requests"; +export * as rewards from "./rewards"; +export * from "./rewards/client/requests"; diff --git a/src/serialization/resources/loyalty/resources/programs/client/index.ts b/src/serialization/resources/loyalty/resources/programs/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts b/src/serialization/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts new file mode 100644 index 000000000..5f95c2425 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/client/requests/CalculateLoyaltyPointsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { Money } from "../../../../../../types/Money"; + +export const CalculateLoyaltyPointsRequest: core.serialization.Schema< + serializers.loyalty.CalculateLoyaltyPointsRequest.Raw, + Omit +> = core.serialization.object({ + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + transactionAmountMoney: core.serialization.property("transaction_amount_money", Money.optional()), + loyaltyAccountId: core.serialization.property("loyalty_account_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace CalculateLoyaltyPointsRequest { + export interface Raw { + order_id?: (string | null) | null; + transaction_amount_money?: Money.Raw | null; + loyalty_account_id?: (string | null) | null; + } +} diff --git a/src/serialization/resources/loyalty/resources/programs/client/requests/index.ts b/src/serialization/resources/loyalty/resources/programs/client/requests/index.ts new file mode 100644 index 000000000..d3ccef282 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/client/requests/index.ts @@ -0,0 +1 @@ +export { CalculateLoyaltyPointsRequest } from "./CalculateLoyaltyPointsRequest"; diff --git a/src/serialization/resources/loyalty/resources/programs/index.ts b/src/serialization/resources/loyalty/resources/programs/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/loyalty/resources/programs/resources/index.ts b/src/serialization/resources/loyalty/resources/programs/resources/index.ts new file mode 100644 index 000000000..0da7d5f94 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/resources/index.ts @@ -0,0 +1,2 @@ +export * as promotions from "./promotions"; +export * from "./promotions/client/requests"; diff --git a/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/index.ts b/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/requests/CreateLoyaltyPromotionRequest.ts b/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/requests/CreateLoyaltyPromotionRequest.ts new file mode 100644 index 000000000..06a38c038 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/requests/CreateLoyaltyPromotionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../../../index"; +import * as Square from "../../../../../../../../../api/index"; +import * as core from "../../../../../../../../../core"; +import { LoyaltyPromotion } from "../../../../../../../../types/LoyaltyPromotion"; + +export const CreateLoyaltyPromotionRequest: core.serialization.Schema< + serializers.loyalty.programs.CreateLoyaltyPromotionRequest.Raw, + Omit +> = core.serialization.object({ + loyaltyPromotion: core.serialization.property("loyalty_promotion", LoyaltyPromotion), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), +}); + +export declare namespace CreateLoyaltyPromotionRequest { + export interface Raw { + loyalty_promotion: LoyaltyPromotion.Raw; + idempotency_key: string; + } +} diff --git a/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/requests/index.ts b/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/requests/index.ts new file mode 100644 index 000000000..8fcc50de0 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/resources/promotions/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateLoyaltyPromotionRequest } from "./CreateLoyaltyPromotionRequest"; diff --git a/src/serialization/resources/loyalty/resources/programs/resources/promotions/index.ts b/src/serialization/resources/loyalty/resources/programs/resources/promotions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/loyalty/resources/programs/resources/promotions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/loyalty/resources/rewards/client/index.ts b/src/serialization/resources/loyalty/resources/rewards/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/loyalty/resources/rewards/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts b/src/serialization/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts new file mode 100644 index 000000000..488fc35d8 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/rewards/client/requests/CreateLoyaltyRewardRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { LoyaltyReward } from "../../../../../../types/LoyaltyReward"; + +export const CreateLoyaltyRewardRequest: core.serialization.Schema< + serializers.loyalty.CreateLoyaltyRewardRequest.Raw, + Square.loyalty.CreateLoyaltyRewardRequest +> = core.serialization.object({ + reward: LoyaltyReward, + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), +}); + +export declare namespace CreateLoyaltyRewardRequest { + export interface Raw { + reward: LoyaltyReward.Raw; + idempotency_key: string; + } +} diff --git a/src/serialization/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts b/src/serialization/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts new file mode 100644 index 000000000..4531f813d --- /dev/null +++ b/src/serialization/resources/loyalty/resources/rewards/client/requests/RedeemLoyaltyRewardRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; + +export const RedeemLoyaltyRewardRequest: core.serialization.Schema< + serializers.loyalty.RedeemLoyaltyRewardRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + locationId: core.serialization.property("location_id", core.serialization.string()), +}); + +export declare namespace RedeemLoyaltyRewardRequest { + export interface Raw { + idempotency_key: string; + location_id: string; + } +} diff --git a/src/serialization/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts b/src/serialization/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts new file mode 100644 index 000000000..d29fbf38d --- /dev/null +++ b/src/serialization/resources/loyalty/resources/rewards/client/requests/SearchLoyaltyRewardsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { SearchLoyaltyRewardsRequestLoyaltyRewardQuery } from "../../../../../../types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery"; + +export const SearchLoyaltyRewardsRequest: core.serialization.Schema< + serializers.loyalty.SearchLoyaltyRewardsRequest.Raw, + Square.loyalty.SearchLoyaltyRewardsRequest +> = core.serialization.object({ + query: SearchLoyaltyRewardsRequestLoyaltyRewardQuery.optional(), + limit: core.serialization.number().optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchLoyaltyRewardsRequest { + export interface Raw { + query?: SearchLoyaltyRewardsRequestLoyaltyRewardQuery.Raw | null; + limit?: number | null; + cursor?: string | null; + } +} diff --git a/src/serialization/resources/loyalty/resources/rewards/client/requests/index.ts b/src/serialization/resources/loyalty/resources/rewards/client/requests/index.ts new file mode 100644 index 000000000..73d200ec3 --- /dev/null +++ b/src/serialization/resources/loyalty/resources/rewards/client/requests/index.ts @@ -0,0 +1,3 @@ +export { CreateLoyaltyRewardRequest } from "./CreateLoyaltyRewardRequest"; +export { SearchLoyaltyRewardsRequest } from "./SearchLoyaltyRewardsRequest"; +export { RedeemLoyaltyRewardRequest } from "./RedeemLoyaltyRewardRequest"; diff --git a/src/serialization/resources/loyalty/resources/rewards/index.ts b/src/serialization/resources/loyalty/resources/rewards/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/loyalty/resources/rewards/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/merchants/index.ts b/src/serialization/resources/merchants/index.ts new file mode 100644 index 000000000..3e5335fe4 --- /dev/null +++ b/src/serialization/resources/merchants/index.ts @@ -0,0 +1 @@ +export * from "./resources"; diff --git a/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/index.ts b/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts b/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..77146cbdd --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/CreateMerchantCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const CreateMerchantCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.merchants.CreateMerchantCustomAttributeDefinitionRequest.Raw, + Square.merchants.CreateMerchantCustomAttributeDefinitionRequest +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), +}); + +export declare namespace CreateMerchantCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: string | null; + } +} diff --git a/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts b/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..786d2c616 --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/UpdateMerchantCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const UpdateMerchantCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.merchants.UpdateMerchantCustomAttributeDefinitionRequest.Raw, + Omit +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpdateMerchantCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts b/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..eb7d4afd2 --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateMerchantCustomAttributeDefinitionRequest } from "./CreateMerchantCustomAttributeDefinitionRequest"; +export { UpdateMerchantCustomAttributeDefinitionRequest } from "./UpdateMerchantCustomAttributeDefinitionRequest"; diff --git a/src/serialization/resources/merchants/resources/customAttributeDefinitions/index.ts b/src/serialization/resources/merchants/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/merchants/resources/customAttributes/client/index.ts b/src/serialization/resources/merchants/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts b/src/serialization/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts new file mode 100644 index 000000000..c78a982c9 --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributes/client/requests/BulkDeleteMerchantCustomAttributesRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest } from "../../../../../../types/BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest"; + +export const BulkDeleteMerchantCustomAttributesRequest: core.serialization.Schema< + serializers.merchants.BulkDeleteMerchantCustomAttributesRequest.Raw, + Square.merchants.BulkDeleteMerchantCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest, + ), +}); + +export declare namespace BulkDeleteMerchantCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts b/src/serialization/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts new file mode 100644 index 000000000..68b2a4675 --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributes/client/requests/BulkUpsertMerchantCustomAttributesRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest } from "../../../../../../types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest"; + +export const BulkUpsertMerchantCustomAttributesRequest: core.serialization.Schema< + serializers.merchants.BulkUpsertMerchantCustomAttributesRequest.Raw, + Square.merchants.BulkUpsertMerchantCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest, + ), +}); + +export declare namespace BulkUpsertMerchantCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts b/src/serialization/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts new file mode 100644 index 000000000..fd3d3f1f9 --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributes/client/requests/UpsertMerchantCustomAttributeRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttribute } from "../../../../../../types/CustomAttribute"; + +export const UpsertMerchantCustomAttributeRequest: core.serialization.Schema< + serializers.merchants.UpsertMerchantCustomAttributeRequest.Raw, + Omit +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpsertMerchantCustomAttributeRequest { + export interface Raw { + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/merchants/resources/customAttributes/client/requests/index.ts b/src/serialization/resources/merchants/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..425cecf89 --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,3 @@ +export { BulkDeleteMerchantCustomAttributesRequest } from "./BulkDeleteMerchantCustomAttributesRequest"; +export { BulkUpsertMerchantCustomAttributesRequest } from "./BulkUpsertMerchantCustomAttributesRequest"; +export { UpsertMerchantCustomAttributeRequest } from "./UpsertMerchantCustomAttributeRequest"; diff --git a/src/serialization/resources/merchants/resources/customAttributes/index.ts b/src/serialization/resources/merchants/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/merchants/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/merchants/resources/index.ts b/src/serialization/resources/merchants/resources/index.ts new file mode 100644 index 000000000..96153bc82 --- /dev/null +++ b/src/serialization/resources/merchants/resources/index.ts @@ -0,0 +1,4 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * from "./customAttributeDefinitions/client/requests"; +export * as customAttributes from "./customAttributes"; +export * from "./customAttributes/client/requests"; diff --git a/src/serialization/resources/mobile/client/index.ts b/src/serialization/resources/mobile/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/mobile/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts b/src/serialization/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts new file mode 100644 index 000000000..0d33f8179 --- /dev/null +++ b/src/serialization/resources/mobile/client/requests/CreateMobileAuthorizationCodeRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const CreateMobileAuthorizationCodeRequest: core.serialization.Schema< + serializers.CreateMobileAuthorizationCodeRequest.Raw, + Square.CreateMobileAuthorizationCodeRequest +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string().optional()), +}); + +export declare namespace CreateMobileAuthorizationCodeRequest { + export interface Raw { + location_id?: string | null; + } +} diff --git a/src/serialization/resources/mobile/client/requests/index.ts b/src/serialization/resources/mobile/client/requests/index.ts new file mode 100644 index 000000000..bea839634 --- /dev/null +++ b/src/serialization/resources/mobile/client/requests/index.ts @@ -0,0 +1 @@ +export { CreateMobileAuthorizationCodeRequest } from "./CreateMobileAuthorizationCodeRequest"; diff --git a/src/serialization/resources/mobile/index.ts b/src/serialization/resources/mobile/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/mobile/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/oAuth/client/index.ts b/src/serialization/resources/oAuth/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/oAuth/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/oAuth/client/requests/ObtainTokenRequest.ts b/src/serialization/resources/oAuth/client/requests/ObtainTokenRequest.ts new file mode 100644 index 000000000..cbde8c0d5 --- /dev/null +++ b/src/serialization/resources/oAuth/client/requests/ObtainTokenRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const ObtainTokenRequest: core.serialization.Schema< + serializers.ObtainTokenRequest.Raw, + Square.ObtainTokenRequest +> = core.serialization.object({ + clientId: core.serialization.property("client_id", core.serialization.string()), + clientSecret: core.serialization.property("client_secret", core.serialization.string().optionalNullable()), + code: core.serialization.string().optionalNullable(), + redirectUri: core.serialization.property("redirect_uri", core.serialization.string().optionalNullable()), + grantType: core.serialization.property("grant_type", core.serialization.string()), + refreshToken: core.serialization.property("refresh_token", core.serialization.string().optionalNullable()), + migrationToken: core.serialization.property("migration_token", core.serialization.string().optionalNullable()), + scopes: core.serialization.list(core.serialization.string()).optionalNullable(), + shortLived: core.serialization.property("short_lived", core.serialization.boolean().optionalNullable()), + codeVerifier: core.serialization.property("code_verifier", core.serialization.string().optionalNullable()), +}); + +export declare namespace ObtainTokenRequest { + export interface Raw { + client_id: string; + client_secret?: (string | null) | null; + code?: (string | null) | null; + redirect_uri?: (string | null) | null; + grant_type: string; + refresh_token?: (string | null) | null; + migration_token?: (string | null) | null; + scopes?: (string[] | null) | null; + short_lived?: (boolean | null) | null; + code_verifier?: (string | null) | null; + } +} diff --git a/src/serialization/resources/oAuth/client/requests/RevokeTokenRequest.ts b/src/serialization/resources/oAuth/client/requests/RevokeTokenRequest.ts new file mode 100644 index 000000000..a1546b6fe --- /dev/null +++ b/src/serialization/resources/oAuth/client/requests/RevokeTokenRequest.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const RevokeTokenRequest: core.serialization.Schema< + serializers.RevokeTokenRequest.Raw, + Square.RevokeTokenRequest +> = core.serialization.object({ + clientId: core.serialization.property("client_id", core.serialization.string().optionalNullable()), + accessToken: core.serialization.property("access_token", core.serialization.string().optionalNullable()), + merchantId: core.serialization.property("merchant_id", core.serialization.string().optionalNullable()), + revokeOnlyAccessToken: core.serialization.property( + "revoke_only_access_token", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace RevokeTokenRequest { + export interface Raw { + client_id?: (string | null) | null; + access_token?: (string | null) | null; + merchant_id?: (string | null) | null; + revoke_only_access_token?: (boolean | null) | null; + } +} diff --git a/src/serialization/resources/oAuth/client/requests/index.ts b/src/serialization/resources/oAuth/client/requests/index.ts new file mode 100644 index 000000000..3adbffa40 --- /dev/null +++ b/src/serialization/resources/oAuth/client/requests/index.ts @@ -0,0 +1,2 @@ +export { RevokeTokenRequest } from "./RevokeTokenRequest"; +export { ObtainTokenRequest } from "./ObtainTokenRequest"; diff --git a/src/serialization/resources/oAuth/index.ts b/src/serialization/resources/oAuth/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/oAuth/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/orders/client/index.ts b/src/serialization/resources/orders/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/orders/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/orders/client/requests/BatchGetOrdersRequest.ts b/src/serialization/resources/orders/client/requests/BatchGetOrdersRequest.ts new file mode 100644 index 000000000..9231fb858 --- /dev/null +++ b/src/serialization/resources/orders/client/requests/BatchGetOrdersRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BatchGetOrdersRequest: core.serialization.Schema< + serializers.BatchGetOrdersRequest.Raw, + Square.BatchGetOrdersRequest +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + orderIds: core.serialization.property("order_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace BatchGetOrdersRequest { + export interface Raw { + location_id?: (string | null) | null; + order_ids: string[]; + } +} diff --git a/src/serialization/resources/orders/client/requests/CalculateOrderRequest.ts b/src/serialization/resources/orders/client/requests/CalculateOrderRequest.ts new file mode 100644 index 000000000..f45aa627c --- /dev/null +++ b/src/serialization/resources/orders/client/requests/CalculateOrderRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Order } from "../../../../types/Order"; +import { OrderReward } from "../../../../types/OrderReward"; + +export const CalculateOrderRequest: core.serialization.Schema< + serializers.CalculateOrderRequest.Raw, + Square.CalculateOrderRequest +> = core.serialization.object({ + order: Order, + proposedRewards: core.serialization.property( + "proposed_rewards", + core.serialization.list(OrderReward).optionalNullable(), + ), +}); + +export declare namespace CalculateOrderRequest { + export interface Raw { + order: Order.Raw; + proposed_rewards?: (OrderReward.Raw[] | null) | null; + } +} diff --git a/src/serialization/resources/orders/client/requests/CloneOrderRequest.ts b/src/serialization/resources/orders/client/requests/CloneOrderRequest.ts new file mode 100644 index 000000000..859bd99e2 --- /dev/null +++ b/src/serialization/resources/orders/client/requests/CloneOrderRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const CloneOrderRequest: core.serialization.Schema = + core.serialization.object({ + orderId: core.serialization.property("order_id", core.serialization.string()), + version: core.serialization.number().optional(), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), + }); + +export declare namespace CloneOrderRequest { + export interface Raw { + order_id: string; + version?: number | null; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/orders/client/requests/PayOrderRequest.ts b/src/serialization/resources/orders/client/requests/PayOrderRequest.ts new file mode 100644 index 000000000..bf220bf26 --- /dev/null +++ b/src/serialization/resources/orders/client/requests/PayOrderRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const PayOrderRequest: core.serialization.Schema< + serializers.PayOrderRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + orderVersion: core.serialization.property("order_version", core.serialization.number().optionalNullable()), + paymentIds: core.serialization.property( + "payment_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace PayOrderRequest { + export interface Raw { + idempotency_key: string; + order_version?: (number | null) | null; + payment_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/resources/orders/client/requests/SearchOrdersRequest.ts b/src/serialization/resources/orders/client/requests/SearchOrdersRequest.ts new file mode 100644 index 000000000..fd836c0ad --- /dev/null +++ b/src/serialization/resources/orders/client/requests/SearchOrdersRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { SearchOrdersQuery } from "../../../../types/SearchOrdersQuery"; + +export const SearchOrdersRequest: core.serialization.Schema< + serializers.SearchOrdersRequest.Raw, + Square.SearchOrdersRequest +> = core.serialization.object({ + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + cursor: core.serialization.string().optional(), + query: SearchOrdersQuery.optional(), + limit: core.serialization.number().optional(), + returnEntries: core.serialization.property("return_entries", core.serialization.boolean().optional()), +}); + +export declare namespace SearchOrdersRequest { + export interface Raw { + location_ids?: string[] | null; + cursor?: string | null; + query?: SearchOrdersQuery.Raw | null; + limit?: number | null; + return_entries?: boolean | null; + } +} diff --git a/src/serialization/resources/orders/client/requests/UpdateOrderRequest.ts b/src/serialization/resources/orders/client/requests/UpdateOrderRequest.ts new file mode 100644 index 000000000..e67aa8934 --- /dev/null +++ b/src/serialization/resources/orders/client/requests/UpdateOrderRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Order } from "../../../../types/Order"; + +export const UpdateOrderRequest: core.serialization.Schema< + serializers.UpdateOrderRequest.Raw, + Omit +> = core.serialization.object({ + order: Order.optional(), + fieldsToClear: core.serialization.property( + "fields_to_clear", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpdateOrderRequest { + export interface Raw { + order?: Order.Raw | null; + fields_to_clear?: (string[] | null) | null; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/orders/client/requests/index.ts b/src/serialization/resources/orders/client/requests/index.ts new file mode 100644 index 000000000..cad486739 --- /dev/null +++ b/src/serialization/resources/orders/client/requests/index.ts @@ -0,0 +1,6 @@ +export { BatchGetOrdersRequest } from "./BatchGetOrdersRequest"; +export { CalculateOrderRequest } from "./CalculateOrderRequest"; +export { CloneOrderRequest } from "./CloneOrderRequest"; +export { SearchOrdersRequest } from "./SearchOrdersRequest"; +export { UpdateOrderRequest } from "./UpdateOrderRequest"; +export { PayOrderRequest } from "./PayOrderRequest"; diff --git a/src/serialization/resources/orders/index.ts b/src/serialization/resources/orders/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/orders/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/orders/resources/customAttributeDefinitions/client/index.ts b/src/serialization/resources/orders/resources/customAttributeDefinitions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributeDefinitions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts b/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..d41721b2f --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/CreateOrderCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const CreateOrderCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.orders.CreateOrderCustomAttributeDefinitionRequest.Raw, + Square.orders.CreateOrderCustomAttributeDefinitionRequest +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), +}); + +export declare namespace CreateOrderCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: string | null; + } +} diff --git a/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts b/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts new file mode 100644 index 000000000..1f23cef83 --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/UpdateOrderCustomAttributeDefinitionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttributeDefinition } from "../../../../../../types/CustomAttributeDefinition"; + +export const UpdateOrderCustomAttributeDefinitionRequest: core.serialization.Schema< + serializers.orders.UpdateOrderCustomAttributeDefinitionRequest.Raw, + Omit +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property("custom_attribute_definition", CustomAttributeDefinition), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpdateOrderCustomAttributeDefinitionRequest { + export interface Raw { + custom_attribute_definition: CustomAttributeDefinition.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts b/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts new file mode 100644 index 000000000..ac4d01a44 --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributeDefinitions/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateOrderCustomAttributeDefinitionRequest } from "./CreateOrderCustomAttributeDefinitionRequest"; +export { UpdateOrderCustomAttributeDefinitionRequest } from "./UpdateOrderCustomAttributeDefinitionRequest"; diff --git a/src/serialization/resources/orders/resources/customAttributeDefinitions/index.ts b/src/serialization/resources/orders/resources/customAttributeDefinitions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributeDefinitions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/orders/resources/customAttributes/client/index.ts b/src/serialization/resources/orders/resources/customAttributes/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributes/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts b/src/serialization/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts new file mode 100644 index 000000000..16ed1b7f3 --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributes/client/requests/BulkDeleteOrderCustomAttributesRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute } from "../../../../../../types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute"; + +export const BulkDeleteOrderCustomAttributesRequest: core.serialization.Schema< + serializers.orders.BulkDeleteOrderCustomAttributesRequest.Raw, + Square.orders.BulkDeleteOrderCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute, + ), +}); + +export declare namespace BulkDeleteOrderCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts b/src/serialization/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts new file mode 100644 index 000000000..2999133ec --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributes/client/requests/BulkUpsertOrderCustomAttributesRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute } from "../../../../../../types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute"; + +export const BulkUpsertOrderCustomAttributesRequest: core.serialization.Schema< + serializers.orders.BulkUpsertOrderCustomAttributesRequest.Raw, + Square.orders.BulkUpsertOrderCustomAttributesRequest +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute, + ), +}); + +export declare namespace BulkUpsertOrderCustomAttributesRequest { + export interface Raw { + values: Record; + } +} diff --git a/src/serialization/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts b/src/serialization/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts new file mode 100644 index 000000000..cd5451bfd --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributes/client/requests/UpsertOrderCustomAttributeRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { CustomAttribute } from "../../../../../../types/CustomAttribute"; + +export const UpsertOrderCustomAttributeRequest: core.serialization.Schema< + serializers.orders.UpsertOrderCustomAttributeRequest.Raw, + Omit +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpsertOrderCustomAttributeRequest { + export interface Raw { + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/orders/resources/customAttributes/client/requests/index.ts b/src/serialization/resources/orders/resources/customAttributes/client/requests/index.ts new file mode 100644 index 000000000..61f2eb98d --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributes/client/requests/index.ts @@ -0,0 +1,3 @@ +export { BulkDeleteOrderCustomAttributesRequest } from "./BulkDeleteOrderCustomAttributesRequest"; +export { BulkUpsertOrderCustomAttributesRequest } from "./BulkUpsertOrderCustomAttributesRequest"; +export { UpsertOrderCustomAttributeRequest } from "./UpsertOrderCustomAttributeRequest"; diff --git a/src/serialization/resources/orders/resources/customAttributes/index.ts b/src/serialization/resources/orders/resources/customAttributes/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/orders/resources/customAttributes/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/orders/resources/index.ts b/src/serialization/resources/orders/resources/index.ts new file mode 100644 index 000000000..96153bc82 --- /dev/null +++ b/src/serialization/resources/orders/resources/index.ts @@ -0,0 +1,4 @@ +export * as customAttributeDefinitions from "./customAttributeDefinitions"; +export * from "./customAttributeDefinitions/client/requests"; +export * as customAttributes from "./customAttributes"; +export * from "./customAttributes/client/requests"; diff --git a/src/serialization/resources/payments/client/index.ts b/src/serialization/resources/payments/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/payments/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts b/src/serialization/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts new file mode 100644 index 000000000..0efa29d7c --- /dev/null +++ b/src/serialization/resources/payments/client/requests/CancelPaymentByIdempotencyKeyRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const CancelPaymentByIdempotencyKeyRequest: core.serialization.Schema< + serializers.CancelPaymentByIdempotencyKeyRequest.Raw, + Square.CancelPaymentByIdempotencyKeyRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), +}); + +export declare namespace CancelPaymentByIdempotencyKeyRequest { + export interface Raw { + idempotency_key: string; + } +} diff --git a/src/serialization/resources/payments/client/requests/CompletePaymentRequest.ts b/src/serialization/resources/payments/client/requests/CompletePaymentRequest.ts new file mode 100644 index 000000000..7c78bc1f1 --- /dev/null +++ b/src/serialization/resources/payments/client/requests/CompletePaymentRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const CompletePaymentRequest: core.serialization.Schema< + serializers.CompletePaymentRequest.Raw, + Omit +> = core.serialization.object({ + versionToken: core.serialization.property("version_token", core.serialization.string().optionalNullable()), +}); + +export declare namespace CompletePaymentRequest { + export interface Raw { + version_token?: (string | null) | null; + } +} diff --git a/src/serialization/resources/payments/client/requests/CreatePaymentRequest.ts b/src/serialization/resources/payments/client/requests/CreatePaymentRequest.ts new file mode 100644 index 000000000..35c740983 --- /dev/null +++ b/src/serialization/resources/payments/client/requests/CreatePaymentRequest.ts @@ -0,0 +1,80 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Money } from "../../../../types/Money"; +import { Address } from "../../../../types/Address"; +import { CashPaymentDetails } from "../../../../types/CashPaymentDetails"; +import { ExternalPaymentDetails } from "../../../../types/ExternalPaymentDetails"; +import { CustomerDetails } from "../../../../types/CustomerDetails"; +import { OfflinePaymentDetails } from "../../../../types/OfflinePaymentDetails"; + +export const CreatePaymentRequest: core.serialization.Schema< + serializers.CreatePaymentRequest.Raw, + Square.CreatePaymentRequest +> = core.serialization.object({ + sourceId: core.serialization.property("source_id", core.serialization.string()), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + amountMoney: core.serialization.property("amount_money", Money.optional()), + tipMoney: core.serialization.property("tip_money", Money.optional()), + appFeeMoney: core.serialization.property("app_fee_money", Money.optional()), + delayDuration: core.serialization.property("delay_duration", core.serialization.string().optional()), + delayAction: core.serialization.property("delay_action", core.serialization.string().optional()), + autocomplete: core.serialization.boolean().optional(), + orderId: core.serialization.property("order_id", core.serialization.string().optional()), + customerId: core.serialization.property("customer_id", core.serialization.string().optional()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optional()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optional()), + verificationToken: core.serialization.property("verification_token", core.serialization.string().optional()), + acceptPartialAuthorization: core.serialization.property( + "accept_partial_authorization", + core.serialization.boolean().optional(), + ), + buyerEmailAddress: core.serialization.property("buyer_email_address", core.serialization.string().optional()), + buyerPhoneNumber: core.serialization.property("buyer_phone_number", core.serialization.string().optional()), + billingAddress: core.serialization.property("billing_address", Address.optional()), + shippingAddress: core.serialization.property("shipping_address", Address.optional()), + note: core.serialization.string().optional(), + statementDescriptionIdentifier: core.serialization.property( + "statement_description_identifier", + core.serialization.string().optional(), + ), + cashDetails: core.serialization.property("cash_details", CashPaymentDetails.optional()), + externalDetails: core.serialization.property("external_details", ExternalPaymentDetails.optional()), + customerDetails: core.serialization.property("customer_details", CustomerDetails.optional()), + offlinePaymentDetails: core.serialization.property("offline_payment_details", OfflinePaymentDetails.optional()), +}); + +export declare namespace CreatePaymentRequest { + export interface Raw { + source_id: string; + idempotency_key: string; + amount_money?: Money.Raw | null; + tip_money?: Money.Raw | null; + app_fee_money?: Money.Raw | null; + delay_duration?: string | null; + delay_action?: string | null; + autocomplete?: boolean | null; + order_id?: string | null; + customer_id?: string | null; + location_id?: string | null; + team_member_id?: string | null; + reference_id?: string | null; + verification_token?: string | null; + accept_partial_authorization?: boolean | null; + buyer_email_address?: string | null; + buyer_phone_number?: string | null; + billing_address?: Address.Raw | null; + shipping_address?: Address.Raw | null; + note?: string | null; + statement_description_identifier?: string | null; + cash_details?: CashPaymentDetails.Raw | null; + external_details?: ExternalPaymentDetails.Raw | null; + customer_details?: CustomerDetails.Raw | null; + offline_payment_details?: OfflinePaymentDetails.Raw | null; + } +} diff --git a/src/serialization/resources/payments/client/requests/UpdatePaymentRequest.ts b/src/serialization/resources/payments/client/requests/UpdatePaymentRequest.ts new file mode 100644 index 000000000..12d129e2f --- /dev/null +++ b/src/serialization/resources/payments/client/requests/UpdatePaymentRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Payment } from "../../../../types/Payment"; + +export const UpdatePaymentRequest: core.serialization.Schema< + serializers.UpdatePaymentRequest.Raw, + Omit +> = core.serialization.object({ + payment: Payment.optional(), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), +}); + +export declare namespace UpdatePaymentRequest { + export interface Raw { + payment?: Payment.Raw | null; + idempotency_key: string; + } +} diff --git a/src/serialization/resources/payments/client/requests/index.ts b/src/serialization/resources/payments/client/requests/index.ts new file mode 100644 index 000000000..4332ec649 --- /dev/null +++ b/src/serialization/resources/payments/client/requests/index.ts @@ -0,0 +1,4 @@ +export { CreatePaymentRequest } from "./CreatePaymentRequest"; +export { CancelPaymentByIdempotencyKeyRequest } from "./CancelPaymentByIdempotencyKeyRequest"; +export { UpdatePaymentRequest } from "./UpdatePaymentRequest"; +export { CompletePaymentRequest } from "./CompletePaymentRequest"; diff --git a/src/serialization/resources/payments/index.ts b/src/serialization/resources/payments/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/payments/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/refunds/client/index.ts b/src/serialization/resources/refunds/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/refunds/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/refunds/client/requests/RefundPaymentRequest.ts b/src/serialization/resources/refunds/client/requests/RefundPaymentRequest.ts new file mode 100644 index 000000000..7f36428a0 --- /dev/null +++ b/src/serialization/resources/refunds/client/requests/RefundPaymentRequest.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Money } from "../../../../types/Money"; +import { DestinationDetailsCashRefundDetails } from "../../../../types/DestinationDetailsCashRefundDetails"; +import { DestinationDetailsExternalRefundDetails } from "../../../../types/DestinationDetailsExternalRefundDetails"; + +export const RefundPaymentRequest: core.serialization.Schema< + serializers.RefundPaymentRequest.Raw, + Square.RefundPaymentRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + amountMoney: core.serialization.property("amount_money", Money), + appFeeMoney: core.serialization.property("app_fee_money", Money.optional()), + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + destinationId: core.serialization.property("destination_id", core.serialization.string().optionalNullable()), + unlinked: core.serialization.boolean().optionalNullable(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + reason: core.serialization.string().optionalNullable(), + paymentVersionToken: core.serialization.property( + "payment_version_token", + core.serialization.string().optionalNullable(), + ), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), + cashDetails: core.serialization.property("cash_details", DestinationDetailsCashRefundDetails.optional()), + externalDetails: core.serialization.property( + "external_details", + DestinationDetailsExternalRefundDetails.optional(), + ), +}); + +export declare namespace RefundPaymentRequest { + export interface Raw { + idempotency_key: string; + amount_money: Money.Raw; + app_fee_money?: Money.Raw | null; + payment_id?: (string | null) | null; + destination_id?: (string | null) | null; + unlinked?: (boolean | null) | null; + location_id?: (string | null) | null; + customer_id?: (string | null) | null; + reason?: (string | null) | null; + payment_version_token?: (string | null) | null; + team_member_id?: (string | null) | null; + cash_details?: DestinationDetailsCashRefundDetails.Raw | null; + external_details?: DestinationDetailsExternalRefundDetails.Raw | null; + } +} diff --git a/src/serialization/resources/refunds/client/requests/index.ts b/src/serialization/resources/refunds/client/requests/index.ts new file mode 100644 index 000000000..772a6ab0a --- /dev/null +++ b/src/serialization/resources/refunds/client/requests/index.ts @@ -0,0 +1 @@ +export { RefundPaymentRequest } from "./RefundPaymentRequest"; diff --git a/src/serialization/resources/refunds/index.ts b/src/serialization/resources/refunds/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/refunds/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/snippets/client/index.ts b/src/serialization/resources/snippets/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/snippets/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/snippets/client/requests/UpsertSnippetRequest.ts b/src/serialization/resources/snippets/client/requests/UpsertSnippetRequest.ts new file mode 100644 index 000000000..4e637b87f --- /dev/null +++ b/src/serialization/resources/snippets/client/requests/UpsertSnippetRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Snippet } from "../../../../types/Snippet"; + +export const UpsertSnippetRequest: core.serialization.Schema< + serializers.UpsertSnippetRequest.Raw, + Omit +> = core.serialization.object({ + snippet: Snippet, +}); + +export declare namespace UpsertSnippetRequest { + export interface Raw { + snippet: Snippet.Raw; + } +} diff --git a/src/serialization/resources/snippets/client/requests/index.ts b/src/serialization/resources/snippets/client/requests/index.ts new file mode 100644 index 000000000..3eddae789 --- /dev/null +++ b/src/serialization/resources/snippets/client/requests/index.ts @@ -0,0 +1 @@ +export { UpsertSnippetRequest } from "./UpsertSnippetRequest"; diff --git a/src/serialization/resources/snippets/index.ts b/src/serialization/resources/snippets/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/snippets/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/subscriptions/client/index.ts b/src/serialization/resources/subscriptions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/subscriptions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts b/src/serialization/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts new file mode 100644 index 000000000..aa87601d5 --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/BulkSwapPlanRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BulkSwapPlanRequest: core.serialization.Schema< + serializers.BulkSwapPlanRequest.Raw, + Square.BulkSwapPlanRequest +> = core.serialization.object({ + newPlanVariationId: core.serialization.property("new_plan_variation_id", core.serialization.string()), + oldPlanVariationId: core.serialization.property("old_plan_variation_id", core.serialization.string()), + locationId: core.serialization.property("location_id", core.serialization.string()), +}); + +export declare namespace BulkSwapPlanRequest { + export interface Raw { + new_plan_variation_id: string; + old_plan_variation_id: string; + location_id: string; + } +} diff --git a/src/serialization/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts b/src/serialization/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts new file mode 100644 index 000000000..53291970d --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/ChangeBillingAnchorDateRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const ChangeBillingAnchorDateRequest: core.serialization.Schema< + serializers.ChangeBillingAnchorDateRequest.Raw, + Omit +> = core.serialization.object({ + monthlyBillingAnchorDate: core.serialization.property( + "monthly_billing_anchor_date", + core.serialization.number().optionalNullable(), + ), + effectiveDate: core.serialization.property("effective_date", core.serialization.string().optionalNullable()), +}); + +export declare namespace ChangeBillingAnchorDateRequest { + export interface Raw { + monthly_billing_anchor_date?: (number | null) | null; + effective_date?: (string | null) | null; + } +} diff --git a/src/serialization/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts b/src/serialization/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts new file mode 100644 index 000000000..f622c8ea4 --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/CreateSubscriptionRequest.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Money } from "../../../../types/Money"; +import { SubscriptionSource } from "../../../../types/SubscriptionSource"; +import { Phase } from "../../../../types/Phase"; + +export const CreateSubscriptionRequest: core.serialization.Schema< + serializers.CreateSubscriptionRequest.Raw, + Square.CreateSubscriptionRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + locationId: core.serialization.property("location_id", core.serialization.string()), + planVariationId: core.serialization.property("plan_variation_id", core.serialization.string().optional()), + customerId: core.serialization.property("customer_id", core.serialization.string()), + startDate: core.serialization.property("start_date", core.serialization.string().optional()), + canceledDate: core.serialization.property("canceled_date", core.serialization.string().optional()), + taxPercentage: core.serialization.property("tax_percentage", core.serialization.string().optional()), + priceOverrideMoney: core.serialization.property("price_override_money", Money.optional()), + cardId: core.serialization.property("card_id", core.serialization.string().optional()), + timezone: core.serialization.string().optional(), + source: SubscriptionSource.optional(), + monthlyBillingAnchorDate: core.serialization.property( + "monthly_billing_anchor_date", + core.serialization.number().optional(), + ), + phases: core.serialization.list(Phase).optional(), +}); + +export declare namespace CreateSubscriptionRequest { + export interface Raw { + idempotency_key?: string | null; + location_id: string; + plan_variation_id?: string | null; + customer_id: string; + start_date?: string | null; + canceled_date?: string | null; + tax_percentage?: string | null; + price_override_money?: Money.Raw | null; + card_id?: string | null; + timezone?: string | null; + source?: SubscriptionSource.Raw | null; + monthly_billing_anchor_date?: number | null; + phases?: Phase.Raw[] | null; + } +} diff --git a/src/serialization/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts b/src/serialization/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts new file mode 100644 index 000000000..384d35024 --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/PauseSubscriptionRequest.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { ChangeTiming } from "../../../../types/ChangeTiming"; + +export const PauseSubscriptionRequest: core.serialization.Schema< + serializers.PauseSubscriptionRequest.Raw, + Omit +> = core.serialization.object({ + pauseEffectiveDate: core.serialization.property( + "pause_effective_date", + core.serialization.string().optionalNullable(), + ), + pauseCycleDuration: core.serialization.property( + "pause_cycle_duration", + core.serialization.bigint().optionalNullable(), + ), + resumeEffectiveDate: core.serialization.property( + "resume_effective_date", + core.serialization.string().optionalNullable(), + ), + resumeChangeTiming: core.serialization.property("resume_change_timing", ChangeTiming.optional()), + pauseReason: core.serialization.property("pause_reason", core.serialization.string().optionalNullable()), +}); + +export declare namespace PauseSubscriptionRequest { + export interface Raw { + pause_effective_date?: (string | null) | null; + pause_cycle_duration?: ((bigint | number) | null) | null; + resume_effective_date?: (string | null) | null; + resume_change_timing?: ChangeTiming.Raw | null; + pause_reason?: (string | null) | null; + } +} diff --git a/src/serialization/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts b/src/serialization/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts new file mode 100644 index 000000000..47f788ac0 --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/ResumeSubscriptionRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { ChangeTiming } from "../../../../types/ChangeTiming"; + +export const ResumeSubscriptionRequest: core.serialization.Schema< + serializers.ResumeSubscriptionRequest.Raw, + Omit +> = core.serialization.object({ + resumeEffectiveDate: core.serialization.property( + "resume_effective_date", + core.serialization.string().optionalNullable(), + ), + resumeChangeTiming: core.serialization.property("resume_change_timing", ChangeTiming.optional()), +}); + +export declare namespace ResumeSubscriptionRequest { + export interface Raw { + resume_effective_date?: (string | null) | null; + resume_change_timing?: ChangeTiming.Raw | null; + } +} diff --git a/src/serialization/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts b/src/serialization/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts new file mode 100644 index 000000000..6bc67aa04 --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/SearchSubscriptionsRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { SearchSubscriptionsQuery } from "../../../../types/SearchSubscriptionsQuery"; + +export const SearchSubscriptionsRequest: core.serialization.Schema< + serializers.SearchSubscriptionsRequest.Raw, + Square.SearchSubscriptionsRequest +> = core.serialization.object({ + cursor: core.serialization.string().optional(), + limit: core.serialization.number().optional(), + query: SearchSubscriptionsQuery.optional(), + include: core.serialization.list(core.serialization.string()).optional(), +}); + +export declare namespace SearchSubscriptionsRequest { + export interface Raw { + cursor?: string | null; + limit?: number | null; + query?: SearchSubscriptionsQuery.Raw | null; + include?: string[] | null; + } +} diff --git a/src/serialization/resources/subscriptions/client/requests/SwapPlanRequest.ts b/src/serialization/resources/subscriptions/client/requests/SwapPlanRequest.ts new file mode 100644 index 000000000..20b4035e0 --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/SwapPlanRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { PhaseInput } from "../../../../types/PhaseInput"; + +export const SwapPlanRequest: core.serialization.Schema< + serializers.SwapPlanRequest.Raw, + Omit +> = core.serialization.object({ + newPlanVariationId: core.serialization.property( + "new_plan_variation_id", + core.serialization.string().optionalNullable(), + ), + phases: core.serialization.list(PhaseInput).optionalNullable(), +}); + +export declare namespace SwapPlanRequest { + export interface Raw { + new_plan_variation_id?: (string | null) | null; + phases?: (PhaseInput.Raw[] | null) | null; + } +} diff --git a/src/serialization/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts b/src/serialization/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts new file mode 100644 index 000000000..ec6826f50 --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/UpdateSubscriptionRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Subscription } from "../../../../types/Subscription"; + +export const UpdateSubscriptionRequest: core.serialization.Schema< + serializers.UpdateSubscriptionRequest.Raw, + Omit +> = core.serialization.object({ + subscription: Subscription.optional(), +}); + +export declare namespace UpdateSubscriptionRequest { + export interface Raw { + subscription?: Subscription.Raw | null; + } +} diff --git a/src/serialization/resources/subscriptions/client/requests/index.ts b/src/serialization/resources/subscriptions/client/requests/index.ts new file mode 100644 index 000000000..b48070509 --- /dev/null +++ b/src/serialization/resources/subscriptions/client/requests/index.ts @@ -0,0 +1,8 @@ +export { CreateSubscriptionRequest } from "./CreateSubscriptionRequest"; +export { BulkSwapPlanRequest } from "./BulkSwapPlanRequest"; +export { SearchSubscriptionsRequest } from "./SearchSubscriptionsRequest"; +export { UpdateSubscriptionRequest } from "./UpdateSubscriptionRequest"; +export { ChangeBillingAnchorDateRequest } from "./ChangeBillingAnchorDateRequest"; +export { PauseSubscriptionRequest } from "./PauseSubscriptionRequest"; +export { ResumeSubscriptionRequest } from "./ResumeSubscriptionRequest"; +export { SwapPlanRequest } from "./SwapPlanRequest"; diff --git a/src/serialization/resources/subscriptions/index.ts b/src/serialization/resources/subscriptions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/subscriptions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/team/client/index.ts b/src/serialization/resources/team/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/team/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/team/client/requests/CreateJobRequest.ts b/src/serialization/resources/team/client/requests/CreateJobRequest.ts new file mode 100644 index 000000000..7ab21c8a9 --- /dev/null +++ b/src/serialization/resources/team/client/requests/CreateJobRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Job } from "../../../../types/Job"; + +export const CreateJobRequest: core.serialization.Schema = + core.serialization.object({ + job: Job, + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + }); + +export declare namespace CreateJobRequest { + export interface Raw { + job: Job.Raw; + idempotency_key: string; + } +} diff --git a/src/serialization/resources/team/client/requests/UpdateJobRequest.ts b/src/serialization/resources/team/client/requests/UpdateJobRequest.ts new file mode 100644 index 000000000..a4b0ff74a --- /dev/null +++ b/src/serialization/resources/team/client/requests/UpdateJobRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Job } from "../../../../types/Job"; + +export const UpdateJobRequest: core.serialization.Schema< + serializers.UpdateJobRequest.Raw, + Omit +> = core.serialization.object({ + job: Job, +}); + +export declare namespace UpdateJobRequest { + export interface Raw { + job: Job.Raw; + } +} diff --git a/src/serialization/resources/team/client/requests/index.ts b/src/serialization/resources/team/client/requests/index.ts new file mode 100644 index 000000000..4324977f5 --- /dev/null +++ b/src/serialization/resources/team/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateJobRequest } from "./CreateJobRequest"; +export { UpdateJobRequest } from "./UpdateJobRequest"; diff --git a/src/serialization/resources/team/index.ts b/src/serialization/resources/team/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/team/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/teamMembers/client/index.ts b/src/serialization/resources/teamMembers/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/teamMembers/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts b/src/serialization/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts new file mode 100644 index 000000000..2484c48dd --- /dev/null +++ b/src/serialization/resources/teamMembers/client/requests/BatchCreateTeamMembersRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { CreateTeamMemberRequest } from "../../../../types/CreateTeamMemberRequest"; + +export const BatchCreateTeamMembersRequest: core.serialization.Schema< + serializers.BatchCreateTeamMembersRequest.Raw, + Square.BatchCreateTeamMembersRequest +> = core.serialization.object({ + teamMembers: core.serialization.property( + "team_members", + core.serialization.record(core.serialization.string(), CreateTeamMemberRequest), + ), +}); + +export declare namespace BatchCreateTeamMembersRequest { + export interface Raw { + team_members: Record; + } +} diff --git a/src/serialization/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts b/src/serialization/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts new file mode 100644 index 000000000..69b652a7c --- /dev/null +++ b/src/serialization/resources/teamMembers/client/requests/BatchUpdateTeamMembersRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { UpdateTeamMemberRequest } from "../../../../types/UpdateTeamMemberRequest"; + +export const BatchUpdateTeamMembersRequest: core.serialization.Schema< + serializers.BatchUpdateTeamMembersRequest.Raw, + Square.BatchUpdateTeamMembersRequest +> = core.serialization.object({ + teamMembers: core.serialization.property( + "team_members", + core.serialization.record(core.serialization.string(), UpdateTeamMemberRequest), + ), +}); + +export declare namespace BatchUpdateTeamMembersRequest { + export interface Raw { + team_members: Record; + } +} diff --git a/src/serialization/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts b/src/serialization/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts new file mode 100644 index 000000000..46826c908 --- /dev/null +++ b/src/serialization/resources/teamMembers/client/requests/SearchTeamMembersRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { SearchTeamMembersQuery } from "../../../../types/SearchTeamMembersQuery"; + +export const SearchTeamMembersRequest: core.serialization.Schema< + serializers.SearchTeamMembersRequest.Raw, + Square.SearchTeamMembersRequest +> = core.serialization.object({ + query: SearchTeamMembersQuery.optional(), + limit: core.serialization.number().optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchTeamMembersRequest { + export interface Raw { + query?: SearchTeamMembersQuery.Raw | null; + limit?: number | null; + cursor?: string | null; + } +} diff --git a/src/serialization/resources/teamMembers/client/requests/index.ts b/src/serialization/resources/teamMembers/client/requests/index.ts new file mode 100644 index 000000000..041bfcfee --- /dev/null +++ b/src/serialization/resources/teamMembers/client/requests/index.ts @@ -0,0 +1,3 @@ +export { BatchCreateTeamMembersRequest } from "./BatchCreateTeamMembersRequest"; +export { BatchUpdateTeamMembersRequest } from "./BatchUpdateTeamMembersRequest"; +export { SearchTeamMembersRequest } from "./SearchTeamMembersRequest"; diff --git a/src/serialization/resources/teamMembers/index.ts b/src/serialization/resources/teamMembers/index.ts new file mode 100644 index 000000000..33a87f100 --- /dev/null +++ b/src/serialization/resources/teamMembers/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./resources"; diff --git a/src/serialization/resources/teamMembers/resources/index.ts b/src/serialization/resources/teamMembers/resources/index.ts new file mode 100644 index 000000000..921a5bbe9 --- /dev/null +++ b/src/serialization/resources/teamMembers/resources/index.ts @@ -0,0 +1,2 @@ +export * as wageSetting from "./wageSetting"; +export * from "./wageSetting/client/requests"; diff --git a/src/serialization/resources/teamMembers/resources/wageSetting/client/index.ts b/src/serialization/resources/teamMembers/resources/wageSetting/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/teamMembers/resources/wageSetting/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts b/src/serialization/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts new file mode 100644 index 000000000..e09c0ea2b --- /dev/null +++ b/src/serialization/resources/teamMembers/resources/wageSetting/client/requests/UpdateWageSettingRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { WageSetting } from "../../../../../../types/WageSetting"; + +export const UpdateWageSettingRequest: core.serialization.Schema< + serializers.teamMembers.UpdateWageSettingRequest.Raw, + Omit +> = core.serialization.object({ + wageSetting: core.serialization.property("wage_setting", WageSetting), +}); + +export declare namespace UpdateWageSettingRequest { + export interface Raw { + wage_setting: WageSetting.Raw; + } +} diff --git a/src/serialization/resources/teamMembers/resources/wageSetting/client/requests/index.ts b/src/serialization/resources/teamMembers/resources/wageSetting/client/requests/index.ts new file mode 100644 index 000000000..354c3b260 --- /dev/null +++ b/src/serialization/resources/teamMembers/resources/wageSetting/client/requests/index.ts @@ -0,0 +1 @@ +export { UpdateWageSettingRequest } from "./UpdateWageSettingRequest"; diff --git a/src/serialization/resources/teamMembers/resources/wageSetting/index.ts b/src/serialization/resources/teamMembers/resources/wageSetting/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/teamMembers/resources/wageSetting/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/terminal/index.ts b/src/serialization/resources/terminal/index.ts new file mode 100644 index 000000000..3e5335fe4 --- /dev/null +++ b/src/serialization/resources/terminal/index.ts @@ -0,0 +1 @@ +export * from "./resources"; diff --git a/src/serialization/resources/terminal/resources/actions/client/index.ts b/src/serialization/resources/terminal/resources/actions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/terminal/resources/actions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts b/src/serialization/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts new file mode 100644 index 000000000..1dbf1be21 --- /dev/null +++ b/src/serialization/resources/terminal/resources/actions/client/requests/CreateTerminalActionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { TerminalAction } from "../../../../../../types/TerminalAction"; + +export const CreateTerminalActionRequest: core.serialization.Schema< + serializers.terminal.CreateTerminalActionRequest.Raw, + Square.terminal.CreateTerminalActionRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + action: TerminalAction, +}); + +export declare namespace CreateTerminalActionRequest { + export interface Raw { + idempotency_key: string; + action: TerminalAction.Raw; + } +} diff --git a/src/serialization/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts b/src/serialization/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts new file mode 100644 index 000000000..0c5fc148c --- /dev/null +++ b/src/serialization/resources/terminal/resources/actions/client/requests/SearchTerminalActionsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { TerminalActionQuery } from "../../../../../../types/TerminalActionQuery"; + +export const SearchTerminalActionsRequest: core.serialization.Schema< + serializers.terminal.SearchTerminalActionsRequest.Raw, + Square.terminal.SearchTerminalActionsRequest +> = core.serialization.object({ + query: TerminalActionQuery.optional(), + cursor: core.serialization.string().optional(), + limit: core.serialization.number().optional(), +}); + +export declare namespace SearchTerminalActionsRequest { + export interface Raw { + query?: TerminalActionQuery.Raw | null; + cursor?: string | null; + limit?: number | null; + } +} diff --git a/src/serialization/resources/terminal/resources/actions/client/requests/index.ts b/src/serialization/resources/terminal/resources/actions/client/requests/index.ts new file mode 100644 index 000000000..f1d809969 --- /dev/null +++ b/src/serialization/resources/terminal/resources/actions/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateTerminalActionRequest } from "./CreateTerminalActionRequest"; +export { SearchTerminalActionsRequest } from "./SearchTerminalActionsRequest"; diff --git a/src/serialization/resources/terminal/resources/actions/index.ts b/src/serialization/resources/terminal/resources/actions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/terminal/resources/actions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/terminal/resources/checkouts/client/index.ts b/src/serialization/resources/terminal/resources/checkouts/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/terminal/resources/checkouts/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts b/src/serialization/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts new file mode 100644 index 000000000..467299dbc --- /dev/null +++ b/src/serialization/resources/terminal/resources/checkouts/client/requests/CreateTerminalCheckoutRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { TerminalCheckout } from "../../../../../../types/TerminalCheckout"; + +export const CreateTerminalCheckoutRequest: core.serialization.Schema< + serializers.terminal.CreateTerminalCheckoutRequest.Raw, + Square.terminal.CreateTerminalCheckoutRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + checkout: TerminalCheckout, +}); + +export declare namespace CreateTerminalCheckoutRequest { + export interface Raw { + idempotency_key: string; + checkout: TerminalCheckout.Raw; + } +} diff --git a/src/serialization/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts b/src/serialization/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts new file mode 100644 index 000000000..0ba1d4581 --- /dev/null +++ b/src/serialization/resources/terminal/resources/checkouts/client/requests/SearchTerminalCheckoutsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { TerminalCheckoutQuery } from "../../../../../../types/TerminalCheckoutQuery"; + +export const SearchTerminalCheckoutsRequest: core.serialization.Schema< + serializers.terminal.SearchTerminalCheckoutsRequest.Raw, + Square.terminal.SearchTerminalCheckoutsRequest +> = core.serialization.object({ + query: TerminalCheckoutQuery.optional(), + cursor: core.serialization.string().optional(), + limit: core.serialization.number().optional(), +}); + +export declare namespace SearchTerminalCheckoutsRequest { + export interface Raw { + query?: TerminalCheckoutQuery.Raw | null; + cursor?: string | null; + limit?: number | null; + } +} diff --git a/src/serialization/resources/terminal/resources/checkouts/client/requests/index.ts b/src/serialization/resources/terminal/resources/checkouts/client/requests/index.ts new file mode 100644 index 000000000..74d954969 --- /dev/null +++ b/src/serialization/resources/terminal/resources/checkouts/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateTerminalCheckoutRequest } from "./CreateTerminalCheckoutRequest"; +export { SearchTerminalCheckoutsRequest } from "./SearchTerminalCheckoutsRequest"; diff --git a/src/serialization/resources/terminal/resources/checkouts/index.ts b/src/serialization/resources/terminal/resources/checkouts/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/terminal/resources/checkouts/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/terminal/resources/index.ts b/src/serialization/resources/terminal/resources/index.ts new file mode 100644 index 000000000..0a902a361 --- /dev/null +++ b/src/serialization/resources/terminal/resources/index.ts @@ -0,0 +1,6 @@ +export * as actions from "./actions"; +export * from "./actions/client/requests"; +export * as checkouts from "./checkouts"; +export * from "./checkouts/client/requests"; +export * as refunds from "./refunds"; +export * from "./refunds/client/requests"; diff --git a/src/serialization/resources/terminal/resources/refunds/client/index.ts b/src/serialization/resources/terminal/resources/refunds/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/terminal/resources/refunds/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts b/src/serialization/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts new file mode 100644 index 000000000..a871e1058 --- /dev/null +++ b/src/serialization/resources/terminal/resources/refunds/client/requests/CreateTerminalRefundRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { TerminalRefund } from "../../../../../../types/TerminalRefund"; + +export const CreateTerminalRefundRequest: core.serialization.Schema< + serializers.terminal.CreateTerminalRefundRequest.Raw, + Square.terminal.CreateTerminalRefundRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + refund: TerminalRefund.optional(), +}); + +export declare namespace CreateTerminalRefundRequest { + export interface Raw { + idempotency_key: string; + refund?: TerminalRefund.Raw | null; + } +} diff --git a/src/serialization/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts b/src/serialization/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts new file mode 100644 index 000000000..c2d5fff3e --- /dev/null +++ b/src/serialization/resources/terminal/resources/refunds/client/requests/SearchTerminalRefundsRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { TerminalRefundQuery } from "../../../../../../types/TerminalRefundQuery"; + +export const SearchTerminalRefundsRequest: core.serialization.Schema< + serializers.terminal.SearchTerminalRefundsRequest.Raw, + Square.terminal.SearchTerminalRefundsRequest +> = core.serialization.object({ + query: TerminalRefundQuery.optional(), + cursor: core.serialization.string().optional(), + limit: core.serialization.number().optional(), +}); + +export declare namespace SearchTerminalRefundsRequest { + export interface Raw { + query?: TerminalRefundQuery.Raw | null; + cursor?: string | null; + limit?: number | null; + } +} diff --git a/src/serialization/resources/terminal/resources/refunds/client/requests/index.ts b/src/serialization/resources/terminal/resources/refunds/client/requests/index.ts new file mode 100644 index 000000000..8f47a8d64 --- /dev/null +++ b/src/serialization/resources/terminal/resources/refunds/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreateTerminalRefundRequest } from "./CreateTerminalRefundRequest"; +export { SearchTerminalRefundsRequest } from "./SearchTerminalRefundsRequest"; diff --git a/src/serialization/resources/terminal/resources/refunds/index.ts b/src/serialization/resources/terminal/resources/refunds/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/terminal/resources/refunds/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/v1Transactions/client/index.ts b/src/serialization/resources/v1Transactions/client/index.ts new file mode 100644 index 000000000..989c4b62f --- /dev/null +++ b/src/serialization/resources/v1Transactions/client/index.ts @@ -0,0 +1,2 @@ +export * as v1ListOrders from "./v1ListOrders"; +export * from "./requests"; diff --git a/src/serialization/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts b/src/serialization/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts new file mode 100644 index 000000000..bb759291f --- /dev/null +++ b/src/serialization/resources/v1Transactions/client/requests/V1UpdateOrderRequest.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { V1UpdateOrderRequestAction } from "../../../../types/V1UpdateOrderRequestAction"; + +export const V1UpdateOrderRequest: core.serialization.Schema< + serializers.V1UpdateOrderRequest.Raw, + Omit +> = core.serialization.object({ + action: V1UpdateOrderRequestAction, + shippedTrackingNumber: core.serialization.property( + "shipped_tracking_number", + core.serialization.string().optionalNullable(), + ), + completedNote: core.serialization.property("completed_note", core.serialization.string().optionalNullable()), + refundedNote: core.serialization.property("refunded_note", core.serialization.string().optionalNullable()), + canceledNote: core.serialization.property("canceled_note", core.serialization.string().optionalNullable()), +}); + +export declare namespace V1UpdateOrderRequest { + export interface Raw { + action: V1UpdateOrderRequestAction.Raw; + shipped_tracking_number?: (string | null) | null; + completed_note?: (string | null) | null; + refunded_note?: (string | null) | null; + canceled_note?: (string | null) | null; + } +} diff --git a/src/serialization/resources/v1Transactions/client/requests/index.ts b/src/serialization/resources/v1Transactions/client/requests/index.ts new file mode 100644 index 000000000..083f766e2 --- /dev/null +++ b/src/serialization/resources/v1Transactions/client/requests/index.ts @@ -0,0 +1 @@ +export { V1UpdateOrderRequest } from "./V1UpdateOrderRequest"; diff --git a/src/serialization/resources/v1Transactions/client/v1ListOrders.ts b/src/serialization/resources/v1Transactions/client/v1ListOrders.ts new file mode 100644 index 000000000..76b301b14 --- /dev/null +++ b/src/serialization/resources/v1Transactions/client/v1ListOrders.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as Square from "../../../../api/index"; +import * as core from "../../../../core"; +import { V1Order } from "../../../types/V1Order"; + +export const Response: core.serialization.Schema< + serializers.v1Transactions.v1ListOrders.Response.Raw, + Square.V1Order[] +> = core.serialization.list(V1Order); + +export declare namespace Response { + export type Raw = V1Order.Raw[]; +} diff --git a/src/serialization/resources/v1Transactions/index.ts b/src/serialization/resources/v1Transactions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/v1Transactions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/vendors/client/index.ts b/src/serialization/resources/vendors/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/vendors/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/vendors/client/requests/BatchCreateVendorsRequest.ts b/src/serialization/resources/vendors/client/requests/BatchCreateVendorsRequest.ts new file mode 100644 index 000000000..35197e5df --- /dev/null +++ b/src/serialization/resources/vendors/client/requests/BatchCreateVendorsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Vendor } from "../../../../types/Vendor"; + +export const BatchCreateVendorsRequest: core.serialization.Schema< + serializers.BatchCreateVendorsRequest.Raw, + Square.BatchCreateVendorsRequest +> = core.serialization.object({ + vendors: core.serialization.record(core.serialization.string(), Vendor), +}); + +export declare namespace BatchCreateVendorsRequest { + export interface Raw { + vendors: Record; + } +} diff --git a/src/serialization/resources/vendors/client/requests/BatchGetVendorsRequest.ts b/src/serialization/resources/vendors/client/requests/BatchGetVendorsRequest.ts new file mode 100644 index 000000000..fc7005729 --- /dev/null +++ b/src/serialization/resources/vendors/client/requests/BatchGetVendorsRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; + +export const BatchGetVendorsRequest: core.serialization.Schema< + serializers.BatchGetVendorsRequest.Raw, + Square.BatchGetVendorsRequest +> = core.serialization.object({ + vendorIds: core.serialization.property( + "vendor_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace BatchGetVendorsRequest { + export interface Raw { + vendor_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts b/src/serialization/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts new file mode 100644 index 000000000..d9cdd6c78 --- /dev/null +++ b/src/serialization/resources/vendors/client/requests/BatchUpdateVendorsRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { UpdateVendorRequest } from "../../../../types/UpdateVendorRequest"; + +export const BatchUpdateVendorsRequest: core.serialization.Schema< + serializers.BatchUpdateVendorsRequest.Raw, + Square.BatchUpdateVendorsRequest +> = core.serialization.object({ + vendors: core.serialization.record(core.serialization.string(), UpdateVendorRequest), +}); + +export declare namespace BatchUpdateVendorsRequest { + export interface Raw { + vendors: Record; + } +} diff --git a/src/serialization/resources/vendors/client/requests/CreateVendorRequest.ts b/src/serialization/resources/vendors/client/requests/CreateVendorRequest.ts new file mode 100644 index 000000000..64c531673 --- /dev/null +++ b/src/serialization/resources/vendors/client/requests/CreateVendorRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { Vendor } from "../../../../types/Vendor"; + +export const CreateVendorRequest: core.serialization.Schema< + serializers.CreateVendorRequest.Raw, + Square.CreateVendorRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + vendor: Vendor.optional(), +}); + +export declare namespace CreateVendorRequest { + export interface Raw { + idempotency_key: string; + vendor?: Vendor.Raw | null; + } +} diff --git a/src/serialization/resources/vendors/client/requests/SearchVendorsRequest.ts b/src/serialization/resources/vendors/client/requests/SearchVendorsRequest.ts new file mode 100644 index 000000000..1a22317b8 --- /dev/null +++ b/src/serialization/resources/vendors/client/requests/SearchVendorsRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../index"; +import * as Square from "../../../../../api/index"; +import * as core from "../../../../../core"; +import { SearchVendorsRequestFilter } from "../../../../types/SearchVendorsRequestFilter"; +import { SearchVendorsRequestSort } from "../../../../types/SearchVendorsRequestSort"; + +export const SearchVendorsRequest: core.serialization.Schema< + serializers.SearchVendorsRequest.Raw, + Square.SearchVendorsRequest +> = core.serialization.object({ + filter: SearchVendorsRequestFilter.optional(), + sort: SearchVendorsRequestSort.optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchVendorsRequest { + export interface Raw { + filter?: SearchVendorsRequestFilter.Raw | null; + sort?: SearchVendorsRequestSort.Raw | null; + cursor?: string | null; + } +} diff --git a/src/serialization/resources/vendors/client/requests/index.ts b/src/serialization/resources/vendors/client/requests/index.ts new file mode 100644 index 000000000..5a9b83969 --- /dev/null +++ b/src/serialization/resources/vendors/client/requests/index.ts @@ -0,0 +1,5 @@ +export { BatchCreateVendorsRequest } from "./BatchCreateVendorsRequest"; +export { BatchGetVendorsRequest } from "./BatchGetVendorsRequest"; +export { BatchUpdateVendorsRequest } from "./BatchUpdateVendorsRequest"; +export { CreateVendorRequest } from "./CreateVendorRequest"; +export { SearchVendorsRequest } from "./SearchVendorsRequest"; diff --git a/src/serialization/resources/vendors/index.ts b/src/serialization/resources/vendors/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/vendors/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/resources/webhooks/index.ts b/src/serialization/resources/webhooks/index.ts new file mode 100644 index 000000000..3e5335fe4 --- /dev/null +++ b/src/serialization/resources/webhooks/index.ts @@ -0,0 +1 @@ +export * from "./resources"; diff --git a/src/serialization/resources/webhooks/resources/index.ts b/src/serialization/resources/webhooks/resources/index.ts new file mode 100644 index 000000000..491a8c689 --- /dev/null +++ b/src/serialization/resources/webhooks/resources/index.ts @@ -0,0 +1,2 @@ +export * as subscriptions from "./subscriptions"; +export * from "./subscriptions/client/requests"; diff --git a/src/serialization/resources/webhooks/resources/subscriptions/client/index.ts b/src/serialization/resources/webhooks/resources/subscriptions/client/index.ts new file mode 100644 index 000000000..415726b7f --- /dev/null +++ b/src/serialization/resources/webhooks/resources/subscriptions/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts new file mode 100644 index 000000000..67ed058de --- /dev/null +++ b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/CreateWebhookSubscriptionRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { WebhookSubscription } from "../../../../../../types/WebhookSubscription"; + +export const CreateWebhookSubscriptionRequest: core.serialization.Schema< + serializers.webhooks.CreateWebhookSubscriptionRequest.Raw, + Square.webhooks.CreateWebhookSubscriptionRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + subscription: WebhookSubscription, +}); + +export declare namespace CreateWebhookSubscriptionRequest { + export interface Raw { + idempotency_key?: string | null; + subscription: WebhookSubscription.Raw; + } +} diff --git a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts new file mode 100644 index 000000000..97000bd74 --- /dev/null +++ b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/TestWebhookSubscriptionRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; + +export const TestWebhookSubscriptionRequest: core.serialization.Schema< + serializers.webhooks.TestWebhookSubscriptionRequest.Raw, + Omit +> = core.serialization.object({ + eventType: core.serialization.property("event_type", core.serialization.string().optionalNullable()), +}); + +export declare namespace TestWebhookSubscriptionRequest { + export interface Raw { + event_type?: (string | null) | null; + } +} diff --git a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts new file mode 100644 index 000000000..495a62319 --- /dev/null +++ b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; +import { WebhookSubscription } from "../../../../../../types/WebhookSubscription"; + +export const UpdateWebhookSubscriptionRequest: core.serialization.Schema< + serializers.webhooks.UpdateWebhookSubscriptionRequest.Raw, + Omit +> = core.serialization.object({ + subscription: WebhookSubscription.optional(), +}); + +export declare namespace UpdateWebhookSubscriptionRequest { + export interface Raw { + subscription?: WebhookSubscription.Raw | null; + } +} diff --git a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts new file mode 100644 index 000000000..b03a6f88b --- /dev/null +++ b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/UpdateWebhookSubscriptionSignatureKeyRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../../../../index"; +import * as Square from "../../../../../../../api/index"; +import * as core from "../../../../../../../core"; + +export const UpdateWebhookSubscriptionSignatureKeyRequest: core.serialization.Schema< + serializers.webhooks.UpdateWebhookSubscriptionSignatureKeyRequest.Raw, + Omit +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace UpdateWebhookSubscriptionSignatureKeyRequest { + export interface Raw { + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/resources/webhooks/resources/subscriptions/client/requests/index.ts b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/index.ts new file mode 100644 index 000000000..849f59f16 --- /dev/null +++ b/src/serialization/resources/webhooks/resources/subscriptions/client/requests/index.ts @@ -0,0 +1,4 @@ +export { CreateWebhookSubscriptionRequest } from "./CreateWebhookSubscriptionRequest"; +export { UpdateWebhookSubscriptionRequest } from "./UpdateWebhookSubscriptionRequest"; +export { UpdateWebhookSubscriptionSignatureKeyRequest } from "./UpdateWebhookSubscriptionSignatureKeyRequest"; +export { TestWebhookSubscriptionRequest } from "./TestWebhookSubscriptionRequest"; diff --git a/src/serialization/resources/webhooks/resources/subscriptions/index.ts b/src/serialization/resources/webhooks/resources/subscriptions/index.ts new file mode 100644 index 000000000..5ec76921e --- /dev/null +++ b/src/serialization/resources/webhooks/resources/subscriptions/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/serialization/types/AcceptDisputeResponse.ts b/src/serialization/types/AcceptDisputeResponse.ts new file mode 100644 index 000000000..2806b9f11 --- /dev/null +++ b/src/serialization/types/AcceptDisputeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Dispute } from "./Dispute"; + +export const AcceptDisputeResponse: core.serialization.ObjectSchema< + serializers.AcceptDisputeResponse.Raw, + Square.AcceptDisputeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + dispute: Dispute.optional(), +}); + +export declare namespace AcceptDisputeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + dispute?: Dispute.Raw | null; + } +} diff --git a/src/serialization/types/AcceptedPaymentMethods.ts b/src/serialization/types/AcceptedPaymentMethods.ts new file mode 100644 index 000000000..1281bce45 --- /dev/null +++ b/src/serialization/types/AcceptedPaymentMethods.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const AcceptedPaymentMethods: core.serialization.ObjectSchema< + serializers.AcceptedPaymentMethods.Raw, + Square.AcceptedPaymentMethods +> = core.serialization.object({ + applePay: core.serialization.property("apple_pay", core.serialization.boolean().optionalNullable()), + googlePay: core.serialization.property("google_pay", core.serialization.boolean().optionalNullable()), + cashAppPay: core.serialization.property("cash_app_pay", core.serialization.boolean().optionalNullable()), + afterpayClearpay: core.serialization.property("afterpay_clearpay", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace AcceptedPaymentMethods { + export interface Raw { + apple_pay?: (boolean | null) | null; + google_pay?: (boolean | null) | null; + cash_app_pay?: (boolean | null) | null; + afterpay_clearpay?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/AccumulateLoyaltyPointsResponse.ts b/src/serialization/types/AccumulateLoyaltyPointsResponse.ts new file mode 100644 index 000000000..a0b7b9f5d --- /dev/null +++ b/src/serialization/types/AccumulateLoyaltyPointsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyEvent } from "./LoyaltyEvent"; + +export const AccumulateLoyaltyPointsResponse: core.serialization.ObjectSchema< + serializers.AccumulateLoyaltyPointsResponse.Raw, + Square.AccumulateLoyaltyPointsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + event: LoyaltyEvent.optional(), + events: core.serialization.list(LoyaltyEvent).optional(), +}); + +export declare namespace AccumulateLoyaltyPointsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + event?: LoyaltyEvent.Raw | null; + events?: LoyaltyEvent.Raw[] | null; + } +} diff --git a/src/serialization/types/AchDetails.ts b/src/serialization/types/AchDetails.ts new file mode 100644 index 000000000..b69297e11 --- /dev/null +++ b/src/serialization/types/AchDetails.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const AchDetails: core.serialization.ObjectSchema = + core.serialization.object({ + routingNumber: core.serialization.property("routing_number", core.serialization.string().optionalNullable()), + accountNumberSuffix: core.serialization.property( + "account_number_suffix", + core.serialization.string().optionalNullable(), + ), + accountType: core.serialization.property("account_type", core.serialization.string().optionalNullable()), + }); + +export declare namespace AchDetails { + export interface Raw { + routing_number?: (string | null) | null; + account_number_suffix?: (string | null) | null; + account_type?: (string | null) | null; + } +} diff --git a/src/serialization/types/ActionCancelReason.ts b/src/serialization/types/ActionCancelReason.ts new file mode 100644 index 000000000..c61108372 --- /dev/null +++ b/src/serialization/types/ActionCancelReason.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ActionCancelReason: core.serialization.Schema< + serializers.ActionCancelReason.Raw, + Square.ActionCancelReason +> = core.serialization.enum_(["BUYER_CANCELED", "SELLER_CANCELED", "TIMED_OUT"]); + +export declare namespace ActionCancelReason { + export type Raw = "BUYER_CANCELED" | "SELLER_CANCELED" | "TIMED_OUT"; +} diff --git a/src/serialization/types/ActivityType.ts b/src/serialization/types/ActivityType.ts new file mode 100644 index 000000000..325c27675 --- /dev/null +++ b/src/serialization/types/ActivityType.ts @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ActivityType: core.serialization.Schema = + core.serialization.enum_([ + "ADJUSTMENT", + "APP_FEE_REFUND", + "APP_FEE_REVENUE", + "AUTOMATIC_SAVINGS", + "AUTOMATIC_SAVINGS_REVERSED", + "CHARGE", + "DEPOSIT_FEE", + "DEPOSIT_FEE_REVERSED", + "DISPUTE", + "ESCHEATMENT", + "FEE", + "FREE_PROCESSING", + "HOLD_ADJUSTMENT", + "INITIAL_BALANCE_CHANGE", + "MONEY_TRANSFER", + "MONEY_TRANSFER_REVERSAL", + "OPEN_DISPUTE", + "OTHER", + "OTHER_ADJUSTMENT", + "PAID_SERVICE_FEE", + "PAID_SERVICE_FEE_REFUND", + "REDEMPTION_CODE", + "REFUND", + "RELEASE_ADJUSTMENT", + "RESERVE_HOLD", + "RESERVE_RELEASE", + "RETURNED_PAYOUT", + "SQUARE_CAPITAL_PAYMENT", + "SQUARE_CAPITAL_REVERSED_PAYMENT", + "SUBSCRIPTION_FEE", + "SUBSCRIPTION_FEE_PAID_REFUND", + "SUBSCRIPTION_FEE_REFUND", + "TAX_ON_FEE", + "THIRD_PARTY_FEE", + "THIRD_PARTY_FEE_REFUND", + "PAYOUT", + "AUTOMATIC_BITCOIN_CONVERSIONS", + "AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED", + "CREDIT_CARD_REPAYMENT", + "CREDIT_CARD_REPAYMENT_REVERSED", + "LOCAL_OFFERS_CASHBACK", + "LOCAL_OFFERS_FEE", + "PERCENTAGE_PROCESSING_ENROLLMENT", + "PERCENTAGE_PROCESSING_DEACTIVATION", + "PERCENTAGE_PROCESSING_REPAYMENT", + "PERCENTAGE_PROCESSING_REPAYMENT_REVERSED", + "PROCESSING_FEE", + "PROCESSING_FEE_REFUND", + "UNDO_PROCESSING_FEE_REFUND", + "GIFT_CARD_LOAD_FEE", + "GIFT_CARD_LOAD_FEE_REFUND", + "UNDO_GIFT_CARD_LOAD_FEE_REFUND", + "BALANCE_FOLDERS_TRANSFER", + "BALANCE_FOLDERS_TRANSFER_REVERSED", + "GIFT_CARD_POOL_TRANSFER", + "GIFT_CARD_POOL_TRANSFER_REVERSED", + "SQUARE_PAYROLL_TRANSFER", + "SQUARE_PAYROLL_TRANSFER_REVERSED", + ]); + +export declare namespace ActivityType { + export type Raw = + | "ADJUSTMENT" + | "APP_FEE_REFUND" + | "APP_FEE_REVENUE" + | "AUTOMATIC_SAVINGS" + | "AUTOMATIC_SAVINGS_REVERSED" + | "CHARGE" + | "DEPOSIT_FEE" + | "DEPOSIT_FEE_REVERSED" + | "DISPUTE" + | "ESCHEATMENT" + | "FEE" + | "FREE_PROCESSING" + | "HOLD_ADJUSTMENT" + | "INITIAL_BALANCE_CHANGE" + | "MONEY_TRANSFER" + | "MONEY_TRANSFER_REVERSAL" + | "OPEN_DISPUTE" + | "OTHER" + | "OTHER_ADJUSTMENT" + | "PAID_SERVICE_FEE" + | "PAID_SERVICE_FEE_REFUND" + | "REDEMPTION_CODE" + | "REFUND" + | "RELEASE_ADJUSTMENT" + | "RESERVE_HOLD" + | "RESERVE_RELEASE" + | "RETURNED_PAYOUT" + | "SQUARE_CAPITAL_PAYMENT" + | "SQUARE_CAPITAL_REVERSED_PAYMENT" + | "SUBSCRIPTION_FEE" + | "SUBSCRIPTION_FEE_PAID_REFUND" + | "SUBSCRIPTION_FEE_REFUND" + | "TAX_ON_FEE" + | "THIRD_PARTY_FEE" + | "THIRD_PARTY_FEE_REFUND" + | "PAYOUT" + | "AUTOMATIC_BITCOIN_CONVERSIONS" + | "AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED" + | "CREDIT_CARD_REPAYMENT" + | "CREDIT_CARD_REPAYMENT_REVERSED" + | "LOCAL_OFFERS_CASHBACK" + | "LOCAL_OFFERS_FEE" + | "PERCENTAGE_PROCESSING_ENROLLMENT" + | "PERCENTAGE_PROCESSING_DEACTIVATION" + | "PERCENTAGE_PROCESSING_REPAYMENT" + | "PERCENTAGE_PROCESSING_REPAYMENT_REVERSED" + | "PROCESSING_FEE" + | "PROCESSING_FEE_REFUND" + | "UNDO_PROCESSING_FEE_REFUND" + | "GIFT_CARD_LOAD_FEE" + | "GIFT_CARD_LOAD_FEE_REFUND" + | "UNDO_GIFT_CARD_LOAD_FEE_REFUND" + | "BALANCE_FOLDERS_TRANSFER" + | "BALANCE_FOLDERS_TRANSFER_REVERSED" + | "GIFT_CARD_POOL_TRANSFER" + | "GIFT_CARD_POOL_TRANSFER_REVERSED" + | "SQUARE_PAYROLL_TRANSFER" + | "SQUARE_PAYROLL_TRANSFER_REVERSED"; +} diff --git a/src/serialization/types/AddGroupToCustomerResponse.ts b/src/serialization/types/AddGroupToCustomerResponse.ts new file mode 100644 index 000000000..1d8d5e99c --- /dev/null +++ b/src/serialization/types/AddGroupToCustomerResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const AddGroupToCustomerResponse: core.serialization.ObjectSchema< + serializers.AddGroupToCustomerResponse.Raw, + Square.AddGroupToCustomerResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace AddGroupToCustomerResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/AdditionalRecipient.ts b/src/serialization/types/AdditionalRecipient.ts new file mode 100644 index 000000000..672bb2df2 --- /dev/null +++ b/src/serialization/types/AdditionalRecipient.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const AdditionalRecipient: core.serialization.ObjectSchema< + serializers.AdditionalRecipient.Raw, + Square.AdditionalRecipient +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string()), + description: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money), + receivableId: core.serialization.property("receivable_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace AdditionalRecipient { + export interface Raw { + location_id: string; + description?: (string | null) | null; + amount_money: Money.Raw; + receivable_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/Address.ts b/src/serialization/types/Address.ts new file mode 100644 index 000000000..33ed78cdc --- /dev/null +++ b/src/serialization/types/Address.ts @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Country } from "./Country"; + +export const Address: core.serialization.ObjectSchema = + core.serialization.object({ + addressLine1: core.serialization.property("address_line_1", core.serialization.string().optionalNullable()), + addressLine2: core.serialization.property("address_line_2", core.serialization.string().optionalNullable()), + addressLine3: core.serialization.property("address_line_3", core.serialization.string().optionalNullable()), + locality: core.serialization.string().optionalNullable(), + sublocality: core.serialization.string().optionalNullable(), + sublocality2: core.serialization.property("sublocality_2", core.serialization.string().optionalNullable()), + sublocality3: core.serialization.property("sublocality_3", core.serialization.string().optionalNullable()), + administrativeDistrictLevel1: core.serialization.property( + "administrative_district_level_1", + core.serialization.string().optionalNullable(), + ), + administrativeDistrictLevel2: core.serialization.property( + "administrative_district_level_2", + core.serialization.string().optionalNullable(), + ), + administrativeDistrictLevel3: core.serialization.property( + "administrative_district_level_3", + core.serialization.string().optionalNullable(), + ), + postalCode: core.serialization.property("postal_code", core.serialization.string().optionalNullable()), + country: Country.optional(), + firstName: core.serialization.property("first_name", core.serialization.string().optionalNullable()), + lastName: core.serialization.property("last_name", core.serialization.string().optionalNullable()), + }); + +export declare namespace Address { + export interface Raw { + address_line_1?: (string | null) | null; + address_line_2?: (string | null) | null; + address_line_3?: (string | null) | null; + locality?: (string | null) | null; + sublocality?: (string | null) | null; + sublocality_2?: (string | null) | null; + sublocality_3?: (string | null) | null; + administrative_district_level_1?: (string | null) | null; + administrative_district_level_2?: (string | null) | null; + administrative_district_level_3?: (string | null) | null; + postal_code?: (string | null) | null; + country?: Country.Raw | null; + first_name?: (string | null) | null; + last_name?: (string | null) | null; + } +} diff --git a/src/serialization/types/AdjustLoyaltyPointsResponse.ts b/src/serialization/types/AdjustLoyaltyPointsResponse.ts new file mode 100644 index 000000000..4c01a8c9e --- /dev/null +++ b/src/serialization/types/AdjustLoyaltyPointsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyEvent } from "./LoyaltyEvent"; + +export const AdjustLoyaltyPointsResponse: core.serialization.ObjectSchema< + serializers.AdjustLoyaltyPointsResponse.Raw, + Square.AdjustLoyaltyPointsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + event: LoyaltyEvent.optional(), +}); + +export declare namespace AdjustLoyaltyPointsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + event?: LoyaltyEvent.Raw | null; + } +} diff --git a/src/serialization/types/AfterpayDetails.ts b/src/serialization/types/AfterpayDetails.ts new file mode 100644 index 000000000..8f2aa497d --- /dev/null +++ b/src/serialization/types/AfterpayDetails.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const AfterpayDetails: core.serialization.ObjectSchema = + core.serialization.object({ + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + }); + +export declare namespace AfterpayDetails { + export interface Raw { + email_address?: (string | null) | null; + } +} diff --git a/src/serialization/types/ApplicationDetails.ts b/src/serialization/types/ApplicationDetails.ts new file mode 100644 index 000000000..08386104f --- /dev/null +++ b/src/serialization/types/ApplicationDetails.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ApplicationDetailsExternalSquareProduct } from "./ApplicationDetailsExternalSquareProduct"; + +export const ApplicationDetails: core.serialization.ObjectSchema< + serializers.ApplicationDetails.Raw, + Square.ApplicationDetails +> = core.serialization.object({ + squareProduct: core.serialization.property("square_product", ApplicationDetailsExternalSquareProduct.optional()), + applicationId: core.serialization.property("application_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace ApplicationDetails { + export interface Raw { + square_product?: ApplicationDetailsExternalSquareProduct.Raw | null; + application_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/ApplicationDetailsExternalSquareProduct.ts b/src/serialization/types/ApplicationDetailsExternalSquareProduct.ts new file mode 100644 index 000000000..71b065b1f --- /dev/null +++ b/src/serialization/types/ApplicationDetailsExternalSquareProduct.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ApplicationDetailsExternalSquareProduct: core.serialization.Schema< + serializers.ApplicationDetailsExternalSquareProduct.Raw, + Square.ApplicationDetailsExternalSquareProduct +> = core.serialization.enum_([ + "APPOINTMENTS", + "ECOMMERCE_API", + "INVOICES", + "ONLINE_STORE", + "OTHER", + "RESTAURANTS", + "RETAIL", + "SQUARE_POS", + "TERMINAL_API", + "VIRTUAL_TERMINAL", +]); + +export declare namespace ApplicationDetailsExternalSquareProduct { + export type Raw = + | "APPOINTMENTS" + | "ECOMMERCE_API" + | "INVOICES" + | "ONLINE_STORE" + | "OTHER" + | "RESTAURANTS" + | "RETAIL" + | "SQUARE_POS" + | "TERMINAL_API" + | "VIRTUAL_TERMINAL"; +} diff --git a/src/serialization/types/ApplicationType.ts b/src/serialization/types/ApplicationType.ts new file mode 100644 index 000000000..9f5c07979 --- /dev/null +++ b/src/serialization/types/ApplicationType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ApplicationType: core.serialization.Schema = + core.serialization.stringLiteral("TERMINAL_API"); + +export declare namespace ApplicationType { + export type Raw = "TERMINAL_API"; +} diff --git a/src/serialization/types/AppointmentSegment.ts b/src/serialization/types/AppointmentSegment.ts new file mode 100644 index 000000000..a159933b8 --- /dev/null +++ b/src/serialization/types/AppointmentSegment.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const AppointmentSegment: core.serialization.ObjectSchema< + serializers.AppointmentSegment.Raw, + Square.AppointmentSegment +> = core.serialization.object({ + durationMinutes: core.serialization.property("duration_minutes", core.serialization.number().optionalNullable()), + serviceVariationId: core.serialization.property( + "service_variation_id", + core.serialization.string().optionalNullable(), + ), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string()), + serviceVariationVersion: core.serialization.property( + "service_variation_version", + core.serialization.bigint().optionalNullable(), + ), + intermissionMinutes: core.serialization.property("intermission_minutes", core.serialization.number().optional()), + anyTeamMember: core.serialization.property("any_team_member", core.serialization.boolean().optional()), + resourceIds: core.serialization.property( + "resource_ids", + core.serialization.list(core.serialization.string()).optional(), + ), +}); + +export declare namespace AppointmentSegment { + export interface Raw { + duration_minutes?: (number | null) | null; + service_variation_id?: (string | null) | null; + team_member_id: string; + service_variation_version?: ((bigint | number) | null) | null; + intermission_minutes?: number | null; + any_team_member?: boolean | null; + resource_ids?: string[] | null; + } +} diff --git a/src/serialization/types/ArchivedState.ts b/src/serialization/types/ArchivedState.ts new file mode 100644 index 000000000..691716411 --- /dev/null +++ b/src/serialization/types/ArchivedState.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ArchivedState: core.serialization.Schema = + core.serialization.enum_(["ARCHIVED_STATE_NOT_ARCHIVED", "ARCHIVED_STATE_ARCHIVED", "ARCHIVED_STATE_ALL"]); + +export declare namespace ArchivedState { + export type Raw = "ARCHIVED_STATE_NOT_ARCHIVED" | "ARCHIVED_STATE_ARCHIVED" | "ARCHIVED_STATE_ALL"; +} diff --git a/src/serialization/types/Availability.ts b/src/serialization/types/Availability.ts new file mode 100644 index 000000000..367bb8fc3 --- /dev/null +++ b/src/serialization/types/Availability.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { AppointmentSegment } from "./AppointmentSegment"; + +export const Availability: core.serialization.ObjectSchema = + core.serialization.object({ + startAt: core.serialization.property("start_at", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + appointmentSegments: core.serialization.property( + "appointment_segments", + core.serialization.list(AppointmentSegment).optionalNullable(), + ), + }); + +export declare namespace Availability { + export interface Raw { + start_at?: (string | null) | null; + location_id?: string | null; + appointment_segments?: (AppointmentSegment.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/BankAccount.ts b/src/serialization/types/BankAccount.ts new file mode 100644 index 000000000..2a4f89132 --- /dev/null +++ b/src/serialization/types/BankAccount.ts @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Country } from "./Country"; +import { Currency } from "./Currency"; +import { BankAccountType } from "./BankAccountType"; +import { BankAccountStatus } from "./BankAccountStatus"; + +export const BankAccount: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + accountNumberSuffix: core.serialization.property("account_number_suffix", core.serialization.string()), + country: Country, + currency: Currency, + accountType: core.serialization.property("account_type", BankAccountType), + holderName: core.serialization.property("holder_name", core.serialization.string()), + primaryBankIdentificationNumber: core.serialization.property( + "primary_bank_identification_number", + core.serialization.string(), + ), + secondaryBankIdentificationNumber: core.serialization.property( + "secondary_bank_identification_number", + core.serialization.string().optionalNullable(), + ), + debitMandateReferenceId: core.serialization.property( + "debit_mandate_reference_id", + core.serialization.string().optionalNullable(), + ), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + status: BankAccountStatus, + creditable: core.serialization.boolean(), + debitable: core.serialization.boolean(), + fingerprint: core.serialization.string().optionalNullable(), + version: core.serialization.number().optional(), + bankName: core.serialization.property("bank_name", core.serialization.string().optionalNullable()), + }); + +export declare namespace BankAccount { + export interface Raw { + id: string; + account_number_suffix: string; + country: Country.Raw; + currency: Currency.Raw; + account_type: BankAccountType.Raw; + holder_name: string; + primary_bank_identification_number: string; + secondary_bank_identification_number?: (string | null) | null; + debit_mandate_reference_id?: (string | null) | null; + reference_id?: (string | null) | null; + location_id?: (string | null) | null; + status: BankAccountStatus.Raw; + creditable: boolean; + debitable: boolean; + fingerprint?: (string | null) | null; + version?: number | null; + bank_name?: (string | null) | null; + } +} diff --git a/src/serialization/types/BankAccountPaymentDetails.ts b/src/serialization/types/BankAccountPaymentDetails.ts new file mode 100644 index 000000000..7a5bfea80 --- /dev/null +++ b/src/serialization/types/BankAccountPaymentDetails.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { AchDetails } from "./AchDetails"; +import { Error_ } from "./Error_"; + +export const BankAccountPaymentDetails: core.serialization.ObjectSchema< + serializers.BankAccountPaymentDetails.Raw, + Square.BankAccountPaymentDetails +> = core.serialization.object({ + bankName: core.serialization.property("bank_name", core.serialization.string().optionalNullable()), + transferType: core.serialization.property("transfer_type", core.serialization.string().optionalNullable()), + accountOwnershipType: core.serialization.property( + "account_ownership_type", + core.serialization.string().optionalNullable(), + ), + fingerprint: core.serialization.string().optionalNullable(), + country: core.serialization.string().optionalNullable(), + statementDescription: core.serialization.property( + "statement_description", + core.serialization.string().optionalNullable(), + ), + achDetails: core.serialization.property("ach_details", AchDetails.optional()), + errors: core.serialization.list(Error_).optionalNullable(), +}); + +export declare namespace BankAccountPaymentDetails { + export interface Raw { + bank_name?: (string | null) | null; + transfer_type?: (string | null) | null; + account_ownership_type?: (string | null) | null; + fingerprint?: (string | null) | null; + country?: (string | null) | null; + statement_description?: (string | null) | null; + ach_details?: AchDetails.Raw | null; + errors?: (Error_.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/BankAccountStatus.ts b/src/serialization/types/BankAccountStatus.ts new file mode 100644 index 000000000..df4c18d94 --- /dev/null +++ b/src/serialization/types/BankAccountStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BankAccountStatus: core.serialization.Schema = + core.serialization.enum_(["VERIFICATION_IN_PROGRESS", "VERIFIED", "DISABLED"]); + +export declare namespace BankAccountStatus { + export type Raw = "VERIFICATION_IN_PROGRESS" | "VERIFIED" | "DISABLED"; +} diff --git a/src/serialization/types/BankAccountType.ts b/src/serialization/types/BankAccountType.ts new file mode 100644 index 000000000..7d7183052 --- /dev/null +++ b/src/serialization/types/BankAccountType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BankAccountType: core.serialization.Schema = + core.serialization.enum_(["CHECKING", "SAVINGS", "INVESTMENT", "OTHER", "BUSINESS_CHECKING"]); + +export declare namespace BankAccountType { + export type Raw = "CHECKING" | "SAVINGS" | "INVESTMENT" | "OTHER" | "BUSINESS_CHECKING"; +} diff --git a/src/serialization/types/BatchChangeInventoryRequest.ts b/src/serialization/types/BatchChangeInventoryRequest.ts new file mode 100644 index 000000000..e32418d37 --- /dev/null +++ b/src/serialization/types/BatchChangeInventoryRequest.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryChange } from "./InventoryChange"; + +export const BatchChangeInventoryRequest: core.serialization.ObjectSchema< + serializers.BatchChangeInventoryRequest.Raw, + Square.BatchChangeInventoryRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + changes: core.serialization.list(InventoryChange).optionalNullable(), + ignoreUnchangedCounts: core.serialization.property( + "ignore_unchanged_counts", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace BatchChangeInventoryRequest { + export interface Raw { + idempotency_key: string; + changes?: (InventoryChange.Raw[] | null) | null; + ignore_unchanged_counts?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/BatchChangeInventoryResponse.ts b/src/serialization/types/BatchChangeInventoryResponse.ts new file mode 100644 index 000000000..277e85771 --- /dev/null +++ b/src/serialization/types/BatchChangeInventoryResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { InventoryCount } from "./InventoryCount"; +import { InventoryChange } from "./InventoryChange"; + +export const BatchChangeInventoryResponse: core.serialization.ObjectSchema< + serializers.BatchChangeInventoryResponse.Raw, + Square.BatchChangeInventoryResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + counts: core.serialization.list(InventoryCount).optional(), + changes: core.serialization.list(InventoryChange).optional(), +}); + +export declare namespace BatchChangeInventoryResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + counts?: InventoryCount.Raw[] | null; + changes?: InventoryChange.Raw[] | null; + } +} diff --git a/src/serialization/types/BatchCreateTeamMembersResponse.ts b/src/serialization/types/BatchCreateTeamMembersResponse.ts new file mode 100644 index 000000000..9edb71dac --- /dev/null +++ b/src/serialization/types/BatchCreateTeamMembersResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CreateTeamMemberResponse } from "./CreateTeamMemberResponse"; +import { Error_ } from "./Error_"; + +export const BatchCreateTeamMembersResponse: core.serialization.ObjectSchema< + serializers.BatchCreateTeamMembersResponse.Raw, + Square.BatchCreateTeamMembersResponse +> = core.serialization.object({ + teamMembers: core.serialization.property( + "team_members", + core.serialization.record(core.serialization.string(), CreateTeamMemberResponse).optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BatchCreateTeamMembersResponse { + export interface Raw { + team_members?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BatchCreateVendorsResponse.ts b/src/serialization/types/BatchCreateVendorsResponse.ts new file mode 100644 index 000000000..b23bfbbb0 --- /dev/null +++ b/src/serialization/types/BatchCreateVendorsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CreateVendorResponse } from "./CreateVendorResponse"; + +export const BatchCreateVendorsResponse: core.serialization.ObjectSchema< + serializers.BatchCreateVendorsResponse.Raw, + Square.BatchCreateVendorsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + responses: core.serialization.record(core.serialization.string(), CreateVendorResponse).optional(), +}); + +export declare namespace BatchCreateVendorsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + responses?: Record | null; + } +} diff --git a/src/serialization/types/BatchDeleteCatalogObjectsResponse.ts b/src/serialization/types/BatchDeleteCatalogObjectsResponse.ts new file mode 100644 index 000000000..53c0cdcdd --- /dev/null +++ b/src/serialization/types/BatchDeleteCatalogObjectsResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const BatchDeleteCatalogObjectsResponse: core.serialization.ObjectSchema< + serializers.BatchDeleteCatalogObjectsResponse.Raw, + Square.BatchDeleteCatalogObjectsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + deletedObjectIds: core.serialization.property( + "deleted_object_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + deletedAt: core.serialization.property("deleted_at", core.serialization.string().optional()), +}); + +export declare namespace BatchDeleteCatalogObjectsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + deleted_object_ids?: string[] | null; + deleted_at?: string | null; + } +} diff --git a/src/serialization/types/BatchGetCatalogObjectsResponse.ts b/src/serialization/types/BatchGetCatalogObjectsResponse.ts new file mode 100644 index 000000000..de6f66a25 --- /dev/null +++ b/src/serialization/types/BatchGetCatalogObjectsResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const BatchGetCatalogObjectsResponse: core.serialization.ObjectSchema< + serializers.BatchGetCatalogObjectsResponse.Raw, + Square.BatchGetCatalogObjectsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + objects: core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optional(), + relatedObjects: core.serialization.property( + "related_objects", + core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optional(), + ), +}); + +export declare namespace BatchGetCatalogObjectsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + objects?: serializers.CatalogObject.Raw[] | null; + related_objects?: serializers.CatalogObject.Raw[] | null; + } +} diff --git a/src/serialization/types/BatchGetInventoryChangesResponse.ts b/src/serialization/types/BatchGetInventoryChangesResponse.ts new file mode 100644 index 000000000..1a100da5a --- /dev/null +++ b/src/serialization/types/BatchGetInventoryChangesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { InventoryChange } from "./InventoryChange"; + +export const BatchGetInventoryChangesResponse: core.serialization.ObjectSchema< + serializers.BatchGetInventoryChangesResponse.Raw, + Square.BatchGetInventoryChangesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + changes: core.serialization.list(InventoryChange).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace BatchGetInventoryChangesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + changes?: InventoryChange.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/BatchGetInventoryCountsRequest.ts b/src/serialization/types/BatchGetInventoryCountsRequest.ts new file mode 100644 index 000000000..eb8312bf6 --- /dev/null +++ b/src/serialization/types/BatchGetInventoryCountsRequest.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryState } from "./InventoryState"; + +export const BatchGetInventoryCountsRequest: core.serialization.ObjectSchema< + serializers.BatchGetInventoryCountsRequest.Raw, + Square.BatchGetInventoryCountsRequest +> = core.serialization.object({ + catalogObjectIds: core.serialization.property( + "catalog_object_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + updatedAfter: core.serialization.property("updated_after", core.serialization.string().optionalNullable()), + cursor: core.serialization.string().optionalNullable(), + states: core.serialization.list(InventoryState).optionalNullable(), + limit: core.serialization.number().optionalNullable(), +}); + +export declare namespace BatchGetInventoryCountsRequest { + export interface Raw { + catalog_object_ids?: (string[] | null) | null; + location_ids?: (string[] | null) | null; + updated_after?: (string | null) | null; + cursor?: (string | null) | null; + states?: (InventoryState.Raw[] | null) | null; + limit?: (number | null) | null; + } +} diff --git a/src/serialization/types/BatchGetInventoryCountsResponse.ts b/src/serialization/types/BatchGetInventoryCountsResponse.ts new file mode 100644 index 000000000..030eab0a5 --- /dev/null +++ b/src/serialization/types/BatchGetInventoryCountsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { InventoryCount } from "./InventoryCount"; + +export const BatchGetInventoryCountsResponse: core.serialization.ObjectSchema< + serializers.BatchGetInventoryCountsResponse.Raw, + Square.BatchGetInventoryCountsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + counts: core.serialization.list(InventoryCount).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace BatchGetInventoryCountsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + counts?: InventoryCount.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/BatchGetOrdersResponse.ts b/src/serialization/types/BatchGetOrdersResponse.ts new file mode 100644 index 000000000..3eb249da1 --- /dev/null +++ b/src/serialization/types/BatchGetOrdersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Order } from "./Order"; +import { Error_ } from "./Error_"; + +export const BatchGetOrdersResponse: core.serialization.ObjectSchema< + serializers.BatchGetOrdersResponse.Raw, + Square.BatchGetOrdersResponse +> = core.serialization.object({ + orders: core.serialization.list(Order).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BatchGetOrdersResponse { + export interface Raw { + orders?: Order.Raw[] | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BatchGetVendorsResponse.ts b/src/serialization/types/BatchGetVendorsResponse.ts new file mode 100644 index 000000000..9ece6ca65 --- /dev/null +++ b/src/serialization/types/BatchGetVendorsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GetVendorResponse } from "./GetVendorResponse"; + +export const BatchGetVendorsResponse: core.serialization.ObjectSchema< + serializers.BatchGetVendorsResponse.Raw, + Square.BatchGetVendorsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + responses: core.serialization.record(core.serialization.string(), GetVendorResponse).optional(), +}); + +export declare namespace BatchGetVendorsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + responses?: Record | null; + } +} diff --git a/src/serialization/types/BatchRetrieveInventoryChangesRequest.ts b/src/serialization/types/BatchRetrieveInventoryChangesRequest.ts new file mode 100644 index 000000000..9183e6d0d --- /dev/null +++ b/src/serialization/types/BatchRetrieveInventoryChangesRequest.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryChangeType } from "./InventoryChangeType"; +import { InventoryState } from "./InventoryState"; + +export const BatchRetrieveInventoryChangesRequest: core.serialization.ObjectSchema< + serializers.BatchRetrieveInventoryChangesRequest.Raw, + Square.BatchRetrieveInventoryChangesRequest +> = core.serialization.object({ + catalogObjectIds: core.serialization.property( + "catalog_object_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + types: core.serialization.list(InventoryChangeType).optionalNullable(), + states: core.serialization.list(InventoryState).optionalNullable(), + updatedAfter: core.serialization.property("updated_after", core.serialization.string().optionalNullable()), + updatedBefore: core.serialization.property("updated_before", core.serialization.string().optionalNullable()), + cursor: core.serialization.string().optionalNullable(), + limit: core.serialization.number().optionalNullable(), +}); + +export declare namespace BatchRetrieveInventoryChangesRequest { + export interface Raw { + catalog_object_ids?: (string[] | null) | null; + location_ids?: (string[] | null) | null; + types?: (InventoryChangeType.Raw[] | null) | null; + states?: (InventoryState.Raw[] | null) | null; + updated_after?: (string | null) | null; + updated_before?: (string | null) | null; + cursor?: (string | null) | null; + limit?: (number | null) | null; + } +} diff --git a/src/serialization/types/BatchUpdateTeamMembersResponse.ts b/src/serialization/types/BatchUpdateTeamMembersResponse.ts new file mode 100644 index 000000000..faa2d592f --- /dev/null +++ b/src/serialization/types/BatchUpdateTeamMembersResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { UpdateTeamMemberResponse } from "./UpdateTeamMemberResponse"; +import { Error_ } from "./Error_"; + +export const BatchUpdateTeamMembersResponse: core.serialization.ObjectSchema< + serializers.BatchUpdateTeamMembersResponse.Raw, + Square.BatchUpdateTeamMembersResponse +> = core.serialization.object({ + teamMembers: core.serialization.property( + "team_members", + core.serialization.record(core.serialization.string(), UpdateTeamMemberResponse).optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BatchUpdateTeamMembersResponse { + export interface Raw { + team_members?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BatchUpdateVendorsResponse.ts b/src/serialization/types/BatchUpdateVendorsResponse.ts new file mode 100644 index 000000000..88d932f61 --- /dev/null +++ b/src/serialization/types/BatchUpdateVendorsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { UpdateVendorResponse } from "./UpdateVendorResponse"; + +export const BatchUpdateVendorsResponse: core.serialization.ObjectSchema< + serializers.BatchUpdateVendorsResponse.Raw, + Square.BatchUpdateVendorsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + responses: core.serialization.record(core.serialization.string(), UpdateVendorResponse).optional(), +}); + +export declare namespace BatchUpdateVendorsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + responses?: Record | null; + } +} diff --git a/src/serialization/types/BatchUpsertCatalogObjectsResponse.ts b/src/serialization/types/BatchUpsertCatalogObjectsResponse.ts new file mode 100644 index 000000000..685418862 --- /dev/null +++ b/src/serialization/types/BatchUpsertCatalogObjectsResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CatalogIdMapping } from "./CatalogIdMapping"; + +export const BatchUpsertCatalogObjectsResponse: core.serialization.ObjectSchema< + serializers.BatchUpsertCatalogObjectsResponse.Raw, + Square.BatchUpsertCatalogObjectsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + objects: core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optional(), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + idMappings: core.serialization.property("id_mappings", core.serialization.list(CatalogIdMapping).optional()), +}); + +export declare namespace BatchUpsertCatalogObjectsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + objects?: serializers.CatalogObject.Raw[] | null; + updated_at?: string | null; + id_mappings?: CatalogIdMapping.Raw[] | null; + } +} diff --git a/src/serialization/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts b/src/serialization/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts new file mode 100644 index 000000000..888ed197a --- /dev/null +++ b/src/serialization/types/BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; + +export const BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest: core.serialization.ObjectSchema< + serializers.BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest.Raw, + Square.BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest +> = core.serialization.object({ + customerId: core.serialization.property("customer_id", core.serialization.string()), + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest { + export interface Raw { + customer_id: string; + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/types/BatchUpsertCustomerCustomAttributesResponse.ts b/src/serialization/types/BatchUpsertCustomerCustomAttributesResponse.ts new file mode 100644 index 000000000..62941923e --- /dev/null +++ b/src/serialization/types/BatchUpsertCustomerCustomAttributesResponse.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse } from "./BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse"; +import { Error_ } from "./Error_"; + +export const BatchUpsertCustomerCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BatchUpsertCustomerCustomAttributesResponse.Raw, + Square.BatchUpsertCustomerCustomAttributesResponse +> = core.serialization.object({ + values: core.serialization + .record( + core.serialization.string(), + BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse, + ) + .optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BatchUpsertCustomerCustomAttributesResponse { + export interface Raw { + values?: Record< + string, + BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.Raw + > | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts b/src/serialization/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts new file mode 100644 index 000000000..5f3a3fb24 --- /dev/null +++ b/src/serialization/types/BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse: core.serialization.ObjectSchema< + serializers.BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse.Raw, + Square.BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse +> = core.serialization.object({ + customerId: core.serialization.property("customer_id", core.serialization.string().optional()), + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse { + export interface Raw { + customer_id?: string | null; + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/Booking.ts b/src/serialization/types/Booking.ts new file mode 100644 index 000000000..91ef5f029 --- /dev/null +++ b/src/serialization/types/Booking.ts @@ -0,0 +1,65 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BookingStatus } from "./BookingStatus"; +import { AppointmentSegment } from "./AppointmentSegment"; +import { BusinessAppointmentSettingsBookingLocationType } from "./BusinessAppointmentSettingsBookingLocationType"; +import { BookingCreatorDetails } from "./BookingCreatorDetails"; +import { BookingBookingSource } from "./BookingBookingSource"; +import { Address } from "./Address"; + +export const Booking: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + version: core.serialization.number().optional(), + status: BookingStatus.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + startAt: core.serialization.property("start_at", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + customerNote: core.serialization.property("customer_note", core.serialization.string().optionalNullable()), + sellerNote: core.serialization.property("seller_note", core.serialization.string().optionalNullable()), + appointmentSegments: core.serialization.property( + "appointment_segments", + core.serialization.list(AppointmentSegment).optionalNullable(), + ), + transitionTimeMinutes: core.serialization.property( + "transition_time_minutes", + core.serialization.number().optional(), + ), + allDay: core.serialization.property("all_day", core.serialization.boolean().optional()), + locationType: core.serialization.property( + "location_type", + BusinessAppointmentSettingsBookingLocationType.optional(), + ), + creatorDetails: core.serialization.property("creator_details", BookingCreatorDetails.optional()), + source: BookingBookingSource.optional(), + address: Address.optional(), + }); + +export declare namespace Booking { + export interface Raw { + id?: string | null; + version?: number | null; + status?: BookingStatus.Raw | null; + created_at?: string | null; + updated_at?: string | null; + start_at?: (string | null) | null; + location_id?: (string | null) | null; + customer_id?: (string | null) | null; + customer_note?: (string | null) | null; + seller_note?: (string | null) | null; + appointment_segments?: (AppointmentSegment.Raw[] | null) | null; + transition_time_minutes?: number | null; + all_day?: boolean | null; + location_type?: BusinessAppointmentSettingsBookingLocationType.Raw | null; + creator_details?: BookingCreatorDetails.Raw | null; + source?: BookingBookingSource.Raw | null; + address?: Address.Raw | null; + } +} diff --git a/src/serialization/types/BookingBookingSource.ts b/src/serialization/types/BookingBookingSource.ts new file mode 100644 index 000000000..b056aab33 --- /dev/null +++ b/src/serialization/types/BookingBookingSource.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BookingBookingSource: core.serialization.Schema< + serializers.BookingBookingSource.Raw, + Square.BookingBookingSource +> = core.serialization.enum_(["FIRST_PARTY_MERCHANT", "FIRST_PARTY_BUYER", "THIRD_PARTY_BUYER", "API"]); + +export declare namespace BookingBookingSource { + export type Raw = "FIRST_PARTY_MERCHANT" | "FIRST_PARTY_BUYER" | "THIRD_PARTY_BUYER" | "API"; +} diff --git a/src/serialization/types/BookingCreatorDetails.ts b/src/serialization/types/BookingCreatorDetails.ts new file mode 100644 index 000000000..cd64d6781 --- /dev/null +++ b/src/serialization/types/BookingCreatorDetails.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BookingCreatorDetailsCreatorType } from "./BookingCreatorDetailsCreatorType"; + +export const BookingCreatorDetails: core.serialization.ObjectSchema< + serializers.BookingCreatorDetails.Raw, + Square.BookingCreatorDetails +> = core.serialization.object({ + creatorType: core.serialization.property("creator_type", BookingCreatorDetailsCreatorType.optional()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optional()), + customerId: core.serialization.property("customer_id", core.serialization.string().optional()), +}); + +export declare namespace BookingCreatorDetails { + export interface Raw { + creator_type?: BookingCreatorDetailsCreatorType.Raw | null; + team_member_id?: string | null; + customer_id?: string | null; + } +} diff --git a/src/serialization/types/BookingCreatorDetailsCreatorType.ts b/src/serialization/types/BookingCreatorDetailsCreatorType.ts new file mode 100644 index 000000000..a7b1a513a --- /dev/null +++ b/src/serialization/types/BookingCreatorDetailsCreatorType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BookingCreatorDetailsCreatorType: core.serialization.Schema< + serializers.BookingCreatorDetailsCreatorType.Raw, + Square.BookingCreatorDetailsCreatorType +> = core.serialization.enum_(["TEAM_MEMBER", "CUSTOMER"]); + +export declare namespace BookingCreatorDetailsCreatorType { + export type Raw = "TEAM_MEMBER" | "CUSTOMER"; +} diff --git a/src/serialization/types/BookingCustomAttributeDeleteRequest.ts b/src/serialization/types/BookingCustomAttributeDeleteRequest.ts new file mode 100644 index 000000000..0700eb5e3 --- /dev/null +++ b/src/serialization/types/BookingCustomAttributeDeleteRequest.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BookingCustomAttributeDeleteRequest: core.serialization.ObjectSchema< + serializers.BookingCustomAttributeDeleteRequest.Raw, + Square.BookingCustomAttributeDeleteRequest +> = core.serialization.object({ + bookingId: core.serialization.property("booking_id", core.serialization.string()), + key: core.serialization.string(), +}); + +export declare namespace BookingCustomAttributeDeleteRequest { + export interface Raw { + booking_id: string; + key: string; + } +} diff --git a/src/serialization/types/BookingCustomAttributeDeleteResponse.ts b/src/serialization/types/BookingCustomAttributeDeleteResponse.ts new file mode 100644 index 000000000..c0703fe23 --- /dev/null +++ b/src/serialization/types/BookingCustomAttributeDeleteResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const BookingCustomAttributeDeleteResponse: core.serialization.ObjectSchema< + serializers.BookingCustomAttributeDeleteResponse.Raw, + Square.BookingCustomAttributeDeleteResponse +> = core.serialization.object({ + bookingId: core.serialization.property("booking_id", core.serialization.string().optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BookingCustomAttributeDeleteResponse { + export interface Raw { + booking_id?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BookingCustomAttributeUpsertRequest.ts b/src/serialization/types/BookingCustomAttributeUpsertRequest.ts new file mode 100644 index 000000000..4a794c637 --- /dev/null +++ b/src/serialization/types/BookingCustomAttributeUpsertRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; + +export const BookingCustomAttributeUpsertRequest: core.serialization.ObjectSchema< + serializers.BookingCustomAttributeUpsertRequest.Raw, + Square.BookingCustomAttributeUpsertRequest +> = core.serialization.object({ + bookingId: core.serialization.property("booking_id", core.serialization.string()), + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace BookingCustomAttributeUpsertRequest { + export interface Raw { + booking_id: string; + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/types/BookingCustomAttributeUpsertResponse.ts b/src/serialization/types/BookingCustomAttributeUpsertResponse.ts new file mode 100644 index 000000000..7d26a7ecd --- /dev/null +++ b/src/serialization/types/BookingCustomAttributeUpsertResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const BookingCustomAttributeUpsertResponse: core.serialization.ObjectSchema< + serializers.BookingCustomAttributeUpsertResponse.Raw, + Square.BookingCustomAttributeUpsertResponse +> = core.serialization.object({ + bookingId: core.serialization.property("booking_id", core.serialization.string().optional()), + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BookingCustomAttributeUpsertResponse { + export interface Raw { + booking_id?: string | null; + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BookingStatus.ts b/src/serialization/types/BookingStatus.ts new file mode 100644 index 000000000..23f9f5841 --- /dev/null +++ b/src/serialization/types/BookingStatus.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BookingStatus: core.serialization.Schema = + core.serialization.enum_([ + "PENDING", + "CANCELLED_BY_CUSTOMER", + "CANCELLED_BY_SELLER", + "DECLINED", + "ACCEPTED", + "NO_SHOW", + ]); + +export declare namespace BookingStatus { + export type Raw = "PENDING" | "CANCELLED_BY_CUSTOMER" | "CANCELLED_BY_SELLER" | "DECLINED" | "ACCEPTED" | "NO_SHOW"; +} diff --git a/src/serialization/types/Break.ts b/src/serialization/types/Break.ts new file mode 100644 index 000000000..3490d3e2d --- /dev/null +++ b/src/serialization/types/Break.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Break: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + startAt: core.serialization.property("start_at", core.serialization.string()), + endAt: core.serialization.property("end_at", core.serialization.string().optionalNullable()), + breakTypeId: core.serialization.property("break_type_id", core.serialization.string()), + name: core.serialization.string(), + expectedDuration: core.serialization.property("expected_duration", core.serialization.string()), + isPaid: core.serialization.property("is_paid", core.serialization.boolean()), +}); + +export declare namespace Break { + export interface Raw { + id?: string | null; + start_at: string; + end_at?: (string | null) | null; + break_type_id: string; + name: string; + expected_duration: string; + is_paid: boolean; + } +} diff --git a/src/serialization/types/BreakType.ts b/src/serialization/types/BreakType.ts new file mode 100644 index 000000000..391ff6e5d --- /dev/null +++ b/src/serialization/types/BreakType.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BreakType: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + locationId: core.serialization.property("location_id", core.serialization.string()), + breakName: core.serialization.property("break_name", core.serialization.string()), + expectedDuration: core.serialization.property("expected_duration", core.serialization.string()), + isPaid: core.serialization.property("is_paid", core.serialization.boolean()), + version: core.serialization.number().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + }); + +export declare namespace BreakType { + export interface Raw { + id?: string | null; + location_id: string; + break_name: string; + expected_duration: string; + is_paid: boolean; + version?: number | null; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/BulkCreateCustomerData.ts b/src/serialization/types/BulkCreateCustomerData.ts new file mode 100644 index 000000000..8cf11f262 --- /dev/null +++ b/src/serialization/types/BulkCreateCustomerData.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; +import { CustomerTaxIds } from "./CustomerTaxIds"; + +export const BulkCreateCustomerData: core.serialization.ObjectSchema< + serializers.BulkCreateCustomerData.Raw, + Square.BulkCreateCustomerData +> = core.serialization.object({ + givenName: core.serialization.property("given_name", core.serialization.string().optionalNullable()), + familyName: core.serialization.property("family_name", core.serialization.string().optionalNullable()), + companyName: core.serialization.property("company_name", core.serialization.string().optionalNullable()), + nickname: core.serialization.string().optionalNullable(), + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + address: Address.optional(), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + note: core.serialization.string().optionalNullable(), + birthday: core.serialization.string().optionalNullable(), + taxIds: core.serialization.property("tax_ids", CustomerTaxIds.optional()), +}); + +export declare namespace BulkCreateCustomerData { + export interface Raw { + given_name?: (string | null) | null; + family_name?: (string | null) | null; + company_name?: (string | null) | null; + nickname?: (string | null) | null; + email_address?: (string | null) | null; + address?: Address.Raw | null; + phone_number?: (string | null) | null; + reference_id?: (string | null) | null; + note?: (string | null) | null; + birthday?: (string | null) | null; + tax_ids?: CustomerTaxIds.Raw | null; + } +} diff --git a/src/serialization/types/BulkCreateCustomersResponse.ts b/src/serialization/types/BulkCreateCustomersResponse.ts new file mode 100644 index 000000000..54f9631e5 --- /dev/null +++ b/src/serialization/types/BulkCreateCustomersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CreateCustomerResponse } from "./CreateCustomerResponse"; +import { Error_ } from "./Error_"; + +export const BulkCreateCustomersResponse: core.serialization.ObjectSchema< + serializers.BulkCreateCustomersResponse.Raw, + Square.BulkCreateCustomersResponse +> = core.serialization.object({ + responses: core.serialization.record(core.serialization.string(), CreateCustomerResponse).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkCreateCustomersResponse { + export interface Raw { + responses?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkDeleteBookingCustomAttributesResponse.ts b/src/serialization/types/BulkDeleteBookingCustomAttributesResponse.ts new file mode 100644 index 000000000..194589a54 --- /dev/null +++ b/src/serialization/types/BulkDeleteBookingCustomAttributesResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BookingCustomAttributeDeleteResponse } from "./BookingCustomAttributeDeleteResponse"; +import { Error_ } from "./Error_"; + +export const BulkDeleteBookingCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BulkDeleteBookingCustomAttributesResponse.Raw, + Square.BulkDeleteBookingCustomAttributesResponse +> = core.serialization.object({ + values: core.serialization.record(core.serialization.string(), BookingCustomAttributeDeleteResponse).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkDeleteBookingCustomAttributesResponse { + export interface Raw { + values?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkDeleteCustomersResponse.ts b/src/serialization/types/BulkDeleteCustomersResponse.ts new file mode 100644 index 000000000..a14b5cdbc --- /dev/null +++ b/src/serialization/types/BulkDeleteCustomersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DeleteCustomerResponse } from "./DeleteCustomerResponse"; +import { Error_ } from "./Error_"; + +export const BulkDeleteCustomersResponse: core.serialization.ObjectSchema< + serializers.BulkDeleteCustomersResponse.Raw, + Square.BulkDeleteCustomersResponse +> = core.serialization.object({ + responses: core.serialization.record(core.serialization.string(), DeleteCustomerResponse).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkDeleteCustomersResponse { + export interface Raw { + responses?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts b/src/serialization/types/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts new file mode 100644 index 000000000..8ec39ae53 --- /dev/null +++ b/src/serialization/types/BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest: core.serialization.ObjectSchema< + serializers.BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest.Raw, + Square.BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest +> = core.serialization.object({ + key: core.serialization.string().optional(), +}); + +export declare namespace BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest { + export interface Raw { + key?: string | null; + } +} diff --git a/src/serialization/types/BulkDeleteLocationCustomAttributesResponse.ts b/src/serialization/types/BulkDeleteLocationCustomAttributesResponse.ts new file mode 100644 index 000000000..8e7a81dff --- /dev/null +++ b/src/serialization/types/BulkDeleteLocationCustomAttributesResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse } from "./BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse"; +import { Error_ } from "./Error_"; + +export const BulkDeleteLocationCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BulkDeleteLocationCustomAttributesResponse.Raw, + Square.BulkDeleteLocationCustomAttributesResponse +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse, + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkDeleteLocationCustomAttributesResponse { + export interface Raw { + values: Record; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts b/src/serialization/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts new file mode 100644 index 000000000..22d88c11a --- /dev/null +++ b/src/serialization/types/BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse: core.serialization.ObjectSchema< + serializers.BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse.Raw, + Square.BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse { + export interface Raw { + location_id?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts b/src/serialization/types/BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts new file mode 100644 index 000000000..2ccbd2d85 --- /dev/null +++ b/src/serialization/types/BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest: core.serialization.ObjectSchema< + serializers.BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest.Raw, + Square.BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest +> = core.serialization.object({ + key: core.serialization.string().optional(), +}); + +export declare namespace BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest { + export interface Raw { + key?: string | null; + } +} diff --git a/src/serialization/types/BulkDeleteMerchantCustomAttributesResponse.ts b/src/serialization/types/BulkDeleteMerchantCustomAttributesResponse.ts new file mode 100644 index 000000000..c03b88e57 --- /dev/null +++ b/src/serialization/types/BulkDeleteMerchantCustomAttributesResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse } from "./BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse"; +import { Error_ } from "./Error_"; + +export const BulkDeleteMerchantCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BulkDeleteMerchantCustomAttributesResponse.Raw, + Square.BulkDeleteMerchantCustomAttributesResponse +> = core.serialization.object({ + values: core.serialization.record( + core.serialization.string(), + BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse, + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkDeleteMerchantCustomAttributesResponse { + export interface Raw { + values: Record; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts b/src/serialization/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts new file mode 100644 index 000000000..f6923054b --- /dev/null +++ b/src/serialization/types/BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse: core.serialization.ObjectSchema< + serializers.BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse.Raw, + Square.BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts b/src/serialization/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts new file mode 100644 index 000000000..c7d3eea93 --- /dev/null +++ b/src/serialization/types/BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute: core.serialization.ObjectSchema< + serializers.BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute.Raw, + Square.BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute +> = core.serialization.object({ + key: core.serialization.string().optional(), + orderId: core.serialization.property("order_id", core.serialization.string()), +}); + +export declare namespace BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute { + export interface Raw { + key?: string | null; + order_id: string; + } +} diff --git a/src/serialization/types/BulkDeleteOrderCustomAttributesResponse.ts b/src/serialization/types/BulkDeleteOrderCustomAttributesResponse.ts new file mode 100644 index 000000000..09cb65491 --- /dev/null +++ b/src/serialization/types/BulkDeleteOrderCustomAttributesResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { DeleteOrderCustomAttributeResponse } from "./DeleteOrderCustomAttributeResponse"; + +export const BulkDeleteOrderCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BulkDeleteOrderCustomAttributesResponse.Raw, + Square.BulkDeleteOrderCustomAttributesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + values: core.serialization.record(core.serialization.string(), DeleteOrderCustomAttributeResponse), +}); + +export declare namespace BulkDeleteOrderCustomAttributesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + values: Record; + } +} diff --git a/src/serialization/types/BulkRetrieveBookingsResponse.ts b/src/serialization/types/BulkRetrieveBookingsResponse.ts new file mode 100644 index 000000000..002ff6a60 --- /dev/null +++ b/src/serialization/types/BulkRetrieveBookingsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GetBookingResponse } from "./GetBookingResponse"; +import { Error_ } from "./Error_"; + +export const BulkRetrieveBookingsResponse: core.serialization.ObjectSchema< + serializers.BulkRetrieveBookingsResponse.Raw, + Square.BulkRetrieveBookingsResponse +> = core.serialization.object({ + bookings: core.serialization.record(core.serialization.string(), GetBookingResponse).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkRetrieveBookingsResponse { + export interface Raw { + bookings?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkRetrieveCustomersResponse.ts b/src/serialization/types/BulkRetrieveCustomersResponse.ts new file mode 100644 index 000000000..1a7485668 --- /dev/null +++ b/src/serialization/types/BulkRetrieveCustomersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GetCustomerResponse } from "./GetCustomerResponse"; +import { Error_ } from "./Error_"; + +export const BulkRetrieveCustomersResponse: core.serialization.ObjectSchema< + serializers.BulkRetrieveCustomersResponse.Raw, + Square.BulkRetrieveCustomersResponse +> = core.serialization.object({ + responses: core.serialization.record(core.serialization.string(), GetCustomerResponse).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkRetrieveCustomersResponse { + export interface Raw { + responses?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts b/src/serialization/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts new file mode 100644 index 000000000..8853ea123 --- /dev/null +++ b/src/serialization/types/BulkRetrieveTeamMemberBookingProfilesResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GetTeamMemberBookingProfileResponse } from "./GetTeamMemberBookingProfileResponse"; +import { Error_ } from "./Error_"; + +export const BulkRetrieveTeamMemberBookingProfilesResponse: core.serialization.ObjectSchema< + serializers.BulkRetrieveTeamMemberBookingProfilesResponse.Raw, + Square.BulkRetrieveTeamMemberBookingProfilesResponse +> = core.serialization.object({ + teamMemberBookingProfiles: core.serialization.property( + "team_member_booking_profiles", + core.serialization.record(core.serialization.string(), GetTeamMemberBookingProfileResponse).optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkRetrieveTeamMemberBookingProfilesResponse { + export interface Raw { + team_member_booking_profiles?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkSwapPlanResponse.ts b/src/serialization/types/BulkSwapPlanResponse.ts new file mode 100644 index 000000000..7381468f1 --- /dev/null +++ b/src/serialization/types/BulkSwapPlanResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const BulkSwapPlanResponse: core.serialization.ObjectSchema< + serializers.BulkSwapPlanResponse.Raw, + Square.BulkSwapPlanResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + affectedSubscriptions: core.serialization.property( + "affected_subscriptions", + core.serialization.number().optional(), + ), +}); + +export declare namespace BulkSwapPlanResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + affected_subscriptions?: number | null; + } +} diff --git a/src/serialization/types/BulkUpdateCustomerData.ts b/src/serialization/types/BulkUpdateCustomerData.ts new file mode 100644 index 000000000..d496cc57a --- /dev/null +++ b/src/serialization/types/BulkUpdateCustomerData.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; +import { CustomerTaxIds } from "./CustomerTaxIds"; + +export const BulkUpdateCustomerData: core.serialization.ObjectSchema< + serializers.BulkUpdateCustomerData.Raw, + Square.BulkUpdateCustomerData +> = core.serialization.object({ + givenName: core.serialization.property("given_name", core.serialization.string().optionalNullable()), + familyName: core.serialization.property("family_name", core.serialization.string().optionalNullable()), + companyName: core.serialization.property("company_name", core.serialization.string().optionalNullable()), + nickname: core.serialization.string().optionalNullable(), + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + address: Address.optional(), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + note: core.serialization.string().optionalNullable(), + birthday: core.serialization.string().optionalNullable(), + taxIds: core.serialization.property("tax_ids", CustomerTaxIds.optional()), + version: core.serialization.bigint().optional(), +}); + +export declare namespace BulkUpdateCustomerData { + export interface Raw { + given_name?: (string | null) | null; + family_name?: (string | null) | null; + company_name?: (string | null) | null; + nickname?: (string | null) | null; + email_address?: (string | null) | null; + address?: Address.Raw | null; + phone_number?: (string | null) | null; + reference_id?: (string | null) | null; + note?: (string | null) | null; + birthday?: (string | null) | null; + tax_ids?: CustomerTaxIds.Raw | null; + version?: (bigint | number) | null; + } +} diff --git a/src/serialization/types/BulkUpdateCustomersResponse.ts b/src/serialization/types/BulkUpdateCustomersResponse.ts new file mode 100644 index 000000000..07cb6cb3e --- /dev/null +++ b/src/serialization/types/BulkUpdateCustomersResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { UpdateCustomerResponse } from "./UpdateCustomerResponse"; +import { Error_ } from "./Error_"; + +export const BulkUpdateCustomersResponse: core.serialization.ObjectSchema< + serializers.BulkUpdateCustomersResponse.Raw, + Square.BulkUpdateCustomersResponse +> = core.serialization.object({ + responses: core.serialization.record(core.serialization.string(), UpdateCustomerResponse).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkUpdateCustomersResponse { + export interface Raw { + responses?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkUpsertBookingCustomAttributesResponse.ts b/src/serialization/types/BulkUpsertBookingCustomAttributesResponse.ts new file mode 100644 index 000000000..d155e7850 --- /dev/null +++ b/src/serialization/types/BulkUpsertBookingCustomAttributesResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BookingCustomAttributeUpsertResponse } from "./BookingCustomAttributeUpsertResponse"; +import { Error_ } from "./Error_"; + +export const BulkUpsertBookingCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BulkUpsertBookingCustomAttributesResponse.Raw, + Square.BulkUpsertBookingCustomAttributesResponse +> = core.serialization.object({ + values: core.serialization.record(core.serialization.string(), BookingCustomAttributeUpsertResponse).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkUpsertBookingCustomAttributesResponse { + export interface Raw { + values?: Record | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts b/src/serialization/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts new file mode 100644 index 000000000..b4c2f7b5c --- /dev/null +++ b/src/serialization/types/BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; + +export const BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest: core.serialization.ObjectSchema< + serializers.BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest.Raw, + Square.BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string()), + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest { + export interface Raw { + location_id: string; + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/types/BulkUpsertLocationCustomAttributesResponse.ts b/src/serialization/types/BulkUpsertLocationCustomAttributesResponse.ts new file mode 100644 index 000000000..85a6fbbed --- /dev/null +++ b/src/serialization/types/BulkUpsertLocationCustomAttributesResponse.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse } from "./BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse"; +import { Error_ } from "./Error_"; + +export const BulkUpsertLocationCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BulkUpsertLocationCustomAttributesResponse.Raw, + Square.BulkUpsertLocationCustomAttributesResponse +> = core.serialization.object({ + values: core.serialization + .record( + core.serialization.string(), + BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse, + ) + .optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkUpsertLocationCustomAttributesResponse { + export interface Raw { + values?: Record< + string, + BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.Raw + > | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts b/src/serialization/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts new file mode 100644 index 000000000..2742b461c --- /dev/null +++ b/src/serialization/types/BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse: core.serialization.ObjectSchema< + serializers.BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse.Raw, + Square.BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse { + export interface Raw { + location_id?: string | null; + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts b/src/serialization/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts new file mode 100644 index 000000000..1a0307bc8 --- /dev/null +++ b/src/serialization/types/BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; + +export const BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest: core.serialization.ObjectSchema< + serializers.BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest.Raw, + Square.BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest +> = core.serialization.object({ + merchantId: core.serialization.property("merchant_id", core.serialization.string()), + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), +}); + +export declare namespace BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest { + export interface Raw { + merchant_id: string; + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + } +} diff --git a/src/serialization/types/BulkUpsertMerchantCustomAttributesResponse.ts b/src/serialization/types/BulkUpsertMerchantCustomAttributesResponse.ts new file mode 100644 index 000000000..14fdbfe1d --- /dev/null +++ b/src/serialization/types/BulkUpsertMerchantCustomAttributesResponse.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse } from "./BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse"; +import { Error_ } from "./Error_"; + +export const BulkUpsertMerchantCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BulkUpsertMerchantCustomAttributesResponse.Raw, + Square.BulkUpsertMerchantCustomAttributesResponse +> = core.serialization.object({ + values: core.serialization + .record( + core.serialization.string(), + BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse, + ) + .optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkUpsertMerchantCustomAttributesResponse { + export interface Raw { + values?: Record< + string, + BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.Raw + > | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts b/src/serialization/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts new file mode 100644 index 000000000..479912102 --- /dev/null +++ b/src/serialization/types/BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse: core.serialization.ObjectSchema< + serializers.BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse.Raw, + Square.BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse +> = core.serialization.object({ + merchantId: core.serialization.property("merchant_id", core.serialization.string().optional()), + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse { + export interface Raw { + merchant_id?: string | null; + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts b/src/serialization/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts new file mode 100644 index 000000000..01fb99457 --- /dev/null +++ b/src/serialization/types/BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; + +export const BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute: core.serialization.ObjectSchema< + serializers.BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute.Raw, + Square.BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), + orderId: core.serialization.property("order_id", core.serialization.string()), +}); + +export declare namespace BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute { + export interface Raw { + custom_attribute: CustomAttribute.Raw; + idempotency_key?: (string | null) | null; + order_id: string; + } +} diff --git a/src/serialization/types/BulkUpsertOrderCustomAttributesResponse.ts b/src/serialization/types/BulkUpsertOrderCustomAttributesResponse.ts new file mode 100644 index 000000000..814fb79fa --- /dev/null +++ b/src/serialization/types/BulkUpsertOrderCustomAttributesResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { UpsertOrderCustomAttributeResponse } from "./UpsertOrderCustomAttributeResponse"; + +export const BulkUpsertOrderCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.BulkUpsertOrderCustomAttributesResponse.Raw, + Square.BulkUpsertOrderCustomAttributesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + values: core.serialization.record(core.serialization.string(), UpsertOrderCustomAttributeResponse), +}); + +export declare namespace BulkUpsertOrderCustomAttributesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + values: Record; + } +} diff --git a/src/serialization/types/BusinessAppointmentSettings.ts b/src/serialization/types/BusinessAppointmentSettings.ts new file mode 100644 index 000000000..bcb5b8250 --- /dev/null +++ b/src/serialization/types/BusinessAppointmentSettings.ts @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BusinessAppointmentSettingsBookingLocationType } from "./BusinessAppointmentSettingsBookingLocationType"; +import { BusinessAppointmentSettingsAlignmentTime } from "./BusinessAppointmentSettingsAlignmentTime"; +import { BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType } from "./BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType"; +import { Money } from "./Money"; +import { BusinessAppointmentSettingsCancellationPolicy } from "./BusinessAppointmentSettingsCancellationPolicy"; + +export const BusinessAppointmentSettings: core.serialization.ObjectSchema< + serializers.BusinessAppointmentSettings.Raw, + Square.BusinessAppointmentSettings +> = core.serialization.object({ + locationTypes: core.serialization.property( + "location_types", + core.serialization.list(BusinessAppointmentSettingsBookingLocationType).optionalNullable(), + ), + alignmentTime: core.serialization.property("alignment_time", BusinessAppointmentSettingsAlignmentTime.optional()), + minBookingLeadTimeSeconds: core.serialization.property( + "min_booking_lead_time_seconds", + core.serialization.number().optionalNullable(), + ), + maxBookingLeadTimeSeconds: core.serialization.property( + "max_booking_lead_time_seconds", + core.serialization.number().optionalNullable(), + ), + anyTeamMemberBookingEnabled: core.serialization.property( + "any_team_member_booking_enabled", + core.serialization.boolean().optionalNullable(), + ), + multipleServiceBookingEnabled: core.serialization.property( + "multiple_service_booking_enabled", + core.serialization.boolean().optionalNullable(), + ), + maxAppointmentsPerDayLimitType: core.serialization.property( + "max_appointments_per_day_limit_type", + BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.optional(), + ), + maxAppointmentsPerDayLimit: core.serialization.property( + "max_appointments_per_day_limit", + core.serialization.number().optionalNullable(), + ), + cancellationWindowSeconds: core.serialization.property( + "cancellation_window_seconds", + core.serialization.number().optionalNullable(), + ), + cancellationFeeMoney: core.serialization.property("cancellation_fee_money", Money.optional()), + cancellationPolicy: core.serialization.property( + "cancellation_policy", + BusinessAppointmentSettingsCancellationPolicy.optional(), + ), + cancellationPolicyText: core.serialization.property( + "cancellation_policy_text", + core.serialization.string().optionalNullable(), + ), + skipBookingFlowStaffSelection: core.serialization.property( + "skip_booking_flow_staff_selection", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace BusinessAppointmentSettings { + export interface Raw { + location_types?: (BusinessAppointmentSettingsBookingLocationType.Raw[] | null) | null; + alignment_time?: BusinessAppointmentSettingsAlignmentTime.Raw | null; + min_booking_lead_time_seconds?: (number | null) | null; + max_booking_lead_time_seconds?: (number | null) | null; + any_team_member_booking_enabled?: (boolean | null) | null; + multiple_service_booking_enabled?: (boolean | null) | null; + max_appointments_per_day_limit_type?: BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.Raw | null; + max_appointments_per_day_limit?: (number | null) | null; + cancellation_window_seconds?: (number | null) | null; + cancellation_fee_money?: Money.Raw | null; + cancellation_policy?: BusinessAppointmentSettingsCancellationPolicy.Raw | null; + cancellation_policy_text?: (string | null) | null; + skip_booking_flow_staff_selection?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/BusinessAppointmentSettingsAlignmentTime.ts b/src/serialization/types/BusinessAppointmentSettingsAlignmentTime.ts new file mode 100644 index 000000000..b0eaf681a --- /dev/null +++ b/src/serialization/types/BusinessAppointmentSettingsAlignmentTime.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BusinessAppointmentSettingsAlignmentTime: core.serialization.Schema< + serializers.BusinessAppointmentSettingsAlignmentTime.Raw, + Square.BusinessAppointmentSettingsAlignmentTime +> = core.serialization.enum_(["SERVICE_DURATION", "QUARTER_HOURLY", "HALF_HOURLY", "HOURLY"]); + +export declare namespace BusinessAppointmentSettingsAlignmentTime { + export type Raw = "SERVICE_DURATION" | "QUARTER_HOURLY" | "HALF_HOURLY" | "HOURLY"; +} diff --git a/src/serialization/types/BusinessAppointmentSettingsBookingLocationType.ts b/src/serialization/types/BusinessAppointmentSettingsBookingLocationType.ts new file mode 100644 index 000000000..bcb0aa343 --- /dev/null +++ b/src/serialization/types/BusinessAppointmentSettingsBookingLocationType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BusinessAppointmentSettingsBookingLocationType: core.serialization.Schema< + serializers.BusinessAppointmentSettingsBookingLocationType.Raw, + Square.BusinessAppointmentSettingsBookingLocationType +> = core.serialization.enum_(["BUSINESS_LOCATION", "CUSTOMER_LOCATION", "PHONE"]); + +export declare namespace BusinessAppointmentSettingsBookingLocationType { + export type Raw = "BUSINESS_LOCATION" | "CUSTOMER_LOCATION" | "PHONE"; +} diff --git a/src/serialization/types/BusinessAppointmentSettingsCancellationPolicy.ts b/src/serialization/types/BusinessAppointmentSettingsCancellationPolicy.ts new file mode 100644 index 000000000..018750741 --- /dev/null +++ b/src/serialization/types/BusinessAppointmentSettingsCancellationPolicy.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BusinessAppointmentSettingsCancellationPolicy: core.serialization.Schema< + serializers.BusinessAppointmentSettingsCancellationPolicy.Raw, + Square.BusinessAppointmentSettingsCancellationPolicy +> = core.serialization.enum_(["CANCELLATION_TREATED_AS_NO_SHOW", "CUSTOM_POLICY"]); + +export declare namespace BusinessAppointmentSettingsCancellationPolicy { + export type Raw = "CANCELLATION_TREATED_AS_NO_SHOW" | "CUSTOM_POLICY"; +} diff --git a/src/serialization/types/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.ts b/src/serialization/types/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.ts new file mode 100644 index 000000000..8441815be --- /dev/null +++ b/src/serialization/types/BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType: core.serialization.Schema< + serializers.BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType.Raw, + Square.BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType +> = core.serialization.enum_(["PER_TEAM_MEMBER", "PER_LOCATION"]); + +export declare namespace BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType { + export type Raw = "PER_TEAM_MEMBER" | "PER_LOCATION"; +} diff --git a/src/serialization/types/BusinessBookingProfile.ts b/src/serialization/types/BusinessBookingProfile.ts new file mode 100644 index 000000000..4176f585b --- /dev/null +++ b/src/serialization/types/BusinessBookingProfile.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BusinessBookingProfileCustomerTimezoneChoice } from "./BusinessBookingProfileCustomerTimezoneChoice"; +import { BusinessBookingProfileBookingPolicy } from "./BusinessBookingProfileBookingPolicy"; +import { BusinessAppointmentSettings } from "./BusinessAppointmentSettings"; + +export const BusinessBookingProfile: core.serialization.ObjectSchema< + serializers.BusinessBookingProfile.Raw, + Square.BusinessBookingProfile +> = core.serialization.object({ + sellerId: core.serialization.property("seller_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + bookingEnabled: core.serialization.property("booking_enabled", core.serialization.boolean().optionalNullable()), + customerTimezoneChoice: core.serialization.property( + "customer_timezone_choice", + BusinessBookingProfileCustomerTimezoneChoice.optional(), + ), + bookingPolicy: core.serialization.property("booking_policy", BusinessBookingProfileBookingPolicy.optional()), + allowUserCancel: core.serialization.property("allow_user_cancel", core.serialization.boolean().optionalNullable()), + businessAppointmentSettings: core.serialization.property( + "business_appointment_settings", + BusinessAppointmentSettings.optional(), + ), + supportSellerLevelWrites: core.serialization.property( + "support_seller_level_writes", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace BusinessBookingProfile { + export interface Raw { + seller_id?: (string | null) | null; + created_at?: string | null; + booking_enabled?: (boolean | null) | null; + customer_timezone_choice?: BusinessBookingProfileCustomerTimezoneChoice.Raw | null; + booking_policy?: BusinessBookingProfileBookingPolicy.Raw | null; + allow_user_cancel?: (boolean | null) | null; + business_appointment_settings?: BusinessAppointmentSettings.Raw | null; + support_seller_level_writes?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/BusinessBookingProfileBookingPolicy.ts b/src/serialization/types/BusinessBookingProfileBookingPolicy.ts new file mode 100644 index 000000000..26f3122b0 --- /dev/null +++ b/src/serialization/types/BusinessBookingProfileBookingPolicy.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BusinessBookingProfileBookingPolicy: core.serialization.Schema< + serializers.BusinessBookingProfileBookingPolicy.Raw, + Square.BusinessBookingProfileBookingPolicy +> = core.serialization.enum_(["ACCEPT_ALL", "REQUIRES_ACCEPTANCE"]); + +export declare namespace BusinessBookingProfileBookingPolicy { + export type Raw = "ACCEPT_ALL" | "REQUIRES_ACCEPTANCE"; +} diff --git a/src/serialization/types/BusinessBookingProfileCustomerTimezoneChoice.ts b/src/serialization/types/BusinessBookingProfileCustomerTimezoneChoice.ts new file mode 100644 index 000000000..e4b5e2f3c --- /dev/null +++ b/src/serialization/types/BusinessBookingProfileCustomerTimezoneChoice.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const BusinessBookingProfileCustomerTimezoneChoice: core.serialization.Schema< + serializers.BusinessBookingProfileCustomerTimezoneChoice.Raw, + Square.BusinessBookingProfileCustomerTimezoneChoice +> = core.serialization.enum_(["BUSINESS_LOCATION_TIMEZONE", "CUSTOMER_CHOICE"]); + +export declare namespace BusinessBookingProfileCustomerTimezoneChoice { + export type Raw = "BUSINESS_LOCATION_TIMEZONE" | "CUSTOMER_CHOICE"; +} diff --git a/src/serialization/types/BusinessHours.ts b/src/serialization/types/BusinessHours.ts new file mode 100644 index 000000000..56f2933eb --- /dev/null +++ b/src/serialization/types/BusinessHours.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BusinessHoursPeriod } from "./BusinessHoursPeriod"; + +export const BusinessHours: core.serialization.ObjectSchema = + core.serialization.object({ + periods: core.serialization.list(BusinessHoursPeriod).optionalNullable(), + }); + +export declare namespace BusinessHours { + export interface Raw { + periods?: (BusinessHoursPeriod.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/BusinessHoursPeriod.ts b/src/serialization/types/BusinessHoursPeriod.ts new file mode 100644 index 000000000..40b8a7c3f --- /dev/null +++ b/src/serialization/types/BusinessHoursPeriod.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DayOfWeek } from "./DayOfWeek"; + +export const BusinessHoursPeriod: core.serialization.ObjectSchema< + serializers.BusinessHoursPeriod.Raw, + Square.BusinessHoursPeriod +> = core.serialization.object({ + dayOfWeek: core.serialization.property("day_of_week", DayOfWeek.optional()), + startLocalTime: core.serialization.property("start_local_time", core.serialization.string().optionalNullable()), + endLocalTime: core.serialization.property("end_local_time", core.serialization.string().optionalNullable()), +}); + +export declare namespace BusinessHoursPeriod { + export interface Raw { + day_of_week?: DayOfWeek.Raw | null; + start_local_time?: (string | null) | null; + end_local_time?: (string | null) | null; + } +} diff --git a/src/serialization/types/BuyNowPayLaterDetails.ts b/src/serialization/types/BuyNowPayLaterDetails.ts new file mode 100644 index 000000000..85ad8fef6 --- /dev/null +++ b/src/serialization/types/BuyNowPayLaterDetails.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { AfterpayDetails } from "./AfterpayDetails"; +import { ClearpayDetails } from "./ClearpayDetails"; + +export const BuyNowPayLaterDetails: core.serialization.ObjectSchema< + serializers.BuyNowPayLaterDetails.Raw, + Square.BuyNowPayLaterDetails +> = core.serialization.object({ + brand: core.serialization.string().optionalNullable(), + afterpayDetails: core.serialization.property("afterpay_details", AfterpayDetails.optional()), + clearpayDetails: core.serialization.property("clearpay_details", ClearpayDetails.optional()), +}); + +export declare namespace BuyNowPayLaterDetails { + export interface Raw { + brand?: (string | null) | null; + afterpay_details?: AfterpayDetails.Raw | null; + clearpay_details?: ClearpayDetails.Raw | null; + } +} diff --git a/src/serialization/types/CalculateLoyaltyPointsResponse.ts b/src/serialization/types/CalculateLoyaltyPointsResponse.ts new file mode 100644 index 000000000..f55b9a1e9 --- /dev/null +++ b/src/serialization/types/CalculateLoyaltyPointsResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const CalculateLoyaltyPointsResponse: core.serialization.ObjectSchema< + serializers.CalculateLoyaltyPointsResponse.Raw, + Square.CalculateLoyaltyPointsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + points: core.serialization.number().optional(), + promotionPoints: core.serialization.property("promotion_points", core.serialization.number().optional()), +}); + +export declare namespace CalculateLoyaltyPointsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + points?: number | null; + promotion_points?: number | null; + } +} diff --git a/src/serialization/types/CalculateOrderResponse.ts b/src/serialization/types/CalculateOrderResponse.ts new file mode 100644 index 000000000..71bf0952f --- /dev/null +++ b/src/serialization/types/CalculateOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Order } from "./Order"; +import { Error_ } from "./Error_"; + +export const CalculateOrderResponse: core.serialization.ObjectSchema< + serializers.CalculateOrderResponse.Raw, + Square.CalculateOrderResponse +> = core.serialization.object({ + order: Order.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CalculateOrderResponse { + export interface Raw { + order?: Order.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CancelBookingResponse.ts b/src/serialization/types/CancelBookingResponse.ts new file mode 100644 index 000000000..7a455c8f3 --- /dev/null +++ b/src/serialization/types/CancelBookingResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Booking } from "./Booking"; +import { Error_ } from "./Error_"; + +export const CancelBookingResponse: core.serialization.ObjectSchema< + serializers.CancelBookingResponse.Raw, + Square.CancelBookingResponse +> = core.serialization.object({ + booking: Booking.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CancelBookingResponse { + export interface Raw { + booking?: Booking.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CancelInvoiceResponse.ts b/src/serialization/types/CancelInvoiceResponse.ts new file mode 100644 index 000000000..e85152eca --- /dev/null +++ b/src/serialization/types/CancelInvoiceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Invoice } from "./Invoice"; +import { Error_ } from "./Error_"; + +export const CancelInvoiceResponse: core.serialization.ObjectSchema< + serializers.CancelInvoiceResponse.Raw, + Square.CancelInvoiceResponse +> = core.serialization.object({ + invoice: Invoice.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CancelInvoiceResponse { + export interface Raw { + invoice?: Invoice.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CancelLoyaltyPromotionResponse.ts b/src/serialization/types/CancelLoyaltyPromotionResponse.ts new file mode 100644 index 000000000..fe7840e2a --- /dev/null +++ b/src/serialization/types/CancelLoyaltyPromotionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyPromotion } from "./LoyaltyPromotion"; + +export const CancelLoyaltyPromotionResponse: core.serialization.ObjectSchema< + serializers.CancelLoyaltyPromotionResponse.Raw, + Square.CancelLoyaltyPromotionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + loyaltyPromotion: core.serialization.property("loyalty_promotion", LoyaltyPromotion.optional()), +}); + +export declare namespace CancelLoyaltyPromotionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + loyalty_promotion?: LoyaltyPromotion.Raw | null; + } +} diff --git a/src/serialization/types/CancelPaymentByIdempotencyKeyResponse.ts b/src/serialization/types/CancelPaymentByIdempotencyKeyResponse.ts new file mode 100644 index 000000000..993515cc7 --- /dev/null +++ b/src/serialization/types/CancelPaymentByIdempotencyKeyResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const CancelPaymentByIdempotencyKeyResponse: core.serialization.ObjectSchema< + serializers.CancelPaymentByIdempotencyKeyResponse.Raw, + Square.CancelPaymentByIdempotencyKeyResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CancelPaymentByIdempotencyKeyResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CancelPaymentResponse.ts b/src/serialization/types/CancelPaymentResponse.ts new file mode 100644 index 000000000..ba792ef0a --- /dev/null +++ b/src/serialization/types/CancelPaymentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Payment } from "./Payment"; + +export const CancelPaymentResponse: core.serialization.ObjectSchema< + serializers.CancelPaymentResponse.Raw, + Square.CancelPaymentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + payment: Payment.optional(), +}); + +export declare namespace CancelPaymentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment?: Payment.Raw | null; + } +} diff --git a/src/serialization/types/CancelSubscriptionResponse.ts b/src/serialization/types/CancelSubscriptionResponse.ts new file mode 100644 index 000000000..bb2577e84 --- /dev/null +++ b/src/serialization/types/CancelSubscriptionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; +import { SubscriptionAction } from "./SubscriptionAction"; + +export const CancelSubscriptionResponse: core.serialization.ObjectSchema< + serializers.CancelSubscriptionResponse.Raw, + Square.CancelSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), + actions: core.serialization.list(SubscriptionAction).optional(), +}); + +export declare namespace CancelSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + actions?: SubscriptionAction.Raw[] | null; + } +} diff --git a/src/serialization/types/CancelTerminalActionResponse.ts b/src/serialization/types/CancelTerminalActionResponse.ts new file mode 100644 index 000000000..e3b133ea0 --- /dev/null +++ b/src/serialization/types/CancelTerminalActionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalAction } from "./TerminalAction"; + +export const CancelTerminalActionResponse: core.serialization.ObjectSchema< + serializers.CancelTerminalActionResponse.Raw, + Square.CancelTerminalActionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + action: TerminalAction.optional(), +}); + +export declare namespace CancelTerminalActionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + action?: TerminalAction.Raw | null; + } +} diff --git a/src/serialization/types/CancelTerminalCheckoutResponse.ts b/src/serialization/types/CancelTerminalCheckoutResponse.ts new file mode 100644 index 000000000..b596aea2b --- /dev/null +++ b/src/serialization/types/CancelTerminalCheckoutResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalCheckout } from "./TerminalCheckout"; + +export const CancelTerminalCheckoutResponse: core.serialization.ObjectSchema< + serializers.CancelTerminalCheckoutResponse.Raw, + Square.CancelTerminalCheckoutResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + checkout: TerminalCheckout.optional(), +}); + +export declare namespace CancelTerminalCheckoutResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + checkout?: TerminalCheckout.Raw | null; + } +} diff --git a/src/serialization/types/CancelTerminalRefundResponse.ts b/src/serialization/types/CancelTerminalRefundResponse.ts new file mode 100644 index 000000000..744ed00a3 --- /dev/null +++ b/src/serialization/types/CancelTerminalRefundResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalRefund } from "./TerminalRefund"; + +export const CancelTerminalRefundResponse: core.serialization.ObjectSchema< + serializers.CancelTerminalRefundResponse.Raw, + Square.CancelTerminalRefundResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + refund: TerminalRefund.optional(), +}); + +export declare namespace CancelTerminalRefundResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + refund?: TerminalRefund.Raw | null; + } +} diff --git a/src/serialization/types/CaptureTransactionResponse.ts b/src/serialization/types/CaptureTransactionResponse.ts new file mode 100644 index 000000000..548384cf9 --- /dev/null +++ b/src/serialization/types/CaptureTransactionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const CaptureTransactionResponse: core.serialization.ObjectSchema< + serializers.CaptureTransactionResponse.Raw, + Square.CaptureTransactionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CaptureTransactionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/Card.ts b/src/serialization/types/Card.ts new file mode 100644 index 000000000..5e62cbd1d --- /dev/null +++ b/src/serialization/types/Card.ts @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CardBrand } from "./CardBrand"; +import { Address } from "./Address"; +import { CardType } from "./CardType"; +import { CardPrepaidType } from "./CardPrepaidType"; +import { CardCoBrand } from "./CardCoBrand"; + +export const Card: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + cardBrand: core.serialization.property("card_brand", CardBrand.optional()), + last4: core.serialization.property("last_4", core.serialization.string().optional()), + expMonth: core.serialization.property("exp_month", core.serialization.bigint().optionalNullable()), + expYear: core.serialization.property("exp_year", core.serialization.bigint().optionalNullable()), + cardholderName: core.serialization.property("cardholder_name", core.serialization.string().optionalNullable()), + billingAddress: core.serialization.property("billing_address", Address.optional()), + fingerprint: core.serialization.string().optional(), + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + merchantId: core.serialization.property("merchant_id", core.serialization.string().optional()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + enabled: core.serialization.boolean().optional(), + cardType: core.serialization.property("card_type", CardType.optional()), + prepaidType: core.serialization.property("prepaid_type", CardPrepaidType.optional()), + bin: core.serialization.string().optional(), + version: core.serialization.bigint().optional(), + cardCoBrand: core.serialization.property("card_co_brand", CardCoBrand.optional()), +}); + +export declare namespace Card { + export interface Raw { + id?: string | null; + card_brand?: CardBrand.Raw | null; + last_4?: string | null; + exp_month?: ((bigint | number) | null) | null; + exp_year?: ((bigint | number) | null) | null; + cardholder_name?: (string | null) | null; + billing_address?: Address.Raw | null; + fingerprint?: string | null; + customer_id?: (string | null) | null; + merchant_id?: string | null; + reference_id?: (string | null) | null; + enabled?: boolean | null; + card_type?: CardType.Raw | null; + prepaid_type?: CardPrepaidType.Raw | null; + bin?: string | null; + version?: (bigint | number) | null; + card_co_brand?: CardCoBrand.Raw | null; + } +} diff --git a/src/serialization/types/CardBrand.ts b/src/serialization/types/CardBrand.ts new file mode 100644 index 000000000..c42e88c83 --- /dev/null +++ b/src/serialization/types/CardBrand.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CardBrand: core.serialization.Schema = + core.serialization.enum_([ + "OTHER_BRAND", + "VISA", + "MASTERCARD", + "AMERICAN_EXPRESS", + "DISCOVER", + "DISCOVER_DINERS", + "JCB", + "CHINA_UNIONPAY", + "SQUARE_GIFT_CARD", + "SQUARE_CAPITAL_CARD", + "INTERAC", + "EFTPOS", + "FELICA", + "EBT", + ]); + +export declare namespace CardBrand { + export type Raw = + | "OTHER_BRAND" + | "VISA" + | "MASTERCARD" + | "AMERICAN_EXPRESS" + | "DISCOVER" + | "DISCOVER_DINERS" + | "JCB" + | "CHINA_UNIONPAY" + | "SQUARE_GIFT_CARD" + | "SQUARE_CAPITAL_CARD" + | "INTERAC" + | "EFTPOS" + | "FELICA" + | "EBT"; +} diff --git a/src/serialization/types/CardCoBrand.ts b/src/serialization/types/CardCoBrand.ts new file mode 100644 index 000000000..61e447c20 --- /dev/null +++ b/src/serialization/types/CardCoBrand.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CardCoBrand: core.serialization.Schema = + core.serialization.enum_(["UNKNOWN", "AFTERPAY", "CLEARPAY"]); + +export declare namespace CardCoBrand { + export type Raw = "UNKNOWN" | "AFTERPAY" | "CLEARPAY"; +} diff --git a/src/serialization/types/CardPaymentDetails.ts b/src/serialization/types/CardPaymentDetails.ts new file mode 100644 index 000000000..a7be16b2c --- /dev/null +++ b/src/serialization/types/CardPaymentDetails.ts @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Card } from "./Card"; +import { DeviceDetails } from "./DeviceDetails"; +import { CardPaymentTimeline } from "./CardPaymentTimeline"; +import { Error_ } from "./Error_"; + +export const CardPaymentDetails: core.serialization.ObjectSchema< + serializers.CardPaymentDetails.Raw, + Square.CardPaymentDetails +> = core.serialization.object({ + status: core.serialization.string().optionalNullable(), + card: Card.optional(), + entryMethod: core.serialization.property("entry_method", core.serialization.string().optionalNullable()), + cvvStatus: core.serialization.property("cvv_status", core.serialization.string().optionalNullable()), + avsStatus: core.serialization.property("avs_status", core.serialization.string().optionalNullable()), + authResultCode: core.serialization.property("auth_result_code", core.serialization.string().optionalNullable()), + applicationIdentifier: core.serialization.property( + "application_identifier", + core.serialization.string().optionalNullable(), + ), + applicationName: core.serialization.property("application_name", core.serialization.string().optionalNullable()), + applicationCryptogram: core.serialization.property( + "application_cryptogram", + core.serialization.string().optionalNullable(), + ), + verificationMethod: core.serialization.property( + "verification_method", + core.serialization.string().optionalNullable(), + ), + verificationResults: core.serialization.property( + "verification_results", + core.serialization.string().optionalNullable(), + ), + statementDescription: core.serialization.property( + "statement_description", + core.serialization.string().optionalNullable(), + ), + deviceDetails: core.serialization.property("device_details", DeviceDetails.optional()), + cardPaymentTimeline: core.serialization.property("card_payment_timeline", CardPaymentTimeline.optional()), + refundRequiresCardPresence: core.serialization.property( + "refund_requires_card_presence", + core.serialization.boolean().optionalNullable(), + ), + errors: core.serialization.list(Error_).optionalNullable(), +}); + +export declare namespace CardPaymentDetails { + export interface Raw { + status?: (string | null) | null; + card?: Card.Raw | null; + entry_method?: (string | null) | null; + cvv_status?: (string | null) | null; + avs_status?: (string | null) | null; + auth_result_code?: (string | null) | null; + application_identifier?: (string | null) | null; + application_name?: (string | null) | null; + application_cryptogram?: (string | null) | null; + verification_method?: (string | null) | null; + verification_results?: (string | null) | null; + statement_description?: (string | null) | null; + device_details?: DeviceDetails.Raw | null; + card_payment_timeline?: CardPaymentTimeline.Raw | null; + refund_requires_card_presence?: (boolean | null) | null; + errors?: (Error_.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/CardPaymentTimeline.ts b/src/serialization/types/CardPaymentTimeline.ts new file mode 100644 index 000000000..8c3915d0c --- /dev/null +++ b/src/serialization/types/CardPaymentTimeline.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CardPaymentTimeline: core.serialization.ObjectSchema< + serializers.CardPaymentTimeline.Raw, + Square.CardPaymentTimeline +> = core.serialization.object({ + authorizedAt: core.serialization.property("authorized_at", core.serialization.string().optionalNullable()), + capturedAt: core.serialization.property("captured_at", core.serialization.string().optionalNullable()), + voidedAt: core.serialization.property("voided_at", core.serialization.string().optionalNullable()), +}); + +export declare namespace CardPaymentTimeline { + export interface Raw { + authorized_at?: (string | null) | null; + captured_at?: (string | null) | null; + voided_at?: (string | null) | null; + } +} diff --git a/src/serialization/types/CardPrepaidType.ts b/src/serialization/types/CardPrepaidType.ts new file mode 100644 index 000000000..5a5e94558 --- /dev/null +++ b/src/serialization/types/CardPrepaidType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CardPrepaidType: core.serialization.Schema = + core.serialization.enum_(["UNKNOWN_PREPAID_TYPE", "NOT_PREPAID", "PREPAID"]); + +export declare namespace CardPrepaidType { + export type Raw = "UNKNOWN_PREPAID_TYPE" | "NOT_PREPAID" | "PREPAID"; +} diff --git a/src/serialization/types/CardType.ts b/src/serialization/types/CardType.ts new file mode 100644 index 000000000..c3f72ee5a --- /dev/null +++ b/src/serialization/types/CardType.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CardType: core.serialization.Schema = core.serialization.enum_([ + "UNKNOWN_CARD_TYPE", + "CREDIT", + "DEBIT", +]); + +export declare namespace CardType { + export type Raw = "UNKNOWN_CARD_TYPE" | "CREDIT" | "DEBIT"; +} diff --git a/src/serialization/types/CashAppDetails.ts b/src/serialization/types/CashAppDetails.ts new file mode 100644 index 000000000..0697dd1c6 --- /dev/null +++ b/src/serialization/types/CashAppDetails.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CashAppDetails: core.serialization.ObjectSchema = + core.serialization.object({ + buyerFullName: core.serialization.property("buyer_full_name", core.serialization.string().optionalNullable()), + buyerCountryCode: core.serialization.property( + "buyer_country_code", + core.serialization.string().optionalNullable(), + ), + buyerCashtag: core.serialization.property("buyer_cashtag", core.serialization.string().optional()), + }); + +export declare namespace CashAppDetails { + export interface Raw { + buyer_full_name?: (string | null) | null; + buyer_country_code?: (string | null) | null; + buyer_cashtag?: string | null; + } +} diff --git a/src/serialization/types/CashDrawerDevice.ts b/src/serialization/types/CashDrawerDevice.ts new file mode 100644 index 000000000..a55a13035 --- /dev/null +++ b/src/serialization/types/CashDrawerDevice.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CashDrawerDevice: core.serialization.ObjectSchema< + serializers.CashDrawerDevice.Raw, + Square.CashDrawerDevice +> = core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string().optionalNullable(), +}); + +export declare namespace CashDrawerDevice { + export interface Raw { + id?: string | null; + name?: (string | null) | null; + } +} diff --git a/src/serialization/types/CashDrawerEventType.ts b/src/serialization/types/CashDrawerEventType.ts new file mode 100644 index 000000000..79983e9a0 --- /dev/null +++ b/src/serialization/types/CashDrawerEventType.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CashDrawerEventType: core.serialization.Schema< + serializers.CashDrawerEventType.Raw, + Square.CashDrawerEventType +> = core.serialization.enum_([ + "NO_SALE", + "CASH_TENDER_PAYMENT", + "OTHER_TENDER_PAYMENT", + "CASH_TENDER_CANCELLED_PAYMENT", + "OTHER_TENDER_CANCELLED_PAYMENT", + "CASH_TENDER_REFUND", + "OTHER_TENDER_REFUND", + "PAID_IN", + "PAID_OUT", +]); + +export declare namespace CashDrawerEventType { + export type Raw = + | "NO_SALE" + | "CASH_TENDER_PAYMENT" + | "OTHER_TENDER_PAYMENT" + | "CASH_TENDER_CANCELLED_PAYMENT" + | "OTHER_TENDER_CANCELLED_PAYMENT" + | "CASH_TENDER_REFUND" + | "OTHER_TENDER_REFUND" + | "PAID_IN" + | "PAID_OUT"; +} diff --git a/src/serialization/types/CashDrawerShift.ts b/src/serialization/types/CashDrawerShift.ts new file mode 100644 index 000000000..b39d3ca00 --- /dev/null +++ b/src/serialization/types/CashDrawerShift.ts @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CashDrawerShiftState } from "./CashDrawerShiftState"; +import { Money } from "./Money"; +import { CashDrawerDevice } from "./CashDrawerDevice"; + +export const CashDrawerShift: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + state: CashDrawerShiftState.optional(), + openedAt: core.serialization.property("opened_at", core.serialization.string().optionalNullable()), + endedAt: core.serialization.property("ended_at", core.serialization.string().optionalNullable()), + closedAt: core.serialization.property("closed_at", core.serialization.string().optionalNullable()), + description: core.serialization.string().optionalNullable(), + openedCashMoney: core.serialization.property("opened_cash_money", Money.optional()), + cashPaymentMoney: core.serialization.property("cash_payment_money", Money.optional()), + cashRefundsMoney: core.serialization.property("cash_refunds_money", Money.optional()), + cashPaidInMoney: core.serialization.property("cash_paid_in_money", Money.optional()), + cashPaidOutMoney: core.serialization.property("cash_paid_out_money", Money.optional()), + expectedCashMoney: core.serialization.property("expected_cash_money", Money.optional()), + closedCashMoney: core.serialization.property("closed_cash_money", Money.optional()), + device: CashDrawerDevice.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + teamMemberIds: core.serialization.property( + "team_member_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + openingTeamMemberId: core.serialization.property( + "opening_team_member_id", + core.serialization.string().optional(), + ), + endingTeamMemberId: core.serialization.property( + "ending_team_member_id", + core.serialization.string().optional(), + ), + closingTeamMemberId: core.serialization.property( + "closing_team_member_id", + core.serialization.string().optional(), + ), + }); + +export declare namespace CashDrawerShift { + export interface Raw { + id?: string | null; + state?: CashDrawerShiftState.Raw | null; + opened_at?: (string | null) | null; + ended_at?: (string | null) | null; + closed_at?: (string | null) | null; + description?: (string | null) | null; + opened_cash_money?: Money.Raw | null; + cash_payment_money?: Money.Raw | null; + cash_refunds_money?: Money.Raw | null; + cash_paid_in_money?: Money.Raw | null; + cash_paid_out_money?: Money.Raw | null; + expected_cash_money?: Money.Raw | null; + closed_cash_money?: Money.Raw | null; + device?: CashDrawerDevice.Raw | null; + created_at?: string | null; + updated_at?: string | null; + location_id?: string | null; + team_member_ids?: string[] | null; + opening_team_member_id?: string | null; + ending_team_member_id?: string | null; + closing_team_member_id?: string | null; + } +} diff --git a/src/serialization/types/CashDrawerShiftEvent.ts b/src/serialization/types/CashDrawerShiftEvent.ts new file mode 100644 index 000000000..985d7ba91 --- /dev/null +++ b/src/serialization/types/CashDrawerShiftEvent.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CashDrawerEventType } from "./CashDrawerEventType"; +import { Money } from "./Money"; + +export const CashDrawerShiftEvent: core.serialization.ObjectSchema< + serializers.CashDrawerShiftEvent.Raw, + Square.CashDrawerShiftEvent +> = core.serialization.object({ + id: core.serialization.string().optional(), + eventType: core.serialization.property("event_type", CashDrawerEventType.optional()), + eventMoney: core.serialization.property("event_money", Money.optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + description: core.serialization.string().optionalNullable(), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optional()), +}); + +export declare namespace CashDrawerShiftEvent { + export interface Raw { + id?: string | null; + event_type?: CashDrawerEventType.Raw | null; + event_money?: Money.Raw | null; + created_at?: string | null; + description?: (string | null) | null; + team_member_id?: string | null; + } +} diff --git a/src/serialization/types/CashDrawerShiftState.ts b/src/serialization/types/CashDrawerShiftState.ts new file mode 100644 index 000000000..b12dcc804 --- /dev/null +++ b/src/serialization/types/CashDrawerShiftState.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CashDrawerShiftState: core.serialization.Schema< + serializers.CashDrawerShiftState.Raw, + Square.CashDrawerShiftState +> = core.serialization.enum_(["OPEN", "ENDED", "CLOSED"]); + +export declare namespace CashDrawerShiftState { + export type Raw = "OPEN" | "ENDED" | "CLOSED"; +} diff --git a/src/serialization/types/CashDrawerShiftSummary.ts b/src/serialization/types/CashDrawerShiftSummary.ts new file mode 100644 index 000000000..e9d476cac --- /dev/null +++ b/src/serialization/types/CashDrawerShiftSummary.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CashDrawerShiftState } from "./CashDrawerShiftState"; +import { Money } from "./Money"; + +export const CashDrawerShiftSummary: core.serialization.ObjectSchema< + serializers.CashDrawerShiftSummary.Raw, + Square.CashDrawerShiftSummary +> = core.serialization.object({ + id: core.serialization.string().optional(), + state: CashDrawerShiftState.optional(), + openedAt: core.serialization.property("opened_at", core.serialization.string().optionalNullable()), + endedAt: core.serialization.property("ended_at", core.serialization.string().optionalNullable()), + closedAt: core.serialization.property("closed_at", core.serialization.string().optionalNullable()), + description: core.serialization.string().optionalNullable(), + openedCashMoney: core.serialization.property("opened_cash_money", Money.optional()), + expectedCashMoney: core.serialization.property("expected_cash_money", Money.optional()), + closedCashMoney: core.serialization.property("closed_cash_money", Money.optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), +}); + +export declare namespace CashDrawerShiftSummary { + export interface Raw { + id?: string | null; + state?: CashDrawerShiftState.Raw | null; + opened_at?: (string | null) | null; + ended_at?: (string | null) | null; + closed_at?: (string | null) | null; + description?: (string | null) | null; + opened_cash_money?: Money.Raw | null; + expected_cash_money?: Money.Raw | null; + closed_cash_money?: Money.Raw | null; + created_at?: string | null; + updated_at?: string | null; + location_id?: string | null; + } +} diff --git a/src/serialization/types/CashPaymentDetails.ts b/src/serialization/types/CashPaymentDetails.ts new file mode 100644 index 000000000..022fc849c --- /dev/null +++ b/src/serialization/types/CashPaymentDetails.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const CashPaymentDetails: core.serialization.ObjectSchema< + serializers.CashPaymentDetails.Raw, + Square.CashPaymentDetails +> = core.serialization.object({ + buyerSuppliedMoney: core.serialization.property("buyer_supplied_money", Money), + changeBackMoney: core.serialization.property("change_back_money", Money.optional()), +}); + +export declare namespace CashPaymentDetails { + export interface Raw { + buyer_supplied_money: Money.Raw; + change_back_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/CatalogCategory.ts b/src/serialization/types/CatalogCategory.ts new file mode 100644 index 000000000..98df942d4 --- /dev/null +++ b/src/serialization/types/CatalogCategory.ts @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogCategoryType } from "./CatalogCategoryType"; +import { CatalogEcomSeoData } from "./CatalogEcomSeoData"; +import { CategoryPathToRootNode } from "./CategoryPathToRootNode"; + +export const CatalogCategory: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optionalNullable(), + imageIds: core.serialization.property( + "image_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + categoryType: core.serialization.property("category_type", CatalogCategoryType.optional()), + parentCategory: core.serialization.property( + "parent_category", + core.serialization.lazyObject(() => serializers.CatalogObjectCategory).optional(), + ), + isTopLevel: core.serialization.property("is_top_level", core.serialization.boolean().optionalNullable()), + channels: core.serialization.list(core.serialization.string()).optionalNullable(), + availabilityPeriodIds: core.serialization.property( + "availability_period_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + onlineVisibility: core.serialization.property( + "online_visibility", + core.serialization.boolean().optionalNullable(), + ), + rootCategory: core.serialization.property("root_category", core.serialization.string().optional()), + ecomSeoData: core.serialization.property("ecom_seo_data", CatalogEcomSeoData.optional()), + pathToRoot: core.serialization.property( + "path_to_root", + core.serialization.list(CategoryPathToRootNode).optionalNullable(), + ), + }); + +export declare namespace CatalogCategory { + export interface Raw { + name?: (string | null) | null; + image_ids?: (string[] | null) | null; + category_type?: CatalogCategoryType.Raw | null; + parent_category?: serializers.CatalogObjectCategory.Raw | null; + is_top_level?: (boolean | null) | null; + channels?: (string[] | null) | null; + availability_period_ids?: (string[] | null) | null; + online_visibility?: (boolean | null) | null; + root_category?: string | null; + ecom_seo_data?: CatalogEcomSeoData.Raw | null; + path_to_root?: (CategoryPathToRootNode.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/CatalogCategoryType.ts b/src/serialization/types/CatalogCategoryType.ts new file mode 100644 index 000000000..46d0a9ab3 --- /dev/null +++ b/src/serialization/types/CatalogCategoryType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogCategoryType: core.serialization.Schema< + serializers.CatalogCategoryType.Raw, + Square.CatalogCategoryType +> = core.serialization.enum_(["REGULAR_CATEGORY", "MENU_CATEGORY", "KITCHEN_CATEGORY"]); + +export declare namespace CatalogCategoryType { + export type Raw = "REGULAR_CATEGORY" | "MENU_CATEGORY" | "KITCHEN_CATEGORY"; +} diff --git a/src/serialization/types/CatalogCustomAttributeDefinition.ts b/src/serialization/types/CatalogCustomAttributeDefinition.ts new file mode 100644 index 000000000..02345011a --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeDefinition.ts @@ -0,0 +1,62 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogCustomAttributeDefinitionType } from "./CatalogCustomAttributeDefinitionType"; +import { SourceApplication } from "./SourceApplication"; +import { CatalogObjectType } from "./CatalogObjectType"; +import { CatalogCustomAttributeDefinitionSellerVisibility } from "./CatalogCustomAttributeDefinitionSellerVisibility"; +import { CatalogCustomAttributeDefinitionAppVisibility } from "./CatalogCustomAttributeDefinitionAppVisibility"; +import { CatalogCustomAttributeDefinitionStringConfig } from "./CatalogCustomAttributeDefinitionStringConfig"; +import { CatalogCustomAttributeDefinitionNumberConfig } from "./CatalogCustomAttributeDefinitionNumberConfig"; +import { CatalogCustomAttributeDefinitionSelectionConfig } from "./CatalogCustomAttributeDefinitionSelectionConfig"; + +export const CatalogCustomAttributeDefinition: core.serialization.ObjectSchema< + serializers.CatalogCustomAttributeDefinition.Raw, + Square.CatalogCustomAttributeDefinition +> = core.serialization.object({ + type: CatalogCustomAttributeDefinitionType, + name: core.serialization.string(), + description: core.serialization.string().optionalNullable(), + sourceApplication: core.serialization.property("source_application", SourceApplication.optional()), + allowedObjectTypes: core.serialization.property("allowed_object_types", core.serialization.list(CatalogObjectType)), + sellerVisibility: core.serialization.property( + "seller_visibility", + CatalogCustomAttributeDefinitionSellerVisibility.optional(), + ), + appVisibility: core.serialization.property( + "app_visibility", + CatalogCustomAttributeDefinitionAppVisibility.optional(), + ), + stringConfig: core.serialization.property("string_config", CatalogCustomAttributeDefinitionStringConfig.optional()), + numberConfig: core.serialization.property("number_config", CatalogCustomAttributeDefinitionNumberConfig.optional()), + selectionConfig: core.serialization.property( + "selection_config", + CatalogCustomAttributeDefinitionSelectionConfig.optional(), + ), + customAttributeUsageCount: core.serialization.property( + "custom_attribute_usage_count", + core.serialization.number().optional(), + ), + key: core.serialization.string().optionalNullable(), +}); + +export declare namespace CatalogCustomAttributeDefinition { + export interface Raw { + type: CatalogCustomAttributeDefinitionType.Raw; + name: string; + description?: (string | null) | null; + source_application?: SourceApplication.Raw | null; + allowed_object_types: CatalogObjectType.Raw[]; + seller_visibility?: CatalogCustomAttributeDefinitionSellerVisibility.Raw | null; + app_visibility?: CatalogCustomAttributeDefinitionAppVisibility.Raw | null; + string_config?: CatalogCustomAttributeDefinitionStringConfig.Raw | null; + number_config?: CatalogCustomAttributeDefinitionNumberConfig.Raw | null; + selection_config?: CatalogCustomAttributeDefinitionSelectionConfig.Raw | null; + custom_attribute_usage_count?: number | null; + key?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogCustomAttributeDefinitionAppVisibility.ts b/src/serialization/types/CatalogCustomAttributeDefinitionAppVisibility.ts new file mode 100644 index 000000000..97622631e --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeDefinitionAppVisibility.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogCustomAttributeDefinitionAppVisibility: core.serialization.Schema< + serializers.CatalogCustomAttributeDefinitionAppVisibility.Raw, + Square.CatalogCustomAttributeDefinitionAppVisibility +> = core.serialization.enum_(["APP_VISIBILITY_HIDDEN", "APP_VISIBILITY_READ_ONLY", "APP_VISIBILITY_READ_WRITE_VALUES"]); + +export declare namespace CatalogCustomAttributeDefinitionAppVisibility { + export type Raw = "APP_VISIBILITY_HIDDEN" | "APP_VISIBILITY_READ_ONLY" | "APP_VISIBILITY_READ_WRITE_VALUES"; +} diff --git a/src/serialization/types/CatalogCustomAttributeDefinitionNumberConfig.ts b/src/serialization/types/CatalogCustomAttributeDefinitionNumberConfig.ts new file mode 100644 index 000000000..9b15f9a9c --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeDefinitionNumberConfig.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogCustomAttributeDefinitionNumberConfig: core.serialization.ObjectSchema< + serializers.CatalogCustomAttributeDefinitionNumberConfig.Raw, + Square.CatalogCustomAttributeDefinitionNumberConfig +> = core.serialization.object({ + precision: core.serialization.number().optionalNullable(), +}); + +export declare namespace CatalogCustomAttributeDefinitionNumberConfig { + export interface Raw { + precision?: (number | null) | null; + } +} diff --git a/src/serialization/types/CatalogCustomAttributeDefinitionSelectionConfig.ts b/src/serialization/types/CatalogCustomAttributeDefinitionSelectionConfig.ts new file mode 100644 index 000000000..c6a22512b --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeDefinitionSelectionConfig.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection } from "./CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection"; + +export const CatalogCustomAttributeDefinitionSelectionConfig: core.serialization.ObjectSchema< + serializers.CatalogCustomAttributeDefinitionSelectionConfig.Raw, + Square.CatalogCustomAttributeDefinitionSelectionConfig +> = core.serialization.object({ + maxAllowedSelections: core.serialization.property( + "max_allowed_selections", + core.serialization.number().optionalNullable(), + ), + allowedSelections: core.serialization.property( + "allowed_selections", + core.serialization + .list(CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection) + .optionalNullable(), + ), +}); + +export declare namespace CatalogCustomAttributeDefinitionSelectionConfig { + export interface Raw { + max_allowed_selections?: (number | null) | null; + allowed_selections?: + | (CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.Raw[] | null) + | null; + } +} diff --git a/src/serialization/types/CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts b/src/serialization/types/CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts new file mode 100644 index 000000000..d2d9d82f5 --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection: core.serialization.ObjectSchema< + serializers.CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection.Raw, + Square.CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + name: core.serialization.string(), +}); + +export declare namespace CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection { + export interface Raw { + uid?: (string | null) | null; + name: string; + } +} diff --git a/src/serialization/types/CatalogCustomAttributeDefinitionSellerVisibility.ts b/src/serialization/types/CatalogCustomAttributeDefinitionSellerVisibility.ts new file mode 100644 index 000000000..fc326e897 --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeDefinitionSellerVisibility.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogCustomAttributeDefinitionSellerVisibility: core.serialization.Schema< + serializers.CatalogCustomAttributeDefinitionSellerVisibility.Raw, + Square.CatalogCustomAttributeDefinitionSellerVisibility +> = core.serialization.enum_(["SELLER_VISIBILITY_HIDDEN", "SELLER_VISIBILITY_READ_WRITE_VALUES"]); + +export declare namespace CatalogCustomAttributeDefinitionSellerVisibility { + export type Raw = "SELLER_VISIBILITY_HIDDEN" | "SELLER_VISIBILITY_READ_WRITE_VALUES"; +} diff --git a/src/serialization/types/CatalogCustomAttributeDefinitionStringConfig.ts b/src/serialization/types/CatalogCustomAttributeDefinitionStringConfig.ts new file mode 100644 index 000000000..ed84b6f74 --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeDefinitionStringConfig.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogCustomAttributeDefinitionStringConfig: core.serialization.ObjectSchema< + serializers.CatalogCustomAttributeDefinitionStringConfig.Raw, + Square.CatalogCustomAttributeDefinitionStringConfig +> = core.serialization.object({ + enforceUniqueness: core.serialization.property( + "enforce_uniqueness", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace CatalogCustomAttributeDefinitionStringConfig { + export interface Raw { + enforce_uniqueness?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CatalogCustomAttributeDefinitionType.ts b/src/serialization/types/CatalogCustomAttributeDefinitionType.ts new file mode 100644 index 000000000..5a2a0a6be --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeDefinitionType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogCustomAttributeDefinitionType: core.serialization.Schema< + serializers.CatalogCustomAttributeDefinitionType.Raw, + Square.CatalogCustomAttributeDefinitionType +> = core.serialization.enum_(["STRING", "BOOLEAN", "NUMBER", "SELECTION"]); + +export declare namespace CatalogCustomAttributeDefinitionType { + export type Raw = "STRING" | "BOOLEAN" | "NUMBER" | "SELECTION"; +} diff --git a/src/serialization/types/CatalogCustomAttributeValue.ts b/src/serialization/types/CatalogCustomAttributeValue.ts new file mode 100644 index 000000000..d9830affe --- /dev/null +++ b/src/serialization/types/CatalogCustomAttributeValue.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogCustomAttributeDefinitionType } from "./CatalogCustomAttributeDefinitionType"; + +export const CatalogCustomAttributeValue: core.serialization.ObjectSchema< + serializers.CatalogCustomAttributeValue.Raw, + Square.CatalogCustomAttributeValue +> = core.serialization.object({ + name: core.serialization.string().optionalNullable(), + stringValue: core.serialization.property("string_value", core.serialization.string().optionalNullable()), + customAttributeDefinitionId: core.serialization.property( + "custom_attribute_definition_id", + core.serialization.string().optional(), + ), + type: CatalogCustomAttributeDefinitionType.optional(), + numberValue: core.serialization.property("number_value", core.serialization.string().optionalNullable()), + booleanValue: core.serialization.property("boolean_value", core.serialization.boolean().optionalNullable()), + selectionUidValues: core.serialization.property( + "selection_uid_values", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + key: core.serialization.string().optional(), +}); + +export declare namespace CatalogCustomAttributeValue { + export interface Raw { + name?: (string | null) | null; + string_value?: (string | null) | null; + custom_attribute_definition_id?: string | null; + type?: CatalogCustomAttributeDefinitionType.Raw | null; + number_value?: (string | null) | null; + boolean_value?: (boolean | null) | null; + selection_uid_values?: (string[] | null) | null; + key?: string | null; + } +} diff --git a/src/serialization/types/CatalogDiscount.ts b/src/serialization/types/CatalogDiscount.ts new file mode 100644 index 000000000..9a6802976 --- /dev/null +++ b/src/serialization/types/CatalogDiscount.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogDiscountType } from "./CatalogDiscountType"; +import { Money } from "./Money"; +import { CatalogDiscountModifyTaxBasis } from "./CatalogDiscountModifyTaxBasis"; + +export const CatalogDiscount: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optionalNullable(), + discountType: core.serialization.property("discount_type", CatalogDiscountType.optional()), + percentage: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money.optional()), + pinRequired: core.serialization.property("pin_required", core.serialization.boolean().optionalNullable()), + labelColor: core.serialization.property("label_color", core.serialization.string().optionalNullable()), + modifyTaxBasis: core.serialization.property("modify_tax_basis", CatalogDiscountModifyTaxBasis.optional()), + maximumAmountMoney: core.serialization.property("maximum_amount_money", Money.optional()), + }); + +export declare namespace CatalogDiscount { + export interface Raw { + name?: (string | null) | null; + discount_type?: CatalogDiscountType.Raw | null; + percentage?: (string | null) | null; + amount_money?: Money.Raw | null; + pin_required?: (boolean | null) | null; + label_color?: (string | null) | null; + modify_tax_basis?: CatalogDiscountModifyTaxBasis.Raw | null; + maximum_amount_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/CatalogDiscountModifyTaxBasis.ts b/src/serialization/types/CatalogDiscountModifyTaxBasis.ts new file mode 100644 index 000000000..f53e989e0 --- /dev/null +++ b/src/serialization/types/CatalogDiscountModifyTaxBasis.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogDiscountModifyTaxBasis: core.serialization.Schema< + serializers.CatalogDiscountModifyTaxBasis.Raw, + Square.CatalogDiscountModifyTaxBasis +> = core.serialization.enum_(["MODIFY_TAX_BASIS", "DO_NOT_MODIFY_TAX_BASIS"]); + +export declare namespace CatalogDiscountModifyTaxBasis { + export type Raw = "MODIFY_TAX_BASIS" | "DO_NOT_MODIFY_TAX_BASIS"; +} diff --git a/src/serialization/types/CatalogDiscountType.ts b/src/serialization/types/CatalogDiscountType.ts new file mode 100644 index 000000000..76db66523 --- /dev/null +++ b/src/serialization/types/CatalogDiscountType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogDiscountType: core.serialization.Schema< + serializers.CatalogDiscountType.Raw, + Square.CatalogDiscountType +> = core.serialization.enum_(["FIXED_PERCENTAGE", "FIXED_AMOUNT", "VARIABLE_PERCENTAGE", "VARIABLE_AMOUNT"]); + +export declare namespace CatalogDiscountType { + export type Raw = "FIXED_PERCENTAGE" | "FIXED_AMOUNT" | "VARIABLE_PERCENTAGE" | "VARIABLE_AMOUNT"; +} diff --git a/src/serialization/types/CatalogEcomSeoData.ts b/src/serialization/types/CatalogEcomSeoData.ts new file mode 100644 index 000000000..196225162 --- /dev/null +++ b/src/serialization/types/CatalogEcomSeoData.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogEcomSeoData: core.serialization.ObjectSchema< + serializers.CatalogEcomSeoData.Raw, + Square.CatalogEcomSeoData +> = core.serialization.object({ + pageTitle: core.serialization.property("page_title", core.serialization.string().optionalNullable()), + pageDescription: core.serialization.property("page_description", core.serialization.string().optionalNullable()), + permalink: core.serialization.string().optionalNullable(), +}); + +export declare namespace CatalogEcomSeoData { + export interface Raw { + page_title?: (string | null) | null; + page_description?: (string | null) | null; + permalink?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogIdMapping.ts b/src/serialization/types/CatalogIdMapping.ts new file mode 100644 index 000000000..7ca9c3e72 --- /dev/null +++ b/src/serialization/types/CatalogIdMapping.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogIdMapping: core.serialization.ObjectSchema< + serializers.CatalogIdMapping.Raw, + Square.CatalogIdMapping +> = core.serialization.object({ + clientObjectId: core.serialization.property("client_object_id", core.serialization.string().optionalNullable()), + objectId: core.serialization.property("object_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace CatalogIdMapping { + export interface Raw { + client_object_id?: (string | null) | null; + object_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogImage.ts b/src/serialization/types/CatalogImage.ts new file mode 100644 index 000000000..8eaa56d15 --- /dev/null +++ b/src/serialization/types/CatalogImage.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogImage: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optionalNullable(), + url: core.serialization.string().optionalNullable(), + caption: core.serialization.string().optionalNullable(), + photoStudioOrderId: core.serialization.property( + "photo_studio_order_id", + core.serialization.string().optionalNullable(), + ), + }); + +export declare namespace CatalogImage { + export interface Raw { + name?: (string | null) | null; + url?: (string | null) | null; + caption?: (string | null) | null; + photo_studio_order_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogInfoResponse.ts b/src/serialization/types/CatalogInfoResponse.ts new file mode 100644 index 000000000..4c2786890 --- /dev/null +++ b/src/serialization/types/CatalogInfoResponse.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CatalogInfoResponseLimits } from "./CatalogInfoResponseLimits"; +import { StandardUnitDescriptionGroup } from "./StandardUnitDescriptionGroup"; + +export const CatalogInfoResponse: core.serialization.ObjectSchema< + serializers.CatalogInfoResponse.Raw, + Square.CatalogInfoResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + limits: CatalogInfoResponseLimits.optional(), + standardUnitDescriptionGroup: core.serialization.property( + "standard_unit_description_group", + StandardUnitDescriptionGroup.optional(), + ), +}); + +export declare namespace CatalogInfoResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + limits?: CatalogInfoResponseLimits.Raw | null; + standard_unit_description_group?: StandardUnitDescriptionGroup.Raw | null; + } +} diff --git a/src/serialization/types/CatalogInfoResponseLimits.ts b/src/serialization/types/CatalogInfoResponseLimits.ts new file mode 100644 index 000000000..34db48aa2 --- /dev/null +++ b/src/serialization/types/CatalogInfoResponseLimits.ts @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogInfoResponseLimits: core.serialization.ObjectSchema< + serializers.CatalogInfoResponseLimits.Raw, + Square.CatalogInfoResponseLimits +> = core.serialization.object({ + batchUpsertMaxObjectsPerBatch: core.serialization.property( + "batch_upsert_max_objects_per_batch", + core.serialization.number().optionalNullable(), + ), + batchUpsertMaxTotalObjects: core.serialization.property( + "batch_upsert_max_total_objects", + core.serialization.number().optionalNullable(), + ), + batchRetrieveMaxObjectIds: core.serialization.property( + "batch_retrieve_max_object_ids", + core.serialization.number().optionalNullable(), + ), + searchMaxPageLimit: core.serialization.property( + "search_max_page_limit", + core.serialization.number().optionalNullable(), + ), + batchDeleteMaxObjectIds: core.serialization.property( + "batch_delete_max_object_ids", + core.serialization.number().optionalNullable(), + ), + updateItemTaxesMaxItemIds: core.serialization.property( + "update_item_taxes_max_item_ids", + core.serialization.number().optionalNullable(), + ), + updateItemTaxesMaxTaxesToEnable: core.serialization.property( + "update_item_taxes_max_taxes_to_enable", + core.serialization.number().optionalNullable(), + ), + updateItemTaxesMaxTaxesToDisable: core.serialization.property( + "update_item_taxes_max_taxes_to_disable", + core.serialization.number().optionalNullable(), + ), + updateItemModifierListsMaxItemIds: core.serialization.property( + "update_item_modifier_lists_max_item_ids", + core.serialization.number().optionalNullable(), + ), + updateItemModifierListsMaxModifierListsToEnable: core.serialization.property( + "update_item_modifier_lists_max_modifier_lists_to_enable", + core.serialization.number().optionalNullable(), + ), + updateItemModifierListsMaxModifierListsToDisable: core.serialization.property( + "update_item_modifier_lists_max_modifier_lists_to_disable", + core.serialization.number().optionalNullable(), + ), +}); + +export declare namespace CatalogInfoResponseLimits { + export interface Raw { + batch_upsert_max_objects_per_batch?: (number | null) | null; + batch_upsert_max_total_objects?: (number | null) | null; + batch_retrieve_max_object_ids?: (number | null) | null; + search_max_page_limit?: (number | null) | null; + batch_delete_max_object_ids?: (number | null) | null; + update_item_taxes_max_item_ids?: (number | null) | null; + update_item_taxes_max_taxes_to_enable?: (number | null) | null; + update_item_taxes_max_taxes_to_disable?: (number | null) | null; + update_item_modifier_lists_max_item_ids?: (number | null) | null; + update_item_modifier_lists_max_modifier_lists_to_enable?: (number | null) | null; + update_item_modifier_lists_max_modifier_lists_to_disable?: (number | null) | null; + } +} diff --git a/src/serialization/types/CatalogItem.ts b/src/serialization/types/CatalogItem.ts new file mode 100644 index 000000000..911335e46 --- /dev/null +++ b/src/serialization/types/CatalogItem.ts @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogItemModifierListInfo } from "./CatalogItemModifierListInfo"; +import { CatalogItemProductType } from "./CatalogItemProductType"; +import { CatalogItemOptionForItem } from "./CatalogItemOptionForItem"; +import { CatalogEcomSeoData } from "./CatalogEcomSeoData"; +import { CatalogItemFoodAndBeverageDetails } from "./CatalogItemFoodAndBeverageDetails"; + +export const CatalogItem: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optionalNullable(), + description: core.serialization.string().optionalNullable(), + abbreviation: core.serialization.string().optionalNullable(), + labelColor: core.serialization.property("label_color", core.serialization.string().optionalNullable()), + isTaxable: core.serialization.property("is_taxable", core.serialization.boolean().optionalNullable()), + categoryId: core.serialization.property("category_id", core.serialization.string().optionalNullable()), + taxIds: core.serialization.property( + "tax_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + modifierListInfo: core.serialization.property( + "modifier_list_info", + core.serialization.list(CatalogItemModifierListInfo).optionalNullable(), + ), + variations: core.serialization + .list(core.serialization.lazy(() => serializers.CatalogObject)) + .optionalNullable(), + productType: core.serialization.property("product_type", CatalogItemProductType.optional()), + skipModifierScreen: core.serialization.property( + "skip_modifier_screen", + core.serialization.boolean().optionalNullable(), + ), + itemOptions: core.serialization.property( + "item_options", + core.serialization.list(CatalogItemOptionForItem).optionalNullable(), + ), + imageIds: core.serialization.property( + "image_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + sortName: core.serialization.property("sort_name", core.serialization.string().optionalNullable()), + categories: core.serialization + .list(core.serialization.lazyObject(() => serializers.CatalogObjectCategory)) + .optionalNullable(), + descriptionHtml: core.serialization.property( + "description_html", + core.serialization.string().optionalNullable(), + ), + descriptionPlaintext: core.serialization.property( + "description_plaintext", + core.serialization.string().optional(), + ), + channels: core.serialization.list(core.serialization.string()).optionalNullable(), + isArchived: core.serialization.property("is_archived", core.serialization.boolean().optionalNullable()), + ecomSeoData: core.serialization.property("ecom_seo_data", CatalogEcomSeoData.optional()), + foodAndBeverageDetails: core.serialization.property( + "food_and_beverage_details", + CatalogItemFoodAndBeverageDetails.optional(), + ), + reportingCategory: core.serialization.property( + "reporting_category", + core.serialization.lazyObject(() => serializers.CatalogObjectCategory).optional(), + ), + }); + +export declare namespace CatalogItem { + export interface Raw { + name?: (string | null) | null; + description?: (string | null) | null; + abbreviation?: (string | null) | null; + label_color?: (string | null) | null; + is_taxable?: (boolean | null) | null; + category_id?: (string | null) | null; + tax_ids?: (string[] | null) | null; + modifier_list_info?: (CatalogItemModifierListInfo.Raw[] | null) | null; + variations?: (serializers.CatalogObject.Raw[] | null) | null; + product_type?: CatalogItemProductType.Raw | null; + skip_modifier_screen?: (boolean | null) | null; + item_options?: (CatalogItemOptionForItem.Raw[] | null) | null; + image_ids?: (string[] | null) | null; + sort_name?: (string | null) | null; + categories?: (serializers.CatalogObjectCategory.Raw[] | null) | null; + description_html?: (string | null) | null; + description_plaintext?: string | null; + channels?: (string[] | null) | null; + is_archived?: (boolean | null) | null; + ecom_seo_data?: CatalogEcomSeoData.Raw | null; + food_and_beverage_details?: CatalogItemFoodAndBeverageDetails.Raw | null; + reporting_category?: serializers.CatalogObjectCategory.Raw | null; + } +} diff --git a/src/serialization/types/CatalogItemFoodAndBeverageDetails.ts b/src/serialization/types/CatalogItemFoodAndBeverageDetails.ts new file mode 100644 index 000000000..776ed1b02 --- /dev/null +++ b/src/serialization/types/CatalogItemFoodAndBeverageDetails.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogItemFoodAndBeverageDetailsDietaryPreference } from "./CatalogItemFoodAndBeverageDetailsDietaryPreference"; +import { CatalogItemFoodAndBeverageDetailsIngredient } from "./CatalogItemFoodAndBeverageDetailsIngredient"; + +export const CatalogItemFoodAndBeverageDetails: core.serialization.ObjectSchema< + serializers.CatalogItemFoodAndBeverageDetails.Raw, + Square.CatalogItemFoodAndBeverageDetails +> = core.serialization.object({ + calorieCount: core.serialization.property("calorie_count", core.serialization.number().optionalNullable()), + dietaryPreferences: core.serialization.property( + "dietary_preferences", + core.serialization.list(CatalogItemFoodAndBeverageDetailsDietaryPreference).optionalNullable(), + ), + ingredients: core.serialization.list(CatalogItemFoodAndBeverageDetailsIngredient).optionalNullable(), +}); + +export declare namespace CatalogItemFoodAndBeverageDetails { + export interface Raw { + calorie_count?: (number | null) | null; + dietary_preferences?: (CatalogItemFoodAndBeverageDetailsDietaryPreference.Raw[] | null) | null; + ingredients?: (CatalogItemFoodAndBeverageDetailsIngredient.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts b/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts new file mode 100644 index 000000000..19e9da00e --- /dev/null +++ b/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreference.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogItemFoodAndBeverageDetailsDietaryPreferenceType } from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceType"; +import { CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference } from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference"; + +export const CatalogItemFoodAndBeverageDetailsDietaryPreference: core.serialization.ObjectSchema< + serializers.CatalogItemFoodAndBeverageDetailsDietaryPreference.Raw, + Square.CatalogItemFoodAndBeverageDetailsDietaryPreference +> = core.serialization.object({ + type: CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.optional(), + standardName: core.serialization.property( + "standard_name", + CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.optional(), + ), + customName: core.serialization.property("custom_name", core.serialization.string().optionalNullable()), +}); + +export declare namespace CatalogItemFoodAndBeverageDetailsDietaryPreference { + export interface Raw { + type?: CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.Raw | null; + standard_name?: CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.Raw | null; + custom_name?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.ts b/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.ts new file mode 100644 index 000000000..67261ced3 --- /dev/null +++ b/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference: core.serialization.Schema< + serializers.CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference.Raw, + Square.CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference +> = core.serialization.enum_(["DAIRY_FREE", "GLUTEN_FREE", "HALAL", "KOSHER", "NUT_FREE", "VEGAN", "VEGETARIAN"]); + +export declare namespace CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference { + export type Raw = "DAIRY_FREE" | "GLUTEN_FREE" | "HALAL" | "KOSHER" | "NUT_FREE" | "VEGAN" | "VEGETARIAN"; +} diff --git a/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.ts b/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.ts new file mode 100644 index 000000000..7e33670ab --- /dev/null +++ b/src/serialization/types/CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogItemFoodAndBeverageDetailsDietaryPreferenceType: core.serialization.Schema< + serializers.CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.Raw, + Square.CatalogItemFoodAndBeverageDetailsDietaryPreferenceType +> = core.serialization.enum_(["STANDARD", "CUSTOM"]); + +export declare namespace CatalogItemFoodAndBeverageDetailsDietaryPreferenceType { + export type Raw = "STANDARD" | "CUSTOM"; +} diff --git a/src/serialization/types/CatalogItemFoodAndBeverageDetailsIngredient.ts b/src/serialization/types/CatalogItemFoodAndBeverageDetailsIngredient.ts new file mode 100644 index 000000000..04d48767d --- /dev/null +++ b/src/serialization/types/CatalogItemFoodAndBeverageDetailsIngredient.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogItemFoodAndBeverageDetailsDietaryPreferenceType } from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceType"; +import { CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient } from "./CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient"; + +export const CatalogItemFoodAndBeverageDetailsIngredient: core.serialization.ObjectSchema< + serializers.CatalogItemFoodAndBeverageDetailsIngredient.Raw, + Square.CatalogItemFoodAndBeverageDetailsIngredient +> = core.serialization.object({ + type: CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.optional(), + standardName: core.serialization.property( + "standard_name", + CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.optional(), + ), + customName: core.serialization.property("custom_name", core.serialization.string().optionalNullable()), +}); + +export declare namespace CatalogItemFoodAndBeverageDetailsIngredient { + export interface Raw { + type?: CatalogItemFoodAndBeverageDetailsDietaryPreferenceType.Raw | null; + standard_name?: CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.Raw | null; + custom_name?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.ts b/src/serialization/types/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.ts new file mode 100644 index 000000000..4a7c678e0 --- /dev/null +++ b/src/serialization/types/CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient: core.serialization.Schema< + serializers.CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient.Raw, + Square.CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient +> = core.serialization.enum_([ + "CELERY", + "CRUSTACEANS", + "EGGS", + "FISH", + "GLUTEN", + "LUPIN", + "MILK", + "MOLLUSCS", + "MUSTARD", + "PEANUTS", + "SESAME", + "SOY", + "SULPHITES", + "TREE_NUTS", +]); + +export declare namespace CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient { + export type Raw = + | "CELERY" + | "CRUSTACEANS" + | "EGGS" + | "FISH" + | "GLUTEN" + | "LUPIN" + | "MILK" + | "MOLLUSCS" + | "MUSTARD" + | "PEANUTS" + | "SESAME" + | "SOY" + | "SULPHITES" + | "TREE_NUTS"; +} diff --git a/src/serialization/types/CatalogItemModifierListInfo.ts b/src/serialization/types/CatalogItemModifierListInfo.ts new file mode 100644 index 000000000..942e2448e --- /dev/null +++ b/src/serialization/types/CatalogItemModifierListInfo.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogModifierOverride } from "./CatalogModifierOverride"; + +export const CatalogItemModifierListInfo: core.serialization.ObjectSchema< + serializers.CatalogItemModifierListInfo.Raw, + Square.CatalogItemModifierListInfo +> = core.serialization.object({ + modifierListId: core.serialization.property("modifier_list_id", core.serialization.string()), + modifierOverrides: core.serialization.property( + "modifier_overrides", + core.serialization.list(CatalogModifierOverride).optionalNullable(), + ), + minSelectedModifiers: core.serialization.property( + "min_selected_modifiers", + core.serialization.number().optionalNullable(), + ), + maxSelectedModifiers: core.serialization.property( + "max_selected_modifiers", + core.serialization.number().optionalNullable(), + ), + enabled: core.serialization.boolean().optionalNullable(), + ordinal: core.serialization.number().optionalNullable(), +}); + +export declare namespace CatalogItemModifierListInfo { + export interface Raw { + modifier_list_id: string; + modifier_overrides?: (CatalogModifierOverride.Raw[] | null) | null; + min_selected_modifiers?: (number | null) | null; + max_selected_modifiers?: (number | null) | null; + enabled?: (boolean | null) | null; + ordinal?: (number | null) | null; + } +} diff --git a/src/serialization/types/CatalogItemOption.ts b/src/serialization/types/CatalogItemOption.ts new file mode 100644 index 000000000..57a18615f --- /dev/null +++ b/src/serialization/types/CatalogItemOption.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogItemOption: core.serialization.ObjectSchema< + serializers.CatalogItemOption.Raw, + Square.CatalogItemOption +> = core.serialization.object({ + name: core.serialization.string().optionalNullable(), + displayName: core.serialization.property("display_name", core.serialization.string().optionalNullable()), + description: core.serialization.string().optionalNullable(), + showColors: core.serialization.property("show_colors", core.serialization.boolean().optionalNullable()), + values: core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optionalNullable(), +}); + +export declare namespace CatalogItemOption { + export interface Raw { + name?: (string | null) | null; + display_name?: (string | null) | null; + description?: (string | null) | null; + show_colors?: (boolean | null) | null; + values?: (serializers.CatalogObject.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/CatalogItemOptionForItem.ts b/src/serialization/types/CatalogItemOptionForItem.ts new file mode 100644 index 000000000..844285eb1 --- /dev/null +++ b/src/serialization/types/CatalogItemOptionForItem.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogItemOptionForItem: core.serialization.ObjectSchema< + serializers.CatalogItemOptionForItem.Raw, + Square.CatalogItemOptionForItem +> = core.serialization.object({ + itemOptionId: core.serialization.property("item_option_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace CatalogItemOptionForItem { + export interface Raw { + item_option_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogItemOptionValue.ts b/src/serialization/types/CatalogItemOptionValue.ts new file mode 100644 index 000000000..50dfac084 --- /dev/null +++ b/src/serialization/types/CatalogItemOptionValue.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogItemOptionValue: core.serialization.ObjectSchema< + serializers.CatalogItemOptionValue.Raw, + Square.CatalogItemOptionValue +> = core.serialization.object({ + itemOptionId: core.serialization.property("item_option_id", core.serialization.string().optionalNullable()), + name: core.serialization.string().optionalNullable(), + description: core.serialization.string().optionalNullable(), + color: core.serialization.string().optionalNullable(), + ordinal: core.serialization.number().optionalNullable(), +}); + +export declare namespace CatalogItemOptionValue { + export interface Raw { + item_option_id?: (string | null) | null; + name?: (string | null) | null; + description?: (string | null) | null; + color?: (string | null) | null; + ordinal?: (number | null) | null; + } +} diff --git a/src/serialization/types/CatalogItemOptionValueForItemVariation.ts b/src/serialization/types/CatalogItemOptionValueForItemVariation.ts new file mode 100644 index 000000000..a4350351e --- /dev/null +++ b/src/serialization/types/CatalogItemOptionValueForItemVariation.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogItemOptionValueForItemVariation: core.serialization.ObjectSchema< + serializers.CatalogItemOptionValueForItemVariation.Raw, + Square.CatalogItemOptionValueForItemVariation +> = core.serialization.object({ + itemOptionId: core.serialization.property("item_option_id", core.serialization.string().optionalNullable()), + itemOptionValueId: core.serialization.property( + "item_option_value_id", + core.serialization.string().optionalNullable(), + ), +}); + +export declare namespace CatalogItemOptionValueForItemVariation { + export interface Raw { + item_option_id?: (string | null) | null; + item_option_value_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogItemProductType.ts b/src/serialization/types/CatalogItemProductType.ts new file mode 100644 index 000000000..41da19f71 --- /dev/null +++ b/src/serialization/types/CatalogItemProductType.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogItemProductType: core.serialization.Schema< + serializers.CatalogItemProductType.Raw, + Square.CatalogItemProductType +> = core.serialization.enum_([ + "REGULAR", + "GIFT_CARD", + "APPOINTMENTS_SERVICE", + "FOOD_AND_BEV", + "EVENT", + "DIGITAL", + "DONATION", + "LEGACY_SQUARE_ONLINE_SERVICE", + "LEGACY_SQUARE_ONLINE_MEMBERSHIP", +]); + +export declare namespace CatalogItemProductType { + export type Raw = + | "REGULAR" + | "GIFT_CARD" + | "APPOINTMENTS_SERVICE" + | "FOOD_AND_BEV" + | "EVENT" + | "DIGITAL" + | "DONATION" + | "LEGACY_SQUARE_ONLINE_SERVICE" + | "LEGACY_SQUARE_ONLINE_MEMBERSHIP"; +} diff --git a/src/serialization/types/CatalogItemVariation.ts b/src/serialization/types/CatalogItemVariation.ts new file mode 100644 index 000000000..b89079ec8 --- /dev/null +++ b/src/serialization/types/CatalogItemVariation.ts @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogPricingType } from "./CatalogPricingType"; +import { Money } from "./Money"; +import { ItemVariationLocationOverrides } from "./ItemVariationLocationOverrides"; +import { InventoryAlertType } from "./InventoryAlertType"; +import { CatalogItemOptionValueForItemVariation } from "./CatalogItemOptionValueForItemVariation"; +import { CatalogStockConversion } from "./CatalogStockConversion"; + +export const CatalogItemVariation: core.serialization.ObjectSchema< + serializers.CatalogItemVariation.Raw, + Square.CatalogItemVariation +> = core.serialization.object({ + itemId: core.serialization.property("item_id", core.serialization.string().optionalNullable()), + name: core.serialization.string().optionalNullable(), + sku: core.serialization.string().optionalNullable(), + upc: core.serialization.string().optionalNullable(), + ordinal: core.serialization.number().optional(), + pricingType: core.serialization.property("pricing_type", CatalogPricingType.optional()), + priceMoney: core.serialization.property("price_money", Money.optional()), + locationOverrides: core.serialization.property( + "location_overrides", + core.serialization.list(ItemVariationLocationOverrides).optionalNullable(), + ), + trackInventory: core.serialization.property("track_inventory", core.serialization.boolean().optionalNullable()), + inventoryAlertType: core.serialization.property("inventory_alert_type", InventoryAlertType.optional()), + inventoryAlertThreshold: core.serialization.property( + "inventory_alert_threshold", + core.serialization.bigint().optionalNullable(), + ), + userData: core.serialization.property("user_data", core.serialization.string().optionalNullable()), + serviceDuration: core.serialization.property("service_duration", core.serialization.bigint().optionalNullable()), + availableForBooking: core.serialization.property( + "available_for_booking", + core.serialization.boolean().optionalNullable(), + ), + itemOptionValues: core.serialization.property( + "item_option_values", + core.serialization.list(CatalogItemOptionValueForItemVariation).optionalNullable(), + ), + measurementUnitId: core.serialization.property( + "measurement_unit_id", + core.serialization.string().optionalNullable(), + ), + sellable: core.serialization.boolean().optionalNullable(), + stockable: core.serialization.boolean().optionalNullable(), + imageIds: core.serialization.property( + "image_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + teamMemberIds: core.serialization.property( + "team_member_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + stockableConversion: core.serialization.property("stockable_conversion", CatalogStockConversion.optional()), +}); + +export declare namespace CatalogItemVariation { + export interface Raw { + item_id?: (string | null) | null; + name?: (string | null) | null; + sku?: (string | null) | null; + upc?: (string | null) | null; + ordinal?: number | null; + pricing_type?: CatalogPricingType.Raw | null; + price_money?: Money.Raw | null; + location_overrides?: (ItemVariationLocationOverrides.Raw[] | null) | null; + track_inventory?: (boolean | null) | null; + inventory_alert_type?: InventoryAlertType.Raw | null; + inventory_alert_threshold?: ((bigint | number) | null) | null; + user_data?: (string | null) | null; + service_duration?: ((bigint | number) | null) | null; + available_for_booking?: (boolean | null) | null; + item_option_values?: (CatalogItemOptionValueForItemVariation.Raw[] | null) | null; + measurement_unit_id?: (string | null) | null; + sellable?: (boolean | null) | null; + stockable?: (boolean | null) | null; + image_ids?: (string[] | null) | null; + team_member_ids?: (string[] | null) | null; + stockable_conversion?: CatalogStockConversion.Raw | null; + } +} diff --git a/src/serialization/types/CatalogMeasurementUnit.ts b/src/serialization/types/CatalogMeasurementUnit.ts new file mode 100644 index 000000000..1047c2a3d --- /dev/null +++ b/src/serialization/types/CatalogMeasurementUnit.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { MeasurementUnit } from "./MeasurementUnit"; + +export const CatalogMeasurementUnit: core.serialization.ObjectSchema< + serializers.CatalogMeasurementUnit.Raw, + Square.CatalogMeasurementUnit +> = core.serialization.object({ + measurementUnit: core.serialization.property("measurement_unit", MeasurementUnit.optional()), + precision: core.serialization.number().optionalNullable(), +}); + +export declare namespace CatalogMeasurementUnit { + export interface Raw { + measurement_unit?: MeasurementUnit.Raw | null; + precision?: (number | null) | null; + } +} diff --git a/src/serialization/types/CatalogModifier.ts b/src/serialization/types/CatalogModifier.ts new file mode 100644 index 000000000..4d433b3ff --- /dev/null +++ b/src/serialization/types/CatalogModifier.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { ModifierLocationOverrides } from "./ModifierLocationOverrides"; + +export const CatalogModifier: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optionalNullable(), + priceMoney: core.serialization.property("price_money", Money.optional()), + ordinal: core.serialization.number().optionalNullable(), + modifierListId: core.serialization.property("modifier_list_id", core.serialization.string().optionalNullable()), + locationOverrides: core.serialization.property( + "location_overrides", + core.serialization.list(ModifierLocationOverrides).optionalNullable(), + ), + imageId: core.serialization.property("image_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace CatalogModifier { + export interface Raw { + name?: (string | null) | null; + price_money?: Money.Raw | null; + ordinal?: (number | null) | null; + modifier_list_id?: (string | null) | null; + location_overrides?: (ModifierLocationOverrides.Raw[] | null) | null; + image_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogModifierList.ts b/src/serialization/types/CatalogModifierList.ts new file mode 100644 index 000000000..009caa758 --- /dev/null +++ b/src/serialization/types/CatalogModifierList.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogModifierListSelectionType } from "./CatalogModifierListSelectionType"; +import { CatalogModifierListModifierType } from "./CatalogModifierListModifierType"; + +export const CatalogModifierList: core.serialization.ObjectSchema< + serializers.CatalogModifierList.Raw, + Square.CatalogModifierList +> = core.serialization.object({ + name: core.serialization.string().optionalNullable(), + ordinal: core.serialization.number().optionalNullable(), + selectionType: core.serialization.property("selection_type", CatalogModifierListSelectionType.optional()), + modifiers: core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optionalNullable(), + imageIds: core.serialization.property( + "image_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + modifierType: core.serialization.property("modifier_type", CatalogModifierListModifierType.optional()), + maxLength: core.serialization.property("max_length", core.serialization.number().optionalNullable()), + textRequired: core.serialization.property("text_required", core.serialization.boolean().optionalNullable()), + internalName: core.serialization.property("internal_name", core.serialization.string().optionalNullable()), +}); + +export declare namespace CatalogModifierList { + export interface Raw { + name?: (string | null) | null; + ordinal?: (number | null) | null; + selection_type?: CatalogModifierListSelectionType.Raw | null; + modifiers?: (serializers.CatalogObject.Raw[] | null) | null; + image_ids?: (string[] | null) | null; + modifier_type?: CatalogModifierListModifierType.Raw | null; + max_length?: (number | null) | null; + text_required?: (boolean | null) | null; + internal_name?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogModifierListModifierType.ts b/src/serialization/types/CatalogModifierListModifierType.ts new file mode 100644 index 000000000..969fa2606 --- /dev/null +++ b/src/serialization/types/CatalogModifierListModifierType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogModifierListModifierType: core.serialization.Schema< + serializers.CatalogModifierListModifierType.Raw, + Square.CatalogModifierListModifierType +> = core.serialization.enum_(["LIST", "TEXT"]); + +export declare namespace CatalogModifierListModifierType { + export type Raw = "LIST" | "TEXT"; +} diff --git a/src/serialization/types/CatalogModifierListSelectionType.ts b/src/serialization/types/CatalogModifierListSelectionType.ts new file mode 100644 index 000000000..87a0c1fc5 --- /dev/null +++ b/src/serialization/types/CatalogModifierListSelectionType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogModifierListSelectionType: core.serialization.Schema< + serializers.CatalogModifierListSelectionType.Raw, + Square.CatalogModifierListSelectionType +> = core.serialization.enum_(["SINGLE", "MULTIPLE"]); + +export declare namespace CatalogModifierListSelectionType { + export type Raw = "SINGLE" | "MULTIPLE"; +} diff --git a/src/serialization/types/CatalogModifierOverride.ts b/src/serialization/types/CatalogModifierOverride.ts new file mode 100644 index 000000000..d11763a33 --- /dev/null +++ b/src/serialization/types/CatalogModifierOverride.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogModifierOverride: core.serialization.ObjectSchema< + serializers.CatalogModifierOverride.Raw, + Square.CatalogModifierOverride +> = core.serialization.object({ + modifierId: core.serialization.property("modifier_id", core.serialization.string()), + onByDefault: core.serialization.property("on_by_default", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace CatalogModifierOverride { + export interface Raw { + modifier_id: string; + on_by_default?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CatalogObject.ts b/src/serialization/types/CatalogObject.ts new file mode 100644 index 000000000..9318db90e --- /dev/null +++ b/src/serialization/types/CatalogObject.ts @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectImage } from "./CatalogObjectImage"; +import { CatalogObjectItemVariation } from "./CatalogObjectItemVariation"; +import { CatalogObjectTax } from "./CatalogObjectTax"; +import { CatalogObjectDiscount } from "./CatalogObjectDiscount"; +import { CatalogObjectModifier } from "./CatalogObjectModifier"; +import { CatalogObjectDiningOption } from "./CatalogObjectDiningOption"; +import { CatalogObjectTaxExemption } from "./CatalogObjectTaxExemption"; +import { CatalogObjectServiceCharge } from "./CatalogObjectServiceCharge"; +import { CatalogObjectPricingRule } from "./CatalogObjectPricingRule"; +import { CatalogObjectProductSet } from "./CatalogObjectProductSet"; +import { CatalogObjectTimePeriod } from "./CatalogObjectTimePeriod"; +import { CatalogObjectMeasurementUnit } from "./CatalogObjectMeasurementUnit"; +import { CatalogObjectItemOptionValue } from "./CatalogObjectItemOptionValue"; +import { CatalogObjectCustomAttributeDefinition } from "./CatalogObjectCustomAttributeDefinition"; +import { CatalogObjectQuickAmountsSettings } from "./CatalogObjectQuickAmountsSettings"; +import { CatalogObjectComponent } from "./CatalogObjectComponent"; +import { CatalogObjectComposition } from "./CatalogObjectComposition"; +import { CatalogObjectResource } from "./CatalogObjectResource"; +import { CatalogObjectCheckoutLink } from "./CatalogObjectCheckoutLink"; +import { CatalogObjectAddress } from "./CatalogObjectAddress"; +import { CatalogObjectSubscriptionProduct } from "./CatalogObjectSubscriptionProduct"; + +export const CatalogObject: core.serialization.Schema = + core.serialization + .union("type", { + ITEM: core.serialization.lazyObject(() => serializers.CatalogObjectItem), + IMAGE: CatalogObjectImage, + CATEGORY: core.serialization.lazyObject(() => serializers.CatalogObjectCategory), + ITEM_VARIATION: CatalogObjectItemVariation, + TAX: CatalogObjectTax, + DISCOUNT: CatalogObjectDiscount, + MODIFIER_LIST: core.serialization.lazyObject(() => serializers.CatalogObjectModifierList), + MODIFIER: CatalogObjectModifier, + DINING_OPTION: CatalogObjectDiningOption, + TAX_EXEMPTION: CatalogObjectTaxExemption, + SERVICE_CHARGE: CatalogObjectServiceCharge, + PRICING_RULE: CatalogObjectPricingRule, + PRODUCT_SET: CatalogObjectProductSet, + TIME_PERIOD: CatalogObjectTimePeriod, + MEASUREMENT_UNIT: CatalogObjectMeasurementUnit, + SUBSCRIPTION_PLAN: core.serialization.lazyObject(() => serializers.CatalogObjectSubscriptionPlan), + ITEM_OPTION: core.serialization.lazyObject(() => serializers.CatalogObjectItemOption), + ITEM_OPTION_VAL: CatalogObjectItemOptionValue, + CUSTOM_ATTRIBUTE_DEFINITION: CatalogObjectCustomAttributeDefinition, + QUICK_AMOUNTS_SETTINGS: CatalogObjectQuickAmountsSettings, + COMPONENT: CatalogObjectComponent, + COMPOSITION: CatalogObjectComposition, + RESOURCE: CatalogObjectResource, + CHECKOUT_LINK: CatalogObjectCheckoutLink, + ADDRESS: CatalogObjectAddress, + SUBSCRIPTION_PRODUCT: CatalogObjectSubscriptionProduct, + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace CatalogObject { + export type Raw = + | CatalogObject.Item + | CatalogObject.Image + | CatalogObject.Category + | CatalogObject.ItemVariation + | CatalogObject.Tax + | CatalogObject.Discount + | CatalogObject.ModifierList + | CatalogObject.Modifier + | CatalogObject.DiningOption + | CatalogObject.TaxExemption + | CatalogObject.ServiceCharge + | CatalogObject.PricingRule + | CatalogObject.ProductSet + | CatalogObject.TimePeriod + | CatalogObject.MeasurementUnit + | CatalogObject.SubscriptionPlan + | CatalogObject.ItemOption + | CatalogObject.ItemOptionVal + | CatalogObject.CustomAttributeDefinition + | CatalogObject.QuickAmountsSettings + | CatalogObject.Component + | CatalogObject.Composition + | CatalogObject.Resource + | CatalogObject.CheckoutLink + | CatalogObject.Address + | CatalogObject.SubscriptionProduct; + + export interface Item extends serializers.CatalogObjectItem.Raw { + type: "ITEM"; + } + + export interface Image extends CatalogObjectImage.Raw { + type: "IMAGE"; + } + + export interface Category extends serializers.CatalogObjectCategory.Raw { + type: "CATEGORY"; + } + + export interface ItemVariation extends CatalogObjectItemVariation.Raw { + type: "ITEM_VARIATION"; + } + + export interface Tax extends CatalogObjectTax.Raw { + type: "TAX"; + } + + export interface Discount extends CatalogObjectDiscount.Raw { + type: "DISCOUNT"; + } + + export interface ModifierList extends serializers.CatalogObjectModifierList.Raw { + type: "MODIFIER_LIST"; + } + + export interface Modifier extends CatalogObjectModifier.Raw { + type: "MODIFIER"; + } + + export interface DiningOption extends CatalogObjectDiningOption.Raw { + type: "DINING_OPTION"; + } + + export interface TaxExemption extends CatalogObjectTaxExemption.Raw { + type: "TAX_EXEMPTION"; + } + + export interface ServiceCharge extends CatalogObjectServiceCharge.Raw { + type: "SERVICE_CHARGE"; + } + + export interface PricingRule extends CatalogObjectPricingRule.Raw { + type: "PRICING_RULE"; + } + + export interface ProductSet extends CatalogObjectProductSet.Raw { + type: "PRODUCT_SET"; + } + + export interface TimePeriod extends CatalogObjectTimePeriod.Raw { + type: "TIME_PERIOD"; + } + + export interface MeasurementUnit extends CatalogObjectMeasurementUnit.Raw { + type: "MEASUREMENT_UNIT"; + } + + export interface SubscriptionPlan extends serializers.CatalogObjectSubscriptionPlan.Raw { + type: "SUBSCRIPTION_PLAN"; + } + + export interface ItemOption extends serializers.CatalogObjectItemOption.Raw { + type: "ITEM_OPTION"; + } + + export interface ItemOptionVal extends CatalogObjectItemOptionValue.Raw { + type: "ITEM_OPTION_VAL"; + } + + export interface CustomAttributeDefinition extends CatalogObjectCustomAttributeDefinition.Raw { + type: "CUSTOM_ATTRIBUTE_DEFINITION"; + } + + export interface QuickAmountsSettings extends CatalogObjectQuickAmountsSettings.Raw { + type: "QUICK_AMOUNTS_SETTINGS"; + } + + export interface Component extends CatalogObjectComponent.Raw { + type: "COMPONENT"; + } + + export interface Composition extends CatalogObjectComposition.Raw { + type: "COMPOSITION"; + } + + export interface Resource extends CatalogObjectResource.Raw { + type: "RESOURCE"; + } + + export interface CheckoutLink extends CatalogObjectCheckoutLink.Raw { + type: "CHECKOUT_LINK"; + } + + export interface Address extends CatalogObjectAddress.Raw { + type: "ADDRESS"; + } + + export interface SubscriptionProduct extends CatalogObjectSubscriptionProduct.Raw { + type: "SUBSCRIPTION_PRODUCT"; + } +} diff --git a/src/serialization/types/CatalogObjectAddress.ts b/src/serialization/types/CatalogObjectAddress.ts new file mode 100644 index 000000000..b4b31b2bd --- /dev/null +++ b/src/serialization/types/CatalogObjectAddress.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectAddress: core.serialization.ObjectSchema< + serializers.CatalogObjectAddress.Raw, + Square.CatalogObjectAddress +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectAddress { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectBase.ts b/src/serialization/types/CatalogObjectBase.ts new file mode 100644 index 000000000..05fba814b --- /dev/null +++ b/src/serialization/types/CatalogObjectBase.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogCustomAttributeValue } from "./CatalogCustomAttributeValue"; +import { CatalogV1Id } from "./CatalogV1Id"; + +export const CatalogObjectBase: core.serialization.ObjectSchema< + serializers.CatalogObjectBase.Raw, + Square.CatalogObjectBase +> = core.serialization.object({ + id: core.serialization.string(), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + version: core.serialization.bigint().optional(), + isDeleted: core.serialization.property("is_deleted", core.serialization.boolean().optional()), + customAttributeValues: core.serialization.property( + "custom_attribute_values", + core.serialization.record(core.serialization.string(), CatalogCustomAttributeValue).optional(), + ), + catalogV1Ids: core.serialization.property("catalog_v1_ids", core.serialization.list(CatalogV1Id).optional()), + presentAtAllLocations: core.serialization.property( + "present_at_all_locations", + core.serialization.boolean().optional(), + ), + presentAtLocationIds: core.serialization.property( + "present_at_location_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + absentAtLocationIds: core.serialization.property( + "absent_at_location_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + imageId: core.serialization.property("image_id", core.serialization.string().optional()), +}); + +export declare namespace CatalogObjectBase { + export interface Raw { + id: string; + updated_at?: string | null; + version?: (bigint | number) | null; + is_deleted?: boolean | null; + custom_attribute_values?: Record | null; + catalog_v1_ids?: CatalogV1Id.Raw[] | null; + present_at_all_locations?: boolean | null; + present_at_location_ids?: string[] | null; + absent_at_location_ids?: string[] | null; + image_id?: string | null; + } +} diff --git a/src/serialization/types/CatalogObjectBatch.ts b/src/serialization/types/CatalogObjectBatch.ts new file mode 100644 index 000000000..74f6e1640 --- /dev/null +++ b/src/serialization/types/CatalogObjectBatch.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogObjectBatch: core.serialization.ObjectSchema< + serializers.CatalogObjectBatch.Raw, + Square.CatalogObjectBatch +> = core.serialization.object({ + objects: core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)), +}); + +export declare namespace CatalogObjectBatch { + export interface Raw { + objects: serializers.CatalogObject.Raw[]; + } +} diff --git a/src/serialization/types/CatalogObjectCategory.ts b/src/serialization/types/CatalogObjectCategory.ts new file mode 100644 index 000000000..f23ff7cb7 --- /dev/null +++ b/src/serialization/types/CatalogObjectCategory.ts @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogCustomAttributeValue } from "./CatalogCustomAttributeValue"; +import { CatalogV1Id } from "./CatalogV1Id"; + +export const CatalogObjectCategory: core.serialization.ObjectSchema< + serializers.CatalogObjectCategory.Raw, + Square.CatalogObjectCategory +> = core.serialization.object({ + id: core.serialization.string().optional(), + ordinal: core.serialization.bigint().optionalNullable(), + categoryData: core.serialization.property( + "category_data", + core.serialization.lazyObject(() => serializers.CatalogCategory).optional(), + ), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + version: core.serialization.bigint().optional(), + isDeleted: core.serialization.property("is_deleted", core.serialization.boolean().optional()), + customAttributeValues: core.serialization.property( + "custom_attribute_values", + core.serialization.record(core.serialization.string(), CatalogCustomAttributeValue).optional(), + ), + catalogV1Ids: core.serialization.property("catalog_v1_ids", core.serialization.list(CatalogV1Id).optional()), + presentAtAllLocations: core.serialization.property( + "present_at_all_locations", + core.serialization.boolean().optional(), + ), + presentAtLocationIds: core.serialization.property( + "present_at_location_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + absentAtLocationIds: core.serialization.property( + "absent_at_location_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + imageId: core.serialization.property("image_id", core.serialization.string().optional()), +}); + +export declare namespace CatalogObjectCategory { + export interface Raw { + id?: string | null; + ordinal?: ((bigint | number) | null) | null; + category_data?: serializers.CatalogCategory.Raw | null; + updated_at?: string | null; + version?: (bigint | number) | null; + is_deleted?: boolean | null; + custom_attribute_values?: Record | null; + catalog_v1_ids?: CatalogV1Id.Raw[] | null; + present_at_all_locations?: boolean | null; + present_at_location_ids?: string[] | null; + absent_at_location_ids?: string[] | null; + image_id?: string | null; + } +} diff --git a/src/serialization/types/CatalogObjectCheckoutLink.ts b/src/serialization/types/CatalogObjectCheckoutLink.ts new file mode 100644 index 000000000..e7d9782d7 --- /dev/null +++ b/src/serialization/types/CatalogObjectCheckoutLink.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectCheckoutLink: core.serialization.ObjectSchema< + serializers.CatalogObjectCheckoutLink.Raw, + Square.CatalogObjectCheckoutLink +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectCheckoutLink { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectComponent.ts b/src/serialization/types/CatalogObjectComponent.ts new file mode 100644 index 000000000..5edc7f4dd --- /dev/null +++ b/src/serialization/types/CatalogObjectComponent.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectComponent: core.serialization.ObjectSchema< + serializers.CatalogObjectComponent.Raw, + Square.CatalogObjectComponent +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectComponent { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectComposition.ts b/src/serialization/types/CatalogObjectComposition.ts new file mode 100644 index 000000000..a1b69f849 --- /dev/null +++ b/src/serialization/types/CatalogObjectComposition.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectComposition: core.serialization.ObjectSchema< + serializers.CatalogObjectComposition.Raw, + Square.CatalogObjectComposition +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectComposition { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectCustomAttributeDefinition.ts b/src/serialization/types/CatalogObjectCustomAttributeDefinition.ts new file mode 100644 index 000000000..d2857d7e0 --- /dev/null +++ b/src/serialization/types/CatalogObjectCustomAttributeDefinition.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogCustomAttributeDefinition } from "./CatalogCustomAttributeDefinition"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectCustomAttributeDefinition: core.serialization.ObjectSchema< + serializers.CatalogObjectCustomAttributeDefinition.Raw, + Square.CatalogObjectCustomAttributeDefinition +> = core.serialization + .object({ + customAttributeDefinitionData: core.serialization.property( + "custom_attribute_definition_data", + CatalogCustomAttributeDefinition.optional(), + ), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectCustomAttributeDefinition { + export interface Raw extends CatalogObjectBase.Raw { + custom_attribute_definition_data?: CatalogCustomAttributeDefinition.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectDiningOption.ts b/src/serialization/types/CatalogObjectDiningOption.ts new file mode 100644 index 000000000..c35916507 --- /dev/null +++ b/src/serialization/types/CatalogObjectDiningOption.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectDiningOption: core.serialization.ObjectSchema< + serializers.CatalogObjectDiningOption.Raw, + Square.CatalogObjectDiningOption +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectDiningOption { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectDiscount.ts b/src/serialization/types/CatalogObjectDiscount.ts new file mode 100644 index 000000000..8fa372b7f --- /dev/null +++ b/src/serialization/types/CatalogObjectDiscount.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogDiscount } from "./CatalogDiscount"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectDiscount: core.serialization.ObjectSchema< + serializers.CatalogObjectDiscount.Raw, + Square.CatalogObjectDiscount +> = core.serialization + .object({ + discountData: core.serialization.property("discount_data", CatalogDiscount.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectDiscount { + export interface Raw extends CatalogObjectBase.Raw { + discount_data?: CatalogDiscount.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectImage.ts b/src/serialization/types/CatalogObjectImage.ts new file mode 100644 index 000000000..8fed46189 --- /dev/null +++ b/src/serialization/types/CatalogObjectImage.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogImage } from "./CatalogImage"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectImage: core.serialization.ObjectSchema< + serializers.CatalogObjectImage.Raw, + Square.CatalogObjectImage +> = core.serialization + .object({ + imageData: core.serialization.property("image_data", CatalogImage.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectImage { + export interface Raw extends CatalogObjectBase.Raw { + image_data?: CatalogImage.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectItem.ts b/src/serialization/types/CatalogObjectItem.ts new file mode 100644 index 000000000..b7b91e20f --- /dev/null +++ b/src/serialization/types/CatalogObjectItem.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectItem: core.serialization.ObjectSchema< + serializers.CatalogObjectItem.Raw, + Square.CatalogObjectItem +> = core.serialization + .object({ + itemData: core.serialization.property( + "item_data", + core.serialization.lazyObject(() => serializers.CatalogItem).optional(), + ), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectItem { + export interface Raw extends CatalogObjectBase.Raw { + item_data?: serializers.CatalogItem.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectItemOption.ts b/src/serialization/types/CatalogObjectItemOption.ts new file mode 100644 index 000000000..fa36313a8 --- /dev/null +++ b/src/serialization/types/CatalogObjectItemOption.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectItemOption: core.serialization.ObjectSchema< + serializers.CatalogObjectItemOption.Raw, + Square.CatalogObjectItemOption +> = core.serialization + .object({ + itemOptionData: core.serialization.property( + "item_option_data", + core.serialization.lazyObject(() => serializers.CatalogItemOption).optional(), + ), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectItemOption { + export interface Raw extends CatalogObjectBase.Raw { + item_option_data?: serializers.CatalogItemOption.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectItemOptionValue.ts b/src/serialization/types/CatalogObjectItemOptionValue.ts new file mode 100644 index 000000000..7326bfd59 --- /dev/null +++ b/src/serialization/types/CatalogObjectItemOptionValue.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogItemOptionValue } from "./CatalogItemOptionValue"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectItemOptionValue: core.serialization.ObjectSchema< + serializers.CatalogObjectItemOptionValue.Raw, + Square.CatalogObjectItemOptionValue +> = core.serialization + .object({ + itemOptionValueData: core.serialization.property("item_option_value_data", CatalogItemOptionValue.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectItemOptionValue { + export interface Raw extends CatalogObjectBase.Raw { + item_option_value_data?: CatalogItemOptionValue.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectItemVariation.ts b/src/serialization/types/CatalogObjectItemVariation.ts new file mode 100644 index 000000000..88d8f4c80 --- /dev/null +++ b/src/serialization/types/CatalogObjectItemVariation.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogItemVariation } from "./CatalogItemVariation"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectItemVariation: core.serialization.ObjectSchema< + serializers.CatalogObjectItemVariation.Raw, + Square.CatalogObjectItemVariation +> = core.serialization + .object({ + itemVariationData: core.serialization.property("item_variation_data", CatalogItemVariation.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectItemVariation { + export interface Raw extends CatalogObjectBase.Raw { + item_variation_data?: CatalogItemVariation.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectMeasurementUnit.ts b/src/serialization/types/CatalogObjectMeasurementUnit.ts new file mode 100644 index 000000000..753f727e8 --- /dev/null +++ b/src/serialization/types/CatalogObjectMeasurementUnit.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogMeasurementUnit } from "./CatalogMeasurementUnit"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectMeasurementUnit: core.serialization.ObjectSchema< + serializers.CatalogObjectMeasurementUnit.Raw, + Square.CatalogObjectMeasurementUnit +> = core.serialization + .object({ + measurementUnitData: core.serialization.property("measurement_unit_data", CatalogMeasurementUnit.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectMeasurementUnit { + export interface Raw extends CatalogObjectBase.Raw { + measurement_unit_data?: CatalogMeasurementUnit.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectModifier.ts b/src/serialization/types/CatalogObjectModifier.ts new file mode 100644 index 000000000..c2e146e43 --- /dev/null +++ b/src/serialization/types/CatalogObjectModifier.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogModifier } from "./CatalogModifier"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectModifier: core.serialization.ObjectSchema< + serializers.CatalogObjectModifier.Raw, + Square.CatalogObjectModifier +> = core.serialization + .object({ + modifierData: core.serialization.property("modifier_data", CatalogModifier.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectModifier { + export interface Raw extends CatalogObjectBase.Raw { + modifier_data?: CatalogModifier.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectModifierList.ts b/src/serialization/types/CatalogObjectModifierList.ts new file mode 100644 index 000000000..0e98634e9 --- /dev/null +++ b/src/serialization/types/CatalogObjectModifierList.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectModifierList: core.serialization.ObjectSchema< + serializers.CatalogObjectModifierList.Raw, + Square.CatalogObjectModifierList +> = core.serialization + .object({ + modifierListData: core.serialization.property( + "modifier_list_data", + core.serialization.lazyObject(() => serializers.CatalogModifierList).optional(), + ), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectModifierList { + export interface Raw extends CatalogObjectBase.Raw { + modifier_list_data?: serializers.CatalogModifierList.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectPricingRule.ts b/src/serialization/types/CatalogObjectPricingRule.ts new file mode 100644 index 000000000..442c3483c --- /dev/null +++ b/src/serialization/types/CatalogObjectPricingRule.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogPricingRule } from "./CatalogPricingRule"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectPricingRule: core.serialization.ObjectSchema< + serializers.CatalogObjectPricingRule.Raw, + Square.CatalogObjectPricingRule +> = core.serialization + .object({ + pricingRuleData: core.serialization.property("pricing_rule_data", CatalogPricingRule.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectPricingRule { + export interface Raw extends CatalogObjectBase.Raw { + pricing_rule_data?: CatalogPricingRule.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectProductSet.ts b/src/serialization/types/CatalogObjectProductSet.ts new file mode 100644 index 000000000..862eda0e1 --- /dev/null +++ b/src/serialization/types/CatalogObjectProductSet.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogProductSet } from "./CatalogProductSet"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectProductSet: core.serialization.ObjectSchema< + serializers.CatalogObjectProductSet.Raw, + Square.CatalogObjectProductSet +> = core.serialization + .object({ + productSetData: core.serialization.property("product_set_data", CatalogProductSet.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectProductSet { + export interface Raw extends CatalogObjectBase.Raw { + product_set_data?: CatalogProductSet.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectQuickAmountsSettings.ts b/src/serialization/types/CatalogObjectQuickAmountsSettings.ts new file mode 100644 index 000000000..34ca8497d --- /dev/null +++ b/src/serialization/types/CatalogObjectQuickAmountsSettings.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogQuickAmountsSettings } from "./CatalogQuickAmountsSettings"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectQuickAmountsSettings: core.serialization.ObjectSchema< + serializers.CatalogObjectQuickAmountsSettings.Raw, + Square.CatalogObjectQuickAmountsSettings +> = core.serialization + .object({ + quickAmountsSettingsData: core.serialization.property( + "quick_amounts_settings_data", + CatalogQuickAmountsSettings.optional(), + ), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectQuickAmountsSettings { + export interface Raw extends CatalogObjectBase.Raw { + quick_amounts_settings_data?: CatalogQuickAmountsSettings.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectReference.ts b/src/serialization/types/CatalogObjectReference.ts new file mode 100644 index 000000000..c7e20761c --- /dev/null +++ b/src/serialization/types/CatalogObjectReference.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogObjectReference: core.serialization.ObjectSchema< + serializers.CatalogObjectReference.Raw, + Square.CatalogObjectReference +> = core.serialization.object({ + objectId: core.serialization.property("object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), +}); + +export declare namespace CatalogObjectReference { + export interface Raw { + object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + } +} diff --git a/src/serialization/types/CatalogObjectResource.ts b/src/serialization/types/CatalogObjectResource.ts new file mode 100644 index 000000000..01ffb4813 --- /dev/null +++ b/src/serialization/types/CatalogObjectResource.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectResource: core.serialization.ObjectSchema< + serializers.CatalogObjectResource.Raw, + Square.CatalogObjectResource +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectResource { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectServiceCharge.ts b/src/serialization/types/CatalogObjectServiceCharge.ts new file mode 100644 index 000000000..04e0e9871 --- /dev/null +++ b/src/serialization/types/CatalogObjectServiceCharge.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectServiceCharge: core.serialization.ObjectSchema< + serializers.CatalogObjectServiceCharge.Raw, + Square.CatalogObjectServiceCharge +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectServiceCharge { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectSubscriptionPlan.ts b/src/serialization/types/CatalogObjectSubscriptionPlan.ts new file mode 100644 index 000000000..ac4fffc44 --- /dev/null +++ b/src/serialization/types/CatalogObjectSubscriptionPlan.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectSubscriptionPlan: core.serialization.ObjectSchema< + serializers.CatalogObjectSubscriptionPlan.Raw, + Square.CatalogObjectSubscriptionPlan +> = core.serialization + .object({ + subscriptionPlanData: core.serialization.property( + "subscription_plan_data", + core.serialization.lazyObject(() => serializers.CatalogSubscriptionPlan).optional(), + ), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectSubscriptionPlan { + export interface Raw extends CatalogObjectBase.Raw { + subscription_plan_data?: serializers.CatalogSubscriptionPlan.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectSubscriptionProduct.ts b/src/serialization/types/CatalogObjectSubscriptionProduct.ts new file mode 100644 index 000000000..7cc5db6d7 --- /dev/null +++ b/src/serialization/types/CatalogObjectSubscriptionProduct.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectSubscriptionProduct: core.serialization.ObjectSchema< + serializers.CatalogObjectSubscriptionProduct.Raw, + Square.CatalogObjectSubscriptionProduct +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectSubscriptionProduct { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectTax.ts b/src/serialization/types/CatalogObjectTax.ts new file mode 100644 index 000000000..890d0cb15 --- /dev/null +++ b/src/serialization/types/CatalogObjectTax.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogTax } from "./CatalogTax"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectTax: core.serialization.ObjectSchema< + serializers.CatalogObjectTax.Raw, + Square.CatalogObjectTax +> = core.serialization + .object({ + taxData: core.serialization.property("tax_data", CatalogTax.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectTax { + export interface Raw extends CatalogObjectBase.Raw { + tax_data?: CatalogTax.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectTaxExemption.ts b/src/serialization/types/CatalogObjectTaxExemption.ts new file mode 100644 index 000000000..e6933bb40 --- /dev/null +++ b/src/serialization/types/CatalogObjectTaxExemption.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectTaxExemption: core.serialization.ObjectSchema< + serializers.CatalogObjectTaxExemption.Raw, + Square.CatalogObjectTaxExemption +> = core.serialization.object({}).extend(CatalogObjectBase); + +export declare namespace CatalogObjectTaxExemption { + export interface Raw extends CatalogObjectBase.Raw {} +} diff --git a/src/serialization/types/CatalogObjectTimePeriod.ts b/src/serialization/types/CatalogObjectTimePeriod.ts new file mode 100644 index 000000000..b199b9374 --- /dev/null +++ b/src/serialization/types/CatalogObjectTimePeriod.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogTimePeriod } from "./CatalogTimePeriod"; +import { CatalogObjectBase } from "./CatalogObjectBase"; + +export const CatalogObjectTimePeriod: core.serialization.ObjectSchema< + serializers.CatalogObjectTimePeriod.Raw, + Square.CatalogObjectTimePeriod +> = core.serialization + .object({ + timePeriodData: core.serialization.property("time_period_data", CatalogTimePeriod.optional()), + }) + .extend(CatalogObjectBase); + +export declare namespace CatalogObjectTimePeriod { + export interface Raw extends CatalogObjectBase.Raw { + time_period_data?: CatalogTimePeriod.Raw | null; + } +} diff --git a/src/serialization/types/CatalogObjectType.ts b/src/serialization/types/CatalogObjectType.ts new file mode 100644 index 000000000..178202e9d --- /dev/null +++ b/src/serialization/types/CatalogObjectType.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogObjectType: core.serialization.Schema = + core.serialization.enum_([ + "ITEM", + "IMAGE", + "CATEGORY", + "ITEM_VARIATION", + "TAX", + "DISCOUNT", + "MODIFIER_LIST", + "MODIFIER", + "PRICING_RULE", + "PRODUCT_SET", + "TIME_PERIOD", + "MEASUREMENT_UNIT", + "SUBSCRIPTION_PLAN_VARIATION", + "ITEM_OPTION", + "ITEM_OPTION_VAL", + "CUSTOM_ATTRIBUTE_DEFINITION", + "QUICK_AMOUNTS_SETTINGS", + "SUBSCRIPTION_PLAN", + "AVAILABILITY_PERIOD", + ]); + +export declare namespace CatalogObjectType { + export type Raw = + | "ITEM" + | "IMAGE" + | "CATEGORY" + | "ITEM_VARIATION" + | "TAX" + | "DISCOUNT" + | "MODIFIER_LIST" + | "MODIFIER" + | "PRICING_RULE" + | "PRODUCT_SET" + | "TIME_PERIOD" + | "MEASUREMENT_UNIT" + | "SUBSCRIPTION_PLAN_VARIATION" + | "ITEM_OPTION" + | "ITEM_OPTION_VAL" + | "CUSTOM_ATTRIBUTE_DEFINITION" + | "QUICK_AMOUNTS_SETTINGS" + | "SUBSCRIPTION_PLAN" + | "AVAILABILITY_PERIOD"; +} diff --git a/src/serialization/types/CatalogPricingRule.ts b/src/serialization/types/CatalogPricingRule.ts new file mode 100644 index 000000000..083f32b61 --- /dev/null +++ b/src/serialization/types/CatalogPricingRule.ts @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ExcludeStrategy } from "./ExcludeStrategy"; +import { Money } from "./Money"; + +export const CatalogPricingRule: core.serialization.ObjectSchema< + serializers.CatalogPricingRule.Raw, + Square.CatalogPricingRule +> = core.serialization.object({ + name: core.serialization.string().optionalNullable(), + timePeriodIds: core.serialization.property( + "time_period_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + discountId: core.serialization.property("discount_id", core.serialization.string().optionalNullable()), + matchProductsId: core.serialization.property("match_products_id", core.serialization.string().optionalNullable()), + applyProductsId: core.serialization.property("apply_products_id", core.serialization.string().optionalNullable()), + excludeProductsId: core.serialization.property( + "exclude_products_id", + core.serialization.string().optionalNullable(), + ), + validFromDate: core.serialization.property("valid_from_date", core.serialization.string().optionalNullable()), + validFromLocalTime: core.serialization.property( + "valid_from_local_time", + core.serialization.string().optionalNullable(), + ), + validUntilDate: core.serialization.property("valid_until_date", core.serialization.string().optionalNullable()), + validUntilLocalTime: core.serialization.property( + "valid_until_local_time", + core.serialization.string().optionalNullable(), + ), + excludeStrategy: core.serialization.property("exclude_strategy", ExcludeStrategy.optional()), + minimumOrderSubtotalMoney: core.serialization.property("minimum_order_subtotal_money", Money.optional()), + customerGroupIdsAny: core.serialization.property( + "customer_group_ids_any", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace CatalogPricingRule { + export interface Raw { + name?: (string | null) | null; + time_period_ids?: (string[] | null) | null; + discount_id?: (string | null) | null; + match_products_id?: (string | null) | null; + apply_products_id?: (string | null) | null; + exclude_products_id?: (string | null) | null; + valid_from_date?: (string | null) | null; + valid_from_local_time?: (string | null) | null; + valid_until_date?: (string | null) | null; + valid_until_local_time?: (string | null) | null; + exclude_strategy?: ExcludeStrategy.Raw | null; + minimum_order_subtotal_money?: Money.Raw | null; + customer_group_ids_any?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/CatalogPricingType.ts b/src/serialization/types/CatalogPricingType.ts new file mode 100644 index 000000000..3a4a30619 --- /dev/null +++ b/src/serialization/types/CatalogPricingType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogPricingType: core.serialization.Schema< + serializers.CatalogPricingType.Raw, + Square.CatalogPricingType +> = core.serialization.enum_(["FIXED_PRICING", "VARIABLE_PRICING"]); + +export declare namespace CatalogPricingType { + export type Raw = "FIXED_PRICING" | "VARIABLE_PRICING"; +} diff --git a/src/serialization/types/CatalogProductSet.ts b/src/serialization/types/CatalogProductSet.ts new file mode 100644 index 000000000..f8c98f1db --- /dev/null +++ b/src/serialization/types/CatalogProductSet.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogProductSet: core.serialization.ObjectSchema< + serializers.CatalogProductSet.Raw, + Square.CatalogProductSet +> = core.serialization.object({ + name: core.serialization.string().optionalNullable(), + productIdsAny: core.serialization.property( + "product_ids_any", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + productIdsAll: core.serialization.property( + "product_ids_all", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + quantityExact: core.serialization.property("quantity_exact", core.serialization.bigint().optionalNullable()), + quantityMin: core.serialization.property("quantity_min", core.serialization.bigint().optionalNullable()), + quantityMax: core.serialization.property("quantity_max", core.serialization.bigint().optionalNullable()), + allProducts: core.serialization.property("all_products", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace CatalogProductSet { + export interface Raw { + name?: (string | null) | null; + product_ids_any?: (string[] | null) | null; + product_ids_all?: (string[] | null) | null; + quantity_exact?: ((bigint | number) | null) | null; + quantity_min?: ((bigint | number) | null) | null; + quantity_max?: ((bigint | number) | null) | null; + all_products?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CatalogQuery.ts b/src/serialization/types/CatalogQuery.ts new file mode 100644 index 000000000..120ca5426 --- /dev/null +++ b/src/serialization/types/CatalogQuery.ts @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogQuerySortedAttribute } from "./CatalogQuerySortedAttribute"; +import { CatalogQueryExact } from "./CatalogQueryExact"; +import { CatalogQuerySet } from "./CatalogQuerySet"; +import { CatalogQueryPrefix } from "./CatalogQueryPrefix"; +import { CatalogQueryRange } from "./CatalogQueryRange"; +import { CatalogQueryText } from "./CatalogQueryText"; +import { CatalogQueryItemsForTax } from "./CatalogQueryItemsForTax"; +import { CatalogQueryItemsForModifierList } from "./CatalogQueryItemsForModifierList"; +import { CatalogQueryItemsForItemOptions } from "./CatalogQueryItemsForItemOptions"; +import { CatalogQueryItemVariationsForItemOptionValues } from "./CatalogQueryItemVariationsForItemOptionValues"; + +export const CatalogQuery: core.serialization.ObjectSchema = + core.serialization.object({ + sortedAttributeQuery: core.serialization.property( + "sorted_attribute_query", + CatalogQuerySortedAttribute.optional(), + ), + exactQuery: core.serialization.property("exact_query", CatalogQueryExact.optional()), + setQuery: core.serialization.property("set_query", CatalogQuerySet.optional()), + prefixQuery: core.serialization.property("prefix_query", CatalogQueryPrefix.optional()), + rangeQuery: core.serialization.property("range_query", CatalogQueryRange.optional()), + textQuery: core.serialization.property("text_query", CatalogQueryText.optional()), + itemsForTaxQuery: core.serialization.property("items_for_tax_query", CatalogQueryItemsForTax.optional()), + itemsForModifierListQuery: core.serialization.property( + "items_for_modifier_list_query", + CatalogQueryItemsForModifierList.optional(), + ), + itemsForItemOptionsQuery: core.serialization.property( + "items_for_item_options_query", + CatalogQueryItemsForItemOptions.optional(), + ), + itemVariationsForItemOptionValuesQuery: core.serialization.property( + "item_variations_for_item_option_values_query", + CatalogQueryItemVariationsForItemOptionValues.optional(), + ), + }); + +export declare namespace CatalogQuery { + export interface Raw { + sorted_attribute_query?: CatalogQuerySortedAttribute.Raw | null; + exact_query?: CatalogQueryExact.Raw | null; + set_query?: CatalogQuerySet.Raw | null; + prefix_query?: CatalogQueryPrefix.Raw | null; + range_query?: CatalogQueryRange.Raw | null; + text_query?: CatalogQueryText.Raw | null; + items_for_tax_query?: CatalogQueryItemsForTax.Raw | null; + items_for_modifier_list_query?: CatalogQueryItemsForModifierList.Raw | null; + items_for_item_options_query?: CatalogQueryItemsForItemOptions.Raw | null; + item_variations_for_item_option_values_query?: CatalogQueryItemVariationsForItemOptionValues.Raw | null; + } +} diff --git a/src/serialization/types/CatalogQueryExact.ts b/src/serialization/types/CatalogQueryExact.ts new file mode 100644 index 000000000..6e990610c --- /dev/null +++ b/src/serialization/types/CatalogQueryExact.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQueryExact: core.serialization.ObjectSchema< + serializers.CatalogQueryExact.Raw, + Square.CatalogQueryExact +> = core.serialization.object({ + attributeName: core.serialization.property("attribute_name", core.serialization.string()), + attributeValue: core.serialization.property("attribute_value", core.serialization.string()), +}); + +export declare namespace CatalogQueryExact { + export interface Raw { + attribute_name: string; + attribute_value: string; + } +} diff --git a/src/serialization/types/CatalogQueryItemVariationsForItemOptionValues.ts b/src/serialization/types/CatalogQueryItemVariationsForItemOptionValues.ts new file mode 100644 index 000000000..9c2698c6d --- /dev/null +++ b/src/serialization/types/CatalogQueryItemVariationsForItemOptionValues.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQueryItemVariationsForItemOptionValues: core.serialization.ObjectSchema< + serializers.CatalogQueryItemVariationsForItemOptionValues.Raw, + Square.CatalogQueryItemVariationsForItemOptionValues +> = core.serialization.object({ + itemOptionValueIds: core.serialization.property( + "item_option_value_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace CatalogQueryItemVariationsForItemOptionValues { + export interface Raw { + item_option_value_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/CatalogQueryItemsForItemOptions.ts b/src/serialization/types/CatalogQueryItemsForItemOptions.ts new file mode 100644 index 000000000..820bc6bcd --- /dev/null +++ b/src/serialization/types/CatalogQueryItemsForItemOptions.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQueryItemsForItemOptions: core.serialization.ObjectSchema< + serializers.CatalogQueryItemsForItemOptions.Raw, + Square.CatalogQueryItemsForItemOptions +> = core.serialization.object({ + itemOptionIds: core.serialization.property( + "item_option_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace CatalogQueryItemsForItemOptions { + export interface Raw { + item_option_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/CatalogQueryItemsForModifierList.ts b/src/serialization/types/CatalogQueryItemsForModifierList.ts new file mode 100644 index 000000000..bdf2752f9 --- /dev/null +++ b/src/serialization/types/CatalogQueryItemsForModifierList.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQueryItemsForModifierList: core.serialization.ObjectSchema< + serializers.CatalogQueryItemsForModifierList.Raw, + Square.CatalogQueryItemsForModifierList +> = core.serialization.object({ + modifierListIds: core.serialization.property( + "modifier_list_ids", + core.serialization.list(core.serialization.string()), + ), +}); + +export declare namespace CatalogQueryItemsForModifierList { + export interface Raw { + modifier_list_ids: string[]; + } +} diff --git a/src/serialization/types/CatalogQueryItemsForTax.ts b/src/serialization/types/CatalogQueryItemsForTax.ts new file mode 100644 index 000000000..de63f3cd6 --- /dev/null +++ b/src/serialization/types/CatalogQueryItemsForTax.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQueryItemsForTax: core.serialization.ObjectSchema< + serializers.CatalogQueryItemsForTax.Raw, + Square.CatalogQueryItemsForTax +> = core.serialization.object({ + taxIds: core.serialization.property("tax_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace CatalogQueryItemsForTax { + export interface Raw { + tax_ids: string[]; + } +} diff --git a/src/serialization/types/CatalogQueryPrefix.ts b/src/serialization/types/CatalogQueryPrefix.ts new file mode 100644 index 000000000..d3bb0198f --- /dev/null +++ b/src/serialization/types/CatalogQueryPrefix.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQueryPrefix: core.serialization.ObjectSchema< + serializers.CatalogQueryPrefix.Raw, + Square.CatalogQueryPrefix +> = core.serialization.object({ + attributeName: core.serialization.property("attribute_name", core.serialization.string()), + attributePrefix: core.serialization.property("attribute_prefix", core.serialization.string()), +}); + +export declare namespace CatalogQueryPrefix { + export interface Raw { + attribute_name: string; + attribute_prefix: string; + } +} diff --git a/src/serialization/types/CatalogQueryRange.ts b/src/serialization/types/CatalogQueryRange.ts new file mode 100644 index 000000000..0a62d5286 --- /dev/null +++ b/src/serialization/types/CatalogQueryRange.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQueryRange: core.serialization.ObjectSchema< + serializers.CatalogQueryRange.Raw, + Square.CatalogQueryRange +> = core.serialization.object({ + attributeName: core.serialization.property("attribute_name", core.serialization.string()), + attributeMinValue: core.serialization.property( + "attribute_min_value", + core.serialization.bigint().optionalNullable(), + ), + attributeMaxValue: core.serialization.property( + "attribute_max_value", + core.serialization.bigint().optionalNullable(), + ), +}); + +export declare namespace CatalogQueryRange { + export interface Raw { + attribute_name: string; + attribute_min_value?: ((bigint | number) | null) | null; + attribute_max_value?: ((bigint | number) | null) | null; + } +} diff --git a/src/serialization/types/CatalogQuerySet.ts b/src/serialization/types/CatalogQuerySet.ts new file mode 100644 index 000000000..0c42e01f7 --- /dev/null +++ b/src/serialization/types/CatalogQuerySet.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQuerySet: core.serialization.ObjectSchema = + core.serialization.object({ + attributeName: core.serialization.property("attribute_name", core.serialization.string()), + attributeValues: core.serialization.property( + "attribute_values", + core.serialization.list(core.serialization.string()), + ), + }); + +export declare namespace CatalogQuerySet { + export interface Raw { + attribute_name: string; + attribute_values: string[]; + } +} diff --git a/src/serialization/types/CatalogQuerySortedAttribute.ts b/src/serialization/types/CatalogQuerySortedAttribute.ts new file mode 100644 index 000000000..5ff24ef07 --- /dev/null +++ b/src/serialization/types/CatalogQuerySortedAttribute.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SortOrder } from "./SortOrder"; + +export const CatalogQuerySortedAttribute: core.serialization.ObjectSchema< + serializers.CatalogQuerySortedAttribute.Raw, + Square.CatalogQuerySortedAttribute +> = core.serialization.object({ + attributeName: core.serialization.property("attribute_name", core.serialization.string()), + initialAttributeValue: core.serialization.property( + "initial_attribute_value", + core.serialization.string().optionalNullable(), + ), + sortOrder: core.serialization.property("sort_order", SortOrder.optional()), +}); + +export declare namespace CatalogQuerySortedAttribute { + export interface Raw { + attribute_name: string; + initial_attribute_value?: (string | null) | null; + sort_order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/CatalogQueryText.ts b/src/serialization/types/CatalogQueryText.ts new file mode 100644 index 000000000..b94fc9a29 --- /dev/null +++ b/src/serialization/types/CatalogQueryText.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQueryText: core.serialization.ObjectSchema< + serializers.CatalogQueryText.Raw, + Square.CatalogQueryText +> = core.serialization.object({ + keywords: core.serialization.list(core.serialization.string()), +}); + +export declare namespace CatalogQueryText { + export interface Raw { + keywords: string[]; + } +} diff --git a/src/serialization/types/CatalogQuickAmount.ts b/src/serialization/types/CatalogQuickAmount.ts new file mode 100644 index 000000000..3ff6828ca --- /dev/null +++ b/src/serialization/types/CatalogQuickAmount.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogQuickAmountType } from "./CatalogQuickAmountType"; +import { Money } from "./Money"; + +export const CatalogQuickAmount: core.serialization.ObjectSchema< + serializers.CatalogQuickAmount.Raw, + Square.CatalogQuickAmount +> = core.serialization.object({ + type: CatalogQuickAmountType, + amount: Money, + score: core.serialization.bigint().optionalNullable(), + ordinal: core.serialization.bigint().optionalNullable(), +}); + +export declare namespace CatalogQuickAmount { + export interface Raw { + type: CatalogQuickAmountType.Raw; + amount: Money.Raw; + score?: ((bigint | number) | null) | null; + ordinal?: ((bigint | number) | null) | null; + } +} diff --git a/src/serialization/types/CatalogQuickAmountType.ts b/src/serialization/types/CatalogQuickAmountType.ts new file mode 100644 index 000000000..10cbf99ae --- /dev/null +++ b/src/serialization/types/CatalogQuickAmountType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQuickAmountType: core.serialization.Schema< + serializers.CatalogQuickAmountType.Raw, + Square.CatalogQuickAmountType +> = core.serialization.enum_(["QUICK_AMOUNT_TYPE_MANUAL", "QUICK_AMOUNT_TYPE_AUTO"]); + +export declare namespace CatalogQuickAmountType { + export type Raw = "QUICK_AMOUNT_TYPE_MANUAL" | "QUICK_AMOUNT_TYPE_AUTO"; +} diff --git a/src/serialization/types/CatalogQuickAmountsSettings.ts b/src/serialization/types/CatalogQuickAmountsSettings.ts new file mode 100644 index 000000000..efe43eff6 --- /dev/null +++ b/src/serialization/types/CatalogQuickAmountsSettings.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CatalogQuickAmountsSettingsOption } from "./CatalogQuickAmountsSettingsOption"; +import { CatalogQuickAmount } from "./CatalogQuickAmount"; + +export const CatalogQuickAmountsSettings: core.serialization.ObjectSchema< + serializers.CatalogQuickAmountsSettings.Raw, + Square.CatalogQuickAmountsSettings +> = core.serialization.object({ + option: CatalogQuickAmountsSettingsOption, + eligibleForAutoAmounts: core.serialization.property( + "eligible_for_auto_amounts", + core.serialization.boolean().optionalNullable(), + ), + amounts: core.serialization.list(CatalogQuickAmount).optionalNullable(), +}); + +export declare namespace CatalogQuickAmountsSettings { + export interface Raw { + option: CatalogQuickAmountsSettingsOption.Raw; + eligible_for_auto_amounts?: (boolean | null) | null; + amounts?: (CatalogQuickAmount.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/CatalogQuickAmountsSettingsOption.ts b/src/serialization/types/CatalogQuickAmountsSettingsOption.ts new file mode 100644 index 000000000..dc5cd9051 --- /dev/null +++ b/src/serialization/types/CatalogQuickAmountsSettingsOption.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogQuickAmountsSettingsOption: core.serialization.Schema< + serializers.CatalogQuickAmountsSettingsOption.Raw, + Square.CatalogQuickAmountsSettingsOption +> = core.serialization.enum_(["DISABLED", "MANUAL", "AUTO"]); + +export declare namespace CatalogQuickAmountsSettingsOption { + export type Raw = "DISABLED" | "MANUAL" | "AUTO"; +} diff --git a/src/serialization/types/CatalogStockConversion.ts b/src/serialization/types/CatalogStockConversion.ts new file mode 100644 index 000000000..365449418 --- /dev/null +++ b/src/serialization/types/CatalogStockConversion.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogStockConversion: core.serialization.ObjectSchema< + serializers.CatalogStockConversion.Raw, + Square.CatalogStockConversion +> = core.serialization.object({ + stockableItemVariationId: core.serialization.property("stockable_item_variation_id", core.serialization.string()), + stockableQuantity: core.serialization.property("stockable_quantity", core.serialization.string()), + nonstockableQuantity: core.serialization.property("nonstockable_quantity", core.serialization.string()), +}); + +export declare namespace CatalogStockConversion { + export interface Raw { + stockable_item_variation_id: string; + stockable_quantity: string; + nonstockable_quantity: string; + } +} diff --git a/src/serialization/types/CatalogSubscriptionPlan.ts b/src/serialization/types/CatalogSubscriptionPlan.ts new file mode 100644 index 000000000..189e4b302 --- /dev/null +++ b/src/serialization/types/CatalogSubscriptionPlan.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionPhase } from "./SubscriptionPhase"; + +export const CatalogSubscriptionPlan: core.serialization.ObjectSchema< + serializers.CatalogSubscriptionPlan.Raw, + Square.CatalogSubscriptionPlan +> = core.serialization.object({ + name: core.serialization.string(), + phases: core.serialization.list(SubscriptionPhase).optionalNullable(), + subscriptionPlanVariations: core.serialization.property( + "subscription_plan_variations", + core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optionalNullable(), + ), + eligibleItemIds: core.serialization.property( + "eligible_item_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + eligibleCategoryIds: core.serialization.property( + "eligible_category_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + allItems: core.serialization.property("all_items", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace CatalogSubscriptionPlan { + export interface Raw { + name: string; + phases?: (SubscriptionPhase.Raw[] | null) | null; + subscription_plan_variations?: (serializers.CatalogObject.Raw[] | null) | null; + eligible_item_ids?: (string[] | null) | null; + eligible_category_ids?: (string[] | null) | null; + all_items?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CatalogTax.ts b/src/serialization/types/CatalogTax.ts new file mode 100644 index 000000000..be8da258b --- /dev/null +++ b/src/serialization/types/CatalogTax.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TaxCalculationPhase } from "./TaxCalculationPhase"; +import { TaxInclusionType } from "./TaxInclusionType"; + +export const CatalogTax: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optionalNullable(), + calculationPhase: core.serialization.property("calculation_phase", TaxCalculationPhase.optional()), + inclusionType: core.serialization.property("inclusion_type", TaxInclusionType.optional()), + percentage: core.serialization.string().optionalNullable(), + appliesToCustomAmounts: core.serialization.property( + "applies_to_custom_amounts", + core.serialization.boolean().optionalNullable(), + ), + enabled: core.serialization.boolean().optionalNullable(), + appliesToProductSetId: core.serialization.property( + "applies_to_product_set_id", + core.serialization.string().optionalNullable(), + ), + }); + +export declare namespace CatalogTax { + export interface Raw { + name?: (string | null) | null; + calculation_phase?: TaxCalculationPhase.Raw | null; + inclusion_type?: TaxInclusionType.Raw | null; + percentage?: (string | null) | null; + applies_to_custom_amounts?: (boolean | null) | null; + enabled?: (boolean | null) | null; + applies_to_product_set_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogTimePeriod.ts b/src/serialization/types/CatalogTimePeriod.ts new file mode 100644 index 000000000..de733eb0b --- /dev/null +++ b/src/serialization/types/CatalogTimePeriod.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogTimePeriod: core.serialization.ObjectSchema< + serializers.CatalogTimePeriod.Raw, + Square.CatalogTimePeriod +> = core.serialization.object({ + event: core.serialization.string().optionalNullable(), +}); + +export declare namespace CatalogTimePeriod { + export interface Raw { + event?: (string | null) | null; + } +} diff --git a/src/serialization/types/CatalogV1Id.ts b/src/serialization/types/CatalogV1Id.ts new file mode 100644 index 000000000..a7231e4a0 --- /dev/null +++ b/src/serialization/types/CatalogV1Id.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CatalogV1Id: core.serialization.ObjectSchema = + core.serialization.object({ + catalogV1Id: core.serialization.property("catalog_v1_id", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace CatalogV1Id { + export interface Raw { + catalog_v1_id?: (string | null) | null; + location_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/CategoryPathToRootNode.ts b/src/serialization/types/CategoryPathToRootNode.ts new file mode 100644 index 000000000..47488d412 --- /dev/null +++ b/src/serialization/types/CategoryPathToRootNode.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CategoryPathToRootNode: core.serialization.ObjectSchema< + serializers.CategoryPathToRootNode.Raw, + Square.CategoryPathToRootNode +> = core.serialization.object({ + categoryId: core.serialization.property("category_id", core.serialization.string().optionalNullable()), + categoryName: core.serialization.property("category_name", core.serialization.string().optionalNullable()), +}); + +export declare namespace CategoryPathToRootNode { + export interface Raw { + category_id?: (string | null) | null; + category_name?: (string | null) | null; + } +} diff --git a/src/serialization/types/ChangeBillingAnchorDateResponse.ts b/src/serialization/types/ChangeBillingAnchorDateResponse.ts new file mode 100644 index 000000000..34d7cf67d --- /dev/null +++ b/src/serialization/types/ChangeBillingAnchorDateResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; +import { SubscriptionAction } from "./SubscriptionAction"; + +export const ChangeBillingAnchorDateResponse: core.serialization.ObjectSchema< + serializers.ChangeBillingAnchorDateResponse.Raw, + Square.ChangeBillingAnchorDateResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), + actions: core.serialization.list(SubscriptionAction).optional(), +}); + +export declare namespace ChangeBillingAnchorDateResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + actions?: SubscriptionAction.Raw[] | null; + } +} diff --git a/src/serialization/types/ChangeTiming.ts b/src/serialization/types/ChangeTiming.ts new file mode 100644 index 000000000..490df3d08 --- /dev/null +++ b/src/serialization/types/ChangeTiming.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ChangeTiming: core.serialization.Schema = + core.serialization.enum_(["IMMEDIATE", "END_OF_BILLING_CYCLE"]); + +export declare namespace ChangeTiming { + export type Raw = "IMMEDIATE" | "END_OF_BILLING_CYCLE"; +} diff --git a/src/serialization/types/ChargeRequestAdditionalRecipient.ts b/src/serialization/types/ChargeRequestAdditionalRecipient.ts new file mode 100644 index 000000000..7da0d9bbe --- /dev/null +++ b/src/serialization/types/ChargeRequestAdditionalRecipient.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const ChargeRequestAdditionalRecipient: core.serialization.ObjectSchema< + serializers.ChargeRequestAdditionalRecipient.Raw, + Square.ChargeRequestAdditionalRecipient +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string()), + description: core.serialization.string(), + amountMoney: core.serialization.property("amount_money", Money), +}); + +export declare namespace ChargeRequestAdditionalRecipient { + export interface Raw { + location_id: string; + description: string; + amount_money: Money.Raw; + } +} diff --git a/src/serialization/types/Checkout.ts b/src/serialization/types/Checkout.ts new file mode 100644 index 000000000..af318ff29 --- /dev/null +++ b/src/serialization/types/Checkout.ts @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; +import { Order } from "./Order"; +import { AdditionalRecipient } from "./AdditionalRecipient"; + +export const Checkout: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + checkoutPageUrl: core.serialization.property( + "checkout_page_url", + core.serialization.string().optionalNullable(), + ), + askForShippingAddress: core.serialization.property( + "ask_for_shipping_address", + core.serialization.boolean().optionalNullable(), + ), + merchantSupportEmail: core.serialization.property( + "merchant_support_email", + core.serialization.string().optionalNullable(), + ), + prePopulateBuyerEmail: core.serialization.property( + "pre_populate_buyer_email", + core.serialization.string().optionalNullable(), + ), + prePopulateShippingAddress: core.serialization.property("pre_populate_shipping_address", Address.optional()), + redirectUrl: core.serialization.property("redirect_url", core.serialization.string().optionalNullable()), + order: Order.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + additionalRecipients: core.serialization.property( + "additional_recipients", + core.serialization.list(AdditionalRecipient).optionalNullable(), + ), + }); + +export declare namespace Checkout { + export interface Raw { + id?: string | null; + checkout_page_url?: (string | null) | null; + ask_for_shipping_address?: (boolean | null) | null; + merchant_support_email?: (string | null) | null; + pre_populate_buyer_email?: (string | null) | null; + pre_populate_shipping_address?: Address.Raw | null; + redirect_url?: (string | null) | null; + order?: Order.Raw | null; + created_at?: string | null; + additional_recipients?: (AdditionalRecipient.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/CheckoutLocationSettings.ts b/src/serialization/types/CheckoutLocationSettings.ts new file mode 100644 index 000000000..bb052e38c --- /dev/null +++ b/src/serialization/types/CheckoutLocationSettings.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CheckoutLocationSettingsPolicy } from "./CheckoutLocationSettingsPolicy"; +import { CheckoutLocationSettingsBranding } from "./CheckoutLocationSettingsBranding"; +import { CheckoutLocationSettingsTipping } from "./CheckoutLocationSettingsTipping"; +import { CheckoutLocationSettingsCoupons } from "./CheckoutLocationSettingsCoupons"; + +export const CheckoutLocationSettings: core.serialization.ObjectSchema< + serializers.CheckoutLocationSettings.Raw, + Square.CheckoutLocationSettings +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + customerNotesEnabled: core.serialization.property( + "customer_notes_enabled", + core.serialization.boolean().optionalNullable(), + ), + policies: core.serialization.list(CheckoutLocationSettingsPolicy).optionalNullable(), + branding: CheckoutLocationSettingsBranding.optional(), + tipping: CheckoutLocationSettingsTipping.optional(), + coupons: CheckoutLocationSettingsCoupons.optional(), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), +}); + +export declare namespace CheckoutLocationSettings { + export interface Raw { + location_id?: (string | null) | null; + customer_notes_enabled?: (boolean | null) | null; + policies?: (CheckoutLocationSettingsPolicy.Raw[] | null) | null; + branding?: CheckoutLocationSettingsBranding.Raw | null; + tipping?: CheckoutLocationSettingsTipping.Raw | null; + coupons?: CheckoutLocationSettingsCoupons.Raw | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/CheckoutLocationSettingsBranding.ts b/src/serialization/types/CheckoutLocationSettingsBranding.ts new file mode 100644 index 000000000..ba7ef2c3a --- /dev/null +++ b/src/serialization/types/CheckoutLocationSettingsBranding.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CheckoutLocationSettingsBrandingHeaderType } from "./CheckoutLocationSettingsBrandingHeaderType"; +import { CheckoutLocationSettingsBrandingButtonShape } from "./CheckoutLocationSettingsBrandingButtonShape"; + +export const CheckoutLocationSettingsBranding: core.serialization.ObjectSchema< + serializers.CheckoutLocationSettingsBranding.Raw, + Square.CheckoutLocationSettingsBranding +> = core.serialization.object({ + headerType: core.serialization.property("header_type", CheckoutLocationSettingsBrandingHeaderType.optional()), + buttonColor: core.serialization.property("button_color", core.serialization.string().optionalNullable()), + buttonShape: core.serialization.property("button_shape", CheckoutLocationSettingsBrandingButtonShape.optional()), +}); + +export declare namespace CheckoutLocationSettingsBranding { + export interface Raw { + header_type?: CheckoutLocationSettingsBrandingHeaderType.Raw | null; + button_color?: (string | null) | null; + button_shape?: CheckoutLocationSettingsBrandingButtonShape.Raw | null; + } +} diff --git a/src/serialization/types/CheckoutLocationSettingsBrandingButtonShape.ts b/src/serialization/types/CheckoutLocationSettingsBrandingButtonShape.ts new file mode 100644 index 000000000..12fc1d393 --- /dev/null +++ b/src/serialization/types/CheckoutLocationSettingsBrandingButtonShape.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CheckoutLocationSettingsBrandingButtonShape: core.serialization.Schema< + serializers.CheckoutLocationSettingsBrandingButtonShape.Raw, + Square.CheckoutLocationSettingsBrandingButtonShape +> = core.serialization.enum_(["SQUARED", "ROUNDED", "PILL"]); + +export declare namespace CheckoutLocationSettingsBrandingButtonShape { + export type Raw = "SQUARED" | "ROUNDED" | "PILL"; +} diff --git a/src/serialization/types/CheckoutLocationSettingsBrandingHeaderType.ts b/src/serialization/types/CheckoutLocationSettingsBrandingHeaderType.ts new file mode 100644 index 000000000..128e41c01 --- /dev/null +++ b/src/serialization/types/CheckoutLocationSettingsBrandingHeaderType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CheckoutLocationSettingsBrandingHeaderType: core.serialization.Schema< + serializers.CheckoutLocationSettingsBrandingHeaderType.Raw, + Square.CheckoutLocationSettingsBrandingHeaderType +> = core.serialization.enum_(["BUSINESS_NAME", "FRAMED_LOGO", "FULL_WIDTH_LOGO"]); + +export declare namespace CheckoutLocationSettingsBrandingHeaderType { + export type Raw = "BUSINESS_NAME" | "FRAMED_LOGO" | "FULL_WIDTH_LOGO"; +} diff --git a/src/serialization/types/CheckoutLocationSettingsCoupons.ts b/src/serialization/types/CheckoutLocationSettingsCoupons.ts new file mode 100644 index 000000000..0ac82a98c --- /dev/null +++ b/src/serialization/types/CheckoutLocationSettingsCoupons.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CheckoutLocationSettingsCoupons: core.serialization.ObjectSchema< + serializers.CheckoutLocationSettingsCoupons.Raw, + Square.CheckoutLocationSettingsCoupons +> = core.serialization.object({ + enabled: core.serialization.boolean().optionalNullable(), +}); + +export declare namespace CheckoutLocationSettingsCoupons { + export interface Raw { + enabled?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CheckoutLocationSettingsPolicy.ts b/src/serialization/types/CheckoutLocationSettingsPolicy.ts new file mode 100644 index 000000000..bb78effc0 --- /dev/null +++ b/src/serialization/types/CheckoutLocationSettingsPolicy.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CheckoutLocationSettingsPolicy: core.serialization.ObjectSchema< + serializers.CheckoutLocationSettingsPolicy.Raw, + Square.CheckoutLocationSettingsPolicy +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + title: core.serialization.string().optionalNullable(), + description: core.serialization.string().optionalNullable(), +}); + +export declare namespace CheckoutLocationSettingsPolicy { + export interface Raw { + uid?: (string | null) | null; + title?: (string | null) | null; + description?: (string | null) | null; + } +} diff --git a/src/serialization/types/CheckoutLocationSettingsTipping.ts b/src/serialization/types/CheckoutLocationSettingsTipping.ts new file mode 100644 index 000000000..8e2f23e2f --- /dev/null +++ b/src/serialization/types/CheckoutLocationSettingsTipping.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const CheckoutLocationSettingsTipping: core.serialization.ObjectSchema< + serializers.CheckoutLocationSettingsTipping.Raw, + Square.CheckoutLocationSettingsTipping +> = core.serialization.object({ + percentages: core.serialization.list(core.serialization.number()).optionalNullable(), + smartTippingEnabled: core.serialization.property( + "smart_tipping_enabled", + core.serialization.boolean().optionalNullable(), + ), + defaultPercent: core.serialization.property("default_percent", core.serialization.number().optionalNullable()), + smartTips: core.serialization.property("smart_tips", core.serialization.list(Money).optionalNullable()), + defaultSmartTip: core.serialization.property("default_smart_tip", Money.optional()), +}); + +export declare namespace CheckoutLocationSettingsTipping { + export interface Raw { + percentages?: (number[] | null) | null; + smart_tipping_enabled?: (boolean | null) | null; + default_percent?: (number | null) | null; + smart_tips?: (Money.Raw[] | null) | null; + default_smart_tip?: Money.Raw | null; + } +} diff --git a/src/serialization/types/CheckoutMerchantSettings.ts b/src/serialization/types/CheckoutMerchantSettings.ts new file mode 100644 index 000000000..6ada600bc --- /dev/null +++ b/src/serialization/types/CheckoutMerchantSettings.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CheckoutMerchantSettingsPaymentMethods } from "./CheckoutMerchantSettingsPaymentMethods"; + +export const CheckoutMerchantSettings: core.serialization.ObjectSchema< + serializers.CheckoutMerchantSettings.Raw, + Square.CheckoutMerchantSettings +> = core.serialization.object({ + paymentMethods: core.serialization.property("payment_methods", CheckoutMerchantSettingsPaymentMethods.optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), +}); + +export declare namespace CheckoutMerchantSettings { + export interface Raw { + payment_methods?: CheckoutMerchantSettingsPaymentMethods.Raw | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/CheckoutMerchantSettingsPaymentMethods.ts b/src/serialization/types/CheckoutMerchantSettingsPaymentMethods.ts new file mode 100644 index 000000000..5d7bae106 --- /dev/null +++ b/src/serialization/types/CheckoutMerchantSettingsPaymentMethods.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CheckoutMerchantSettingsPaymentMethodsPaymentMethod } from "./CheckoutMerchantSettingsPaymentMethodsPaymentMethod"; +import { CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay } from "./CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay"; + +export const CheckoutMerchantSettingsPaymentMethods: core.serialization.ObjectSchema< + serializers.CheckoutMerchantSettingsPaymentMethods.Raw, + Square.CheckoutMerchantSettingsPaymentMethods +> = core.serialization.object({ + applePay: core.serialization.property("apple_pay", CheckoutMerchantSettingsPaymentMethodsPaymentMethod.optional()), + googlePay: core.serialization.property( + "google_pay", + CheckoutMerchantSettingsPaymentMethodsPaymentMethod.optional(), + ), + cashApp: core.serialization.property("cash_app", CheckoutMerchantSettingsPaymentMethodsPaymentMethod.optional()), + afterpayClearpay: core.serialization.property( + "afterpay_clearpay", + CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.optional(), + ), +}); + +export declare namespace CheckoutMerchantSettingsPaymentMethods { + export interface Raw { + apple_pay?: CheckoutMerchantSettingsPaymentMethodsPaymentMethod.Raw | null; + google_pay?: CheckoutMerchantSettingsPaymentMethodsPaymentMethod.Raw | null; + cash_app?: CheckoutMerchantSettingsPaymentMethodsPaymentMethod.Raw | null; + afterpay_clearpay?: CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.Raw | null; + } +} diff --git a/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts b/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts new file mode 100644 index 000000000..e0c6a8e8a --- /dev/null +++ b/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange } from "./CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange"; + +export const CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay: core.serialization.ObjectSchema< + serializers.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay.Raw, + Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay +> = core.serialization.object({ + orderEligibilityRange: core.serialization.property( + "order_eligibility_range", + CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.optional(), + ), + itemEligibilityRange: core.serialization.property( + "item_eligibility_range", + CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.optional(), + ), + enabled: core.serialization.boolean().optional(), +}); + +export declare namespace CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay { + export interface Raw { + order_eligibility_range?: CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.Raw | null; + item_eligibility_range?: CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.Raw | null; + enabled?: boolean | null; + } +} diff --git a/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts b/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts new file mode 100644 index 000000000..febca0fef --- /dev/null +++ b/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange: core.serialization.ObjectSchema< + serializers.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange.Raw, + Square.CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange +> = core.serialization.object({ + min: Money, + max: Money, +}); + +export declare namespace CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange { + export interface Raw { + min: Money.Raw; + max: Money.Raw; + } +} diff --git a/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsPaymentMethod.ts b/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsPaymentMethod.ts new file mode 100644 index 000000000..5710316d2 --- /dev/null +++ b/src/serialization/types/CheckoutMerchantSettingsPaymentMethodsPaymentMethod.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CheckoutMerchantSettingsPaymentMethodsPaymentMethod: core.serialization.ObjectSchema< + serializers.CheckoutMerchantSettingsPaymentMethodsPaymentMethod.Raw, + Square.CheckoutMerchantSettingsPaymentMethodsPaymentMethod +> = core.serialization.object({ + enabled: core.serialization.boolean().optionalNullable(), +}); + +export declare namespace CheckoutMerchantSettingsPaymentMethodsPaymentMethod { + export interface Raw { + enabled?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CheckoutOptions.ts b/src/serialization/types/CheckoutOptions.ts new file mode 100644 index 000000000..24fb21f67 --- /dev/null +++ b/src/serialization/types/CheckoutOptions.ts @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomField } from "./CustomField"; +import { AcceptedPaymentMethods } from "./AcceptedPaymentMethods"; +import { Money } from "./Money"; +import { ShippingFee } from "./ShippingFee"; + +export const CheckoutOptions: core.serialization.ObjectSchema = + core.serialization.object({ + allowTipping: core.serialization.property("allow_tipping", core.serialization.boolean().optionalNullable()), + customFields: core.serialization.property( + "custom_fields", + core.serialization.list(CustomField).optionalNullable(), + ), + subscriptionPlanId: core.serialization.property( + "subscription_plan_id", + core.serialization.string().optionalNullable(), + ), + redirectUrl: core.serialization.property("redirect_url", core.serialization.string().optionalNullable()), + merchantSupportEmail: core.serialization.property( + "merchant_support_email", + core.serialization.string().optionalNullable(), + ), + askForShippingAddress: core.serialization.property( + "ask_for_shipping_address", + core.serialization.boolean().optionalNullable(), + ), + acceptedPaymentMethods: core.serialization.property( + "accepted_payment_methods", + AcceptedPaymentMethods.optional(), + ), + appFeeMoney: core.serialization.property("app_fee_money", Money.optional()), + shippingFee: core.serialization.property("shipping_fee", ShippingFee.optional()), + enableCoupon: core.serialization.property("enable_coupon", core.serialization.boolean().optionalNullable()), + enableLoyalty: core.serialization.property("enable_loyalty", core.serialization.boolean().optionalNullable()), + }); + +export declare namespace CheckoutOptions { + export interface Raw { + allow_tipping?: (boolean | null) | null; + custom_fields?: (CustomField.Raw[] | null) | null; + subscription_plan_id?: (string | null) | null; + redirect_url?: (string | null) | null; + merchant_support_email?: (string | null) | null; + ask_for_shipping_address?: (boolean | null) | null; + accepted_payment_methods?: AcceptedPaymentMethods.Raw | null; + app_fee_money?: Money.Raw | null; + shipping_fee?: ShippingFee.Raw | null; + enable_coupon?: (boolean | null) | null; + enable_loyalty?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CheckoutOptionsPaymentType.ts b/src/serialization/types/CheckoutOptionsPaymentType.ts new file mode 100644 index 000000000..b37865522 --- /dev/null +++ b/src/serialization/types/CheckoutOptionsPaymentType.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CheckoutOptionsPaymentType: core.serialization.Schema< + serializers.CheckoutOptionsPaymentType.Raw, + Square.CheckoutOptionsPaymentType +> = core.serialization.enum_([ + "CARD_PRESENT", + "MANUAL_CARD_ENTRY", + "FELICA_ID", + "FELICA_QUICPAY", + "FELICA_TRANSPORTATION_GROUP", + "FELICA_ALL", + "PAYPAY", + "QR_CODE", +]); + +export declare namespace CheckoutOptionsPaymentType { + export type Raw = + | "CARD_PRESENT" + | "MANUAL_CARD_ENTRY" + | "FELICA_ID" + | "FELICA_QUICPAY" + | "FELICA_TRANSPORTATION_GROUP" + | "FELICA_ALL" + | "PAYPAY" + | "QR_CODE"; +} diff --git a/src/serialization/types/ClearpayDetails.ts b/src/serialization/types/ClearpayDetails.ts new file mode 100644 index 000000000..5c3ee717a --- /dev/null +++ b/src/serialization/types/ClearpayDetails.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ClearpayDetails: core.serialization.ObjectSchema = + core.serialization.object({ + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + }); + +export declare namespace ClearpayDetails { + export interface Raw { + email_address?: (string | null) | null; + } +} diff --git a/src/serialization/types/CloneOrderResponse.ts b/src/serialization/types/CloneOrderResponse.ts new file mode 100644 index 000000000..8a38ee214 --- /dev/null +++ b/src/serialization/types/CloneOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Order } from "./Order"; +import { Error_ } from "./Error_"; + +export const CloneOrderResponse: core.serialization.ObjectSchema< + serializers.CloneOrderResponse.Raw, + Square.CloneOrderResponse +> = core.serialization.object({ + order: Order.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CloneOrderResponse { + export interface Raw { + order?: Order.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CollectedData.ts b/src/serialization/types/CollectedData.ts new file mode 100644 index 000000000..57ed61460 --- /dev/null +++ b/src/serialization/types/CollectedData.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CollectedData: core.serialization.ObjectSchema = + core.serialization.object({ + inputText: core.serialization.property("input_text", core.serialization.string().optional()), + }); + +export declare namespace CollectedData { + export interface Raw { + input_text?: string | null; + } +} diff --git a/src/serialization/types/CompletePaymentResponse.ts b/src/serialization/types/CompletePaymentResponse.ts new file mode 100644 index 000000000..ad790d62a --- /dev/null +++ b/src/serialization/types/CompletePaymentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Payment } from "./Payment"; + +export const CompletePaymentResponse: core.serialization.ObjectSchema< + serializers.CompletePaymentResponse.Raw, + Square.CompletePaymentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + payment: Payment.optional(), +}); + +export declare namespace CompletePaymentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment?: Payment.Raw | null; + } +} diff --git a/src/serialization/types/Component.ts b/src/serialization/types/Component.ts new file mode 100644 index 000000000..18d3c09e9 --- /dev/null +++ b/src/serialization/types/Component.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ComponentComponentType } from "./ComponentComponentType"; +import { DeviceComponentDetailsApplicationDetails } from "./DeviceComponentDetailsApplicationDetails"; +import { DeviceComponentDetailsCardReaderDetails } from "./DeviceComponentDetailsCardReaderDetails"; +import { DeviceComponentDetailsBatteryDetails } from "./DeviceComponentDetailsBatteryDetails"; +import { DeviceComponentDetailsWiFiDetails } from "./DeviceComponentDetailsWiFiDetails"; +import { DeviceComponentDetailsEthernetDetails } from "./DeviceComponentDetailsEthernetDetails"; + +export const Component: core.serialization.ObjectSchema = + core.serialization.object({ + type: ComponentComponentType, + applicationDetails: core.serialization.property( + "application_details", + DeviceComponentDetailsApplicationDetails.optional(), + ), + cardReaderDetails: core.serialization.property( + "card_reader_details", + DeviceComponentDetailsCardReaderDetails.optional(), + ), + batteryDetails: core.serialization.property("battery_details", DeviceComponentDetailsBatteryDetails.optional()), + wifiDetails: core.serialization.property("wifi_details", DeviceComponentDetailsWiFiDetails.optional()), + ethernetDetails: core.serialization.property( + "ethernet_details", + DeviceComponentDetailsEthernetDetails.optional(), + ), + }); + +export declare namespace Component { + export interface Raw { + type: ComponentComponentType.Raw; + application_details?: DeviceComponentDetailsApplicationDetails.Raw | null; + card_reader_details?: DeviceComponentDetailsCardReaderDetails.Raw | null; + battery_details?: DeviceComponentDetailsBatteryDetails.Raw | null; + wifi_details?: DeviceComponentDetailsWiFiDetails.Raw | null; + ethernet_details?: DeviceComponentDetailsEthernetDetails.Raw | null; + } +} diff --git a/src/serialization/types/ComponentComponentType.ts b/src/serialization/types/ComponentComponentType.ts new file mode 100644 index 000000000..fab0e16b3 --- /dev/null +++ b/src/serialization/types/ComponentComponentType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ComponentComponentType: core.serialization.Schema< + serializers.ComponentComponentType.Raw, + Square.ComponentComponentType +> = core.serialization.enum_(["APPLICATION", "CARD_READER", "BATTERY", "WIFI", "ETHERNET", "PRINTER"]); + +export declare namespace ComponentComponentType { + export type Raw = "APPLICATION" | "CARD_READER" | "BATTERY" | "WIFI" | "ETHERNET" | "PRINTER"; +} diff --git a/src/serialization/types/ConfirmationDecision.ts b/src/serialization/types/ConfirmationDecision.ts new file mode 100644 index 000000000..d857306bd --- /dev/null +++ b/src/serialization/types/ConfirmationDecision.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ConfirmationDecision: core.serialization.ObjectSchema< + serializers.ConfirmationDecision.Raw, + Square.ConfirmationDecision +> = core.serialization.object({ + hasAgreed: core.serialization.property("has_agreed", core.serialization.boolean().optional()), +}); + +export declare namespace ConfirmationDecision { + export interface Raw { + has_agreed?: boolean | null; + } +} diff --git a/src/serialization/types/ConfirmationOptions.ts b/src/serialization/types/ConfirmationOptions.ts new file mode 100644 index 000000000..285a1f77f --- /dev/null +++ b/src/serialization/types/ConfirmationOptions.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ConfirmationDecision } from "./ConfirmationDecision"; + +export const ConfirmationOptions: core.serialization.ObjectSchema< + serializers.ConfirmationOptions.Raw, + Square.ConfirmationOptions +> = core.serialization.object({ + title: core.serialization.string(), + body: core.serialization.string(), + agreeButtonText: core.serialization.property("agree_button_text", core.serialization.string()), + disagreeButtonText: core.serialization.property( + "disagree_button_text", + core.serialization.string().optionalNullable(), + ), + decision: ConfirmationDecision.optional(), +}); + +export declare namespace ConfirmationOptions { + export interface Raw { + title: string; + body: string; + agree_button_text: string; + disagree_button_text?: (string | null) | null; + decision?: ConfirmationDecision.Raw | null; + } +} diff --git a/src/serialization/types/Coordinates.ts b/src/serialization/types/Coordinates.ts new file mode 100644 index 000000000..aeb171690 --- /dev/null +++ b/src/serialization/types/Coordinates.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Coordinates: core.serialization.ObjectSchema = + core.serialization.object({ + latitude: core.serialization.number().optionalNullable(), + longitude: core.serialization.number().optionalNullable(), + }); + +export declare namespace Coordinates { + export interface Raw { + latitude?: (number | null) | null; + longitude?: (number | null) | null; + } +} diff --git a/src/serialization/types/Country.ts b/src/serialization/types/Country.ts new file mode 100644 index 000000000..6b53709cc --- /dev/null +++ b/src/serialization/types/Country.ts @@ -0,0 +1,514 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Country: core.serialization.Schema = core.serialization.enum_([ + "ZZ", + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", +]); + +export declare namespace Country { + export type Raw = + | "ZZ" + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; +} diff --git a/src/serialization/types/CreateBookingCustomAttributeDefinitionResponse.ts b/src/serialization/types/CreateBookingCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..39c595962 --- /dev/null +++ b/src/serialization/types/CreateBookingCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const CreateBookingCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.CreateBookingCustomAttributeDefinitionResponse.Raw, + Square.CreateBookingCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateBookingCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateBookingResponse.ts b/src/serialization/types/CreateBookingResponse.ts new file mode 100644 index 000000000..6bf71e49a --- /dev/null +++ b/src/serialization/types/CreateBookingResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Booking } from "./Booking"; +import { Error_ } from "./Error_"; + +export const CreateBookingResponse: core.serialization.ObjectSchema< + serializers.CreateBookingResponse.Raw, + Square.CreateBookingResponse +> = core.serialization.object({ + booking: Booking.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateBookingResponse { + export interface Raw { + booking?: Booking.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateBreakTypeResponse.ts b/src/serialization/types/CreateBreakTypeResponse.ts new file mode 100644 index 000000000..8abe550a8 --- /dev/null +++ b/src/serialization/types/CreateBreakTypeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BreakType } from "./BreakType"; +import { Error_ } from "./Error_"; + +export const CreateBreakTypeResponse: core.serialization.ObjectSchema< + serializers.CreateBreakTypeResponse.Raw, + Square.CreateBreakTypeResponse +> = core.serialization.object({ + breakType: core.serialization.property("break_type", BreakType.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateBreakTypeResponse { + export interface Raw { + break_type?: BreakType.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateCardResponse.ts b/src/serialization/types/CreateCardResponse.ts new file mode 100644 index 000000000..374cd9d34 --- /dev/null +++ b/src/serialization/types/CreateCardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Card } from "./Card"; + +export const CreateCardResponse: core.serialization.ObjectSchema< + serializers.CreateCardResponse.Raw, + Square.CreateCardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + card: Card.optional(), +}); + +export declare namespace CreateCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + card?: Card.Raw | null; + } +} diff --git a/src/serialization/types/CreateCatalogImageRequest.ts b/src/serialization/types/CreateCatalogImageRequest.ts new file mode 100644 index 000000000..861ed5f4a --- /dev/null +++ b/src/serialization/types/CreateCatalogImageRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CreateCatalogImageRequest: core.serialization.ObjectSchema< + serializers.CreateCatalogImageRequest.Raw, + Square.CreateCatalogImageRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + objectId: core.serialization.property("object_id", core.serialization.string().optional()), + image: core.serialization.lazy(() => serializers.CatalogObject), + isPrimary: core.serialization.property("is_primary", core.serialization.boolean().optional()), +}); + +export declare namespace CreateCatalogImageRequest { + export interface Raw { + idempotency_key: string; + object_id?: string | null; + image: serializers.CatalogObject.Raw; + is_primary?: boolean | null; + } +} diff --git a/src/serialization/types/CreateCatalogImageResponse.ts b/src/serialization/types/CreateCatalogImageResponse.ts new file mode 100644 index 000000000..9dd799d61 --- /dev/null +++ b/src/serialization/types/CreateCatalogImageResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const CreateCatalogImageResponse: core.serialization.ObjectSchema< + serializers.CreateCatalogImageResponse.Raw, + Square.CreateCatalogImageResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + image: core.serialization.lazy(() => serializers.CatalogObject).optional(), +}); + +export declare namespace CreateCatalogImageResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + image?: serializers.CatalogObject.Raw | null; + } +} diff --git a/src/serialization/types/CreateCheckoutResponse.ts b/src/serialization/types/CreateCheckoutResponse.ts new file mode 100644 index 000000000..9eb703880 --- /dev/null +++ b/src/serialization/types/CreateCheckoutResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Checkout } from "./Checkout"; +import { Error_ } from "./Error_"; + +export const CreateCheckoutResponse: core.serialization.ObjectSchema< + serializers.CreateCheckoutResponse.Raw, + Square.CreateCheckoutResponse +> = core.serialization.object({ + checkout: Checkout.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateCheckoutResponse { + export interface Raw { + checkout?: Checkout.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateCustomerCardResponse.ts b/src/serialization/types/CreateCustomerCardResponse.ts new file mode 100644 index 000000000..8449b3850 --- /dev/null +++ b/src/serialization/types/CreateCustomerCardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Card } from "./Card"; + +export const CreateCustomerCardResponse: core.serialization.ObjectSchema< + serializers.CreateCustomerCardResponse.Raw, + Square.CreateCustomerCardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + card: Card.optional(), +}); + +export declare namespace CreateCustomerCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + card?: Card.Raw | null; + } +} diff --git a/src/serialization/types/CreateCustomerCustomAttributeDefinitionResponse.ts b/src/serialization/types/CreateCustomerCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..2b97ef4b6 --- /dev/null +++ b/src/serialization/types/CreateCustomerCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const CreateCustomerCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.CreateCustomerCustomAttributeDefinitionResponse.Raw, + Square.CreateCustomerCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateCustomerCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateCustomerGroupResponse.ts b/src/serialization/types/CreateCustomerGroupResponse.ts new file mode 100644 index 000000000..40cf55199 --- /dev/null +++ b/src/serialization/types/CreateCustomerGroupResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CustomerGroup } from "./CustomerGroup"; + +export const CreateCustomerGroupResponse: core.serialization.ObjectSchema< + serializers.CreateCustomerGroupResponse.Raw, + Square.CreateCustomerGroupResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + group: CustomerGroup.optional(), +}); + +export declare namespace CreateCustomerGroupResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + group?: CustomerGroup.Raw | null; + } +} diff --git a/src/serialization/types/CreateCustomerResponse.ts b/src/serialization/types/CreateCustomerResponse.ts new file mode 100644 index 000000000..6d01d42c7 --- /dev/null +++ b/src/serialization/types/CreateCustomerResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Customer } from "./Customer"; + +export const CreateCustomerResponse: core.serialization.ObjectSchema< + serializers.CreateCustomerResponse.Raw, + Square.CreateCustomerResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + customer: Customer.optional(), +}); + +export declare namespace CreateCustomerResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + customer?: Customer.Raw | null; + } +} diff --git a/src/serialization/types/CreateDeviceCodeResponse.ts b/src/serialization/types/CreateDeviceCodeResponse.ts new file mode 100644 index 000000000..ce85dd674 --- /dev/null +++ b/src/serialization/types/CreateDeviceCodeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { DeviceCode } from "./DeviceCode"; + +export const CreateDeviceCodeResponse: core.serialization.ObjectSchema< + serializers.CreateDeviceCodeResponse.Raw, + Square.CreateDeviceCodeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + deviceCode: core.serialization.property("device_code", DeviceCode.optional()), +}); + +export declare namespace CreateDeviceCodeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + device_code?: DeviceCode.Raw | null; + } +} diff --git a/src/serialization/types/CreateDisputeEvidenceFileRequest.ts b/src/serialization/types/CreateDisputeEvidenceFileRequest.ts new file mode 100644 index 000000000..1d3fca2bf --- /dev/null +++ b/src/serialization/types/CreateDisputeEvidenceFileRequest.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DisputeEvidenceType } from "./DisputeEvidenceType"; + +export const CreateDisputeEvidenceFileRequest: core.serialization.ObjectSchema< + serializers.CreateDisputeEvidenceFileRequest.Raw, + Square.CreateDisputeEvidenceFileRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), + evidenceType: core.serialization.property("evidence_type", DisputeEvidenceType.optional()), + contentType: core.serialization.property("content_type", core.serialization.string().optional()), +}); + +export declare namespace CreateDisputeEvidenceFileRequest { + export interface Raw { + idempotency_key: string; + evidence_type?: DisputeEvidenceType.Raw | null; + content_type?: string | null; + } +} diff --git a/src/serialization/types/CreateDisputeEvidenceFileResponse.ts b/src/serialization/types/CreateDisputeEvidenceFileResponse.ts new file mode 100644 index 000000000..38f77d069 --- /dev/null +++ b/src/serialization/types/CreateDisputeEvidenceFileResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { DisputeEvidence } from "./DisputeEvidence"; + +export const CreateDisputeEvidenceFileResponse: core.serialization.ObjectSchema< + serializers.CreateDisputeEvidenceFileResponse.Raw, + Square.CreateDisputeEvidenceFileResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + evidence: DisputeEvidence.optional(), +}); + +export declare namespace CreateDisputeEvidenceFileResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + evidence?: DisputeEvidence.Raw | null; + } +} diff --git a/src/serialization/types/CreateDisputeEvidenceTextResponse.ts b/src/serialization/types/CreateDisputeEvidenceTextResponse.ts new file mode 100644 index 000000000..9e278727c --- /dev/null +++ b/src/serialization/types/CreateDisputeEvidenceTextResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { DisputeEvidence } from "./DisputeEvidence"; + +export const CreateDisputeEvidenceTextResponse: core.serialization.ObjectSchema< + serializers.CreateDisputeEvidenceTextResponse.Raw, + Square.CreateDisputeEvidenceTextResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + evidence: DisputeEvidence.optional(), +}); + +export declare namespace CreateDisputeEvidenceTextResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + evidence?: DisputeEvidence.Raw | null; + } +} diff --git a/src/serialization/types/CreateGiftCardActivityResponse.ts b/src/serialization/types/CreateGiftCardActivityResponse.ts new file mode 100644 index 000000000..dd25beb58 --- /dev/null +++ b/src/serialization/types/CreateGiftCardActivityResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCardActivity } from "./GiftCardActivity"; + +export const CreateGiftCardActivityResponse: core.serialization.ObjectSchema< + serializers.CreateGiftCardActivityResponse.Raw, + Square.CreateGiftCardActivityResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCardActivity: core.serialization.property("gift_card_activity", GiftCardActivity.optional()), +}); + +export declare namespace CreateGiftCardActivityResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_card_activity?: GiftCardActivity.Raw | null; + } +} diff --git a/src/serialization/types/CreateGiftCardResponse.ts b/src/serialization/types/CreateGiftCardResponse.ts new file mode 100644 index 000000000..441867d59 --- /dev/null +++ b/src/serialization/types/CreateGiftCardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCard } from "./GiftCard"; + +export const CreateGiftCardResponse: core.serialization.ObjectSchema< + serializers.CreateGiftCardResponse.Raw, + Square.CreateGiftCardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCard: core.serialization.property("gift_card", GiftCard.optional()), +}); + +export declare namespace CreateGiftCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_card?: GiftCard.Raw | null; + } +} diff --git a/src/serialization/types/CreateInvoiceAttachmentResponse.ts b/src/serialization/types/CreateInvoiceAttachmentResponse.ts new file mode 100644 index 000000000..b5f7e474d --- /dev/null +++ b/src/serialization/types/CreateInvoiceAttachmentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InvoiceAttachment } from "./InvoiceAttachment"; +import { Error_ } from "./Error_"; + +export const CreateInvoiceAttachmentResponse: core.serialization.ObjectSchema< + serializers.CreateInvoiceAttachmentResponse.Raw, + Square.CreateInvoiceAttachmentResponse +> = core.serialization.object({ + attachment: InvoiceAttachment.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateInvoiceAttachmentResponse { + export interface Raw { + attachment?: InvoiceAttachment.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateInvoiceResponse.ts b/src/serialization/types/CreateInvoiceResponse.ts new file mode 100644 index 000000000..30246acab --- /dev/null +++ b/src/serialization/types/CreateInvoiceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Invoice } from "./Invoice"; +import { Error_ } from "./Error_"; + +export const CreateInvoiceResponse: core.serialization.ObjectSchema< + serializers.CreateInvoiceResponse.Raw, + Square.CreateInvoiceResponse +> = core.serialization.object({ + invoice: Invoice.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateInvoiceResponse { + export interface Raw { + invoice?: Invoice.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateJobResponse.ts b/src/serialization/types/CreateJobResponse.ts new file mode 100644 index 000000000..8d8376f63 --- /dev/null +++ b/src/serialization/types/CreateJobResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Job } from "./Job"; +import { Error_ } from "./Error_"; + +export const CreateJobResponse: core.serialization.ObjectSchema< + serializers.CreateJobResponse.Raw, + Square.CreateJobResponse +> = core.serialization.object({ + job: Job.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateJobResponse { + export interface Raw { + job?: Job.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateLocationCustomAttributeDefinitionResponse.ts b/src/serialization/types/CreateLocationCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..ff829065c --- /dev/null +++ b/src/serialization/types/CreateLocationCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const CreateLocationCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.CreateLocationCustomAttributeDefinitionResponse.Raw, + Square.CreateLocationCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateLocationCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateLocationResponse.ts b/src/serialization/types/CreateLocationResponse.ts new file mode 100644 index 000000000..d4a35dbc3 --- /dev/null +++ b/src/serialization/types/CreateLocationResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Location } from "./Location"; + +export const CreateLocationResponse: core.serialization.ObjectSchema< + serializers.CreateLocationResponse.Raw, + Square.CreateLocationResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + location: Location.optional(), +}); + +export declare namespace CreateLocationResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + location?: Location.Raw | null; + } +} diff --git a/src/serialization/types/CreateLoyaltyAccountResponse.ts b/src/serialization/types/CreateLoyaltyAccountResponse.ts new file mode 100644 index 000000000..719616e98 --- /dev/null +++ b/src/serialization/types/CreateLoyaltyAccountResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyAccount } from "./LoyaltyAccount"; + +export const CreateLoyaltyAccountResponse: core.serialization.ObjectSchema< + serializers.CreateLoyaltyAccountResponse.Raw, + Square.CreateLoyaltyAccountResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + loyaltyAccount: core.serialization.property("loyalty_account", LoyaltyAccount.optional()), +}); + +export declare namespace CreateLoyaltyAccountResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + loyalty_account?: LoyaltyAccount.Raw | null; + } +} diff --git a/src/serialization/types/CreateLoyaltyPromotionResponse.ts b/src/serialization/types/CreateLoyaltyPromotionResponse.ts new file mode 100644 index 000000000..3bb2dea21 --- /dev/null +++ b/src/serialization/types/CreateLoyaltyPromotionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyPromotion } from "./LoyaltyPromotion"; + +export const CreateLoyaltyPromotionResponse: core.serialization.ObjectSchema< + serializers.CreateLoyaltyPromotionResponse.Raw, + Square.CreateLoyaltyPromotionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + loyaltyPromotion: core.serialization.property("loyalty_promotion", LoyaltyPromotion.optional()), +}); + +export declare namespace CreateLoyaltyPromotionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + loyalty_promotion?: LoyaltyPromotion.Raw | null; + } +} diff --git a/src/serialization/types/CreateLoyaltyRewardResponse.ts b/src/serialization/types/CreateLoyaltyRewardResponse.ts new file mode 100644 index 000000000..fd4404dbd --- /dev/null +++ b/src/serialization/types/CreateLoyaltyRewardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyReward } from "./LoyaltyReward"; + +export const CreateLoyaltyRewardResponse: core.serialization.ObjectSchema< + serializers.CreateLoyaltyRewardResponse.Raw, + Square.CreateLoyaltyRewardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + reward: LoyaltyReward.optional(), +}); + +export declare namespace CreateLoyaltyRewardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + reward?: LoyaltyReward.Raw | null; + } +} diff --git a/src/serialization/types/CreateMerchantCustomAttributeDefinitionResponse.ts b/src/serialization/types/CreateMerchantCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..6fa86f3f4 --- /dev/null +++ b/src/serialization/types/CreateMerchantCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const CreateMerchantCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.CreateMerchantCustomAttributeDefinitionResponse.Raw, + Square.CreateMerchantCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateMerchantCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateMobileAuthorizationCodeResponse.ts b/src/serialization/types/CreateMobileAuthorizationCodeResponse.ts new file mode 100644 index 000000000..9e00f3fab --- /dev/null +++ b/src/serialization/types/CreateMobileAuthorizationCodeResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const CreateMobileAuthorizationCodeResponse: core.serialization.ObjectSchema< + serializers.CreateMobileAuthorizationCodeResponse.Raw, + Square.CreateMobileAuthorizationCodeResponse +> = core.serialization.object({ + authorizationCode: core.serialization.property("authorization_code", core.serialization.string().optional()), + expiresAt: core.serialization.property("expires_at", core.serialization.string().optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateMobileAuthorizationCodeResponse { + export interface Raw { + authorization_code?: string | null; + expires_at?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateOrderCustomAttributeDefinitionResponse.ts b/src/serialization/types/CreateOrderCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..0c269b0d2 --- /dev/null +++ b/src/serialization/types/CreateOrderCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const CreateOrderCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.CreateOrderCustomAttributeDefinitionResponse.Raw, + Square.CreateOrderCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateOrderCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateOrderRequest.ts b/src/serialization/types/CreateOrderRequest.ts new file mode 100644 index 000000000..97b072a82 --- /dev/null +++ b/src/serialization/types/CreateOrderRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Order } from "./Order"; + +export const CreateOrderRequest: core.serialization.ObjectSchema< + serializers.CreateOrderRequest.Raw, + Square.CreateOrderRequest +> = core.serialization.object({ + order: Order.optional(), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), +}); + +export declare namespace CreateOrderRequest { + export interface Raw { + order?: Order.Raw | null; + idempotency_key?: string | null; + } +} diff --git a/src/serialization/types/CreateOrderResponse.ts b/src/serialization/types/CreateOrderResponse.ts new file mode 100644 index 000000000..3cdc089b7 --- /dev/null +++ b/src/serialization/types/CreateOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Order } from "./Order"; +import { Error_ } from "./Error_"; + +export const CreateOrderResponse: core.serialization.ObjectSchema< + serializers.CreateOrderResponse.Raw, + Square.CreateOrderResponse +> = core.serialization.object({ + order: Order.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateOrderResponse { + export interface Raw { + order?: Order.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreatePaymentLinkResponse.ts b/src/serialization/types/CreatePaymentLinkResponse.ts new file mode 100644 index 000000000..e56b6d267 --- /dev/null +++ b/src/serialization/types/CreatePaymentLinkResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { PaymentLink } from "./PaymentLink"; +import { PaymentLinkRelatedResources } from "./PaymentLinkRelatedResources"; + +export const CreatePaymentLinkResponse: core.serialization.ObjectSchema< + serializers.CreatePaymentLinkResponse.Raw, + Square.CreatePaymentLinkResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + paymentLink: core.serialization.property("payment_link", PaymentLink.optional()), + relatedResources: core.serialization.property("related_resources", PaymentLinkRelatedResources.optional()), +}); + +export declare namespace CreatePaymentLinkResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment_link?: PaymentLink.Raw | null; + related_resources?: PaymentLinkRelatedResources.Raw | null; + } +} diff --git a/src/serialization/types/CreatePaymentResponse.ts b/src/serialization/types/CreatePaymentResponse.ts new file mode 100644 index 000000000..5ab32549a --- /dev/null +++ b/src/serialization/types/CreatePaymentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Payment } from "./Payment"; + +export const CreatePaymentResponse: core.serialization.ObjectSchema< + serializers.CreatePaymentResponse.Raw, + Square.CreatePaymentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + payment: Payment.optional(), +}); + +export declare namespace CreatePaymentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment?: Payment.Raw | null; + } +} diff --git a/src/serialization/types/CreateShiftResponse.ts b/src/serialization/types/CreateShiftResponse.ts new file mode 100644 index 000000000..367047732 --- /dev/null +++ b/src/serialization/types/CreateShiftResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Shift } from "./Shift"; +import { Error_ } from "./Error_"; + +export const CreateShiftResponse: core.serialization.ObjectSchema< + serializers.CreateShiftResponse.Raw, + Square.CreateShiftResponse +> = core.serialization.object({ + shift: Shift.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateShiftResponse { + export interface Raw { + shift?: Shift.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateSubscriptionResponse.ts b/src/serialization/types/CreateSubscriptionResponse.ts new file mode 100644 index 000000000..925fff48a --- /dev/null +++ b/src/serialization/types/CreateSubscriptionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; + +export const CreateSubscriptionResponse: core.serialization.ObjectSchema< + serializers.CreateSubscriptionResponse.Raw, + Square.CreateSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), +}); + +export declare namespace CreateSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + } +} diff --git a/src/serialization/types/CreateTeamMemberRequest.ts b/src/serialization/types/CreateTeamMemberRequest.ts new file mode 100644 index 000000000..2dfc3ea28 --- /dev/null +++ b/src/serialization/types/CreateTeamMemberRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMember } from "./TeamMember"; + +export const CreateTeamMemberRequest: core.serialization.ObjectSchema< + serializers.CreateTeamMemberRequest.Raw, + Square.CreateTeamMemberRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), + teamMember: core.serialization.property("team_member", TeamMember.optional()), +}); + +export declare namespace CreateTeamMemberRequest { + export interface Raw { + idempotency_key?: string | null; + team_member?: TeamMember.Raw | null; + } +} diff --git a/src/serialization/types/CreateTeamMemberResponse.ts b/src/serialization/types/CreateTeamMemberResponse.ts new file mode 100644 index 000000000..817631b00 --- /dev/null +++ b/src/serialization/types/CreateTeamMemberResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMember } from "./TeamMember"; +import { Error_ } from "./Error_"; + +export const CreateTeamMemberResponse: core.serialization.ObjectSchema< + serializers.CreateTeamMemberResponse.Raw, + Square.CreateTeamMemberResponse +> = core.serialization.object({ + teamMember: core.serialization.property("team_member", TeamMember.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace CreateTeamMemberResponse { + export interface Raw { + team_member?: TeamMember.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/CreateTerminalActionResponse.ts b/src/serialization/types/CreateTerminalActionResponse.ts new file mode 100644 index 000000000..10002c68c --- /dev/null +++ b/src/serialization/types/CreateTerminalActionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalAction } from "./TerminalAction"; + +export const CreateTerminalActionResponse: core.serialization.ObjectSchema< + serializers.CreateTerminalActionResponse.Raw, + Square.CreateTerminalActionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + action: TerminalAction.optional(), +}); + +export declare namespace CreateTerminalActionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + action?: TerminalAction.Raw | null; + } +} diff --git a/src/serialization/types/CreateTerminalCheckoutResponse.ts b/src/serialization/types/CreateTerminalCheckoutResponse.ts new file mode 100644 index 000000000..7c30fb814 --- /dev/null +++ b/src/serialization/types/CreateTerminalCheckoutResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalCheckout } from "./TerminalCheckout"; + +export const CreateTerminalCheckoutResponse: core.serialization.ObjectSchema< + serializers.CreateTerminalCheckoutResponse.Raw, + Square.CreateTerminalCheckoutResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + checkout: TerminalCheckout.optional(), +}); + +export declare namespace CreateTerminalCheckoutResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + checkout?: TerminalCheckout.Raw | null; + } +} diff --git a/src/serialization/types/CreateTerminalRefundResponse.ts b/src/serialization/types/CreateTerminalRefundResponse.ts new file mode 100644 index 000000000..028548ff9 --- /dev/null +++ b/src/serialization/types/CreateTerminalRefundResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalRefund } from "./TerminalRefund"; + +export const CreateTerminalRefundResponse: core.serialization.ObjectSchema< + serializers.CreateTerminalRefundResponse.Raw, + Square.CreateTerminalRefundResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + refund: TerminalRefund.optional(), +}); + +export declare namespace CreateTerminalRefundResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + refund?: TerminalRefund.Raw | null; + } +} diff --git a/src/serialization/types/CreateVendorResponse.ts b/src/serialization/types/CreateVendorResponse.ts new file mode 100644 index 000000000..eb5ee83a0 --- /dev/null +++ b/src/serialization/types/CreateVendorResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Vendor } from "./Vendor"; + +export const CreateVendorResponse: core.serialization.ObjectSchema< + serializers.CreateVendorResponse.Raw, + Square.CreateVendorResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + vendor: Vendor.optional(), +}); + +export declare namespace CreateVendorResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + vendor?: Vendor.Raw | null; + } +} diff --git a/src/serialization/types/CreateWebhookSubscriptionResponse.ts b/src/serialization/types/CreateWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..3d7ae7166 --- /dev/null +++ b/src/serialization/types/CreateWebhookSubscriptionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { WebhookSubscription } from "./WebhookSubscription"; + +export const CreateWebhookSubscriptionResponse: core.serialization.ObjectSchema< + serializers.CreateWebhookSubscriptionResponse.Raw, + Square.CreateWebhookSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: WebhookSubscription.optional(), +}); + +export declare namespace CreateWebhookSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: WebhookSubscription.Raw | null; + } +} diff --git a/src/serialization/types/Currency.ts b/src/serialization/types/Currency.ts new file mode 100644 index 000000000..4842418f9 --- /dev/null +++ b/src/serialization/types/Currency.ts @@ -0,0 +1,380 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Currency: core.serialization.Schema = core.serialization.enum_([ + "UNKNOWN_CURRENCY", + "AED", + "AFN", + "ALL", + "AMD", + "ANG", + "AOA", + "ARS", + "AUD", + "AWG", + "AZN", + "BAM", + "BBD", + "BDT", + "BGN", + "BHD", + "BIF", + "BMD", + "BND", + "BOB", + "BOV", + "BRL", + "BSD", + "BTN", + "BWP", + "BYR", + "BZD", + "CAD", + "CDF", + "CHE", + "CHF", + "CHW", + "CLF", + "CLP", + "CNY", + "COP", + "COU", + "CRC", + "CUC", + "CUP", + "CVE", + "CZK", + "DJF", + "DKK", + "DOP", + "DZD", + "EGP", + "ERN", + "ETB", + "EUR", + "FJD", + "FKP", + "GBP", + "GEL", + "GHS", + "GIP", + "GMD", + "GNF", + "GTQ", + "GYD", + "HKD", + "HNL", + "HRK", + "HTG", + "HUF", + "IDR", + "ILS", + "INR", + "IQD", + "IRR", + "ISK", + "JMD", + "JOD", + "JPY", + "KES", + "KGS", + "KHR", + "KMF", + "KPW", + "KRW", + "KWD", + "KYD", + "KZT", + "LAK", + "LBP", + "LKR", + "LRD", + "LSL", + "LTL", + "LVL", + "LYD", + "MAD", + "MDL", + "MGA", + "MKD", + "MMK", + "MNT", + "MOP", + "MRO", + "MUR", + "MVR", + "MWK", + "MXN", + "MXV", + "MYR", + "MZN", + "NAD", + "NGN", + "NIO", + "NOK", + "NPR", + "NZD", + "OMR", + "PAB", + "PEN", + "PGK", + "PHP", + "PKR", + "PLN", + "PYG", + "QAR", + "RON", + "RSD", + "RUB", + "RWF", + "SAR", + "SBD", + "SCR", + "SDG", + "SEK", + "SGD", + "SHP", + "SLL", + "SLE", + "SOS", + "SRD", + "SSP", + "STD", + "SVC", + "SYP", + "SZL", + "THB", + "TJS", + "TMT", + "TND", + "TOP", + "TRY", + "TTD", + "TWD", + "TZS", + "UAH", + "UGX", + "USD", + "USN", + "USS", + "UYI", + "UYU", + "UZS", + "VEF", + "VND", + "VUV", + "WST", + "XAF", + "XAG", + "XAU", + "XBA", + "XBB", + "XBC", + "XBD", + "XCD", + "XDR", + "XOF", + "XPD", + "XPF", + "XPT", + "XTS", + "XXX", + "YER", + "ZAR", + "ZMK", + "ZMW", + "BTC", + "XUS", +]); + +export declare namespace Currency { + export type Raw = + | "UNKNOWN_CURRENCY" + | "AED" + | "AFN" + | "ALL" + | "AMD" + | "ANG" + | "AOA" + | "ARS" + | "AUD" + | "AWG" + | "AZN" + | "BAM" + | "BBD" + | "BDT" + | "BGN" + | "BHD" + | "BIF" + | "BMD" + | "BND" + | "BOB" + | "BOV" + | "BRL" + | "BSD" + | "BTN" + | "BWP" + | "BYR" + | "BZD" + | "CAD" + | "CDF" + | "CHE" + | "CHF" + | "CHW" + | "CLF" + | "CLP" + | "CNY" + | "COP" + | "COU" + | "CRC" + | "CUC" + | "CUP" + | "CVE" + | "CZK" + | "DJF" + | "DKK" + | "DOP" + | "DZD" + | "EGP" + | "ERN" + | "ETB" + | "EUR" + | "FJD" + | "FKP" + | "GBP" + | "GEL" + | "GHS" + | "GIP" + | "GMD" + | "GNF" + | "GTQ" + | "GYD" + | "HKD" + | "HNL" + | "HRK" + | "HTG" + | "HUF" + | "IDR" + | "ILS" + | "INR" + | "IQD" + | "IRR" + | "ISK" + | "JMD" + | "JOD" + | "JPY" + | "KES" + | "KGS" + | "KHR" + | "KMF" + | "KPW" + | "KRW" + | "KWD" + | "KYD" + | "KZT" + | "LAK" + | "LBP" + | "LKR" + | "LRD" + | "LSL" + | "LTL" + | "LVL" + | "LYD" + | "MAD" + | "MDL" + | "MGA" + | "MKD" + | "MMK" + | "MNT" + | "MOP" + | "MRO" + | "MUR" + | "MVR" + | "MWK" + | "MXN" + | "MXV" + | "MYR" + | "MZN" + | "NAD" + | "NGN" + | "NIO" + | "NOK" + | "NPR" + | "NZD" + | "OMR" + | "PAB" + | "PEN" + | "PGK" + | "PHP" + | "PKR" + | "PLN" + | "PYG" + | "QAR" + | "RON" + | "RSD" + | "RUB" + | "RWF" + | "SAR" + | "SBD" + | "SCR" + | "SDG" + | "SEK" + | "SGD" + | "SHP" + | "SLL" + | "SLE" + | "SOS" + | "SRD" + | "SSP" + | "STD" + | "SVC" + | "SYP" + | "SZL" + | "THB" + | "TJS" + | "TMT" + | "TND" + | "TOP" + | "TRY" + | "TTD" + | "TWD" + | "TZS" + | "UAH" + | "UGX" + | "USD" + | "USN" + | "USS" + | "UYI" + | "UYU" + | "UZS" + | "VEF" + | "VND" + | "VUV" + | "WST" + | "XAF" + | "XAG" + | "XAU" + | "XBA" + | "XBB" + | "XBC" + | "XBD" + | "XCD" + | "XDR" + | "XOF" + | "XPD" + | "XPF" + | "XPT" + | "XTS" + | "XXX" + | "YER" + | "ZAR" + | "ZMK" + | "ZMW" + | "BTC" + | "XUS"; +} diff --git a/src/serialization/types/CustomAttribute.ts b/src/serialization/types/CustomAttribute.ts new file mode 100644 index 000000000..7456f606c --- /dev/null +++ b/src/serialization/types/CustomAttribute.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinitionVisibility } from "./CustomAttributeDefinitionVisibility"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; + +export const CustomAttribute: core.serialization.ObjectSchema = + core.serialization.object({ + key: core.serialization.string().optionalNullable(), + value: core.serialization.unknown().optional(), + version: core.serialization.number().optional(), + visibility: CustomAttributeDefinitionVisibility.optional(), + definition: CustomAttributeDefinition.optional(), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + }); + +export declare namespace CustomAttribute { + export interface Raw { + key?: (string | null) | null; + value?: unknown | null; + version?: number | null; + visibility?: CustomAttributeDefinitionVisibility.Raw | null; + definition?: CustomAttributeDefinition.Raw | null; + updated_at?: string | null; + created_at?: string | null; + } +} diff --git a/src/serialization/types/CustomAttributeDefinition.ts b/src/serialization/types/CustomAttributeDefinition.ts new file mode 100644 index 000000000..c8b70be86 --- /dev/null +++ b/src/serialization/types/CustomAttributeDefinition.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinitionVisibility } from "./CustomAttributeDefinitionVisibility"; + +export const CustomAttributeDefinition: core.serialization.ObjectSchema< + serializers.CustomAttributeDefinition.Raw, + Square.CustomAttributeDefinition +> = core.serialization.object({ + key: core.serialization.string().optionalNullable(), + schema: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optionalNullable(), + name: core.serialization.string().optionalNullable(), + description: core.serialization.string().optionalNullable(), + visibility: CustomAttributeDefinitionVisibility.optional(), + version: core.serialization.number().optional(), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), +}); + +export declare namespace CustomAttributeDefinition { + export interface Raw { + key?: (string | null) | null; + schema?: (Record | null) | null; + name?: (string | null) | null; + description?: (string | null) | null; + visibility?: CustomAttributeDefinitionVisibility.Raw | null; + version?: number | null; + updated_at?: string | null; + created_at?: string | null; + } +} diff --git a/src/serialization/types/CustomAttributeDefinitionVisibility.ts b/src/serialization/types/CustomAttributeDefinitionVisibility.ts new file mode 100644 index 000000000..09e71c424 --- /dev/null +++ b/src/serialization/types/CustomAttributeDefinitionVisibility.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomAttributeDefinitionVisibility: core.serialization.Schema< + serializers.CustomAttributeDefinitionVisibility.Raw, + Square.CustomAttributeDefinitionVisibility +> = core.serialization.enum_(["VISIBILITY_HIDDEN", "VISIBILITY_READ_ONLY", "VISIBILITY_READ_WRITE_VALUES"]); + +export declare namespace CustomAttributeDefinitionVisibility { + export type Raw = "VISIBILITY_HIDDEN" | "VISIBILITY_READ_ONLY" | "VISIBILITY_READ_WRITE_VALUES"; +} diff --git a/src/serialization/types/CustomAttributeFilter.ts b/src/serialization/types/CustomAttributeFilter.ts new file mode 100644 index 000000000..9e6d947af --- /dev/null +++ b/src/serialization/types/CustomAttributeFilter.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Range } from "./Range"; + +export const CustomAttributeFilter: core.serialization.ObjectSchema< + serializers.CustomAttributeFilter.Raw, + Square.CustomAttributeFilter +> = core.serialization.object({ + customAttributeDefinitionId: core.serialization.property( + "custom_attribute_definition_id", + core.serialization.string().optionalNullable(), + ), + key: core.serialization.string().optionalNullable(), + stringFilter: core.serialization.property("string_filter", core.serialization.string().optionalNullable()), + numberFilter: core.serialization.property("number_filter", Range.optional()), + selectionUidsFilter: core.serialization.property( + "selection_uids_filter", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + boolFilter: core.serialization.property("bool_filter", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace CustomAttributeFilter { + export interface Raw { + custom_attribute_definition_id?: (string | null) | null; + key?: (string | null) | null; + string_filter?: (string | null) | null; + number_filter?: Range.Raw | null; + selection_uids_filter?: (string[] | null) | null; + bool_filter?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CustomField.ts b/src/serialization/types/CustomField.ts new file mode 100644 index 000000000..112388b70 --- /dev/null +++ b/src/serialization/types/CustomField.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomField: core.serialization.ObjectSchema = + core.serialization.object({ + title: core.serialization.string(), + }); + +export declare namespace CustomField { + export interface Raw { + title: string; + } +} diff --git a/src/serialization/types/Customer.ts b/src/serialization/types/Customer.ts new file mode 100644 index 000000000..ec7ddfd7f --- /dev/null +++ b/src/serialization/types/Customer.ts @@ -0,0 +1,64 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; +import { CustomerPreferences } from "./CustomerPreferences"; +import { CustomerCreationSource } from "./CustomerCreationSource"; +import { CustomerTaxIds } from "./CustomerTaxIds"; + +export const Customer: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + givenName: core.serialization.property("given_name", core.serialization.string().optionalNullable()), + familyName: core.serialization.property("family_name", core.serialization.string().optionalNullable()), + nickname: core.serialization.string().optionalNullable(), + companyName: core.serialization.property("company_name", core.serialization.string().optionalNullable()), + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + address: Address.optional(), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + birthday: core.serialization.string().optionalNullable(), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + note: core.serialization.string().optionalNullable(), + preferences: CustomerPreferences.optional(), + creationSource: core.serialization.property("creation_source", CustomerCreationSource.optional()), + groupIds: core.serialization.property( + "group_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + segmentIds: core.serialization.property( + "segment_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + version: core.serialization.bigint().optional(), + taxIds: core.serialization.property("tax_ids", CustomerTaxIds.optional()), + }); + +export declare namespace Customer { + export interface Raw { + id?: string | null; + created_at?: string | null; + updated_at?: string | null; + given_name?: (string | null) | null; + family_name?: (string | null) | null; + nickname?: (string | null) | null; + company_name?: (string | null) | null; + email_address?: (string | null) | null; + address?: Address.Raw | null; + phone_number?: (string | null) | null; + birthday?: (string | null) | null; + reference_id?: (string | null) | null; + note?: (string | null) | null; + preferences?: CustomerPreferences.Raw | null; + creation_source?: CustomerCreationSource.Raw | null; + group_ids?: (string[] | null) | null; + segment_ids?: (string[] | null) | null; + version?: (bigint | number) | null; + tax_ids?: CustomerTaxIds.Raw | null; + } +} diff --git a/src/serialization/types/CustomerAddressFilter.ts b/src/serialization/types/CustomerAddressFilter.ts new file mode 100644 index 000000000..536e3fec7 --- /dev/null +++ b/src/serialization/types/CustomerAddressFilter.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomerTextFilter } from "./CustomerTextFilter"; +import { Country } from "./Country"; + +export const CustomerAddressFilter: core.serialization.ObjectSchema< + serializers.CustomerAddressFilter.Raw, + Square.CustomerAddressFilter +> = core.serialization.object({ + postalCode: core.serialization.property("postal_code", CustomerTextFilter.optional()), + country: Country.optional(), +}); + +export declare namespace CustomerAddressFilter { + export interface Raw { + postal_code?: CustomerTextFilter.Raw | null; + country?: Country.Raw | null; + } +} diff --git a/src/serialization/types/CustomerCreationSource.ts b/src/serialization/types/CustomerCreationSource.ts new file mode 100644 index 000000000..aa8551b3f --- /dev/null +++ b/src/serialization/types/CustomerCreationSource.ts @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerCreationSource: core.serialization.Schema< + serializers.CustomerCreationSource.Raw, + Square.CustomerCreationSource +> = core.serialization.enum_([ + "OTHER", + "APPOINTMENTS", + "COUPON", + "DELETION_RECOVERY", + "DIRECTORY", + "EGIFTING", + "EMAIL_COLLECTION", + "FEEDBACK", + "IMPORT", + "INVOICES", + "LOYALTY", + "MARKETING", + "MERGE", + "ONLINE_STORE", + "INSTANT_PROFILE", + "TERMINAL", + "THIRD_PARTY", + "THIRD_PARTY_IMPORT", + "UNMERGE_RECOVERY", +]); + +export declare namespace CustomerCreationSource { + export type Raw = + | "OTHER" + | "APPOINTMENTS" + | "COUPON" + | "DELETION_RECOVERY" + | "DIRECTORY" + | "EGIFTING" + | "EMAIL_COLLECTION" + | "FEEDBACK" + | "IMPORT" + | "INVOICES" + | "LOYALTY" + | "MARKETING" + | "MERGE" + | "ONLINE_STORE" + | "INSTANT_PROFILE" + | "TERMINAL" + | "THIRD_PARTY" + | "THIRD_PARTY_IMPORT" + | "UNMERGE_RECOVERY"; +} diff --git a/src/serialization/types/CustomerCreationSourceFilter.ts b/src/serialization/types/CustomerCreationSourceFilter.ts new file mode 100644 index 000000000..514cd7c2b --- /dev/null +++ b/src/serialization/types/CustomerCreationSourceFilter.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomerCreationSource } from "./CustomerCreationSource"; +import { CustomerInclusionExclusion } from "./CustomerInclusionExclusion"; + +export const CustomerCreationSourceFilter: core.serialization.ObjectSchema< + serializers.CustomerCreationSourceFilter.Raw, + Square.CustomerCreationSourceFilter +> = core.serialization.object({ + values: core.serialization.list(CustomerCreationSource).optionalNullable(), + rule: CustomerInclusionExclusion.optional(), +}); + +export declare namespace CustomerCreationSourceFilter { + export interface Raw { + values?: (CustomerCreationSource.Raw[] | null) | null; + rule?: CustomerInclusionExclusion.Raw | null; + } +} diff --git a/src/serialization/types/CustomerCustomAttributeFilter.ts b/src/serialization/types/CustomerCustomAttributeFilter.ts new file mode 100644 index 000000000..4f4fd1320 --- /dev/null +++ b/src/serialization/types/CustomerCustomAttributeFilter.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomerCustomAttributeFilterValue } from "./CustomerCustomAttributeFilterValue"; +import { TimeRange } from "./TimeRange"; + +export const CustomerCustomAttributeFilter: core.serialization.ObjectSchema< + serializers.CustomerCustomAttributeFilter.Raw, + Square.CustomerCustomAttributeFilter +> = core.serialization.object({ + key: core.serialization.string(), + filter: CustomerCustomAttributeFilterValue.optional(), + updatedAt: core.serialization.property("updated_at", TimeRange.optional()), +}); + +export declare namespace CustomerCustomAttributeFilter { + export interface Raw { + key: string; + filter?: CustomerCustomAttributeFilterValue.Raw | null; + updated_at?: TimeRange.Raw | null; + } +} diff --git a/src/serialization/types/CustomerCustomAttributeFilterValue.ts b/src/serialization/types/CustomerCustomAttributeFilterValue.ts new file mode 100644 index 000000000..855a127f2 --- /dev/null +++ b/src/serialization/types/CustomerCustomAttributeFilterValue.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomerTextFilter } from "./CustomerTextFilter"; +import { FilterValue } from "./FilterValue"; +import { TimeRange } from "./TimeRange"; +import { FloatNumberRange } from "./FloatNumberRange"; +import { CustomerAddressFilter } from "./CustomerAddressFilter"; + +export const CustomerCustomAttributeFilterValue: core.serialization.ObjectSchema< + serializers.CustomerCustomAttributeFilterValue.Raw, + Square.CustomerCustomAttributeFilterValue +> = core.serialization.object({ + email: CustomerTextFilter.optional(), + phone: CustomerTextFilter.optional(), + text: CustomerTextFilter.optional(), + selection: FilterValue.optional(), + date: TimeRange.optional(), + number: FloatNumberRange.optional(), + boolean: core.serialization.boolean().optionalNullable(), + address: CustomerAddressFilter.optional(), +}); + +export declare namespace CustomerCustomAttributeFilterValue { + export interface Raw { + email?: CustomerTextFilter.Raw | null; + phone?: CustomerTextFilter.Raw | null; + text?: CustomerTextFilter.Raw | null; + selection?: FilterValue.Raw | null; + date?: TimeRange.Raw | null; + number?: FloatNumberRange.Raw | null; + boolean?: (boolean | null) | null; + address?: CustomerAddressFilter.Raw | null; + } +} diff --git a/src/serialization/types/CustomerCustomAttributeFilters.ts b/src/serialization/types/CustomerCustomAttributeFilters.ts new file mode 100644 index 000000000..b7fa2ed18 --- /dev/null +++ b/src/serialization/types/CustomerCustomAttributeFilters.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomerCustomAttributeFilter } from "./CustomerCustomAttributeFilter"; + +export const CustomerCustomAttributeFilters: core.serialization.ObjectSchema< + serializers.CustomerCustomAttributeFilters.Raw, + Square.CustomerCustomAttributeFilters +> = core.serialization.object({ + filters: core.serialization.list(CustomerCustomAttributeFilter).optionalNullable(), +}); + +export declare namespace CustomerCustomAttributeFilters { + export interface Raw { + filters?: (CustomerCustomAttributeFilter.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/CustomerDetails.ts b/src/serialization/types/CustomerDetails.ts new file mode 100644 index 000000000..04afde920 --- /dev/null +++ b/src/serialization/types/CustomerDetails.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerDetails: core.serialization.ObjectSchema = + core.serialization.object({ + customerInitiated: core.serialization.property( + "customer_initiated", + core.serialization.boolean().optionalNullable(), + ), + sellerKeyedIn: core.serialization.property("seller_keyed_in", core.serialization.boolean().optionalNullable()), + }); + +export declare namespace CustomerDetails { + export interface Raw { + customer_initiated?: (boolean | null) | null; + seller_keyed_in?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CustomerFilter.ts b/src/serialization/types/CustomerFilter.ts new file mode 100644 index 000000000..ff8288420 --- /dev/null +++ b/src/serialization/types/CustomerFilter.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomerCreationSourceFilter } from "./CustomerCreationSourceFilter"; +import { TimeRange } from "./TimeRange"; +import { CustomerTextFilter } from "./CustomerTextFilter"; +import { FilterValue } from "./FilterValue"; +import { CustomerCustomAttributeFilters } from "./CustomerCustomAttributeFilters"; + +export const CustomerFilter: core.serialization.ObjectSchema = + core.serialization.object({ + creationSource: core.serialization.property("creation_source", CustomerCreationSourceFilter.optional()), + createdAt: core.serialization.property("created_at", TimeRange.optional()), + updatedAt: core.serialization.property("updated_at", TimeRange.optional()), + emailAddress: core.serialization.property("email_address", CustomerTextFilter.optional()), + phoneNumber: core.serialization.property("phone_number", CustomerTextFilter.optional()), + referenceId: core.serialization.property("reference_id", CustomerTextFilter.optional()), + groupIds: core.serialization.property("group_ids", FilterValue.optional()), + customAttribute: core.serialization.property("custom_attribute", CustomerCustomAttributeFilters.optional()), + segmentIds: core.serialization.property("segment_ids", FilterValue.optional()), + }); + +export declare namespace CustomerFilter { + export interface Raw { + creation_source?: CustomerCreationSourceFilter.Raw | null; + created_at?: TimeRange.Raw | null; + updated_at?: TimeRange.Raw | null; + email_address?: CustomerTextFilter.Raw | null; + phone_number?: CustomerTextFilter.Raw | null; + reference_id?: CustomerTextFilter.Raw | null; + group_ids?: FilterValue.Raw | null; + custom_attribute?: CustomerCustomAttributeFilters.Raw | null; + segment_ids?: FilterValue.Raw | null; + } +} diff --git a/src/serialization/types/CustomerGroup.ts b/src/serialization/types/CustomerGroup.ts new file mode 100644 index 000000000..7375e075e --- /dev/null +++ b/src/serialization/types/CustomerGroup.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerGroup: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + }); + +export declare namespace CustomerGroup { + export interface Raw { + id?: string | null; + name: string; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/CustomerInclusionExclusion.ts b/src/serialization/types/CustomerInclusionExclusion.ts new file mode 100644 index 000000000..70cbbbb21 --- /dev/null +++ b/src/serialization/types/CustomerInclusionExclusion.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerInclusionExclusion: core.serialization.Schema< + serializers.CustomerInclusionExclusion.Raw, + Square.CustomerInclusionExclusion +> = core.serialization.enum_(["INCLUDE", "EXCLUDE"]); + +export declare namespace CustomerInclusionExclusion { + export type Raw = "INCLUDE" | "EXCLUDE"; +} diff --git a/src/serialization/types/CustomerPreferences.ts b/src/serialization/types/CustomerPreferences.ts new file mode 100644 index 000000000..c9f3a7d35 --- /dev/null +++ b/src/serialization/types/CustomerPreferences.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerPreferences: core.serialization.ObjectSchema< + serializers.CustomerPreferences.Raw, + Square.CustomerPreferences +> = core.serialization.object({ + emailUnsubscribed: core.serialization.property( + "email_unsubscribed", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace CustomerPreferences { + export interface Raw { + email_unsubscribed?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/CustomerQuery.ts b/src/serialization/types/CustomerQuery.ts new file mode 100644 index 000000000..74c50bc41 --- /dev/null +++ b/src/serialization/types/CustomerQuery.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomerFilter } from "./CustomerFilter"; +import { CustomerSort } from "./CustomerSort"; + +export const CustomerQuery: core.serialization.ObjectSchema = + core.serialization.object({ + filter: CustomerFilter.optional(), + sort: CustomerSort.optional(), + }); + +export declare namespace CustomerQuery { + export interface Raw { + filter?: CustomerFilter.Raw | null; + sort?: CustomerSort.Raw | null; + } +} diff --git a/src/serialization/types/CustomerSegment.ts b/src/serialization/types/CustomerSegment.ts new file mode 100644 index 000000000..ef1f34139 --- /dev/null +++ b/src/serialization/types/CustomerSegment.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerSegment: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + }); + +export declare namespace CustomerSegment { + export interface Raw { + id?: string | null; + name: string; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/CustomerSort.ts b/src/serialization/types/CustomerSort.ts new file mode 100644 index 000000000..2b9ef32f7 --- /dev/null +++ b/src/serialization/types/CustomerSort.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomerSortField } from "./CustomerSortField"; +import { SortOrder } from "./SortOrder"; + +export const CustomerSort: core.serialization.ObjectSchema = + core.serialization.object({ + field: CustomerSortField.optional(), + order: SortOrder.optional(), + }); + +export declare namespace CustomerSort { + export interface Raw { + field?: CustomerSortField.Raw | null; + order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/CustomerSortField.ts b/src/serialization/types/CustomerSortField.ts new file mode 100644 index 000000000..21e2203c2 --- /dev/null +++ b/src/serialization/types/CustomerSortField.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerSortField: core.serialization.Schema = + core.serialization.enum_(["DEFAULT", "CREATED_AT"]); + +export declare namespace CustomerSortField { + export type Raw = "DEFAULT" | "CREATED_AT"; +} diff --git a/src/serialization/types/CustomerTaxIds.ts b/src/serialization/types/CustomerTaxIds.ts new file mode 100644 index 000000000..cef8a8edb --- /dev/null +++ b/src/serialization/types/CustomerTaxIds.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerTaxIds: core.serialization.ObjectSchema = + core.serialization.object({ + euVat: core.serialization.property("eu_vat", core.serialization.string().optionalNullable()), + }); + +export declare namespace CustomerTaxIds { + export interface Raw { + eu_vat?: (string | null) | null; + } +} diff --git a/src/serialization/types/CustomerTextFilter.ts b/src/serialization/types/CustomerTextFilter.ts new file mode 100644 index 000000000..9812d5e91 --- /dev/null +++ b/src/serialization/types/CustomerTextFilter.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const CustomerTextFilter: core.serialization.ObjectSchema< + serializers.CustomerTextFilter.Raw, + Square.CustomerTextFilter +> = core.serialization.object({ + exact: core.serialization.string().optionalNullable(), + fuzzy: core.serialization.string().optionalNullable(), +}); + +export declare namespace CustomerTextFilter { + export interface Raw { + exact?: (string | null) | null; + fuzzy?: (string | null) | null; + } +} diff --git a/src/serialization/types/DataCollectionOptions.ts b/src/serialization/types/DataCollectionOptions.ts new file mode 100644 index 000000000..a79221a8d --- /dev/null +++ b/src/serialization/types/DataCollectionOptions.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DataCollectionOptionsInputType } from "./DataCollectionOptionsInputType"; +import { CollectedData } from "./CollectedData"; + +export const DataCollectionOptions: core.serialization.ObjectSchema< + serializers.DataCollectionOptions.Raw, + Square.DataCollectionOptions +> = core.serialization.object({ + title: core.serialization.string(), + body: core.serialization.string(), + inputType: core.serialization.property("input_type", DataCollectionOptionsInputType), + collectedData: core.serialization.property("collected_data", CollectedData.optional()), +}); + +export declare namespace DataCollectionOptions { + export interface Raw { + title: string; + body: string; + input_type: DataCollectionOptionsInputType.Raw; + collected_data?: CollectedData.Raw | null; + } +} diff --git a/src/serialization/types/DataCollectionOptionsInputType.ts b/src/serialization/types/DataCollectionOptionsInputType.ts new file mode 100644 index 000000000..73f2c73c1 --- /dev/null +++ b/src/serialization/types/DataCollectionOptionsInputType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DataCollectionOptionsInputType: core.serialization.Schema< + serializers.DataCollectionOptionsInputType.Raw, + Square.DataCollectionOptionsInputType +> = core.serialization.enum_(["EMAIL", "PHONE_NUMBER"]); + +export declare namespace DataCollectionOptionsInputType { + export type Raw = "EMAIL" | "PHONE_NUMBER"; +} diff --git a/src/serialization/types/DateRange.ts b/src/serialization/types/DateRange.ts new file mode 100644 index 000000000..a4f544d8a --- /dev/null +++ b/src/serialization/types/DateRange.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DateRange: core.serialization.ObjectSchema = + core.serialization.object({ + startDate: core.serialization.property("start_date", core.serialization.string().optionalNullable()), + endDate: core.serialization.property("end_date", core.serialization.string().optionalNullable()), + }); + +export declare namespace DateRange { + export interface Raw { + start_date?: (string | null) | null; + end_date?: (string | null) | null; + } +} diff --git a/src/serialization/types/DayOfWeek.ts b/src/serialization/types/DayOfWeek.ts new file mode 100644 index 000000000..38c8ded8d --- /dev/null +++ b/src/serialization/types/DayOfWeek.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DayOfWeek: core.serialization.Schema = + core.serialization.enum_(["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]); + +export declare namespace DayOfWeek { + export type Raw = "SUN" | "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT"; +} diff --git a/src/serialization/types/DeleteBookingCustomAttributeDefinitionResponse.ts b/src/serialization/types/DeleteBookingCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..0a4b638fc --- /dev/null +++ b/src/serialization/types/DeleteBookingCustomAttributeDefinitionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteBookingCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.DeleteBookingCustomAttributeDefinitionResponse.Raw, + Square.DeleteBookingCustomAttributeDefinitionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteBookingCustomAttributeDefinitionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteBookingCustomAttributeResponse.ts b/src/serialization/types/DeleteBookingCustomAttributeResponse.ts new file mode 100644 index 000000000..ef33e73a4 --- /dev/null +++ b/src/serialization/types/DeleteBookingCustomAttributeResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteBookingCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.DeleteBookingCustomAttributeResponse.Raw, + Square.DeleteBookingCustomAttributeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteBookingCustomAttributeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteBreakTypeResponse.ts b/src/serialization/types/DeleteBreakTypeResponse.ts new file mode 100644 index 000000000..32a9fd7b4 --- /dev/null +++ b/src/serialization/types/DeleteBreakTypeResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteBreakTypeResponse: core.serialization.ObjectSchema< + serializers.DeleteBreakTypeResponse.Raw, + Square.DeleteBreakTypeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteBreakTypeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteCatalogObjectResponse.ts b/src/serialization/types/DeleteCatalogObjectResponse.ts new file mode 100644 index 000000000..8cd03bde4 --- /dev/null +++ b/src/serialization/types/DeleteCatalogObjectResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteCatalogObjectResponse: core.serialization.ObjectSchema< + serializers.DeleteCatalogObjectResponse.Raw, + Square.DeleteCatalogObjectResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + deletedObjectIds: core.serialization.property( + "deleted_object_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + deletedAt: core.serialization.property("deleted_at", core.serialization.string().optional()), +}); + +export declare namespace DeleteCatalogObjectResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + deleted_object_ids?: string[] | null; + deleted_at?: string | null; + } +} diff --git a/src/serialization/types/DeleteCustomerCardResponse.ts b/src/serialization/types/DeleteCustomerCardResponse.ts new file mode 100644 index 000000000..de93fa722 --- /dev/null +++ b/src/serialization/types/DeleteCustomerCardResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteCustomerCardResponse: core.serialization.ObjectSchema< + serializers.DeleteCustomerCardResponse.Raw, + Square.DeleteCustomerCardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteCustomerCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteCustomerCustomAttributeDefinitionResponse.ts b/src/serialization/types/DeleteCustomerCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..b74465071 --- /dev/null +++ b/src/serialization/types/DeleteCustomerCustomAttributeDefinitionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteCustomerCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.DeleteCustomerCustomAttributeDefinitionResponse.Raw, + Square.DeleteCustomerCustomAttributeDefinitionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteCustomerCustomAttributeDefinitionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteCustomerCustomAttributeResponse.ts b/src/serialization/types/DeleteCustomerCustomAttributeResponse.ts new file mode 100644 index 000000000..0a64db0d8 --- /dev/null +++ b/src/serialization/types/DeleteCustomerCustomAttributeResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteCustomerCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.DeleteCustomerCustomAttributeResponse.Raw, + Square.DeleteCustomerCustomAttributeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteCustomerCustomAttributeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteCustomerGroupResponse.ts b/src/serialization/types/DeleteCustomerGroupResponse.ts new file mode 100644 index 000000000..ceefcf781 --- /dev/null +++ b/src/serialization/types/DeleteCustomerGroupResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteCustomerGroupResponse: core.serialization.ObjectSchema< + serializers.DeleteCustomerGroupResponse.Raw, + Square.DeleteCustomerGroupResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteCustomerGroupResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteCustomerResponse.ts b/src/serialization/types/DeleteCustomerResponse.ts new file mode 100644 index 000000000..b6b31e040 --- /dev/null +++ b/src/serialization/types/DeleteCustomerResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteCustomerResponse: core.serialization.ObjectSchema< + serializers.DeleteCustomerResponse.Raw, + Square.DeleteCustomerResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteCustomerResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteDisputeEvidenceResponse.ts b/src/serialization/types/DeleteDisputeEvidenceResponse.ts new file mode 100644 index 000000000..5462a5275 --- /dev/null +++ b/src/serialization/types/DeleteDisputeEvidenceResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteDisputeEvidenceResponse: core.serialization.ObjectSchema< + serializers.DeleteDisputeEvidenceResponse.Raw, + Square.DeleteDisputeEvidenceResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteDisputeEvidenceResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteInvoiceAttachmentResponse.ts b/src/serialization/types/DeleteInvoiceAttachmentResponse.ts new file mode 100644 index 000000000..6385db0c8 --- /dev/null +++ b/src/serialization/types/DeleteInvoiceAttachmentResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteInvoiceAttachmentResponse: core.serialization.ObjectSchema< + serializers.DeleteInvoiceAttachmentResponse.Raw, + Square.DeleteInvoiceAttachmentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteInvoiceAttachmentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteInvoiceResponse.ts b/src/serialization/types/DeleteInvoiceResponse.ts new file mode 100644 index 000000000..3475aa54b --- /dev/null +++ b/src/serialization/types/DeleteInvoiceResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteInvoiceResponse: core.serialization.ObjectSchema< + serializers.DeleteInvoiceResponse.Raw, + Square.DeleteInvoiceResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteInvoiceResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteLocationCustomAttributeDefinitionResponse.ts b/src/serialization/types/DeleteLocationCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..acf03bfd2 --- /dev/null +++ b/src/serialization/types/DeleteLocationCustomAttributeDefinitionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteLocationCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.DeleteLocationCustomAttributeDefinitionResponse.Raw, + Square.DeleteLocationCustomAttributeDefinitionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteLocationCustomAttributeDefinitionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteLocationCustomAttributeResponse.ts b/src/serialization/types/DeleteLocationCustomAttributeResponse.ts new file mode 100644 index 000000000..fa3d0ed2b --- /dev/null +++ b/src/serialization/types/DeleteLocationCustomAttributeResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteLocationCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.DeleteLocationCustomAttributeResponse.Raw, + Square.DeleteLocationCustomAttributeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteLocationCustomAttributeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteLoyaltyRewardResponse.ts b/src/serialization/types/DeleteLoyaltyRewardResponse.ts new file mode 100644 index 000000000..5d3fbc7bc --- /dev/null +++ b/src/serialization/types/DeleteLoyaltyRewardResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteLoyaltyRewardResponse: core.serialization.ObjectSchema< + serializers.DeleteLoyaltyRewardResponse.Raw, + Square.DeleteLoyaltyRewardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteLoyaltyRewardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteMerchantCustomAttributeDefinitionResponse.ts b/src/serialization/types/DeleteMerchantCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..4bb4141e6 --- /dev/null +++ b/src/serialization/types/DeleteMerchantCustomAttributeDefinitionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteMerchantCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.DeleteMerchantCustomAttributeDefinitionResponse.Raw, + Square.DeleteMerchantCustomAttributeDefinitionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteMerchantCustomAttributeDefinitionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteMerchantCustomAttributeResponse.ts b/src/serialization/types/DeleteMerchantCustomAttributeResponse.ts new file mode 100644 index 000000000..5c68b8813 --- /dev/null +++ b/src/serialization/types/DeleteMerchantCustomAttributeResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteMerchantCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.DeleteMerchantCustomAttributeResponse.Raw, + Square.DeleteMerchantCustomAttributeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteMerchantCustomAttributeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteOrderCustomAttributeDefinitionResponse.ts b/src/serialization/types/DeleteOrderCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..3b3ff726a --- /dev/null +++ b/src/serialization/types/DeleteOrderCustomAttributeDefinitionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteOrderCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.DeleteOrderCustomAttributeDefinitionResponse.Raw, + Square.DeleteOrderCustomAttributeDefinitionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteOrderCustomAttributeDefinitionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteOrderCustomAttributeResponse.ts b/src/serialization/types/DeleteOrderCustomAttributeResponse.ts new file mode 100644 index 000000000..b9edcc24a --- /dev/null +++ b/src/serialization/types/DeleteOrderCustomAttributeResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteOrderCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.DeleteOrderCustomAttributeResponse.Raw, + Square.DeleteOrderCustomAttributeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteOrderCustomAttributeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeletePaymentLinkResponse.ts b/src/serialization/types/DeletePaymentLinkResponse.ts new file mode 100644 index 000000000..a78fac4ba --- /dev/null +++ b/src/serialization/types/DeletePaymentLinkResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeletePaymentLinkResponse: core.serialization.ObjectSchema< + serializers.DeletePaymentLinkResponse.Raw, + Square.DeletePaymentLinkResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + id: core.serialization.string().optional(), + cancelledOrderId: core.serialization.property("cancelled_order_id", core.serialization.string().optional()), +}); + +export declare namespace DeletePaymentLinkResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + id?: string | null; + cancelled_order_id?: string | null; + } +} diff --git a/src/serialization/types/DeleteShiftResponse.ts b/src/serialization/types/DeleteShiftResponse.ts new file mode 100644 index 000000000..46c572ab5 --- /dev/null +++ b/src/serialization/types/DeleteShiftResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteShiftResponse: core.serialization.ObjectSchema< + serializers.DeleteShiftResponse.Raw, + Square.DeleteShiftResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteShiftResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteSnippetResponse.ts b/src/serialization/types/DeleteSnippetResponse.ts new file mode 100644 index 000000000..1c7670975 --- /dev/null +++ b/src/serialization/types/DeleteSnippetResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteSnippetResponse: core.serialization.ObjectSchema< + serializers.DeleteSnippetResponse.Raw, + Square.DeleteSnippetResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteSnippetResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DeleteSubscriptionActionResponse.ts b/src/serialization/types/DeleteSubscriptionActionResponse.ts new file mode 100644 index 000000000..1f25108ee --- /dev/null +++ b/src/serialization/types/DeleteSubscriptionActionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; + +export const DeleteSubscriptionActionResponse: core.serialization.ObjectSchema< + serializers.DeleteSubscriptionActionResponse.Raw, + Square.DeleteSubscriptionActionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), +}); + +export declare namespace DeleteSubscriptionActionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + } +} diff --git a/src/serialization/types/DeleteWebhookSubscriptionResponse.ts b/src/serialization/types/DeleteWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..b56bfc771 --- /dev/null +++ b/src/serialization/types/DeleteWebhookSubscriptionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DeleteWebhookSubscriptionResponse: core.serialization.ObjectSchema< + serializers.DeleteWebhookSubscriptionResponse.Raw, + Square.DeleteWebhookSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DeleteWebhookSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/Destination.ts b/src/serialization/types/Destination.ts new file mode 100644 index 000000000..366eff6d8 --- /dev/null +++ b/src/serialization/types/Destination.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DestinationType } from "./DestinationType"; + +export const Destination: core.serialization.ObjectSchema = + core.serialization.object({ + type: DestinationType.optional(), + id: core.serialization.string().optional(), + }); + +export declare namespace Destination { + export interface Raw { + type?: DestinationType.Raw | null; + id?: string | null; + } +} diff --git a/src/serialization/types/DestinationDetails.ts b/src/serialization/types/DestinationDetails.ts new file mode 100644 index 000000000..a75499ab1 --- /dev/null +++ b/src/serialization/types/DestinationDetails.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DestinationDetailsCardRefundDetails } from "./DestinationDetailsCardRefundDetails"; +import { DestinationDetailsCashRefundDetails } from "./DestinationDetailsCashRefundDetails"; +import { DestinationDetailsExternalRefundDetails } from "./DestinationDetailsExternalRefundDetails"; + +export const DestinationDetails: core.serialization.ObjectSchema< + serializers.DestinationDetails.Raw, + Square.DestinationDetails +> = core.serialization.object({ + cardDetails: core.serialization.property("card_details", DestinationDetailsCardRefundDetails.optional()), + cashDetails: core.serialization.property("cash_details", DestinationDetailsCashRefundDetails.optional()), + externalDetails: core.serialization.property( + "external_details", + DestinationDetailsExternalRefundDetails.optional(), + ), +}); + +export declare namespace DestinationDetails { + export interface Raw { + card_details?: DestinationDetailsCardRefundDetails.Raw | null; + cash_details?: DestinationDetailsCashRefundDetails.Raw | null; + external_details?: DestinationDetailsExternalRefundDetails.Raw | null; + } +} diff --git a/src/serialization/types/DestinationDetailsCardRefundDetails.ts b/src/serialization/types/DestinationDetailsCardRefundDetails.ts new file mode 100644 index 000000000..e7aeb6e32 --- /dev/null +++ b/src/serialization/types/DestinationDetailsCardRefundDetails.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Card } from "./Card"; + +export const DestinationDetailsCardRefundDetails: core.serialization.ObjectSchema< + serializers.DestinationDetailsCardRefundDetails.Raw, + Square.DestinationDetailsCardRefundDetails +> = core.serialization.object({ + card: Card.optional(), + entryMethod: core.serialization.property("entry_method", core.serialization.string().optionalNullable()), + authResultCode: core.serialization.property("auth_result_code", core.serialization.string().optionalNullable()), +}); + +export declare namespace DestinationDetailsCardRefundDetails { + export interface Raw { + card?: Card.Raw | null; + entry_method?: (string | null) | null; + auth_result_code?: (string | null) | null; + } +} diff --git a/src/serialization/types/DestinationDetailsCashRefundDetails.ts b/src/serialization/types/DestinationDetailsCashRefundDetails.ts new file mode 100644 index 000000000..a34890e16 --- /dev/null +++ b/src/serialization/types/DestinationDetailsCashRefundDetails.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const DestinationDetailsCashRefundDetails: core.serialization.ObjectSchema< + serializers.DestinationDetailsCashRefundDetails.Raw, + Square.DestinationDetailsCashRefundDetails +> = core.serialization.object({ + sellerSuppliedMoney: core.serialization.property("seller_supplied_money", Money), + changeBackMoney: core.serialization.property("change_back_money", Money.optional()), +}); + +export declare namespace DestinationDetailsCashRefundDetails { + export interface Raw { + seller_supplied_money: Money.Raw; + change_back_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/DestinationDetailsExternalRefundDetails.ts b/src/serialization/types/DestinationDetailsExternalRefundDetails.ts new file mode 100644 index 000000000..d6cc57509 --- /dev/null +++ b/src/serialization/types/DestinationDetailsExternalRefundDetails.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DestinationDetailsExternalRefundDetails: core.serialization.ObjectSchema< + serializers.DestinationDetailsExternalRefundDetails.Raw, + Square.DestinationDetailsExternalRefundDetails +> = core.serialization.object({ + type: core.serialization.string(), + source: core.serialization.string(), + sourceId: core.serialization.property("source_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace DestinationDetailsExternalRefundDetails { + export interface Raw { + type: string; + source: string; + source_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/DestinationType.ts b/src/serialization/types/DestinationType.ts new file mode 100644 index 000000000..8d5966cf5 --- /dev/null +++ b/src/serialization/types/DestinationType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DestinationType: core.serialization.Schema = + core.serialization.enum_(["BANK_ACCOUNT", "CARD", "SQUARE_BALANCE", "SQUARE_STORED_BALANCE"]); + +export declare namespace DestinationType { + export type Raw = "BANK_ACCOUNT" | "CARD" | "SQUARE_BALANCE" | "SQUARE_STORED_BALANCE"; +} diff --git a/src/serialization/types/Device.ts b/src/serialization/types/Device.ts new file mode 100644 index 000000000..bdfa1bd46 --- /dev/null +++ b/src/serialization/types/Device.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DeviceAttributes } from "./DeviceAttributes"; +import { Component } from "./Component"; +import { DeviceStatus } from "./DeviceStatus"; + +export const Device: core.serialization.ObjectSchema = core.serialization.object( + { + id: core.serialization.string().optional(), + attributes: DeviceAttributes, + components: core.serialization.list(Component).optionalNullable(), + status: DeviceStatus.optional(), + }, +); + +export declare namespace Device { + export interface Raw { + id?: string | null; + attributes: DeviceAttributes.Raw; + components?: (Component.Raw[] | null) | null; + status?: DeviceStatus.Raw | null; + } +} diff --git a/src/serialization/types/DeviceAttributes.ts b/src/serialization/types/DeviceAttributes.ts new file mode 100644 index 000000000..364f6f982 --- /dev/null +++ b/src/serialization/types/DeviceAttributes.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DeviceAttributesDeviceType } from "./DeviceAttributesDeviceType"; + +export const DeviceAttributes: core.serialization.ObjectSchema< + serializers.DeviceAttributes.Raw, + Square.DeviceAttributes +> = core.serialization.object({ + type: DeviceAttributesDeviceType, + manufacturer: core.serialization.string(), + model: core.serialization.string().optionalNullable(), + name: core.serialization.string().optionalNullable(), + manufacturersId: core.serialization.property("manufacturers_id", core.serialization.string().optionalNullable()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + version: core.serialization.string().optional(), + merchantToken: core.serialization.property("merchant_token", core.serialization.string().optionalNullable()), +}); + +export declare namespace DeviceAttributes { + export interface Raw { + type: DeviceAttributesDeviceType.Raw; + manufacturer: string; + model?: (string | null) | null; + name?: (string | null) | null; + manufacturers_id?: (string | null) | null; + updated_at?: string | null; + version?: string | null; + merchant_token?: (string | null) | null; + } +} diff --git a/src/serialization/types/DeviceAttributesDeviceType.ts b/src/serialization/types/DeviceAttributesDeviceType.ts new file mode 100644 index 000000000..cd9d9fb54 --- /dev/null +++ b/src/serialization/types/DeviceAttributesDeviceType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceAttributesDeviceType: core.serialization.Schema< + serializers.DeviceAttributesDeviceType.Raw, + Square.DeviceAttributesDeviceType +> = core.serialization.stringLiteral("TERMINAL"); + +export declare namespace DeviceAttributesDeviceType { + export type Raw = "TERMINAL"; +} diff --git a/src/serialization/types/DeviceCheckoutOptions.ts b/src/serialization/types/DeviceCheckoutOptions.ts new file mode 100644 index 000000000..b9498253e --- /dev/null +++ b/src/serialization/types/DeviceCheckoutOptions.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TipSettings } from "./TipSettings"; + +export const DeviceCheckoutOptions: core.serialization.ObjectSchema< + serializers.DeviceCheckoutOptions.Raw, + Square.DeviceCheckoutOptions +> = core.serialization.object({ + deviceId: core.serialization.property("device_id", core.serialization.string()), + skipReceiptScreen: core.serialization.property( + "skip_receipt_screen", + core.serialization.boolean().optionalNullable(), + ), + collectSignature: core.serialization.property("collect_signature", core.serialization.boolean().optionalNullable()), + tipSettings: core.serialization.property("tip_settings", TipSettings.optional()), + showItemizedCart: core.serialization.property( + "show_itemized_cart", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace DeviceCheckoutOptions { + export interface Raw { + device_id: string; + skip_receipt_screen?: (boolean | null) | null; + collect_signature?: (boolean | null) | null; + tip_settings?: TipSettings.Raw | null; + show_itemized_cart?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/DeviceCode.ts b/src/serialization/types/DeviceCode.ts new file mode 100644 index 000000000..d21f97aa2 --- /dev/null +++ b/src/serialization/types/DeviceCode.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ProductType } from "./ProductType"; +import { DeviceCodeStatus } from "./DeviceCodeStatus"; + +export const DeviceCode: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string().optionalNullable(), + code: core.serialization.string().optional(), + deviceId: core.serialization.property("device_id", core.serialization.string().optional()), + productType: core.serialization.property("product_type", ProductType), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + status: DeviceCodeStatus.optional(), + pairBy: core.serialization.property("pair_by", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + statusChangedAt: core.serialization.property("status_changed_at", core.serialization.string().optional()), + pairedAt: core.serialization.property("paired_at", core.serialization.string().optional()), + }); + +export declare namespace DeviceCode { + export interface Raw { + id?: string | null; + name?: (string | null) | null; + code?: string | null; + device_id?: string | null; + product_type: ProductType.Raw; + location_id?: (string | null) | null; + status?: DeviceCodeStatus.Raw | null; + pair_by?: string | null; + created_at?: string | null; + status_changed_at?: string | null; + paired_at?: string | null; + } +} diff --git a/src/serialization/types/DeviceCodeStatus.ts b/src/serialization/types/DeviceCodeStatus.ts new file mode 100644 index 000000000..f3c765feb --- /dev/null +++ b/src/serialization/types/DeviceCodeStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceCodeStatus: core.serialization.Schema = + core.serialization.enum_(["UNKNOWN", "UNPAIRED", "PAIRED", "EXPIRED"]); + +export declare namespace DeviceCodeStatus { + export type Raw = "UNKNOWN" | "UNPAIRED" | "PAIRED" | "EXPIRED"; +} diff --git a/src/serialization/types/DeviceComponentDetailsApplicationDetails.ts b/src/serialization/types/DeviceComponentDetailsApplicationDetails.ts new file mode 100644 index 000000000..b0c35e557 --- /dev/null +++ b/src/serialization/types/DeviceComponentDetailsApplicationDetails.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ApplicationType } from "./ApplicationType"; + +export const DeviceComponentDetailsApplicationDetails: core.serialization.ObjectSchema< + serializers.DeviceComponentDetailsApplicationDetails.Raw, + Square.DeviceComponentDetailsApplicationDetails +> = core.serialization.object({ + applicationType: core.serialization.property("application_type", ApplicationType.optional()), + version: core.serialization.string().optional(), + sessionLocation: core.serialization.property("session_location", core.serialization.string().optionalNullable()), + deviceCodeId: core.serialization.property("device_code_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace DeviceComponentDetailsApplicationDetails { + export interface Raw { + application_type?: ApplicationType.Raw | null; + version?: string | null; + session_location?: (string | null) | null; + device_code_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/DeviceComponentDetailsBatteryDetails.ts b/src/serialization/types/DeviceComponentDetailsBatteryDetails.ts new file mode 100644 index 000000000..12e3b61d6 --- /dev/null +++ b/src/serialization/types/DeviceComponentDetailsBatteryDetails.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DeviceComponentDetailsExternalPower } from "./DeviceComponentDetailsExternalPower"; + +export const DeviceComponentDetailsBatteryDetails: core.serialization.ObjectSchema< + serializers.DeviceComponentDetailsBatteryDetails.Raw, + Square.DeviceComponentDetailsBatteryDetails +> = core.serialization.object({ + visiblePercent: core.serialization.property("visible_percent", core.serialization.number().optionalNullable()), + externalPower: core.serialization.property("external_power", DeviceComponentDetailsExternalPower.optional()), +}); + +export declare namespace DeviceComponentDetailsBatteryDetails { + export interface Raw { + visible_percent?: (number | null) | null; + external_power?: DeviceComponentDetailsExternalPower.Raw | null; + } +} diff --git a/src/serialization/types/DeviceComponentDetailsCardReaderDetails.ts b/src/serialization/types/DeviceComponentDetailsCardReaderDetails.ts new file mode 100644 index 000000000..5904dbe18 --- /dev/null +++ b/src/serialization/types/DeviceComponentDetailsCardReaderDetails.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceComponentDetailsCardReaderDetails: core.serialization.ObjectSchema< + serializers.DeviceComponentDetailsCardReaderDetails.Raw, + Square.DeviceComponentDetailsCardReaderDetails +> = core.serialization.object({ + version: core.serialization.string().optional(), +}); + +export declare namespace DeviceComponentDetailsCardReaderDetails { + export interface Raw { + version?: string | null; + } +} diff --git a/src/serialization/types/DeviceComponentDetailsEthernetDetails.ts b/src/serialization/types/DeviceComponentDetailsEthernetDetails.ts new file mode 100644 index 000000000..9fd0da52a --- /dev/null +++ b/src/serialization/types/DeviceComponentDetailsEthernetDetails.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceComponentDetailsEthernetDetails: core.serialization.ObjectSchema< + serializers.DeviceComponentDetailsEthernetDetails.Raw, + Square.DeviceComponentDetailsEthernetDetails +> = core.serialization.object({ + active: core.serialization.boolean().optionalNullable(), + ipAddressV4: core.serialization.property("ip_address_v4", core.serialization.string().optionalNullable()), +}); + +export declare namespace DeviceComponentDetailsEthernetDetails { + export interface Raw { + active?: (boolean | null) | null; + ip_address_v4?: (string | null) | null; + } +} diff --git a/src/serialization/types/DeviceComponentDetailsExternalPower.ts b/src/serialization/types/DeviceComponentDetailsExternalPower.ts new file mode 100644 index 000000000..0f81b7fee --- /dev/null +++ b/src/serialization/types/DeviceComponentDetailsExternalPower.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceComponentDetailsExternalPower: core.serialization.Schema< + serializers.DeviceComponentDetailsExternalPower.Raw, + Square.DeviceComponentDetailsExternalPower +> = core.serialization.enum_(["AVAILABLE_CHARGING", "AVAILABLE_NOT_IN_USE", "UNAVAILABLE", "AVAILABLE_INSUFFICIENT"]); + +export declare namespace DeviceComponentDetailsExternalPower { + export type Raw = "AVAILABLE_CHARGING" | "AVAILABLE_NOT_IN_USE" | "UNAVAILABLE" | "AVAILABLE_INSUFFICIENT"; +} diff --git a/src/serialization/types/DeviceComponentDetailsMeasurement.ts b/src/serialization/types/DeviceComponentDetailsMeasurement.ts new file mode 100644 index 000000000..6a6bfea0b --- /dev/null +++ b/src/serialization/types/DeviceComponentDetailsMeasurement.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceComponentDetailsMeasurement: core.serialization.ObjectSchema< + serializers.DeviceComponentDetailsMeasurement.Raw, + Square.DeviceComponentDetailsMeasurement +> = core.serialization.object({ + value: core.serialization.number().optionalNullable(), +}); + +export declare namespace DeviceComponentDetailsMeasurement { + export interface Raw { + value?: (number | null) | null; + } +} diff --git a/src/serialization/types/DeviceComponentDetailsWiFiDetails.ts b/src/serialization/types/DeviceComponentDetailsWiFiDetails.ts new file mode 100644 index 000000000..f8d34847c --- /dev/null +++ b/src/serialization/types/DeviceComponentDetailsWiFiDetails.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DeviceComponentDetailsMeasurement } from "./DeviceComponentDetailsMeasurement"; + +export const DeviceComponentDetailsWiFiDetails: core.serialization.ObjectSchema< + serializers.DeviceComponentDetailsWiFiDetails.Raw, + Square.DeviceComponentDetailsWiFiDetails +> = core.serialization.object({ + active: core.serialization.boolean().optionalNullable(), + ssid: core.serialization.string().optionalNullable(), + ipAddressV4: core.serialization.property("ip_address_v4", core.serialization.string().optionalNullable()), + secureConnection: core.serialization.property("secure_connection", core.serialization.string().optionalNullable()), + signalStrength: core.serialization.property("signal_strength", DeviceComponentDetailsMeasurement.optional()), +}); + +export declare namespace DeviceComponentDetailsWiFiDetails { + export interface Raw { + active?: (boolean | null) | null; + ssid?: (string | null) | null; + ip_address_v4?: (string | null) | null; + secure_connection?: (string | null) | null; + signal_strength?: DeviceComponentDetailsMeasurement.Raw | null; + } +} diff --git a/src/serialization/types/DeviceDetails.ts b/src/serialization/types/DeviceDetails.ts new file mode 100644 index 000000000..569bd6b08 --- /dev/null +++ b/src/serialization/types/DeviceDetails.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceDetails: core.serialization.ObjectSchema = + core.serialization.object({ + deviceId: core.serialization.property("device_id", core.serialization.string().optionalNullable()), + deviceInstallationId: core.serialization.property( + "device_installation_id", + core.serialization.string().optionalNullable(), + ), + deviceName: core.serialization.property("device_name", core.serialization.string().optionalNullable()), + }); + +export declare namespace DeviceDetails { + export interface Raw { + device_id?: (string | null) | null; + device_installation_id?: (string | null) | null; + device_name?: (string | null) | null; + } +} diff --git a/src/serialization/types/DeviceMetadata.ts b/src/serialization/types/DeviceMetadata.ts new file mode 100644 index 000000000..13b723292 --- /dev/null +++ b/src/serialization/types/DeviceMetadata.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceMetadata: core.serialization.ObjectSchema = + core.serialization.object({ + batteryPercentage: core.serialization.property( + "battery_percentage", + core.serialization.string().optionalNullable(), + ), + chargingState: core.serialization.property("charging_state", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + merchantId: core.serialization.property("merchant_id", core.serialization.string().optionalNullable()), + networkConnectionType: core.serialization.property( + "network_connection_type", + core.serialization.string().optionalNullable(), + ), + paymentRegion: core.serialization.property("payment_region", core.serialization.string().optionalNullable()), + serialNumber: core.serialization.property("serial_number", core.serialization.string().optionalNullable()), + osVersion: core.serialization.property("os_version", core.serialization.string().optionalNullable()), + appVersion: core.serialization.property("app_version", core.serialization.string().optionalNullable()), + wifiNetworkName: core.serialization.property( + "wifi_network_name", + core.serialization.string().optionalNullable(), + ), + wifiNetworkStrength: core.serialization.property( + "wifi_network_strength", + core.serialization.string().optionalNullable(), + ), + ipAddress: core.serialization.property("ip_address", core.serialization.string().optionalNullable()), + }); + +export declare namespace DeviceMetadata { + export interface Raw { + battery_percentage?: (string | null) | null; + charging_state?: (string | null) | null; + location_id?: (string | null) | null; + merchant_id?: (string | null) | null; + network_connection_type?: (string | null) | null; + payment_region?: (string | null) | null; + serial_number?: (string | null) | null; + os_version?: (string | null) | null; + app_version?: (string | null) | null; + wifi_network_name?: (string | null) | null; + wifi_network_strength?: (string | null) | null; + ip_address?: (string | null) | null; + } +} diff --git a/src/serialization/types/DeviceStatus.ts b/src/serialization/types/DeviceStatus.ts new file mode 100644 index 000000000..3cb85b739 --- /dev/null +++ b/src/serialization/types/DeviceStatus.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DeviceStatusCategory } from "./DeviceStatusCategory"; + +export const DeviceStatus: core.serialization.ObjectSchema = + core.serialization.object({ + category: DeviceStatusCategory.optional(), + }); + +export declare namespace DeviceStatus { + export interface Raw { + category?: DeviceStatusCategory.Raw | null; + } +} diff --git a/src/serialization/types/DeviceStatusCategory.ts b/src/serialization/types/DeviceStatusCategory.ts new file mode 100644 index 000000000..35f539b5b --- /dev/null +++ b/src/serialization/types/DeviceStatusCategory.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DeviceStatusCategory: core.serialization.Schema< + serializers.DeviceStatusCategory.Raw, + Square.DeviceStatusCategory +> = core.serialization.enum_(["AVAILABLE", "NEEDS_ATTENTION", "OFFLINE"]); + +export declare namespace DeviceStatusCategory { + export type Raw = "AVAILABLE" | "NEEDS_ATTENTION" | "OFFLINE"; +} diff --git a/src/serialization/types/DigitalWalletDetails.ts b/src/serialization/types/DigitalWalletDetails.ts new file mode 100644 index 000000000..22a338e6f --- /dev/null +++ b/src/serialization/types/DigitalWalletDetails.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CashAppDetails } from "./CashAppDetails"; + +export const DigitalWalletDetails: core.serialization.ObjectSchema< + serializers.DigitalWalletDetails.Raw, + Square.DigitalWalletDetails +> = core.serialization.object({ + status: core.serialization.string().optionalNullable(), + brand: core.serialization.string().optionalNullable(), + cashAppDetails: core.serialization.property("cash_app_details", CashAppDetails.optional()), +}); + +export declare namespace DigitalWalletDetails { + export interface Raw { + status?: (string | null) | null; + brand?: (string | null) | null; + cash_app_details?: CashAppDetails.Raw | null; + } +} diff --git a/src/serialization/types/DisableCardResponse.ts b/src/serialization/types/DisableCardResponse.ts new file mode 100644 index 000000000..9b0895fff --- /dev/null +++ b/src/serialization/types/DisableCardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Card } from "./Card"; + +export const DisableCardResponse: core.serialization.ObjectSchema< + serializers.DisableCardResponse.Raw, + Square.DisableCardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + card: Card.optional(), +}); + +export declare namespace DisableCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + card?: Card.Raw | null; + } +} diff --git a/src/serialization/types/DisableEventsResponse.ts b/src/serialization/types/DisableEventsResponse.ts new file mode 100644 index 000000000..c00d6bce6 --- /dev/null +++ b/src/serialization/types/DisableEventsResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const DisableEventsResponse: core.serialization.ObjectSchema< + serializers.DisableEventsResponse.Raw, + Square.DisableEventsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace DisableEventsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/DismissTerminalActionResponse.ts b/src/serialization/types/DismissTerminalActionResponse.ts new file mode 100644 index 000000000..31c15cb00 --- /dev/null +++ b/src/serialization/types/DismissTerminalActionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalAction } from "./TerminalAction"; + +export const DismissTerminalActionResponse: core.serialization.ObjectSchema< + serializers.DismissTerminalActionResponse.Raw, + Square.DismissTerminalActionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + action: TerminalAction.optional(), +}); + +export declare namespace DismissTerminalActionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + action?: TerminalAction.Raw | null; + } +} diff --git a/src/serialization/types/DismissTerminalCheckoutResponse.ts b/src/serialization/types/DismissTerminalCheckoutResponse.ts new file mode 100644 index 000000000..355ace5b7 --- /dev/null +++ b/src/serialization/types/DismissTerminalCheckoutResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalCheckout } from "./TerminalCheckout"; + +export const DismissTerminalCheckoutResponse: core.serialization.ObjectSchema< + serializers.DismissTerminalCheckoutResponse.Raw, + Square.DismissTerminalCheckoutResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + checkout: TerminalCheckout.optional(), +}); + +export declare namespace DismissTerminalCheckoutResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + checkout?: TerminalCheckout.Raw | null; + } +} diff --git a/src/serialization/types/DismissTerminalRefundResponse.ts b/src/serialization/types/DismissTerminalRefundResponse.ts new file mode 100644 index 000000000..533b62e3a --- /dev/null +++ b/src/serialization/types/DismissTerminalRefundResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalRefund } from "./TerminalRefund"; + +export const DismissTerminalRefundResponse: core.serialization.ObjectSchema< + serializers.DismissTerminalRefundResponse.Raw, + Square.DismissTerminalRefundResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + refund: TerminalRefund.optional(), +}); + +export declare namespace DismissTerminalRefundResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + refund?: TerminalRefund.Raw | null; + } +} diff --git a/src/serialization/types/Dispute.ts b/src/serialization/types/Dispute.ts new file mode 100644 index 000000000..bff1b3f70 --- /dev/null +++ b/src/serialization/types/Dispute.ts @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { DisputeReason } from "./DisputeReason"; +import { DisputeState } from "./DisputeState"; +import { DisputedPayment } from "./DisputedPayment"; +import { CardBrand } from "./CardBrand"; + +export const Dispute: core.serialization.ObjectSchema = + core.serialization.object({ + disputeId: core.serialization.property("dispute_id", core.serialization.string().optionalNullable()), + id: core.serialization.string().optional(), + amountMoney: core.serialization.property("amount_money", Money.optional()), + reason: DisputeReason.optional(), + state: DisputeState.optional(), + dueAt: core.serialization.property("due_at", core.serialization.string().optionalNullable()), + disputedPayment: core.serialization.property("disputed_payment", DisputedPayment.optional()), + evidenceIds: core.serialization.property( + "evidence_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + cardBrand: core.serialization.property("card_brand", CardBrand.optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + brandDisputeId: core.serialization.property("brand_dispute_id", core.serialization.string().optionalNullable()), + reportedDate: core.serialization.property("reported_date", core.serialization.string().optionalNullable()), + reportedAt: core.serialization.property("reported_at", core.serialization.string().optionalNullable()), + version: core.serialization.number().optional(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace Dispute { + export interface Raw { + dispute_id?: (string | null) | null; + id?: string | null; + amount_money?: Money.Raw | null; + reason?: DisputeReason.Raw | null; + state?: DisputeState.Raw | null; + due_at?: (string | null) | null; + disputed_payment?: DisputedPayment.Raw | null; + evidence_ids?: (string[] | null) | null; + card_brand?: CardBrand.Raw | null; + created_at?: string | null; + updated_at?: string | null; + brand_dispute_id?: (string | null) | null; + reported_date?: (string | null) | null; + reported_at?: (string | null) | null; + version?: number | null; + location_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/DisputeEvidence.ts b/src/serialization/types/DisputeEvidence.ts new file mode 100644 index 000000000..905aca8e1 --- /dev/null +++ b/src/serialization/types/DisputeEvidence.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DisputeEvidenceFile } from "./DisputeEvidenceFile"; +import { DisputeEvidenceType } from "./DisputeEvidenceType"; + +export const DisputeEvidence: core.serialization.ObjectSchema = + core.serialization.object({ + evidenceId: core.serialization.property("evidence_id", core.serialization.string().optionalNullable()), + id: core.serialization.string().optional(), + disputeId: core.serialization.property("dispute_id", core.serialization.string().optionalNullable()), + evidenceFile: core.serialization.property("evidence_file", DisputeEvidenceFile.optional()), + evidenceText: core.serialization.property("evidence_text", core.serialization.string().optionalNullable()), + uploadedAt: core.serialization.property("uploaded_at", core.serialization.string().optionalNullable()), + evidenceType: core.serialization.property("evidence_type", DisputeEvidenceType.optional()), + }); + +export declare namespace DisputeEvidence { + export interface Raw { + evidence_id?: (string | null) | null; + id?: string | null; + dispute_id?: (string | null) | null; + evidence_file?: DisputeEvidenceFile.Raw | null; + evidence_text?: (string | null) | null; + uploaded_at?: (string | null) | null; + evidence_type?: DisputeEvidenceType.Raw | null; + } +} diff --git a/src/serialization/types/DisputeEvidenceFile.ts b/src/serialization/types/DisputeEvidenceFile.ts new file mode 100644 index 000000000..0d0db54ea --- /dev/null +++ b/src/serialization/types/DisputeEvidenceFile.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DisputeEvidenceFile: core.serialization.ObjectSchema< + serializers.DisputeEvidenceFile.Raw, + Square.DisputeEvidenceFile +> = core.serialization.object({ + filename: core.serialization.string().optionalNullable(), + filetype: core.serialization.string().optionalNullable(), +}); + +export declare namespace DisputeEvidenceFile { + export interface Raw { + filename?: (string | null) | null; + filetype?: (string | null) | null; + } +} diff --git a/src/serialization/types/DisputeEvidenceType.ts b/src/serialization/types/DisputeEvidenceType.ts new file mode 100644 index 000000000..4d28b606f --- /dev/null +++ b/src/serialization/types/DisputeEvidenceType.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DisputeEvidenceType: core.serialization.Schema< + serializers.DisputeEvidenceType.Raw, + Square.DisputeEvidenceType +> = core.serialization.enum_([ + "GENERIC_EVIDENCE", + "ONLINE_OR_APP_ACCESS_LOG", + "AUTHORIZATION_DOCUMENTATION", + "CANCELLATION_OR_REFUND_DOCUMENTATION", + "CARDHOLDER_COMMUNICATION", + "CARDHOLDER_INFORMATION", + "PURCHASE_ACKNOWLEDGEMENT", + "DUPLICATE_CHARGE_DOCUMENTATION", + "PRODUCT_OR_SERVICE_DESCRIPTION", + "RECEIPT", + "SERVICE_RECEIVED_DOCUMENTATION", + "PROOF_OF_DELIVERY_DOCUMENTATION", + "RELATED_TRANSACTION_DOCUMENTATION", + "REBUTTAL_EXPLANATION", + "TRACKING_NUMBER", +]); + +export declare namespace DisputeEvidenceType { + export type Raw = + | "GENERIC_EVIDENCE" + | "ONLINE_OR_APP_ACCESS_LOG" + | "AUTHORIZATION_DOCUMENTATION" + | "CANCELLATION_OR_REFUND_DOCUMENTATION" + | "CARDHOLDER_COMMUNICATION" + | "CARDHOLDER_INFORMATION" + | "PURCHASE_ACKNOWLEDGEMENT" + | "DUPLICATE_CHARGE_DOCUMENTATION" + | "PRODUCT_OR_SERVICE_DESCRIPTION" + | "RECEIPT" + | "SERVICE_RECEIVED_DOCUMENTATION" + | "PROOF_OF_DELIVERY_DOCUMENTATION" + | "RELATED_TRANSACTION_DOCUMENTATION" + | "REBUTTAL_EXPLANATION" + | "TRACKING_NUMBER"; +} diff --git a/src/serialization/types/DisputeReason.ts b/src/serialization/types/DisputeReason.ts new file mode 100644 index 000000000..f2e6f91f4 --- /dev/null +++ b/src/serialization/types/DisputeReason.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DisputeReason: core.serialization.Schema = + core.serialization.enum_([ + "AMOUNT_DIFFERS", + "CANCELLED", + "DUPLICATE", + "NO_KNOWLEDGE", + "NOT_AS_DESCRIBED", + "NOT_RECEIVED", + "PAID_BY_OTHER_MEANS", + "CUSTOMER_REQUESTS_CREDIT", + "EMV_LIABILITY_SHIFT", + ]); + +export declare namespace DisputeReason { + export type Raw = + | "AMOUNT_DIFFERS" + | "CANCELLED" + | "DUPLICATE" + | "NO_KNOWLEDGE" + | "NOT_AS_DESCRIBED" + | "NOT_RECEIVED" + | "PAID_BY_OTHER_MEANS" + | "CUSTOMER_REQUESTS_CREDIT" + | "EMV_LIABILITY_SHIFT"; +} diff --git a/src/serialization/types/DisputeState.ts b/src/serialization/types/DisputeState.ts new file mode 100644 index 000000000..815e152bd --- /dev/null +++ b/src/serialization/types/DisputeState.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DisputeState: core.serialization.Schema = + core.serialization.enum_([ + "INQUIRY_EVIDENCE_REQUIRED", + "INQUIRY_PROCESSING", + "INQUIRY_CLOSED", + "EVIDENCE_REQUIRED", + "PROCESSING", + "WON", + "LOST", + "ACCEPTED", + ]); + +export declare namespace DisputeState { + export type Raw = + | "INQUIRY_EVIDENCE_REQUIRED" + | "INQUIRY_PROCESSING" + | "INQUIRY_CLOSED" + | "EVIDENCE_REQUIRED" + | "PROCESSING" + | "WON" + | "LOST" + | "ACCEPTED"; +} diff --git a/src/serialization/types/DisputedPayment.ts b/src/serialization/types/DisputedPayment.ts new file mode 100644 index 000000000..5c0798547 --- /dev/null +++ b/src/serialization/types/DisputedPayment.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const DisputedPayment: core.serialization.ObjectSchema = + core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace DisputedPayment { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/Employee.ts b/src/serialization/types/Employee.ts new file mode 100644 index 000000000..860e08f00 --- /dev/null +++ b/src/serialization/types/Employee.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { EmployeeStatus } from "./EmployeeStatus"; + +export const Employee: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + firstName: core.serialization.property("first_name", core.serialization.string().optionalNullable()), + lastName: core.serialization.property("last_name", core.serialization.string().optionalNullable()), + email: core.serialization.string().optionalNullable(), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + status: EmployeeStatus.optional(), + isOwner: core.serialization.property("is_owner", core.serialization.boolean().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + }); + +export declare namespace Employee { + export interface Raw { + id?: string | null; + first_name?: (string | null) | null; + last_name?: (string | null) | null; + email?: (string | null) | null; + phone_number?: (string | null) | null; + location_ids?: (string[] | null) | null; + status?: EmployeeStatus.Raw | null; + is_owner?: (boolean | null) | null; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/EmployeeStatus.ts b/src/serialization/types/EmployeeStatus.ts new file mode 100644 index 000000000..46d16d836 --- /dev/null +++ b/src/serialization/types/EmployeeStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const EmployeeStatus: core.serialization.Schema = + core.serialization.enum_(["ACTIVE", "INACTIVE"]); + +export declare namespace EmployeeStatus { + export type Raw = "ACTIVE" | "INACTIVE"; +} diff --git a/src/serialization/types/EmployeeWage.ts b/src/serialization/types/EmployeeWage.ts new file mode 100644 index 000000000..14437ed3b --- /dev/null +++ b/src/serialization/types/EmployeeWage.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const EmployeeWage: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + employeeId: core.serialization.property("employee_id", core.serialization.string().optionalNullable()), + title: core.serialization.string().optionalNullable(), + hourlyRate: core.serialization.property("hourly_rate", Money.optional()), + }); + +export declare namespace EmployeeWage { + export interface Raw { + id?: string | null; + employee_id?: (string | null) | null; + title?: (string | null) | null; + hourly_rate?: Money.Raw | null; + } +} diff --git a/src/serialization/types/EnableEventsResponse.ts b/src/serialization/types/EnableEventsResponse.ts new file mode 100644 index 000000000..98c90c894 --- /dev/null +++ b/src/serialization/types/EnableEventsResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const EnableEventsResponse: core.serialization.ObjectSchema< + serializers.EnableEventsResponse.Raw, + Square.EnableEventsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace EnableEventsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ErrorCategory.ts b/src/serialization/types/ErrorCategory.ts new file mode 100644 index 000000000..dad8ca955 --- /dev/null +++ b/src/serialization/types/ErrorCategory.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ErrorCategory: core.serialization.Schema = + core.serialization.enum_([ + "API_ERROR", + "AUTHENTICATION_ERROR", + "INVALID_REQUEST_ERROR", + "RATE_LIMIT_ERROR", + "PAYMENT_METHOD_ERROR", + "REFUND_ERROR", + "MERCHANT_SUBSCRIPTION_ERROR", + "EXTERNAL_VENDOR_ERROR", + ]); + +export declare namespace ErrorCategory { + export type Raw = + | "API_ERROR" + | "AUTHENTICATION_ERROR" + | "INVALID_REQUEST_ERROR" + | "RATE_LIMIT_ERROR" + | "PAYMENT_METHOD_ERROR" + | "REFUND_ERROR" + | "MERCHANT_SUBSCRIPTION_ERROR" + | "EXTERNAL_VENDOR_ERROR"; +} diff --git a/src/serialization/types/ErrorCode.ts b/src/serialization/types/ErrorCode.ts new file mode 100644 index 000000000..0d86654fc --- /dev/null +++ b/src/serialization/types/ErrorCode.ts @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ErrorCode: core.serialization.Schema = + core.serialization.enum_([ + "INTERNAL_SERVER_ERROR", + "UNAUTHORIZED", + "ACCESS_TOKEN_EXPIRED", + "ACCESS_TOKEN_REVOKED", + "CLIENT_DISABLED", + "FORBIDDEN", + "INSUFFICIENT_SCOPES", + "APPLICATION_DISABLED", + "V1_APPLICATION", + "V1_ACCESS_TOKEN", + "CARD_PROCESSING_NOT_ENABLED", + "MERCHANT_SUBSCRIPTION_NOT_FOUND", + "BAD_REQUEST", + "MISSING_REQUIRED_PARAMETER", + "INCORRECT_TYPE", + "INVALID_TIME", + "INVALID_TIME_RANGE", + "INVALID_VALUE", + "INVALID_CURSOR", + "UNKNOWN_QUERY_PARAMETER", + "CONFLICTING_PARAMETERS", + "EXPECTED_JSON_BODY", + "INVALID_SORT_ORDER", + "VALUE_REGEX_MISMATCH", + "VALUE_TOO_SHORT", + "VALUE_TOO_LONG", + "VALUE_TOO_LOW", + "VALUE_TOO_HIGH", + "VALUE_EMPTY", + "ARRAY_LENGTH_TOO_LONG", + "ARRAY_LENGTH_TOO_SHORT", + "ARRAY_EMPTY", + "EXPECTED_BOOLEAN", + "EXPECTED_INTEGER", + "EXPECTED_FLOAT", + "EXPECTED_STRING", + "EXPECTED_OBJECT", + "EXPECTED_ARRAY", + "EXPECTED_MAP", + "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", + "INVALID_ARRAY_VALUE", + "INVALID_ENUM_VALUE", + "INVALID_CONTENT_TYPE", + "INVALID_FORM_VALUE", + "CUSTOMER_NOT_FOUND", + "ONE_INSTRUMENT_EXPECTED", + "NO_FIELDS_SET", + "TOO_MANY_MAP_ENTRIES", + "MAP_KEY_LENGTH_TOO_SHORT", + "MAP_KEY_LENGTH_TOO_LONG", + "CUSTOMER_MISSING_NAME", + "CUSTOMER_MISSING_EMAIL", + "INVALID_PAUSE_LENGTH", + "INVALID_DATE", + "UNSUPPORTED_COUNTRY", + "UNSUPPORTED_CURRENCY", + "APPLE_TTP_PIN_TOKEN", + "CARD_EXPIRED", + "INVALID_EXPIRATION", + "INVALID_EXPIRATION_YEAR", + "INVALID_EXPIRATION_DATE", + "UNSUPPORTED_CARD_BRAND", + "UNSUPPORTED_ENTRY_METHOD", + "INVALID_ENCRYPTED_CARD", + "INVALID_CARD", + "PAYMENT_AMOUNT_MISMATCH", + "GENERIC_DECLINE", + "CVV_FAILURE", + "ADDRESS_VERIFICATION_FAILURE", + "INVALID_ACCOUNT", + "CURRENCY_MISMATCH", + "INSUFFICIENT_FUNDS", + "INSUFFICIENT_PERMISSIONS", + "CARDHOLDER_INSUFFICIENT_PERMISSIONS", + "INVALID_LOCATION", + "TRANSACTION_LIMIT", + "VOICE_FAILURE", + "PAN_FAILURE", + "EXPIRATION_FAILURE", + "CARD_NOT_SUPPORTED", + "INVALID_PIN", + "MISSING_PIN", + "MISSING_ACCOUNT_TYPE", + "INVALID_POSTAL_CODE", + "INVALID_FEES", + "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED", + "PAYMENT_LIMIT_EXCEEDED", + "GIFT_CARD_AVAILABLE_AMOUNT", + "ACCOUNT_UNUSABLE", + "BUYER_REFUSED_PAYMENT", + "DELAYED_TRANSACTION_EXPIRED", + "DELAYED_TRANSACTION_CANCELED", + "DELAYED_TRANSACTION_CAPTURED", + "DELAYED_TRANSACTION_FAILED", + "CARD_TOKEN_EXPIRED", + "CARD_TOKEN_USED", + "AMOUNT_TOO_HIGH", + "UNSUPPORTED_INSTRUMENT_TYPE", + "REFUND_AMOUNT_INVALID", + "REFUND_ALREADY_PENDING", + "PAYMENT_NOT_REFUNDABLE", + "PAYMENT_NOT_REFUNDABLE_DUE_TO_DISPUTE", + "REFUND_DECLINED", + "INSUFFICIENT_PERMISSIONS_FOR_REFUND", + "INVALID_CARD_DATA", + "SOURCE_USED", + "SOURCE_EXPIRED", + "UNSUPPORTED_LOYALTY_REWARD_TIER", + "LOCATION_MISMATCH", + "IDEMPOTENCY_KEY_REUSED", + "UNEXPECTED_VALUE", + "SANDBOX_NOT_SUPPORTED", + "INVALID_EMAIL_ADDRESS", + "INVALID_PHONE_NUMBER", + "CHECKOUT_EXPIRED", + "BAD_CERTIFICATE", + "INVALID_SQUARE_VERSION_FORMAT", + "API_VERSION_INCOMPATIBLE", + "CARD_PRESENCE_REQUIRED", + "UNSUPPORTED_SOURCE_TYPE", + "CARD_MISMATCH", + "PLAID_ERROR", + "PLAID_ERROR_ITEM_LOGIN_REQUIRED", + "PLAID_ERROR_RATE_LIMIT", + "CARD_DECLINED", + "VERIFY_CVV_FAILURE", + "VERIFY_AVS_FAILURE", + "CARD_DECLINED_CALL_ISSUER", + "CARD_DECLINED_VERIFICATION_REQUIRED", + "BAD_EXPIRATION", + "CHIP_INSERTION_REQUIRED", + "ALLOWABLE_PIN_TRIES_EXCEEDED", + "RESERVATION_DECLINED", + "UNKNOWN_BODY_PARAMETER", + "NOT_FOUND", + "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", + "METHOD_NOT_ALLOWED", + "NOT_ACCEPTABLE", + "REQUEST_TIMEOUT", + "CONFLICT", + "GONE", + "REQUEST_ENTITY_TOO_LARGE", + "UNSUPPORTED_MEDIA_TYPE", + "UNPROCESSABLE_ENTITY", + "RATE_LIMITED", + "NOT_IMPLEMENTED", + "BAD_GATEWAY", + "SERVICE_UNAVAILABLE", + "TEMPORARY_ERROR", + "GATEWAY_TIMEOUT", + ]); + +export declare namespace ErrorCode { + export type Raw = + | "INTERNAL_SERVER_ERROR" + | "UNAUTHORIZED" + | "ACCESS_TOKEN_EXPIRED" + | "ACCESS_TOKEN_REVOKED" + | "CLIENT_DISABLED" + | "FORBIDDEN" + | "INSUFFICIENT_SCOPES" + | "APPLICATION_DISABLED" + | "V1_APPLICATION" + | "V1_ACCESS_TOKEN" + | "CARD_PROCESSING_NOT_ENABLED" + | "MERCHANT_SUBSCRIPTION_NOT_FOUND" + | "BAD_REQUEST" + | "MISSING_REQUIRED_PARAMETER" + | "INCORRECT_TYPE" + | "INVALID_TIME" + | "INVALID_TIME_RANGE" + | "INVALID_VALUE" + | "INVALID_CURSOR" + | "UNKNOWN_QUERY_PARAMETER" + | "CONFLICTING_PARAMETERS" + | "EXPECTED_JSON_BODY" + | "INVALID_SORT_ORDER" + | "VALUE_REGEX_MISMATCH" + | "VALUE_TOO_SHORT" + | "VALUE_TOO_LONG" + | "VALUE_TOO_LOW" + | "VALUE_TOO_HIGH" + | "VALUE_EMPTY" + | "ARRAY_LENGTH_TOO_LONG" + | "ARRAY_LENGTH_TOO_SHORT" + | "ARRAY_EMPTY" + | "EXPECTED_BOOLEAN" + | "EXPECTED_INTEGER" + | "EXPECTED_FLOAT" + | "EXPECTED_STRING" + | "EXPECTED_OBJECT" + | "EXPECTED_ARRAY" + | "EXPECTED_MAP" + | "EXPECTED_BASE64_ENCODED_BYTE_ARRAY" + | "INVALID_ARRAY_VALUE" + | "INVALID_ENUM_VALUE" + | "INVALID_CONTENT_TYPE" + | "INVALID_FORM_VALUE" + | "CUSTOMER_NOT_FOUND" + | "ONE_INSTRUMENT_EXPECTED" + | "NO_FIELDS_SET" + | "TOO_MANY_MAP_ENTRIES" + | "MAP_KEY_LENGTH_TOO_SHORT" + | "MAP_KEY_LENGTH_TOO_LONG" + | "CUSTOMER_MISSING_NAME" + | "CUSTOMER_MISSING_EMAIL" + | "INVALID_PAUSE_LENGTH" + | "INVALID_DATE" + | "UNSUPPORTED_COUNTRY" + | "UNSUPPORTED_CURRENCY" + | "APPLE_TTP_PIN_TOKEN" + | "CARD_EXPIRED" + | "INVALID_EXPIRATION" + | "INVALID_EXPIRATION_YEAR" + | "INVALID_EXPIRATION_DATE" + | "UNSUPPORTED_CARD_BRAND" + | "UNSUPPORTED_ENTRY_METHOD" + | "INVALID_ENCRYPTED_CARD" + | "INVALID_CARD" + | "PAYMENT_AMOUNT_MISMATCH" + | "GENERIC_DECLINE" + | "CVV_FAILURE" + | "ADDRESS_VERIFICATION_FAILURE" + | "INVALID_ACCOUNT" + | "CURRENCY_MISMATCH" + | "INSUFFICIENT_FUNDS" + | "INSUFFICIENT_PERMISSIONS" + | "CARDHOLDER_INSUFFICIENT_PERMISSIONS" + | "INVALID_LOCATION" + | "TRANSACTION_LIMIT" + | "VOICE_FAILURE" + | "PAN_FAILURE" + | "EXPIRATION_FAILURE" + | "CARD_NOT_SUPPORTED" + | "INVALID_PIN" + | "MISSING_PIN" + | "MISSING_ACCOUNT_TYPE" + | "INVALID_POSTAL_CODE" + | "INVALID_FEES" + | "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED" + | "PAYMENT_LIMIT_EXCEEDED" + | "GIFT_CARD_AVAILABLE_AMOUNT" + | "ACCOUNT_UNUSABLE" + | "BUYER_REFUSED_PAYMENT" + | "DELAYED_TRANSACTION_EXPIRED" + | "DELAYED_TRANSACTION_CANCELED" + | "DELAYED_TRANSACTION_CAPTURED" + | "DELAYED_TRANSACTION_FAILED" + | "CARD_TOKEN_EXPIRED" + | "CARD_TOKEN_USED" + | "AMOUNT_TOO_HIGH" + | "UNSUPPORTED_INSTRUMENT_TYPE" + | "REFUND_AMOUNT_INVALID" + | "REFUND_ALREADY_PENDING" + | "PAYMENT_NOT_REFUNDABLE" + | "PAYMENT_NOT_REFUNDABLE_DUE_TO_DISPUTE" + | "REFUND_DECLINED" + | "INSUFFICIENT_PERMISSIONS_FOR_REFUND" + | "INVALID_CARD_DATA" + | "SOURCE_USED" + | "SOURCE_EXPIRED" + | "UNSUPPORTED_LOYALTY_REWARD_TIER" + | "LOCATION_MISMATCH" + | "IDEMPOTENCY_KEY_REUSED" + | "UNEXPECTED_VALUE" + | "SANDBOX_NOT_SUPPORTED" + | "INVALID_EMAIL_ADDRESS" + | "INVALID_PHONE_NUMBER" + | "CHECKOUT_EXPIRED" + | "BAD_CERTIFICATE" + | "INVALID_SQUARE_VERSION_FORMAT" + | "API_VERSION_INCOMPATIBLE" + | "CARD_PRESENCE_REQUIRED" + | "UNSUPPORTED_SOURCE_TYPE" + | "CARD_MISMATCH" + | "PLAID_ERROR" + | "PLAID_ERROR_ITEM_LOGIN_REQUIRED" + | "PLAID_ERROR_RATE_LIMIT" + | "CARD_DECLINED" + | "VERIFY_CVV_FAILURE" + | "VERIFY_AVS_FAILURE" + | "CARD_DECLINED_CALL_ISSUER" + | "CARD_DECLINED_VERIFICATION_REQUIRED" + | "BAD_EXPIRATION" + | "CHIP_INSERTION_REQUIRED" + | "ALLOWABLE_PIN_TRIES_EXCEEDED" + | "RESERVATION_DECLINED" + | "UNKNOWN_BODY_PARAMETER" + | "NOT_FOUND" + | "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND" + | "METHOD_NOT_ALLOWED" + | "NOT_ACCEPTABLE" + | "REQUEST_TIMEOUT" + | "CONFLICT" + | "GONE" + | "REQUEST_ENTITY_TOO_LARGE" + | "UNSUPPORTED_MEDIA_TYPE" + | "UNPROCESSABLE_ENTITY" + | "RATE_LIMITED" + | "NOT_IMPLEMENTED" + | "BAD_GATEWAY" + | "SERVICE_UNAVAILABLE" + | "TEMPORARY_ERROR" + | "GATEWAY_TIMEOUT"; +} diff --git a/src/serialization/types/Error_.ts b/src/serialization/types/Error_.ts new file mode 100644 index 000000000..00b51db34 --- /dev/null +++ b/src/serialization/types/Error_.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ErrorCategory } from "./ErrorCategory"; +import { ErrorCode } from "./ErrorCode"; + +export const Error_: core.serialization.ObjectSchema = core.serialization.object( + { + category: ErrorCategory, + code: ErrorCode, + detail: core.serialization.string().optional(), + field: core.serialization.string().optional(), + }, +); + +export declare namespace Error_ { + export interface Raw { + category: ErrorCategory.Raw; + code: ErrorCode.Raw; + detail?: string | null; + field?: string | null; + } +} diff --git a/src/serialization/types/Event.ts b/src/serialization/types/Event.ts new file mode 100644 index 000000000..4c24c847c --- /dev/null +++ b/src/serialization/types/Event.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { EventData } from "./EventData"; + +export const Event: core.serialization.ObjectSchema = core.serialization.object({ + merchantId: core.serialization.property("merchant_id", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + type: core.serialization.string().optionalNullable(), + eventId: core.serialization.property("event_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + data: EventData.optional(), +}); + +export declare namespace Event { + export interface Raw { + merchant_id?: (string | null) | null; + location_id?: (string | null) | null; + type?: (string | null) | null; + event_id?: (string | null) | null; + created_at?: string | null; + data?: EventData.Raw | null; + } +} diff --git a/src/serialization/types/EventData.ts b/src/serialization/types/EventData.ts new file mode 100644 index 000000000..a4f971bf8 --- /dev/null +++ b/src/serialization/types/EventData.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const EventData: core.serialization.ObjectSchema = + core.serialization.object({ + type: core.serialization.string().optionalNullable(), + id: core.serialization.string().optional(), + deleted: core.serialization.boolean().optionalNullable(), + object: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optionalNullable(), + }); + +export declare namespace EventData { + export interface Raw { + type?: (string | null) | null; + id?: string | null; + deleted?: (boolean | null) | null; + object?: (Record | null) | null; + } +} diff --git a/src/serialization/types/EventMetadata.ts b/src/serialization/types/EventMetadata.ts new file mode 100644 index 000000000..6e97d0967 --- /dev/null +++ b/src/serialization/types/EventMetadata.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const EventMetadata: core.serialization.ObjectSchema = + core.serialization.object({ + eventId: core.serialization.property("event_id", core.serialization.string().optionalNullable()), + apiVersion: core.serialization.property("api_version", core.serialization.string().optionalNullable()), + }); + +export declare namespace EventMetadata { + export interface Raw { + event_id?: (string | null) | null; + api_version?: (string | null) | null; + } +} diff --git a/src/serialization/types/EventTypeMetadata.ts b/src/serialization/types/EventTypeMetadata.ts new file mode 100644 index 000000000..5eddc56f3 --- /dev/null +++ b/src/serialization/types/EventTypeMetadata.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const EventTypeMetadata: core.serialization.ObjectSchema< + serializers.EventTypeMetadata.Raw, + Square.EventTypeMetadata +> = core.serialization.object({ + eventType: core.serialization.property("event_type", core.serialization.string().optional()), + apiVersionIntroduced: core.serialization.property("api_version_introduced", core.serialization.string().optional()), + releaseStatus: core.serialization.property("release_status", core.serialization.string().optional()), +}); + +export declare namespace EventTypeMetadata { + export interface Raw { + event_type?: string | null; + api_version_introduced?: string | null; + release_status?: string | null; + } +} diff --git a/src/serialization/types/ExcludeStrategy.ts b/src/serialization/types/ExcludeStrategy.ts new file mode 100644 index 000000000..d00e62988 --- /dev/null +++ b/src/serialization/types/ExcludeStrategy.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ExcludeStrategy: core.serialization.Schema = + core.serialization.enum_(["LEAST_EXPENSIVE", "MOST_EXPENSIVE"]); + +export declare namespace ExcludeStrategy { + export type Raw = "LEAST_EXPENSIVE" | "MOST_EXPENSIVE"; +} diff --git a/src/serialization/types/ExternalPaymentDetails.ts b/src/serialization/types/ExternalPaymentDetails.ts new file mode 100644 index 000000000..957fe6370 --- /dev/null +++ b/src/serialization/types/ExternalPaymentDetails.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const ExternalPaymentDetails: core.serialization.ObjectSchema< + serializers.ExternalPaymentDetails.Raw, + Square.ExternalPaymentDetails +> = core.serialization.object({ + type: core.serialization.string(), + source: core.serialization.string(), + sourceId: core.serialization.property("source_id", core.serialization.string().optionalNullable()), + sourceFeeMoney: core.serialization.property("source_fee_money", Money.optional()), +}); + +export declare namespace ExternalPaymentDetails { + export interface Raw { + type: string; + source: string; + source_id?: (string | null) | null; + source_fee_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/FilterValue.ts b/src/serialization/types/FilterValue.ts new file mode 100644 index 000000000..b16ce73bd --- /dev/null +++ b/src/serialization/types/FilterValue.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FilterValue: core.serialization.ObjectSchema = + core.serialization.object({ + all: core.serialization.list(core.serialization.string()).optionalNullable(), + any: core.serialization.list(core.serialization.string()).optionalNullable(), + none: core.serialization.list(core.serialization.string()).optionalNullable(), + }); + +export declare namespace FilterValue { + export interface Raw { + all?: (string[] | null) | null; + any?: (string[] | null) | null; + none?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/FloatNumberRange.ts b/src/serialization/types/FloatNumberRange.ts new file mode 100644 index 000000000..40ebe8f9e --- /dev/null +++ b/src/serialization/types/FloatNumberRange.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FloatNumberRange: core.serialization.ObjectSchema< + serializers.FloatNumberRange.Raw, + Square.FloatNumberRange +> = core.serialization.object({ + startAt: core.serialization.property("start_at", core.serialization.string().optionalNullable()), + endAt: core.serialization.property("end_at", core.serialization.string().optionalNullable()), +}); + +export declare namespace FloatNumberRange { + export interface Raw { + start_at?: (string | null) | null; + end_at?: (string | null) | null; + } +} diff --git a/src/serialization/types/Fulfillment.ts b/src/serialization/types/Fulfillment.ts new file mode 100644 index 000000000..761eeaa08 --- /dev/null +++ b/src/serialization/types/Fulfillment.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { FulfillmentType } from "./FulfillmentType"; +import { FulfillmentState } from "./FulfillmentState"; +import { FulfillmentFulfillmentLineItemApplication } from "./FulfillmentFulfillmentLineItemApplication"; +import { FulfillmentFulfillmentEntry } from "./FulfillmentFulfillmentEntry"; +import { FulfillmentPickupDetails } from "./FulfillmentPickupDetails"; +import { FulfillmentShipmentDetails } from "./FulfillmentShipmentDetails"; +import { FulfillmentDeliveryDetails } from "./FulfillmentDeliveryDetails"; + +export const Fulfillment: core.serialization.ObjectSchema = + core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + type: FulfillmentType.optional(), + state: FulfillmentState.optional(), + lineItemApplication: core.serialization.property( + "line_item_application", + FulfillmentFulfillmentLineItemApplication.optional(), + ), + entries: core.serialization.list(FulfillmentFulfillmentEntry).optional(), + metadata: core.serialization + .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .optionalNullable(), + pickupDetails: core.serialization.property("pickup_details", FulfillmentPickupDetails.optional()), + shipmentDetails: core.serialization.property("shipment_details", FulfillmentShipmentDetails.optional()), + deliveryDetails: core.serialization.property("delivery_details", FulfillmentDeliveryDetails.optional()), + }); + +export declare namespace Fulfillment { + export interface Raw { + uid?: (string | null) | null; + type?: FulfillmentType.Raw | null; + state?: FulfillmentState.Raw | null; + line_item_application?: FulfillmentFulfillmentLineItemApplication.Raw | null; + entries?: FulfillmentFulfillmentEntry.Raw[] | null; + metadata?: (Record | null) | null; + pickup_details?: FulfillmentPickupDetails.Raw | null; + shipment_details?: FulfillmentShipmentDetails.Raw | null; + delivery_details?: FulfillmentDeliveryDetails.Raw | null; + } +} diff --git a/src/serialization/types/FulfillmentDeliveryDetails.ts b/src/serialization/types/FulfillmentDeliveryDetails.ts new file mode 100644 index 000000000..fc6a290f3 --- /dev/null +++ b/src/serialization/types/FulfillmentDeliveryDetails.ts @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { FulfillmentRecipient } from "./FulfillmentRecipient"; +import { FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType } from "./FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType"; + +export const FulfillmentDeliveryDetails: core.serialization.ObjectSchema< + serializers.FulfillmentDeliveryDetails.Raw, + Square.FulfillmentDeliveryDetails +> = core.serialization.object({ + recipient: FulfillmentRecipient.optional(), + scheduleType: core.serialization.property( + "schedule_type", + FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.optional(), + ), + placedAt: core.serialization.property("placed_at", core.serialization.string().optional()), + deliverAt: core.serialization.property("deliver_at", core.serialization.string().optionalNullable()), + prepTimeDuration: core.serialization.property("prep_time_duration", core.serialization.string().optionalNullable()), + deliveryWindowDuration: core.serialization.property( + "delivery_window_duration", + core.serialization.string().optionalNullable(), + ), + note: core.serialization.string().optionalNullable(), + completedAt: core.serialization.property("completed_at", core.serialization.string().optionalNullable()), + inProgressAt: core.serialization.property("in_progress_at", core.serialization.string().optional()), + rejectedAt: core.serialization.property("rejected_at", core.serialization.string().optional()), + readyAt: core.serialization.property("ready_at", core.serialization.string().optional()), + deliveredAt: core.serialization.property("delivered_at", core.serialization.string().optional()), + canceledAt: core.serialization.property("canceled_at", core.serialization.string().optional()), + cancelReason: core.serialization.property("cancel_reason", core.serialization.string().optionalNullable()), + courierPickupAt: core.serialization.property("courier_pickup_at", core.serialization.string().optionalNullable()), + courierPickupWindowDuration: core.serialization.property( + "courier_pickup_window_duration", + core.serialization.string().optionalNullable(), + ), + isNoContactDelivery: core.serialization.property( + "is_no_contact_delivery", + core.serialization.boolean().optionalNullable(), + ), + dropoffNotes: core.serialization.property("dropoff_notes", core.serialization.string().optionalNullable()), + courierProviderName: core.serialization.property( + "courier_provider_name", + core.serialization.string().optionalNullable(), + ), + courierSupportPhoneNumber: core.serialization.property( + "courier_support_phone_number", + core.serialization.string().optionalNullable(), + ), + squareDeliveryId: core.serialization.property("square_delivery_id", core.serialization.string().optionalNullable()), + externalDeliveryId: core.serialization.property( + "external_delivery_id", + core.serialization.string().optionalNullable(), + ), + managedDelivery: core.serialization.property("managed_delivery", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace FulfillmentDeliveryDetails { + export interface Raw { + recipient?: FulfillmentRecipient.Raw | null; + schedule_type?: FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.Raw | null; + placed_at?: string | null; + deliver_at?: (string | null) | null; + prep_time_duration?: (string | null) | null; + delivery_window_duration?: (string | null) | null; + note?: (string | null) | null; + completed_at?: (string | null) | null; + in_progress_at?: string | null; + rejected_at?: string | null; + ready_at?: string | null; + delivered_at?: string | null; + canceled_at?: string | null; + cancel_reason?: (string | null) | null; + courier_pickup_at?: (string | null) | null; + courier_pickup_window_duration?: (string | null) | null; + is_no_contact_delivery?: (boolean | null) | null; + dropoff_notes?: (string | null) | null; + courier_provider_name?: (string | null) | null; + courier_support_phone_number?: (string | null) | null; + square_delivery_id?: (string | null) | null; + external_delivery_id?: (string | null) | null; + managed_delivery?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.ts b/src/serialization/types/FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.ts new file mode 100644 index 000000000..dd1d97b1e --- /dev/null +++ b/src/serialization/types/FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType: core.serialization.Schema< + serializers.FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType.Raw, + Square.FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType +> = core.serialization.enum_(["SCHEDULED", "ASAP"]); + +export declare namespace FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType { + export type Raw = "SCHEDULED" | "ASAP"; +} diff --git a/src/serialization/types/FulfillmentFulfillmentEntry.ts b/src/serialization/types/FulfillmentFulfillmentEntry.ts new file mode 100644 index 000000000..da586b64f --- /dev/null +++ b/src/serialization/types/FulfillmentFulfillmentEntry.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FulfillmentFulfillmentEntry: core.serialization.ObjectSchema< + serializers.FulfillmentFulfillmentEntry.Raw, + Square.FulfillmentFulfillmentEntry +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + lineItemUid: core.serialization.property("line_item_uid", core.serialization.string()), + quantity: core.serialization.string(), + metadata: core.serialization + .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .optionalNullable(), +}); + +export declare namespace FulfillmentFulfillmentEntry { + export interface Raw { + uid?: (string | null) | null; + line_item_uid: string; + quantity: string; + metadata?: (Record | null) | null; + } +} diff --git a/src/serialization/types/FulfillmentFulfillmentLineItemApplication.ts b/src/serialization/types/FulfillmentFulfillmentLineItemApplication.ts new file mode 100644 index 000000000..0a3c8ab9e --- /dev/null +++ b/src/serialization/types/FulfillmentFulfillmentLineItemApplication.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FulfillmentFulfillmentLineItemApplication: core.serialization.Schema< + serializers.FulfillmentFulfillmentLineItemApplication.Raw, + Square.FulfillmentFulfillmentLineItemApplication +> = core.serialization.enum_(["ALL", "ENTRY_LIST"]); + +export declare namespace FulfillmentFulfillmentLineItemApplication { + export type Raw = "ALL" | "ENTRY_LIST"; +} diff --git a/src/serialization/types/FulfillmentPickupDetails.ts b/src/serialization/types/FulfillmentPickupDetails.ts new file mode 100644 index 000000000..f88d88241 --- /dev/null +++ b/src/serialization/types/FulfillmentPickupDetails.ts @@ -0,0 +1,69 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { FulfillmentRecipient } from "./FulfillmentRecipient"; +import { FulfillmentPickupDetailsScheduleType } from "./FulfillmentPickupDetailsScheduleType"; +import { FulfillmentPickupDetailsCurbsidePickupDetails } from "./FulfillmentPickupDetailsCurbsidePickupDetails"; + +export const FulfillmentPickupDetails: core.serialization.ObjectSchema< + serializers.FulfillmentPickupDetails.Raw, + Square.FulfillmentPickupDetails +> = core.serialization.object({ + recipient: FulfillmentRecipient.optional(), + expiresAt: core.serialization.property("expires_at", core.serialization.string().optionalNullable()), + autoCompleteDuration: core.serialization.property( + "auto_complete_duration", + core.serialization.string().optionalNullable(), + ), + scheduleType: core.serialization.property("schedule_type", FulfillmentPickupDetailsScheduleType.optional()), + pickupAt: core.serialization.property("pickup_at", core.serialization.string().optionalNullable()), + pickupWindowDuration: core.serialization.property( + "pickup_window_duration", + core.serialization.string().optionalNullable(), + ), + prepTimeDuration: core.serialization.property("prep_time_duration", core.serialization.string().optionalNullable()), + note: core.serialization.string().optionalNullable(), + placedAt: core.serialization.property("placed_at", core.serialization.string().optional()), + acceptedAt: core.serialization.property("accepted_at", core.serialization.string().optional()), + rejectedAt: core.serialization.property("rejected_at", core.serialization.string().optional()), + readyAt: core.serialization.property("ready_at", core.serialization.string().optional()), + expiredAt: core.serialization.property("expired_at", core.serialization.string().optional()), + pickedUpAt: core.serialization.property("picked_up_at", core.serialization.string().optional()), + canceledAt: core.serialization.property("canceled_at", core.serialization.string().optional()), + cancelReason: core.serialization.property("cancel_reason", core.serialization.string().optionalNullable()), + isCurbsidePickup: core.serialization.property( + "is_curbside_pickup", + core.serialization.boolean().optionalNullable(), + ), + curbsidePickupDetails: core.serialization.property( + "curbside_pickup_details", + FulfillmentPickupDetailsCurbsidePickupDetails.optional(), + ), +}); + +export declare namespace FulfillmentPickupDetails { + export interface Raw { + recipient?: FulfillmentRecipient.Raw | null; + expires_at?: (string | null) | null; + auto_complete_duration?: (string | null) | null; + schedule_type?: FulfillmentPickupDetailsScheduleType.Raw | null; + pickup_at?: (string | null) | null; + pickup_window_duration?: (string | null) | null; + prep_time_duration?: (string | null) | null; + note?: (string | null) | null; + placed_at?: string | null; + accepted_at?: string | null; + rejected_at?: string | null; + ready_at?: string | null; + expired_at?: string | null; + picked_up_at?: string | null; + canceled_at?: string | null; + cancel_reason?: (string | null) | null; + is_curbside_pickup?: (boolean | null) | null; + curbside_pickup_details?: FulfillmentPickupDetailsCurbsidePickupDetails.Raw | null; + } +} diff --git a/src/serialization/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts b/src/serialization/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts new file mode 100644 index 000000000..ce8f1eb19 --- /dev/null +++ b/src/serialization/types/FulfillmentPickupDetailsCurbsidePickupDetails.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FulfillmentPickupDetailsCurbsidePickupDetails: core.serialization.ObjectSchema< + serializers.FulfillmentPickupDetailsCurbsidePickupDetails.Raw, + Square.FulfillmentPickupDetailsCurbsidePickupDetails +> = core.serialization.object({ + curbsideDetails: core.serialization.property("curbside_details", core.serialization.string().optionalNullable()), + buyerArrivedAt: core.serialization.property("buyer_arrived_at", core.serialization.string().optionalNullable()), +}); + +export declare namespace FulfillmentPickupDetailsCurbsidePickupDetails { + export interface Raw { + curbside_details?: (string | null) | null; + buyer_arrived_at?: (string | null) | null; + } +} diff --git a/src/serialization/types/FulfillmentPickupDetailsScheduleType.ts b/src/serialization/types/FulfillmentPickupDetailsScheduleType.ts new file mode 100644 index 000000000..1d5ad7e9b --- /dev/null +++ b/src/serialization/types/FulfillmentPickupDetailsScheduleType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FulfillmentPickupDetailsScheduleType: core.serialization.Schema< + serializers.FulfillmentPickupDetailsScheduleType.Raw, + Square.FulfillmentPickupDetailsScheduleType +> = core.serialization.enum_(["SCHEDULED", "ASAP"]); + +export declare namespace FulfillmentPickupDetailsScheduleType { + export type Raw = "SCHEDULED" | "ASAP"; +} diff --git a/src/serialization/types/FulfillmentRecipient.ts b/src/serialization/types/FulfillmentRecipient.ts new file mode 100644 index 000000000..43148eacb --- /dev/null +++ b/src/serialization/types/FulfillmentRecipient.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; + +export const FulfillmentRecipient: core.serialization.ObjectSchema< + serializers.FulfillmentRecipient.Raw, + Square.FulfillmentRecipient +> = core.serialization.object({ + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + displayName: core.serialization.property("display_name", core.serialization.string().optionalNullable()), + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + address: Address.optional(), +}); + +export declare namespace FulfillmentRecipient { + export interface Raw { + customer_id?: (string | null) | null; + display_name?: (string | null) | null; + email_address?: (string | null) | null; + phone_number?: (string | null) | null; + address?: Address.Raw | null; + } +} diff --git a/src/serialization/types/FulfillmentShipmentDetails.ts b/src/serialization/types/FulfillmentShipmentDetails.ts new file mode 100644 index 000000000..b79f6229d --- /dev/null +++ b/src/serialization/types/FulfillmentShipmentDetails.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { FulfillmentRecipient } from "./FulfillmentRecipient"; + +export const FulfillmentShipmentDetails: core.serialization.ObjectSchema< + serializers.FulfillmentShipmentDetails.Raw, + Square.FulfillmentShipmentDetails +> = core.serialization.object({ + recipient: FulfillmentRecipient.optional(), + carrier: core.serialization.string().optionalNullable(), + shippingNote: core.serialization.property("shipping_note", core.serialization.string().optionalNullable()), + shippingType: core.serialization.property("shipping_type", core.serialization.string().optionalNullable()), + trackingNumber: core.serialization.property("tracking_number", core.serialization.string().optionalNullable()), + trackingUrl: core.serialization.property("tracking_url", core.serialization.string().optionalNullable()), + placedAt: core.serialization.property("placed_at", core.serialization.string().optional()), + inProgressAt: core.serialization.property("in_progress_at", core.serialization.string().optional()), + packagedAt: core.serialization.property("packaged_at", core.serialization.string().optional()), + expectedShippedAt: core.serialization.property( + "expected_shipped_at", + core.serialization.string().optionalNullable(), + ), + shippedAt: core.serialization.property("shipped_at", core.serialization.string().optional()), + canceledAt: core.serialization.property("canceled_at", core.serialization.string().optionalNullable()), + cancelReason: core.serialization.property("cancel_reason", core.serialization.string().optionalNullable()), + failedAt: core.serialization.property("failed_at", core.serialization.string().optional()), + failureReason: core.serialization.property("failure_reason", core.serialization.string().optionalNullable()), +}); + +export declare namespace FulfillmentShipmentDetails { + export interface Raw { + recipient?: FulfillmentRecipient.Raw | null; + carrier?: (string | null) | null; + shipping_note?: (string | null) | null; + shipping_type?: (string | null) | null; + tracking_number?: (string | null) | null; + tracking_url?: (string | null) | null; + placed_at?: string | null; + in_progress_at?: string | null; + packaged_at?: string | null; + expected_shipped_at?: (string | null) | null; + shipped_at?: string | null; + canceled_at?: (string | null) | null; + cancel_reason?: (string | null) | null; + failed_at?: string | null; + failure_reason?: (string | null) | null; + } +} diff --git a/src/serialization/types/FulfillmentState.ts b/src/serialization/types/FulfillmentState.ts new file mode 100644 index 000000000..d624ac9e3 --- /dev/null +++ b/src/serialization/types/FulfillmentState.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FulfillmentState: core.serialization.Schema = + core.serialization.enum_(["PROPOSED", "RESERVED", "PREPARED", "COMPLETED", "CANCELED", "FAILED"]); + +export declare namespace FulfillmentState { + export type Raw = "PROPOSED" | "RESERVED" | "PREPARED" | "COMPLETED" | "CANCELED" | "FAILED"; +} diff --git a/src/serialization/types/FulfillmentType.ts b/src/serialization/types/FulfillmentType.ts new file mode 100644 index 000000000..88783a472 --- /dev/null +++ b/src/serialization/types/FulfillmentType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const FulfillmentType: core.serialization.Schema = + core.serialization.enum_(["PICKUP", "SHIPMENT", "DELIVERY"]); + +export declare namespace FulfillmentType { + export type Raw = "PICKUP" | "SHIPMENT" | "DELIVERY"; +} diff --git a/src/serialization/types/GetBankAccountByV1IdResponse.ts b/src/serialization/types/GetBankAccountByV1IdResponse.ts new file mode 100644 index 000000000..f4c5e2568 --- /dev/null +++ b/src/serialization/types/GetBankAccountByV1IdResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { BankAccount } from "./BankAccount"; + +export const GetBankAccountByV1IdResponse: core.serialization.ObjectSchema< + serializers.GetBankAccountByV1IdResponse.Raw, + Square.GetBankAccountByV1IdResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + bankAccount: core.serialization.property("bank_account", BankAccount.optional()), +}); + +export declare namespace GetBankAccountByV1IdResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + bank_account?: BankAccount.Raw | null; + } +} diff --git a/src/serialization/types/GetBankAccountResponse.ts b/src/serialization/types/GetBankAccountResponse.ts new file mode 100644 index 000000000..cb4e4e99d --- /dev/null +++ b/src/serialization/types/GetBankAccountResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { BankAccount } from "./BankAccount"; + +export const GetBankAccountResponse: core.serialization.ObjectSchema< + serializers.GetBankAccountResponse.Raw, + Square.GetBankAccountResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + bankAccount: core.serialization.property("bank_account", BankAccount.optional()), +}); + +export declare namespace GetBankAccountResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + bank_account?: BankAccount.Raw | null; + } +} diff --git a/src/serialization/types/GetBookingResponse.ts b/src/serialization/types/GetBookingResponse.ts new file mode 100644 index 000000000..2a90fa6d8 --- /dev/null +++ b/src/serialization/types/GetBookingResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Booking } from "./Booking"; +import { Error_ } from "./Error_"; + +export const GetBookingResponse: core.serialization.ObjectSchema< + serializers.GetBookingResponse.Raw, + Square.GetBookingResponse +> = core.serialization.object({ + booking: Booking.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetBookingResponse { + export interface Raw { + booking?: Booking.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetBreakTypeResponse.ts b/src/serialization/types/GetBreakTypeResponse.ts new file mode 100644 index 000000000..026c809cc --- /dev/null +++ b/src/serialization/types/GetBreakTypeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BreakType } from "./BreakType"; +import { Error_ } from "./Error_"; + +export const GetBreakTypeResponse: core.serialization.ObjectSchema< + serializers.GetBreakTypeResponse.Raw, + Square.GetBreakTypeResponse +> = core.serialization.object({ + breakType: core.serialization.property("break_type", BreakType.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetBreakTypeResponse { + export interface Raw { + break_type?: BreakType.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetBusinessBookingProfileResponse.ts b/src/serialization/types/GetBusinessBookingProfileResponse.ts new file mode 100644 index 000000000..9c7bd48c6 --- /dev/null +++ b/src/serialization/types/GetBusinessBookingProfileResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BusinessBookingProfile } from "./BusinessBookingProfile"; +import { Error_ } from "./Error_"; + +export const GetBusinessBookingProfileResponse: core.serialization.ObjectSchema< + serializers.GetBusinessBookingProfileResponse.Raw, + Square.GetBusinessBookingProfileResponse +> = core.serialization.object({ + businessBookingProfile: core.serialization.property("business_booking_profile", BusinessBookingProfile.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetBusinessBookingProfileResponse { + export interface Raw { + business_booking_profile?: BusinessBookingProfile.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetCardResponse.ts b/src/serialization/types/GetCardResponse.ts new file mode 100644 index 000000000..4f32f7c94 --- /dev/null +++ b/src/serialization/types/GetCardResponse.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Card } from "./Card"; + +export const GetCardResponse: core.serialization.ObjectSchema = + core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + card: Card.optional(), + }); + +export declare namespace GetCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + card?: Card.Raw | null; + } +} diff --git a/src/serialization/types/GetCashDrawerShiftResponse.ts b/src/serialization/types/GetCashDrawerShiftResponse.ts new file mode 100644 index 000000000..7dbb57527 --- /dev/null +++ b/src/serialization/types/GetCashDrawerShiftResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CashDrawerShift } from "./CashDrawerShift"; +import { Error_ } from "./Error_"; + +export const GetCashDrawerShiftResponse: core.serialization.ObjectSchema< + serializers.GetCashDrawerShiftResponse.Raw, + Square.GetCashDrawerShiftResponse +> = core.serialization.object({ + cashDrawerShift: core.serialization.property("cash_drawer_shift", CashDrawerShift.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetCashDrawerShiftResponse { + export interface Raw { + cash_drawer_shift?: CashDrawerShift.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetCatalogObjectResponse.ts b/src/serialization/types/GetCatalogObjectResponse.ts new file mode 100644 index 000000000..bfaac4ff3 --- /dev/null +++ b/src/serialization/types/GetCatalogObjectResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const GetCatalogObjectResponse: core.serialization.ObjectSchema< + serializers.GetCatalogObjectResponse.Raw, + Square.GetCatalogObjectResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + object: core.serialization.lazy(() => serializers.CatalogObject).optional(), + relatedObjects: core.serialization.property( + "related_objects", + core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optional(), + ), +}); + +export declare namespace GetCatalogObjectResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + object?: serializers.CatalogObject.Raw | null; + related_objects?: serializers.CatalogObject.Raw[] | null; + } +} diff --git a/src/serialization/types/GetCustomerCustomAttributeDefinitionResponse.ts b/src/serialization/types/GetCustomerCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..1472950ac --- /dev/null +++ b/src/serialization/types/GetCustomerCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const GetCustomerCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.GetCustomerCustomAttributeDefinitionResponse.Raw, + Square.GetCustomerCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetCustomerCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetCustomerCustomAttributeResponse.ts b/src/serialization/types/GetCustomerCustomAttributeResponse.ts new file mode 100644 index 000000000..b927cf0fa --- /dev/null +++ b/src/serialization/types/GetCustomerCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const GetCustomerCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.GetCustomerCustomAttributeResponse.Raw, + Square.GetCustomerCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetCustomerCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetCustomerGroupResponse.ts b/src/serialization/types/GetCustomerGroupResponse.ts new file mode 100644 index 000000000..a7006053f --- /dev/null +++ b/src/serialization/types/GetCustomerGroupResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CustomerGroup } from "./CustomerGroup"; + +export const GetCustomerGroupResponse: core.serialization.ObjectSchema< + serializers.GetCustomerGroupResponse.Raw, + Square.GetCustomerGroupResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + group: CustomerGroup.optional(), +}); + +export declare namespace GetCustomerGroupResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + group?: CustomerGroup.Raw | null; + } +} diff --git a/src/serialization/types/GetCustomerResponse.ts b/src/serialization/types/GetCustomerResponse.ts new file mode 100644 index 000000000..f590308e1 --- /dev/null +++ b/src/serialization/types/GetCustomerResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Customer } from "./Customer"; + +export const GetCustomerResponse: core.serialization.ObjectSchema< + serializers.GetCustomerResponse.Raw, + Square.GetCustomerResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + customer: Customer.optional(), +}); + +export declare namespace GetCustomerResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + customer?: Customer.Raw | null; + } +} diff --git a/src/serialization/types/GetCustomerSegmentResponse.ts b/src/serialization/types/GetCustomerSegmentResponse.ts new file mode 100644 index 000000000..40aa558b5 --- /dev/null +++ b/src/serialization/types/GetCustomerSegmentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CustomerSegment } from "./CustomerSegment"; + +export const GetCustomerSegmentResponse: core.serialization.ObjectSchema< + serializers.GetCustomerSegmentResponse.Raw, + Square.GetCustomerSegmentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + segment: CustomerSegment.optional(), +}); + +export declare namespace GetCustomerSegmentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + segment?: CustomerSegment.Raw | null; + } +} diff --git a/src/serialization/types/GetDeviceCodeResponse.ts b/src/serialization/types/GetDeviceCodeResponse.ts new file mode 100644 index 000000000..ce9400994 --- /dev/null +++ b/src/serialization/types/GetDeviceCodeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { DeviceCode } from "./DeviceCode"; + +export const GetDeviceCodeResponse: core.serialization.ObjectSchema< + serializers.GetDeviceCodeResponse.Raw, + Square.GetDeviceCodeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + deviceCode: core.serialization.property("device_code", DeviceCode.optional()), +}); + +export declare namespace GetDeviceCodeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + device_code?: DeviceCode.Raw | null; + } +} diff --git a/src/serialization/types/GetDeviceResponse.ts b/src/serialization/types/GetDeviceResponse.ts new file mode 100644 index 000000000..0de28714a --- /dev/null +++ b/src/serialization/types/GetDeviceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Device } from "./Device"; + +export const GetDeviceResponse: core.serialization.ObjectSchema< + serializers.GetDeviceResponse.Raw, + Square.GetDeviceResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + device: Device.optional(), +}); + +export declare namespace GetDeviceResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + device?: Device.Raw | null; + } +} diff --git a/src/serialization/types/GetDisputeEvidenceResponse.ts b/src/serialization/types/GetDisputeEvidenceResponse.ts new file mode 100644 index 000000000..df9d25569 --- /dev/null +++ b/src/serialization/types/GetDisputeEvidenceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { DisputeEvidence } from "./DisputeEvidence"; + +export const GetDisputeEvidenceResponse: core.serialization.ObjectSchema< + serializers.GetDisputeEvidenceResponse.Raw, + Square.GetDisputeEvidenceResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + evidence: DisputeEvidence.optional(), +}); + +export declare namespace GetDisputeEvidenceResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + evidence?: DisputeEvidence.Raw | null; + } +} diff --git a/src/serialization/types/GetDisputeResponse.ts b/src/serialization/types/GetDisputeResponse.ts new file mode 100644 index 000000000..182b44846 --- /dev/null +++ b/src/serialization/types/GetDisputeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Dispute } from "./Dispute"; + +export const GetDisputeResponse: core.serialization.ObjectSchema< + serializers.GetDisputeResponse.Raw, + Square.GetDisputeResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + dispute: Dispute.optional(), +}); + +export declare namespace GetDisputeResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + dispute?: Dispute.Raw | null; + } +} diff --git a/src/serialization/types/GetEmployeeResponse.ts b/src/serialization/types/GetEmployeeResponse.ts new file mode 100644 index 000000000..268f84fc5 --- /dev/null +++ b/src/serialization/types/GetEmployeeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Employee } from "./Employee"; +import { Error_ } from "./Error_"; + +export const GetEmployeeResponse: core.serialization.ObjectSchema< + serializers.GetEmployeeResponse.Raw, + Square.GetEmployeeResponse +> = core.serialization.object({ + employee: Employee.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetEmployeeResponse { + export interface Raw { + employee?: Employee.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetEmployeeWageResponse.ts b/src/serialization/types/GetEmployeeWageResponse.ts new file mode 100644 index 000000000..5181efdb6 --- /dev/null +++ b/src/serialization/types/GetEmployeeWageResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { EmployeeWage } from "./EmployeeWage"; +import { Error_ } from "./Error_"; + +export const GetEmployeeWageResponse: core.serialization.ObjectSchema< + serializers.GetEmployeeWageResponse.Raw, + Square.GetEmployeeWageResponse +> = core.serialization.object({ + employeeWage: core.serialization.property("employee_wage", EmployeeWage.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetEmployeeWageResponse { + export interface Raw { + employee_wage?: EmployeeWage.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetGiftCardFromGanResponse.ts b/src/serialization/types/GetGiftCardFromGanResponse.ts new file mode 100644 index 000000000..cf88fa9ad --- /dev/null +++ b/src/serialization/types/GetGiftCardFromGanResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCard } from "./GiftCard"; + +export const GetGiftCardFromGanResponse: core.serialization.ObjectSchema< + serializers.GetGiftCardFromGanResponse.Raw, + Square.GetGiftCardFromGanResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCard: core.serialization.property("gift_card", GiftCard.optional()), +}); + +export declare namespace GetGiftCardFromGanResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_card?: GiftCard.Raw | null; + } +} diff --git a/src/serialization/types/GetGiftCardFromNonceResponse.ts b/src/serialization/types/GetGiftCardFromNonceResponse.ts new file mode 100644 index 000000000..242d8b966 --- /dev/null +++ b/src/serialization/types/GetGiftCardFromNonceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCard } from "./GiftCard"; + +export const GetGiftCardFromNonceResponse: core.serialization.ObjectSchema< + serializers.GetGiftCardFromNonceResponse.Raw, + Square.GetGiftCardFromNonceResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCard: core.serialization.property("gift_card", GiftCard.optional()), +}); + +export declare namespace GetGiftCardFromNonceResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_card?: GiftCard.Raw | null; + } +} diff --git a/src/serialization/types/GetGiftCardResponse.ts b/src/serialization/types/GetGiftCardResponse.ts new file mode 100644 index 000000000..467a46cc0 --- /dev/null +++ b/src/serialization/types/GetGiftCardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCard } from "./GiftCard"; + +export const GetGiftCardResponse: core.serialization.ObjectSchema< + serializers.GetGiftCardResponse.Raw, + Square.GetGiftCardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCard: core.serialization.property("gift_card", GiftCard.optional()), +}); + +export declare namespace GetGiftCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_card?: GiftCard.Raw | null; + } +} diff --git a/src/serialization/types/GetInventoryAdjustmentResponse.ts b/src/serialization/types/GetInventoryAdjustmentResponse.ts new file mode 100644 index 000000000..74163baa7 --- /dev/null +++ b/src/serialization/types/GetInventoryAdjustmentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { InventoryAdjustment } from "./InventoryAdjustment"; + +export const GetInventoryAdjustmentResponse: core.serialization.ObjectSchema< + serializers.GetInventoryAdjustmentResponse.Raw, + Square.GetInventoryAdjustmentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + adjustment: InventoryAdjustment.optional(), +}); + +export declare namespace GetInventoryAdjustmentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + adjustment?: InventoryAdjustment.Raw | null; + } +} diff --git a/src/serialization/types/GetInventoryChangesResponse.ts b/src/serialization/types/GetInventoryChangesResponse.ts new file mode 100644 index 000000000..1c75db603 --- /dev/null +++ b/src/serialization/types/GetInventoryChangesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { InventoryChange } from "./InventoryChange"; + +export const GetInventoryChangesResponse: core.serialization.ObjectSchema< + serializers.GetInventoryChangesResponse.Raw, + Square.GetInventoryChangesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + changes: core.serialization.list(InventoryChange).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace GetInventoryChangesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + changes?: InventoryChange.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/GetInventoryCountResponse.ts b/src/serialization/types/GetInventoryCountResponse.ts new file mode 100644 index 000000000..f9f487d37 --- /dev/null +++ b/src/serialization/types/GetInventoryCountResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { InventoryCount } from "./InventoryCount"; + +export const GetInventoryCountResponse: core.serialization.ObjectSchema< + serializers.GetInventoryCountResponse.Raw, + Square.GetInventoryCountResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + counts: core.serialization.list(InventoryCount).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace GetInventoryCountResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + counts?: InventoryCount.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/GetInventoryPhysicalCountResponse.ts b/src/serialization/types/GetInventoryPhysicalCountResponse.ts new file mode 100644 index 000000000..74e4f9b41 --- /dev/null +++ b/src/serialization/types/GetInventoryPhysicalCountResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { InventoryPhysicalCount } from "./InventoryPhysicalCount"; + +export const GetInventoryPhysicalCountResponse: core.serialization.ObjectSchema< + serializers.GetInventoryPhysicalCountResponse.Raw, + Square.GetInventoryPhysicalCountResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + count: InventoryPhysicalCount.optional(), +}); + +export declare namespace GetInventoryPhysicalCountResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + count?: InventoryPhysicalCount.Raw | null; + } +} diff --git a/src/serialization/types/GetInventoryTransferResponse.ts b/src/serialization/types/GetInventoryTransferResponse.ts new file mode 100644 index 000000000..2094d9103 --- /dev/null +++ b/src/serialization/types/GetInventoryTransferResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { InventoryTransfer } from "./InventoryTransfer"; + +export const GetInventoryTransferResponse: core.serialization.ObjectSchema< + serializers.GetInventoryTransferResponse.Raw, + Square.GetInventoryTransferResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + transfer: InventoryTransfer.optional(), +}); + +export declare namespace GetInventoryTransferResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + transfer?: InventoryTransfer.Raw | null; + } +} diff --git a/src/serialization/types/GetInvoiceResponse.ts b/src/serialization/types/GetInvoiceResponse.ts new file mode 100644 index 000000000..038461e76 --- /dev/null +++ b/src/serialization/types/GetInvoiceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Invoice } from "./Invoice"; +import { Error_ } from "./Error_"; + +export const GetInvoiceResponse: core.serialization.ObjectSchema< + serializers.GetInvoiceResponse.Raw, + Square.GetInvoiceResponse +> = core.serialization.object({ + invoice: Invoice.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetInvoiceResponse { + export interface Raw { + invoice?: Invoice.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetLocationResponse.ts b/src/serialization/types/GetLocationResponse.ts new file mode 100644 index 000000000..7d4112fd7 --- /dev/null +++ b/src/serialization/types/GetLocationResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Location } from "./Location"; + +export const GetLocationResponse: core.serialization.ObjectSchema< + serializers.GetLocationResponse.Raw, + Square.GetLocationResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + location: Location.optional(), +}); + +export declare namespace GetLocationResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + location?: Location.Raw | null; + } +} diff --git a/src/serialization/types/GetLoyaltyAccountResponse.ts b/src/serialization/types/GetLoyaltyAccountResponse.ts new file mode 100644 index 000000000..15b8eeb30 --- /dev/null +++ b/src/serialization/types/GetLoyaltyAccountResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyAccount } from "./LoyaltyAccount"; + +export const GetLoyaltyAccountResponse: core.serialization.ObjectSchema< + serializers.GetLoyaltyAccountResponse.Raw, + Square.GetLoyaltyAccountResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + loyaltyAccount: core.serialization.property("loyalty_account", LoyaltyAccount.optional()), +}); + +export declare namespace GetLoyaltyAccountResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + loyalty_account?: LoyaltyAccount.Raw | null; + } +} diff --git a/src/serialization/types/GetLoyaltyProgramResponse.ts b/src/serialization/types/GetLoyaltyProgramResponse.ts new file mode 100644 index 000000000..c054699c1 --- /dev/null +++ b/src/serialization/types/GetLoyaltyProgramResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyProgram } from "./LoyaltyProgram"; + +export const GetLoyaltyProgramResponse: core.serialization.ObjectSchema< + serializers.GetLoyaltyProgramResponse.Raw, + Square.GetLoyaltyProgramResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + program: LoyaltyProgram.optional(), +}); + +export declare namespace GetLoyaltyProgramResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + program?: LoyaltyProgram.Raw | null; + } +} diff --git a/src/serialization/types/GetLoyaltyPromotionResponse.ts b/src/serialization/types/GetLoyaltyPromotionResponse.ts new file mode 100644 index 000000000..d300d9cbd --- /dev/null +++ b/src/serialization/types/GetLoyaltyPromotionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyPromotion } from "./LoyaltyPromotion"; + +export const GetLoyaltyPromotionResponse: core.serialization.ObjectSchema< + serializers.GetLoyaltyPromotionResponse.Raw, + Square.GetLoyaltyPromotionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + loyaltyPromotion: core.serialization.property("loyalty_promotion", LoyaltyPromotion.optional()), +}); + +export declare namespace GetLoyaltyPromotionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + loyalty_promotion?: LoyaltyPromotion.Raw | null; + } +} diff --git a/src/serialization/types/GetLoyaltyRewardResponse.ts b/src/serialization/types/GetLoyaltyRewardResponse.ts new file mode 100644 index 000000000..d936de9af --- /dev/null +++ b/src/serialization/types/GetLoyaltyRewardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyReward } from "./LoyaltyReward"; + +export const GetLoyaltyRewardResponse: core.serialization.ObjectSchema< + serializers.GetLoyaltyRewardResponse.Raw, + Square.GetLoyaltyRewardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + reward: LoyaltyReward.optional(), +}); + +export declare namespace GetLoyaltyRewardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + reward?: LoyaltyReward.Raw | null; + } +} diff --git a/src/serialization/types/GetMerchantResponse.ts b/src/serialization/types/GetMerchantResponse.ts new file mode 100644 index 000000000..4f6ed35c3 --- /dev/null +++ b/src/serialization/types/GetMerchantResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Merchant } from "./Merchant"; + +export const GetMerchantResponse: core.serialization.ObjectSchema< + serializers.GetMerchantResponse.Raw, + Square.GetMerchantResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + merchant: Merchant.optional(), +}); + +export declare namespace GetMerchantResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + merchant?: Merchant.Raw | null; + } +} diff --git a/src/serialization/types/GetOrderResponse.ts b/src/serialization/types/GetOrderResponse.ts new file mode 100644 index 000000000..903ce0f8c --- /dev/null +++ b/src/serialization/types/GetOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Order } from "./Order"; +import { Error_ } from "./Error_"; + +export const GetOrderResponse: core.serialization.ObjectSchema< + serializers.GetOrderResponse.Raw, + Square.GetOrderResponse +> = core.serialization.object({ + order: Order.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetOrderResponse { + export interface Raw { + order?: Order.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetPaymentLinkResponse.ts b/src/serialization/types/GetPaymentLinkResponse.ts new file mode 100644 index 000000000..bcdcca186 --- /dev/null +++ b/src/serialization/types/GetPaymentLinkResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { PaymentLink } from "./PaymentLink"; + +export const GetPaymentLinkResponse: core.serialization.ObjectSchema< + serializers.GetPaymentLinkResponse.Raw, + Square.GetPaymentLinkResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + paymentLink: core.serialization.property("payment_link", PaymentLink.optional()), +}); + +export declare namespace GetPaymentLinkResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment_link?: PaymentLink.Raw | null; + } +} diff --git a/src/serialization/types/GetPaymentRefundResponse.ts b/src/serialization/types/GetPaymentRefundResponse.ts new file mode 100644 index 000000000..9711d4d39 --- /dev/null +++ b/src/serialization/types/GetPaymentRefundResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { PaymentRefund } from "./PaymentRefund"; + +export const GetPaymentRefundResponse: core.serialization.ObjectSchema< + serializers.GetPaymentRefundResponse.Raw, + Square.GetPaymentRefundResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + refund: PaymentRefund.optional(), +}); + +export declare namespace GetPaymentRefundResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + refund?: PaymentRefund.Raw | null; + } +} diff --git a/src/serialization/types/GetPaymentResponse.ts b/src/serialization/types/GetPaymentResponse.ts new file mode 100644 index 000000000..0f380cf2f --- /dev/null +++ b/src/serialization/types/GetPaymentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Payment } from "./Payment"; + +export const GetPaymentResponse: core.serialization.ObjectSchema< + serializers.GetPaymentResponse.Raw, + Square.GetPaymentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + payment: Payment.optional(), +}); + +export declare namespace GetPaymentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment?: Payment.Raw | null; + } +} diff --git a/src/serialization/types/GetPayoutResponse.ts b/src/serialization/types/GetPayoutResponse.ts new file mode 100644 index 000000000..cebd3beca --- /dev/null +++ b/src/serialization/types/GetPayoutResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Payout } from "./Payout"; +import { Error_ } from "./Error_"; + +export const GetPayoutResponse: core.serialization.ObjectSchema< + serializers.GetPayoutResponse.Raw, + Square.GetPayoutResponse +> = core.serialization.object({ + payout: Payout.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetPayoutResponse { + export interface Raw { + payout?: Payout.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetShiftResponse.ts b/src/serialization/types/GetShiftResponse.ts new file mode 100644 index 000000000..9c02f8677 --- /dev/null +++ b/src/serialization/types/GetShiftResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Shift } from "./Shift"; +import { Error_ } from "./Error_"; + +export const GetShiftResponse: core.serialization.ObjectSchema< + serializers.GetShiftResponse.Raw, + Square.GetShiftResponse +> = core.serialization.object({ + shift: Shift.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetShiftResponse { + export interface Raw { + shift?: Shift.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetSnippetResponse.ts b/src/serialization/types/GetSnippetResponse.ts new file mode 100644 index 000000000..a0a418678 --- /dev/null +++ b/src/serialization/types/GetSnippetResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Snippet } from "./Snippet"; + +export const GetSnippetResponse: core.serialization.ObjectSchema< + serializers.GetSnippetResponse.Raw, + Square.GetSnippetResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + snippet: Snippet.optional(), +}); + +export declare namespace GetSnippetResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + snippet?: Snippet.Raw | null; + } +} diff --git a/src/serialization/types/GetSubscriptionResponse.ts b/src/serialization/types/GetSubscriptionResponse.ts new file mode 100644 index 000000000..76695322b --- /dev/null +++ b/src/serialization/types/GetSubscriptionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; + +export const GetSubscriptionResponse: core.serialization.ObjectSchema< + serializers.GetSubscriptionResponse.Raw, + Square.GetSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), +}); + +export declare namespace GetSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + } +} diff --git a/src/serialization/types/GetTeamMemberBookingProfileResponse.ts b/src/serialization/types/GetTeamMemberBookingProfileResponse.ts new file mode 100644 index 000000000..5069af0aa --- /dev/null +++ b/src/serialization/types/GetTeamMemberBookingProfileResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMemberBookingProfile } from "./TeamMemberBookingProfile"; +import { Error_ } from "./Error_"; + +export const GetTeamMemberBookingProfileResponse: core.serialization.ObjectSchema< + serializers.GetTeamMemberBookingProfileResponse.Raw, + Square.GetTeamMemberBookingProfileResponse +> = core.serialization.object({ + teamMemberBookingProfile: core.serialization.property( + "team_member_booking_profile", + TeamMemberBookingProfile.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetTeamMemberBookingProfileResponse { + export interface Raw { + team_member_booking_profile?: TeamMemberBookingProfile.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetTeamMemberResponse.ts b/src/serialization/types/GetTeamMemberResponse.ts new file mode 100644 index 000000000..4023d83fe --- /dev/null +++ b/src/serialization/types/GetTeamMemberResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMember } from "./TeamMember"; +import { Error_ } from "./Error_"; + +export const GetTeamMemberResponse: core.serialization.ObjectSchema< + serializers.GetTeamMemberResponse.Raw, + Square.GetTeamMemberResponse +> = core.serialization.object({ + teamMember: core.serialization.property("team_member", TeamMember.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetTeamMemberResponse { + export interface Raw { + team_member?: TeamMember.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetTeamMemberWageResponse.ts b/src/serialization/types/GetTeamMemberWageResponse.ts new file mode 100644 index 000000000..d226f40f6 --- /dev/null +++ b/src/serialization/types/GetTeamMemberWageResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMemberWage } from "./TeamMemberWage"; +import { Error_ } from "./Error_"; + +export const GetTeamMemberWageResponse: core.serialization.ObjectSchema< + serializers.GetTeamMemberWageResponse.Raw, + Square.GetTeamMemberWageResponse +> = core.serialization.object({ + teamMemberWage: core.serialization.property("team_member_wage", TeamMemberWage.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetTeamMemberWageResponse { + export interface Raw { + team_member_wage?: TeamMemberWage.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetTerminalActionResponse.ts b/src/serialization/types/GetTerminalActionResponse.ts new file mode 100644 index 000000000..701202b83 --- /dev/null +++ b/src/serialization/types/GetTerminalActionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalAction } from "./TerminalAction"; + +export const GetTerminalActionResponse: core.serialization.ObjectSchema< + serializers.GetTerminalActionResponse.Raw, + Square.GetTerminalActionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + action: TerminalAction.optional(), +}); + +export declare namespace GetTerminalActionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + action?: TerminalAction.Raw | null; + } +} diff --git a/src/serialization/types/GetTerminalCheckoutResponse.ts b/src/serialization/types/GetTerminalCheckoutResponse.ts new file mode 100644 index 000000000..2a89d63a4 --- /dev/null +++ b/src/serialization/types/GetTerminalCheckoutResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalCheckout } from "./TerminalCheckout"; + +export const GetTerminalCheckoutResponse: core.serialization.ObjectSchema< + serializers.GetTerminalCheckoutResponse.Raw, + Square.GetTerminalCheckoutResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + checkout: TerminalCheckout.optional(), +}); + +export declare namespace GetTerminalCheckoutResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + checkout?: TerminalCheckout.Raw | null; + } +} diff --git a/src/serialization/types/GetTerminalRefundResponse.ts b/src/serialization/types/GetTerminalRefundResponse.ts new file mode 100644 index 000000000..87febea02 --- /dev/null +++ b/src/serialization/types/GetTerminalRefundResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalRefund } from "./TerminalRefund"; + +export const GetTerminalRefundResponse: core.serialization.ObjectSchema< + serializers.GetTerminalRefundResponse.Raw, + Square.GetTerminalRefundResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + refund: TerminalRefund.optional(), +}); + +export declare namespace GetTerminalRefundResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + refund?: TerminalRefund.Raw | null; + } +} diff --git a/src/serialization/types/GetTransactionResponse.ts b/src/serialization/types/GetTransactionResponse.ts new file mode 100644 index 000000000..c91a94d24 --- /dev/null +++ b/src/serialization/types/GetTransactionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Transaction } from "./Transaction"; + +export const GetTransactionResponse: core.serialization.ObjectSchema< + serializers.GetTransactionResponse.Raw, + Square.GetTransactionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + transaction: Transaction.optional(), +}); + +export declare namespace GetTransactionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + transaction?: Transaction.Raw | null; + } +} diff --git a/src/serialization/types/GetVendorResponse.ts b/src/serialization/types/GetVendorResponse.ts new file mode 100644 index 000000000..e2c170739 --- /dev/null +++ b/src/serialization/types/GetVendorResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Vendor } from "./Vendor"; + +export const GetVendorResponse: core.serialization.ObjectSchema< + serializers.GetVendorResponse.Raw, + Square.GetVendorResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + vendor: Vendor.optional(), +}); + +export declare namespace GetVendorResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + vendor?: Vendor.Raw | null; + } +} diff --git a/src/serialization/types/GetWageSettingResponse.ts b/src/serialization/types/GetWageSettingResponse.ts new file mode 100644 index 000000000..cb181e5e7 --- /dev/null +++ b/src/serialization/types/GetWageSettingResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { WageSetting } from "./WageSetting"; +import { Error_ } from "./Error_"; + +export const GetWageSettingResponse: core.serialization.ObjectSchema< + serializers.GetWageSettingResponse.Raw, + Square.GetWageSettingResponse +> = core.serialization.object({ + wageSetting: core.serialization.property("wage_setting", WageSetting.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace GetWageSettingResponse { + export interface Raw { + wage_setting?: WageSetting.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/GetWebhookSubscriptionResponse.ts b/src/serialization/types/GetWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..3e02e9e12 --- /dev/null +++ b/src/serialization/types/GetWebhookSubscriptionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { WebhookSubscription } from "./WebhookSubscription"; + +export const GetWebhookSubscriptionResponse: core.serialization.ObjectSchema< + serializers.GetWebhookSubscriptionResponse.Raw, + Square.GetWebhookSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: WebhookSubscription.optional(), +}); + +export declare namespace GetWebhookSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: WebhookSubscription.Raw | null; + } +} diff --git a/src/serialization/types/GiftCard.ts b/src/serialization/types/GiftCard.ts new file mode 100644 index 000000000..87199f596 --- /dev/null +++ b/src/serialization/types/GiftCard.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GiftCardType } from "./GiftCardType"; +import { GiftCardGanSource } from "./GiftCardGanSource"; +import { GiftCardStatus } from "./GiftCardStatus"; +import { Money } from "./Money"; + +export const GiftCard: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + type: GiftCardType, + ganSource: core.serialization.property("gan_source", GiftCardGanSource.optional()), + state: GiftCardStatus.optional(), + balanceMoney: core.serialization.property("balance_money", Money.optional()), + gan: core.serialization.string().optionalNullable(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + customerIds: core.serialization.property( + "customer_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + }); + +export declare namespace GiftCard { + export interface Raw { + id?: string | null; + type: GiftCardType.Raw; + gan_source?: GiftCardGanSource.Raw | null; + state?: GiftCardStatus.Raw | null; + balance_money?: Money.Raw | null; + gan?: (string | null) | null; + created_at?: string | null; + customer_ids?: string[] | null; + } +} diff --git a/src/serialization/types/GiftCardActivity.ts b/src/serialization/types/GiftCardActivity.ts new file mode 100644 index 000000000..5f2f95243 --- /dev/null +++ b/src/serialization/types/GiftCardActivity.ts @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GiftCardActivityType } from "./GiftCardActivityType"; +import { Money } from "./Money"; +import { GiftCardActivityLoad } from "./GiftCardActivityLoad"; +import { GiftCardActivityActivate } from "./GiftCardActivityActivate"; +import { GiftCardActivityRedeem } from "./GiftCardActivityRedeem"; +import { GiftCardActivityClearBalance } from "./GiftCardActivityClearBalance"; +import { GiftCardActivityDeactivate } from "./GiftCardActivityDeactivate"; +import { GiftCardActivityAdjustIncrement } from "./GiftCardActivityAdjustIncrement"; +import { GiftCardActivityAdjustDecrement } from "./GiftCardActivityAdjustDecrement"; +import { GiftCardActivityRefund } from "./GiftCardActivityRefund"; +import { GiftCardActivityUnlinkedActivityRefund } from "./GiftCardActivityUnlinkedActivityRefund"; +import { GiftCardActivityImport } from "./GiftCardActivityImport"; +import { GiftCardActivityBlock } from "./GiftCardActivityBlock"; +import { GiftCardActivityUnblock } from "./GiftCardActivityUnblock"; +import { GiftCardActivityImportReversal } from "./GiftCardActivityImportReversal"; +import { GiftCardActivityTransferBalanceTo } from "./GiftCardActivityTransferBalanceTo"; +import { GiftCardActivityTransferBalanceFrom } from "./GiftCardActivityTransferBalanceFrom"; + +export const GiftCardActivity: core.serialization.ObjectSchema< + serializers.GiftCardActivity.Raw, + Square.GiftCardActivity +> = core.serialization.object({ + id: core.serialization.string().optional(), + type: GiftCardActivityType, + locationId: core.serialization.property("location_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + giftCardId: core.serialization.property("gift_card_id", core.serialization.string().optionalNullable()), + giftCardGan: core.serialization.property("gift_card_gan", core.serialization.string().optionalNullable()), + giftCardBalanceMoney: core.serialization.property("gift_card_balance_money", Money.optional()), + loadActivityDetails: core.serialization.property("load_activity_details", GiftCardActivityLoad.optional()), + activateActivityDetails: core.serialization.property( + "activate_activity_details", + GiftCardActivityActivate.optional(), + ), + redeemActivityDetails: core.serialization.property("redeem_activity_details", GiftCardActivityRedeem.optional()), + clearBalanceActivityDetails: core.serialization.property( + "clear_balance_activity_details", + GiftCardActivityClearBalance.optional(), + ), + deactivateActivityDetails: core.serialization.property( + "deactivate_activity_details", + GiftCardActivityDeactivate.optional(), + ), + adjustIncrementActivityDetails: core.serialization.property( + "adjust_increment_activity_details", + GiftCardActivityAdjustIncrement.optional(), + ), + adjustDecrementActivityDetails: core.serialization.property( + "adjust_decrement_activity_details", + GiftCardActivityAdjustDecrement.optional(), + ), + refundActivityDetails: core.serialization.property("refund_activity_details", GiftCardActivityRefund.optional()), + unlinkedActivityRefundActivityDetails: core.serialization.property( + "unlinked_activity_refund_activity_details", + GiftCardActivityUnlinkedActivityRefund.optional(), + ), + importActivityDetails: core.serialization.property("import_activity_details", GiftCardActivityImport.optional()), + blockActivityDetails: core.serialization.property("block_activity_details", GiftCardActivityBlock.optional()), + unblockActivityDetails: core.serialization.property("unblock_activity_details", GiftCardActivityUnblock.optional()), + importReversalActivityDetails: core.serialization.property( + "import_reversal_activity_details", + GiftCardActivityImportReversal.optional(), + ), + transferBalanceToActivityDetails: core.serialization.property( + "transfer_balance_to_activity_details", + GiftCardActivityTransferBalanceTo.optional(), + ), + transferBalanceFromActivityDetails: core.serialization.property( + "transfer_balance_from_activity_details", + GiftCardActivityTransferBalanceFrom.optional(), + ), +}); + +export declare namespace GiftCardActivity { + export interface Raw { + id?: string | null; + type: GiftCardActivityType.Raw; + location_id: string; + created_at?: string | null; + gift_card_id?: (string | null) | null; + gift_card_gan?: (string | null) | null; + gift_card_balance_money?: Money.Raw | null; + load_activity_details?: GiftCardActivityLoad.Raw | null; + activate_activity_details?: GiftCardActivityActivate.Raw | null; + redeem_activity_details?: GiftCardActivityRedeem.Raw | null; + clear_balance_activity_details?: GiftCardActivityClearBalance.Raw | null; + deactivate_activity_details?: GiftCardActivityDeactivate.Raw | null; + adjust_increment_activity_details?: GiftCardActivityAdjustIncrement.Raw | null; + adjust_decrement_activity_details?: GiftCardActivityAdjustDecrement.Raw | null; + refund_activity_details?: GiftCardActivityRefund.Raw | null; + unlinked_activity_refund_activity_details?: GiftCardActivityUnlinkedActivityRefund.Raw | null; + import_activity_details?: GiftCardActivityImport.Raw | null; + block_activity_details?: GiftCardActivityBlock.Raw | null; + unblock_activity_details?: GiftCardActivityUnblock.Raw | null; + import_reversal_activity_details?: GiftCardActivityImportReversal.Raw | null; + transfer_balance_to_activity_details?: GiftCardActivityTransferBalanceTo.Raw | null; + transfer_balance_from_activity_details?: GiftCardActivityTransferBalanceFrom.Raw | null; + } +} diff --git a/src/serialization/types/GiftCardActivityActivate.ts b/src/serialization/types/GiftCardActivityActivate.ts new file mode 100644 index 000000000..f4643ba31 --- /dev/null +++ b/src/serialization/types/GiftCardActivityActivate.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const GiftCardActivityActivate: core.serialization.ObjectSchema< + serializers.GiftCardActivityActivate.Raw, + Square.GiftCardActivityActivate +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money.optional()), + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + lineItemUid: core.serialization.property("line_item_uid", core.serialization.string().optionalNullable()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + buyerPaymentInstrumentIds: core.serialization.property( + "buyer_payment_instrument_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace GiftCardActivityActivate { + export interface Raw { + amount_money?: Money.Raw | null; + order_id?: (string | null) | null; + line_item_uid?: (string | null) | null; + reference_id?: (string | null) | null; + buyer_payment_instrument_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/GiftCardActivityAdjustDecrement.ts b/src/serialization/types/GiftCardActivityAdjustDecrement.ts new file mode 100644 index 000000000..2f77e39a1 --- /dev/null +++ b/src/serialization/types/GiftCardActivityAdjustDecrement.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { GiftCardActivityAdjustDecrementReason } from "./GiftCardActivityAdjustDecrementReason"; + +export const GiftCardActivityAdjustDecrement: core.serialization.ObjectSchema< + serializers.GiftCardActivityAdjustDecrement.Raw, + Square.GiftCardActivityAdjustDecrement +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money), + reason: GiftCardActivityAdjustDecrementReason, +}); + +export declare namespace GiftCardActivityAdjustDecrement { + export interface Raw { + amount_money: Money.Raw; + reason: GiftCardActivityAdjustDecrementReason.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityAdjustDecrementReason.ts b/src/serialization/types/GiftCardActivityAdjustDecrementReason.ts new file mode 100644 index 000000000..9d2d0fbd3 --- /dev/null +++ b/src/serialization/types/GiftCardActivityAdjustDecrementReason.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardActivityAdjustDecrementReason: core.serialization.Schema< + serializers.GiftCardActivityAdjustDecrementReason.Raw, + Square.GiftCardActivityAdjustDecrementReason +> = core.serialization.enum_([ + "SUSPICIOUS_ACTIVITY", + "BALANCE_ACCIDENTALLY_INCREASED", + "SUPPORT_ISSUE", + "PURCHASE_WAS_REFUNDED", +]); + +export declare namespace GiftCardActivityAdjustDecrementReason { + export type Raw = + | "SUSPICIOUS_ACTIVITY" + | "BALANCE_ACCIDENTALLY_INCREASED" + | "SUPPORT_ISSUE" + | "PURCHASE_WAS_REFUNDED"; +} diff --git a/src/serialization/types/GiftCardActivityAdjustIncrement.ts b/src/serialization/types/GiftCardActivityAdjustIncrement.ts new file mode 100644 index 000000000..49f48b1e2 --- /dev/null +++ b/src/serialization/types/GiftCardActivityAdjustIncrement.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { GiftCardActivityAdjustIncrementReason } from "./GiftCardActivityAdjustIncrementReason"; + +export const GiftCardActivityAdjustIncrement: core.serialization.ObjectSchema< + serializers.GiftCardActivityAdjustIncrement.Raw, + Square.GiftCardActivityAdjustIncrement +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money), + reason: GiftCardActivityAdjustIncrementReason, +}); + +export declare namespace GiftCardActivityAdjustIncrement { + export interface Raw { + amount_money: Money.Raw; + reason: GiftCardActivityAdjustIncrementReason.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityAdjustIncrementReason.ts b/src/serialization/types/GiftCardActivityAdjustIncrementReason.ts new file mode 100644 index 000000000..cadc8cc9a --- /dev/null +++ b/src/serialization/types/GiftCardActivityAdjustIncrementReason.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardActivityAdjustIncrementReason: core.serialization.Schema< + serializers.GiftCardActivityAdjustIncrementReason.Raw, + Square.GiftCardActivityAdjustIncrementReason +> = core.serialization.enum_(["COMPLIMENTARY", "SUPPORT_ISSUE", "TRANSACTION_VOIDED"]); + +export declare namespace GiftCardActivityAdjustIncrementReason { + export type Raw = "COMPLIMENTARY" | "SUPPORT_ISSUE" | "TRANSACTION_VOIDED"; +} diff --git a/src/serialization/types/GiftCardActivityBlock.ts b/src/serialization/types/GiftCardActivityBlock.ts new file mode 100644 index 000000000..e1d40a989 --- /dev/null +++ b/src/serialization/types/GiftCardActivityBlock.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GiftCardActivityBlockReason } from "./GiftCardActivityBlockReason"; + +export const GiftCardActivityBlock: core.serialization.ObjectSchema< + serializers.GiftCardActivityBlock.Raw, + Square.GiftCardActivityBlock +> = core.serialization.object({ + reason: GiftCardActivityBlockReason, +}); + +export declare namespace GiftCardActivityBlock { + export interface Raw { + reason: GiftCardActivityBlockReason.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityBlockReason.ts b/src/serialization/types/GiftCardActivityBlockReason.ts new file mode 100644 index 000000000..d24d63096 --- /dev/null +++ b/src/serialization/types/GiftCardActivityBlockReason.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardActivityBlockReason: core.serialization.Schema< + serializers.GiftCardActivityBlockReason.Raw, + Square.GiftCardActivityBlockReason +> = core.serialization.stringLiteral("CHARGEBACK_BLOCK"); + +export declare namespace GiftCardActivityBlockReason { + export type Raw = "CHARGEBACK_BLOCK"; +} diff --git a/src/serialization/types/GiftCardActivityClearBalance.ts b/src/serialization/types/GiftCardActivityClearBalance.ts new file mode 100644 index 000000000..14f5d1d26 --- /dev/null +++ b/src/serialization/types/GiftCardActivityClearBalance.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GiftCardActivityClearBalanceReason } from "./GiftCardActivityClearBalanceReason"; + +export const GiftCardActivityClearBalance: core.serialization.ObjectSchema< + serializers.GiftCardActivityClearBalance.Raw, + Square.GiftCardActivityClearBalance +> = core.serialization.object({ + reason: GiftCardActivityClearBalanceReason, +}); + +export declare namespace GiftCardActivityClearBalance { + export interface Raw { + reason: GiftCardActivityClearBalanceReason.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityClearBalanceReason.ts b/src/serialization/types/GiftCardActivityClearBalanceReason.ts new file mode 100644 index 000000000..5fe86e635 --- /dev/null +++ b/src/serialization/types/GiftCardActivityClearBalanceReason.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardActivityClearBalanceReason: core.serialization.Schema< + serializers.GiftCardActivityClearBalanceReason.Raw, + Square.GiftCardActivityClearBalanceReason +> = core.serialization.enum_(["SUSPICIOUS_ACTIVITY", "REUSE_GIFTCARD", "UNKNOWN_REASON"]); + +export declare namespace GiftCardActivityClearBalanceReason { + export type Raw = "SUSPICIOUS_ACTIVITY" | "REUSE_GIFTCARD" | "UNKNOWN_REASON"; +} diff --git a/src/serialization/types/GiftCardActivityDeactivate.ts b/src/serialization/types/GiftCardActivityDeactivate.ts new file mode 100644 index 000000000..490a74c9e --- /dev/null +++ b/src/serialization/types/GiftCardActivityDeactivate.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GiftCardActivityDeactivateReason } from "./GiftCardActivityDeactivateReason"; + +export const GiftCardActivityDeactivate: core.serialization.ObjectSchema< + serializers.GiftCardActivityDeactivate.Raw, + Square.GiftCardActivityDeactivate +> = core.serialization.object({ + reason: GiftCardActivityDeactivateReason, +}); + +export declare namespace GiftCardActivityDeactivate { + export interface Raw { + reason: GiftCardActivityDeactivateReason.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityDeactivateReason.ts b/src/serialization/types/GiftCardActivityDeactivateReason.ts new file mode 100644 index 000000000..47ecedbf1 --- /dev/null +++ b/src/serialization/types/GiftCardActivityDeactivateReason.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardActivityDeactivateReason: core.serialization.Schema< + serializers.GiftCardActivityDeactivateReason.Raw, + Square.GiftCardActivityDeactivateReason +> = core.serialization.enum_(["SUSPICIOUS_ACTIVITY", "UNKNOWN_REASON", "CHARGEBACK_DEACTIVATE"]); + +export declare namespace GiftCardActivityDeactivateReason { + export type Raw = "SUSPICIOUS_ACTIVITY" | "UNKNOWN_REASON" | "CHARGEBACK_DEACTIVATE"; +} diff --git a/src/serialization/types/GiftCardActivityImport.ts b/src/serialization/types/GiftCardActivityImport.ts new file mode 100644 index 000000000..3a84bf94b --- /dev/null +++ b/src/serialization/types/GiftCardActivityImport.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const GiftCardActivityImport: core.serialization.ObjectSchema< + serializers.GiftCardActivityImport.Raw, + Square.GiftCardActivityImport +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money), +}); + +export declare namespace GiftCardActivityImport { + export interface Raw { + amount_money: Money.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityImportReversal.ts b/src/serialization/types/GiftCardActivityImportReversal.ts new file mode 100644 index 000000000..f7627916d --- /dev/null +++ b/src/serialization/types/GiftCardActivityImportReversal.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const GiftCardActivityImportReversal: core.serialization.ObjectSchema< + serializers.GiftCardActivityImportReversal.Raw, + Square.GiftCardActivityImportReversal +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money), +}); + +export declare namespace GiftCardActivityImportReversal { + export interface Raw { + amount_money: Money.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityLoad.ts b/src/serialization/types/GiftCardActivityLoad.ts new file mode 100644 index 000000000..610635f63 --- /dev/null +++ b/src/serialization/types/GiftCardActivityLoad.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const GiftCardActivityLoad: core.serialization.ObjectSchema< + serializers.GiftCardActivityLoad.Raw, + Square.GiftCardActivityLoad +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money.optional()), + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + lineItemUid: core.serialization.property("line_item_uid", core.serialization.string().optionalNullable()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + buyerPaymentInstrumentIds: core.serialization.property( + "buyer_payment_instrument_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace GiftCardActivityLoad { + export interface Raw { + amount_money?: Money.Raw | null; + order_id?: (string | null) | null; + line_item_uid?: (string | null) | null; + reference_id?: (string | null) | null; + buyer_payment_instrument_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/GiftCardActivityRedeem.ts b/src/serialization/types/GiftCardActivityRedeem.ts new file mode 100644 index 000000000..0e43c3bc3 --- /dev/null +++ b/src/serialization/types/GiftCardActivityRedeem.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { GiftCardActivityRedeemStatus } from "./GiftCardActivityRedeemStatus"; + +export const GiftCardActivityRedeem: core.serialization.ObjectSchema< + serializers.GiftCardActivityRedeem.Raw, + Square.GiftCardActivityRedeem +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money), + paymentId: core.serialization.property("payment_id", core.serialization.string().optional()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + status: GiftCardActivityRedeemStatus.optional(), +}); + +export declare namespace GiftCardActivityRedeem { + export interface Raw { + amount_money: Money.Raw; + payment_id?: string | null; + reference_id?: (string | null) | null; + status?: GiftCardActivityRedeemStatus.Raw | null; + } +} diff --git a/src/serialization/types/GiftCardActivityRedeemStatus.ts b/src/serialization/types/GiftCardActivityRedeemStatus.ts new file mode 100644 index 000000000..ea0717145 --- /dev/null +++ b/src/serialization/types/GiftCardActivityRedeemStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardActivityRedeemStatus: core.serialization.Schema< + serializers.GiftCardActivityRedeemStatus.Raw, + Square.GiftCardActivityRedeemStatus +> = core.serialization.enum_(["PENDING", "COMPLETED", "CANCELED"]); + +export declare namespace GiftCardActivityRedeemStatus { + export type Raw = "PENDING" | "COMPLETED" | "CANCELED"; +} diff --git a/src/serialization/types/GiftCardActivityRefund.ts b/src/serialization/types/GiftCardActivityRefund.ts new file mode 100644 index 000000000..b2983e9be --- /dev/null +++ b/src/serialization/types/GiftCardActivityRefund.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const GiftCardActivityRefund: core.serialization.ObjectSchema< + serializers.GiftCardActivityRefund.Raw, + Square.GiftCardActivityRefund +> = core.serialization.object({ + redeemActivityId: core.serialization.property("redeem_activity_id", core.serialization.string().optionalNullable()), + amountMoney: core.serialization.property("amount_money", Money.optional()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + paymentId: core.serialization.property("payment_id", core.serialization.string().optional()), +}); + +export declare namespace GiftCardActivityRefund { + export interface Raw { + redeem_activity_id?: (string | null) | null; + amount_money?: Money.Raw | null; + reference_id?: (string | null) | null; + payment_id?: string | null; + } +} diff --git a/src/serialization/types/GiftCardActivityTransferBalanceFrom.ts b/src/serialization/types/GiftCardActivityTransferBalanceFrom.ts new file mode 100644 index 000000000..852fb7857 --- /dev/null +++ b/src/serialization/types/GiftCardActivityTransferBalanceFrom.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const GiftCardActivityTransferBalanceFrom: core.serialization.ObjectSchema< + serializers.GiftCardActivityTransferBalanceFrom.Raw, + Square.GiftCardActivityTransferBalanceFrom +> = core.serialization.object({ + transferToGiftCardId: core.serialization.property("transfer_to_gift_card_id", core.serialization.string()), + amountMoney: core.serialization.property("amount_money", Money), +}); + +export declare namespace GiftCardActivityTransferBalanceFrom { + export interface Raw { + transfer_to_gift_card_id: string; + amount_money: Money.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityTransferBalanceTo.ts b/src/serialization/types/GiftCardActivityTransferBalanceTo.ts new file mode 100644 index 000000000..147277398 --- /dev/null +++ b/src/serialization/types/GiftCardActivityTransferBalanceTo.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const GiftCardActivityTransferBalanceTo: core.serialization.ObjectSchema< + serializers.GiftCardActivityTransferBalanceTo.Raw, + Square.GiftCardActivityTransferBalanceTo +> = core.serialization.object({ + transferFromGiftCardId: core.serialization.property("transfer_from_gift_card_id", core.serialization.string()), + amountMoney: core.serialization.property("amount_money", Money), +}); + +export declare namespace GiftCardActivityTransferBalanceTo { + export interface Raw { + transfer_from_gift_card_id: string; + amount_money: Money.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityType.ts b/src/serialization/types/GiftCardActivityType.ts new file mode 100644 index 000000000..2c628dac9 --- /dev/null +++ b/src/serialization/types/GiftCardActivityType.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardActivityType: core.serialization.Schema< + serializers.GiftCardActivityType.Raw, + Square.GiftCardActivityType +> = core.serialization.enum_([ + "ACTIVATE", + "LOAD", + "REDEEM", + "CLEAR_BALANCE", + "DEACTIVATE", + "ADJUST_INCREMENT", + "ADJUST_DECREMENT", + "REFUND", + "UNLINKED_ACTIVITY_REFUND", + "IMPORT", + "BLOCK", + "UNBLOCK", + "IMPORT_REVERSAL", + "TRANSFER_BALANCE_FROM", + "TRANSFER_BALANCE_TO", +]); + +export declare namespace GiftCardActivityType { + export type Raw = + | "ACTIVATE" + | "LOAD" + | "REDEEM" + | "CLEAR_BALANCE" + | "DEACTIVATE" + | "ADJUST_INCREMENT" + | "ADJUST_DECREMENT" + | "REFUND" + | "UNLINKED_ACTIVITY_REFUND" + | "IMPORT" + | "BLOCK" + | "UNBLOCK" + | "IMPORT_REVERSAL" + | "TRANSFER_BALANCE_FROM" + | "TRANSFER_BALANCE_TO"; +} diff --git a/src/serialization/types/GiftCardActivityUnblock.ts b/src/serialization/types/GiftCardActivityUnblock.ts new file mode 100644 index 000000000..6cf9f515b --- /dev/null +++ b/src/serialization/types/GiftCardActivityUnblock.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { GiftCardActivityUnblockReason } from "./GiftCardActivityUnblockReason"; + +export const GiftCardActivityUnblock: core.serialization.ObjectSchema< + serializers.GiftCardActivityUnblock.Raw, + Square.GiftCardActivityUnblock +> = core.serialization.object({ + reason: GiftCardActivityUnblockReason, +}); + +export declare namespace GiftCardActivityUnblock { + export interface Raw { + reason: GiftCardActivityUnblockReason.Raw; + } +} diff --git a/src/serialization/types/GiftCardActivityUnblockReason.ts b/src/serialization/types/GiftCardActivityUnblockReason.ts new file mode 100644 index 000000000..1ffb7a9bb --- /dev/null +++ b/src/serialization/types/GiftCardActivityUnblockReason.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardActivityUnblockReason: core.serialization.Schema< + serializers.GiftCardActivityUnblockReason.Raw, + Square.GiftCardActivityUnblockReason +> = core.serialization.stringLiteral("CHARGEBACK_UNBLOCK"); + +export declare namespace GiftCardActivityUnblockReason { + export type Raw = "CHARGEBACK_UNBLOCK"; +} diff --git a/src/serialization/types/GiftCardActivityUnlinkedActivityRefund.ts b/src/serialization/types/GiftCardActivityUnlinkedActivityRefund.ts new file mode 100644 index 000000000..5e5cd0347 --- /dev/null +++ b/src/serialization/types/GiftCardActivityUnlinkedActivityRefund.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const GiftCardActivityUnlinkedActivityRefund: core.serialization.ObjectSchema< + serializers.GiftCardActivityUnlinkedActivityRefund.Raw, + Square.GiftCardActivityUnlinkedActivityRefund +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + paymentId: core.serialization.property("payment_id", core.serialization.string().optional()), +}); + +export declare namespace GiftCardActivityUnlinkedActivityRefund { + export interface Raw { + amount_money: Money.Raw; + reference_id?: (string | null) | null; + payment_id?: string | null; + } +} diff --git a/src/serialization/types/GiftCardGanSource.ts b/src/serialization/types/GiftCardGanSource.ts new file mode 100644 index 000000000..759e10061 --- /dev/null +++ b/src/serialization/types/GiftCardGanSource.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardGanSource: core.serialization.Schema = + core.serialization.enum_(["SQUARE", "OTHER"]); + +export declare namespace GiftCardGanSource { + export type Raw = "SQUARE" | "OTHER"; +} diff --git a/src/serialization/types/GiftCardStatus.ts b/src/serialization/types/GiftCardStatus.ts new file mode 100644 index 000000000..eeb183e8f --- /dev/null +++ b/src/serialization/types/GiftCardStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardStatus: core.serialization.Schema = + core.serialization.enum_(["ACTIVE", "DEACTIVATED", "BLOCKED", "PENDING"]); + +export declare namespace GiftCardStatus { + export type Raw = "ACTIVE" | "DEACTIVATED" | "BLOCKED" | "PENDING"; +} diff --git a/src/serialization/types/GiftCardType.ts b/src/serialization/types/GiftCardType.ts new file mode 100644 index 000000000..42a52afa9 --- /dev/null +++ b/src/serialization/types/GiftCardType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const GiftCardType: core.serialization.Schema = + core.serialization.enum_(["PHYSICAL", "DIGITAL"]); + +export declare namespace GiftCardType { + export type Raw = "PHYSICAL" | "DIGITAL"; +} diff --git a/src/serialization/types/InventoryAdjustment.ts b/src/serialization/types/InventoryAdjustment.ts new file mode 100644 index 000000000..c0f813c6f --- /dev/null +++ b/src/serialization/types/InventoryAdjustment.ts @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryState } from "./InventoryState"; +import { Money } from "./Money"; +import { SourceApplication } from "./SourceApplication"; +import { InventoryAdjustmentGroup } from "./InventoryAdjustmentGroup"; + +export const InventoryAdjustment: core.serialization.ObjectSchema< + serializers.InventoryAdjustment.Raw, + Square.InventoryAdjustment +> = core.serialization.object({ + id: core.serialization.string().optional(), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + fromState: core.serialization.property("from_state", InventoryState.optional()), + toState: core.serialization.property("to_state", InventoryState.optional()), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogObjectType: core.serialization.property( + "catalog_object_type", + core.serialization.string().optionalNullable(), + ), + quantity: core.serialization.string().optionalNullable(), + totalPriceMoney: core.serialization.property("total_price_money", Money.optional()), + occurredAt: core.serialization.property("occurred_at", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + source: SourceApplication.optional(), + employeeId: core.serialization.property("employee_id", core.serialization.string().optionalNullable()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), + transactionId: core.serialization.property("transaction_id", core.serialization.string().optional()), + refundId: core.serialization.property("refund_id", core.serialization.string().optional()), + purchaseOrderId: core.serialization.property("purchase_order_id", core.serialization.string().optional()), + goodsReceiptId: core.serialization.property("goods_receipt_id", core.serialization.string().optional()), + adjustmentGroup: core.serialization.property("adjustment_group", InventoryAdjustmentGroup.optional()), +}); + +export declare namespace InventoryAdjustment { + export interface Raw { + id?: string | null; + reference_id?: (string | null) | null; + from_state?: InventoryState.Raw | null; + to_state?: InventoryState.Raw | null; + location_id?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_object_type?: (string | null) | null; + quantity?: (string | null) | null; + total_price_money?: Money.Raw | null; + occurred_at?: (string | null) | null; + created_at?: string | null; + source?: SourceApplication.Raw | null; + employee_id?: (string | null) | null; + team_member_id?: (string | null) | null; + transaction_id?: string | null; + refund_id?: string | null; + purchase_order_id?: string | null; + goods_receipt_id?: string | null; + adjustment_group?: InventoryAdjustmentGroup.Raw | null; + } +} diff --git a/src/serialization/types/InventoryAdjustmentGroup.ts b/src/serialization/types/InventoryAdjustmentGroup.ts new file mode 100644 index 000000000..d32aa7ef2 --- /dev/null +++ b/src/serialization/types/InventoryAdjustmentGroup.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryState } from "./InventoryState"; + +export const InventoryAdjustmentGroup: core.serialization.ObjectSchema< + serializers.InventoryAdjustmentGroup.Raw, + Square.InventoryAdjustmentGroup +> = core.serialization.object({ + id: core.serialization.string().optional(), + rootAdjustmentId: core.serialization.property("root_adjustment_id", core.serialization.string().optional()), + fromState: core.serialization.property("from_state", InventoryState.optional()), + toState: core.serialization.property("to_state", InventoryState.optional()), +}); + +export declare namespace InventoryAdjustmentGroup { + export interface Raw { + id?: string | null; + root_adjustment_id?: string | null; + from_state?: InventoryState.Raw | null; + to_state?: InventoryState.Raw | null; + } +} diff --git a/src/serialization/types/InventoryAlertType.ts b/src/serialization/types/InventoryAlertType.ts new file mode 100644 index 000000000..d89842f58 --- /dev/null +++ b/src/serialization/types/InventoryAlertType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InventoryAlertType: core.serialization.Schema< + serializers.InventoryAlertType.Raw, + Square.InventoryAlertType +> = core.serialization.enum_(["NONE", "LOW_QUANTITY"]); + +export declare namespace InventoryAlertType { + export type Raw = "NONE" | "LOW_QUANTITY"; +} diff --git a/src/serialization/types/InventoryChange.ts b/src/serialization/types/InventoryChange.ts new file mode 100644 index 000000000..ef50a81b7 --- /dev/null +++ b/src/serialization/types/InventoryChange.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryChangeType } from "./InventoryChangeType"; +import { InventoryPhysicalCount } from "./InventoryPhysicalCount"; +import { InventoryAdjustment } from "./InventoryAdjustment"; +import { InventoryTransfer } from "./InventoryTransfer"; +import { CatalogMeasurementUnit } from "./CatalogMeasurementUnit"; + +export const InventoryChange: core.serialization.ObjectSchema = + core.serialization.object({ + type: InventoryChangeType.optional(), + physicalCount: core.serialization.property("physical_count", InventoryPhysicalCount.optional()), + adjustment: InventoryAdjustment.optional(), + transfer: InventoryTransfer.optional(), + measurementUnit: core.serialization.property("measurement_unit", CatalogMeasurementUnit.optional()), + measurementUnitId: core.serialization.property("measurement_unit_id", core.serialization.string().optional()), + }); + +export declare namespace InventoryChange { + export interface Raw { + type?: InventoryChangeType.Raw | null; + physical_count?: InventoryPhysicalCount.Raw | null; + adjustment?: InventoryAdjustment.Raw | null; + transfer?: InventoryTransfer.Raw | null; + measurement_unit?: CatalogMeasurementUnit.Raw | null; + measurement_unit_id?: string | null; + } +} diff --git a/src/serialization/types/InventoryChangeType.ts b/src/serialization/types/InventoryChangeType.ts new file mode 100644 index 000000000..6598bec3a --- /dev/null +++ b/src/serialization/types/InventoryChangeType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InventoryChangeType: core.serialization.Schema< + serializers.InventoryChangeType.Raw, + Square.InventoryChangeType +> = core.serialization.enum_(["PHYSICAL_COUNT", "ADJUSTMENT", "TRANSFER"]); + +export declare namespace InventoryChangeType { + export type Raw = "PHYSICAL_COUNT" | "ADJUSTMENT" | "TRANSFER"; +} diff --git a/src/serialization/types/InventoryCount.ts b/src/serialization/types/InventoryCount.ts new file mode 100644 index 000000000..5bc02050e --- /dev/null +++ b/src/serialization/types/InventoryCount.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryState } from "./InventoryState"; + +export const InventoryCount: core.serialization.ObjectSchema = + core.serialization.object({ + catalogObjectId: core.serialization.property( + "catalog_object_id", + core.serialization.string().optionalNullable(), + ), + catalogObjectType: core.serialization.property( + "catalog_object_type", + core.serialization.string().optionalNullable(), + ), + state: InventoryState.optional(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + quantity: core.serialization.string().optionalNullable(), + calculatedAt: core.serialization.property("calculated_at", core.serialization.string().optional()), + isEstimated: core.serialization.property("is_estimated", core.serialization.boolean().optional()), + }); + +export declare namespace InventoryCount { + export interface Raw { + catalog_object_id?: (string | null) | null; + catalog_object_type?: (string | null) | null; + state?: InventoryState.Raw | null; + location_id?: (string | null) | null; + quantity?: (string | null) | null; + calculated_at?: string | null; + is_estimated?: boolean | null; + } +} diff --git a/src/serialization/types/InventoryPhysicalCount.ts b/src/serialization/types/InventoryPhysicalCount.ts new file mode 100644 index 000000000..113358026 --- /dev/null +++ b/src/serialization/types/InventoryPhysicalCount.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryState } from "./InventoryState"; +import { SourceApplication } from "./SourceApplication"; + +export const InventoryPhysicalCount: core.serialization.ObjectSchema< + serializers.InventoryPhysicalCount.Raw, + Square.InventoryPhysicalCount +> = core.serialization.object({ + id: core.serialization.string().optional(), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogObjectType: core.serialization.property( + "catalog_object_type", + core.serialization.string().optionalNullable(), + ), + state: InventoryState.optional(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + quantity: core.serialization.string().optionalNullable(), + source: SourceApplication.optional(), + employeeId: core.serialization.property("employee_id", core.serialization.string().optionalNullable()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), + occurredAt: core.serialization.property("occurred_at", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), +}); + +export declare namespace InventoryPhysicalCount { + export interface Raw { + id?: string | null; + reference_id?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_object_type?: (string | null) | null; + state?: InventoryState.Raw | null; + location_id?: (string | null) | null; + quantity?: (string | null) | null; + source?: SourceApplication.Raw | null; + employee_id?: (string | null) | null; + team_member_id?: (string | null) | null; + occurred_at?: (string | null) | null; + created_at?: string | null; + } +} diff --git a/src/serialization/types/InventoryState.ts b/src/serialization/types/InventoryState.ts new file mode 100644 index 000000000..9772f0399 --- /dev/null +++ b/src/serialization/types/InventoryState.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InventoryState: core.serialization.Schema = + core.serialization.enum_([ + "CUSTOM", + "IN_STOCK", + "SOLD", + "RETURNED_BY_CUSTOMER", + "RESERVED_FOR_SALE", + "SOLD_ONLINE", + "ORDERED_FROM_VENDOR", + "RECEIVED_FROM_VENDOR", + "IN_TRANSIT_TO", + "NONE", + "WASTE", + "UNLINKED_RETURN", + "COMPOSED", + "DECOMPOSED", + "SUPPORTED_BY_NEWER_VERSION", + "IN_TRANSIT", + ]); + +export declare namespace InventoryState { + export type Raw = + | "CUSTOM" + | "IN_STOCK" + | "SOLD" + | "RETURNED_BY_CUSTOMER" + | "RESERVED_FOR_SALE" + | "SOLD_ONLINE" + | "ORDERED_FROM_VENDOR" + | "RECEIVED_FROM_VENDOR" + | "IN_TRANSIT_TO" + | "NONE" + | "WASTE" + | "UNLINKED_RETURN" + | "COMPOSED" + | "DECOMPOSED" + | "SUPPORTED_BY_NEWER_VERSION" + | "IN_TRANSIT"; +} diff --git a/src/serialization/types/InventoryTransfer.ts b/src/serialization/types/InventoryTransfer.ts new file mode 100644 index 000000000..27a01f6ad --- /dev/null +++ b/src/serialization/types/InventoryTransfer.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InventoryState } from "./InventoryState"; +import { SourceApplication } from "./SourceApplication"; + +export const InventoryTransfer: core.serialization.ObjectSchema< + serializers.InventoryTransfer.Raw, + Square.InventoryTransfer +> = core.serialization.object({ + id: core.serialization.string().optional(), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + state: InventoryState.optional(), + fromLocationId: core.serialization.property("from_location_id", core.serialization.string().optionalNullable()), + toLocationId: core.serialization.property("to_location_id", core.serialization.string().optionalNullable()), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogObjectType: core.serialization.property( + "catalog_object_type", + core.serialization.string().optionalNullable(), + ), + quantity: core.serialization.string().optionalNullable(), + occurredAt: core.serialization.property("occurred_at", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + source: SourceApplication.optional(), + employeeId: core.serialization.property("employee_id", core.serialization.string().optionalNullable()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace InventoryTransfer { + export interface Raw { + id?: string | null; + reference_id?: (string | null) | null; + state?: InventoryState.Raw | null; + from_location_id?: (string | null) | null; + to_location_id?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_object_type?: (string | null) | null; + quantity?: (string | null) | null; + occurred_at?: (string | null) | null; + created_at?: string | null; + source?: SourceApplication.Raw | null; + employee_id?: (string | null) | null; + team_member_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/Invoice.ts b/src/serialization/types/Invoice.ts new file mode 100644 index 000000000..330465995 --- /dev/null +++ b/src/serialization/types/Invoice.ts @@ -0,0 +1,90 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InvoiceRecipient } from "./InvoiceRecipient"; +import { InvoicePaymentRequest } from "./InvoicePaymentRequest"; +import { InvoiceDeliveryMethod } from "./InvoiceDeliveryMethod"; +import { Money } from "./Money"; +import { InvoiceStatus } from "./InvoiceStatus"; +import { InvoiceAcceptedPaymentMethods } from "./InvoiceAcceptedPaymentMethods"; +import { InvoiceCustomField } from "./InvoiceCustomField"; +import { InvoiceAttachment } from "./InvoiceAttachment"; + +export const Invoice: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + version: core.serialization.number().optional(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + primaryRecipient: core.serialization.property("primary_recipient", InvoiceRecipient.optional()), + paymentRequests: core.serialization.property( + "payment_requests", + core.serialization.list(InvoicePaymentRequest).optionalNullable(), + ), + deliveryMethod: core.serialization.property("delivery_method", InvoiceDeliveryMethod.optional()), + invoiceNumber: core.serialization.property("invoice_number", core.serialization.string().optionalNullable()), + title: core.serialization.string().optionalNullable(), + description: core.serialization.string().optionalNullable(), + scheduledAt: core.serialization.property("scheduled_at", core.serialization.string().optionalNullable()), + publicUrl: core.serialization.property("public_url", core.serialization.string().optional()), + nextPaymentAmountMoney: core.serialization.property("next_payment_amount_money", Money.optional()), + status: InvoiceStatus.optional(), + timezone: core.serialization.string().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + acceptedPaymentMethods: core.serialization.property( + "accepted_payment_methods", + InvoiceAcceptedPaymentMethods.optional(), + ), + customFields: core.serialization.property( + "custom_fields", + core.serialization.list(InvoiceCustomField).optionalNullable(), + ), + subscriptionId: core.serialization.property("subscription_id", core.serialization.string().optional()), + saleOrServiceDate: core.serialization.property( + "sale_or_service_date", + core.serialization.string().optionalNullable(), + ), + paymentConditions: core.serialization.property( + "payment_conditions", + core.serialization.string().optionalNullable(), + ), + storePaymentMethodEnabled: core.serialization.property( + "store_payment_method_enabled", + core.serialization.boolean().optionalNullable(), + ), + attachments: core.serialization.list(InvoiceAttachment).optional(), + }); + +export declare namespace Invoice { + export interface Raw { + id?: string | null; + version?: number | null; + location_id?: (string | null) | null; + order_id?: (string | null) | null; + primary_recipient?: InvoiceRecipient.Raw | null; + payment_requests?: (InvoicePaymentRequest.Raw[] | null) | null; + delivery_method?: InvoiceDeliveryMethod.Raw | null; + invoice_number?: (string | null) | null; + title?: (string | null) | null; + description?: (string | null) | null; + scheduled_at?: (string | null) | null; + public_url?: string | null; + next_payment_amount_money?: Money.Raw | null; + status?: InvoiceStatus.Raw | null; + timezone?: string | null; + created_at?: string | null; + updated_at?: string | null; + accepted_payment_methods?: InvoiceAcceptedPaymentMethods.Raw | null; + custom_fields?: (InvoiceCustomField.Raw[] | null) | null; + subscription_id?: string | null; + sale_or_service_date?: (string | null) | null; + payment_conditions?: (string | null) | null; + store_payment_method_enabled?: (boolean | null) | null; + attachments?: InvoiceAttachment.Raw[] | null; + } +} diff --git a/src/serialization/types/InvoiceAcceptedPaymentMethods.ts b/src/serialization/types/InvoiceAcceptedPaymentMethods.ts new file mode 100644 index 000000000..17a0fc90e --- /dev/null +++ b/src/serialization/types/InvoiceAcceptedPaymentMethods.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceAcceptedPaymentMethods: core.serialization.ObjectSchema< + serializers.InvoiceAcceptedPaymentMethods.Raw, + Square.InvoiceAcceptedPaymentMethods +> = core.serialization.object({ + card: core.serialization.boolean().optionalNullable(), + squareGiftCard: core.serialization.property("square_gift_card", core.serialization.boolean().optionalNullable()), + bankAccount: core.serialization.property("bank_account", core.serialization.boolean().optionalNullable()), + buyNowPayLater: core.serialization.property("buy_now_pay_later", core.serialization.boolean().optionalNullable()), + cashAppPay: core.serialization.property("cash_app_pay", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace InvoiceAcceptedPaymentMethods { + export interface Raw { + card?: (boolean | null) | null; + square_gift_card?: (boolean | null) | null; + bank_account?: (boolean | null) | null; + buy_now_pay_later?: (boolean | null) | null; + cash_app_pay?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/InvoiceAttachment.ts b/src/serialization/types/InvoiceAttachment.ts new file mode 100644 index 000000000..8479a3ba1 --- /dev/null +++ b/src/serialization/types/InvoiceAttachment.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceAttachment: core.serialization.ObjectSchema< + serializers.InvoiceAttachment.Raw, + Square.InvoiceAttachment +> = core.serialization.object({ + id: core.serialization.string().optional(), + filename: core.serialization.string().optional(), + description: core.serialization.string().optional(), + filesize: core.serialization.number().optional(), + hash: core.serialization.string().optional(), + mimeType: core.serialization.property("mime_type", core.serialization.string().optional()), + uploadedAt: core.serialization.property("uploaded_at", core.serialization.string().optional()), +}); + +export declare namespace InvoiceAttachment { + export interface Raw { + id?: string | null; + filename?: string | null; + description?: string | null; + filesize?: number | null; + hash?: string | null; + mime_type?: string | null; + uploaded_at?: string | null; + } +} diff --git a/src/serialization/types/InvoiceAutomaticPaymentSource.ts b/src/serialization/types/InvoiceAutomaticPaymentSource.ts new file mode 100644 index 000000000..f40f3b0cb --- /dev/null +++ b/src/serialization/types/InvoiceAutomaticPaymentSource.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceAutomaticPaymentSource: core.serialization.Schema< + serializers.InvoiceAutomaticPaymentSource.Raw, + Square.InvoiceAutomaticPaymentSource +> = core.serialization.enum_(["NONE", "CARD_ON_FILE", "BANK_ON_FILE"]); + +export declare namespace InvoiceAutomaticPaymentSource { + export type Raw = "NONE" | "CARD_ON_FILE" | "BANK_ON_FILE"; +} diff --git a/src/serialization/types/InvoiceCustomField.ts b/src/serialization/types/InvoiceCustomField.ts new file mode 100644 index 000000000..b68fb4a50 --- /dev/null +++ b/src/serialization/types/InvoiceCustomField.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InvoiceCustomFieldPlacement } from "./InvoiceCustomFieldPlacement"; + +export const InvoiceCustomField: core.serialization.ObjectSchema< + serializers.InvoiceCustomField.Raw, + Square.InvoiceCustomField +> = core.serialization.object({ + label: core.serialization.string().optionalNullable(), + value: core.serialization.string().optionalNullable(), + placement: InvoiceCustomFieldPlacement.optional(), +}); + +export declare namespace InvoiceCustomField { + export interface Raw { + label?: (string | null) | null; + value?: (string | null) | null; + placement?: InvoiceCustomFieldPlacement.Raw | null; + } +} diff --git a/src/serialization/types/InvoiceCustomFieldPlacement.ts b/src/serialization/types/InvoiceCustomFieldPlacement.ts new file mode 100644 index 000000000..65e63c445 --- /dev/null +++ b/src/serialization/types/InvoiceCustomFieldPlacement.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceCustomFieldPlacement: core.serialization.Schema< + serializers.InvoiceCustomFieldPlacement.Raw, + Square.InvoiceCustomFieldPlacement +> = core.serialization.enum_(["ABOVE_LINE_ITEMS", "BELOW_LINE_ITEMS"]); + +export declare namespace InvoiceCustomFieldPlacement { + export type Raw = "ABOVE_LINE_ITEMS" | "BELOW_LINE_ITEMS"; +} diff --git a/src/serialization/types/InvoiceDeliveryMethod.ts b/src/serialization/types/InvoiceDeliveryMethod.ts new file mode 100644 index 000000000..42ecaeb2d --- /dev/null +++ b/src/serialization/types/InvoiceDeliveryMethod.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceDeliveryMethod: core.serialization.Schema< + serializers.InvoiceDeliveryMethod.Raw, + Square.InvoiceDeliveryMethod +> = core.serialization.enum_(["EMAIL", "SHARE_MANUALLY", "SMS"]); + +export declare namespace InvoiceDeliveryMethod { + export type Raw = "EMAIL" | "SHARE_MANUALLY" | "SMS"; +} diff --git a/src/serialization/types/InvoiceFilter.ts b/src/serialization/types/InvoiceFilter.ts new file mode 100644 index 000000000..2660f6970 --- /dev/null +++ b/src/serialization/types/InvoiceFilter.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceFilter: core.serialization.ObjectSchema = + core.serialization.object({ + locationIds: core.serialization.property("location_ids", core.serialization.list(core.serialization.string())), + customerIds: core.serialization.property( + "customer_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + }); + +export declare namespace InvoiceFilter { + export interface Raw { + location_ids: string[]; + customer_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/InvoicePaymentReminder.ts b/src/serialization/types/InvoicePaymentReminder.ts new file mode 100644 index 000000000..bc717670e --- /dev/null +++ b/src/serialization/types/InvoicePaymentReminder.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InvoicePaymentReminderStatus } from "./InvoicePaymentReminderStatus"; + +export const InvoicePaymentReminder: core.serialization.ObjectSchema< + serializers.InvoicePaymentReminder.Raw, + Square.InvoicePaymentReminder +> = core.serialization.object({ + uid: core.serialization.string().optional(), + relativeScheduledDays: core.serialization.property( + "relative_scheduled_days", + core.serialization.number().optionalNullable(), + ), + message: core.serialization.string().optionalNullable(), + status: InvoicePaymentReminderStatus.optional(), + sentAt: core.serialization.property("sent_at", core.serialization.string().optional()), +}); + +export declare namespace InvoicePaymentReminder { + export interface Raw { + uid?: string | null; + relative_scheduled_days?: (number | null) | null; + message?: (string | null) | null; + status?: InvoicePaymentReminderStatus.Raw | null; + sent_at?: string | null; + } +} diff --git a/src/serialization/types/InvoicePaymentReminderStatus.ts b/src/serialization/types/InvoicePaymentReminderStatus.ts new file mode 100644 index 000000000..af696d158 --- /dev/null +++ b/src/serialization/types/InvoicePaymentReminderStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoicePaymentReminderStatus: core.serialization.Schema< + serializers.InvoicePaymentReminderStatus.Raw, + Square.InvoicePaymentReminderStatus +> = core.serialization.enum_(["PENDING", "NOT_APPLICABLE", "SENT"]); + +export declare namespace InvoicePaymentReminderStatus { + export type Raw = "PENDING" | "NOT_APPLICABLE" | "SENT"; +} diff --git a/src/serialization/types/InvoicePaymentRequest.ts b/src/serialization/types/InvoicePaymentRequest.ts new file mode 100644 index 000000000..cf3fa688f --- /dev/null +++ b/src/serialization/types/InvoicePaymentRequest.ts @@ -0,0 +1,58 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InvoiceRequestMethod } from "./InvoiceRequestMethod"; +import { InvoiceRequestType } from "./InvoiceRequestType"; +import { Money } from "./Money"; +import { InvoiceAutomaticPaymentSource } from "./InvoiceAutomaticPaymentSource"; +import { InvoicePaymentReminder } from "./InvoicePaymentReminder"; + +export const InvoicePaymentRequest: core.serialization.ObjectSchema< + serializers.InvoicePaymentRequest.Raw, + Square.InvoicePaymentRequest +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + requestMethod: core.serialization.property("request_method", InvoiceRequestMethod.optional()), + requestType: core.serialization.property("request_type", InvoiceRequestType.optional()), + dueDate: core.serialization.property("due_date", core.serialization.string().optionalNullable()), + fixedAmountRequestedMoney: core.serialization.property("fixed_amount_requested_money", Money.optional()), + percentageRequested: core.serialization.property( + "percentage_requested", + core.serialization.string().optionalNullable(), + ), + tippingEnabled: core.serialization.property("tipping_enabled", core.serialization.boolean().optionalNullable()), + automaticPaymentSource: core.serialization.property( + "automatic_payment_source", + InvoiceAutomaticPaymentSource.optional(), + ), + cardId: core.serialization.property("card_id", core.serialization.string().optionalNullable()), + reminders: core.serialization.list(InvoicePaymentReminder).optionalNullable(), + computedAmountMoney: core.serialization.property("computed_amount_money", Money.optional()), + totalCompletedAmountMoney: core.serialization.property("total_completed_amount_money", Money.optional()), + roundingAdjustmentIncludedMoney: core.serialization.property( + "rounding_adjustment_included_money", + Money.optional(), + ), +}); + +export declare namespace InvoicePaymentRequest { + export interface Raw { + uid?: (string | null) | null; + request_method?: InvoiceRequestMethod.Raw | null; + request_type?: InvoiceRequestType.Raw | null; + due_date?: (string | null) | null; + fixed_amount_requested_money?: Money.Raw | null; + percentage_requested?: (string | null) | null; + tipping_enabled?: (boolean | null) | null; + automatic_payment_source?: InvoiceAutomaticPaymentSource.Raw | null; + card_id?: (string | null) | null; + reminders?: (InvoicePaymentReminder.Raw[] | null) | null; + computed_amount_money?: Money.Raw | null; + total_completed_amount_money?: Money.Raw | null; + rounding_adjustment_included_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/InvoiceQuery.ts b/src/serialization/types/InvoiceQuery.ts new file mode 100644 index 000000000..9f15c7b8c --- /dev/null +++ b/src/serialization/types/InvoiceQuery.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InvoiceFilter } from "./InvoiceFilter"; +import { InvoiceSort } from "./InvoiceSort"; + +export const InvoiceQuery: core.serialization.ObjectSchema = + core.serialization.object({ + filter: InvoiceFilter, + sort: InvoiceSort.optional(), + }); + +export declare namespace InvoiceQuery { + export interface Raw { + filter: InvoiceFilter.Raw; + sort?: InvoiceSort.Raw | null; + } +} diff --git a/src/serialization/types/InvoiceRecipient.ts b/src/serialization/types/InvoiceRecipient.ts new file mode 100644 index 000000000..6062f89fb --- /dev/null +++ b/src/serialization/types/InvoiceRecipient.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; +import { InvoiceRecipientTaxIds } from "./InvoiceRecipientTaxIds"; + +export const InvoiceRecipient: core.serialization.ObjectSchema< + serializers.InvoiceRecipient.Raw, + Square.InvoiceRecipient +> = core.serialization.object({ + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + givenName: core.serialization.property("given_name", core.serialization.string().optional()), + familyName: core.serialization.property("family_name", core.serialization.string().optional()), + emailAddress: core.serialization.property("email_address", core.serialization.string().optional()), + address: Address.optional(), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optional()), + companyName: core.serialization.property("company_name", core.serialization.string().optional()), + taxIds: core.serialization.property("tax_ids", InvoiceRecipientTaxIds.optional()), +}); + +export declare namespace InvoiceRecipient { + export interface Raw { + customer_id?: (string | null) | null; + given_name?: string | null; + family_name?: string | null; + email_address?: string | null; + address?: Address.Raw | null; + phone_number?: string | null; + company_name?: string | null; + tax_ids?: InvoiceRecipientTaxIds.Raw | null; + } +} diff --git a/src/serialization/types/InvoiceRecipientTaxIds.ts b/src/serialization/types/InvoiceRecipientTaxIds.ts new file mode 100644 index 000000000..da795ddb1 --- /dev/null +++ b/src/serialization/types/InvoiceRecipientTaxIds.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceRecipientTaxIds: core.serialization.ObjectSchema< + serializers.InvoiceRecipientTaxIds.Raw, + Square.InvoiceRecipientTaxIds +> = core.serialization.object({ + euVat: core.serialization.property("eu_vat", core.serialization.string().optional()), +}); + +export declare namespace InvoiceRecipientTaxIds { + export interface Raw { + eu_vat?: string | null; + } +} diff --git a/src/serialization/types/InvoiceRequestMethod.ts b/src/serialization/types/InvoiceRequestMethod.ts new file mode 100644 index 000000000..c1ae8b27b --- /dev/null +++ b/src/serialization/types/InvoiceRequestMethod.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceRequestMethod: core.serialization.Schema< + serializers.InvoiceRequestMethod.Raw, + Square.InvoiceRequestMethod +> = core.serialization.enum_([ + "EMAIL", + "CHARGE_CARD_ON_FILE", + "SHARE_MANUALLY", + "CHARGE_BANK_ON_FILE", + "SMS", + "SMS_CHARGE_CARD_ON_FILE", + "SMS_CHARGE_BANK_ON_FILE", +]); + +export declare namespace InvoiceRequestMethod { + export type Raw = + | "EMAIL" + | "CHARGE_CARD_ON_FILE" + | "SHARE_MANUALLY" + | "CHARGE_BANK_ON_FILE" + | "SMS" + | "SMS_CHARGE_CARD_ON_FILE" + | "SMS_CHARGE_BANK_ON_FILE"; +} diff --git a/src/serialization/types/InvoiceRequestType.ts b/src/serialization/types/InvoiceRequestType.ts new file mode 100644 index 000000000..cb33fb072 --- /dev/null +++ b/src/serialization/types/InvoiceRequestType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceRequestType: core.serialization.Schema< + serializers.InvoiceRequestType.Raw, + Square.InvoiceRequestType +> = core.serialization.enum_(["BALANCE", "DEPOSIT", "INSTALLMENT"]); + +export declare namespace InvoiceRequestType { + export type Raw = "BALANCE" | "DEPOSIT" | "INSTALLMENT"; +} diff --git a/src/serialization/types/InvoiceSort.ts b/src/serialization/types/InvoiceSort.ts new file mode 100644 index 000000000..c993551b0 --- /dev/null +++ b/src/serialization/types/InvoiceSort.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { InvoiceSortField } from "./InvoiceSortField"; +import { SortOrder } from "./SortOrder"; + +export const InvoiceSort: core.serialization.ObjectSchema = + core.serialization.object({ + field: InvoiceSortField, + order: SortOrder.optional(), + }); + +export declare namespace InvoiceSort { + export interface Raw { + field: InvoiceSortField.Raw; + order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/InvoiceSortField.ts b/src/serialization/types/InvoiceSortField.ts new file mode 100644 index 000000000..de97dd1af --- /dev/null +++ b/src/serialization/types/InvoiceSortField.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceSortField: core.serialization.Schema = + core.serialization.stringLiteral("INVOICE_SORT_DATE"); + +export declare namespace InvoiceSortField { + export type Raw = "INVOICE_SORT_DATE"; +} diff --git a/src/serialization/types/InvoiceStatus.ts b/src/serialization/types/InvoiceStatus.ts new file mode 100644 index 000000000..0d5019adb --- /dev/null +++ b/src/serialization/types/InvoiceStatus.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const InvoiceStatus: core.serialization.Schema = + core.serialization.enum_([ + "DRAFT", + "UNPAID", + "SCHEDULED", + "PARTIALLY_PAID", + "PAID", + "PARTIALLY_REFUNDED", + "REFUNDED", + "CANCELED", + "FAILED", + "PAYMENT_PENDING", + ]); + +export declare namespace InvoiceStatus { + export type Raw = + | "DRAFT" + | "UNPAID" + | "SCHEDULED" + | "PARTIALLY_PAID" + | "PAID" + | "PARTIALLY_REFUNDED" + | "REFUNDED" + | "CANCELED" + | "FAILED" + | "PAYMENT_PENDING"; +} diff --git a/src/serialization/types/ItemVariationLocationOverrides.ts b/src/serialization/types/ItemVariationLocationOverrides.ts new file mode 100644 index 000000000..f960fa211 --- /dev/null +++ b/src/serialization/types/ItemVariationLocationOverrides.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { CatalogPricingType } from "./CatalogPricingType"; +import { InventoryAlertType } from "./InventoryAlertType"; + +export const ItemVariationLocationOverrides: core.serialization.ObjectSchema< + serializers.ItemVariationLocationOverrides.Raw, + Square.ItemVariationLocationOverrides +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + priceMoney: core.serialization.property("price_money", Money.optional()), + pricingType: core.serialization.property("pricing_type", CatalogPricingType.optional()), + trackInventory: core.serialization.property("track_inventory", core.serialization.boolean().optionalNullable()), + inventoryAlertType: core.serialization.property("inventory_alert_type", InventoryAlertType.optional()), + inventoryAlertThreshold: core.serialization.property( + "inventory_alert_threshold", + core.serialization.bigint().optionalNullable(), + ), + soldOut: core.serialization.property("sold_out", core.serialization.boolean().optional()), + soldOutValidUntil: core.serialization.property("sold_out_valid_until", core.serialization.string().optional()), +}); + +export declare namespace ItemVariationLocationOverrides { + export interface Raw { + location_id?: (string | null) | null; + price_money?: Money.Raw | null; + pricing_type?: CatalogPricingType.Raw | null; + track_inventory?: (boolean | null) | null; + inventory_alert_type?: InventoryAlertType.Raw | null; + inventory_alert_threshold?: ((bigint | number) | null) | null; + sold_out?: boolean | null; + sold_out_valid_until?: string | null; + } +} diff --git a/src/serialization/types/Job.ts b/src/serialization/types/Job.ts new file mode 100644 index 000000000..8e0104ca1 --- /dev/null +++ b/src/serialization/types/Job.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Job: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + title: core.serialization.string().optionalNullable(), + isTipEligible: core.serialization.property("is_tip_eligible", core.serialization.boolean().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + version: core.serialization.number().optional(), +}); + +export declare namespace Job { + export interface Raw { + id?: string | null; + title?: (string | null) | null; + is_tip_eligible?: (boolean | null) | null; + created_at?: string | null; + updated_at?: string | null; + version?: number | null; + } +} diff --git a/src/serialization/types/JobAssignment.ts b/src/serialization/types/JobAssignment.ts new file mode 100644 index 000000000..0d11dd48a --- /dev/null +++ b/src/serialization/types/JobAssignment.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { JobAssignmentPayType } from "./JobAssignmentPayType"; +import { Money } from "./Money"; + +export const JobAssignment: core.serialization.ObjectSchema = + core.serialization.object({ + jobTitle: core.serialization.property("job_title", core.serialization.string().optionalNullable()), + payType: core.serialization.property("pay_type", JobAssignmentPayType), + hourlyRate: core.serialization.property("hourly_rate", Money.optional()), + annualRate: core.serialization.property("annual_rate", Money.optional()), + weeklyHours: core.serialization.property("weekly_hours", core.serialization.number().optionalNullable()), + jobId: core.serialization.property("job_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace JobAssignment { + export interface Raw { + job_title?: (string | null) | null; + pay_type: JobAssignmentPayType.Raw; + hourly_rate?: Money.Raw | null; + annual_rate?: Money.Raw | null; + weekly_hours?: (number | null) | null; + job_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/JobAssignmentPayType.ts b/src/serialization/types/JobAssignmentPayType.ts new file mode 100644 index 000000000..ba51de358 --- /dev/null +++ b/src/serialization/types/JobAssignmentPayType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const JobAssignmentPayType: core.serialization.Schema< + serializers.JobAssignmentPayType.Raw, + Square.JobAssignmentPayType +> = core.serialization.enum_(["NONE", "HOURLY", "SALARY"]); + +export declare namespace JobAssignmentPayType { + export type Raw = "NONE" | "HOURLY" | "SALARY"; +} diff --git a/src/serialization/types/LinkCustomerToGiftCardResponse.ts b/src/serialization/types/LinkCustomerToGiftCardResponse.ts new file mode 100644 index 000000000..8a6f64bbc --- /dev/null +++ b/src/serialization/types/LinkCustomerToGiftCardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCard } from "./GiftCard"; + +export const LinkCustomerToGiftCardResponse: core.serialization.ObjectSchema< + serializers.LinkCustomerToGiftCardResponse.Raw, + Square.LinkCustomerToGiftCardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCard: core.serialization.property("gift_card", GiftCard.optional()), +}); + +export declare namespace LinkCustomerToGiftCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_card?: GiftCard.Raw | null; + } +} diff --git a/src/serialization/types/ListBankAccountsResponse.ts b/src/serialization/types/ListBankAccountsResponse.ts new file mode 100644 index 000000000..9ae803f54 --- /dev/null +++ b/src/serialization/types/ListBankAccountsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { BankAccount } from "./BankAccount"; + +export const ListBankAccountsResponse: core.serialization.ObjectSchema< + serializers.ListBankAccountsResponse.Raw, + Square.ListBankAccountsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + bankAccounts: core.serialization.property("bank_accounts", core.serialization.list(BankAccount).optional()), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListBankAccountsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + bank_accounts?: BankAccount.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListBookingCustomAttributeDefinitionsResponse.ts b/src/serialization/types/ListBookingCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..0074fe8bd --- /dev/null +++ b/src/serialization/types/ListBookingCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const ListBookingCustomAttributeDefinitionsResponse: core.serialization.ObjectSchema< + serializers.ListBookingCustomAttributeDefinitionsResponse.Raw, + Square.ListBookingCustomAttributeDefinitionsResponse +> = core.serialization.object({ + customAttributeDefinitions: core.serialization.property( + "custom_attribute_definitions", + core.serialization.list(CustomAttributeDefinition).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListBookingCustomAttributeDefinitionsResponse { + export interface Raw { + custom_attribute_definitions?: CustomAttributeDefinition.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListBookingCustomAttributesResponse.ts b/src/serialization/types/ListBookingCustomAttributesResponse.ts new file mode 100644 index 000000000..dbfc99ae3 --- /dev/null +++ b/src/serialization/types/ListBookingCustomAttributesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const ListBookingCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.ListBookingCustomAttributesResponse.Raw, + Square.ListBookingCustomAttributesResponse +> = core.serialization.object({ + customAttributes: core.serialization.property( + "custom_attributes", + core.serialization.list(CustomAttribute).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListBookingCustomAttributesResponse { + export interface Raw { + custom_attributes?: CustomAttribute.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListBookingsResponse.ts b/src/serialization/types/ListBookingsResponse.ts new file mode 100644 index 000000000..4bc031920 --- /dev/null +++ b/src/serialization/types/ListBookingsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Booking } from "./Booking"; +import { Error_ } from "./Error_"; + +export const ListBookingsResponse: core.serialization.ObjectSchema< + serializers.ListBookingsResponse.Raw, + Square.ListBookingsResponse +> = core.serialization.object({ + bookings: core.serialization.list(Booking).optional(), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListBookingsResponse { + export interface Raw { + bookings?: Booking.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListBreakTypesResponse.ts b/src/serialization/types/ListBreakTypesResponse.ts new file mode 100644 index 000000000..eca335c53 --- /dev/null +++ b/src/serialization/types/ListBreakTypesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BreakType } from "./BreakType"; +import { Error_ } from "./Error_"; + +export const ListBreakTypesResponse: core.serialization.ObjectSchema< + serializers.ListBreakTypesResponse.Raw, + Square.ListBreakTypesResponse +> = core.serialization.object({ + breakTypes: core.serialization.property("break_types", core.serialization.list(BreakType).optional()), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListBreakTypesResponse { + export interface Raw { + break_types?: BreakType.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListCardsResponse.ts b/src/serialization/types/ListCardsResponse.ts new file mode 100644 index 000000000..b4ff596e5 --- /dev/null +++ b/src/serialization/types/ListCardsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Card } from "./Card"; + +export const ListCardsResponse: core.serialization.ObjectSchema< + serializers.ListCardsResponse.Raw, + Square.ListCardsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + cards: core.serialization.list(Card).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListCardsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + cards?: Card.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListCashDrawerShiftEventsResponse.ts b/src/serialization/types/ListCashDrawerShiftEventsResponse.ts new file mode 100644 index 000000000..45ac96bc9 --- /dev/null +++ b/src/serialization/types/ListCashDrawerShiftEventsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CashDrawerShiftEvent } from "./CashDrawerShiftEvent"; + +export const ListCashDrawerShiftEventsResponse: core.serialization.ObjectSchema< + serializers.ListCashDrawerShiftEventsResponse.Raw, + Square.ListCashDrawerShiftEventsResponse +> = core.serialization.object({ + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), + cashDrawerShiftEvents: core.serialization.property( + "cash_drawer_shift_events", + core.serialization.list(CashDrawerShiftEvent).optional(), + ), +}); + +export declare namespace ListCashDrawerShiftEventsResponse { + export interface Raw { + cursor?: string | null; + errors?: Error_.Raw[] | null; + cash_drawer_shift_events?: CashDrawerShiftEvent.Raw[] | null; + } +} diff --git a/src/serialization/types/ListCashDrawerShiftsResponse.ts b/src/serialization/types/ListCashDrawerShiftsResponse.ts new file mode 100644 index 000000000..c36631fa0 --- /dev/null +++ b/src/serialization/types/ListCashDrawerShiftsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CashDrawerShiftSummary } from "./CashDrawerShiftSummary"; + +export const ListCashDrawerShiftsResponse: core.serialization.ObjectSchema< + serializers.ListCashDrawerShiftsResponse.Raw, + Square.ListCashDrawerShiftsResponse +> = core.serialization.object({ + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), + cashDrawerShifts: core.serialization.property( + "cash_drawer_shifts", + core.serialization.list(CashDrawerShiftSummary).optional(), + ), +}); + +export declare namespace ListCashDrawerShiftsResponse { + export interface Raw { + cursor?: string | null; + errors?: Error_.Raw[] | null; + cash_drawer_shifts?: CashDrawerShiftSummary.Raw[] | null; + } +} diff --git a/src/serialization/types/ListCatalogResponse.ts b/src/serialization/types/ListCatalogResponse.ts new file mode 100644 index 000000000..0a38150d8 --- /dev/null +++ b/src/serialization/types/ListCatalogResponse.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const ListCatalogResponse: core.serialization.ObjectSchema< + serializers.ListCatalogResponse.Raw, + Square.ListCatalogResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + cursor: core.serialization.string().optional(), + objects: core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optional(), +}); + +export declare namespace ListCatalogResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + cursor?: string | null; + objects?: serializers.CatalogObject.Raw[] | null; + } +} diff --git a/src/serialization/types/ListCustomerCustomAttributeDefinitionsResponse.ts b/src/serialization/types/ListCustomerCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..d73872e4f --- /dev/null +++ b/src/serialization/types/ListCustomerCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const ListCustomerCustomAttributeDefinitionsResponse: core.serialization.ObjectSchema< + serializers.ListCustomerCustomAttributeDefinitionsResponse.Raw, + Square.ListCustomerCustomAttributeDefinitionsResponse +> = core.serialization.object({ + customAttributeDefinitions: core.serialization.property( + "custom_attribute_definitions", + core.serialization.list(CustomAttributeDefinition).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListCustomerCustomAttributeDefinitionsResponse { + export interface Raw { + custom_attribute_definitions?: CustomAttributeDefinition.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListCustomerCustomAttributesResponse.ts b/src/serialization/types/ListCustomerCustomAttributesResponse.ts new file mode 100644 index 000000000..ef66ceeaf --- /dev/null +++ b/src/serialization/types/ListCustomerCustomAttributesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const ListCustomerCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.ListCustomerCustomAttributesResponse.Raw, + Square.ListCustomerCustomAttributesResponse +> = core.serialization.object({ + customAttributes: core.serialization.property( + "custom_attributes", + core.serialization.list(CustomAttribute).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListCustomerCustomAttributesResponse { + export interface Raw { + custom_attributes?: CustomAttribute.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListCustomerGroupsResponse.ts b/src/serialization/types/ListCustomerGroupsResponse.ts new file mode 100644 index 000000000..c8e2b0a90 --- /dev/null +++ b/src/serialization/types/ListCustomerGroupsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CustomerGroup } from "./CustomerGroup"; + +export const ListCustomerGroupsResponse: core.serialization.ObjectSchema< + serializers.ListCustomerGroupsResponse.Raw, + Square.ListCustomerGroupsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + groups: core.serialization.list(CustomerGroup).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListCustomerGroupsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + groups?: CustomerGroup.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListCustomerSegmentsResponse.ts b/src/serialization/types/ListCustomerSegmentsResponse.ts new file mode 100644 index 000000000..e6f3c59b8 --- /dev/null +++ b/src/serialization/types/ListCustomerSegmentsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CustomerSegment } from "./CustomerSegment"; + +export const ListCustomerSegmentsResponse: core.serialization.ObjectSchema< + serializers.ListCustomerSegmentsResponse.Raw, + Square.ListCustomerSegmentsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + segments: core.serialization.list(CustomerSegment).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListCustomerSegmentsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + segments?: CustomerSegment.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListCustomersResponse.ts b/src/serialization/types/ListCustomersResponse.ts new file mode 100644 index 000000000..697809709 --- /dev/null +++ b/src/serialization/types/ListCustomersResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Customer } from "./Customer"; + +export const ListCustomersResponse: core.serialization.ObjectSchema< + serializers.ListCustomersResponse.Raw, + Square.ListCustomersResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + customers: core.serialization.list(Customer).optional(), + cursor: core.serialization.string().optional(), + count: core.serialization.bigint().optional(), +}); + +export declare namespace ListCustomersResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + customers?: Customer.Raw[] | null; + cursor?: string | null; + count?: (bigint | number) | null; + } +} diff --git a/src/serialization/types/ListDeviceCodesResponse.ts b/src/serialization/types/ListDeviceCodesResponse.ts new file mode 100644 index 000000000..67bd8848f --- /dev/null +++ b/src/serialization/types/ListDeviceCodesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { DeviceCode } from "./DeviceCode"; + +export const ListDeviceCodesResponse: core.serialization.ObjectSchema< + serializers.ListDeviceCodesResponse.Raw, + Square.ListDeviceCodesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + deviceCodes: core.serialization.property("device_codes", core.serialization.list(DeviceCode).optional()), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListDeviceCodesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + device_codes?: DeviceCode.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListDevicesResponse.ts b/src/serialization/types/ListDevicesResponse.ts new file mode 100644 index 000000000..cd6940182 --- /dev/null +++ b/src/serialization/types/ListDevicesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Device } from "./Device"; + +export const ListDevicesResponse: core.serialization.ObjectSchema< + serializers.ListDevicesResponse.Raw, + Square.ListDevicesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + devices: core.serialization.list(Device).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListDevicesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + devices?: Device.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListDisputeEvidenceResponse.ts b/src/serialization/types/ListDisputeEvidenceResponse.ts new file mode 100644 index 000000000..e9788cd53 --- /dev/null +++ b/src/serialization/types/ListDisputeEvidenceResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DisputeEvidence } from "./DisputeEvidence"; +import { Error_ } from "./Error_"; + +export const ListDisputeEvidenceResponse: core.serialization.ObjectSchema< + serializers.ListDisputeEvidenceResponse.Raw, + Square.ListDisputeEvidenceResponse +> = core.serialization.object({ + evidence: core.serialization.list(DisputeEvidence).optional(), + errors: core.serialization.list(Error_).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListDisputeEvidenceResponse { + export interface Raw { + evidence?: DisputeEvidence.Raw[] | null; + errors?: Error_.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListDisputesResponse.ts b/src/serialization/types/ListDisputesResponse.ts new file mode 100644 index 000000000..84a1eaa91 --- /dev/null +++ b/src/serialization/types/ListDisputesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Dispute } from "./Dispute"; + +export const ListDisputesResponse: core.serialization.ObjectSchema< + serializers.ListDisputesResponse.Raw, + Square.ListDisputesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + disputes: core.serialization.list(Dispute).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListDisputesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + disputes?: Dispute.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListEmployeeWagesResponse.ts b/src/serialization/types/ListEmployeeWagesResponse.ts new file mode 100644 index 000000000..d6143cbdb --- /dev/null +++ b/src/serialization/types/ListEmployeeWagesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { EmployeeWage } from "./EmployeeWage"; +import { Error_ } from "./Error_"; + +export const ListEmployeeWagesResponse: core.serialization.ObjectSchema< + serializers.ListEmployeeWagesResponse.Raw, + Square.ListEmployeeWagesResponse +> = core.serialization.object({ + employeeWages: core.serialization.property("employee_wages", core.serialization.list(EmployeeWage).optional()), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListEmployeeWagesResponse { + export interface Raw { + employee_wages?: EmployeeWage.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListEmployeesResponse.ts b/src/serialization/types/ListEmployeesResponse.ts new file mode 100644 index 000000000..77807351e --- /dev/null +++ b/src/serialization/types/ListEmployeesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Employee } from "./Employee"; +import { Error_ } from "./Error_"; + +export const ListEmployeesResponse: core.serialization.ObjectSchema< + serializers.ListEmployeesResponse.Raw, + Square.ListEmployeesResponse +> = core.serialization.object({ + employees: core.serialization.list(Employee).optional(), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListEmployeesResponse { + export interface Raw { + employees?: Employee.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListEventTypesResponse.ts b/src/serialization/types/ListEventTypesResponse.ts new file mode 100644 index 000000000..928ab03c9 --- /dev/null +++ b/src/serialization/types/ListEventTypesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { EventTypeMetadata } from "./EventTypeMetadata"; + +export const ListEventTypesResponse: core.serialization.ObjectSchema< + serializers.ListEventTypesResponse.Raw, + Square.ListEventTypesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + eventTypes: core.serialization.property( + "event_types", + core.serialization.list(core.serialization.string()).optional(), + ), + metadata: core.serialization.list(EventTypeMetadata).optional(), +}); + +export declare namespace ListEventTypesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + event_types?: string[] | null; + metadata?: EventTypeMetadata.Raw[] | null; + } +} diff --git a/src/serialization/types/ListGiftCardActivitiesResponse.ts b/src/serialization/types/ListGiftCardActivitiesResponse.ts new file mode 100644 index 000000000..4b120a9dc --- /dev/null +++ b/src/serialization/types/ListGiftCardActivitiesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCardActivity } from "./GiftCardActivity"; + +export const ListGiftCardActivitiesResponse: core.serialization.ObjectSchema< + serializers.ListGiftCardActivitiesResponse.Raw, + Square.ListGiftCardActivitiesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCardActivities: core.serialization.property( + "gift_card_activities", + core.serialization.list(GiftCardActivity).optional(), + ), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListGiftCardActivitiesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_card_activities?: GiftCardActivity.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListGiftCardsResponse.ts b/src/serialization/types/ListGiftCardsResponse.ts new file mode 100644 index 000000000..c3404662a --- /dev/null +++ b/src/serialization/types/ListGiftCardsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCard } from "./GiftCard"; + +export const ListGiftCardsResponse: core.serialization.ObjectSchema< + serializers.ListGiftCardsResponse.Raw, + Square.ListGiftCardsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCards: core.serialization.property("gift_cards", core.serialization.list(GiftCard).optional()), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListGiftCardsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_cards?: GiftCard.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListInvoicesResponse.ts b/src/serialization/types/ListInvoicesResponse.ts new file mode 100644 index 000000000..7397ad716 --- /dev/null +++ b/src/serialization/types/ListInvoicesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Invoice } from "./Invoice"; +import { Error_ } from "./Error_"; + +export const ListInvoicesResponse: core.serialization.ObjectSchema< + serializers.ListInvoicesResponse.Raw, + Square.ListInvoicesResponse +> = core.serialization.object({ + invoices: core.serialization.list(Invoice).optional(), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListInvoicesResponse { + export interface Raw { + invoices?: Invoice.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListJobsResponse.ts b/src/serialization/types/ListJobsResponse.ts new file mode 100644 index 000000000..40768cd12 --- /dev/null +++ b/src/serialization/types/ListJobsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Job } from "./Job"; +import { Error_ } from "./Error_"; + +export const ListJobsResponse: core.serialization.ObjectSchema< + serializers.ListJobsResponse.Raw, + Square.ListJobsResponse +> = core.serialization.object({ + jobs: core.serialization.list(Job).optional(), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListJobsResponse { + export interface Raw { + jobs?: Job.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListLocationBookingProfilesResponse.ts b/src/serialization/types/ListLocationBookingProfilesResponse.ts new file mode 100644 index 000000000..1bf45e1b1 --- /dev/null +++ b/src/serialization/types/ListLocationBookingProfilesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LocationBookingProfile } from "./LocationBookingProfile"; +import { Error_ } from "./Error_"; + +export const ListLocationBookingProfilesResponse: core.serialization.ObjectSchema< + serializers.ListLocationBookingProfilesResponse.Raw, + Square.ListLocationBookingProfilesResponse +> = core.serialization.object({ + locationBookingProfiles: core.serialization.property( + "location_booking_profiles", + core.serialization.list(LocationBookingProfile).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListLocationBookingProfilesResponse { + export interface Raw { + location_booking_profiles?: LocationBookingProfile.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListLocationCustomAttributeDefinitionsResponse.ts b/src/serialization/types/ListLocationCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..a5ed1021b --- /dev/null +++ b/src/serialization/types/ListLocationCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const ListLocationCustomAttributeDefinitionsResponse: core.serialization.ObjectSchema< + serializers.ListLocationCustomAttributeDefinitionsResponse.Raw, + Square.ListLocationCustomAttributeDefinitionsResponse +> = core.serialization.object({ + customAttributeDefinitions: core.serialization.property( + "custom_attribute_definitions", + core.serialization.list(CustomAttributeDefinition).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListLocationCustomAttributeDefinitionsResponse { + export interface Raw { + custom_attribute_definitions?: CustomAttributeDefinition.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListLocationCustomAttributesResponse.ts b/src/serialization/types/ListLocationCustomAttributesResponse.ts new file mode 100644 index 000000000..0866efabd --- /dev/null +++ b/src/serialization/types/ListLocationCustomAttributesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const ListLocationCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.ListLocationCustomAttributesResponse.Raw, + Square.ListLocationCustomAttributesResponse +> = core.serialization.object({ + customAttributes: core.serialization.property( + "custom_attributes", + core.serialization.list(CustomAttribute).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListLocationCustomAttributesResponse { + export interface Raw { + custom_attributes?: CustomAttribute.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListLocationsResponse.ts b/src/serialization/types/ListLocationsResponse.ts new file mode 100644 index 000000000..877b12961 --- /dev/null +++ b/src/serialization/types/ListLocationsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Location } from "./Location"; + +export const ListLocationsResponse: core.serialization.ObjectSchema< + serializers.ListLocationsResponse.Raw, + Square.ListLocationsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + locations: core.serialization.list(Location).optional(), +}); + +export declare namespace ListLocationsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + locations?: Location.Raw[] | null; + } +} diff --git a/src/serialization/types/ListLoyaltyProgramsResponse.ts b/src/serialization/types/ListLoyaltyProgramsResponse.ts new file mode 100644 index 000000000..85b9e0855 --- /dev/null +++ b/src/serialization/types/ListLoyaltyProgramsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyProgram } from "./LoyaltyProgram"; + +export const ListLoyaltyProgramsResponse: core.serialization.ObjectSchema< + serializers.ListLoyaltyProgramsResponse.Raw, + Square.ListLoyaltyProgramsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + programs: core.serialization.list(LoyaltyProgram).optional(), +}); + +export declare namespace ListLoyaltyProgramsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + programs?: LoyaltyProgram.Raw[] | null; + } +} diff --git a/src/serialization/types/ListLoyaltyPromotionsResponse.ts b/src/serialization/types/ListLoyaltyPromotionsResponse.ts new file mode 100644 index 000000000..90889f9a2 --- /dev/null +++ b/src/serialization/types/ListLoyaltyPromotionsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyPromotion } from "./LoyaltyPromotion"; + +export const ListLoyaltyPromotionsResponse: core.serialization.ObjectSchema< + serializers.ListLoyaltyPromotionsResponse.Raw, + Square.ListLoyaltyPromotionsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + loyaltyPromotions: core.serialization.property( + "loyalty_promotions", + core.serialization.list(LoyaltyPromotion).optional(), + ), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListLoyaltyPromotionsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + loyalty_promotions?: LoyaltyPromotion.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListMerchantCustomAttributeDefinitionsResponse.ts b/src/serialization/types/ListMerchantCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..97bcd71bd --- /dev/null +++ b/src/serialization/types/ListMerchantCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const ListMerchantCustomAttributeDefinitionsResponse: core.serialization.ObjectSchema< + serializers.ListMerchantCustomAttributeDefinitionsResponse.Raw, + Square.ListMerchantCustomAttributeDefinitionsResponse +> = core.serialization.object({ + customAttributeDefinitions: core.serialization.property( + "custom_attribute_definitions", + core.serialization.list(CustomAttributeDefinition).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListMerchantCustomAttributeDefinitionsResponse { + export interface Raw { + custom_attribute_definitions?: CustomAttributeDefinition.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListMerchantCustomAttributesResponse.ts b/src/serialization/types/ListMerchantCustomAttributesResponse.ts new file mode 100644 index 000000000..bdc90edc2 --- /dev/null +++ b/src/serialization/types/ListMerchantCustomAttributesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const ListMerchantCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.ListMerchantCustomAttributesResponse.Raw, + Square.ListMerchantCustomAttributesResponse +> = core.serialization.object({ + customAttributes: core.serialization.property( + "custom_attributes", + core.serialization.list(CustomAttribute).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListMerchantCustomAttributesResponse { + export interface Raw { + custom_attributes?: CustomAttribute.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListMerchantsResponse.ts b/src/serialization/types/ListMerchantsResponse.ts new file mode 100644 index 000000000..5129540da --- /dev/null +++ b/src/serialization/types/ListMerchantsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Merchant } from "./Merchant"; + +export const ListMerchantsResponse: core.serialization.ObjectSchema< + serializers.ListMerchantsResponse.Raw, + Square.ListMerchantsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + merchant: core.serialization.list(Merchant).optional(), + cursor: core.serialization.number().optional(), +}); + +export declare namespace ListMerchantsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + merchant?: Merchant.Raw[] | null; + cursor?: number | null; + } +} diff --git a/src/serialization/types/ListOrderCustomAttributeDefinitionsResponse.ts b/src/serialization/types/ListOrderCustomAttributeDefinitionsResponse.ts new file mode 100644 index 000000000..25c06a63e --- /dev/null +++ b/src/serialization/types/ListOrderCustomAttributeDefinitionsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const ListOrderCustomAttributeDefinitionsResponse: core.serialization.ObjectSchema< + serializers.ListOrderCustomAttributeDefinitionsResponse.Raw, + Square.ListOrderCustomAttributeDefinitionsResponse +> = core.serialization.object({ + customAttributeDefinitions: core.serialization.property( + "custom_attribute_definitions", + core.serialization.list(CustomAttributeDefinition), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListOrderCustomAttributeDefinitionsResponse { + export interface Raw { + custom_attribute_definitions: CustomAttributeDefinition.Raw[]; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListOrderCustomAttributesResponse.ts b/src/serialization/types/ListOrderCustomAttributesResponse.ts new file mode 100644 index 000000000..e1a445ef3 --- /dev/null +++ b/src/serialization/types/ListOrderCustomAttributesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const ListOrderCustomAttributesResponse: core.serialization.ObjectSchema< + serializers.ListOrderCustomAttributesResponse.Raw, + Square.ListOrderCustomAttributesResponse +> = core.serialization.object({ + customAttributes: core.serialization.property( + "custom_attributes", + core.serialization.list(CustomAttribute).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListOrderCustomAttributesResponse { + export interface Raw { + custom_attributes?: CustomAttribute.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListPaymentLinksResponse.ts b/src/serialization/types/ListPaymentLinksResponse.ts new file mode 100644 index 000000000..b5eaf0acf --- /dev/null +++ b/src/serialization/types/ListPaymentLinksResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { PaymentLink } from "./PaymentLink"; + +export const ListPaymentLinksResponse: core.serialization.ObjectSchema< + serializers.ListPaymentLinksResponse.Raw, + Square.ListPaymentLinksResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + paymentLinks: core.serialization.property("payment_links", core.serialization.list(PaymentLink).optional()), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListPaymentLinksResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment_links?: PaymentLink.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListPaymentRefundsResponse.ts b/src/serialization/types/ListPaymentRefundsResponse.ts new file mode 100644 index 000000000..8ce9c8655 --- /dev/null +++ b/src/serialization/types/ListPaymentRefundsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { PaymentRefund } from "./PaymentRefund"; + +export const ListPaymentRefundsResponse: core.serialization.ObjectSchema< + serializers.ListPaymentRefundsResponse.Raw, + Square.ListPaymentRefundsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + refunds: core.serialization.list(PaymentRefund).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListPaymentRefundsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + refunds?: PaymentRefund.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListPaymentsResponse.ts b/src/serialization/types/ListPaymentsResponse.ts new file mode 100644 index 000000000..e7aaddf4a --- /dev/null +++ b/src/serialization/types/ListPaymentsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Payment } from "./Payment"; + +export const ListPaymentsResponse: core.serialization.ObjectSchema< + serializers.ListPaymentsResponse.Raw, + Square.ListPaymentsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + payments: core.serialization.list(Payment).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListPaymentsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payments?: Payment.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListPayoutEntriesResponse.ts b/src/serialization/types/ListPayoutEntriesResponse.ts new file mode 100644 index 000000000..55da07c34 --- /dev/null +++ b/src/serialization/types/ListPayoutEntriesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { PayoutEntry } from "./PayoutEntry"; +import { Error_ } from "./Error_"; + +export const ListPayoutEntriesResponse: core.serialization.ObjectSchema< + serializers.ListPayoutEntriesResponse.Raw, + Square.ListPayoutEntriesResponse +> = core.serialization.object({ + payoutEntries: core.serialization.property("payout_entries", core.serialization.list(PayoutEntry).optional()), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListPayoutEntriesResponse { + export interface Raw { + payout_entries?: PayoutEntry.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListPayoutsResponse.ts b/src/serialization/types/ListPayoutsResponse.ts new file mode 100644 index 000000000..94bd7a835 --- /dev/null +++ b/src/serialization/types/ListPayoutsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Payout } from "./Payout"; +import { Error_ } from "./Error_"; + +export const ListPayoutsResponse: core.serialization.ObjectSchema< + serializers.ListPayoutsResponse.Raw, + Square.ListPayoutsResponse +> = core.serialization.object({ + payouts: core.serialization.list(Payout).optional(), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListPayoutsResponse { + export interface Raw { + payouts?: Payout.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListSitesResponse.ts b/src/serialization/types/ListSitesResponse.ts new file mode 100644 index 000000000..557dc290c --- /dev/null +++ b/src/serialization/types/ListSitesResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Site } from "./Site"; + +export const ListSitesResponse: core.serialization.ObjectSchema< + serializers.ListSitesResponse.Raw, + Square.ListSitesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + sites: core.serialization.list(Site).optional(), +}); + +export declare namespace ListSitesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + sites?: Site.Raw[] | null; + } +} diff --git a/src/serialization/types/ListSubscriptionEventsResponse.ts b/src/serialization/types/ListSubscriptionEventsResponse.ts new file mode 100644 index 000000000..55be5a067 --- /dev/null +++ b/src/serialization/types/ListSubscriptionEventsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { SubscriptionEvent } from "./SubscriptionEvent"; + +export const ListSubscriptionEventsResponse: core.serialization.ObjectSchema< + serializers.ListSubscriptionEventsResponse.Raw, + Square.ListSubscriptionEventsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscriptionEvents: core.serialization.property( + "subscription_events", + core.serialization.list(SubscriptionEvent).optional(), + ), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListSubscriptionEventsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription_events?: SubscriptionEvent.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListTeamMemberBookingProfilesResponse.ts b/src/serialization/types/ListTeamMemberBookingProfilesResponse.ts new file mode 100644 index 000000000..8cf951929 --- /dev/null +++ b/src/serialization/types/ListTeamMemberBookingProfilesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMemberBookingProfile } from "./TeamMemberBookingProfile"; +import { Error_ } from "./Error_"; + +export const ListTeamMemberBookingProfilesResponse: core.serialization.ObjectSchema< + serializers.ListTeamMemberBookingProfilesResponse.Raw, + Square.ListTeamMemberBookingProfilesResponse +> = core.serialization.object({ + teamMemberBookingProfiles: core.serialization.property( + "team_member_booking_profiles", + core.serialization.list(TeamMemberBookingProfile).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListTeamMemberBookingProfilesResponse { + export interface Raw { + team_member_booking_profiles?: TeamMemberBookingProfile.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListTeamMemberWagesResponse.ts b/src/serialization/types/ListTeamMemberWagesResponse.ts new file mode 100644 index 000000000..3b5d52b44 --- /dev/null +++ b/src/serialization/types/ListTeamMemberWagesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMemberWage } from "./TeamMemberWage"; +import { Error_ } from "./Error_"; + +export const ListTeamMemberWagesResponse: core.serialization.ObjectSchema< + serializers.ListTeamMemberWagesResponse.Raw, + Square.ListTeamMemberWagesResponse +> = core.serialization.object({ + teamMemberWages: core.serialization.property( + "team_member_wages", + core.serialization.list(TeamMemberWage).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListTeamMemberWagesResponse { + export interface Raw { + team_member_wages?: TeamMemberWage.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ListTransactionsResponse.ts b/src/serialization/types/ListTransactionsResponse.ts new file mode 100644 index 000000000..219aaedd3 --- /dev/null +++ b/src/serialization/types/ListTransactionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Transaction } from "./Transaction"; + +export const ListTransactionsResponse: core.serialization.ObjectSchema< + serializers.ListTransactionsResponse.Raw, + Square.ListTransactionsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + transactions: core.serialization.list(Transaction).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListTransactionsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + transactions?: Transaction.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListWebhookEventTypesResponse.ts b/src/serialization/types/ListWebhookEventTypesResponse.ts new file mode 100644 index 000000000..a0d1c8bbb --- /dev/null +++ b/src/serialization/types/ListWebhookEventTypesResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { EventTypeMetadata } from "./EventTypeMetadata"; + +export const ListWebhookEventTypesResponse: core.serialization.ObjectSchema< + serializers.ListWebhookEventTypesResponse.Raw, + Square.ListWebhookEventTypesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + eventTypes: core.serialization.property( + "event_types", + core.serialization.list(core.serialization.string()).optional(), + ), + metadata: core.serialization.list(EventTypeMetadata).optional(), +}); + +export declare namespace ListWebhookEventTypesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + event_types?: string[] | null; + metadata?: EventTypeMetadata.Raw[] | null; + } +} diff --git a/src/serialization/types/ListWebhookSubscriptionsResponse.ts b/src/serialization/types/ListWebhookSubscriptionsResponse.ts new file mode 100644 index 000000000..331d5e18a --- /dev/null +++ b/src/serialization/types/ListWebhookSubscriptionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { WebhookSubscription } from "./WebhookSubscription"; + +export const ListWebhookSubscriptionsResponse: core.serialization.ObjectSchema< + serializers.ListWebhookSubscriptionsResponse.Raw, + Square.ListWebhookSubscriptionsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscriptions: core.serialization.list(WebhookSubscription).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace ListWebhookSubscriptionsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscriptions?: WebhookSubscription.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/ListWorkweekConfigsResponse.ts b/src/serialization/types/ListWorkweekConfigsResponse.ts new file mode 100644 index 000000000..ab9d168d1 --- /dev/null +++ b/src/serialization/types/ListWorkweekConfigsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { WorkweekConfig } from "./WorkweekConfig"; +import { Error_ } from "./Error_"; + +export const ListWorkweekConfigsResponse: core.serialization.ObjectSchema< + serializers.ListWorkweekConfigsResponse.Raw, + Square.ListWorkweekConfigsResponse +> = core.serialization.object({ + workweekConfigs: core.serialization.property( + "workweek_configs", + core.serialization.list(WorkweekConfig).optional(), + ), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace ListWorkweekConfigsResponse { + export interface Raw { + workweek_configs?: WorkweekConfig.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/Location.ts b/src/serialization/types/Location.ts new file mode 100644 index 000000000..699cf9ea9 --- /dev/null +++ b/src/serialization/types/Location.ts @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; +import { LocationCapability } from "./LocationCapability"; +import { LocationStatus } from "./LocationStatus"; +import { Country } from "./Country"; +import { Currency } from "./Currency"; +import { LocationType } from "./LocationType"; +import { BusinessHours } from "./BusinessHours"; +import { Coordinates } from "./Coordinates"; +import { TaxIds } from "./TaxIds"; + +export const Location: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string().optionalNullable(), + address: Address.optional(), + timezone: core.serialization.string().optionalNullable(), + capabilities: core.serialization.list(LocationCapability).optional(), + status: LocationStatus.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + merchantId: core.serialization.property("merchant_id", core.serialization.string().optional()), + country: Country.optional(), + languageCode: core.serialization.property("language_code", core.serialization.string().optionalNullable()), + currency: Currency.optional(), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + businessName: core.serialization.property("business_name", core.serialization.string().optionalNullable()), + type: LocationType.optional(), + websiteUrl: core.serialization.property("website_url", core.serialization.string().optionalNullable()), + businessHours: core.serialization.property("business_hours", BusinessHours.optional()), + businessEmail: core.serialization.property("business_email", core.serialization.string().optionalNullable()), + description: core.serialization.string().optionalNullable(), + twitterUsername: core.serialization.property( + "twitter_username", + core.serialization.string().optionalNullable(), + ), + instagramUsername: core.serialization.property( + "instagram_username", + core.serialization.string().optionalNullable(), + ), + facebookUrl: core.serialization.property("facebook_url", core.serialization.string().optionalNullable()), + coordinates: Coordinates.optional(), + logoUrl: core.serialization.property("logo_url", core.serialization.string().optional()), + posBackgroundUrl: core.serialization.property("pos_background_url", core.serialization.string().optional()), + mcc: core.serialization.string().optionalNullable(), + fullFormatLogoUrl: core.serialization.property("full_format_logo_url", core.serialization.string().optional()), + taxIds: core.serialization.property("tax_ids", TaxIds.optional()), + }); + +export declare namespace Location { + export interface Raw { + id?: string | null; + name?: (string | null) | null; + address?: Address.Raw | null; + timezone?: (string | null) | null; + capabilities?: LocationCapability.Raw[] | null; + status?: LocationStatus.Raw | null; + created_at?: string | null; + merchant_id?: string | null; + country?: Country.Raw | null; + language_code?: (string | null) | null; + currency?: Currency.Raw | null; + phone_number?: (string | null) | null; + business_name?: (string | null) | null; + type?: LocationType.Raw | null; + website_url?: (string | null) | null; + business_hours?: BusinessHours.Raw | null; + business_email?: (string | null) | null; + description?: (string | null) | null; + twitter_username?: (string | null) | null; + instagram_username?: (string | null) | null; + facebook_url?: (string | null) | null; + coordinates?: Coordinates.Raw | null; + logo_url?: string | null; + pos_background_url?: string | null; + mcc?: (string | null) | null; + full_format_logo_url?: string | null; + tax_ids?: TaxIds.Raw | null; + } +} diff --git a/src/serialization/types/LocationBookingProfile.ts b/src/serialization/types/LocationBookingProfile.ts new file mode 100644 index 000000000..ebd5ccbfb --- /dev/null +++ b/src/serialization/types/LocationBookingProfile.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LocationBookingProfile: core.serialization.ObjectSchema< + serializers.LocationBookingProfile.Raw, + Square.LocationBookingProfile +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + bookingSiteUrl: core.serialization.property("booking_site_url", core.serialization.string().optionalNullable()), + onlineBookingEnabled: core.serialization.property( + "online_booking_enabled", + core.serialization.boolean().optionalNullable(), + ), +}); + +export declare namespace LocationBookingProfile { + export interface Raw { + location_id?: (string | null) | null; + booking_site_url?: (string | null) | null; + online_booking_enabled?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/LocationCapability.ts b/src/serialization/types/LocationCapability.ts new file mode 100644 index 000000000..3a3245814 --- /dev/null +++ b/src/serialization/types/LocationCapability.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LocationCapability: core.serialization.Schema< + serializers.LocationCapability.Raw, + Square.LocationCapability +> = core.serialization.enum_(["CREDIT_CARD_PROCESSING", "AUTOMATIC_TRANSFERS", "UNLINKED_REFUNDS"]); + +export declare namespace LocationCapability { + export type Raw = "CREDIT_CARD_PROCESSING" | "AUTOMATIC_TRANSFERS" | "UNLINKED_REFUNDS"; +} diff --git a/src/serialization/types/LocationStatus.ts b/src/serialization/types/LocationStatus.ts new file mode 100644 index 000000000..7a3722527 --- /dev/null +++ b/src/serialization/types/LocationStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LocationStatus: core.serialization.Schema = + core.serialization.enum_(["ACTIVE", "INACTIVE"]); + +export declare namespace LocationStatus { + export type Raw = "ACTIVE" | "INACTIVE"; +} diff --git a/src/serialization/types/LocationType.ts b/src/serialization/types/LocationType.ts new file mode 100644 index 000000000..d2003c9d2 --- /dev/null +++ b/src/serialization/types/LocationType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LocationType: core.serialization.Schema = + core.serialization.enum_(["PHYSICAL", "MOBILE"]); + +export declare namespace LocationType { + export type Raw = "PHYSICAL" | "MOBILE"; +} diff --git a/src/serialization/types/LoyaltyAccount.ts b/src/serialization/types/LoyaltyAccount.ts new file mode 100644 index 000000000..78a50fcf0 --- /dev/null +++ b/src/serialization/types/LoyaltyAccount.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyAccountMapping } from "./LoyaltyAccountMapping"; +import { LoyaltyAccountExpiringPointDeadline } from "./LoyaltyAccountExpiringPointDeadline"; + +export const LoyaltyAccount: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + programId: core.serialization.property("program_id", core.serialization.string()), + balance: core.serialization.number().optional(), + lifetimePoints: core.serialization.property("lifetime_points", core.serialization.number().optional()), + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + enrolledAt: core.serialization.property("enrolled_at", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + mapping: LoyaltyAccountMapping.optional(), + expiringPointDeadlines: core.serialization.property( + "expiring_point_deadlines", + core.serialization.list(LoyaltyAccountExpiringPointDeadline).optionalNullable(), + ), + }); + +export declare namespace LoyaltyAccount { + export interface Raw { + id?: string | null; + program_id: string; + balance?: number | null; + lifetime_points?: number | null; + customer_id?: (string | null) | null; + enrolled_at?: (string | null) | null; + created_at?: string | null; + updated_at?: string | null; + mapping?: LoyaltyAccountMapping.Raw | null; + expiring_point_deadlines?: (LoyaltyAccountExpiringPointDeadline.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/LoyaltyAccountExpiringPointDeadline.ts b/src/serialization/types/LoyaltyAccountExpiringPointDeadline.ts new file mode 100644 index 000000000..8da4115ca --- /dev/null +++ b/src/serialization/types/LoyaltyAccountExpiringPointDeadline.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyAccountExpiringPointDeadline: core.serialization.ObjectSchema< + serializers.LoyaltyAccountExpiringPointDeadline.Raw, + Square.LoyaltyAccountExpiringPointDeadline +> = core.serialization.object({ + points: core.serialization.number(), + expiresAt: core.serialization.property("expires_at", core.serialization.string()), +}); + +export declare namespace LoyaltyAccountExpiringPointDeadline { + export interface Raw { + points: number; + expires_at: string; + } +} diff --git a/src/serialization/types/LoyaltyAccountMapping.ts b/src/serialization/types/LoyaltyAccountMapping.ts new file mode 100644 index 000000000..6c3ac7656 --- /dev/null +++ b/src/serialization/types/LoyaltyAccountMapping.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyAccountMapping: core.serialization.ObjectSchema< + serializers.LoyaltyAccountMapping.Raw, + Square.LoyaltyAccountMapping +> = core.serialization.object({ + id: core.serialization.string().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), +}); + +export declare namespace LoyaltyAccountMapping { + export interface Raw { + id?: string | null; + created_at?: string | null; + phone_number?: (string | null) | null; + } +} diff --git a/src/serialization/types/LoyaltyEvent.ts b/src/serialization/types/LoyaltyEvent.ts new file mode 100644 index 000000000..5e0f63980 --- /dev/null +++ b/src/serialization/types/LoyaltyEvent.ts @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyEventType } from "./LoyaltyEventType"; +import { LoyaltyEventAccumulatePoints } from "./LoyaltyEventAccumulatePoints"; +import { LoyaltyEventCreateReward } from "./LoyaltyEventCreateReward"; +import { LoyaltyEventRedeemReward } from "./LoyaltyEventRedeemReward"; +import { LoyaltyEventDeleteReward } from "./LoyaltyEventDeleteReward"; +import { LoyaltyEventAdjustPoints } from "./LoyaltyEventAdjustPoints"; +import { LoyaltyEventSource } from "./LoyaltyEventSource"; +import { LoyaltyEventExpirePoints } from "./LoyaltyEventExpirePoints"; +import { LoyaltyEventOther } from "./LoyaltyEventOther"; +import { LoyaltyEventAccumulatePromotionPoints } from "./LoyaltyEventAccumulatePromotionPoints"; + +export const LoyaltyEvent: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + type: LoyaltyEventType, + createdAt: core.serialization.property("created_at", core.serialization.string()), + accumulatePoints: core.serialization.property("accumulate_points", LoyaltyEventAccumulatePoints.optional()), + createReward: core.serialization.property("create_reward", LoyaltyEventCreateReward.optional()), + redeemReward: core.serialization.property("redeem_reward", LoyaltyEventRedeemReward.optional()), + deleteReward: core.serialization.property("delete_reward", LoyaltyEventDeleteReward.optional()), + adjustPoints: core.serialization.property("adjust_points", LoyaltyEventAdjustPoints.optional()), + loyaltyAccountId: core.serialization.property("loyalty_account_id", core.serialization.string()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + source: LoyaltyEventSource, + expirePoints: core.serialization.property("expire_points", LoyaltyEventExpirePoints.optional()), + otherEvent: core.serialization.property("other_event", LoyaltyEventOther.optional()), + accumulatePromotionPoints: core.serialization.property( + "accumulate_promotion_points", + LoyaltyEventAccumulatePromotionPoints.optional(), + ), + }); + +export declare namespace LoyaltyEvent { + export interface Raw { + id: string; + type: LoyaltyEventType.Raw; + created_at: string; + accumulate_points?: LoyaltyEventAccumulatePoints.Raw | null; + create_reward?: LoyaltyEventCreateReward.Raw | null; + redeem_reward?: LoyaltyEventRedeemReward.Raw | null; + delete_reward?: LoyaltyEventDeleteReward.Raw | null; + adjust_points?: LoyaltyEventAdjustPoints.Raw | null; + loyalty_account_id: string; + location_id?: string | null; + source: LoyaltyEventSource.Raw; + expire_points?: LoyaltyEventExpirePoints.Raw | null; + other_event?: LoyaltyEventOther.Raw | null; + accumulate_promotion_points?: LoyaltyEventAccumulatePromotionPoints.Raw | null; + } +} diff --git a/src/serialization/types/LoyaltyEventAccumulatePoints.ts b/src/serialization/types/LoyaltyEventAccumulatePoints.ts new file mode 100644 index 000000000..d04eda5e4 --- /dev/null +++ b/src/serialization/types/LoyaltyEventAccumulatePoints.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventAccumulatePoints: core.serialization.ObjectSchema< + serializers.LoyaltyEventAccumulatePoints.Raw, + Square.LoyaltyEventAccumulatePoints +> = core.serialization.object({ + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string().optional()), + points: core.serialization.number().optionalNullable(), + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace LoyaltyEventAccumulatePoints { + export interface Raw { + loyalty_program_id?: string | null; + points?: (number | null) | null; + order_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/LoyaltyEventAccumulatePromotionPoints.ts b/src/serialization/types/LoyaltyEventAccumulatePromotionPoints.ts new file mode 100644 index 000000000..9dc6ca59a --- /dev/null +++ b/src/serialization/types/LoyaltyEventAccumulatePromotionPoints.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventAccumulatePromotionPoints: core.serialization.ObjectSchema< + serializers.LoyaltyEventAccumulatePromotionPoints.Raw, + Square.LoyaltyEventAccumulatePromotionPoints +> = core.serialization.object({ + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string().optional()), + loyaltyPromotionId: core.serialization.property("loyalty_promotion_id", core.serialization.string().optional()), + points: core.serialization.number(), + orderId: core.serialization.property("order_id", core.serialization.string()), +}); + +export declare namespace LoyaltyEventAccumulatePromotionPoints { + export interface Raw { + loyalty_program_id?: string | null; + loyalty_promotion_id?: string | null; + points: number; + order_id: string; + } +} diff --git a/src/serialization/types/LoyaltyEventAdjustPoints.ts b/src/serialization/types/LoyaltyEventAdjustPoints.ts new file mode 100644 index 000000000..f1be0699c --- /dev/null +++ b/src/serialization/types/LoyaltyEventAdjustPoints.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventAdjustPoints: core.serialization.ObjectSchema< + serializers.LoyaltyEventAdjustPoints.Raw, + Square.LoyaltyEventAdjustPoints +> = core.serialization.object({ + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string().optional()), + points: core.serialization.number(), + reason: core.serialization.string().optionalNullable(), +}); + +export declare namespace LoyaltyEventAdjustPoints { + export interface Raw { + loyalty_program_id?: string | null; + points: number; + reason?: (string | null) | null; + } +} diff --git a/src/serialization/types/LoyaltyEventCreateReward.ts b/src/serialization/types/LoyaltyEventCreateReward.ts new file mode 100644 index 000000000..79494bb71 --- /dev/null +++ b/src/serialization/types/LoyaltyEventCreateReward.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventCreateReward: core.serialization.ObjectSchema< + serializers.LoyaltyEventCreateReward.Raw, + Square.LoyaltyEventCreateReward +> = core.serialization.object({ + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string()), + rewardId: core.serialization.property("reward_id", core.serialization.string().optional()), + points: core.serialization.number(), +}); + +export declare namespace LoyaltyEventCreateReward { + export interface Raw { + loyalty_program_id: string; + reward_id?: string | null; + points: number; + } +} diff --git a/src/serialization/types/LoyaltyEventDateTimeFilter.ts b/src/serialization/types/LoyaltyEventDateTimeFilter.ts new file mode 100644 index 000000000..c8675f7a3 --- /dev/null +++ b/src/serialization/types/LoyaltyEventDateTimeFilter.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TimeRange } from "./TimeRange"; + +export const LoyaltyEventDateTimeFilter: core.serialization.ObjectSchema< + serializers.LoyaltyEventDateTimeFilter.Raw, + Square.LoyaltyEventDateTimeFilter +> = core.serialization.object({ + createdAt: core.serialization.property("created_at", TimeRange), +}); + +export declare namespace LoyaltyEventDateTimeFilter { + export interface Raw { + created_at: TimeRange.Raw; + } +} diff --git a/src/serialization/types/LoyaltyEventDeleteReward.ts b/src/serialization/types/LoyaltyEventDeleteReward.ts new file mode 100644 index 000000000..127429a97 --- /dev/null +++ b/src/serialization/types/LoyaltyEventDeleteReward.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventDeleteReward: core.serialization.ObjectSchema< + serializers.LoyaltyEventDeleteReward.Raw, + Square.LoyaltyEventDeleteReward +> = core.serialization.object({ + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string()), + rewardId: core.serialization.property("reward_id", core.serialization.string().optional()), + points: core.serialization.number(), +}); + +export declare namespace LoyaltyEventDeleteReward { + export interface Raw { + loyalty_program_id: string; + reward_id?: string | null; + points: number; + } +} diff --git a/src/serialization/types/LoyaltyEventExpirePoints.ts b/src/serialization/types/LoyaltyEventExpirePoints.ts new file mode 100644 index 000000000..40ae08b73 --- /dev/null +++ b/src/serialization/types/LoyaltyEventExpirePoints.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventExpirePoints: core.serialization.ObjectSchema< + serializers.LoyaltyEventExpirePoints.Raw, + Square.LoyaltyEventExpirePoints +> = core.serialization.object({ + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string()), + points: core.serialization.number(), +}); + +export declare namespace LoyaltyEventExpirePoints { + export interface Raw { + loyalty_program_id: string; + points: number; + } +} diff --git a/src/serialization/types/LoyaltyEventFilter.ts b/src/serialization/types/LoyaltyEventFilter.ts new file mode 100644 index 000000000..145b2ddc6 --- /dev/null +++ b/src/serialization/types/LoyaltyEventFilter.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyEventLoyaltyAccountFilter } from "./LoyaltyEventLoyaltyAccountFilter"; +import { LoyaltyEventTypeFilter } from "./LoyaltyEventTypeFilter"; +import { LoyaltyEventDateTimeFilter } from "./LoyaltyEventDateTimeFilter"; +import { LoyaltyEventLocationFilter } from "./LoyaltyEventLocationFilter"; +import { LoyaltyEventOrderFilter } from "./LoyaltyEventOrderFilter"; + +export const LoyaltyEventFilter: core.serialization.ObjectSchema< + serializers.LoyaltyEventFilter.Raw, + Square.LoyaltyEventFilter +> = core.serialization.object({ + loyaltyAccountFilter: core.serialization.property( + "loyalty_account_filter", + LoyaltyEventLoyaltyAccountFilter.optional(), + ), + typeFilter: core.serialization.property("type_filter", LoyaltyEventTypeFilter.optional()), + dateTimeFilter: core.serialization.property("date_time_filter", LoyaltyEventDateTimeFilter.optional()), + locationFilter: core.serialization.property("location_filter", LoyaltyEventLocationFilter.optional()), + orderFilter: core.serialization.property("order_filter", LoyaltyEventOrderFilter.optional()), +}); + +export declare namespace LoyaltyEventFilter { + export interface Raw { + loyalty_account_filter?: LoyaltyEventLoyaltyAccountFilter.Raw | null; + type_filter?: LoyaltyEventTypeFilter.Raw | null; + date_time_filter?: LoyaltyEventDateTimeFilter.Raw | null; + location_filter?: LoyaltyEventLocationFilter.Raw | null; + order_filter?: LoyaltyEventOrderFilter.Raw | null; + } +} diff --git a/src/serialization/types/LoyaltyEventLocationFilter.ts b/src/serialization/types/LoyaltyEventLocationFilter.ts new file mode 100644 index 000000000..06ae6117b --- /dev/null +++ b/src/serialization/types/LoyaltyEventLocationFilter.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventLocationFilter: core.serialization.ObjectSchema< + serializers.LoyaltyEventLocationFilter.Raw, + Square.LoyaltyEventLocationFilter +> = core.serialization.object({ + locationIds: core.serialization.property("location_ids", core.serialization.list(core.serialization.string())), +}); + +export declare namespace LoyaltyEventLocationFilter { + export interface Raw { + location_ids: string[]; + } +} diff --git a/src/serialization/types/LoyaltyEventLoyaltyAccountFilter.ts b/src/serialization/types/LoyaltyEventLoyaltyAccountFilter.ts new file mode 100644 index 000000000..ea4be1b22 --- /dev/null +++ b/src/serialization/types/LoyaltyEventLoyaltyAccountFilter.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventLoyaltyAccountFilter: core.serialization.ObjectSchema< + serializers.LoyaltyEventLoyaltyAccountFilter.Raw, + Square.LoyaltyEventLoyaltyAccountFilter +> = core.serialization.object({ + loyaltyAccountId: core.serialization.property("loyalty_account_id", core.serialization.string()), +}); + +export declare namespace LoyaltyEventLoyaltyAccountFilter { + export interface Raw { + loyalty_account_id: string; + } +} diff --git a/src/serialization/types/LoyaltyEventOrderFilter.ts b/src/serialization/types/LoyaltyEventOrderFilter.ts new file mode 100644 index 000000000..60aceb6ee --- /dev/null +++ b/src/serialization/types/LoyaltyEventOrderFilter.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventOrderFilter: core.serialization.ObjectSchema< + serializers.LoyaltyEventOrderFilter.Raw, + Square.LoyaltyEventOrderFilter +> = core.serialization.object({ + orderId: core.serialization.property("order_id", core.serialization.string()), +}); + +export declare namespace LoyaltyEventOrderFilter { + export interface Raw { + order_id: string; + } +} diff --git a/src/serialization/types/LoyaltyEventOther.ts b/src/serialization/types/LoyaltyEventOther.ts new file mode 100644 index 000000000..f099788e7 --- /dev/null +++ b/src/serialization/types/LoyaltyEventOther.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventOther: core.serialization.ObjectSchema< + serializers.LoyaltyEventOther.Raw, + Square.LoyaltyEventOther +> = core.serialization.object({ + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string()), + points: core.serialization.number(), +}); + +export declare namespace LoyaltyEventOther { + export interface Raw { + loyalty_program_id: string; + points: number; + } +} diff --git a/src/serialization/types/LoyaltyEventQuery.ts b/src/serialization/types/LoyaltyEventQuery.ts new file mode 100644 index 000000000..f85d5e9c4 --- /dev/null +++ b/src/serialization/types/LoyaltyEventQuery.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyEventFilter } from "./LoyaltyEventFilter"; + +export const LoyaltyEventQuery: core.serialization.ObjectSchema< + serializers.LoyaltyEventQuery.Raw, + Square.LoyaltyEventQuery +> = core.serialization.object({ + filter: LoyaltyEventFilter.optional(), +}); + +export declare namespace LoyaltyEventQuery { + export interface Raw { + filter?: LoyaltyEventFilter.Raw | null; + } +} diff --git a/src/serialization/types/LoyaltyEventRedeemReward.ts b/src/serialization/types/LoyaltyEventRedeemReward.ts new file mode 100644 index 000000000..8cdd13d2a --- /dev/null +++ b/src/serialization/types/LoyaltyEventRedeemReward.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventRedeemReward: core.serialization.ObjectSchema< + serializers.LoyaltyEventRedeemReward.Raw, + Square.LoyaltyEventRedeemReward +> = core.serialization.object({ + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string()), + rewardId: core.serialization.property("reward_id", core.serialization.string().optional()), + orderId: core.serialization.property("order_id", core.serialization.string().optional()), +}); + +export declare namespace LoyaltyEventRedeemReward { + export interface Raw { + loyalty_program_id: string; + reward_id?: string | null; + order_id?: string | null; + } +} diff --git a/src/serialization/types/LoyaltyEventSource.ts b/src/serialization/types/LoyaltyEventSource.ts new file mode 100644 index 000000000..db9ffcaed --- /dev/null +++ b/src/serialization/types/LoyaltyEventSource.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventSource: core.serialization.Schema< + serializers.LoyaltyEventSource.Raw, + Square.LoyaltyEventSource +> = core.serialization.enum_(["SQUARE", "LOYALTY_API"]); + +export declare namespace LoyaltyEventSource { + export type Raw = "SQUARE" | "LOYALTY_API"; +} diff --git a/src/serialization/types/LoyaltyEventType.ts b/src/serialization/types/LoyaltyEventType.ts new file mode 100644 index 000000000..7dca763aa --- /dev/null +++ b/src/serialization/types/LoyaltyEventType.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyEventType: core.serialization.Schema = + core.serialization.enum_([ + "ACCUMULATE_POINTS", + "CREATE_REWARD", + "REDEEM_REWARD", + "DELETE_REWARD", + "ADJUST_POINTS", + "EXPIRE_POINTS", + "OTHER", + "ACCUMULATE_PROMOTION_POINTS", + ]); + +export declare namespace LoyaltyEventType { + export type Raw = + | "ACCUMULATE_POINTS" + | "CREATE_REWARD" + | "REDEEM_REWARD" + | "DELETE_REWARD" + | "ADJUST_POINTS" + | "EXPIRE_POINTS" + | "OTHER" + | "ACCUMULATE_PROMOTION_POINTS"; +} diff --git a/src/serialization/types/LoyaltyEventTypeFilter.ts b/src/serialization/types/LoyaltyEventTypeFilter.ts new file mode 100644 index 000000000..405b69228 --- /dev/null +++ b/src/serialization/types/LoyaltyEventTypeFilter.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyEventType } from "./LoyaltyEventType"; + +export const LoyaltyEventTypeFilter: core.serialization.ObjectSchema< + serializers.LoyaltyEventTypeFilter.Raw, + Square.LoyaltyEventTypeFilter +> = core.serialization.object({ + types: core.serialization.list(LoyaltyEventType), +}); + +export declare namespace LoyaltyEventTypeFilter { + export interface Raw { + types: LoyaltyEventType.Raw[]; + } +} diff --git a/src/serialization/types/LoyaltyProgram.ts b/src/serialization/types/LoyaltyProgram.ts new file mode 100644 index 000000000..d020c5377 --- /dev/null +++ b/src/serialization/types/LoyaltyProgram.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyProgramStatus } from "./LoyaltyProgramStatus"; +import { LoyaltyProgramRewardTier } from "./LoyaltyProgramRewardTier"; +import { LoyaltyProgramExpirationPolicy } from "./LoyaltyProgramExpirationPolicy"; +import { LoyaltyProgramTerminology } from "./LoyaltyProgramTerminology"; +import { LoyaltyProgramAccrualRule } from "./LoyaltyProgramAccrualRule"; + +export const LoyaltyProgram: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + status: LoyaltyProgramStatus.optional(), + rewardTiers: core.serialization.property( + "reward_tiers", + core.serialization.list(LoyaltyProgramRewardTier).optionalNullable(), + ), + expirationPolicy: core.serialization.property("expiration_policy", LoyaltyProgramExpirationPolicy.optional()), + terminology: LoyaltyProgramTerminology.optional(), + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + accrualRules: core.serialization.property( + "accrual_rules", + core.serialization.list(LoyaltyProgramAccrualRule).optionalNullable(), + ), + }); + +export declare namespace LoyaltyProgram { + export interface Raw { + id?: string | null; + status?: LoyaltyProgramStatus.Raw | null; + reward_tiers?: (LoyaltyProgramRewardTier.Raw[] | null) | null; + expiration_policy?: LoyaltyProgramExpirationPolicy.Raw | null; + terminology?: LoyaltyProgramTerminology.Raw | null; + location_ids?: (string[] | null) | null; + created_at?: string | null; + updated_at?: string | null; + accrual_rules?: (LoyaltyProgramAccrualRule.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/LoyaltyProgramAccrualRule.ts b/src/serialization/types/LoyaltyProgramAccrualRule.ts new file mode 100644 index 000000000..d24f34354 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramAccrualRule.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyProgramAccrualRuleType } from "./LoyaltyProgramAccrualRuleType"; +import { LoyaltyProgramAccrualRuleVisitData } from "./LoyaltyProgramAccrualRuleVisitData"; +import { LoyaltyProgramAccrualRuleSpendData } from "./LoyaltyProgramAccrualRuleSpendData"; +import { LoyaltyProgramAccrualRuleItemVariationData } from "./LoyaltyProgramAccrualRuleItemVariationData"; +import { LoyaltyProgramAccrualRuleCategoryData } from "./LoyaltyProgramAccrualRuleCategoryData"; + +export const LoyaltyProgramAccrualRule: core.serialization.ObjectSchema< + serializers.LoyaltyProgramAccrualRule.Raw, + Square.LoyaltyProgramAccrualRule +> = core.serialization.object({ + accrualType: core.serialization.property("accrual_type", LoyaltyProgramAccrualRuleType), + points: core.serialization.number().optionalNullable(), + visitData: core.serialization.property("visit_data", LoyaltyProgramAccrualRuleVisitData.optional()), + spendData: core.serialization.property("spend_data", LoyaltyProgramAccrualRuleSpendData.optional()), + itemVariationData: core.serialization.property( + "item_variation_data", + LoyaltyProgramAccrualRuleItemVariationData.optional(), + ), + categoryData: core.serialization.property("category_data", LoyaltyProgramAccrualRuleCategoryData.optional()), +}); + +export declare namespace LoyaltyProgramAccrualRule { + export interface Raw { + accrual_type: LoyaltyProgramAccrualRuleType.Raw; + points?: (number | null) | null; + visit_data?: LoyaltyProgramAccrualRuleVisitData.Raw | null; + spend_data?: LoyaltyProgramAccrualRuleSpendData.Raw | null; + item_variation_data?: LoyaltyProgramAccrualRuleItemVariationData.Raw | null; + category_data?: LoyaltyProgramAccrualRuleCategoryData.Raw | null; + } +} diff --git a/src/serialization/types/LoyaltyProgramAccrualRuleCategoryData.ts b/src/serialization/types/LoyaltyProgramAccrualRuleCategoryData.ts new file mode 100644 index 000000000..f528cfad6 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramAccrualRuleCategoryData.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramAccrualRuleCategoryData: core.serialization.ObjectSchema< + serializers.LoyaltyProgramAccrualRuleCategoryData.Raw, + Square.LoyaltyProgramAccrualRuleCategoryData +> = core.serialization.object({ + categoryId: core.serialization.property("category_id", core.serialization.string()), +}); + +export declare namespace LoyaltyProgramAccrualRuleCategoryData { + export interface Raw { + category_id: string; + } +} diff --git a/src/serialization/types/LoyaltyProgramAccrualRuleItemVariationData.ts b/src/serialization/types/LoyaltyProgramAccrualRuleItemVariationData.ts new file mode 100644 index 000000000..afd62c584 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramAccrualRuleItemVariationData.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramAccrualRuleItemVariationData: core.serialization.ObjectSchema< + serializers.LoyaltyProgramAccrualRuleItemVariationData.Raw, + Square.LoyaltyProgramAccrualRuleItemVariationData +> = core.serialization.object({ + itemVariationId: core.serialization.property("item_variation_id", core.serialization.string()), +}); + +export declare namespace LoyaltyProgramAccrualRuleItemVariationData { + export interface Raw { + item_variation_id: string; + } +} diff --git a/src/serialization/types/LoyaltyProgramAccrualRuleSpendData.ts b/src/serialization/types/LoyaltyProgramAccrualRuleSpendData.ts new file mode 100644 index 000000000..392662f9c --- /dev/null +++ b/src/serialization/types/LoyaltyProgramAccrualRuleSpendData.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { LoyaltyProgramAccrualRuleTaxMode } from "./LoyaltyProgramAccrualRuleTaxMode"; + +export const LoyaltyProgramAccrualRuleSpendData: core.serialization.ObjectSchema< + serializers.LoyaltyProgramAccrualRuleSpendData.Raw, + Square.LoyaltyProgramAccrualRuleSpendData +> = core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money), + excludedCategoryIds: core.serialization.property( + "excluded_category_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + excludedItemVariationIds: core.serialization.property( + "excluded_item_variation_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + taxMode: core.serialization.property("tax_mode", LoyaltyProgramAccrualRuleTaxMode), +}); + +export declare namespace LoyaltyProgramAccrualRuleSpendData { + export interface Raw { + amount_money: Money.Raw; + excluded_category_ids?: (string[] | null) | null; + excluded_item_variation_ids?: (string[] | null) | null; + tax_mode: LoyaltyProgramAccrualRuleTaxMode.Raw; + } +} diff --git a/src/serialization/types/LoyaltyProgramAccrualRuleTaxMode.ts b/src/serialization/types/LoyaltyProgramAccrualRuleTaxMode.ts new file mode 100644 index 000000000..cda917057 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramAccrualRuleTaxMode.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramAccrualRuleTaxMode: core.serialization.Schema< + serializers.LoyaltyProgramAccrualRuleTaxMode.Raw, + Square.LoyaltyProgramAccrualRuleTaxMode +> = core.serialization.enum_(["BEFORE_TAX", "AFTER_TAX"]); + +export declare namespace LoyaltyProgramAccrualRuleTaxMode { + export type Raw = "BEFORE_TAX" | "AFTER_TAX"; +} diff --git a/src/serialization/types/LoyaltyProgramAccrualRuleType.ts b/src/serialization/types/LoyaltyProgramAccrualRuleType.ts new file mode 100644 index 000000000..76c2c16a0 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramAccrualRuleType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramAccrualRuleType: core.serialization.Schema< + serializers.LoyaltyProgramAccrualRuleType.Raw, + Square.LoyaltyProgramAccrualRuleType +> = core.serialization.enum_(["VISIT", "SPEND", "ITEM_VARIATION", "CATEGORY"]); + +export declare namespace LoyaltyProgramAccrualRuleType { + export type Raw = "VISIT" | "SPEND" | "ITEM_VARIATION" | "CATEGORY"; +} diff --git a/src/serialization/types/LoyaltyProgramAccrualRuleVisitData.ts b/src/serialization/types/LoyaltyProgramAccrualRuleVisitData.ts new file mode 100644 index 000000000..55869b831 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramAccrualRuleVisitData.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { LoyaltyProgramAccrualRuleTaxMode } from "./LoyaltyProgramAccrualRuleTaxMode"; + +export const LoyaltyProgramAccrualRuleVisitData: core.serialization.ObjectSchema< + serializers.LoyaltyProgramAccrualRuleVisitData.Raw, + Square.LoyaltyProgramAccrualRuleVisitData +> = core.serialization.object({ + minimumAmountMoney: core.serialization.property("minimum_amount_money", Money.optional()), + taxMode: core.serialization.property("tax_mode", LoyaltyProgramAccrualRuleTaxMode), +}); + +export declare namespace LoyaltyProgramAccrualRuleVisitData { + export interface Raw { + minimum_amount_money?: Money.Raw | null; + tax_mode: LoyaltyProgramAccrualRuleTaxMode.Raw; + } +} diff --git a/src/serialization/types/LoyaltyProgramExpirationPolicy.ts b/src/serialization/types/LoyaltyProgramExpirationPolicy.ts new file mode 100644 index 000000000..46559ff5e --- /dev/null +++ b/src/serialization/types/LoyaltyProgramExpirationPolicy.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramExpirationPolicy: core.serialization.ObjectSchema< + serializers.LoyaltyProgramExpirationPolicy.Raw, + Square.LoyaltyProgramExpirationPolicy +> = core.serialization.object({ + expirationDuration: core.serialization.property("expiration_duration", core.serialization.string()), +}); + +export declare namespace LoyaltyProgramExpirationPolicy { + export interface Raw { + expiration_duration: string; + } +} diff --git a/src/serialization/types/LoyaltyProgramRewardDefinition.ts b/src/serialization/types/LoyaltyProgramRewardDefinition.ts new file mode 100644 index 000000000..c32847cd9 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramRewardDefinition.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyProgramRewardDefinitionScope } from "./LoyaltyProgramRewardDefinitionScope"; +import { LoyaltyProgramRewardDefinitionType } from "./LoyaltyProgramRewardDefinitionType"; +import { Money } from "./Money"; + +export const LoyaltyProgramRewardDefinition: core.serialization.ObjectSchema< + serializers.LoyaltyProgramRewardDefinition.Raw, + Square.LoyaltyProgramRewardDefinition +> = core.serialization.object({ + scope: LoyaltyProgramRewardDefinitionScope, + discountType: core.serialization.property("discount_type", LoyaltyProgramRewardDefinitionType), + percentageDiscount: core.serialization.property("percentage_discount", core.serialization.string().optional()), + catalogObjectIds: core.serialization.property( + "catalog_object_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + fixedDiscountMoney: core.serialization.property("fixed_discount_money", Money.optional()), + maxDiscountMoney: core.serialization.property("max_discount_money", Money.optional()), +}); + +export declare namespace LoyaltyProgramRewardDefinition { + export interface Raw { + scope: LoyaltyProgramRewardDefinitionScope.Raw; + discount_type: LoyaltyProgramRewardDefinitionType.Raw; + percentage_discount?: string | null; + catalog_object_ids?: string[] | null; + fixed_discount_money?: Money.Raw | null; + max_discount_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/LoyaltyProgramRewardDefinitionScope.ts b/src/serialization/types/LoyaltyProgramRewardDefinitionScope.ts new file mode 100644 index 000000000..bc58e4f6e --- /dev/null +++ b/src/serialization/types/LoyaltyProgramRewardDefinitionScope.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramRewardDefinitionScope: core.serialization.Schema< + serializers.LoyaltyProgramRewardDefinitionScope.Raw, + Square.LoyaltyProgramRewardDefinitionScope +> = core.serialization.enum_(["ORDER", "ITEM_VARIATION", "CATEGORY"]); + +export declare namespace LoyaltyProgramRewardDefinitionScope { + export type Raw = "ORDER" | "ITEM_VARIATION" | "CATEGORY"; +} diff --git a/src/serialization/types/LoyaltyProgramRewardDefinitionType.ts b/src/serialization/types/LoyaltyProgramRewardDefinitionType.ts new file mode 100644 index 000000000..3f1f11f61 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramRewardDefinitionType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramRewardDefinitionType: core.serialization.Schema< + serializers.LoyaltyProgramRewardDefinitionType.Raw, + Square.LoyaltyProgramRewardDefinitionType +> = core.serialization.enum_(["FIXED_AMOUNT", "FIXED_PERCENTAGE"]); + +export declare namespace LoyaltyProgramRewardDefinitionType { + export type Raw = "FIXED_AMOUNT" | "FIXED_PERCENTAGE"; +} diff --git a/src/serialization/types/LoyaltyProgramRewardTier.ts b/src/serialization/types/LoyaltyProgramRewardTier.ts new file mode 100644 index 000000000..ae1c4a9dc --- /dev/null +++ b/src/serialization/types/LoyaltyProgramRewardTier.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyProgramRewardDefinition } from "./LoyaltyProgramRewardDefinition"; +import { CatalogObjectReference } from "./CatalogObjectReference"; + +export const LoyaltyProgramRewardTier: core.serialization.ObjectSchema< + serializers.LoyaltyProgramRewardTier.Raw, + Square.LoyaltyProgramRewardTier +> = core.serialization.object({ + id: core.serialization.string().optional(), + points: core.serialization.number(), + name: core.serialization.string().optional(), + definition: LoyaltyProgramRewardDefinition.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + pricingRuleReference: core.serialization.property("pricing_rule_reference", CatalogObjectReference), +}); + +export declare namespace LoyaltyProgramRewardTier { + export interface Raw { + id?: string | null; + points: number; + name?: string | null; + definition?: LoyaltyProgramRewardDefinition.Raw | null; + created_at?: string | null; + pricing_rule_reference: CatalogObjectReference.Raw; + } +} diff --git a/src/serialization/types/LoyaltyProgramStatus.ts b/src/serialization/types/LoyaltyProgramStatus.ts new file mode 100644 index 000000000..437b0cc79 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramStatus: core.serialization.Schema< + serializers.LoyaltyProgramStatus.Raw, + Square.LoyaltyProgramStatus +> = core.serialization.enum_(["INACTIVE", "ACTIVE"]); + +export declare namespace LoyaltyProgramStatus { + export type Raw = "INACTIVE" | "ACTIVE"; +} diff --git a/src/serialization/types/LoyaltyProgramTerminology.ts b/src/serialization/types/LoyaltyProgramTerminology.ts new file mode 100644 index 000000000..5f9aa7b54 --- /dev/null +++ b/src/serialization/types/LoyaltyProgramTerminology.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyProgramTerminology: core.serialization.ObjectSchema< + serializers.LoyaltyProgramTerminology.Raw, + Square.LoyaltyProgramTerminology +> = core.serialization.object({ + one: core.serialization.string(), + other: core.serialization.string(), +}); + +export declare namespace LoyaltyProgramTerminology { + export interface Raw { + one: string; + other: string; + } +} diff --git a/src/serialization/types/LoyaltyPromotion.ts b/src/serialization/types/LoyaltyPromotion.ts new file mode 100644 index 000000000..aaf228eb2 --- /dev/null +++ b/src/serialization/types/LoyaltyPromotion.ts @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyPromotionIncentive } from "./LoyaltyPromotionIncentive"; +import { LoyaltyPromotionAvailableTimeData } from "./LoyaltyPromotionAvailableTimeData"; +import { LoyaltyPromotionTriggerLimit } from "./LoyaltyPromotionTriggerLimit"; +import { LoyaltyPromotionStatus } from "./LoyaltyPromotionStatus"; +import { Money } from "./Money"; + +export const LoyaltyPromotion: core.serialization.ObjectSchema< + serializers.LoyaltyPromotion.Raw, + Square.LoyaltyPromotion +> = core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string(), + incentive: LoyaltyPromotionIncentive, + availableTime: core.serialization.property("available_time", LoyaltyPromotionAvailableTimeData), + triggerLimit: core.serialization.property("trigger_limit", LoyaltyPromotionTriggerLimit.optional()), + status: LoyaltyPromotionStatus.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + canceledAt: core.serialization.property("canceled_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + loyaltyProgramId: core.serialization.property("loyalty_program_id", core.serialization.string().optional()), + minimumSpendAmountMoney: core.serialization.property("minimum_spend_amount_money", Money.optional()), + qualifyingItemVariationIds: core.serialization.property( + "qualifying_item_variation_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + qualifyingCategoryIds: core.serialization.property( + "qualifying_category_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace LoyaltyPromotion { + export interface Raw { + id?: string | null; + name: string; + incentive: LoyaltyPromotionIncentive.Raw; + available_time: LoyaltyPromotionAvailableTimeData.Raw; + trigger_limit?: LoyaltyPromotionTriggerLimit.Raw | null; + status?: LoyaltyPromotionStatus.Raw | null; + created_at?: string | null; + canceled_at?: string | null; + updated_at?: string | null; + loyalty_program_id?: string | null; + minimum_spend_amount_money?: Money.Raw | null; + qualifying_item_variation_ids?: (string[] | null) | null; + qualifying_category_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/LoyaltyPromotionAvailableTimeData.ts b/src/serialization/types/LoyaltyPromotionAvailableTimeData.ts new file mode 100644 index 000000000..f7b34ac92 --- /dev/null +++ b/src/serialization/types/LoyaltyPromotionAvailableTimeData.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyPromotionAvailableTimeData: core.serialization.ObjectSchema< + serializers.LoyaltyPromotionAvailableTimeData.Raw, + Square.LoyaltyPromotionAvailableTimeData +> = core.serialization.object({ + startDate: core.serialization.property("start_date", core.serialization.string().optional()), + endDate: core.serialization.property("end_date", core.serialization.string().optional()), + timePeriods: core.serialization.property("time_periods", core.serialization.list(core.serialization.string())), +}); + +export declare namespace LoyaltyPromotionAvailableTimeData { + export interface Raw { + start_date?: string | null; + end_date?: string | null; + time_periods: string[]; + } +} diff --git a/src/serialization/types/LoyaltyPromotionIncentive.ts b/src/serialization/types/LoyaltyPromotionIncentive.ts new file mode 100644 index 000000000..0301b9d63 --- /dev/null +++ b/src/serialization/types/LoyaltyPromotionIncentive.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyPromotionIncentiveType } from "./LoyaltyPromotionIncentiveType"; +import { LoyaltyPromotionIncentivePointsMultiplierData } from "./LoyaltyPromotionIncentivePointsMultiplierData"; +import { LoyaltyPromotionIncentivePointsAdditionData } from "./LoyaltyPromotionIncentivePointsAdditionData"; + +export const LoyaltyPromotionIncentive: core.serialization.ObjectSchema< + serializers.LoyaltyPromotionIncentive.Raw, + Square.LoyaltyPromotionIncentive +> = core.serialization.object({ + type: LoyaltyPromotionIncentiveType, + pointsMultiplierData: core.serialization.property( + "points_multiplier_data", + LoyaltyPromotionIncentivePointsMultiplierData.optional(), + ), + pointsAdditionData: core.serialization.property( + "points_addition_data", + LoyaltyPromotionIncentivePointsAdditionData.optional(), + ), +}); + +export declare namespace LoyaltyPromotionIncentive { + export interface Raw { + type: LoyaltyPromotionIncentiveType.Raw; + points_multiplier_data?: LoyaltyPromotionIncentivePointsMultiplierData.Raw | null; + points_addition_data?: LoyaltyPromotionIncentivePointsAdditionData.Raw | null; + } +} diff --git a/src/serialization/types/LoyaltyPromotionIncentivePointsAdditionData.ts b/src/serialization/types/LoyaltyPromotionIncentivePointsAdditionData.ts new file mode 100644 index 000000000..8b0ed9225 --- /dev/null +++ b/src/serialization/types/LoyaltyPromotionIncentivePointsAdditionData.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyPromotionIncentivePointsAdditionData: core.serialization.ObjectSchema< + serializers.LoyaltyPromotionIncentivePointsAdditionData.Raw, + Square.LoyaltyPromotionIncentivePointsAdditionData +> = core.serialization.object({ + pointsAddition: core.serialization.property("points_addition", core.serialization.number()), +}); + +export declare namespace LoyaltyPromotionIncentivePointsAdditionData { + export interface Raw { + points_addition: number; + } +} diff --git a/src/serialization/types/LoyaltyPromotionIncentivePointsMultiplierData.ts b/src/serialization/types/LoyaltyPromotionIncentivePointsMultiplierData.ts new file mode 100644 index 000000000..97309104c --- /dev/null +++ b/src/serialization/types/LoyaltyPromotionIncentivePointsMultiplierData.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyPromotionIncentivePointsMultiplierData: core.serialization.ObjectSchema< + serializers.LoyaltyPromotionIncentivePointsMultiplierData.Raw, + Square.LoyaltyPromotionIncentivePointsMultiplierData +> = core.serialization.object({ + pointsMultiplier: core.serialization.property("points_multiplier", core.serialization.number().optionalNullable()), + multiplier: core.serialization.string().optionalNullable(), +}); + +export declare namespace LoyaltyPromotionIncentivePointsMultiplierData { + export interface Raw { + points_multiplier?: (number | null) | null; + multiplier?: (string | null) | null; + } +} diff --git a/src/serialization/types/LoyaltyPromotionIncentiveType.ts b/src/serialization/types/LoyaltyPromotionIncentiveType.ts new file mode 100644 index 000000000..11ce60a53 --- /dev/null +++ b/src/serialization/types/LoyaltyPromotionIncentiveType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyPromotionIncentiveType: core.serialization.Schema< + serializers.LoyaltyPromotionIncentiveType.Raw, + Square.LoyaltyPromotionIncentiveType +> = core.serialization.enum_(["POINTS_MULTIPLIER", "POINTS_ADDITION"]); + +export declare namespace LoyaltyPromotionIncentiveType { + export type Raw = "POINTS_MULTIPLIER" | "POINTS_ADDITION"; +} diff --git a/src/serialization/types/LoyaltyPromotionStatus.ts b/src/serialization/types/LoyaltyPromotionStatus.ts new file mode 100644 index 000000000..248bc733e --- /dev/null +++ b/src/serialization/types/LoyaltyPromotionStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyPromotionStatus: core.serialization.Schema< + serializers.LoyaltyPromotionStatus.Raw, + Square.LoyaltyPromotionStatus +> = core.serialization.enum_(["ACTIVE", "ENDED", "CANCELED", "SCHEDULED"]); + +export declare namespace LoyaltyPromotionStatus { + export type Raw = "ACTIVE" | "ENDED" | "CANCELED" | "SCHEDULED"; +} diff --git a/src/serialization/types/LoyaltyPromotionTriggerLimit.ts b/src/serialization/types/LoyaltyPromotionTriggerLimit.ts new file mode 100644 index 000000000..98aef06d2 --- /dev/null +++ b/src/serialization/types/LoyaltyPromotionTriggerLimit.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyPromotionTriggerLimitInterval } from "./LoyaltyPromotionTriggerLimitInterval"; + +export const LoyaltyPromotionTriggerLimit: core.serialization.ObjectSchema< + serializers.LoyaltyPromotionTriggerLimit.Raw, + Square.LoyaltyPromotionTriggerLimit +> = core.serialization.object({ + times: core.serialization.number(), + interval: LoyaltyPromotionTriggerLimitInterval.optional(), +}); + +export declare namespace LoyaltyPromotionTriggerLimit { + export interface Raw { + times: number; + interval?: LoyaltyPromotionTriggerLimitInterval.Raw | null; + } +} diff --git a/src/serialization/types/LoyaltyPromotionTriggerLimitInterval.ts b/src/serialization/types/LoyaltyPromotionTriggerLimitInterval.ts new file mode 100644 index 000000000..ee4f88df7 --- /dev/null +++ b/src/serialization/types/LoyaltyPromotionTriggerLimitInterval.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyPromotionTriggerLimitInterval: core.serialization.Schema< + serializers.LoyaltyPromotionTriggerLimitInterval.Raw, + Square.LoyaltyPromotionTriggerLimitInterval +> = core.serialization.enum_(["ALL_TIME", "DAY"]); + +export declare namespace LoyaltyPromotionTriggerLimitInterval { + export type Raw = "ALL_TIME" | "DAY"; +} diff --git a/src/serialization/types/LoyaltyReward.ts b/src/serialization/types/LoyaltyReward.ts new file mode 100644 index 000000000..5eaeb90bc --- /dev/null +++ b/src/serialization/types/LoyaltyReward.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyRewardStatus } from "./LoyaltyRewardStatus"; + +export const LoyaltyReward: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + status: LoyaltyRewardStatus.optional(), + loyaltyAccountId: core.serialization.property("loyalty_account_id", core.serialization.string()), + rewardTierId: core.serialization.property("reward_tier_id", core.serialization.string()), + points: core.serialization.number().optional(), + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + redeemedAt: core.serialization.property("redeemed_at", core.serialization.string().optional()), + }); + +export declare namespace LoyaltyReward { + export interface Raw { + id?: string | null; + status?: LoyaltyRewardStatus.Raw | null; + loyalty_account_id: string; + reward_tier_id: string; + points?: number | null; + order_id?: (string | null) | null; + created_at?: string | null; + updated_at?: string | null; + redeemed_at?: string | null; + } +} diff --git a/src/serialization/types/LoyaltyRewardStatus.ts b/src/serialization/types/LoyaltyRewardStatus.ts new file mode 100644 index 000000000..73204b87a --- /dev/null +++ b/src/serialization/types/LoyaltyRewardStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const LoyaltyRewardStatus: core.serialization.Schema< + serializers.LoyaltyRewardStatus.Raw, + Square.LoyaltyRewardStatus +> = core.serialization.enum_(["ISSUED", "REDEEMED", "DELETED"]); + +export declare namespace LoyaltyRewardStatus { + export type Raw = "ISSUED" | "REDEEMED" | "DELETED"; +} diff --git a/src/serialization/types/MeasurementUnit.ts b/src/serialization/types/MeasurementUnit.ts new file mode 100644 index 000000000..b567cfbe7 --- /dev/null +++ b/src/serialization/types/MeasurementUnit.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { MeasurementUnitCustom } from "./MeasurementUnitCustom"; +import { MeasurementUnitArea } from "./MeasurementUnitArea"; +import { MeasurementUnitLength } from "./MeasurementUnitLength"; +import { MeasurementUnitVolume } from "./MeasurementUnitVolume"; +import { MeasurementUnitWeight } from "./MeasurementUnitWeight"; +import { MeasurementUnitGeneric } from "./MeasurementUnitGeneric"; +import { MeasurementUnitTime } from "./MeasurementUnitTime"; +import { MeasurementUnitUnitType } from "./MeasurementUnitUnitType"; + +export const MeasurementUnit: core.serialization.ObjectSchema = + core.serialization.object({ + customUnit: core.serialization.property("custom_unit", MeasurementUnitCustom.optional()), + areaUnit: core.serialization.property("area_unit", MeasurementUnitArea.optional()), + lengthUnit: core.serialization.property("length_unit", MeasurementUnitLength.optional()), + volumeUnit: core.serialization.property("volume_unit", MeasurementUnitVolume.optional()), + weightUnit: core.serialization.property("weight_unit", MeasurementUnitWeight.optional()), + genericUnit: core.serialization.property("generic_unit", MeasurementUnitGeneric.optional()), + timeUnit: core.serialization.property("time_unit", MeasurementUnitTime.optional()), + type: MeasurementUnitUnitType.optional(), + }); + +export declare namespace MeasurementUnit { + export interface Raw { + custom_unit?: MeasurementUnitCustom.Raw | null; + area_unit?: MeasurementUnitArea.Raw | null; + length_unit?: MeasurementUnitLength.Raw | null; + volume_unit?: MeasurementUnitVolume.Raw | null; + weight_unit?: MeasurementUnitWeight.Raw | null; + generic_unit?: MeasurementUnitGeneric.Raw | null; + time_unit?: MeasurementUnitTime.Raw | null; + type?: MeasurementUnitUnitType.Raw | null; + } +} diff --git a/src/serialization/types/MeasurementUnitArea.ts b/src/serialization/types/MeasurementUnitArea.ts new file mode 100644 index 000000000..b6e8bb363 --- /dev/null +++ b/src/serialization/types/MeasurementUnitArea.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MeasurementUnitArea: core.serialization.Schema< + serializers.MeasurementUnitArea.Raw, + Square.MeasurementUnitArea +> = core.serialization.enum_([ + "IMPERIAL_ACRE", + "IMPERIAL_SQUARE_INCH", + "IMPERIAL_SQUARE_FOOT", + "IMPERIAL_SQUARE_YARD", + "IMPERIAL_SQUARE_MILE", + "METRIC_SQUARE_CENTIMETER", + "METRIC_SQUARE_METER", + "METRIC_SQUARE_KILOMETER", +]); + +export declare namespace MeasurementUnitArea { + export type Raw = + | "IMPERIAL_ACRE" + | "IMPERIAL_SQUARE_INCH" + | "IMPERIAL_SQUARE_FOOT" + | "IMPERIAL_SQUARE_YARD" + | "IMPERIAL_SQUARE_MILE" + | "METRIC_SQUARE_CENTIMETER" + | "METRIC_SQUARE_METER" + | "METRIC_SQUARE_KILOMETER"; +} diff --git a/src/serialization/types/MeasurementUnitCustom.ts b/src/serialization/types/MeasurementUnitCustom.ts new file mode 100644 index 000000000..c1a9688ac --- /dev/null +++ b/src/serialization/types/MeasurementUnitCustom.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MeasurementUnitCustom: core.serialization.ObjectSchema< + serializers.MeasurementUnitCustom.Raw, + Square.MeasurementUnitCustom +> = core.serialization.object({ + name: core.serialization.string(), + abbreviation: core.serialization.string(), +}); + +export declare namespace MeasurementUnitCustom { + export interface Raw { + name: string; + abbreviation: string; + } +} diff --git a/src/serialization/types/MeasurementUnitGeneric.ts b/src/serialization/types/MeasurementUnitGeneric.ts new file mode 100644 index 000000000..c2a5a8fa6 --- /dev/null +++ b/src/serialization/types/MeasurementUnitGeneric.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MeasurementUnitGeneric: core.serialization.Schema< + serializers.MeasurementUnitGeneric.Raw, + Square.MeasurementUnitGeneric +> = core.serialization.stringLiteral("UNIT"); + +export declare namespace MeasurementUnitGeneric { + export type Raw = "UNIT"; +} diff --git a/src/serialization/types/MeasurementUnitLength.ts b/src/serialization/types/MeasurementUnitLength.ts new file mode 100644 index 000000000..f2bbedab8 --- /dev/null +++ b/src/serialization/types/MeasurementUnitLength.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MeasurementUnitLength: core.serialization.Schema< + serializers.MeasurementUnitLength.Raw, + Square.MeasurementUnitLength +> = core.serialization.enum_([ + "IMPERIAL_INCH", + "IMPERIAL_FOOT", + "IMPERIAL_YARD", + "IMPERIAL_MILE", + "METRIC_MILLIMETER", + "METRIC_CENTIMETER", + "METRIC_METER", + "METRIC_KILOMETER", +]); + +export declare namespace MeasurementUnitLength { + export type Raw = + | "IMPERIAL_INCH" + | "IMPERIAL_FOOT" + | "IMPERIAL_YARD" + | "IMPERIAL_MILE" + | "METRIC_MILLIMETER" + | "METRIC_CENTIMETER" + | "METRIC_METER" + | "METRIC_KILOMETER"; +} diff --git a/src/serialization/types/MeasurementUnitTime.ts b/src/serialization/types/MeasurementUnitTime.ts new file mode 100644 index 000000000..2470332b0 --- /dev/null +++ b/src/serialization/types/MeasurementUnitTime.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MeasurementUnitTime: core.serialization.Schema< + serializers.MeasurementUnitTime.Raw, + Square.MeasurementUnitTime +> = core.serialization.enum_([ + "GENERIC_MILLISECOND", + "GENERIC_SECOND", + "GENERIC_MINUTE", + "GENERIC_HOUR", + "GENERIC_DAY", +]); + +export declare namespace MeasurementUnitTime { + export type Raw = "GENERIC_MILLISECOND" | "GENERIC_SECOND" | "GENERIC_MINUTE" | "GENERIC_HOUR" | "GENERIC_DAY"; +} diff --git a/src/serialization/types/MeasurementUnitUnitType.ts b/src/serialization/types/MeasurementUnitUnitType.ts new file mode 100644 index 000000000..b1466384a --- /dev/null +++ b/src/serialization/types/MeasurementUnitUnitType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MeasurementUnitUnitType: core.serialization.Schema< + serializers.MeasurementUnitUnitType.Raw, + Square.MeasurementUnitUnitType +> = core.serialization.enum_(["TYPE_CUSTOM", "TYPE_AREA", "TYPE_LENGTH", "TYPE_VOLUME", "TYPE_WEIGHT", "TYPE_GENERIC"]); + +export declare namespace MeasurementUnitUnitType { + export type Raw = "TYPE_CUSTOM" | "TYPE_AREA" | "TYPE_LENGTH" | "TYPE_VOLUME" | "TYPE_WEIGHT" | "TYPE_GENERIC"; +} diff --git a/src/serialization/types/MeasurementUnitVolume.ts b/src/serialization/types/MeasurementUnitVolume.ts new file mode 100644 index 000000000..0d8db1ee4 --- /dev/null +++ b/src/serialization/types/MeasurementUnitVolume.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MeasurementUnitVolume: core.serialization.Schema< + serializers.MeasurementUnitVolume.Raw, + Square.MeasurementUnitVolume +> = core.serialization.enum_([ + "GENERIC_FLUID_OUNCE", + "GENERIC_SHOT", + "GENERIC_CUP", + "GENERIC_PINT", + "GENERIC_QUART", + "GENERIC_GALLON", + "IMPERIAL_CUBIC_INCH", + "IMPERIAL_CUBIC_FOOT", + "IMPERIAL_CUBIC_YARD", + "METRIC_MILLILITER", + "METRIC_LITER", +]); + +export declare namespace MeasurementUnitVolume { + export type Raw = + | "GENERIC_FLUID_OUNCE" + | "GENERIC_SHOT" + | "GENERIC_CUP" + | "GENERIC_PINT" + | "GENERIC_QUART" + | "GENERIC_GALLON" + | "IMPERIAL_CUBIC_INCH" + | "IMPERIAL_CUBIC_FOOT" + | "IMPERIAL_CUBIC_YARD" + | "METRIC_MILLILITER" + | "METRIC_LITER"; +} diff --git a/src/serialization/types/MeasurementUnitWeight.ts b/src/serialization/types/MeasurementUnitWeight.ts new file mode 100644 index 000000000..14a458dd5 --- /dev/null +++ b/src/serialization/types/MeasurementUnitWeight.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MeasurementUnitWeight: core.serialization.Schema< + serializers.MeasurementUnitWeight.Raw, + Square.MeasurementUnitWeight +> = core.serialization.enum_([ + "IMPERIAL_WEIGHT_OUNCE", + "IMPERIAL_POUND", + "IMPERIAL_STONE", + "METRIC_MILLIGRAM", + "METRIC_GRAM", + "METRIC_KILOGRAM", +]); + +export declare namespace MeasurementUnitWeight { + export type Raw = + | "IMPERIAL_WEIGHT_OUNCE" + | "IMPERIAL_POUND" + | "IMPERIAL_STONE" + | "METRIC_MILLIGRAM" + | "METRIC_GRAM" + | "METRIC_KILOGRAM"; +} diff --git a/src/serialization/types/Merchant.ts b/src/serialization/types/Merchant.ts new file mode 100644 index 000000000..72cc5e821 --- /dev/null +++ b/src/serialization/types/Merchant.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Country } from "./Country"; +import { Currency } from "./Currency"; +import { MerchantStatus } from "./MerchantStatus"; + +export const Merchant: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + businessName: core.serialization.property("business_name", core.serialization.string().optionalNullable()), + country: Country, + languageCode: core.serialization.property("language_code", core.serialization.string().optionalNullable()), + currency: Currency.optional(), + status: MerchantStatus.optional(), + mainLocationId: core.serialization.property("main_location_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + }); + +export declare namespace Merchant { + export interface Raw { + id?: string | null; + business_name?: (string | null) | null; + country: Country.Raw; + language_code?: (string | null) | null; + currency?: Currency.Raw | null; + status?: MerchantStatus.Raw | null; + main_location_id?: (string | null) | null; + created_at?: string | null; + } +} diff --git a/src/serialization/types/MerchantStatus.ts b/src/serialization/types/MerchantStatus.ts new file mode 100644 index 000000000..f5f261227 --- /dev/null +++ b/src/serialization/types/MerchantStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const MerchantStatus: core.serialization.Schema = + core.serialization.enum_(["ACTIVE", "INACTIVE"]); + +export declare namespace MerchantStatus { + export type Raw = "ACTIVE" | "INACTIVE"; +} diff --git a/src/serialization/types/ModifierLocationOverrides.ts b/src/serialization/types/ModifierLocationOverrides.ts new file mode 100644 index 000000000..ca69ef371 --- /dev/null +++ b/src/serialization/types/ModifierLocationOverrides.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const ModifierLocationOverrides: core.serialization.ObjectSchema< + serializers.ModifierLocationOverrides.Raw, + Square.ModifierLocationOverrides +> = core.serialization.object({ + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + priceMoney: core.serialization.property("price_money", Money.optional()), + soldOut: core.serialization.property("sold_out", core.serialization.boolean().optional()), +}); + +export declare namespace ModifierLocationOverrides { + export interface Raw { + location_id?: (string | null) | null; + price_money?: Money.Raw | null; + sold_out?: boolean | null; + } +} diff --git a/src/serialization/types/Money.ts b/src/serialization/types/Money.ts new file mode 100644 index 000000000..2ae0cc3be --- /dev/null +++ b/src/serialization/types/Money.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Currency } from "./Currency"; + +export const Money: core.serialization.ObjectSchema = core.serialization.object({ + amount: core.serialization.bigint().optionalNullable(), + currency: Currency.optional(), +}); + +export declare namespace Money { + export interface Raw { + amount?: ((bigint | number) | null) | null; + currency?: Currency.Raw | null; + } +} diff --git a/src/serialization/types/ObtainTokenResponse.ts b/src/serialization/types/ObtainTokenResponse.ts new file mode 100644 index 000000000..1d3aca06b --- /dev/null +++ b/src/serialization/types/ObtainTokenResponse.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const ObtainTokenResponse: core.serialization.ObjectSchema< + serializers.ObtainTokenResponse.Raw, + Square.ObtainTokenResponse +> = core.serialization.object({ + accessToken: core.serialization.property("access_token", core.serialization.string().optional()), + tokenType: core.serialization.property("token_type", core.serialization.string().optional()), + expiresAt: core.serialization.property("expires_at", core.serialization.string().optional()), + merchantId: core.serialization.property("merchant_id", core.serialization.string().optional()), + subscriptionId: core.serialization.property("subscription_id", core.serialization.string().optional()), + planId: core.serialization.property("plan_id", core.serialization.string().optional()), + idToken: core.serialization.property("id_token", core.serialization.string().optional()), + refreshToken: core.serialization.property("refresh_token", core.serialization.string().optional()), + shortLived: core.serialization.property("short_lived", core.serialization.boolean().optional()), + errors: core.serialization.list(Error_).optional(), + refreshTokenExpiresAt: core.serialization.property( + "refresh_token_expires_at", + core.serialization.string().optional(), + ), +}); + +export declare namespace ObtainTokenResponse { + export interface Raw { + access_token?: string | null; + token_type?: string | null; + expires_at?: string | null; + merchant_id?: string | null; + subscription_id?: string | null; + plan_id?: string | null; + id_token?: string | null; + refresh_token?: string | null; + short_lived?: boolean | null; + errors?: Error_.Raw[] | null; + refresh_token_expires_at?: string | null; + } +} diff --git a/src/serialization/types/OfflinePaymentDetails.ts b/src/serialization/types/OfflinePaymentDetails.ts new file mode 100644 index 000000000..139973f11 --- /dev/null +++ b/src/serialization/types/OfflinePaymentDetails.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OfflinePaymentDetails: core.serialization.ObjectSchema< + serializers.OfflinePaymentDetails.Raw, + Square.OfflinePaymentDetails +> = core.serialization.object({ + clientCreatedAt: core.serialization.property("client_created_at", core.serialization.string().optional()), +}); + +export declare namespace OfflinePaymentDetails { + export interface Raw { + client_created_at?: string | null; + } +} diff --git a/src/serialization/types/Order.ts b/src/serialization/types/Order.ts new file mode 100644 index 000000000..892f18430 --- /dev/null +++ b/src/serialization/types/Order.ts @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderSource } from "./OrderSource"; +import { OrderLineItem } from "./OrderLineItem"; +import { OrderLineItemTax } from "./OrderLineItemTax"; +import { OrderLineItemDiscount } from "./OrderLineItemDiscount"; +import { OrderServiceCharge } from "./OrderServiceCharge"; +import { Fulfillment } from "./Fulfillment"; +import { OrderReturn } from "./OrderReturn"; +import { OrderMoneyAmounts } from "./OrderMoneyAmounts"; +import { OrderRoundingAdjustment } from "./OrderRoundingAdjustment"; +import { Tender } from "./Tender"; +import { Refund } from "./Refund"; +import { OrderState } from "./OrderState"; +import { Money } from "./Money"; +import { OrderPricingOptions } from "./OrderPricingOptions"; +import { OrderReward } from "./OrderReward"; + +export const Order: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + locationId: core.serialization.property("location_id", core.serialization.string()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + source: OrderSource.optional(), + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + lineItems: core.serialization.property("line_items", core.serialization.list(OrderLineItem).optionalNullable()), + taxes: core.serialization.list(OrderLineItemTax).optionalNullable(), + discounts: core.serialization.list(OrderLineItemDiscount).optionalNullable(), + serviceCharges: core.serialization.property( + "service_charges", + core.serialization.list(OrderServiceCharge).optionalNullable(), + ), + fulfillments: core.serialization.list(Fulfillment).optionalNullable(), + returns: core.serialization.list(OrderReturn).optional(), + returnAmounts: core.serialization.property("return_amounts", OrderMoneyAmounts.optional()), + netAmounts: core.serialization.property("net_amounts", OrderMoneyAmounts.optional()), + roundingAdjustment: core.serialization.property("rounding_adjustment", OrderRoundingAdjustment.optional()), + tenders: core.serialization.list(Tender).optional(), + refunds: core.serialization.list(Refund).optional(), + metadata: core.serialization + .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .optionalNullable(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + closedAt: core.serialization.property("closed_at", core.serialization.string().optional()), + state: OrderState.optional(), + version: core.serialization.number().optional(), + totalMoney: core.serialization.property("total_money", Money.optional()), + totalTaxMoney: core.serialization.property("total_tax_money", Money.optional()), + totalDiscountMoney: core.serialization.property("total_discount_money", Money.optional()), + totalTipMoney: core.serialization.property("total_tip_money", Money.optional()), + totalServiceChargeMoney: core.serialization.property("total_service_charge_money", Money.optional()), + ticketName: core.serialization.property("ticket_name", core.serialization.string().optionalNullable()), + pricingOptions: core.serialization.property("pricing_options", OrderPricingOptions.optional()), + rewards: core.serialization.list(OrderReward).optional(), + netAmountDueMoney: core.serialization.property("net_amount_due_money", Money.optional()), +}); + +export declare namespace Order { + export interface Raw { + id?: string | null; + location_id: string; + reference_id?: (string | null) | null; + source?: OrderSource.Raw | null; + customer_id?: (string | null) | null; + line_items?: (OrderLineItem.Raw[] | null) | null; + taxes?: (OrderLineItemTax.Raw[] | null) | null; + discounts?: (OrderLineItemDiscount.Raw[] | null) | null; + service_charges?: (OrderServiceCharge.Raw[] | null) | null; + fulfillments?: (Fulfillment.Raw[] | null) | null; + returns?: OrderReturn.Raw[] | null; + return_amounts?: OrderMoneyAmounts.Raw | null; + net_amounts?: OrderMoneyAmounts.Raw | null; + rounding_adjustment?: OrderRoundingAdjustment.Raw | null; + tenders?: Tender.Raw[] | null; + refunds?: Refund.Raw[] | null; + metadata?: (Record | null) | null; + created_at?: string | null; + updated_at?: string | null; + closed_at?: string | null; + state?: OrderState.Raw | null; + version?: number | null; + total_money?: Money.Raw | null; + total_tax_money?: Money.Raw | null; + total_discount_money?: Money.Raw | null; + total_tip_money?: Money.Raw | null; + total_service_charge_money?: Money.Raw | null; + ticket_name?: (string | null) | null; + pricing_options?: OrderPricingOptions.Raw | null; + rewards?: OrderReward.Raw[] | null; + net_amount_due_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/OrderEntry.ts b/src/serialization/types/OrderEntry.ts new file mode 100644 index 000000000..7d0ea2c29 --- /dev/null +++ b/src/serialization/types/OrderEntry.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderEntry: core.serialization.ObjectSchema = + core.serialization.object({ + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + version: core.serialization.number().optional(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace OrderEntry { + export interface Raw { + order_id?: (string | null) | null; + version?: number | null; + location_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/OrderLineItem.ts b/src/serialization/types/OrderLineItem.ts new file mode 100644 index 000000000..77dac1de4 --- /dev/null +++ b/src/serialization/types/OrderLineItem.ts @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderQuantityUnit } from "./OrderQuantityUnit"; +import { OrderLineItemItemType } from "./OrderLineItemItemType"; +import { OrderLineItemModifier } from "./OrderLineItemModifier"; +import { OrderLineItemAppliedTax } from "./OrderLineItemAppliedTax"; +import { OrderLineItemAppliedDiscount } from "./OrderLineItemAppliedDiscount"; +import { OrderLineItemAppliedServiceCharge } from "./OrderLineItemAppliedServiceCharge"; +import { Money } from "./Money"; +import { OrderLineItemPricingBlocklists } from "./OrderLineItemPricingBlocklists"; + +export const OrderLineItem: core.serialization.ObjectSchema = + core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + name: core.serialization.string().optionalNullable(), + quantity: core.serialization.string(), + quantityUnit: core.serialization.property("quantity_unit", OrderQuantityUnit.optional()), + note: core.serialization.string().optionalNullable(), + catalogObjectId: core.serialization.property( + "catalog_object_id", + core.serialization.string().optionalNullable(), + ), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + variationName: core.serialization.property("variation_name", core.serialization.string().optionalNullable()), + itemType: core.serialization.property("item_type", OrderLineItemItemType.optional()), + metadata: core.serialization + .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .optionalNullable(), + modifiers: core.serialization.list(OrderLineItemModifier).optionalNullable(), + appliedTaxes: core.serialization.property( + "applied_taxes", + core.serialization.list(OrderLineItemAppliedTax).optionalNullable(), + ), + appliedDiscounts: core.serialization.property( + "applied_discounts", + core.serialization.list(OrderLineItemAppliedDiscount).optionalNullable(), + ), + appliedServiceCharges: core.serialization.property( + "applied_service_charges", + core.serialization.list(OrderLineItemAppliedServiceCharge).optionalNullable(), + ), + basePriceMoney: core.serialization.property("base_price_money", Money.optional()), + variationTotalPriceMoney: core.serialization.property("variation_total_price_money", Money.optional()), + grossSalesMoney: core.serialization.property("gross_sales_money", Money.optional()), + totalTaxMoney: core.serialization.property("total_tax_money", Money.optional()), + totalDiscountMoney: core.serialization.property("total_discount_money", Money.optional()), + totalMoney: core.serialization.property("total_money", Money.optional()), + pricingBlocklists: core.serialization.property("pricing_blocklists", OrderLineItemPricingBlocklists.optional()), + totalServiceChargeMoney: core.serialization.property("total_service_charge_money", Money.optional()), + }); + +export declare namespace OrderLineItem { + export interface Raw { + uid?: (string | null) | null; + name?: (string | null) | null; + quantity: string; + quantity_unit?: OrderQuantityUnit.Raw | null; + note?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + variation_name?: (string | null) | null; + item_type?: OrderLineItemItemType.Raw | null; + metadata?: (Record | null) | null; + modifiers?: (OrderLineItemModifier.Raw[] | null) | null; + applied_taxes?: (OrderLineItemAppliedTax.Raw[] | null) | null; + applied_discounts?: (OrderLineItemAppliedDiscount.Raw[] | null) | null; + applied_service_charges?: (OrderLineItemAppliedServiceCharge.Raw[] | null) | null; + base_price_money?: Money.Raw | null; + variation_total_price_money?: Money.Raw | null; + gross_sales_money?: Money.Raw | null; + total_tax_money?: Money.Raw | null; + total_discount_money?: Money.Raw | null; + total_money?: Money.Raw | null; + pricing_blocklists?: OrderLineItemPricingBlocklists.Raw | null; + total_service_charge_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/OrderLineItemAppliedDiscount.ts b/src/serialization/types/OrderLineItemAppliedDiscount.ts new file mode 100644 index 000000000..2e1d5875e --- /dev/null +++ b/src/serialization/types/OrderLineItemAppliedDiscount.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const OrderLineItemAppliedDiscount: core.serialization.ObjectSchema< + serializers.OrderLineItemAppliedDiscount.Raw, + Square.OrderLineItemAppliedDiscount +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + discountUid: core.serialization.property("discount_uid", core.serialization.string()), + appliedMoney: core.serialization.property("applied_money", Money.optional()), +}); + +export declare namespace OrderLineItemAppliedDiscount { + export interface Raw { + uid?: (string | null) | null; + discount_uid: string; + applied_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/OrderLineItemAppliedServiceCharge.ts b/src/serialization/types/OrderLineItemAppliedServiceCharge.ts new file mode 100644 index 000000000..36612b700 --- /dev/null +++ b/src/serialization/types/OrderLineItemAppliedServiceCharge.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const OrderLineItemAppliedServiceCharge: core.serialization.ObjectSchema< + serializers.OrderLineItemAppliedServiceCharge.Raw, + Square.OrderLineItemAppliedServiceCharge +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + serviceChargeUid: core.serialization.property("service_charge_uid", core.serialization.string()), + appliedMoney: core.serialization.property("applied_money", Money.optional()), +}); + +export declare namespace OrderLineItemAppliedServiceCharge { + export interface Raw { + uid?: (string | null) | null; + service_charge_uid: string; + applied_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/OrderLineItemAppliedTax.ts b/src/serialization/types/OrderLineItemAppliedTax.ts new file mode 100644 index 000000000..d04a39c78 --- /dev/null +++ b/src/serialization/types/OrderLineItemAppliedTax.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const OrderLineItemAppliedTax: core.serialization.ObjectSchema< + serializers.OrderLineItemAppliedTax.Raw, + Square.OrderLineItemAppliedTax +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + taxUid: core.serialization.property("tax_uid", core.serialization.string()), + appliedMoney: core.serialization.property("applied_money", Money.optional()), +}); + +export declare namespace OrderLineItemAppliedTax { + export interface Raw { + uid?: (string | null) | null; + tax_uid: string; + applied_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/OrderLineItemDiscount.ts b/src/serialization/types/OrderLineItemDiscount.ts new file mode 100644 index 000000000..d4044eb07 --- /dev/null +++ b/src/serialization/types/OrderLineItemDiscount.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderLineItemDiscountType } from "./OrderLineItemDiscountType"; +import { Money } from "./Money"; +import { OrderLineItemDiscountScope } from "./OrderLineItemDiscountScope"; + +export const OrderLineItemDiscount: core.serialization.ObjectSchema< + serializers.OrderLineItemDiscount.Raw, + Square.OrderLineItemDiscount +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + name: core.serialization.string().optionalNullable(), + type: OrderLineItemDiscountType.optional(), + percentage: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money.optional()), + appliedMoney: core.serialization.property("applied_money", Money.optional()), + metadata: core.serialization + .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .optionalNullable(), + scope: OrderLineItemDiscountScope.optional(), + rewardIds: core.serialization.property( + "reward_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + pricingRuleId: core.serialization.property("pricing_rule_id", core.serialization.string().optional()), +}); + +export declare namespace OrderLineItemDiscount { + export interface Raw { + uid?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + name?: (string | null) | null; + type?: OrderLineItemDiscountType.Raw | null; + percentage?: (string | null) | null; + amount_money?: Money.Raw | null; + applied_money?: Money.Raw | null; + metadata?: (Record | null) | null; + scope?: OrderLineItemDiscountScope.Raw | null; + reward_ids?: string[] | null; + pricing_rule_id?: string | null; + } +} diff --git a/src/serialization/types/OrderLineItemDiscountScope.ts b/src/serialization/types/OrderLineItemDiscountScope.ts new file mode 100644 index 000000000..bce436185 --- /dev/null +++ b/src/serialization/types/OrderLineItemDiscountScope.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderLineItemDiscountScope: core.serialization.Schema< + serializers.OrderLineItemDiscountScope.Raw, + Square.OrderLineItemDiscountScope +> = core.serialization.enum_(["OTHER_DISCOUNT_SCOPE", "LINE_ITEM", "ORDER"]); + +export declare namespace OrderLineItemDiscountScope { + export type Raw = "OTHER_DISCOUNT_SCOPE" | "LINE_ITEM" | "ORDER"; +} diff --git a/src/serialization/types/OrderLineItemDiscountType.ts b/src/serialization/types/OrderLineItemDiscountType.ts new file mode 100644 index 000000000..dfb201efd --- /dev/null +++ b/src/serialization/types/OrderLineItemDiscountType.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderLineItemDiscountType: core.serialization.Schema< + serializers.OrderLineItemDiscountType.Raw, + Square.OrderLineItemDiscountType +> = core.serialization.enum_([ + "UNKNOWN_DISCOUNT", + "FIXED_PERCENTAGE", + "FIXED_AMOUNT", + "VARIABLE_PERCENTAGE", + "VARIABLE_AMOUNT", +]); + +export declare namespace OrderLineItemDiscountType { + export type Raw = + | "UNKNOWN_DISCOUNT" + | "FIXED_PERCENTAGE" + | "FIXED_AMOUNT" + | "VARIABLE_PERCENTAGE" + | "VARIABLE_AMOUNT"; +} diff --git a/src/serialization/types/OrderLineItemItemType.ts b/src/serialization/types/OrderLineItemItemType.ts new file mode 100644 index 000000000..68533023b --- /dev/null +++ b/src/serialization/types/OrderLineItemItemType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderLineItemItemType: core.serialization.Schema< + serializers.OrderLineItemItemType.Raw, + Square.OrderLineItemItemType +> = core.serialization.enum_(["ITEM", "CUSTOM_AMOUNT", "GIFT_CARD"]); + +export declare namespace OrderLineItemItemType { + export type Raw = "ITEM" | "CUSTOM_AMOUNT" | "GIFT_CARD"; +} diff --git a/src/serialization/types/OrderLineItemModifier.ts b/src/serialization/types/OrderLineItemModifier.ts new file mode 100644 index 000000000..8e1eca6ac --- /dev/null +++ b/src/serialization/types/OrderLineItemModifier.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const OrderLineItemModifier: core.serialization.ObjectSchema< + serializers.OrderLineItemModifier.Raw, + Square.OrderLineItemModifier +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + name: core.serialization.string().optionalNullable(), + quantity: core.serialization.string().optionalNullable(), + basePriceMoney: core.serialization.property("base_price_money", Money.optional()), + totalPriceMoney: core.serialization.property("total_price_money", Money.optional()), + metadata: core.serialization + .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .optionalNullable(), +}); + +export declare namespace OrderLineItemModifier { + export interface Raw { + uid?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + name?: (string | null) | null; + quantity?: (string | null) | null; + base_price_money?: Money.Raw | null; + total_price_money?: Money.Raw | null; + metadata?: (Record | null) | null; + } +} diff --git a/src/serialization/types/OrderLineItemPricingBlocklists.ts b/src/serialization/types/OrderLineItemPricingBlocklists.ts new file mode 100644 index 000000000..2042642b5 --- /dev/null +++ b/src/serialization/types/OrderLineItemPricingBlocklists.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderLineItemPricingBlocklistsBlockedDiscount } from "./OrderLineItemPricingBlocklistsBlockedDiscount"; +import { OrderLineItemPricingBlocklistsBlockedTax } from "./OrderLineItemPricingBlocklistsBlockedTax"; + +export const OrderLineItemPricingBlocklists: core.serialization.ObjectSchema< + serializers.OrderLineItemPricingBlocklists.Raw, + Square.OrderLineItemPricingBlocklists +> = core.serialization.object({ + blockedDiscounts: core.serialization.property( + "blocked_discounts", + core.serialization.list(OrderLineItemPricingBlocklistsBlockedDiscount).optionalNullable(), + ), + blockedTaxes: core.serialization.property( + "blocked_taxes", + core.serialization.list(OrderLineItemPricingBlocklistsBlockedTax).optionalNullable(), + ), +}); + +export declare namespace OrderLineItemPricingBlocklists { + export interface Raw { + blocked_discounts?: (OrderLineItemPricingBlocklistsBlockedDiscount.Raw[] | null) | null; + blocked_taxes?: (OrderLineItemPricingBlocklistsBlockedTax.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts b/src/serialization/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts new file mode 100644 index 000000000..2c326bb13 --- /dev/null +++ b/src/serialization/types/OrderLineItemPricingBlocklistsBlockedDiscount.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderLineItemPricingBlocklistsBlockedDiscount: core.serialization.ObjectSchema< + serializers.OrderLineItemPricingBlocklistsBlockedDiscount.Raw, + Square.OrderLineItemPricingBlocklistsBlockedDiscount +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + discountUid: core.serialization.property("discount_uid", core.serialization.string().optionalNullable()), + discountCatalogObjectId: core.serialization.property( + "discount_catalog_object_id", + core.serialization.string().optionalNullable(), + ), +}); + +export declare namespace OrderLineItemPricingBlocklistsBlockedDiscount { + export interface Raw { + uid?: (string | null) | null; + discount_uid?: (string | null) | null; + discount_catalog_object_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/OrderLineItemPricingBlocklistsBlockedTax.ts b/src/serialization/types/OrderLineItemPricingBlocklistsBlockedTax.ts new file mode 100644 index 000000000..0909a8346 --- /dev/null +++ b/src/serialization/types/OrderLineItemPricingBlocklistsBlockedTax.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderLineItemPricingBlocklistsBlockedTax: core.serialization.ObjectSchema< + serializers.OrderLineItemPricingBlocklistsBlockedTax.Raw, + Square.OrderLineItemPricingBlocklistsBlockedTax +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + taxUid: core.serialization.property("tax_uid", core.serialization.string().optionalNullable()), + taxCatalogObjectId: core.serialization.property( + "tax_catalog_object_id", + core.serialization.string().optionalNullable(), + ), +}); + +export declare namespace OrderLineItemPricingBlocklistsBlockedTax { + export interface Raw { + uid?: (string | null) | null; + tax_uid?: (string | null) | null; + tax_catalog_object_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/OrderLineItemTax.ts b/src/serialization/types/OrderLineItemTax.ts new file mode 100644 index 000000000..2e61af997 --- /dev/null +++ b/src/serialization/types/OrderLineItemTax.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderLineItemTaxType } from "./OrderLineItemTaxType"; +import { Money } from "./Money"; +import { OrderLineItemTaxScope } from "./OrderLineItemTaxScope"; + +export const OrderLineItemTax: core.serialization.ObjectSchema< + serializers.OrderLineItemTax.Raw, + Square.OrderLineItemTax +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + name: core.serialization.string().optionalNullable(), + type: OrderLineItemTaxType.optional(), + percentage: core.serialization.string().optionalNullable(), + metadata: core.serialization + .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .optionalNullable(), + appliedMoney: core.serialization.property("applied_money", Money.optional()), + scope: OrderLineItemTaxScope.optional(), + autoApplied: core.serialization.property("auto_applied", core.serialization.boolean().optional()), +}); + +export declare namespace OrderLineItemTax { + export interface Raw { + uid?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + name?: (string | null) | null; + type?: OrderLineItemTaxType.Raw | null; + percentage?: (string | null) | null; + metadata?: (Record | null) | null; + applied_money?: Money.Raw | null; + scope?: OrderLineItemTaxScope.Raw | null; + auto_applied?: boolean | null; + } +} diff --git a/src/serialization/types/OrderLineItemTaxScope.ts b/src/serialization/types/OrderLineItemTaxScope.ts new file mode 100644 index 000000000..c819edbed --- /dev/null +++ b/src/serialization/types/OrderLineItemTaxScope.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderLineItemTaxScope: core.serialization.Schema< + serializers.OrderLineItemTaxScope.Raw, + Square.OrderLineItemTaxScope +> = core.serialization.enum_(["OTHER_TAX_SCOPE", "LINE_ITEM", "ORDER"]); + +export declare namespace OrderLineItemTaxScope { + export type Raw = "OTHER_TAX_SCOPE" | "LINE_ITEM" | "ORDER"; +} diff --git a/src/serialization/types/OrderLineItemTaxType.ts b/src/serialization/types/OrderLineItemTaxType.ts new file mode 100644 index 000000000..37322d402 --- /dev/null +++ b/src/serialization/types/OrderLineItemTaxType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderLineItemTaxType: core.serialization.Schema< + serializers.OrderLineItemTaxType.Raw, + Square.OrderLineItemTaxType +> = core.serialization.enum_(["UNKNOWN_TAX", "ADDITIVE", "INCLUSIVE"]); + +export declare namespace OrderLineItemTaxType { + export type Raw = "UNKNOWN_TAX" | "ADDITIVE" | "INCLUSIVE"; +} diff --git a/src/serialization/types/OrderMoneyAmounts.ts b/src/serialization/types/OrderMoneyAmounts.ts new file mode 100644 index 000000000..40e754627 --- /dev/null +++ b/src/serialization/types/OrderMoneyAmounts.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const OrderMoneyAmounts: core.serialization.ObjectSchema< + serializers.OrderMoneyAmounts.Raw, + Square.OrderMoneyAmounts +> = core.serialization.object({ + totalMoney: core.serialization.property("total_money", Money.optional()), + taxMoney: core.serialization.property("tax_money", Money.optional()), + discountMoney: core.serialization.property("discount_money", Money.optional()), + tipMoney: core.serialization.property("tip_money", Money.optional()), + serviceChargeMoney: core.serialization.property("service_charge_money", Money.optional()), +}); + +export declare namespace OrderMoneyAmounts { + export interface Raw { + total_money?: Money.Raw | null; + tax_money?: Money.Raw | null; + discount_money?: Money.Raw | null; + tip_money?: Money.Raw | null; + service_charge_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/OrderPricingOptions.ts b/src/serialization/types/OrderPricingOptions.ts new file mode 100644 index 000000000..cb0dd842b --- /dev/null +++ b/src/serialization/types/OrderPricingOptions.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderPricingOptions: core.serialization.ObjectSchema< + serializers.OrderPricingOptions.Raw, + Square.OrderPricingOptions +> = core.serialization.object({ + autoApplyDiscounts: core.serialization.property( + "auto_apply_discounts", + core.serialization.boolean().optionalNullable(), + ), + autoApplyTaxes: core.serialization.property("auto_apply_taxes", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace OrderPricingOptions { + export interface Raw { + auto_apply_discounts?: (boolean | null) | null; + auto_apply_taxes?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/OrderQuantityUnit.ts b/src/serialization/types/OrderQuantityUnit.ts new file mode 100644 index 000000000..7d67fdc6a --- /dev/null +++ b/src/serialization/types/OrderQuantityUnit.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { MeasurementUnit } from "./MeasurementUnit"; + +export const OrderQuantityUnit: core.serialization.ObjectSchema< + serializers.OrderQuantityUnit.Raw, + Square.OrderQuantityUnit +> = core.serialization.object({ + measurementUnit: core.serialization.property("measurement_unit", MeasurementUnit.optional()), + precision: core.serialization.number().optionalNullable(), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), +}); + +export declare namespace OrderQuantityUnit { + export interface Raw { + measurement_unit?: MeasurementUnit.Raw | null; + precision?: (number | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + } +} diff --git a/src/serialization/types/OrderReturn.ts b/src/serialization/types/OrderReturn.ts new file mode 100644 index 000000000..650a90208 --- /dev/null +++ b/src/serialization/types/OrderReturn.ts @@ -0,0 +1,53 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderReturnLineItem } from "./OrderReturnLineItem"; +import { OrderReturnServiceCharge } from "./OrderReturnServiceCharge"; +import { OrderReturnTax } from "./OrderReturnTax"; +import { OrderReturnDiscount } from "./OrderReturnDiscount"; +import { OrderReturnTip } from "./OrderReturnTip"; +import { OrderRoundingAdjustment } from "./OrderRoundingAdjustment"; +import { OrderMoneyAmounts } from "./OrderMoneyAmounts"; + +export const OrderReturn: core.serialization.ObjectSchema = + core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + sourceOrderId: core.serialization.property("source_order_id", core.serialization.string().optionalNullable()), + returnLineItems: core.serialization.property( + "return_line_items", + core.serialization.list(OrderReturnLineItem).optionalNullable(), + ), + returnServiceCharges: core.serialization.property( + "return_service_charges", + core.serialization.list(OrderReturnServiceCharge).optionalNullable(), + ), + returnTaxes: core.serialization.property("return_taxes", core.serialization.list(OrderReturnTax).optional()), + returnDiscounts: core.serialization.property( + "return_discounts", + core.serialization.list(OrderReturnDiscount).optional(), + ), + returnTips: core.serialization.property( + "return_tips", + core.serialization.list(OrderReturnTip).optionalNullable(), + ), + roundingAdjustment: core.serialization.property("rounding_adjustment", OrderRoundingAdjustment.optional()), + returnAmounts: core.serialization.property("return_amounts", OrderMoneyAmounts.optional()), + }); + +export declare namespace OrderReturn { + export interface Raw { + uid?: (string | null) | null; + source_order_id?: (string | null) | null; + return_line_items?: (OrderReturnLineItem.Raw[] | null) | null; + return_service_charges?: (OrderReturnServiceCharge.Raw[] | null) | null; + return_taxes?: OrderReturnTax.Raw[] | null; + return_discounts?: OrderReturnDiscount.Raw[] | null; + return_tips?: (OrderReturnTip.Raw[] | null) | null; + rounding_adjustment?: OrderRoundingAdjustment.Raw | null; + return_amounts?: OrderMoneyAmounts.Raw | null; + } +} diff --git a/src/serialization/types/OrderReturnDiscount.ts b/src/serialization/types/OrderReturnDiscount.ts new file mode 100644 index 000000000..05c25785e --- /dev/null +++ b/src/serialization/types/OrderReturnDiscount.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderLineItemDiscountType } from "./OrderLineItemDiscountType"; +import { Money } from "./Money"; +import { OrderLineItemDiscountScope } from "./OrderLineItemDiscountScope"; + +export const OrderReturnDiscount: core.serialization.ObjectSchema< + serializers.OrderReturnDiscount.Raw, + Square.OrderReturnDiscount +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + sourceDiscountUid: core.serialization.property( + "source_discount_uid", + core.serialization.string().optionalNullable(), + ), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + name: core.serialization.string().optionalNullable(), + type: OrderLineItemDiscountType.optional(), + percentage: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money.optional()), + appliedMoney: core.serialization.property("applied_money", Money.optional()), + scope: OrderLineItemDiscountScope.optional(), +}); + +export declare namespace OrderReturnDiscount { + export interface Raw { + uid?: (string | null) | null; + source_discount_uid?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + name?: (string | null) | null; + type?: OrderLineItemDiscountType.Raw | null; + percentage?: (string | null) | null; + amount_money?: Money.Raw | null; + applied_money?: Money.Raw | null; + scope?: OrderLineItemDiscountScope.Raw | null; + } +} diff --git a/src/serialization/types/OrderReturnLineItem.ts b/src/serialization/types/OrderReturnLineItem.ts new file mode 100644 index 000000000..565236307 --- /dev/null +++ b/src/serialization/types/OrderReturnLineItem.ts @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderQuantityUnit } from "./OrderQuantityUnit"; +import { OrderLineItemItemType } from "./OrderLineItemItemType"; +import { OrderReturnLineItemModifier } from "./OrderReturnLineItemModifier"; +import { OrderLineItemAppliedTax } from "./OrderLineItemAppliedTax"; +import { OrderLineItemAppliedDiscount } from "./OrderLineItemAppliedDiscount"; +import { Money } from "./Money"; +import { OrderLineItemAppliedServiceCharge } from "./OrderLineItemAppliedServiceCharge"; + +export const OrderReturnLineItem: core.serialization.ObjectSchema< + serializers.OrderReturnLineItem.Raw, + Square.OrderReturnLineItem +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + sourceLineItemUid: core.serialization.property( + "source_line_item_uid", + core.serialization.string().optionalNullable(), + ), + name: core.serialization.string().optionalNullable(), + quantity: core.serialization.string(), + quantityUnit: core.serialization.property("quantity_unit", OrderQuantityUnit.optional()), + note: core.serialization.string().optionalNullable(), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + variationName: core.serialization.property("variation_name", core.serialization.string().optionalNullable()), + itemType: core.serialization.property("item_type", OrderLineItemItemType.optional()), + returnModifiers: core.serialization.property( + "return_modifiers", + core.serialization.list(OrderReturnLineItemModifier).optionalNullable(), + ), + appliedTaxes: core.serialization.property( + "applied_taxes", + core.serialization.list(OrderLineItemAppliedTax).optionalNullable(), + ), + appliedDiscounts: core.serialization.property( + "applied_discounts", + core.serialization.list(OrderLineItemAppliedDiscount).optionalNullable(), + ), + basePriceMoney: core.serialization.property("base_price_money", Money.optional()), + variationTotalPriceMoney: core.serialization.property("variation_total_price_money", Money.optional()), + grossReturnMoney: core.serialization.property("gross_return_money", Money.optional()), + totalTaxMoney: core.serialization.property("total_tax_money", Money.optional()), + totalDiscountMoney: core.serialization.property("total_discount_money", Money.optional()), + totalMoney: core.serialization.property("total_money", Money.optional()), + appliedServiceCharges: core.serialization.property( + "applied_service_charges", + core.serialization.list(OrderLineItemAppliedServiceCharge).optionalNullable(), + ), + totalServiceChargeMoney: core.serialization.property("total_service_charge_money", Money.optional()), +}); + +export declare namespace OrderReturnLineItem { + export interface Raw { + uid?: (string | null) | null; + source_line_item_uid?: (string | null) | null; + name?: (string | null) | null; + quantity: string; + quantity_unit?: OrderQuantityUnit.Raw | null; + note?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + variation_name?: (string | null) | null; + item_type?: OrderLineItemItemType.Raw | null; + return_modifiers?: (OrderReturnLineItemModifier.Raw[] | null) | null; + applied_taxes?: (OrderLineItemAppliedTax.Raw[] | null) | null; + applied_discounts?: (OrderLineItemAppliedDiscount.Raw[] | null) | null; + base_price_money?: Money.Raw | null; + variation_total_price_money?: Money.Raw | null; + gross_return_money?: Money.Raw | null; + total_tax_money?: Money.Raw | null; + total_discount_money?: Money.Raw | null; + total_money?: Money.Raw | null; + applied_service_charges?: (OrderLineItemAppliedServiceCharge.Raw[] | null) | null; + total_service_charge_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/OrderReturnLineItemModifier.ts b/src/serialization/types/OrderReturnLineItemModifier.ts new file mode 100644 index 000000000..2515ff830 --- /dev/null +++ b/src/serialization/types/OrderReturnLineItemModifier.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const OrderReturnLineItemModifier: core.serialization.ObjectSchema< + serializers.OrderReturnLineItemModifier.Raw, + Square.OrderReturnLineItemModifier +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + sourceModifierUid: core.serialization.property( + "source_modifier_uid", + core.serialization.string().optionalNullable(), + ), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + name: core.serialization.string().optionalNullable(), + basePriceMoney: core.serialization.property("base_price_money", Money.optional()), + totalPriceMoney: core.serialization.property("total_price_money", Money.optional()), + quantity: core.serialization.string().optionalNullable(), +}); + +export declare namespace OrderReturnLineItemModifier { + export interface Raw { + uid?: (string | null) | null; + source_modifier_uid?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + name?: (string | null) | null; + base_price_money?: Money.Raw | null; + total_price_money?: Money.Raw | null; + quantity?: (string | null) | null; + } +} diff --git a/src/serialization/types/OrderReturnServiceCharge.ts b/src/serialization/types/OrderReturnServiceCharge.ts new file mode 100644 index 000000000..5e69e20f8 --- /dev/null +++ b/src/serialization/types/OrderReturnServiceCharge.ts @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { OrderServiceChargeCalculationPhase } from "./OrderServiceChargeCalculationPhase"; +import { OrderLineItemAppliedTax } from "./OrderLineItemAppliedTax"; +import { OrderServiceChargeTreatmentType } from "./OrderServiceChargeTreatmentType"; +import { OrderServiceChargeScope } from "./OrderServiceChargeScope"; + +export const OrderReturnServiceCharge: core.serialization.ObjectSchema< + serializers.OrderReturnServiceCharge.Raw, + Square.OrderReturnServiceCharge +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + sourceServiceChargeUid: core.serialization.property( + "source_service_charge_uid", + core.serialization.string().optionalNullable(), + ), + name: core.serialization.string().optionalNullable(), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + percentage: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money.optional()), + appliedMoney: core.serialization.property("applied_money", Money.optional()), + totalMoney: core.serialization.property("total_money", Money.optional()), + totalTaxMoney: core.serialization.property("total_tax_money", Money.optional()), + calculationPhase: core.serialization.property("calculation_phase", OrderServiceChargeCalculationPhase.optional()), + taxable: core.serialization.boolean().optionalNullable(), + appliedTaxes: core.serialization.property( + "applied_taxes", + core.serialization.list(OrderLineItemAppliedTax).optionalNullable(), + ), + treatmentType: core.serialization.property("treatment_type", OrderServiceChargeTreatmentType.optional()), + scope: OrderServiceChargeScope.optional(), +}); + +export declare namespace OrderReturnServiceCharge { + export interface Raw { + uid?: (string | null) | null; + source_service_charge_uid?: (string | null) | null; + name?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + percentage?: (string | null) | null; + amount_money?: Money.Raw | null; + applied_money?: Money.Raw | null; + total_money?: Money.Raw | null; + total_tax_money?: Money.Raw | null; + calculation_phase?: OrderServiceChargeCalculationPhase.Raw | null; + taxable?: (boolean | null) | null; + applied_taxes?: (OrderLineItemAppliedTax.Raw[] | null) | null; + treatment_type?: OrderServiceChargeTreatmentType.Raw | null; + scope?: OrderServiceChargeScope.Raw | null; + } +} diff --git a/src/serialization/types/OrderReturnTax.ts b/src/serialization/types/OrderReturnTax.ts new file mode 100644 index 000000000..6d3f0f0ea --- /dev/null +++ b/src/serialization/types/OrderReturnTax.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderLineItemTaxType } from "./OrderLineItemTaxType"; +import { Money } from "./Money"; +import { OrderLineItemTaxScope } from "./OrderLineItemTaxScope"; + +export const OrderReturnTax: core.serialization.ObjectSchema = + core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + sourceTaxUid: core.serialization.property("source_tax_uid", core.serialization.string().optionalNullable()), + catalogObjectId: core.serialization.property( + "catalog_object_id", + core.serialization.string().optionalNullable(), + ), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + name: core.serialization.string().optionalNullable(), + type: OrderLineItemTaxType.optional(), + percentage: core.serialization.string().optionalNullable(), + appliedMoney: core.serialization.property("applied_money", Money.optional()), + scope: OrderLineItemTaxScope.optional(), + }); + +export declare namespace OrderReturnTax { + export interface Raw { + uid?: (string | null) | null; + source_tax_uid?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + name?: (string | null) | null; + type?: OrderLineItemTaxType.Raw | null; + percentage?: (string | null) | null; + applied_money?: Money.Raw | null; + scope?: OrderLineItemTaxScope.Raw | null; + } +} diff --git a/src/serialization/types/OrderReturnTip.ts b/src/serialization/types/OrderReturnTip.ts new file mode 100644 index 000000000..683b370d0 --- /dev/null +++ b/src/serialization/types/OrderReturnTip.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const OrderReturnTip: core.serialization.ObjectSchema = + core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + appliedMoney: core.serialization.property("applied_money", Money.optional()), + sourceTenderUid: core.serialization.property( + "source_tender_uid", + core.serialization.string().optionalNullable(), + ), + sourceTenderId: core.serialization.property("source_tender_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace OrderReturnTip { + export interface Raw { + uid?: (string | null) | null; + applied_money?: Money.Raw | null; + source_tender_uid?: (string | null) | null; + source_tender_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/OrderReward.ts b/src/serialization/types/OrderReward.ts new file mode 100644 index 000000000..7a9bb193c --- /dev/null +++ b/src/serialization/types/OrderReward.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderReward: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + rewardTierId: core.serialization.property("reward_tier_id", core.serialization.string()), + }); + +export declare namespace OrderReward { + export interface Raw { + id: string; + reward_tier_id: string; + } +} diff --git a/src/serialization/types/OrderRoundingAdjustment.ts b/src/serialization/types/OrderRoundingAdjustment.ts new file mode 100644 index 000000000..fcdf03719 --- /dev/null +++ b/src/serialization/types/OrderRoundingAdjustment.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const OrderRoundingAdjustment: core.serialization.ObjectSchema< + serializers.OrderRoundingAdjustment.Raw, + Square.OrderRoundingAdjustment +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + name: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money.optional()), +}); + +export declare namespace OrderRoundingAdjustment { + export interface Raw { + uid?: (string | null) | null; + name?: (string | null) | null; + amount_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/OrderServiceCharge.ts b/src/serialization/types/OrderServiceCharge.ts new file mode 100644 index 000000000..88fbd238a --- /dev/null +++ b/src/serialization/types/OrderServiceCharge.ts @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { OrderServiceChargeCalculationPhase } from "./OrderServiceChargeCalculationPhase"; +import { OrderLineItemAppliedTax } from "./OrderLineItemAppliedTax"; +import { OrderServiceChargeType } from "./OrderServiceChargeType"; +import { OrderServiceChargeTreatmentType } from "./OrderServiceChargeTreatmentType"; +import { OrderServiceChargeScope } from "./OrderServiceChargeScope"; + +export const OrderServiceCharge: core.serialization.ObjectSchema< + serializers.OrderServiceCharge.Raw, + Square.OrderServiceCharge +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + name: core.serialization.string().optionalNullable(), + catalogObjectId: core.serialization.property("catalog_object_id", core.serialization.string().optionalNullable()), + catalogVersion: core.serialization.property("catalog_version", core.serialization.bigint().optionalNullable()), + percentage: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money.optional()), + appliedMoney: core.serialization.property("applied_money", Money.optional()), + totalMoney: core.serialization.property("total_money", Money.optional()), + totalTaxMoney: core.serialization.property("total_tax_money", Money.optional()), + calculationPhase: core.serialization.property("calculation_phase", OrderServiceChargeCalculationPhase.optional()), + taxable: core.serialization.boolean().optionalNullable(), + appliedTaxes: core.serialization.property( + "applied_taxes", + core.serialization.list(OrderLineItemAppliedTax).optionalNullable(), + ), + metadata: core.serialization + .record(core.serialization.string(), core.serialization.string().optionalNullable()) + .optionalNullable(), + type: OrderServiceChargeType.optional(), + treatmentType: core.serialization.property("treatment_type", OrderServiceChargeTreatmentType.optional()), + scope: OrderServiceChargeScope.optional(), +}); + +export declare namespace OrderServiceCharge { + export interface Raw { + uid?: (string | null) | null; + name?: (string | null) | null; + catalog_object_id?: (string | null) | null; + catalog_version?: ((bigint | number) | null) | null; + percentage?: (string | null) | null; + amount_money?: Money.Raw | null; + applied_money?: Money.Raw | null; + total_money?: Money.Raw | null; + total_tax_money?: Money.Raw | null; + calculation_phase?: OrderServiceChargeCalculationPhase.Raw | null; + taxable?: (boolean | null) | null; + applied_taxes?: (OrderLineItemAppliedTax.Raw[] | null) | null; + metadata?: (Record | null) | null; + type?: OrderServiceChargeType.Raw | null; + treatment_type?: OrderServiceChargeTreatmentType.Raw | null; + scope?: OrderServiceChargeScope.Raw | null; + } +} diff --git a/src/serialization/types/OrderServiceChargeCalculationPhase.ts b/src/serialization/types/OrderServiceChargeCalculationPhase.ts new file mode 100644 index 000000000..ac6544627 --- /dev/null +++ b/src/serialization/types/OrderServiceChargeCalculationPhase.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderServiceChargeCalculationPhase: core.serialization.Schema< + serializers.OrderServiceChargeCalculationPhase.Raw, + Square.OrderServiceChargeCalculationPhase +> = core.serialization.enum_([ + "SUBTOTAL_PHASE", + "TOTAL_PHASE", + "APPORTIONED_PERCENTAGE_PHASE", + "APPORTIONED_AMOUNT_PHASE", +]); + +export declare namespace OrderServiceChargeCalculationPhase { + export type Raw = "SUBTOTAL_PHASE" | "TOTAL_PHASE" | "APPORTIONED_PERCENTAGE_PHASE" | "APPORTIONED_AMOUNT_PHASE"; +} diff --git a/src/serialization/types/OrderServiceChargeScope.ts b/src/serialization/types/OrderServiceChargeScope.ts new file mode 100644 index 000000000..83faa80ea --- /dev/null +++ b/src/serialization/types/OrderServiceChargeScope.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderServiceChargeScope: core.serialization.Schema< + serializers.OrderServiceChargeScope.Raw, + Square.OrderServiceChargeScope +> = core.serialization.enum_(["OTHER_SERVICE_CHARGE_SCOPE", "LINE_ITEM", "ORDER"]); + +export declare namespace OrderServiceChargeScope { + export type Raw = "OTHER_SERVICE_CHARGE_SCOPE" | "LINE_ITEM" | "ORDER"; +} diff --git a/src/serialization/types/OrderServiceChargeTreatmentType.ts b/src/serialization/types/OrderServiceChargeTreatmentType.ts new file mode 100644 index 000000000..af0aca06c --- /dev/null +++ b/src/serialization/types/OrderServiceChargeTreatmentType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderServiceChargeTreatmentType: core.serialization.Schema< + serializers.OrderServiceChargeTreatmentType.Raw, + Square.OrderServiceChargeTreatmentType +> = core.serialization.enum_(["LINE_ITEM_TREATMENT", "APPORTIONED_TREATMENT"]); + +export declare namespace OrderServiceChargeTreatmentType { + export type Raw = "LINE_ITEM_TREATMENT" | "APPORTIONED_TREATMENT"; +} diff --git a/src/serialization/types/OrderServiceChargeType.ts b/src/serialization/types/OrderServiceChargeType.ts new file mode 100644 index 000000000..4553380e3 --- /dev/null +++ b/src/serialization/types/OrderServiceChargeType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderServiceChargeType: core.serialization.Schema< + serializers.OrderServiceChargeType.Raw, + Square.OrderServiceChargeType +> = core.serialization.enum_(["AUTO_GRATUITY", "CUSTOM"]); + +export declare namespace OrderServiceChargeType { + export type Raw = "AUTO_GRATUITY" | "CUSTOM"; +} diff --git a/src/serialization/types/OrderSource.ts b/src/serialization/types/OrderSource.ts new file mode 100644 index 000000000..f260b8b09 --- /dev/null +++ b/src/serialization/types/OrderSource.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderSource: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optionalNullable(), + }); + +export declare namespace OrderSource { + export interface Raw { + name?: (string | null) | null; + } +} diff --git a/src/serialization/types/OrderState.ts b/src/serialization/types/OrderState.ts new file mode 100644 index 000000000..eb74759b5 --- /dev/null +++ b/src/serialization/types/OrderState.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const OrderState: core.serialization.Schema = + core.serialization.enum_(["OPEN", "COMPLETED", "CANCELED", "DRAFT"]); + +export declare namespace OrderState { + export type Raw = "OPEN" | "COMPLETED" | "CANCELED" | "DRAFT"; +} diff --git a/src/serialization/types/PauseSubscriptionResponse.ts b/src/serialization/types/PauseSubscriptionResponse.ts new file mode 100644 index 000000000..0567c7b00 --- /dev/null +++ b/src/serialization/types/PauseSubscriptionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; +import { SubscriptionAction } from "./SubscriptionAction"; + +export const PauseSubscriptionResponse: core.serialization.ObjectSchema< + serializers.PauseSubscriptionResponse.Raw, + Square.PauseSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), + actions: core.serialization.list(SubscriptionAction).optional(), +}); + +export declare namespace PauseSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + actions?: SubscriptionAction.Raw[] | null; + } +} diff --git a/src/serialization/types/PayOrderResponse.ts b/src/serialization/types/PayOrderResponse.ts new file mode 100644 index 000000000..568b53da5 --- /dev/null +++ b/src/serialization/types/PayOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Order } from "./Order"; + +export const PayOrderResponse: core.serialization.ObjectSchema< + serializers.PayOrderResponse.Raw, + Square.PayOrderResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + order: Order.optional(), +}); + +export declare namespace PayOrderResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + order?: Order.Raw | null; + } +} diff --git a/src/serialization/types/Payment.ts b/src/serialization/types/Payment.ts new file mode 100644 index 000000000..c088f6643 --- /dev/null +++ b/src/serialization/types/Payment.ts @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { ProcessingFee } from "./ProcessingFee"; +import { CardPaymentDetails } from "./CardPaymentDetails"; +import { CashPaymentDetails } from "./CashPaymentDetails"; +import { BankAccountPaymentDetails } from "./BankAccountPaymentDetails"; +import { ExternalPaymentDetails } from "./ExternalPaymentDetails"; +import { DigitalWalletDetails } from "./DigitalWalletDetails"; +import { BuyNowPayLaterDetails } from "./BuyNowPayLaterDetails"; +import { SquareAccountDetails } from "./SquareAccountDetails"; +import { RiskEvaluation } from "./RiskEvaluation"; +import { Address } from "./Address"; +import { DeviceDetails } from "./DeviceDetails"; +import { ApplicationDetails } from "./ApplicationDetails"; +import { OfflinePaymentDetails } from "./OfflinePaymentDetails"; + +export const Payment: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + amountMoney: core.serialization.property("amount_money", Money.optional()), + tipMoney: core.serialization.property("tip_money", Money.optional()), + totalMoney: core.serialization.property("total_money", Money.optional()), + appFeeMoney: core.serialization.property("app_fee_money", Money.optional()), + approvedMoney: core.serialization.property("approved_money", Money.optional()), + processingFee: core.serialization.property("processing_fee", core.serialization.list(ProcessingFee).optional()), + refundedMoney: core.serialization.property("refunded_money", Money.optional()), + status: core.serialization.string().optional(), + delayDuration: core.serialization.property("delay_duration", core.serialization.string().optional()), + delayAction: core.serialization.property("delay_action", core.serialization.string().optionalNullable()), + delayedUntil: core.serialization.property("delayed_until", core.serialization.string().optional()), + sourceType: core.serialization.property("source_type", core.serialization.string().optional()), + cardDetails: core.serialization.property("card_details", CardPaymentDetails.optional()), + cashDetails: core.serialization.property("cash_details", CashPaymentDetails.optional()), + bankAccountDetails: core.serialization.property("bank_account_details", BankAccountPaymentDetails.optional()), + externalDetails: core.serialization.property("external_details", ExternalPaymentDetails.optional()), + walletDetails: core.serialization.property("wallet_details", DigitalWalletDetails.optional()), + buyNowPayLaterDetails: core.serialization.property( + "buy_now_pay_later_details", + BuyNowPayLaterDetails.optional(), + ), + squareAccountDetails: core.serialization.property("square_account_details", SquareAccountDetails.optional()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + orderId: core.serialization.property("order_id", core.serialization.string().optional()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optional()), + customerId: core.serialization.property("customer_id", core.serialization.string().optional()), + employeeId: core.serialization.property("employee_id", core.serialization.string().optional()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), + refundIds: core.serialization.property( + "refund_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + riskEvaluation: core.serialization.property("risk_evaluation", RiskEvaluation.optional()), + terminalCheckoutId: core.serialization.property("terminal_checkout_id", core.serialization.string().optional()), + buyerEmailAddress: core.serialization.property("buyer_email_address", core.serialization.string().optional()), + billingAddress: core.serialization.property("billing_address", Address.optional()), + shippingAddress: core.serialization.property("shipping_address", Address.optional()), + note: core.serialization.string().optional(), + statementDescriptionIdentifier: core.serialization.property( + "statement_description_identifier", + core.serialization.string().optional(), + ), + capabilities: core.serialization.list(core.serialization.string()).optional(), + receiptNumber: core.serialization.property("receipt_number", core.serialization.string().optional()), + receiptUrl: core.serialization.property("receipt_url", core.serialization.string().optional()), + deviceDetails: core.serialization.property("device_details", DeviceDetails.optional()), + applicationDetails: core.serialization.property("application_details", ApplicationDetails.optional()), + isOfflinePayment: core.serialization.property("is_offline_payment", core.serialization.boolean().optional()), + offlinePaymentDetails: core.serialization.property("offline_payment_details", OfflinePaymentDetails.optional()), + versionToken: core.serialization.property("version_token", core.serialization.string().optionalNullable()), + }); + +export declare namespace Payment { + export interface Raw { + id?: string | null; + created_at?: string | null; + updated_at?: string | null; + amount_money?: Money.Raw | null; + tip_money?: Money.Raw | null; + total_money?: Money.Raw | null; + app_fee_money?: Money.Raw | null; + approved_money?: Money.Raw | null; + processing_fee?: ProcessingFee.Raw[] | null; + refunded_money?: Money.Raw | null; + status?: string | null; + delay_duration?: string | null; + delay_action?: (string | null) | null; + delayed_until?: string | null; + source_type?: string | null; + card_details?: CardPaymentDetails.Raw | null; + cash_details?: CashPaymentDetails.Raw | null; + bank_account_details?: BankAccountPaymentDetails.Raw | null; + external_details?: ExternalPaymentDetails.Raw | null; + wallet_details?: DigitalWalletDetails.Raw | null; + buy_now_pay_later_details?: BuyNowPayLaterDetails.Raw | null; + square_account_details?: SquareAccountDetails.Raw | null; + location_id?: string | null; + order_id?: string | null; + reference_id?: string | null; + customer_id?: string | null; + employee_id?: string | null; + team_member_id?: (string | null) | null; + refund_ids?: string[] | null; + risk_evaluation?: RiskEvaluation.Raw | null; + terminal_checkout_id?: string | null; + buyer_email_address?: string | null; + billing_address?: Address.Raw | null; + shipping_address?: Address.Raw | null; + note?: string | null; + statement_description_identifier?: string | null; + capabilities?: string[] | null; + receipt_number?: string | null; + receipt_url?: string | null; + device_details?: DeviceDetails.Raw | null; + application_details?: ApplicationDetails.Raw | null; + is_offline_payment?: boolean | null; + offline_payment_details?: OfflinePaymentDetails.Raw | null; + version_token?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityAppFeeRefundDetail.ts b/src/serialization/types/PaymentBalanceActivityAppFeeRefundDetail.ts new file mode 100644 index 000000000..93715e586 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityAppFeeRefundDetail.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityAppFeeRefundDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityAppFeeRefundDetail.Raw, + Square.PaymentBalanceActivityAppFeeRefundDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + refundId: core.serialization.property("refund_id", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityAppFeeRefundDetail { + export interface Raw { + payment_id?: (string | null) | null; + refund_id?: (string | null) | null; + location_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityAppFeeRevenueDetail.ts b/src/serialization/types/PaymentBalanceActivityAppFeeRevenueDetail.ts new file mode 100644 index 000000000..e51a7e1d7 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityAppFeeRevenueDetail.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityAppFeeRevenueDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityAppFeeRevenueDetail.Raw, + Square.PaymentBalanceActivityAppFeeRevenueDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityAppFeeRevenueDetail { + export interface Raw { + payment_id?: (string | null) | null; + location_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityAutomaticSavingsDetail.ts b/src/serialization/types/PaymentBalanceActivityAutomaticSavingsDetail.ts new file mode 100644 index 000000000..5a54a9f90 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityAutomaticSavingsDetail.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityAutomaticSavingsDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityAutomaticSavingsDetail.Raw, + Square.PaymentBalanceActivityAutomaticSavingsDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + payoutId: core.serialization.property("payout_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityAutomaticSavingsDetail { + export interface Raw { + payment_id?: (string | null) | null; + payout_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts b/src/serialization/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts new file mode 100644 index 000000000..936413940 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityAutomaticSavingsReversedDetail.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityAutomaticSavingsReversedDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityAutomaticSavingsReversedDetail.Raw, + Square.PaymentBalanceActivityAutomaticSavingsReversedDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + payoutId: core.serialization.property("payout_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityAutomaticSavingsReversedDetail { + export interface Raw { + payment_id?: (string | null) | null; + payout_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityChargeDetail.ts b/src/serialization/types/PaymentBalanceActivityChargeDetail.ts new file mode 100644 index 000000000..1106a0204 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityChargeDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityChargeDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityChargeDetail.Raw, + Square.PaymentBalanceActivityChargeDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityChargeDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityDepositFeeDetail.ts b/src/serialization/types/PaymentBalanceActivityDepositFeeDetail.ts new file mode 100644 index 000000000..8e3f3179e --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityDepositFeeDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityDepositFeeDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityDepositFeeDetail.Raw, + Square.PaymentBalanceActivityDepositFeeDetail +> = core.serialization.object({ + payoutId: core.serialization.property("payout_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityDepositFeeDetail { + export interface Raw { + payout_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityDepositFeeReversedDetail.ts b/src/serialization/types/PaymentBalanceActivityDepositFeeReversedDetail.ts new file mode 100644 index 000000000..53747895f --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityDepositFeeReversedDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityDepositFeeReversedDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityDepositFeeReversedDetail.Raw, + Square.PaymentBalanceActivityDepositFeeReversedDetail +> = core.serialization.object({ + payoutId: core.serialization.property("payout_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityDepositFeeReversedDetail { + export interface Raw { + payout_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityDisputeDetail.ts b/src/serialization/types/PaymentBalanceActivityDisputeDetail.ts new file mode 100644 index 000000000..a25697664 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityDisputeDetail.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityDisputeDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityDisputeDetail.Raw, + Square.PaymentBalanceActivityDisputeDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + disputeId: core.serialization.property("dispute_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityDisputeDetail { + export interface Raw { + payment_id?: (string | null) | null; + dispute_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityFeeDetail.ts b/src/serialization/types/PaymentBalanceActivityFeeDetail.ts new file mode 100644 index 000000000..30db029ff --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityFeeDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityFeeDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityFeeDetail.Raw, + Square.PaymentBalanceActivityFeeDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityFeeDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityFreeProcessingDetail.ts b/src/serialization/types/PaymentBalanceActivityFreeProcessingDetail.ts new file mode 100644 index 000000000..38e81759b --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityFreeProcessingDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityFreeProcessingDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityFreeProcessingDetail.Raw, + Square.PaymentBalanceActivityFreeProcessingDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityFreeProcessingDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityHoldAdjustmentDetail.ts b/src/serialization/types/PaymentBalanceActivityHoldAdjustmentDetail.ts new file mode 100644 index 000000000..7add70237 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityHoldAdjustmentDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityHoldAdjustmentDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityHoldAdjustmentDetail.Raw, + Square.PaymentBalanceActivityHoldAdjustmentDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityHoldAdjustmentDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityOpenDisputeDetail.ts b/src/serialization/types/PaymentBalanceActivityOpenDisputeDetail.ts new file mode 100644 index 000000000..ffe15a534 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityOpenDisputeDetail.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityOpenDisputeDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityOpenDisputeDetail.Raw, + Square.PaymentBalanceActivityOpenDisputeDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + disputeId: core.serialization.property("dispute_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityOpenDisputeDetail { + export interface Raw { + payment_id?: (string | null) | null; + dispute_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityOtherAdjustmentDetail.ts b/src/serialization/types/PaymentBalanceActivityOtherAdjustmentDetail.ts new file mode 100644 index 000000000..82a2306a8 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityOtherAdjustmentDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityOtherAdjustmentDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityOtherAdjustmentDetail.Raw, + Square.PaymentBalanceActivityOtherAdjustmentDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityOtherAdjustmentDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityOtherDetail.ts b/src/serialization/types/PaymentBalanceActivityOtherDetail.ts new file mode 100644 index 000000000..b630c73b3 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityOtherDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityOtherDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityOtherDetail.Raw, + Square.PaymentBalanceActivityOtherDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityOtherDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityRefundDetail.ts b/src/serialization/types/PaymentBalanceActivityRefundDetail.ts new file mode 100644 index 000000000..872d98175 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityRefundDetail.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityRefundDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityRefundDetail.Raw, + Square.PaymentBalanceActivityRefundDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + refundId: core.serialization.property("refund_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityRefundDetail { + export interface Raw { + payment_id?: (string | null) | null; + refund_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts b/src/serialization/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts new file mode 100644 index 000000000..9cac322fd --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityReleaseAdjustmentDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityReleaseAdjustmentDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityReleaseAdjustmentDetail.Raw, + Square.PaymentBalanceActivityReleaseAdjustmentDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityReleaseAdjustmentDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityReserveHoldDetail.ts b/src/serialization/types/PaymentBalanceActivityReserveHoldDetail.ts new file mode 100644 index 000000000..9fb979d1b --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityReserveHoldDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityReserveHoldDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityReserveHoldDetail.Raw, + Square.PaymentBalanceActivityReserveHoldDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityReserveHoldDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityReserveReleaseDetail.ts b/src/serialization/types/PaymentBalanceActivityReserveReleaseDetail.ts new file mode 100644 index 000000000..3c67aee14 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityReserveReleaseDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityReserveReleaseDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityReserveReleaseDetail.Raw, + Square.PaymentBalanceActivityReserveReleaseDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityReserveReleaseDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts b/src/serialization/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts new file mode 100644 index 000000000..3d6c15fa1 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivitySquareCapitalPaymentDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivitySquareCapitalPaymentDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivitySquareCapitalPaymentDetail.Raw, + Square.PaymentBalanceActivitySquareCapitalPaymentDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivitySquareCapitalPaymentDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts b/src/serialization/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts new file mode 100644 index 000000000..055245e5c --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivitySquareCapitalReversedPaymentDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivitySquareCapitalReversedPaymentDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivitySquareCapitalReversedPaymentDetail.Raw, + Square.PaymentBalanceActivitySquareCapitalReversedPaymentDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivitySquareCapitalReversedPaymentDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts b/src/serialization/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts new file mode 100644 index 000000000..5d4921bbe --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivitySquarePayrollTransferDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivitySquarePayrollTransferDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivitySquarePayrollTransferDetail.Raw, + Square.PaymentBalanceActivitySquarePayrollTransferDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivitySquarePayrollTransferDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts b/src/serialization/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts new file mode 100644 index 000000000..c1788834d --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivitySquarePayrollTransferReversedDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivitySquarePayrollTransferReversedDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivitySquarePayrollTransferReversedDetail.Raw, + Square.PaymentBalanceActivitySquarePayrollTransferReversedDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivitySquarePayrollTransferReversedDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityTaxOnFeeDetail.ts b/src/serialization/types/PaymentBalanceActivityTaxOnFeeDetail.ts new file mode 100644 index 000000000..e7b9c9ded --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityTaxOnFeeDetail.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityTaxOnFeeDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityTaxOnFeeDetail.Raw, + Square.PaymentBalanceActivityTaxOnFeeDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + taxRateDescription: core.serialization.property( + "tax_rate_description", + core.serialization.string().optionalNullable(), + ), +}); + +export declare namespace PaymentBalanceActivityTaxOnFeeDetail { + export interface Raw { + payment_id?: (string | null) | null; + tax_rate_description?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityThirdPartyFeeDetail.ts b/src/serialization/types/PaymentBalanceActivityThirdPartyFeeDetail.ts new file mode 100644 index 000000000..5cd6f8826 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityThirdPartyFeeDetail.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityThirdPartyFeeDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityThirdPartyFeeDetail.Raw, + Square.PaymentBalanceActivityThirdPartyFeeDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityThirdPartyFeeDetail { + export interface Raw { + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts b/src/serialization/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts new file mode 100644 index 000000000..177199e56 --- /dev/null +++ b/src/serialization/types/PaymentBalanceActivityThirdPartyFeeRefundDetail.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentBalanceActivityThirdPartyFeeRefundDetail: core.serialization.ObjectSchema< + serializers.PaymentBalanceActivityThirdPartyFeeRefundDetail.Raw, + Square.PaymentBalanceActivityThirdPartyFeeRefundDetail +> = core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + refundId: core.serialization.property("refund_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace PaymentBalanceActivityThirdPartyFeeRefundDetail { + export interface Raw { + payment_id?: (string | null) | null; + refund_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentLink.ts b/src/serialization/types/PaymentLink.ts new file mode 100644 index 000000000..4bef5bb04 --- /dev/null +++ b/src/serialization/types/PaymentLink.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CheckoutOptions } from "./CheckoutOptions"; +import { PrePopulatedData } from "./PrePopulatedData"; + +export const PaymentLink: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + version: core.serialization.number(), + description: core.serialization.string().optionalNullable(), + orderId: core.serialization.property("order_id", core.serialization.string().optional()), + checkoutOptions: core.serialization.property("checkout_options", CheckoutOptions.optional()), + prePopulatedData: core.serialization.property("pre_populated_data", PrePopulatedData.optional()), + url: core.serialization.string().optional(), + longUrl: core.serialization.property("long_url", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + paymentNote: core.serialization.property("payment_note", core.serialization.string().optionalNullable()), + }); + +export declare namespace PaymentLink { + export interface Raw { + id?: string | null; + version: number; + description?: (string | null) | null; + order_id?: string | null; + checkout_options?: CheckoutOptions.Raw | null; + pre_populated_data?: PrePopulatedData.Raw | null; + url?: string | null; + long_url?: string | null; + created_at?: string | null; + updated_at?: string | null; + payment_note?: (string | null) | null; + } +} diff --git a/src/serialization/types/PaymentLinkRelatedResources.ts b/src/serialization/types/PaymentLinkRelatedResources.ts new file mode 100644 index 000000000..b2b074e85 --- /dev/null +++ b/src/serialization/types/PaymentLinkRelatedResources.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Order } from "./Order"; + +export const PaymentLinkRelatedResources: core.serialization.ObjectSchema< + serializers.PaymentLinkRelatedResources.Raw, + Square.PaymentLinkRelatedResources +> = core.serialization.object({ + orders: core.serialization.list(Order).optionalNullable(), + subscriptionPlans: core.serialization.property( + "subscription_plans", + core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optionalNullable(), + ), +}); + +export declare namespace PaymentLinkRelatedResources { + export interface Raw { + orders?: (Order.Raw[] | null) | null; + subscription_plans?: (serializers.CatalogObject.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/PaymentOptions.ts b/src/serialization/types/PaymentOptions.ts new file mode 100644 index 000000000..35c20723c --- /dev/null +++ b/src/serialization/types/PaymentOptions.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { PaymentOptionsDelayAction } from "./PaymentOptionsDelayAction"; + +export const PaymentOptions: core.serialization.ObjectSchema = + core.serialization.object({ + autocomplete: core.serialization.boolean().optionalNullable(), + delayDuration: core.serialization.property("delay_duration", core.serialization.string().optionalNullable()), + acceptPartialAuthorization: core.serialization.property( + "accept_partial_authorization", + core.serialization.boolean().optionalNullable(), + ), + delayAction: core.serialization.property("delay_action", PaymentOptionsDelayAction.optional()), + }); + +export declare namespace PaymentOptions { + export interface Raw { + autocomplete?: (boolean | null) | null; + delay_duration?: (string | null) | null; + accept_partial_authorization?: (boolean | null) | null; + delay_action?: PaymentOptionsDelayAction.Raw | null; + } +} diff --git a/src/serialization/types/PaymentOptionsDelayAction.ts b/src/serialization/types/PaymentOptionsDelayAction.ts new file mode 100644 index 000000000..cc1fd6003 --- /dev/null +++ b/src/serialization/types/PaymentOptionsDelayAction.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentOptionsDelayAction: core.serialization.Schema< + serializers.PaymentOptionsDelayAction.Raw, + Square.PaymentOptionsDelayAction +> = core.serialization.enum_(["CANCEL", "COMPLETE"]); + +export declare namespace PaymentOptionsDelayAction { + export type Raw = "CANCEL" | "COMPLETE"; +} diff --git a/src/serialization/types/PaymentRefund.ts b/src/serialization/types/PaymentRefund.ts new file mode 100644 index 000000000..4dcdccbf4 --- /dev/null +++ b/src/serialization/types/PaymentRefund.ts @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DestinationDetails } from "./DestinationDetails"; +import { Money } from "./Money"; +import { ProcessingFee } from "./ProcessingFee"; + +export const PaymentRefund: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + status: core.serialization.string().optionalNullable(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + unlinked: core.serialization.boolean().optional(), + destinationType: core.serialization.property( + "destination_type", + core.serialization.string().optionalNullable(), + ), + destinationDetails: core.serialization.property("destination_details", DestinationDetails.optional()), + amountMoney: core.serialization.property("amount_money", Money), + appFeeMoney: core.serialization.property("app_fee_money", Money.optional()), + processingFee: core.serialization.property( + "processing_fee", + core.serialization.list(ProcessingFee).optionalNullable(), + ), + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + reason: core.serialization.string().optionalNullable(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optional()), + terminalRefundId: core.serialization.property("terminal_refund_id", core.serialization.string().optional()), + }); + +export declare namespace PaymentRefund { + export interface Raw { + id: string; + status?: (string | null) | null; + location_id?: (string | null) | null; + unlinked?: boolean | null; + destination_type?: (string | null) | null; + destination_details?: DestinationDetails.Raw | null; + amount_money: Money.Raw; + app_fee_money?: Money.Raw | null; + processing_fee?: (ProcessingFee.Raw[] | null) | null; + payment_id?: (string | null) | null; + order_id?: (string | null) | null; + reason?: (string | null) | null; + created_at?: string | null; + updated_at?: string | null; + team_member_id?: string | null; + terminal_refund_id?: string | null; + } +} diff --git a/src/serialization/types/PaymentSortField.ts b/src/serialization/types/PaymentSortField.ts new file mode 100644 index 000000000..fcdf26cdb --- /dev/null +++ b/src/serialization/types/PaymentSortField.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PaymentSortField: core.serialization.Schema = + core.serialization.enum_(["CREATED_AT", "OFFLINE_CREATED_AT", "UPDATED_AT"]); + +export declare namespace PaymentSortField { + export type Raw = "CREATED_AT" | "OFFLINE_CREATED_AT" | "UPDATED_AT"; +} diff --git a/src/serialization/types/Payout.ts b/src/serialization/types/Payout.ts new file mode 100644 index 000000000..e0517b2ad --- /dev/null +++ b/src/serialization/types/Payout.ts @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { PayoutStatus } from "./PayoutStatus"; +import { Money } from "./Money"; +import { Destination } from "./Destination"; +import { PayoutType } from "./PayoutType"; +import { PayoutFee } from "./PayoutFee"; + +export const Payout: core.serialization.ObjectSchema = core.serialization.object( + { + id: core.serialization.string(), + status: PayoutStatus.optional(), + locationId: core.serialization.property("location_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + amountMoney: core.serialization.property("amount_money", Money.optional()), + destination: Destination.optional(), + version: core.serialization.number().optional(), + type: PayoutType.optional(), + payoutFee: core.serialization.property("payout_fee", core.serialization.list(PayoutFee).optionalNullable()), + arrivalDate: core.serialization.property("arrival_date", core.serialization.string().optionalNullable()), + endToEndId: core.serialization.property("end_to_end_id", core.serialization.string().optionalNullable()), + }, +); + +export declare namespace Payout { + export interface Raw { + id: string; + status?: PayoutStatus.Raw | null; + location_id: string; + created_at?: string | null; + updated_at?: string | null; + amount_money?: Money.Raw | null; + destination?: Destination.Raw | null; + version?: number | null; + type?: PayoutType.Raw | null; + payout_fee?: (PayoutFee.Raw[] | null) | null; + arrival_date?: (string | null) | null; + end_to_end_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PayoutEntry.ts b/src/serialization/types/PayoutEntry.ts new file mode 100644 index 000000000..be6a53eed --- /dev/null +++ b/src/serialization/types/PayoutEntry.ts @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ActivityType } from "./ActivityType"; +import { Money } from "./Money"; +import { PaymentBalanceActivityAppFeeRevenueDetail } from "./PaymentBalanceActivityAppFeeRevenueDetail"; +import { PaymentBalanceActivityAppFeeRefundDetail } from "./PaymentBalanceActivityAppFeeRefundDetail"; +import { PaymentBalanceActivityAutomaticSavingsDetail } from "./PaymentBalanceActivityAutomaticSavingsDetail"; +import { PaymentBalanceActivityAutomaticSavingsReversedDetail } from "./PaymentBalanceActivityAutomaticSavingsReversedDetail"; +import { PaymentBalanceActivityChargeDetail } from "./PaymentBalanceActivityChargeDetail"; +import { PaymentBalanceActivityDepositFeeDetail } from "./PaymentBalanceActivityDepositFeeDetail"; +import { PaymentBalanceActivityDepositFeeReversedDetail } from "./PaymentBalanceActivityDepositFeeReversedDetail"; +import { PaymentBalanceActivityDisputeDetail } from "./PaymentBalanceActivityDisputeDetail"; +import { PaymentBalanceActivityFeeDetail } from "./PaymentBalanceActivityFeeDetail"; +import { PaymentBalanceActivityFreeProcessingDetail } from "./PaymentBalanceActivityFreeProcessingDetail"; +import { PaymentBalanceActivityHoldAdjustmentDetail } from "./PaymentBalanceActivityHoldAdjustmentDetail"; +import { PaymentBalanceActivityOpenDisputeDetail } from "./PaymentBalanceActivityOpenDisputeDetail"; +import { PaymentBalanceActivityOtherDetail } from "./PaymentBalanceActivityOtherDetail"; +import { PaymentBalanceActivityOtherAdjustmentDetail } from "./PaymentBalanceActivityOtherAdjustmentDetail"; +import { PaymentBalanceActivityRefundDetail } from "./PaymentBalanceActivityRefundDetail"; +import { PaymentBalanceActivityReleaseAdjustmentDetail } from "./PaymentBalanceActivityReleaseAdjustmentDetail"; +import { PaymentBalanceActivityReserveHoldDetail } from "./PaymentBalanceActivityReserveHoldDetail"; +import { PaymentBalanceActivityReserveReleaseDetail } from "./PaymentBalanceActivityReserveReleaseDetail"; +import { PaymentBalanceActivitySquareCapitalPaymentDetail } from "./PaymentBalanceActivitySquareCapitalPaymentDetail"; +import { PaymentBalanceActivitySquareCapitalReversedPaymentDetail } from "./PaymentBalanceActivitySquareCapitalReversedPaymentDetail"; +import { PaymentBalanceActivityTaxOnFeeDetail } from "./PaymentBalanceActivityTaxOnFeeDetail"; +import { PaymentBalanceActivityThirdPartyFeeDetail } from "./PaymentBalanceActivityThirdPartyFeeDetail"; +import { PaymentBalanceActivityThirdPartyFeeRefundDetail } from "./PaymentBalanceActivityThirdPartyFeeRefundDetail"; +import { PaymentBalanceActivitySquarePayrollTransferDetail } from "./PaymentBalanceActivitySquarePayrollTransferDetail"; +import { PaymentBalanceActivitySquarePayrollTransferReversedDetail } from "./PaymentBalanceActivitySquarePayrollTransferReversedDetail"; + +export const PayoutEntry: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + payoutId: core.serialization.property("payout_id", core.serialization.string()), + effectiveAt: core.serialization.property("effective_at", core.serialization.string().optionalNullable()), + type: ActivityType.optional(), + grossAmountMoney: core.serialization.property("gross_amount_money", Money.optional()), + feeAmountMoney: core.serialization.property("fee_amount_money", Money.optional()), + netAmountMoney: core.serialization.property("net_amount_money", Money.optional()), + typeAppFeeRevenueDetails: core.serialization.property( + "type_app_fee_revenue_details", + PaymentBalanceActivityAppFeeRevenueDetail.optional(), + ), + typeAppFeeRefundDetails: core.serialization.property( + "type_app_fee_refund_details", + PaymentBalanceActivityAppFeeRefundDetail.optional(), + ), + typeAutomaticSavingsDetails: core.serialization.property( + "type_automatic_savings_details", + PaymentBalanceActivityAutomaticSavingsDetail.optional(), + ), + typeAutomaticSavingsReversedDetails: core.serialization.property( + "type_automatic_savings_reversed_details", + PaymentBalanceActivityAutomaticSavingsReversedDetail.optional(), + ), + typeChargeDetails: core.serialization.property( + "type_charge_details", + PaymentBalanceActivityChargeDetail.optional(), + ), + typeDepositFeeDetails: core.serialization.property( + "type_deposit_fee_details", + PaymentBalanceActivityDepositFeeDetail.optional(), + ), + typeDepositFeeReversedDetails: core.serialization.property( + "type_deposit_fee_reversed_details", + PaymentBalanceActivityDepositFeeReversedDetail.optional(), + ), + typeDisputeDetails: core.serialization.property( + "type_dispute_details", + PaymentBalanceActivityDisputeDetail.optional(), + ), + typeFeeDetails: core.serialization.property("type_fee_details", PaymentBalanceActivityFeeDetail.optional()), + typeFreeProcessingDetails: core.serialization.property( + "type_free_processing_details", + PaymentBalanceActivityFreeProcessingDetail.optional(), + ), + typeHoldAdjustmentDetails: core.serialization.property( + "type_hold_adjustment_details", + PaymentBalanceActivityHoldAdjustmentDetail.optional(), + ), + typeOpenDisputeDetails: core.serialization.property( + "type_open_dispute_details", + PaymentBalanceActivityOpenDisputeDetail.optional(), + ), + typeOtherDetails: core.serialization.property( + "type_other_details", + PaymentBalanceActivityOtherDetail.optional(), + ), + typeOtherAdjustmentDetails: core.serialization.property( + "type_other_adjustment_details", + PaymentBalanceActivityOtherAdjustmentDetail.optional(), + ), + typeRefundDetails: core.serialization.property( + "type_refund_details", + PaymentBalanceActivityRefundDetail.optional(), + ), + typeReleaseAdjustmentDetails: core.serialization.property( + "type_release_adjustment_details", + PaymentBalanceActivityReleaseAdjustmentDetail.optional(), + ), + typeReserveHoldDetails: core.serialization.property( + "type_reserve_hold_details", + PaymentBalanceActivityReserveHoldDetail.optional(), + ), + typeReserveReleaseDetails: core.serialization.property( + "type_reserve_release_details", + PaymentBalanceActivityReserveReleaseDetail.optional(), + ), + typeSquareCapitalPaymentDetails: core.serialization.property( + "type_square_capital_payment_details", + PaymentBalanceActivitySquareCapitalPaymentDetail.optional(), + ), + typeSquareCapitalReversedPaymentDetails: core.serialization.property( + "type_square_capital_reversed_payment_details", + PaymentBalanceActivitySquareCapitalReversedPaymentDetail.optional(), + ), + typeTaxOnFeeDetails: core.serialization.property( + "type_tax_on_fee_details", + PaymentBalanceActivityTaxOnFeeDetail.optional(), + ), + typeThirdPartyFeeDetails: core.serialization.property( + "type_third_party_fee_details", + PaymentBalanceActivityThirdPartyFeeDetail.optional(), + ), + typeThirdPartyFeeRefundDetails: core.serialization.property( + "type_third_party_fee_refund_details", + PaymentBalanceActivityThirdPartyFeeRefundDetail.optional(), + ), + typeSquarePayrollTransferDetails: core.serialization.property( + "type_square_payroll_transfer_details", + PaymentBalanceActivitySquarePayrollTransferDetail.optional(), + ), + typeSquarePayrollTransferReversedDetails: core.serialization.property( + "type_square_payroll_transfer_reversed_details", + PaymentBalanceActivitySquarePayrollTransferReversedDetail.optional(), + ), + }); + +export declare namespace PayoutEntry { + export interface Raw { + id: string; + payout_id: string; + effective_at?: (string | null) | null; + type?: ActivityType.Raw | null; + gross_amount_money?: Money.Raw | null; + fee_amount_money?: Money.Raw | null; + net_amount_money?: Money.Raw | null; + type_app_fee_revenue_details?: PaymentBalanceActivityAppFeeRevenueDetail.Raw | null; + type_app_fee_refund_details?: PaymentBalanceActivityAppFeeRefundDetail.Raw | null; + type_automatic_savings_details?: PaymentBalanceActivityAutomaticSavingsDetail.Raw | null; + type_automatic_savings_reversed_details?: PaymentBalanceActivityAutomaticSavingsReversedDetail.Raw | null; + type_charge_details?: PaymentBalanceActivityChargeDetail.Raw | null; + type_deposit_fee_details?: PaymentBalanceActivityDepositFeeDetail.Raw | null; + type_deposit_fee_reversed_details?: PaymentBalanceActivityDepositFeeReversedDetail.Raw | null; + type_dispute_details?: PaymentBalanceActivityDisputeDetail.Raw | null; + type_fee_details?: PaymentBalanceActivityFeeDetail.Raw | null; + type_free_processing_details?: PaymentBalanceActivityFreeProcessingDetail.Raw | null; + type_hold_adjustment_details?: PaymentBalanceActivityHoldAdjustmentDetail.Raw | null; + type_open_dispute_details?: PaymentBalanceActivityOpenDisputeDetail.Raw | null; + type_other_details?: PaymentBalanceActivityOtherDetail.Raw | null; + type_other_adjustment_details?: PaymentBalanceActivityOtherAdjustmentDetail.Raw | null; + type_refund_details?: PaymentBalanceActivityRefundDetail.Raw | null; + type_release_adjustment_details?: PaymentBalanceActivityReleaseAdjustmentDetail.Raw | null; + type_reserve_hold_details?: PaymentBalanceActivityReserveHoldDetail.Raw | null; + type_reserve_release_details?: PaymentBalanceActivityReserveReleaseDetail.Raw | null; + type_square_capital_payment_details?: PaymentBalanceActivitySquareCapitalPaymentDetail.Raw | null; + type_square_capital_reversed_payment_details?: PaymentBalanceActivitySquareCapitalReversedPaymentDetail.Raw | null; + type_tax_on_fee_details?: PaymentBalanceActivityTaxOnFeeDetail.Raw | null; + type_third_party_fee_details?: PaymentBalanceActivityThirdPartyFeeDetail.Raw | null; + type_third_party_fee_refund_details?: PaymentBalanceActivityThirdPartyFeeRefundDetail.Raw | null; + type_square_payroll_transfer_details?: PaymentBalanceActivitySquarePayrollTransferDetail.Raw | null; + type_square_payroll_transfer_reversed_details?: PaymentBalanceActivitySquarePayrollTransferReversedDetail.Raw | null; + } +} diff --git a/src/serialization/types/PayoutFee.ts b/src/serialization/types/PayoutFee.ts new file mode 100644 index 000000000..336dee4cb --- /dev/null +++ b/src/serialization/types/PayoutFee.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { PayoutFeeType } from "./PayoutFeeType"; + +export const PayoutFee: core.serialization.ObjectSchema = + core.serialization.object({ + amountMoney: core.serialization.property("amount_money", Money.optional()), + effectiveAt: core.serialization.property("effective_at", core.serialization.string().optionalNullable()), + type: PayoutFeeType.optional(), + }); + +export declare namespace PayoutFee { + export interface Raw { + amount_money?: Money.Raw | null; + effective_at?: (string | null) | null; + type?: PayoutFeeType.Raw | null; + } +} diff --git a/src/serialization/types/PayoutFeeType.ts b/src/serialization/types/PayoutFeeType.ts new file mode 100644 index 000000000..9a1a80a65 --- /dev/null +++ b/src/serialization/types/PayoutFeeType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PayoutFeeType: core.serialization.Schema = + core.serialization.enum_(["TRANSFER_FEE", "TAX_ON_TRANSFER_FEE"]); + +export declare namespace PayoutFeeType { + export type Raw = "TRANSFER_FEE" | "TAX_ON_TRANSFER_FEE"; +} diff --git a/src/serialization/types/PayoutStatus.ts b/src/serialization/types/PayoutStatus.ts new file mode 100644 index 000000000..9754f341e --- /dev/null +++ b/src/serialization/types/PayoutStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PayoutStatus: core.serialization.Schema = + core.serialization.enum_(["SENT", "FAILED", "PAID"]); + +export declare namespace PayoutStatus { + export type Raw = "SENT" | "FAILED" | "PAID"; +} diff --git a/src/serialization/types/PayoutType.ts b/src/serialization/types/PayoutType.ts new file mode 100644 index 000000000..b098f055b --- /dev/null +++ b/src/serialization/types/PayoutType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PayoutType: core.serialization.Schema = + core.serialization.enum_(["BATCH", "SIMPLE"]); + +export declare namespace PayoutType { + export type Raw = "BATCH" | "SIMPLE"; +} diff --git a/src/serialization/types/Phase.ts b/src/serialization/types/Phase.ts new file mode 100644 index 000000000..729c46185 --- /dev/null +++ b/src/serialization/types/Phase.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Phase: core.serialization.ObjectSchema = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + ordinal: core.serialization.bigint().optionalNullable(), + orderTemplateId: core.serialization.property("order_template_id", core.serialization.string().optionalNullable()), + planPhaseUid: core.serialization.property("plan_phase_uid", core.serialization.string().optionalNullable()), +}); + +export declare namespace Phase { + export interface Raw { + uid?: (string | null) | null; + ordinal?: ((bigint | number) | null) | null; + order_template_id?: (string | null) | null; + plan_phase_uid?: (string | null) | null; + } +} diff --git a/src/serialization/types/PhaseInput.ts b/src/serialization/types/PhaseInput.ts new file mode 100644 index 000000000..dc5014d6e --- /dev/null +++ b/src/serialization/types/PhaseInput.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const PhaseInput: core.serialization.ObjectSchema = + core.serialization.object({ + ordinal: core.serialization.bigint(), + orderTemplateId: core.serialization.property( + "order_template_id", + core.serialization.string().optionalNullable(), + ), + }); + +export declare namespace PhaseInput { + export interface Raw { + ordinal: bigint | number; + order_template_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/PrePopulatedData.ts b/src/serialization/types/PrePopulatedData.ts new file mode 100644 index 000000000..ec9a1c623 --- /dev/null +++ b/src/serialization/types/PrePopulatedData.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; + +export const PrePopulatedData: core.serialization.ObjectSchema< + serializers.PrePopulatedData.Raw, + Square.PrePopulatedData +> = core.serialization.object({ + buyerEmail: core.serialization.property("buyer_email", core.serialization.string().optionalNullable()), + buyerPhoneNumber: core.serialization.property("buyer_phone_number", core.serialization.string().optionalNullable()), + buyerAddress: core.serialization.property("buyer_address", Address.optional()), +}); + +export declare namespace PrePopulatedData { + export interface Raw { + buyer_email?: (string | null) | null; + buyer_phone_number?: (string | null) | null; + buyer_address?: Address.Raw | null; + } +} diff --git a/src/serialization/types/ProcessingFee.ts b/src/serialization/types/ProcessingFee.ts new file mode 100644 index 000000000..0be927813 --- /dev/null +++ b/src/serialization/types/ProcessingFee.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const ProcessingFee: core.serialization.ObjectSchema = + core.serialization.object({ + effectiveAt: core.serialization.property("effective_at", core.serialization.string().optionalNullable()), + type: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money.optional()), + }); + +export declare namespace ProcessingFee { + export interface Raw { + effective_at?: (string | null) | null; + type?: (string | null) | null; + amount_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/Product.ts b/src/serialization/types/Product.ts new file mode 100644 index 000000000..ae4f181c8 --- /dev/null +++ b/src/serialization/types/Product.ts @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Product: core.serialization.Schema = core.serialization.enum_([ + "SQUARE_POS", + "EXTERNAL_API", + "BILLING", + "APPOINTMENTS", + "INVOICES", + "ONLINE_STORE", + "PAYROLL", + "DASHBOARD", + "ITEM_LIBRARY_IMPORT", + "OTHER", +]); + +export declare namespace Product { + export type Raw = + | "SQUARE_POS" + | "EXTERNAL_API" + | "BILLING" + | "APPOINTMENTS" + | "INVOICES" + | "ONLINE_STORE" + | "PAYROLL" + | "DASHBOARD" + | "ITEM_LIBRARY_IMPORT" + | "OTHER"; +} diff --git a/src/serialization/types/ProductType.ts b/src/serialization/types/ProductType.ts new file mode 100644 index 000000000..4c34c70bf --- /dev/null +++ b/src/serialization/types/ProductType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ProductType: core.serialization.Schema = + core.serialization.stringLiteral("TERMINAL_API"); + +export declare namespace ProductType { + export type Raw = "TERMINAL_API"; +} diff --git a/src/serialization/types/PublishInvoiceResponse.ts b/src/serialization/types/PublishInvoiceResponse.ts new file mode 100644 index 000000000..7158bd895 --- /dev/null +++ b/src/serialization/types/PublishInvoiceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Invoice } from "./Invoice"; +import { Error_ } from "./Error_"; + +export const PublishInvoiceResponse: core.serialization.ObjectSchema< + serializers.PublishInvoiceResponse.Raw, + Square.PublishInvoiceResponse +> = core.serialization.object({ + invoice: Invoice.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace PublishInvoiceResponse { + export interface Raw { + invoice?: Invoice.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/QrCodeOptions.ts b/src/serialization/types/QrCodeOptions.ts new file mode 100644 index 000000000..441b168c5 --- /dev/null +++ b/src/serialization/types/QrCodeOptions.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const QrCodeOptions: core.serialization.ObjectSchema = + core.serialization.object({ + title: core.serialization.string(), + body: core.serialization.string(), + barcodeContents: core.serialization.property("barcode_contents", core.serialization.string()), + }); + +export declare namespace QrCodeOptions { + export interface Raw { + title: string; + body: string; + barcode_contents: string; + } +} diff --git a/src/serialization/types/QuickPay.ts b/src/serialization/types/QuickPay.ts new file mode 100644 index 000000000..d2b0867ae --- /dev/null +++ b/src/serialization/types/QuickPay.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const QuickPay: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string(), + priceMoney: core.serialization.property("price_money", Money), + locationId: core.serialization.property("location_id", core.serialization.string()), + }); + +export declare namespace QuickPay { + export interface Raw { + name: string; + price_money: Money.Raw; + location_id: string; + } +} diff --git a/src/serialization/types/Range.ts b/src/serialization/types/Range.ts new file mode 100644 index 000000000..a77159731 --- /dev/null +++ b/src/serialization/types/Range.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Range: core.serialization.ObjectSchema = core.serialization.object({ + min: core.serialization.string().optionalNullable(), + max: core.serialization.string().optionalNullable(), +}); + +export declare namespace Range { + export interface Raw { + min?: (string | null) | null; + max?: (string | null) | null; + } +} diff --git a/src/serialization/types/ReceiptOptions.ts b/src/serialization/types/ReceiptOptions.ts new file mode 100644 index 000000000..d47ea2d70 --- /dev/null +++ b/src/serialization/types/ReceiptOptions.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ReceiptOptions: core.serialization.ObjectSchema = + core.serialization.object({ + paymentId: core.serialization.property("payment_id", core.serialization.string()), + printOnly: core.serialization.property("print_only", core.serialization.boolean().optionalNullable()), + isDuplicate: core.serialization.property("is_duplicate", core.serialization.boolean().optionalNullable()), + }); + +export declare namespace ReceiptOptions { + export interface Raw { + payment_id: string; + print_only?: (boolean | null) | null; + is_duplicate?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/RedeemLoyaltyRewardResponse.ts b/src/serialization/types/RedeemLoyaltyRewardResponse.ts new file mode 100644 index 000000000..b73aec760 --- /dev/null +++ b/src/serialization/types/RedeemLoyaltyRewardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyEvent } from "./LoyaltyEvent"; + +export const RedeemLoyaltyRewardResponse: core.serialization.ObjectSchema< + serializers.RedeemLoyaltyRewardResponse.Raw, + Square.RedeemLoyaltyRewardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + event: LoyaltyEvent.optional(), +}); + +export declare namespace RedeemLoyaltyRewardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + event?: LoyaltyEvent.Raw | null; + } +} diff --git a/src/serialization/types/Refund.ts b/src/serialization/types/Refund.ts new file mode 100644 index 000000000..616c4a302 --- /dev/null +++ b/src/serialization/types/Refund.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { RefundStatus } from "./RefundStatus"; +import { AdditionalRecipient } from "./AdditionalRecipient"; + +export const Refund: core.serialization.ObjectSchema = core.serialization.object( + { + id: core.serialization.string(), + locationId: core.serialization.property("location_id", core.serialization.string()), + transactionId: core.serialization.property("transaction_id", core.serialization.string().optionalNullable()), + tenderId: core.serialization.property("tender_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + reason: core.serialization.string(), + amountMoney: core.serialization.property("amount_money", Money), + status: RefundStatus, + processingFeeMoney: core.serialization.property("processing_fee_money", Money.optional()), + additionalRecipients: core.serialization.property( + "additional_recipients", + core.serialization.list(AdditionalRecipient).optionalNullable(), + ), + }, +); + +export declare namespace Refund { + export interface Raw { + id: string; + location_id: string; + transaction_id?: (string | null) | null; + tender_id: string; + created_at?: string | null; + reason: string; + amount_money: Money.Raw; + status: RefundStatus.Raw; + processing_fee_money?: Money.Raw | null; + additional_recipients?: (AdditionalRecipient.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/RefundPaymentResponse.ts b/src/serialization/types/RefundPaymentResponse.ts new file mode 100644 index 000000000..d76298edc --- /dev/null +++ b/src/serialization/types/RefundPaymentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { PaymentRefund } from "./PaymentRefund"; + +export const RefundPaymentResponse: core.serialization.ObjectSchema< + serializers.RefundPaymentResponse.Raw, + Square.RefundPaymentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + refund: PaymentRefund.optional(), +}); + +export declare namespace RefundPaymentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + refund?: PaymentRefund.Raw | null; + } +} diff --git a/src/serialization/types/RefundStatus.ts b/src/serialization/types/RefundStatus.ts new file mode 100644 index 000000000..1578265c9 --- /dev/null +++ b/src/serialization/types/RefundStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const RefundStatus: core.serialization.Schema = + core.serialization.enum_(["PENDING", "APPROVED", "REJECTED", "FAILED"]); + +export declare namespace RefundStatus { + export type Raw = "PENDING" | "APPROVED" | "REJECTED" | "FAILED"; +} diff --git a/src/serialization/types/RegisterDomainResponse.ts b/src/serialization/types/RegisterDomainResponse.ts new file mode 100644 index 000000000..87699cee4 --- /dev/null +++ b/src/serialization/types/RegisterDomainResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { RegisterDomainResponseStatus } from "./RegisterDomainResponseStatus"; + +export const RegisterDomainResponse: core.serialization.ObjectSchema< + serializers.RegisterDomainResponse.Raw, + Square.RegisterDomainResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + status: RegisterDomainResponseStatus.optional(), +}); + +export declare namespace RegisterDomainResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + status?: RegisterDomainResponseStatus.Raw | null; + } +} diff --git a/src/serialization/types/RegisterDomainResponseStatus.ts b/src/serialization/types/RegisterDomainResponseStatus.ts new file mode 100644 index 000000000..77fd34696 --- /dev/null +++ b/src/serialization/types/RegisterDomainResponseStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const RegisterDomainResponseStatus: core.serialization.Schema< + serializers.RegisterDomainResponseStatus.Raw, + Square.RegisterDomainResponseStatus +> = core.serialization.enum_(["PENDING", "VERIFIED"]); + +export declare namespace RegisterDomainResponseStatus { + export type Raw = "PENDING" | "VERIFIED"; +} diff --git a/src/serialization/types/RemoveGroupFromCustomerResponse.ts b/src/serialization/types/RemoveGroupFromCustomerResponse.ts new file mode 100644 index 000000000..a401b3884 --- /dev/null +++ b/src/serialization/types/RemoveGroupFromCustomerResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const RemoveGroupFromCustomerResponse: core.serialization.ObjectSchema< + serializers.RemoveGroupFromCustomerResponse.Raw, + Square.RemoveGroupFromCustomerResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RemoveGroupFromCustomerResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/ResumeSubscriptionResponse.ts b/src/serialization/types/ResumeSubscriptionResponse.ts new file mode 100644 index 000000000..b4713acf3 --- /dev/null +++ b/src/serialization/types/ResumeSubscriptionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; +import { SubscriptionAction } from "./SubscriptionAction"; + +export const ResumeSubscriptionResponse: core.serialization.ObjectSchema< + serializers.ResumeSubscriptionResponse.Raw, + Square.ResumeSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), + actions: core.serialization.list(SubscriptionAction).optional(), +}); + +export declare namespace ResumeSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + actions?: SubscriptionAction.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveBookingCustomAttributeDefinitionResponse.ts b/src/serialization/types/RetrieveBookingCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..6a4a3f8ed --- /dev/null +++ b/src/serialization/types/RetrieveBookingCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const RetrieveBookingCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.RetrieveBookingCustomAttributeDefinitionResponse.Raw, + Square.RetrieveBookingCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveBookingCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveBookingCustomAttributeResponse.ts b/src/serialization/types/RetrieveBookingCustomAttributeResponse.ts new file mode 100644 index 000000000..31e84710a --- /dev/null +++ b/src/serialization/types/RetrieveBookingCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const RetrieveBookingCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.RetrieveBookingCustomAttributeResponse.Raw, + Square.RetrieveBookingCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveBookingCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveJobResponse.ts b/src/serialization/types/RetrieveJobResponse.ts new file mode 100644 index 000000000..a4b98803c --- /dev/null +++ b/src/serialization/types/RetrieveJobResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Job } from "./Job"; +import { Error_ } from "./Error_"; + +export const RetrieveJobResponse: core.serialization.ObjectSchema< + serializers.RetrieveJobResponse.Raw, + Square.RetrieveJobResponse +> = core.serialization.object({ + job: Job.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveJobResponse { + export interface Raw { + job?: Job.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveLocationBookingProfileResponse.ts b/src/serialization/types/RetrieveLocationBookingProfileResponse.ts new file mode 100644 index 000000000..2ad615460 --- /dev/null +++ b/src/serialization/types/RetrieveLocationBookingProfileResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LocationBookingProfile } from "./LocationBookingProfile"; +import { Error_ } from "./Error_"; + +export const RetrieveLocationBookingProfileResponse: core.serialization.ObjectSchema< + serializers.RetrieveLocationBookingProfileResponse.Raw, + Square.RetrieveLocationBookingProfileResponse +> = core.serialization.object({ + locationBookingProfile: core.serialization.property("location_booking_profile", LocationBookingProfile.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveLocationBookingProfileResponse { + export interface Raw { + location_booking_profile?: LocationBookingProfile.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveLocationCustomAttributeDefinitionResponse.ts b/src/serialization/types/RetrieveLocationCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..01ddfc6db --- /dev/null +++ b/src/serialization/types/RetrieveLocationCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const RetrieveLocationCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.RetrieveLocationCustomAttributeDefinitionResponse.Raw, + Square.RetrieveLocationCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveLocationCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveLocationCustomAttributeResponse.ts b/src/serialization/types/RetrieveLocationCustomAttributeResponse.ts new file mode 100644 index 000000000..7bf3b30d3 --- /dev/null +++ b/src/serialization/types/RetrieveLocationCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const RetrieveLocationCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.RetrieveLocationCustomAttributeResponse.Raw, + Square.RetrieveLocationCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveLocationCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveLocationSettingsResponse.ts b/src/serialization/types/RetrieveLocationSettingsResponse.ts new file mode 100644 index 000000000..49d846137 --- /dev/null +++ b/src/serialization/types/RetrieveLocationSettingsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CheckoutLocationSettings } from "./CheckoutLocationSettings"; + +export const RetrieveLocationSettingsResponse: core.serialization.ObjectSchema< + serializers.RetrieveLocationSettingsResponse.Raw, + Square.RetrieveLocationSettingsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + locationSettings: core.serialization.property("location_settings", CheckoutLocationSettings.optional()), +}); + +export declare namespace RetrieveLocationSettingsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + location_settings?: CheckoutLocationSettings.Raw | null; + } +} diff --git a/src/serialization/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts b/src/serialization/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..7eaf410a2 --- /dev/null +++ b/src/serialization/types/RetrieveMerchantCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const RetrieveMerchantCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.RetrieveMerchantCustomAttributeDefinitionResponse.Raw, + Square.RetrieveMerchantCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveMerchantCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveMerchantCustomAttributeResponse.ts b/src/serialization/types/RetrieveMerchantCustomAttributeResponse.ts new file mode 100644 index 000000000..9f8d1d506 --- /dev/null +++ b/src/serialization/types/RetrieveMerchantCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const RetrieveMerchantCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.RetrieveMerchantCustomAttributeResponse.Raw, + Square.RetrieveMerchantCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveMerchantCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveMerchantSettingsResponse.ts b/src/serialization/types/RetrieveMerchantSettingsResponse.ts new file mode 100644 index 000000000..c8150ff50 --- /dev/null +++ b/src/serialization/types/RetrieveMerchantSettingsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CheckoutMerchantSettings } from "./CheckoutMerchantSettings"; + +export const RetrieveMerchantSettingsResponse: core.serialization.ObjectSchema< + serializers.RetrieveMerchantSettingsResponse.Raw, + Square.RetrieveMerchantSettingsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + merchantSettings: core.serialization.property("merchant_settings", CheckoutMerchantSettings.optional()), +}); + +export declare namespace RetrieveMerchantSettingsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + merchant_settings?: CheckoutMerchantSettings.Raw | null; + } +} diff --git a/src/serialization/types/RetrieveOrderCustomAttributeDefinitionResponse.ts b/src/serialization/types/RetrieveOrderCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..e783fa6b5 --- /dev/null +++ b/src/serialization/types/RetrieveOrderCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const RetrieveOrderCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.RetrieveOrderCustomAttributeDefinitionResponse.Raw, + Square.RetrieveOrderCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveOrderCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveOrderCustomAttributeResponse.ts b/src/serialization/types/RetrieveOrderCustomAttributeResponse.ts new file mode 100644 index 000000000..29ece41ae --- /dev/null +++ b/src/serialization/types/RetrieveOrderCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const RetrieveOrderCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.RetrieveOrderCustomAttributeResponse.Raw, + Square.RetrieveOrderCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveOrderCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RetrieveTokenStatusResponse.ts b/src/serialization/types/RetrieveTokenStatusResponse.ts new file mode 100644 index 000000000..c5dfd9b72 --- /dev/null +++ b/src/serialization/types/RetrieveTokenStatusResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const RetrieveTokenStatusResponse: core.serialization.ObjectSchema< + serializers.RetrieveTokenStatusResponse.Raw, + Square.RetrieveTokenStatusResponse +> = core.serialization.object({ + scopes: core.serialization.list(core.serialization.string()).optional(), + expiresAt: core.serialization.property("expires_at", core.serialization.string().optional()), + clientId: core.serialization.property("client_id", core.serialization.string().optional()), + merchantId: core.serialization.property("merchant_id", core.serialization.string().optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RetrieveTokenStatusResponse { + export interface Raw { + scopes?: string[] | null; + expires_at?: string | null; + client_id?: string | null; + merchant_id?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RevokeTokenResponse.ts b/src/serialization/types/RevokeTokenResponse.ts new file mode 100644 index 000000000..28ebe9146 --- /dev/null +++ b/src/serialization/types/RevokeTokenResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const RevokeTokenResponse: core.serialization.ObjectSchema< + serializers.RevokeTokenResponse.Raw, + Square.RevokeTokenResponse +> = core.serialization.object({ + success: core.serialization.boolean().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace RevokeTokenResponse { + export interface Raw { + success?: boolean | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/RiskEvaluation.ts b/src/serialization/types/RiskEvaluation.ts new file mode 100644 index 000000000..d2c707c06 --- /dev/null +++ b/src/serialization/types/RiskEvaluation.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { RiskEvaluationRiskLevel } from "./RiskEvaluationRiskLevel"; + +export const RiskEvaluation: core.serialization.ObjectSchema = + core.serialization.object({ + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + riskLevel: core.serialization.property("risk_level", RiskEvaluationRiskLevel.optional()), + }); + +export declare namespace RiskEvaluation { + export interface Raw { + created_at?: string | null; + risk_level?: RiskEvaluationRiskLevel.Raw | null; + } +} diff --git a/src/serialization/types/RiskEvaluationRiskLevel.ts b/src/serialization/types/RiskEvaluationRiskLevel.ts new file mode 100644 index 000000000..25df8b767 --- /dev/null +++ b/src/serialization/types/RiskEvaluationRiskLevel.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const RiskEvaluationRiskLevel: core.serialization.Schema< + serializers.RiskEvaluationRiskLevel.Raw, + Square.RiskEvaluationRiskLevel +> = core.serialization.enum_(["PENDING", "NORMAL", "MODERATE", "HIGH"]); + +export declare namespace RiskEvaluationRiskLevel { + export type Raw = "PENDING" | "NORMAL" | "MODERATE" | "HIGH"; +} diff --git a/src/serialization/types/SaveCardOptions.ts b/src/serialization/types/SaveCardOptions.ts new file mode 100644 index 000000000..21e0e6b9e --- /dev/null +++ b/src/serialization/types/SaveCardOptions.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SaveCardOptions: core.serialization.ObjectSchema = + core.serialization.object({ + customerId: core.serialization.property("customer_id", core.serialization.string()), + cardId: core.serialization.property("card_id", core.serialization.string().optional()), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace SaveCardOptions { + export interface Raw { + customer_id: string; + card_id?: string | null; + reference_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/SearchAvailabilityFilter.ts b/src/serialization/types/SearchAvailabilityFilter.ts new file mode 100644 index 000000000..14717622e --- /dev/null +++ b/src/serialization/types/SearchAvailabilityFilter.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TimeRange } from "./TimeRange"; +import { SegmentFilter } from "./SegmentFilter"; + +export const SearchAvailabilityFilter: core.serialization.ObjectSchema< + serializers.SearchAvailabilityFilter.Raw, + Square.SearchAvailabilityFilter +> = core.serialization.object({ + startAtRange: core.serialization.property("start_at_range", TimeRange), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + segmentFilters: core.serialization.property( + "segment_filters", + core.serialization.list(SegmentFilter).optionalNullable(), + ), + bookingId: core.serialization.property("booking_id", core.serialization.string().optionalNullable()), +}); + +export declare namespace SearchAvailabilityFilter { + export interface Raw { + start_at_range: TimeRange.Raw; + location_id?: (string | null) | null; + segment_filters?: (SegmentFilter.Raw[] | null) | null; + booking_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/SearchAvailabilityQuery.ts b/src/serialization/types/SearchAvailabilityQuery.ts new file mode 100644 index 000000000..a3166bbb3 --- /dev/null +++ b/src/serialization/types/SearchAvailabilityQuery.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchAvailabilityFilter } from "./SearchAvailabilityFilter"; + +export const SearchAvailabilityQuery: core.serialization.ObjectSchema< + serializers.SearchAvailabilityQuery.Raw, + Square.SearchAvailabilityQuery +> = core.serialization.object({ + filter: SearchAvailabilityFilter, +}); + +export declare namespace SearchAvailabilityQuery { + export interface Raw { + filter: SearchAvailabilityFilter.Raw; + } +} diff --git a/src/serialization/types/SearchAvailabilityResponse.ts b/src/serialization/types/SearchAvailabilityResponse.ts new file mode 100644 index 000000000..e2ccb73f4 --- /dev/null +++ b/src/serialization/types/SearchAvailabilityResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Availability } from "./Availability"; +import { Error_ } from "./Error_"; + +export const SearchAvailabilityResponse: core.serialization.ObjectSchema< + serializers.SearchAvailabilityResponse.Raw, + Square.SearchAvailabilityResponse +> = core.serialization.object({ + availabilities: core.serialization.list(Availability).optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace SearchAvailabilityResponse { + export interface Raw { + availabilities?: Availability.Raw[] | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/SearchCatalogItemsRequestStockLevel.ts b/src/serialization/types/SearchCatalogItemsRequestStockLevel.ts new file mode 100644 index 000000000..2f39d5598 --- /dev/null +++ b/src/serialization/types/SearchCatalogItemsRequestStockLevel.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SearchCatalogItemsRequestStockLevel: core.serialization.Schema< + serializers.SearchCatalogItemsRequestStockLevel.Raw, + Square.SearchCatalogItemsRequestStockLevel +> = core.serialization.enum_(["OUT", "LOW"]); + +export declare namespace SearchCatalogItemsRequestStockLevel { + export type Raw = "OUT" | "LOW"; +} diff --git a/src/serialization/types/SearchCatalogItemsResponse.ts b/src/serialization/types/SearchCatalogItemsResponse.ts new file mode 100644 index 000000000..159714d35 --- /dev/null +++ b/src/serialization/types/SearchCatalogItemsResponse.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const SearchCatalogItemsResponse: core.serialization.ObjectSchema< + serializers.SearchCatalogItemsResponse.Raw, + Square.SearchCatalogItemsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + items: core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optional(), + cursor: core.serialization.string().optional(), + matchedVariationIds: core.serialization.property( + "matched_variation_ids", + core.serialization.list(core.serialization.string()).optional(), + ), +}); + +export declare namespace SearchCatalogItemsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + items?: serializers.CatalogObject.Raw[] | null; + cursor?: string | null; + matched_variation_ids?: string[] | null; + } +} diff --git a/src/serialization/types/SearchCatalogObjectsResponse.ts b/src/serialization/types/SearchCatalogObjectsResponse.ts new file mode 100644 index 000000000..44f718830 --- /dev/null +++ b/src/serialization/types/SearchCatalogObjectsResponse.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const SearchCatalogObjectsResponse: core.serialization.ObjectSchema< + serializers.SearchCatalogObjectsResponse.Raw, + Square.SearchCatalogObjectsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + cursor: core.serialization.string().optional(), + objects: core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optional(), + relatedObjects: core.serialization.property( + "related_objects", + core.serialization.list(core.serialization.lazy(() => serializers.CatalogObject)).optional(), + ), + latestTime: core.serialization.property("latest_time", core.serialization.string().optional()), +}); + +export declare namespace SearchCatalogObjectsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + cursor?: string | null; + objects?: serializers.CatalogObject.Raw[] | null; + related_objects?: serializers.CatalogObject.Raw[] | null; + latest_time?: string | null; + } +} diff --git a/src/serialization/types/SearchCustomersResponse.ts b/src/serialization/types/SearchCustomersResponse.ts new file mode 100644 index 000000000..75a06ffd6 --- /dev/null +++ b/src/serialization/types/SearchCustomersResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Customer } from "./Customer"; + +export const SearchCustomersResponse: core.serialization.ObjectSchema< + serializers.SearchCustomersResponse.Raw, + Square.SearchCustomersResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + customers: core.serialization.list(Customer).optional(), + cursor: core.serialization.string().optional(), + count: core.serialization.bigint().optional(), +}); + +export declare namespace SearchCustomersResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + customers?: Customer.Raw[] | null; + cursor?: string | null; + count?: (bigint | number) | null; + } +} diff --git a/src/serialization/types/SearchEventsFilter.ts b/src/serialization/types/SearchEventsFilter.ts new file mode 100644 index 000000000..d146b9ba2 --- /dev/null +++ b/src/serialization/types/SearchEventsFilter.ts @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TimeRange } from "./TimeRange"; + +export const SearchEventsFilter: core.serialization.ObjectSchema< + serializers.SearchEventsFilter.Raw, + Square.SearchEventsFilter +> = core.serialization.object({ + eventTypes: core.serialization.property( + "event_types", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + merchantIds: core.serialization.property( + "merchant_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + createdAt: core.serialization.property("created_at", TimeRange.optional()), +}); + +export declare namespace SearchEventsFilter { + export interface Raw { + event_types?: (string[] | null) | null; + merchant_ids?: (string[] | null) | null; + location_ids?: (string[] | null) | null; + created_at?: TimeRange.Raw | null; + } +} diff --git a/src/serialization/types/SearchEventsQuery.ts b/src/serialization/types/SearchEventsQuery.ts new file mode 100644 index 000000000..b0bfbfc25 --- /dev/null +++ b/src/serialization/types/SearchEventsQuery.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchEventsFilter } from "./SearchEventsFilter"; +import { SearchEventsSort } from "./SearchEventsSort"; + +export const SearchEventsQuery: core.serialization.ObjectSchema< + serializers.SearchEventsQuery.Raw, + Square.SearchEventsQuery +> = core.serialization.object({ + filter: SearchEventsFilter.optional(), + sort: SearchEventsSort.optional(), +}); + +export declare namespace SearchEventsQuery { + export interface Raw { + filter?: SearchEventsFilter.Raw | null; + sort?: SearchEventsSort.Raw | null; + } +} diff --git a/src/serialization/types/SearchEventsResponse.ts b/src/serialization/types/SearchEventsResponse.ts new file mode 100644 index 000000000..1d600deda --- /dev/null +++ b/src/serialization/types/SearchEventsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Event } from "./Event"; +import { EventMetadata } from "./EventMetadata"; + +export const SearchEventsResponse: core.serialization.ObjectSchema< + serializers.SearchEventsResponse.Raw, + Square.SearchEventsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + events: core.serialization.list(Event).optional(), + metadata: core.serialization.list(EventMetadata).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchEventsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + events?: Event.Raw[] | null; + metadata?: EventMetadata.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SearchEventsSort.ts b/src/serialization/types/SearchEventsSort.ts new file mode 100644 index 000000000..65685abf8 --- /dev/null +++ b/src/serialization/types/SearchEventsSort.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchEventsSortField } from "./SearchEventsSortField"; +import { SortOrder } from "./SortOrder"; + +export const SearchEventsSort: core.serialization.ObjectSchema< + serializers.SearchEventsSort.Raw, + Square.SearchEventsSort +> = core.serialization.object({ + field: SearchEventsSortField.optional(), + order: SortOrder.optional(), +}); + +export declare namespace SearchEventsSort { + export interface Raw { + field?: SearchEventsSortField.Raw | null; + order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/SearchEventsSortField.ts b/src/serialization/types/SearchEventsSortField.ts new file mode 100644 index 000000000..4ec6be9fb --- /dev/null +++ b/src/serialization/types/SearchEventsSortField.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SearchEventsSortField: core.serialization.Schema< + serializers.SearchEventsSortField.Raw, + Square.SearchEventsSortField +> = core.serialization.stringLiteral("DEFAULT"); + +export declare namespace SearchEventsSortField { + export type Raw = "DEFAULT"; +} diff --git a/src/serialization/types/SearchInvoicesResponse.ts b/src/serialization/types/SearchInvoicesResponse.ts new file mode 100644 index 000000000..e0a13eeb9 --- /dev/null +++ b/src/serialization/types/SearchInvoicesResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Invoice } from "./Invoice"; +import { Error_ } from "./Error_"; + +export const SearchInvoicesResponse: core.serialization.ObjectSchema< + serializers.SearchInvoicesResponse.Raw, + Square.SearchInvoicesResponse +> = core.serialization.object({ + invoices: core.serialization.list(Invoice).optional(), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace SearchInvoicesResponse { + export interface Raw { + invoices?: Invoice.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts b/src/serialization/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts new file mode 100644 index 000000000..3c4301a0c --- /dev/null +++ b/src/serialization/types/SearchLoyaltyAccountsRequestLoyaltyAccountQuery.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyAccountMapping } from "./LoyaltyAccountMapping"; + +export const SearchLoyaltyAccountsRequestLoyaltyAccountQuery: core.serialization.ObjectSchema< + serializers.SearchLoyaltyAccountsRequestLoyaltyAccountQuery.Raw, + Square.SearchLoyaltyAccountsRequestLoyaltyAccountQuery +> = core.serialization.object({ + mappings: core.serialization.list(LoyaltyAccountMapping).optionalNullable(), + customerIds: core.serialization.property( + "customer_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace SearchLoyaltyAccountsRequestLoyaltyAccountQuery { + export interface Raw { + mappings?: (LoyaltyAccountMapping.Raw[] | null) | null; + customer_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/SearchLoyaltyAccountsResponse.ts b/src/serialization/types/SearchLoyaltyAccountsResponse.ts new file mode 100644 index 000000000..17f71231b --- /dev/null +++ b/src/serialization/types/SearchLoyaltyAccountsResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyAccount } from "./LoyaltyAccount"; + +export const SearchLoyaltyAccountsResponse: core.serialization.ObjectSchema< + serializers.SearchLoyaltyAccountsResponse.Raw, + Square.SearchLoyaltyAccountsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + loyaltyAccounts: core.serialization.property( + "loyalty_accounts", + core.serialization.list(LoyaltyAccount).optional(), + ), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchLoyaltyAccountsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + loyalty_accounts?: LoyaltyAccount.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SearchLoyaltyEventsResponse.ts b/src/serialization/types/SearchLoyaltyEventsResponse.ts new file mode 100644 index 000000000..918c6f772 --- /dev/null +++ b/src/serialization/types/SearchLoyaltyEventsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyEvent } from "./LoyaltyEvent"; + +export const SearchLoyaltyEventsResponse: core.serialization.ObjectSchema< + serializers.SearchLoyaltyEventsResponse.Raw, + Square.SearchLoyaltyEventsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + events: core.serialization.list(LoyaltyEvent).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchLoyaltyEventsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + events?: LoyaltyEvent.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts b/src/serialization/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts new file mode 100644 index 000000000..209f11035 --- /dev/null +++ b/src/serialization/types/SearchLoyaltyRewardsRequestLoyaltyRewardQuery.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { LoyaltyRewardStatus } from "./LoyaltyRewardStatus"; + +export const SearchLoyaltyRewardsRequestLoyaltyRewardQuery: core.serialization.ObjectSchema< + serializers.SearchLoyaltyRewardsRequestLoyaltyRewardQuery.Raw, + Square.SearchLoyaltyRewardsRequestLoyaltyRewardQuery +> = core.serialization.object({ + loyaltyAccountId: core.serialization.property("loyalty_account_id", core.serialization.string()), + status: LoyaltyRewardStatus.optional(), +}); + +export declare namespace SearchLoyaltyRewardsRequestLoyaltyRewardQuery { + export interface Raw { + loyalty_account_id: string; + status?: LoyaltyRewardStatus.Raw | null; + } +} diff --git a/src/serialization/types/SearchLoyaltyRewardsResponse.ts b/src/serialization/types/SearchLoyaltyRewardsResponse.ts new file mode 100644 index 000000000..e0533042c --- /dev/null +++ b/src/serialization/types/SearchLoyaltyRewardsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { LoyaltyReward } from "./LoyaltyReward"; + +export const SearchLoyaltyRewardsResponse: core.serialization.ObjectSchema< + serializers.SearchLoyaltyRewardsResponse.Raw, + Square.SearchLoyaltyRewardsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + rewards: core.serialization.list(LoyaltyReward).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchLoyaltyRewardsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + rewards?: LoyaltyReward.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SearchOrdersCustomerFilter.ts b/src/serialization/types/SearchOrdersCustomerFilter.ts new file mode 100644 index 000000000..d66b8fd5c --- /dev/null +++ b/src/serialization/types/SearchOrdersCustomerFilter.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SearchOrdersCustomerFilter: core.serialization.ObjectSchema< + serializers.SearchOrdersCustomerFilter.Raw, + Square.SearchOrdersCustomerFilter +> = core.serialization.object({ + customerIds: core.serialization.property( + "customer_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace SearchOrdersCustomerFilter { + export interface Raw { + customer_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/SearchOrdersDateTimeFilter.ts b/src/serialization/types/SearchOrdersDateTimeFilter.ts new file mode 100644 index 000000000..e84e1ab47 --- /dev/null +++ b/src/serialization/types/SearchOrdersDateTimeFilter.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TimeRange } from "./TimeRange"; + +export const SearchOrdersDateTimeFilter: core.serialization.ObjectSchema< + serializers.SearchOrdersDateTimeFilter.Raw, + Square.SearchOrdersDateTimeFilter +> = core.serialization.object({ + createdAt: core.serialization.property("created_at", TimeRange.optional()), + updatedAt: core.serialization.property("updated_at", TimeRange.optional()), + closedAt: core.serialization.property("closed_at", TimeRange.optional()), +}); + +export declare namespace SearchOrdersDateTimeFilter { + export interface Raw { + created_at?: TimeRange.Raw | null; + updated_at?: TimeRange.Raw | null; + closed_at?: TimeRange.Raw | null; + } +} diff --git a/src/serialization/types/SearchOrdersFilter.ts b/src/serialization/types/SearchOrdersFilter.ts new file mode 100644 index 000000000..dd1ee309e --- /dev/null +++ b/src/serialization/types/SearchOrdersFilter.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchOrdersStateFilter } from "./SearchOrdersStateFilter"; +import { SearchOrdersDateTimeFilter } from "./SearchOrdersDateTimeFilter"; +import { SearchOrdersFulfillmentFilter } from "./SearchOrdersFulfillmentFilter"; +import { SearchOrdersSourceFilter } from "./SearchOrdersSourceFilter"; +import { SearchOrdersCustomerFilter } from "./SearchOrdersCustomerFilter"; + +export const SearchOrdersFilter: core.serialization.ObjectSchema< + serializers.SearchOrdersFilter.Raw, + Square.SearchOrdersFilter +> = core.serialization.object({ + stateFilter: core.serialization.property("state_filter", SearchOrdersStateFilter.optional()), + dateTimeFilter: core.serialization.property("date_time_filter", SearchOrdersDateTimeFilter.optional()), + fulfillmentFilter: core.serialization.property("fulfillment_filter", SearchOrdersFulfillmentFilter.optional()), + sourceFilter: core.serialization.property("source_filter", SearchOrdersSourceFilter.optional()), + customerFilter: core.serialization.property("customer_filter", SearchOrdersCustomerFilter.optional()), +}); + +export declare namespace SearchOrdersFilter { + export interface Raw { + state_filter?: SearchOrdersStateFilter.Raw | null; + date_time_filter?: SearchOrdersDateTimeFilter.Raw | null; + fulfillment_filter?: SearchOrdersFulfillmentFilter.Raw | null; + source_filter?: SearchOrdersSourceFilter.Raw | null; + customer_filter?: SearchOrdersCustomerFilter.Raw | null; + } +} diff --git a/src/serialization/types/SearchOrdersFulfillmentFilter.ts b/src/serialization/types/SearchOrdersFulfillmentFilter.ts new file mode 100644 index 000000000..4fe610b63 --- /dev/null +++ b/src/serialization/types/SearchOrdersFulfillmentFilter.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { FulfillmentType } from "./FulfillmentType"; +import { FulfillmentState } from "./FulfillmentState"; + +export const SearchOrdersFulfillmentFilter: core.serialization.ObjectSchema< + serializers.SearchOrdersFulfillmentFilter.Raw, + Square.SearchOrdersFulfillmentFilter +> = core.serialization.object({ + fulfillmentTypes: core.serialization.property( + "fulfillment_types", + core.serialization.list(FulfillmentType).optionalNullable(), + ), + fulfillmentStates: core.serialization.property( + "fulfillment_states", + core.serialization.list(FulfillmentState).optionalNullable(), + ), +}); + +export declare namespace SearchOrdersFulfillmentFilter { + export interface Raw { + fulfillment_types?: (FulfillmentType.Raw[] | null) | null; + fulfillment_states?: (FulfillmentState.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/SearchOrdersQuery.ts b/src/serialization/types/SearchOrdersQuery.ts new file mode 100644 index 000000000..633eb35ff --- /dev/null +++ b/src/serialization/types/SearchOrdersQuery.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchOrdersFilter } from "./SearchOrdersFilter"; +import { SearchOrdersSort } from "./SearchOrdersSort"; + +export const SearchOrdersQuery: core.serialization.ObjectSchema< + serializers.SearchOrdersQuery.Raw, + Square.SearchOrdersQuery +> = core.serialization.object({ + filter: SearchOrdersFilter.optional(), + sort: SearchOrdersSort.optional(), +}); + +export declare namespace SearchOrdersQuery { + export interface Raw { + filter?: SearchOrdersFilter.Raw | null; + sort?: SearchOrdersSort.Raw | null; + } +} diff --git a/src/serialization/types/SearchOrdersResponse.ts b/src/serialization/types/SearchOrdersResponse.ts new file mode 100644 index 000000000..87a447147 --- /dev/null +++ b/src/serialization/types/SearchOrdersResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderEntry } from "./OrderEntry"; +import { Order } from "./Order"; +import { Error_ } from "./Error_"; + +export const SearchOrdersResponse: core.serialization.ObjectSchema< + serializers.SearchOrdersResponse.Raw, + Square.SearchOrdersResponse +> = core.serialization.object({ + orderEntries: core.serialization.property("order_entries", core.serialization.list(OrderEntry).optional()), + orders: core.serialization.list(Order).optional(), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace SearchOrdersResponse { + export interface Raw { + order_entries?: OrderEntry.Raw[] | null; + orders?: Order.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/SearchOrdersSort.ts b/src/serialization/types/SearchOrdersSort.ts new file mode 100644 index 000000000..d8a7509d8 --- /dev/null +++ b/src/serialization/types/SearchOrdersSort.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchOrdersSortField } from "./SearchOrdersSortField"; +import { SortOrder } from "./SortOrder"; + +export const SearchOrdersSort: core.serialization.ObjectSchema< + serializers.SearchOrdersSort.Raw, + Square.SearchOrdersSort +> = core.serialization.object({ + sortField: core.serialization.property("sort_field", SearchOrdersSortField), + sortOrder: core.serialization.property("sort_order", SortOrder.optional()), +}); + +export declare namespace SearchOrdersSort { + export interface Raw { + sort_field: SearchOrdersSortField.Raw; + sort_order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/SearchOrdersSortField.ts b/src/serialization/types/SearchOrdersSortField.ts new file mode 100644 index 000000000..d8e9d878f --- /dev/null +++ b/src/serialization/types/SearchOrdersSortField.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SearchOrdersSortField: core.serialization.Schema< + serializers.SearchOrdersSortField.Raw, + Square.SearchOrdersSortField +> = core.serialization.enum_(["CREATED_AT", "UPDATED_AT", "CLOSED_AT"]); + +export declare namespace SearchOrdersSortField { + export type Raw = "CREATED_AT" | "UPDATED_AT" | "CLOSED_AT"; +} diff --git a/src/serialization/types/SearchOrdersSourceFilter.ts b/src/serialization/types/SearchOrdersSourceFilter.ts new file mode 100644 index 000000000..ea863d6ca --- /dev/null +++ b/src/serialization/types/SearchOrdersSourceFilter.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SearchOrdersSourceFilter: core.serialization.ObjectSchema< + serializers.SearchOrdersSourceFilter.Raw, + Square.SearchOrdersSourceFilter +> = core.serialization.object({ + sourceNames: core.serialization.property( + "source_names", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace SearchOrdersSourceFilter { + export interface Raw { + source_names?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/SearchOrdersStateFilter.ts b/src/serialization/types/SearchOrdersStateFilter.ts new file mode 100644 index 000000000..351210688 --- /dev/null +++ b/src/serialization/types/SearchOrdersStateFilter.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { OrderState } from "./OrderState"; + +export const SearchOrdersStateFilter: core.serialization.ObjectSchema< + serializers.SearchOrdersStateFilter.Raw, + Square.SearchOrdersStateFilter +> = core.serialization.object({ + states: core.serialization.list(OrderState), +}); + +export declare namespace SearchOrdersStateFilter { + export interface Raw { + states: OrderState.Raw[]; + } +} diff --git a/src/serialization/types/SearchShiftsResponse.ts b/src/serialization/types/SearchShiftsResponse.ts new file mode 100644 index 000000000..dfa97e639 --- /dev/null +++ b/src/serialization/types/SearchShiftsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Shift } from "./Shift"; +import { Error_ } from "./Error_"; + +export const SearchShiftsResponse: core.serialization.ObjectSchema< + serializers.SearchShiftsResponse.Raw, + Square.SearchShiftsResponse +> = core.serialization.object({ + shifts: core.serialization.list(Shift).optional(), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace SearchShiftsResponse { + export interface Raw { + shifts?: Shift.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/SearchSubscriptionsFilter.ts b/src/serialization/types/SearchSubscriptionsFilter.ts new file mode 100644 index 000000000..aaae83cad --- /dev/null +++ b/src/serialization/types/SearchSubscriptionsFilter.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SearchSubscriptionsFilter: core.serialization.ObjectSchema< + serializers.SearchSubscriptionsFilter.Raw, + Square.SearchSubscriptionsFilter +> = core.serialization.object({ + customerIds: core.serialization.property( + "customer_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + sourceNames: core.serialization.property( + "source_names", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace SearchSubscriptionsFilter { + export interface Raw { + customer_ids?: (string[] | null) | null; + location_ids?: (string[] | null) | null; + source_names?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/SearchSubscriptionsQuery.ts b/src/serialization/types/SearchSubscriptionsQuery.ts new file mode 100644 index 000000000..4a85e5009 --- /dev/null +++ b/src/serialization/types/SearchSubscriptionsQuery.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchSubscriptionsFilter } from "./SearchSubscriptionsFilter"; + +export const SearchSubscriptionsQuery: core.serialization.ObjectSchema< + serializers.SearchSubscriptionsQuery.Raw, + Square.SearchSubscriptionsQuery +> = core.serialization.object({ + filter: SearchSubscriptionsFilter.optional(), +}); + +export declare namespace SearchSubscriptionsQuery { + export interface Raw { + filter?: SearchSubscriptionsFilter.Raw | null; + } +} diff --git a/src/serialization/types/SearchSubscriptionsResponse.ts b/src/serialization/types/SearchSubscriptionsResponse.ts new file mode 100644 index 000000000..d223f1998 --- /dev/null +++ b/src/serialization/types/SearchSubscriptionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; + +export const SearchSubscriptionsResponse: core.serialization.ObjectSchema< + serializers.SearchSubscriptionsResponse.Raw, + Square.SearchSubscriptionsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscriptions: core.serialization.list(Subscription).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchSubscriptionsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscriptions?: Subscription.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SearchTeamMembersFilter.ts b/src/serialization/types/SearchTeamMembersFilter.ts new file mode 100644 index 000000000..d69ba09d6 --- /dev/null +++ b/src/serialization/types/SearchTeamMembersFilter.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMemberStatus } from "./TeamMemberStatus"; + +export const SearchTeamMembersFilter: core.serialization.ObjectSchema< + serializers.SearchTeamMembersFilter.Raw, + Square.SearchTeamMembersFilter +> = core.serialization.object({ + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + status: TeamMemberStatus.optional(), + isOwner: core.serialization.property("is_owner", core.serialization.boolean().optionalNullable()), +}); + +export declare namespace SearchTeamMembersFilter { + export interface Raw { + location_ids?: (string[] | null) | null; + status?: TeamMemberStatus.Raw | null; + is_owner?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/SearchTeamMembersQuery.ts b/src/serialization/types/SearchTeamMembersQuery.ts new file mode 100644 index 000000000..742fe9f15 --- /dev/null +++ b/src/serialization/types/SearchTeamMembersQuery.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchTeamMembersFilter } from "./SearchTeamMembersFilter"; + +export const SearchTeamMembersQuery: core.serialization.ObjectSchema< + serializers.SearchTeamMembersQuery.Raw, + Square.SearchTeamMembersQuery +> = core.serialization.object({ + filter: SearchTeamMembersFilter.optional(), +}); + +export declare namespace SearchTeamMembersQuery { + export interface Raw { + filter?: SearchTeamMembersFilter.Raw | null; + } +} diff --git a/src/serialization/types/SearchTeamMembersResponse.ts b/src/serialization/types/SearchTeamMembersResponse.ts new file mode 100644 index 000000000..e0f67291f --- /dev/null +++ b/src/serialization/types/SearchTeamMembersResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMember } from "./TeamMember"; +import { Error_ } from "./Error_"; + +export const SearchTeamMembersResponse: core.serialization.ObjectSchema< + serializers.SearchTeamMembersResponse.Raw, + Square.SearchTeamMembersResponse +> = core.serialization.object({ + teamMembers: core.serialization.property("team_members", core.serialization.list(TeamMember).optional()), + cursor: core.serialization.string().optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace SearchTeamMembersResponse { + export interface Raw { + team_members?: TeamMember.Raw[] | null; + cursor?: string | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/SearchTerminalActionsResponse.ts b/src/serialization/types/SearchTerminalActionsResponse.ts new file mode 100644 index 000000000..3ee9cea3c --- /dev/null +++ b/src/serialization/types/SearchTerminalActionsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalAction } from "./TerminalAction"; + +export const SearchTerminalActionsResponse: core.serialization.ObjectSchema< + serializers.SearchTerminalActionsResponse.Raw, + Square.SearchTerminalActionsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + action: core.serialization.list(TerminalAction).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchTerminalActionsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + action?: TerminalAction.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SearchTerminalCheckoutsResponse.ts b/src/serialization/types/SearchTerminalCheckoutsResponse.ts new file mode 100644 index 000000000..47691c7c8 --- /dev/null +++ b/src/serialization/types/SearchTerminalCheckoutsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalCheckout } from "./TerminalCheckout"; + +export const SearchTerminalCheckoutsResponse: core.serialization.ObjectSchema< + serializers.SearchTerminalCheckoutsResponse.Raw, + Square.SearchTerminalCheckoutsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + checkouts: core.serialization.list(TerminalCheckout).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchTerminalCheckoutsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + checkouts?: TerminalCheckout.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SearchTerminalRefundsResponse.ts b/src/serialization/types/SearchTerminalRefundsResponse.ts new file mode 100644 index 000000000..cb7ed1e47 --- /dev/null +++ b/src/serialization/types/SearchTerminalRefundsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { TerminalRefund } from "./TerminalRefund"; + +export const SearchTerminalRefundsResponse: core.serialization.ObjectSchema< + serializers.SearchTerminalRefundsResponse.Raw, + Square.SearchTerminalRefundsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + refunds: core.serialization.list(TerminalRefund).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchTerminalRefundsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + refunds?: TerminalRefund.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SearchVendorsRequestFilter.ts b/src/serialization/types/SearchVendorsRequestFilter.ts new file mode 100644 index 000000000..1c68be2e6 --- /dev/null +++ b/src/serialization/types/SearchVendorsRequestFilter.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { VendorStatus } from "./VendorStatus"; + +export const SearchVendorsRequestFilter: core.serialization.ObjectSchema< + serializers.SearchVendorsRequestFilter.Raw, + Square.SearchVendorsRequestFilter +> = core.serialization.object({ + name: core.serialization.list(core.serialization.string()).optionalNullable(), + status: core.serialization.list(VendorStatus).optionalNullable(), +}); + +export declare namespace SearchVendorsRequestFilter { + export interface Raw { + name?: (string[] | null) | null; + status?: (VendorStatus.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/SearchVendorsRequestSort.ts b/src/serialization/types/SearchVendorsRequestSort.ts new file mode 100644 index 000000000..ced89af2d --- /dev/null +++ b/src/serialization/types/SearchVendorsRequestSort.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SearchVendorsRequestSortField } from "./SearchVendorsRequestSortField"; +import { SortOrder } from "./SortOrder"; + +export const SearchVendorsRequestSort: core.serialization.ObjectSchema< + serializers.SearchVendorsRequestSort.Raw, + Square.SearchVendorsRequestSort +> = core.serialization.object({ + field: SearchVendorsRequestSortField.optional(), + order: SortOrder.optional(), +}); + +export declare namespace SearchVendorsRequestSort { + export interface Raw { + field?: SearchVendorsRequestSortField.Raw | null; + order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/SearchVendorsRequestSortField.ts b/src/serialization/types/SearchVendorsRequestSortField.ts new file mode 100644 index 000000000..123d35513 --- /dev/null +++ b/src/serialization/types/SearchVendorsRequestSortField.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SearchVendorsRequestSortField: core.serialization.Schema< + serializers.SearchVendorsRequestSortField.Raw, + Square.SearchVendorsRequestSortField +> = core.serialization.enum_(["NAME", "CREATED_AT"]); + +export declare namespace SearchVendorsRequestSortField { + export type Raw = "NAME" | "CREATED_AT"; +} diff --git a/src/serialization/types/SearchVendorsResponse.ts b/src/serialization/types/SearchVendorsResponse.ts new file mode 100644 index 000000000..520e5eb14 --- /dev/null +++ b/src/serialization/types/SearchVendorsResponse.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Vendor } from "./Vendor"; + +export const SearchVendorsResponse: core.serialization.ObjectSchema< + serializers.SearchVendorsResponse.Raw, + Square.SearchVendorsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + vendors: core.serialization.list(Vendor).optional(), + cursor: core.serialization.string().optional(), +}); + +export declare namespace SearchVendorsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + vendors?: Vendor.Raw[] | null; + cursor?: string | null; + } +} diff --git a/src/serialization/types/SegmentFilter.ts b/src/serialization/types/SegmentFilter.ts new file mode 100644 index 000000000..2b990803b --- /dev/null +++ b/src/serialization/types/SegmentFilter.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { FilterValue } from "./FilterValue"; + +export const SegmentFilter: core.serialization.ObjectSchema = + core.serialization.object({ + serviceVariationId: core.serialization.property("service_variation_id", core.serialization.string()), + teamMemberIdFilter: core.serialization.property("team_member_id_filter", FilterValue.optional()), + }); + +export declare namespace SegmentFilter { + export interface Raw { + service_variation_id: string; + team_member_id_filter?: FilterValue.Raw | null; + } +} diff --git a/src/serialization/types/SelectOption.ts b/src/serialization/types/SelectOption.ts new file mode 100644 index 000000000..eba451cac --- /dev/null +++ b/src/serialization/types/SelectOption.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SelectOption: core.serialization.ObjectSchema = + core.serialization.object({ + referenceId: core.serialization.property("reference_id", core.serialization.string()), + title: core.serialization.string(), + }); + +export declare namespace SelectOption { + export interface Raw { + reference_id: string; + title: string; + } +} diff --git a/src/serialization/types/SelectOptions.ts b/src/serialization/types/SelectOptions.ts new file mode 100644 index 000000000..077fa48ec --- /dev/null +++ b/src/serialization/types/SelectOptions.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SelectOption } from "./SelectOption"; + +export const SelectOptions: core.serialization.ObjectSchema = + core.serialization.object({ + title: core.serialization.string(), + body: core.serialization.string(), + options: core.serialization.list(SelectOption), + selectedOption: core.serialization.property("selected_option", SelectOption.optional()), + }); + +export declare namespace SelectOptions { + export interface Raw { + title: string; + body: string; + options: SelectOption.Raw[]; + selected_option?: SelectOption.Raw | null; + } +} diff --git a/src/serialization/types/Shift.ts b/src/serialization/types/Shift.ts new file mode 100644 index 000000000..57b048af6 --- /dev/null +++ b/src/serialization/types/Shift.ts @@ -0,0 +1,47 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ShiftWage } from "./ShiftWage"; +import { Break } from "./Break"; +import { ShiftStatus } from "./ShiftStatus"; +import { Money } from "./Money"; + +export const Shift: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + employeeId: core.serialization.property("employee_id", core.serialization.string().optionalNullable()), + locationId: core.serialization.property("location_id", core.serialization.string()), + timezone: core.serialization.string().optionalNullable(), + startAt: core.serialization.property("start_at", core.serialization.string()), + endAt: core.serialization.property("end_at", core.serialization.string().optionalNullable()), + wage: ShiftWage.optional(), + breaks: core.serialization.list(Break).optionalNullable(), + status: ShiftStatus.optional(), + version: core.serialization.number().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), + declaredCashTipMoney: core.serialization.property("declared_cash_tip_money", Money.optional()), +}); + +export declare namespace Shift { + export interface Raw { + id?: string | null; + employee_id?: (string | null) | null; + location_id: string; + timezone?: (string | null) | null; + start_at: string; + end_at?: (string | null) | null; + wage?: ShiftWage.Raw | null; + breaks?: (Break.Raw[] | null) | null; + status?: ShiftStatus.Raw | null; + version?: number | null; + created_at?: string | null; + updated_at?: string | null; + team_member_id?: (string | null) | null; + declared_cash_tip_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/ShiftFilter.ts b/src/serialization/types/ShiftFilter.ts new file mode 100644 index 000000000..25e469ef9 --- /dev/null +++ b/src/serialization/types/ShiftFilter.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ShiftFilterStatus } from "./ShiftFilterStatus"; +import { TimeRange } from "./TimeRange"; +import { ShiftWorkday } from "./ShiftWorkday"; + +export const ShiftFilter: core.serialization.ObjectSchema = + core.serialization.object({ + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + employeeIds: core.serialization.property( + "employee_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + status: ShiftFilterStatus.optional(), + start: TimeRange.optional(), + end: TimeRange.optional(), + workday: ShiftWorkday.optional(), + teamMemberIds: core.serialization.property( + "team_member_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + }); + +export declare namespace ShiftFilter { + export interface Raw { + location_ids?: (string[] | null) | null; + employee_ids?: (string[] | null) | null; + status?: ShiftFilterStatus.Raw | null; + start?: TimeRange.Raw | null; + end?: TimeRange.Raw | null; + workday?: ShiftWorkday.Raw | null; + team_member_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/ShiftFilterStatus.ts b/src/serialization/types/ShiftFilterStatus.ts new file mode 100644 index 000000000..e127b4470 --- /dev/null +++ b/src/serialization/types/ShiftFilterStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ShiftFilterStatus: core.serialization.Schema = + core.serialization.enum_(["OPEN", "CLOSED"]); + +export declare namespace ShiftFilterStatus { + export type Raw = "OPEN" | "CLOSED"; +} diff --git a/src/serialization/types/ShiftQuery.ts b/src/serialization/types/ShiftQuery.ts new file mode 100644 index 000000000..28823f111 --- /dev/null +++ b/src/serialization/types/ShiftQuery.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ShiftFilter } from "./ShiftFilter"; +import { ShiftSort } from "./ShiftSort"; + +export const ShiftQuery: core.serialization.ObjectSchema = + core.serialization.object({ + filter: ShiftFilter.optional(), + sort: ShiftSort.optional(), + }); + +export declare namespace ShiftQuery { + export interface Raw { + filter?: ShiftFilter.Raw | null; + sort?: ShiftSort.Raw | null; + } +} diff --git a/src/serialization/types/ShiftSort.ts b/src/serialization/types/ShiftSort.ts new file mode 100644 index 000000000..60d726363 --- /dev/null +++ b/src/serialization/types/ShiftSort.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ShiftSortField } from "./ShiftSortField"; +import { SortOrder } from "./SortOrder"; + +export const ShiftSort: core.serialization.ObjectSchema = + core.serialization.object({ + field: ShiftSortField.optional(), + order: SortOrder.optional(), + }); + +export declare namespace ShiftSort { + export interface Raw { + field?: ShiftSortField.Raw | null; + order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/ShiftSortField.ts b/src/serialization/types/ShiftSortField.ts new file mode 100644 index 000000000..096579bad --- /dev/null +++ b/src/serialization/types/ShiftSortField.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ShiftSortField: core.serialization.Schema = + core.serialization.enum_(["START_AT", "END_AT", "CREATED_AT", "UPDATED_AT"]); + +export declare namespace ShiftSortField { + export type Raw = "START_AT" | "END_AT" | "CREATED_AT" | "UPDATED_AT"; +} diff --git a/src/serialization/types/ShiftStatus.ts b/src/serialization/types/ShiftStatus.ts new file mode 100644 index 000000000..4cc8e7274 --- /dev/null +++ b/src/serialization/types/ShiftStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ShiftStatus: core.serialization.Schema = + core.serialization.enum_(["OPEN", "CLOSED"]); + +export declare namespace ShiftStatus { + export type Raw = "OPEN" | "CLOSED"; +} diff --git a/src/serialization/types/ShiftWage.ts b/src/serialization/types/ShiftWage.ts new file mode 100644 index 000000000..71fc0893e --- /dev/null +++ b/src/serialization/types/ShiftWage.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const ShiftWage: core.serialization.ObjectSchema = + core.serialization.object({ + title: core.serialization.string().optionalNullable(), + hourlyRate: core.serialization.property("hourly_rate", Money.optional()), + jobId: core.serialization.property("job_id", core.serialization.string().optional()), + tipEligible: core.serialization.property("tip_eligible", core.serialization.boolean().optionalNullable()), + }); + +export declare namespace ShiftWage { + export interface Raw { + title?: (string | null) | null; + hourly_rate?: Money.Raw | null; + job_id?: string | null; + tip_eligible?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/ShiftWorkday.ts b/src/serialization/types/ShiftWorkday.ts new file mode 100644 index 000000000..883537a23 --- /dev/null +++ b/src/serialization/types/ShiftWorkday.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { DateRange } from "./DateRange"; +import { ShiftWorkdayMatcher } from "./ShiftWorkdayMatcher"; + +export const ShiftWorkday: core.serialization.ObjectSchema = + core.serialization.object({ + dateRange: core.serialization.property("date_range", DateRange.optional()), + matchShiftsBy: core.serialization.property("match_shifts_by", ShiftWorkdayMatcher.optional()), + defaultTimezone: core.serialization.property( + "default_timezone", + core.serialization.string().optionalNullable(), + ), + }); + +export declare namespace ShiftWorkday { + export interface Raw { + date_range?: DateRange.Raw | null; + match_shifts_by?: ShiftWorkdayMatcher.Raw | null; + default_timezone?: (string | null) | null; + } +} diff --git a/src/serialization/types/ShiftWorkdayMatcher.ts b/src/serialization/types/ShiftWorkdayMatcher.ts new file mode 100644 index 000000000..3db2c88b4 --- /dev/null +++ b/src/serialization/types/ShiftWorkdayMatcher.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const ShiftWorkdayMatcher: core.serialization.Schema< + serializers.ShiftWorkdayMatcher.Raw, + Square.ShiftWorkdayMatcher +> = core.serialization.enum_(["START_AT", "END_AT", "INTERSECTION"]); + +export declare namespace ShiftWorkdayMatcher { + export type Raw = "START_AT" | "END_AT" | "INTERSECTION"; +} diff --git a/src/serialization/types/ShippingFee.ts b/src/serialization/types/ShippingFee.ts new file mode 100644 index 000000000..c47e302c7 --- /dev/null +++ b/src/serialization/types/ShippingFee.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const ShippingFee: core.serialization.ObjectSchema = + core.serialization.object({ + name: core.serialization.string().optionalNullable(), + charge: Money, + }); + +export declare namespace ShippingFee { + export interface Raw { + name?: (string | null) | null; + charge: Money.Raw; + } +} diff --git a/src/serialization/types/SignatureImage.ts b/src/serialization/types/SignatureImage.ts new file mode 100644 index 000000000..9ac87e967 --- /dev/null +++ b/src/serialization/types/SignatureImage.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SignatureImage: core.serialization.ObjectSchema = + core.serialization.object({ + imageType: core.serialization.property("image_type", core.serialization.string().optional()), + data: core.serialization.string().optional(), + }); + +export declare namespace SignatureImage { + export interface Raw { + image_type?: string | null; + data?: string | null; + } +} diff --git a/src/serialization/types/SignatureOptions.ts b/src/serialization/types/SignatureOptions.ts new file mode 100644 index 000000000..4c6e23be4 --- /dev/null +++ b/src/serialization/types/SignatureOptions.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SignatureImage } from "./SignatureImage"; + +export const SignatureOptions: core.serialization.ObjectSchema< + serializers.SignatureOptions.Raw, + Square.SignatureOptions +> = core.serialization.object({ + title: core.serialization.string(), + body: core.serialization.string(), + signature: core.serialization.list(SignatureImage).optional(), +}); + +export declare namespace SignatureOptions { + export interface Raw { + title: string; + body: string; + signature?: SignatureImage.Raw[] | null; + } +} diff --git a/src/serialization/types/Site.ts b/src/serialization/types/Site.ts new file mode 100644 index 000000000..e464ae935 --- /dev/null +++ b/src/serialization/types/Site.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Site: core.serialization.ObjectSchema = core.serialization.object({ + id: core.serialization.string().optional(), + siteTitle: core.serialization.property("site_title", core.serialization.string().optionalNullable()), + domain: core.serialization.string().optionalNullable(), + isPublished: core.serialization.property("is_published", core.serialization.boolean().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), +}); + +export declare namespace Site { + export interface Raw { + id?: string | null; + site_title?: (string | null) | null; + domain?: (string | null) | null; + is_published?: (boolean | null) | null; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/Snippet.ts b/src/serialization/types/Snippet.ts new file mode 100644 index 000000000..09ca1c1a8 --- /dev/null +++ b/src/serialization/types/Snippet.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Snippet: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + siteId: core.serialization.property("site_id", core.serialization.string().optional()), + content: core.serialization.string(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + }); + +export declare namespace Snippet { + export interface Raw { + id?: string | null; + site_id?: string | null; + content: string; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/SortOrder.ts b/src/serialization/types/SortOrder.ts new file mode 100644 index 000000000..4e735a24e --- /dev/null +++ b/src/serialization/types/SortOrder.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SortOrder: core.serialization.Schema = + core.serialization.enum_(["DESC", "ASC"]); + +export declare namespace SortOrder { + export type Raw = "DESC" | "ASC"; +} diff --git a/src/serialization/types/SourceApplication.ts b/src/serialization/types/SourceApplication.ts new file mode 100644 index 000000000..ae209bc91 --- /dev/null +++ b/src/serialization/types/SourceApplication.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Product } from "./Product"; + +export const SourceApplication: core.serialization.ObjectSchema< + serializers.SourceApplication.Raw, + Square.SourceApplication +> = core.serialization.object({ + product: Product.optional(), + applicationId: core.serialization.property("application_id", core.serialization.string().optionalNullable()), + name: core.serialization.string().optionalNullable(), +}); + +export declare namespace SourceApplication { + export interface Raw { + product?: Product.Raw | null; + application_id?: (string | null) | null; + name?: (string | null) | null; + } +} diff --git a/src/serialization/types/SquareAccountDetails.ts b/src/serialization/types/SquareAccountDetails.ts new file mode 100644 index 000000000..0fe060eb8 --- /dev/null +++ b/src/serialization/types/SquareAccountDetails.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const SquareAccountDetails: core.serialization.ObjectSchema< + serializers.SquareAccountDetails.Raw, + Square.SquareAccountDetails +> = core.serialization.object({ + paymentSourceToken: core.serialization.property( + "payment_source_token", + core.serialization.string().optionalNullable(), + ), + errors: core.serialization.list(Error_).optionalNullable(), +}); + +export declare namespace SquareAccountDetails { + export interface Raw { + payment_source_token?: (string | null) | null; + errors?: (Error_.Raw[] | null) | null; + } +} diff --git a/src/serialization/types/StandardUnitDescription.ts b/src/serialization/types/StandardUnitDescription.ts new file mode 100644 index 000000000..6a1bf19a5 --- /dev/null +++ b/src/serialization/types/StandardUnitDescription.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { MeasurementUnit } from "./MeasurementUnit"; + +export const StandardUnitDescription: core.serialization.ObjectSchema< + serializers.StandardUnitDescription.Raw, + Square.StandardUnitDescription +> = core.serialization.object({ + unit: MeasurementUnit.optional(), + name: core.serialization.string().optionalNullable(), + abbreviation: core.serialization.string().optionalNullable(), +}); + +export declare namespace StandardUnitDescription { + export interface Raw { + unit?: MeasurementUnit.Raw | null; + name?: (string | null) | null; + abbreviation?: (string | null) | null; + } +} diff --git a/src/serialization/types/StandardUnitDescriptionGroup.ts b/src/serialization/types/StandardUnitDescriptionGroup.ts new file mode 100644 index 000000000..583900eff --- /dev/null +++ b/src/serialization/types/StandardUnitDescriptionGroup.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { StandardUnitDescription } from "./StandardUnitDescription"; + +export const StandardUnitDescriptionGroup: core.serialization.ObjectSchema< + serializers.StandardUnitDescriptionGroup.Raw, + Square.StandardUnitDescriptionGroup +> = core.serialization.object({ + standardUnitDescriptions: core.serialization.property( + "standard_unit_descriptions", + core.serialization.list(StandardUnitDescription).optionalNullable(), + ), + languageCode: core.serialization.property("language_code", core.serialization.string().optionalNullable()), +}); + +export declare namespace StandardUnitDescriptionGroup { + export interface Raw { + standard_unit_descriptions?: (StandardUnitDescription.Raw[] | null) | null; + language_code?: (string | null) | null; + } +} diff --git a/src/serialization/types/SubmitEvidenceResponse.ts b/src/serialization/types/SubmitEvidenceResponse.ts new file mode 100644 index 000000000..424f1d059 --- /dev/null +++ b/src/serialization/types/SubmitEvidenceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Dispute } from "./Dispute"; + +export const SubmitEvidenceResponse: core.serialization.ObjectSchema< + serializers.SubmitEvidenceResponse.Raw, + Square.SubmitEvidenceResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + dispute: Dispute.optional(), +}); + +export declare namespace SubmitEvidenceResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + dispute?: Dispute.Raw | null; + } +} diff --git a/src/serialization/types/Subscription.ts b/src/serialization/types/Subscription.ts new file mode 100644 index 000000000..b72d3d9bd --- /dev/null +++ b/src/serialization/types/Subscription.ts @@ -0,0 +1,65 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionStatus } from "./SubscriptionStatus"; +import { Money } from "./Money"; +import { SubscriptionSource } from "./SubscriptionSource"; +import { SubscriptionAction } from "./SubscriptionAction"; +import { Phase } from "./Phase"; + +export const Subscription: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + planVariationId: core.serialization.property("plan_variation_id", core.serialization.string().optional()), + customerId: core.serialization.property("customer_id", core.serialization.string().optional()), + startDate: core.serialization.property("start_date", core.serialization.string().optional()), + canceledDate: core.serialization.property("canceled_date", core.serialization.string().optionalNullable()), + chargedThroughDate: core.serialization.property("charged_through_date", core.serialization.string().optional()), + status: SubscriptionStatus.optional(), + taxPercentage: core.serialization.property("tax_percentage", core.serialization.string().optionalNullable()), + invoiceIds: core.serialization.property( + "invoice_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + priceOverrideMoney: core.serialization.property("price_override_money", Money.optional()), + version: core.serialization.bigint().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + cardId: core.serialization.property("card_id", core.serialization.string().optionalNullable()), + timezone: core.serialization.string().optional(), + source: SubscriptionSource.optional(), + actions: core.serialization.list(SubscriptionAction).optionalNullable(), + monthlyBillingAnchorDate: core.serialization.property( + "monthly_billing_anchor_date", + core.serialization.number().optional(), + ), + phases: core.serialization.list(Phase).optional(), + }); + +export declare namespace Subscription { + export interface Raw { + id?: string | null; + location_id?: string | null; + plan_variation_id?: string | null; + customer_id?: string | null; + start_date?: string | null; + canceled_date?: (string | null) | null; + charged_through_date?: string | null; + status?: SubscriptionStatus.Raw | null; + tax_percentage?: (string | null) | null; + invoice_ids?: string[] | null; + price_override_money?: Money.Raw | null; + version?: (bigint | number) | null; + created_at?: string | null; + card_id?: (string | null) | null; + timezone?: string | null; + source?: SubscriptionSource.Raw | null; + actions?: (SubscriptionAction.Raw[] | null) | null; + monthly_billing_anchor_date?: number | null; + phases?: Phase.Raw[] | null; + } +} diff --git a/src/serialization/types/SubscriptionAction.ts b/src/serialization/types/SubscriptionAction.ts new file mode 100644 index 000000000..82deb1d64 --- /dev/null +++ b/src/serialization/types/SubscriptionAction.ts @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionActionType } from "./SubscriptionActionType"; +import { Phase } from "./Phase"; + +export const SubscriptionAction: core.serialization.ObjectSchema< + serializers.SubscriptionAction.Raw, + Square.SubscriptionAction +> = core.serialization.object({ + id: core.serialization.string().optional(), + type: SubscriptionActionType.optional(), + effectiveDate: core.serialization.property("effective_date", core.serialization.string().optionalNullable()), + monthlyBillingAnchorDate: core.serialization.property( + "monthly_billing_anchor_date", + core.serialization.number().optionalNullable(), + ), + phases: core.serialization.list(Phase).optionalNullable(), + newPlanVariationId: core.serialization.property( + "new_plan_variation_id", + core.serialization.string().optionalNullable(), + ), +}); + +export declare namespace SubscriptionAction { + export interface Raw { + id?: string | null; + type?: SubscriptionActionType.Raw | null; + effective_date?: (string | null) | null; + monthly_billing_anchor_date?: (number | null) | null; + phases?: (Phase.Raw[] | null) | null; + new_plan_variation_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/SubscriptionActionType.ts b/src/serialization/types/SubscriptionActionType.ts new file mode 100644 index 000000000..6926eaf81 --- /dev/null +++ b/src/serialization/types/SubscriptionActionType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionActionType: core.serialization.Schema< + serializers.SubscriptionActionType.Raw, + Square.SubscriptionActionType +> = core.serialization.enum_(["CANCEL", "PAUSE", "RESUME", "SWAP_PLAN", "CHANGE_BILLING_ANCHOR_DATE"]); + +export declare namespace SubscriptionActionType { + export type Raw = "CANCEL" | "PAUSE" | "RESUME" | "SWAP_PLAN" | "CHANGE_BILLING_ANCHOR_DATE"; +} diff --git a/src/serialization/types/SubscriptionCadence.ts b/src/serialization/types/SubscriptionCadence.ts new file mode 100644 index 000000000..3554022c0 --- /dev/null +++ b/src/serialization/types/SubscriptionCadence.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionCadence: core.serialization.Schema< + serializers.SubscriptionCadence.Raw, + Square.SubscriptionCadence +> = core.serialization.enum_([ + "DAILY", + "WEEKLY", + "EVERY_TWO_WEEKS", + "THIRTY_DAYS", + "SIXTY_DAYS", + "NINETY_DAYS", + "MONTHLY", + "EVERY_TWO_MONTHS", + "QUARTERLY", + "EVERY_FOUR_MONTHS", + "EVERY_SIX_MONTHS", + "ANNUAL", + "EVERY_TWO_YEARS", +]); + +export declare namespace SubscriptionCadence { + export type Raw = + | "DAILY" + | "WEEKLY" + | "EVERY_TWO_WEEKS" + | "THIRTY_DAYS" + | "SIXTY_DAYS" + | "NINETY_DAYS" + | "MONTHLY" + | "EVERY_TWO_MONTHS" + | "QUARTERLY" + | "EVERY_FOUR_MONTHS" + | "EVERY_SIX_MONTHS" + | "ANNUAL" + | "EVERY_TWO_YEARS"; +} diff --git a/src/serialization/types/SubscriptionEvent.ts b/src/serialization/types/SubscriptionEvent.ts new file mode 100644 index 000000000..94071625b --- /dev/null +++ b/src/serialization/types/SubscriptionEvent.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionEventSubscriptionEventType } from "./SubscriptionEventSubscriptionEventType"; +import { SubscriptionEventInfo } from "./SubscriptionEventInfo"; +import { Phase } from "./Phase"; + +export const SubscriptionEvent: core.serialization.ObjectSchema< + serializers.SubscriptionEvent.Raw, + Square.SubscriptionEvent +> = core.serialization.object({ + id: core.serialization.string(), + subscriptionEventType: core.serialization.property( + "subscription_event_type", + SubscriptionEventSubscriptionEventType, + ), + effectiveDate: core.serialization.property("effective_date", core.serialization.string()), + monthlyBillingAnchorDate: core.serialization.property( + "monthly_billing_anchor_date", + core.serialization.number().optional(), + ), + info: SubscriptionEventInfo.optional(), + phases: core.serialization.list(Phase).optionalNullable(), + planVariationId: core.serialization.property("plan_variation_id", core.serialization.string()), +}); + +export declare namespace SubscriptionEvent { + export interface Raw { + id: string; + subscription_event_type: SubscriptionEventSubscriptionEventType.Raw; + effective_date: string; + monthly_billing_anchor_date?: number | null; + info?: SubscriptionEventInfo.Raw | null; + phases?: (Phase.Raw[] | null) | null; + plan_variation_id: string; + } +} diff --git a/src/serialization/types/SubscriptionEventInfo.ts b/src/serialization/types/SubscriptionEventInfo.ts new file mode 100644 index 000000000..1213901c6 --- /dev/null +++ b/src/serialization/types/SubscriptionEventInfo.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionEventInfoCode } from "./SubscriptionEventInfoCode"; + +export const SubscriptionEventInfo: core.serialization.ObjectSchema< + serializers.SubscriptionEventInfo.Raw, + Square.SubscriptionEventInfo +> = core.serialization.object({ + detail: core.serialization.string().optionalNullable(), + code: SubscriptionEventInfoCode.optional(), +}); + +export declare namespace SubscriptionEventInfo { + export interface Raw { + detail?: (string | null) | null; + code?: SubscriptionEventInfoCode.Raw | null; + } +} diff --git a/src/serialization/types/SubscriptionEventInfoCode.ts b/src/serialization/types/SubscriptionEventInfoCode.ts new file mode 100644 index 000000000..e435d9eb3 --- /dev/null +++ b/src/serialization/types/SubscriptionEventInfoCode.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionEventInfoCode: core.serialization.Schema< + serializers.SubscriptionEventInfoCode.Raw, + Square.SubscriptionEventInfoCode +> = core.serialization.enum_([ + "LOCATION_NOT_ACTIVE", + "LOCATION_CANNOT_ACCEPT_PAYMENT", + "CUSTOMER_DELETED", + "CUSTOMER_NO_EMAIL", + "CUSTOMER_NO_NAME", + "USER_PROVIDED", +]); + +export declare namespace SubscriptionEventInfoCode { + export type Raw = + | "LOCATION_NOT_ACTIVE" + | "LOCATION_CANNOT_ACCEPT_PAYMENT" + | "CUSTOMER_DELETED" + | "CUSTOMER_NO_EMAIL" + | "CUSTOMER_NO_NAME" + | "USER_PROVIDED"; +} diff --git a/src/serialization/types/SubscriptionEventSubscriptionEventType.ts b/src/serialization/types/SubscriptionEventSubscriptionEventType.ts new file mode 100644 index 000000000..62b7fc660 --- /dev/null +++ b/src/serialization/types/SubscriptionEventSubscriptionEventType.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionEventSubscriptionEventType: core.serialization.Schema< + serializers.SubscriptionEventSubscriptionEventType.Raw, + Square.SubscriptionEventSubscriptionEventType +> = core.serialization.enum_([ + "START_SUBSCRIPTION", + "PLAN_CHANGE", + "STOP_SUBSCRIPTION", + "DEACTIVATE_SUBSCRIPTION", + "RESUME_SUBSCRIPTION", + "PAUSE_SUBSCRIPTION", + "BILLING_ANCHOR_DATE_CHANGED", +]); + +export declare namespace SubscriptionEventSubscriptionEventType { + export type Raw = + | "START_SUBSCRIPTION" + | "PLAN_CHANGE" + | "STOP_SUBSCRIPTION" + | "DEACTIVATE_SUBSCRIPTION" + | "RESUME_SUBSCRIPTION" + | "PAUSE_SUBSCRIPTION" + | "BILLING_ANCHOR_DATE_CHANGED"; +} diff --git a/src/serialization/types/SubscriptionPhase.ts b/src/serialization/types/SubscriptionPhase.ts new file mode 100644 index 000000000..3bb6e311f --- /dev/null +++ b/src/serialization/types/SubscriptionPhase.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionCadence } from "./SubscriptionCadence"; +import { Money } from "./Money"; +import { SubscriptionPricing } from "./SubscriptionPricing"; + +export const SubscriptionPhase: core.serialization.ObjectSchema< + serializers.SubscriptionPhase.Raw, + Square.SubscriptionPhase +> = core.serialization.object({ + uid: core.serialization.string().optionalNullable(), + cadence: SubscriptionCadence, + periods: core.serialization.number().optionalNullable(), + recurringPriceMoney: core.serialization.property("recurring_price_money", Money.optional()), + ordinal: core.serialization.bigint().optionalNullable(), + pricing: SubscriptionPricing.optional(), +}); + +export declare namespace SubscriptionPhase { + export interface Raw { + uid?: (string | null) | null; + cadence: SubscriptionCadence.Raw; + periods?: (number | null) | null; + recurring_price_money?: Money.Raw | null; + ordinal?: ((bigint | number) | null) | null; + pricing?: SubscriptionPricing.Raw | null; + } +} diff --git a/src/serialization/types/SubscriptionPricing.ts b/src/serialization/types/SubscriptionPricing.ts new file mode 100644 index 000000000..6fa511e8c --- /dev/null +++ b/src/serialization/types/SubscriptionPricing.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SubscriptionPricingType } from "./SubscriptionPricingType"; +import { Money } from "./Money"; + +export const SubscriptionPricing: core.serialization.ObjectSchema< + serializers.SubscriptionPricing.Raw, + Square.SubscriptionPricing +> = core.serialization.object({ + type: SubscriptionPricingType.optional(), + discountIds: core.serialization.property( + "discount_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + priceMoney: core.serialization.property("price_money", Money.optional()), +}); + +export declare namespace SubscriptionPricing { + export interface Raw { + type?: SubscriptionPricingType.Raw | null; + discount_ids?: (string[] | null) | null; + price_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/SubscriptionPricingType.ts b/src/serialization/types/SubscriptionPricingType.ts new file mode 100644 index 000000000..e9f81a66d --- /dev/null +++ b/src/serialization/types/SubscriptionPricingType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionPricingType: core.serialization.Schema< + serializers.SubscriptionPricingType.Raw, + Square.SubscriptionPricingType +> = core.serialization.enum_(["STATIC", "RELATIVE"]); + +export declare namespace SubscriptionPricingType { + export type Raw = "STATIC" | "RELATIVE"; +} diff --git a/src/serialization/types/SubscriptionSource.ts b/src/serialization/types/SubscriptionSource.ts new file mode 100644 index 000000000..9024e0fb7 --- /dev/null +++ b/src/serialization/types/SubscriptionSource.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionSource: core.serialization.ObjectSchema< + serializers.SubscriptionSource.Raw, + Square.SubscriptionSource +> = core.serialization.object({ + name: core.serialization.string().optionalNullable(), +}); + +export declare namespace SubscriptionSource { + export interface Raw { + name?: (string | null) | null; + } +} diff --git a/src/serialization/types/SubscriptionStatus.ts b/src/serialization/types/SubscriptionStatus.ts new file mode 100644 index 000000000..b7b49f13c --- /dev/null +++ b/src/serialization/types/SubscriptionStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionStatus: core.serialization.Schema< + serializers.SubscriptionStatus.Raw, + Square.SubscriptionStatus +> = core.serialization.enum_(["PENDING", "ACTIVE", "CANCELED", "DEACTIVATED", "PAUSED"]); + +export declare namespace SubscriptionStatus { + export type Raw = "PENDING" | "ACTIVE" | "CANCELED" | "DEACTIVATED" | "PAUSED"; +} diff --git a/src/serialization/types/SubscriptionTestResult.ts b/src/serialization/types/SubscriptionTestResult.ts new file mode 100644 index 000000000..48676804e --- /dev/null +++ b/src/serialization/types/SubscriptionTestResult.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const SubscriptionTestResult: core.serialization.ObjectSchema< + serializers.SubscriptionTestResult.Raw, + Square.SubscriptionTestResult +> = core.serialization.object({ + id: core.serialization.string().optional(), + statusCode: core.serialization.property("status_code", core.serialization.number().optionalNullable()), + payload: core.serialization.string().optionalNullable(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), +}); + +export declare namespace SubscriptionTestResult { + export interface Raw { + id?: string | null; + status_code?: (number | null) | null; + payload?: (string | null) | null; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/SwapPlanResponse.ts b/src/serialization/types/SwapPlanResponse.ts new file mode 100644 index 000000000..dd9d5c3e6 --- /dev/null +++ b/src/serialization/types/SwapPlanResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; +import { SubscriptionAction } from "./SubscriptionAction"; + +export const SwapPlanResponse: core.serialization.ObjectSchema< + serializers.SwapPlanResponse.Raw, + Square.SwapPlanResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), + actions: core.serialization.list(SubscriptionAction).optional(), +}); + +export declare namespace SwapPlanResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + actions?: SubscriptionAction.Raw[] | null; + } +} diff --git a/src/serialization/types/TaxCalculationPhase.ts b/src/serialization/types/TaxCalculationPhase.ts new file mode 100644 index 000000000..5f58c7c01 --- /dev/null +++ b/src/serialization/types/TaxCalculationPhase.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TaxCalculationPhase: core.serialization.Schema< + serializers.TaxCalculationPhase.Raw, + Square.TaxCalculationPhase +> = core.serialization.enum_(["TAX_SUBTOTAL_PHASE", "TAX_TOTAL_PHASE"]); + +export declare namespace TaxCalculationPhase { + export type Raw = "TAX_SUBTOTAL_PHASE" | "TAX_TOTAL_PHASE"; +} diff --git a/src/serialization/types/TaxIds.ts b/src/serialization/types/TaxIds.ts new file mode 100644 index 000000000..6ac0e13c6 --- /dev/null +++ b/src/serialization/types/TaxIds.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TaxIds: core.serialization.ObjectSchema = core.serialization.object( + { + euVat: core.serialization.property("eu_vat", core.serialization.string().optional()), + frSiret: core.serialization.property("fr_siret", core.serialization.string().optional()), + frNaf: core.serialization.property("fr_naf", core.serialization.string().optional()), + esNif: core.serialization.property("es_nif", core.serialization.string().optional()), + jpQii: core.serialization.property("jp_qii", core.serialization.string().optional()), + }, +); + +export declare namespace TaxIds { + export interface Raw { + eu_vat?: string | null; + fr_siret?: string | null; + fr_naf?: string | null; + es_nif?: string | null; + jp_qii?: string | null; + } +} diff --git a/src/serialization/types/TaxInclusionType.ts b/src/serialization/types/TaxInclusionType.ts new file mode 100644 index 000000000..b48dcfa51 --- /dev/null +++ b/src/serialization/types/TaxInclusionType.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TaxInclusionType: core.serialization.Schema = + core.serialization.enum_(["ADDITIVE", "INCLUSIVE"]); + +export declare namespace TaxInclusionType { + export type Raw = "ADDITIVE" | "INCLUSIVE"; +} diff --git a/src/serialization/types/TeamMember.ts b/src/serialization/types/TeamMember.ts new file mode 100644 index 000000000..e3f666d99 --- /dev/null +++ b/src/serialization/types/TeamMember.ts @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMemberStatus } from "./TeamMemberStatus"; +import { TeamMemberAssignedLocations } from "./TeamMemberAssignedLocations"; +import { WageSetting } from "./WageSetting"; + +export const TeamMember: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + isOwner: core.serialization.property("is_owner", core.serialization.boolean().optional()), + status: TeamMemberStatus.optional(), + givenName: core.serialization.property("given_name", core.serialization.string().optionalNullable()), + familyName: core.serialization.property("family_name", core.serialization.string().optionalNullable()), + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + assignedLocations: core.serialization.property("assigned_locations", TeamMemberAssignedLocations.optional()), + wageSetting: core.serialization.property("wage_setting", WageSetting.optional()), + }); + +export declare namespace TeamMember { + export interface Raw { + id?: string | null; + reference_id?: (string | null) | null; + is_owner?: boolean | null; + status?: TeamMemberStatus.Raw | null; + given_name?: (string | null) | null; + family_name?: (string | null) | null; + email_address?: (string | null) | null; + phone_number?: (string | null) | null; + created_at?: string | null; + updated_at?: string | null; + assigned_locations?: TeamMemberAssignedLocations.Raw | null; + wage_setting?: WageSetting.Raw | null; + } +} diff --git a/src/serialization/types/TeamMemberAssignedLocations.ts b/src/serialization/types/TeamMemberAssignedLocations.ts new file mode 100644 index 000000000..3e8b93c5b --- /dev/null +++ b/src/serialization/types/TeamMemberAssignedLocations.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMemberAssignedLocationsAssignmentType } from "./TeamMemberAssignedLocationsAssignmentType"; + +export const TeamMemberAssignedLocations: core.serialization.ObjectSchema< + serializers.TeamMemberAssignedLocations.Raw, + Square.TeamMemberAssignedLocations +> = core.serialization.object({ + assignmentType: core.serialization.property( + "assignment_type", + TeamMemberAssignedLocationsAssignmentType.optional(), + ), + locationIds: core.serialization.property( + "location_ids", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), +}); + +export declare namespace TeamMemberAssignedLocations { + export interface Raw { + assignment_type?: TeamMemberAssignedLocationsAssignmentType.Raw | null; + location_ids?: (string[] | null) | null; + } +} diff --git a/src/serialization/types/TeamMemberAssignedLocationsAssignmentType.ts b/src/serialization/types/TeamMemberAssignedLocationsAssignmentType.ts new file mode 100644 index 000000000..97bbc383f --- /dev/null +++ b/src/serialization/types/TeamMemberAssignedLocationsAssignmentType.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TeamMemberAssignedLocationsAssignmentType: core.serialization.Schema< + serializers.TeamMemberAssignedLocationsAssignmentType.Raw, + Square.TeamMemberAssignedLocationsAssignmentType +> = core.serialization.enum_(["ALL_CURRENT_AND_FUTURE_LOCATIONS", "EXPLICIT_LOCATIONS"]); + +export declare namespace TeamMemberAssignedLocationsAssignmentType { + export type Raw = "ALL_CURRENT_AND_FUTURE_LOCATIONS" | "EXPLICIT_LOCATIONS"; +} diff --git a/src/serialization/types/TeamMemberBookingProfile.ts b/src/serialization/types/TeamMemberBookingProfile.ts new file mode 100644 index 000000000..584f4029d --- /dev/null +++ b/src/serialization/types/TeamMemberBookingProfile.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TeamMemberBookingProfile: core.serialization.ObjectSchema< + serializers.TeamMemberBookingProfile.Raw, + Square.TeamMemberBookingProfile +> = core.serialization.object({ + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optional()), + description: core.serialization.string().optional(), + displayName: core.serialization.property("display_name", core.serialization.string().optional()), + isBookable: core.serialization.property("is_bookable", core.serialization.boolean().optionalNullable()), + profileImageUrl: core.serialization.property("profile_image_url", core.serialization.string().optional()), +}); + +export declare namespace TeamMemberBookingProfile { + export interface Raw { + team_member_id?: string | null; + description?: string | null; + display_name?: string | null; + is_bookable?: (boolean | null) | null; + profile_image_url?: string | null; + } +} diff --git a/src/serialization/types/TeamMemberStatus.ts b/src/serialization/types/TeamMemberStatus.ts new file mode 100644 index 000000000..417fd5c05 --- /dev/null +++ b/src/serialization/types/TeamMemberStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TeamMemberStatus: core.serialization.Schema = + core.serialization.enum_(["ACTIVE", "INACTIVE"]); + +export declare namespace TeamMemberStatus { + export type Raw = "ACTIVE" | "INACTIVE"; +} diff --git a/src/serialization/types/TeamMemberWage.ts b/src/serialization/types/TeamMemberWage.ts new file mode 100644 index 000000000..c79f7fa98 --- /dev/null +++ b/src/serialization/types/TeamMemberWage.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const TeamMemberWage: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), + title: core.serialization.string().optionalNullable(), + hourlyRate: core.serialization.property("hourly_rate", Money.optional()), + jobId: core.serialization.property("job_id", core.serialization.string().optionalNullable()), + tipEligible: core.serialization.property("tip_eligible", core.serialization.boolean().optionalNullable()), + }); + +export declare namespace TeamMemberWage { + export interface Raw { + id?: string | null; + team_member_id?: (string | null) | null; + title?: (string | null) | null; + hourly_rate?: Money.Raw | null; + job_id?: (string | null) | null; + tip_eligible?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/Tender.ts b/src/serialization/types/Tender.ts new file mode 100644 index 000000000..c30875d12 --- /dev/null +++ b/src/serialization/types/Tender.ts @@ -0,0 +1,68 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { TenderType } from "./TenderType"; +import { TenderCardDetails } from "./TenderCardDetails"; +import { TenderCashDetails } from "./TenderCashDetails"; +import { TenderBankAccountDetails } from "./TenderBankAccountDetails"; +import { TenderBuyNowPayLaterDetails } from "./TenderBuyNowPayLaterDetails"; +import { TenderSquareAccountDetails } from "./TenderSquareAccountDetails"; +import { AdditionalRecipient } from "./AdditionalRecipient"; + +export const Tender: core.serialization.ObjectSchema = core.serialization.object( + { + id: core.serialization.string().optional(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + transactionId: core.serialization.property("transaction_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + note: core.serialization.string().optionalNullable(), + amountMoney: core.serialization.property("amount_money", Money.optional()), + tipMoney: core.serialization.property("tip_money", Money.optional()), + processingFeeMoney: core.serialization.property("processing_fee_money", Money.optional()), + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + type: TenderType, + cardDetails: core.serialization.property("card_details", TenderCardDetails.optional()), + cashDetails: core.serialization.property("cash_details", TenderCashDetails.optional()), + bankAccountDetails: core.serialization.property("bank_account_details", TenderBankAccountDetails.optional()), + buyNowPayLaterDetails: core.serialization.property( + "buy_now_pay_later_details", + TenderBuyNowPayLaterDetails.optional(), + ), + squareAccountDetails: core.serialization.property( + "square_account_details", + TenderSquareAccountDetails.optional(), + ), + additionalRecipients: core.serialization.property( + "additional_recipients", + core.serialization.list(AdditionalRecipient).optionalNullable(), + ), + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + }, +); + +export declare namespace Tender { + export interface Raw { + id?: string | null; + location_id?: (string | null) | null; + transaction_id?: (string | null) | null; + created_at?: string | null; + note?: (string | null) | null; + amount_money?: Money.Raw | null; + tip_money?: Money.Raw | null; + processing_fee_money?: Money.Raw | null; + customer_id?: (string | null) | null; + type: TenderType.Raw; + card_details?: TenderCardDetails.Raw | null; + cash_details?: TenderCashDetails.Raw | null; + bank_account_details?: TenderBankAccountDetails.Raw | null; + buy_now_pay_later_details?: TenderBuyNowPayLaterDetails.Raw | null; + square_account_details?: TenderSquareAccountDetails.Raw | null; + additional_recipients?: (AdditionalRecipient.Raw[] | null) | null; + payment_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/TenderBankAccountDetails.ts b/src/serialization/types/TenderBankAccountDetails.ts new file mode 100644 index 000000000..1d3f14ded --- /dev/null +++ b/src/serialization/types/TenderBankAccountDetails.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TenderBankAccountDetailsStatus } from "./TenderBankAccountDetailsStatus"; + +export const TenderBankAccountDetails: core.serialization.ObjectSchema< + serializers.TenderBankAccountDetails.Raw, + Square.TenderBankAccountDetails +> = core.serialization.object({ + status: TenderBankAccountDetailsStatus.optional(), +}); + +export declare namespace TenderBankAccountDetails { + export interface Raw { + status?: TenderBankAccountDetailsStatus.Raw | null; + } +} diff --git a/src/serialization/types/TenderBankAccountDetailsStatus.ts b/src/serialization/types/TenderBankAccountDetailsStatus.ts new file mode 100644 index 000000000..5b554fbff --- /dev/null +++ b/src/serialization/types/TenderBankAccountDetailsStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TenderBankAccountDetailsStatus: core.serialization.Schema< + serializers.TenderBankAccountDetailsStatus.Raw, + Square.TenderBankAccountDetailsStatus +> = core.serialization.enum_(["PENDING", "COMPLETED", "FAILED"]); + +export declare namespace TenderBankAccountDetailsStatus { + export type Raw = "PENDING" | "COMPLETED" | "FAILED"; +} diff --git a/src/serialization/types/TenderBuyNowPayLaterDetails.ts b/src/serialization/types/TenderBuyNowPayLaterDetails.ts new file mode 100644 index 000000000..b3ef06e94 --- /dev/null +++ b/src/serialization/types/TenderBuyNowPayLaterDetails.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TenderBuyNowPayLaterDetailsBrand } from "./TenderBuyNowPayLaterDetailsBrand"; +import { TenderBuyNowPayLaterDetailsStatus } from "./TenderBuyNowPayLaterDetailsStatus"; + +export const TenderBuyNowPayLaterDetails: core.serialization.ObjectSchema< + serializers.TenderBuyNowPayLaterDetails.Raw, + Square.TenderBuyNowPayLaterDetails +> = core.serialization.object({ + buyNowPayLaterBrand: core.serialization.property( + "buy_now_pay_later_brand", + TenderBuyNowPayLaterDetailsBrand.optional(), + ), + status: TenderBuyNowPayLaterDetailsStatus.optional(), +}); + +export declare namespace TenderBuyNowPayLaterDetails { + export interface Raw { + buy_now_pay_later_brand?: TenderBuyNowPayLaterDetailsBrand.Raw | null; + status?: TenderBuyNowPayLaterDetailsStatus.Raw | null; + } +} diff --git a/src/serialization/types/TenderBuyNowPayLaterDetailsBrand.ts b/src/serialization/types/TenderBuyNowPayLaterDetailsBrand.ts new file mode 100644 index 000000000..95ccb3e4d --- /dev/null +++ b/src/serialization/types/TenderBuyNowPayLaterDetailsBrand.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TenderBuyNowPayLaterDetailsBrand: core.serialization.Schema< + serializers.TenderBuyNowPayLaterDetailsBrand.Raw, + Square.TenderBuyNowPayLaterDetailsBrand +> = core.serialization.enum_(["OTHER_BRAND", "AFTERPAY"]); + +export declare namespace TenderBuyNowPayLaterDetailsBrand { + export type Raw = "OTHER_BRAND" | "AFTERPAY"; +} diff --git a/src/serialization/types/TenderBuyNowPayLaterDetailsStatus.ts b/src/serialization/types/TenderBuyNowPayLaterDetailsStatus.ts new file mode 100644 index 000000000..89dfff83e --- /dev/null +++ b/src/serialization/types/TenderBuyNowPayLaterDetailsStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TenderBuyNowPayLaterDetailsStatus: core.serialization.Schema< + serializers.TenderBuyNowPayLaterDetailsStatus.Raw, + Square.TenderBuyNowPayLaterDetailsStatus +> = core.serialization.enum_(["AUTHORIZED", "CAPTURED", "VOIDED", "FAILED"]); + +export declare namespace TenderBuyNowPayLaterDetailsStatus { + export type Raw = "AUTHORIZED" | "CAPTURED" | "VOIDED" | "FAILED"; +} diff --git a/src/serialization/types/TenderCardDetails.ts b/src/serialization/types/TenderCardDetails.ts new file mode 100644 index 000000000..2a9b53e02 --- /dev/null +++ b/src/serialization/types/TenderCardDetails.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TenderCardDetailsStatus } from "./TenderCardDetailsStatus"; +import { Card } from "./Card"; +import { TenderCardDetailsEntryMethod } from "./TenderCardDetailsEntryMethod"; + +export const TenderCardDetails: core.serialization.ObjectSchema< + serializers.TenderCardDetails.Raw, + Square.TenderCardDetails +> = core.serialization.object({ + status: TenderCardDetailsStatus.optional(), + card: Card.optional(), + entryMethod: core.serialization.property("entry_method", TenderCardDetailsEntryMethod.optional()), +}); + +export declare namespace TenderCardDetails { + export interface Raw { + status?: TenderCardDetailsStatus.Raw | null; + card?: Card.Raw | null; + entry_method?: TenderCardDetailsEntryMethod.Raw | null; + } +} diff --git a/src/serialization/types/TenderCardDetailsEntryMethod.ts b/src/serialization/types/TenderCardDetailsEntryMethod.ts new file mode 100644 index 000000000..e03397c18 --- /dev/null +++ b/src/serialization/types/TenderCardDetailsEntryMethod.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TenderCardDetailsEntryMethod: core.serialization.Schema< + serializers.TenderCardDetailsEntryMethod.Raw, + Square.TenderCardDetailsEntryMethod +> = core.serialization.enum_(["SWIPED", "KEYED", "EMV", "ON_FILE", "CONTACTLESS"]); + +export declare namespace TenderCardDetailsEntryMethod { + export type Raw = "SWIPED" | "KEYED" | "EMV" | "ON_FILE" | "CONTACTLESS"; +} diff --git a/src/serialization/types/TenderCardDetailsStatus.ts b/src/serialization/types/TenderCardDetailsStatus.ts new file mode 100644 index 000000000..994ea1c25 --- /dev/null +++ b/src/serialization/types/TenderCardDetailsStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TenderCardDetailsStatus: core.serialization.Schema< + serializers.TenderCardDetailsStatus.Raw, + Square.TenderCardDetailsStatus +> = core.serialization.enum_(["AUTHORIZED", "CAPTURED", "VOIDED", "FAILED"]); + +export declare namespace TenderCardDetailsStatus { + export type Raw = "AUTHORIZED" | "CAPTURED" | "VOIDED" | "FAILED"; +} diff --git a/src/serialization/types/TenderCashDetails.ts b/src/serialization/types/TenderCashDetails.ts new file mode 100644 index 000000000..555c8f3a1 --- /dev/null +++ b/src/serialization/types/TenderCashDetails.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; + +export const TenderCashDetails: core.serialization.ObjectSchema< + serializers.TenderCashDetails.Raw, + Square.TenderCashDetails +> = core.serialization.object({ + buyerTenderedMoney: core.serialization.property("buyer_tendered_money", Money.optional()), + changeBackMoney: core.serialization.property("change_back_money", Money.optional()), +}); + +export declare namespace TenderCashDetails { + export interface Raw { + buyer_tendered_money?: Money.Raw | null; + change_back_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/TenderSquareAccountDetails.ts b/src/serialization/types/TenderSquareAccountDetails.ts new file mode 100644 index 000000000..703528170 --- /dev/null +++ b/src/serialization/types/TenderSquareAccountDetails.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TenderSquareAccountDetailsStatus } from "./TenderSquareAccountDetailsStatus"; + +export const TenderSquareAccountDetails: core.serialization.ObjectSchema< + serializers.TenderSquareAccountDetails.Raw, + Square.TenderSquareAccountDetails +> = core.serialization.object({ + status: TenderSquareAccountDetailsStatus.optional(), +}); + +export declare namespace TenderSquareAccountDetails { + export interface Raw { + status?: TenderSquareAccountDetailsStatus.Raw | null; + } +} diff --git a/src/serialization/types/TenderSquareAccountDetailsStatus.ts b/src/serialization/types/TenderSquareAccountDetailsStatus.ts new file mode 100644 index 000000000..79af0af04 --- /dev/null +++ b/src/serialization/types/TenderSquareAccountDetailsStatus.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TenderSquareAccountDetailsStatus: core.serialization.Schema< + serializers.TenderSquareAccountDetailsStatus.Raw, + Square.TenderSquareAccountDetailsStatus +> = core.serialization.enum_(["AUTHORIZED", "CAPTURED", "VOIDED", "FAILED"]); + +export declare namespace TenderSquareAccountDetailsStatus { + export type Raw = "AUTHORIZED" | "CAPTURED" | "VOIDED" | "FAILED"; +} diff --git a/src/serialization/types/TenderType.ts b/src/serialization/types/TenderType.ts new file mode 100644 index 000000000..430fde4a6 --- /dev/null +++ b/src/serialization/types/TenderType.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TenderType: core.serialization.Schema = + core.serialization.enum_([ + "CARD", + "CASH", + "THIRD_PARTY_CARD", + "SQUARE_GIFT_CARD", + "NO_SALE", + "BANK_ACCOUNT", + "WALLET", + "BUY_NOW_PAY_LATER", + "SQUARE_ACCOUNT", + "OTHER", + ]); + +export declare namespace TenderType { + export type Raw = + | "CARD" + | "CASH" + | "THIRD_PARTY_CARD" + | "SQUARE_GIFT_CARD" + | "NO_SALE" + | "BANK_ACCOUNT" + | "WALLET" + | "BUY_NOW_PAY_LATER" + | "SQUARE_ACCOUNT" + | "OTHER"; +} diff --git a/src/serialization/types/TerminalAction.ts b/src/serialization/types/TerminalAction.ts new file mode 100644 index 000000000..cd94a74c5 --- /dev/null +++ b/src/serialization/types/TerminalAction.ts @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { ActionCancelReason } from "./ActionCancelReason"; +import { TerminalActionActionType } from "./TerminalActionActionType"; +import { QrCodeOptions } from "./QrCodeOptions"; +import { SaveCardOptions } from "./SaveCardOptions"; +import { SignatureOptions } from "./SignatureOptions"; +import { ConfirmationOptions } from "./ConfirmationOptions"; +import { ReceiptOptions } from "./ReceiptOptions"; +import { DataCollectionOptions } from "./DataCollectionOptions"; +import { SelectOptions } from "./SelectOptions"; +import { DeviceMetadata } from "./DeviceMetadata"; + +export const TerminalAction: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + deviceId: core.serialization.property("device_id", core.serialization.string().optionalNullable()), + deadlineDuration: core.serialization.property( + "deadline_duration", + core.serialization.string().optionalNullable(), + ), + status: core.serialization.string().optional(), + cancelReason: core.serialization.property("cancel_reason", ActionCancelReason.optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + appId: core.serialization.property("app_id", core.serialization.string().optional()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + type: TerminalActionActionType.optional(), + qrCodeOptions: core.serialization.property("qr_code_options", QrCodeOptions.optional()), + saveCardOptions: core.serialization.property("save_card_options", SaveCardOptions.optional()), + signatureOptions: core.serialization.property("signature_options", SignatureOptions.optional()), + confirmationOptions: core.serialization.property("confirmation_options", ConfirmationOptions.optional()), + receiptOptions: core.serialization.property("receipt_options", ReceiptOptions.optional()), + dataCollectionOptions: core.serialization.property("data_collection_options", DataCollectionOptions.optional()), + selectOptions: core.serialization.property("select_options", SelectOptions.optional()), + deviceMetadata: core.serialization.property("device_metadata", DeviceMetadata.optional()), + awaitNextAction: core.serialization.property( + "await_next_action", + core.serialization.boolean().optionalNullable(), + ), + awaitNextActionDuration: core.serialization.property( + "await_next_action_duration", + core.serialization.string().optionalNullable(), + ), + }); + +export declare namespace TerminalAction { + export interface Raw { + id?: string | null; + device_id?: (string | null) | null; + deadline_duration?: (string | null) | null; + status?: string | null; + cancel_reason?: ActionCancelReason.Raw | null; + created_at?: string | null; + updated_at?: string | null; + app_id?: string | null; + location_id?: string | null; + type?: TerminalActionActionType.Raw | null; + qr_code_options?: QrCodeOptions.Raw | null; + save_card_options?: SaveCardOptions.Raw | null; + signature_options?: SignatureOptions.Raw | null; + confirmation_options?: ConfirmationOptions.Raw | null; + receipt_options?: ReceiptOptions.Raw | null; + data_collection_options?: DataCollectionOptions.Raw | null; + select_options?: SelectOptions.Raw | null; + device_metadata?: DeviceMetadata.Raw | null; + await_next_action?: (boolean | null) | null; + await_next_action_duration?: (string | null) | null; + } +} diff --git a/src/serialization/types/TerminalActionActionType.ts b/src/serialization/types/TerminalActionActionType.ts new file mode 100644 index 000000000..c8dd2cea8 --- /dev/null +++ b/src/serialization/types/TerminalActionActionType.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TerminalActionActionType: core.serialization.Schema< + serializers.TerminalActionActionType.Raw, + Square.TerminalActionActionType +> = core.serialization.enum_([ + "QR_CODE", + "PING", + "SAVE_CARD", + "SIGNATURE", + "CONFIRMATION", + "RECEIPT", + "DATA_COLLECTION", + "SELECT", +]); + +export declare namespace TerminalActionActionType { + export type Raw = + | "QR_CODE" + | "PING" + | "SAVE_CARD" + | "SIGNATURE" + | "CONFIRMATION" + | "RECEIPT" + | "DATA_COLLECTION" + | "SELECT"; +} diff --git a/src/serialization/types/TerminalActionQuery.ts b/src/serialization/types/TerminalActionQuery.ts new file mode 100644 index 000000000..c6d8edfb9 --- /dev/null +++ b/src/serialization/types/TerminalActionQuery.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TerminalActionQueryFilter } from "./TerminalActionQueryFilter"; +import { TerminalActionQuerySort } from "./TerminalActionQuerySort"; + +export const TerminalActionQuery: core.serialization.ObjectSchema< + serializers.TerminalActionQuery.Raw, + Square.TerminalActionQuery +> = core.serialization.object({ + filter: TerminalActionQueryFilter.optional(), + sort: TerminalActionQuerySort.optional(), +}); + +export declare namespace TerminalActionQuery { + export interface Raw { + filter?: TerminalActionQueryFilter.Raw | null; + sort?: TerminalActionQuerySort.Raw | null; + } +} diff --git a/src/serialization/types/TerminalActionQueryFilter.ts b/src/serialization/types/TerminalActionQueryFilter.ts new file mode 100644 index 000000000..a7a4fc640 --- /dev/null +++ b/src/serialization/types/TerminalActionQueryFilter.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TimeRange } from "./TimeRange"; +import { TerminalActionActionType } from "./TerminalActionActionType"; + +export const TerminalActionQueryFilter: core.serialization.ObjectSchema< + serializers.TerminalActionQueryFilter.Raw, + Square.TerminalActionQueryFilter +> = core.serialization.object({ + deviceId: core.serialization.property("device_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", TimeRange.optional()), + status: core.serialization.string().optionalNullable(), + type: TerminalActionActionType.optional(), +}); + +export declare namespace TerminalActionQueryFilter { + export interface Raw { + device_id?: (string | null) | null; + created_at?: TimeRange.Raw | null; + status?: (string | null) | null; + type?: TerminalActionActionType.Raw | null; + } +} diff --git a/src/serialization/types/TerminalActionQuerySort.ts b/src/serialization/types/TerminalActionQuerySort.ts new file mode 100644 index 000000000..a42b30172 --- /dev/null +++ b/src/serialization/types/TerminalActionQuerySort.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SortOrder } from "./SortOrder"; + +export const TerminalActionQuerySort: core.serialization.ObjectSchema< + serializers.TerminalActionQuerySort.Raw, + Square.TerminalActionQuerySort +> = core.serialization.object({ + sortOrder: core.serialization.property("sort_order", SortOrder.optional()), +}); + +export declare namespace TerminalActionQuerySort { + export interface Raw { + sort_order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/TerminalCheckout.ts b/src/serialization/types/TerminalCheckout.ts new file mode 100644 index 000000000..995a2052c --- /dev/null +++ b/src/serialization/types/TerminalCheckout.ts @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { PaymentOptions } from "./PaymentOptions"; +import { DeviceCheckoutOptions } from "./DeviceCheckoutOptions"; +import { ActionCancelReason } from "./ActionCancelReason"; +import { CheckoutOptionsPaymentType } from "./CheckoutOptionsPaymentType"; + +export const TerminalCheckout: core.serialization.ObjectSchema< + serializers.TerminalCheckout.Raw, + Square.TerminalCheckout +> = core.serialization.object({ + id: core.serialization.string().optional(), + amountMoney: core.serialization.property("amount_money", Money), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + note: core.serialization.string().optionalNullable(), + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + paymentOptions: core.serialization.property("payment_options", PaymentOptions.optional()), + deviceOptions: core.serialization.property("device_options", DeviceCheckoutOptions), + deadlineDuration: core.serialization.property("deadline_duration", core.serialization.string().optionalNullable()), + status: core.serialization.string().optional(), + cancelReason: core.serialization.property("cancel_reason", ActionCancelReason.optional()), + paymentIds: core.serialization.property( + "payment_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + appId: core.serialization.property("app_id", core.serialization.string().optional()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + paymentType: core.serialization.property("payment_type", CheckoutOptionsPaymentType.optional()), + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), + customerId: core.serialization.property("customer_id", core.serialization.string().optionalNullable()), + appFeeMoney: core.serialization.property("app_fee_money", Money.optional()), + statementDescriptionIdentifier: core.serialization.property( + "statement_description_identifier", + core.serialization.string().optionalNullable(), + ), + tipMoney: core.serialization.property("tip_money", Money.optional()), +}); + +export declare namespace TerminalCheckout { + export interface Raw { + id?: string | null; + amount_money: Money.Raw; + reference_id?: (string | null) | null; + note?: (string | null) | null; + order_id?: (string | null) | null; + payment_options?: PaymentOptions.Raw | null; + device_options: DeviceCheckoutOptions.Raw; + deadline_duration?: (string | null) | null; + status?: string | null; + cancel_reason?: ActionCancelReason.Raw | null; + payment_ids?: string[] | null; + created_at?: string | null; + updated_at?: string | null; + app_id?: string | null; + location_id?: string | null; + payment_type?: CheckoutOptionsPaymentType.Raw | null; + team_member_id?: (string | null) | null; + customer_id?: (string | null) | null; + app_fee_money?: Money.Raw | null; + statement_description_identifier?: (string | null) | null; + tip_money?: Money.Raw | null; + } +} diff --git a/src/serialization/types/TerminalCheckoutQuery.ts b/src/serialization/types/TerminalCheckoutQuery.ts new file mode 100644 index 000000000..129088d2e --- /dev/null +++ b/src/serialization/types/TerminalCheckoutQuery.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TerminalCheckoutQueryFilter } from "./TerminalCheckoutQueryFilter"; +import { TerminalCheckoutQuerySort } from "./TerminalCheckoutQuerySort"; + +export const TerminalCheckoutQuery: core.serialization.ObjectSchema< + serializers.TerminalCheckoutQuery.Raw, + Square.TerminalCheckoutQuery +> = core.serialization.object({ + filter: TerminalCheckoutQueryFilter.optional(), + sort: TerminalCheckoutQuerySort.optional(), +}); + +export declare namespace TerminalCheckoutQuery { + export interface Raw { + filter?: TerminalCheckoutQueryFilter.Raw | null; + sort?: TerminalCheckoutQuerySort.Raw | null; + } +} diff --git a/src/serialization/types/TerminalCheckoutQueryFilter.ts b/src/serialization/types/TerminalCheckoutQueryFilter.ts new file mode 100644 index 000000000..4b79c98e7 --- /dev/null +++ b/src/serialization/types/TerminalCheckoutQueryFilter.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TimeRange } from "./TimeRange"; + +export const TerminalCheckoutQueryFilter: core.serialization.ObjectSchema< + serializers.TerminalCheckoutQueryFilter.Raw, + Square.TerminalCheckoutQueryFilter +> = core.serialization.object({ + deviceId: core.serialization.property("device_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", TimeRange.optional()), + status: core.serialization.string().optionalNullable(), +}); + +export declare namespace TerminalCheckoutQueryFilter { + export interface Raw { + device_id?: (string | null) | null; + created_at?: TimeRange.Raw | null; + status?: (string | null) | null; + } +} diff --git a/src/serialization/types/TerminalCheckoutQuerySort.ts b/src/serialization/types/TerminalCheckoutQuerySort.ts new file mode 100644 index 000000000..31c4738f9 --- /dev/null +++ b/src/serialization/types/TerminalCheckoutQuerySort.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { SortOrder } from "./SortOrder"; + +export const TerminalCheckoutQuerySort: core.serialization.ObjectSchema< + serializers.TerminalCheckoutQuerySort.Raw, + Square.TerminalCheckoutQuerySort +> = core.serialization.object({ + sortOrder: core.serialization.property("sort_order", SortOrder.optional()), +}); + +export declare namespace TerminalCheckoutQuerySort { + export interface Raw { + sort_order?: SortOrder.Raw | null; + } +} diff --git a/src/serialization/types/TerminalRefund.ts b/src/serialization/types/TerminalRefund.ts new file mode 100644 index 000000000..378ce0eb7 --- /dev/null +++ b/src/serialization/types/TerminalRefund.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Money } from "./Money"; +import { ActionCancelReason } from "./ActionCancelReason"; + +export const TerminalRefund: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + refundId: core.serialization.property("refund_id", core.serialization.string().optional()), + paymentId: core.serialization.property("payment_id", core.serialization.string()), + orderId: core.serialization.property("order_id", core.serialization.string().optional()), + amountMoney: core.serialization.property("amount_money", Money), + reason: core.serialization.string(), + deviceId: core.serialization.property("device_id", core.serialization.string()), + deadlineDuration: core.serialization.property( + "deadline_duration", + core.serialization.string().optionalNullable(), + ), + status: core.serialization.string().optional(), + cancelReason: core.serialization.property("cancel_reason", ActionCancelReason.optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + appId: core.serialization.property("app_id", core.serialization.string().optional()), + locationId: core.serialization.property("location_id", core.serialization.string().optional()), + }); + +export declare namespace TerminalRefund { + export interface Raw { + id?: string | null; + refund_id?: string | null; + payment_id: string; + order_id?: string | null; + amount_money: Money.Raw; + reason: string; + device_id: string; + deadline_duration?: (string | null) | null; + status?: string | null; + cancel_reason?: ActionCancelReason.Raw | null; + created_at?: string | null; + updated_at?: string | null; + app_id?: string | null; + location_id?: string | null; + } +} diff --git a/src/serialization/types/TerminalRefundQuery.ts b/src/serialization/types/TerminalRefundQuery.ts new file mode 100644 index 000000000..40119b8ed --- /dev/null +++ b/src/serialization/types/TerminalRefundQuery.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TerminalRefundQueryFilter } from "./TerminalRefundQueryFilter"; +import { TerminalRefundQuerySort } from "./TerminalRefundQuerySort"; + +export const TerminalRefundQuery: core.serialization.ObjectSchema< + serializers.TerminalRefundQuery.Raw, + Square.TerminalRefundQuery +> = core.serialization.object({ + filter: TerminalRefundQueryFilter.optional(), + sort: TerminalRefundQuerySort.optional(), +}); + +export declare namespace TerminalRefundQuery { + export interface Raw { + filter?: TerminalRefundQueryFilter.Raw | null; + sort?: TerminalRefundQuerySort.Raw | null; + } +} diff --git a/src/serialization/types/TerminalRefundQueryFilter.ts b/src/serialization/types/TerminalRefundQueryFilter.ts new file mode 100644 index 000000000..c8ff1d3a9 --- /dev/null +++ b/src/serialization/types/TerminalRefundQueryFilter.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TimeRange } from "./TimeRange"; + +export const TerminalRefundQueryFilter: core.serialization.ObjectSchema< + serializers.TerminalRefundQueryFilter.Raw, + Square.TerminalRefundQueryFilter +> = core.serialization.object({ + deviceId: core.serialization.property("device_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", TimeRange.optional()), + status: core.serialization.string().optionalNullable(), +}); + +export declare namespace TerminalRefundQueryFilter { + export interface Raw { + device_id?: (string | null) | null; + created_at?: TimeRange.Raw | null; + status?: (string | null) | null; + } +} diff --git a/src/serialization/types/TerminalRefundQuerySort.ts b/src/serialization/types/TerminalRefundQuerySort.ts new file mode 100644 index 000000000..5a9eacc0b --- /dev/null +++ b/src/serialization/types/TerminalRefundQuerySort.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TerminalRefundQuerySort: core.serialization.ObjectSchema< + serializers.TerminalRefundQuerySort.Raw, + Square.TerminalRefundQuerySort +> = core.serialization.object({ + sortOrder: core.serialization.property("sort_order", core.serialization.string().optionalNullable()), +}); + +export declare namespace TerminalRefundQuerySort { + export interface Raw { + sort_order?: (string | null) | null; + } +} diff --git a/src/serialization/types/TestWebhookSubscriptionResponse.ts b/src/serialization/types/TestWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..d768ff030 --- /dev/null +++ b/src/serialization/types/TestWebhookSubscriptionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { SubscriptionTestResult } from "./SubscriptionTestResult"; + +export const TestWebhookSubscriptionResponse: core.serialization.ObjectSchema< + serializers.TestWebhookSubscriptionResponse.Raw, + Square.TestWebhookSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscriptionTestResult: core.serialization.property("subscription_test_result", SubscriptionTestResult.optional()), +}); + +export declare namespace TestWebhookSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription_test_result?: SubscriptionTestResult.Raw | null; + } +} diff --git a/src/serialization/types/TimeRange.ts b/src/serialization/types/TimeRange.ts new file mode 100644 index 000000000..28845f302 --- /dev/null +++ b/src/serialization/types/TimeRange.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TimeRange: core.serialization.ObjectSchema = + core.serialization.object({ + startAt: core.serialization.property("start_at", core.serialization.string().optionalNullable()), + endAt: core.serialization.property("end_at", core.serialization.string().optionalNullable()), + }); + +export declare namespace TimeRange { + export interface Raw { + start_at?: (string | null) | null; + end_at?: (string | null) | null; + } +} diff --git a/src/serialization/types/TipSettings.ts b/src/serialization/types/TipSettings.ts new file mode 100644 index 000000000..681b122fa --- /dev/null +++ b/src/serialization/types/TipSettings.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TipSettings: core.serialization.ObjectSchema = + core.serialization.object({ + allowTipping: core.serialization.property("allow_tipping", core.serialization.boolean().optionalNullable()), + separateTipScreen: core.serialization.property( + "separate_tip_screen", + core.serialization.boolean().optionalNullable(), + ), + customTipField: core.serialization.property( + "custom_tip_field", + core.serialization.boolean().optionalNullable(), + ), + tipPercentages: core.serialization.property( + "tip_percentages", + core.serialization.list(core.serialization.number()).optionalNullable(), + ), + smartTipping: core.serialization.property("smart_tipping", core.serialization.boolean().optionalNullable()), + }); + +export declare namespace TipSettings { + export interface Raw { + allow_tipping?: (boolean | null) | null; + separate_tip_screen?: (boolean | null) | null; + custom_tip_field?: (boolean | null) | null; + tip_percentages?: (number[] | null) | null; + smart_tipping?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/Transaction.ts b/src/serialization/types/Transaction.ts new file mode 100644 index 000000000..e2dea2b54 --- /dev/null +++ b/src/serialization/types/Transaction.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Tender } from "./Tender"; +import { Refund } from "./Refund"; +import { TransactionProduct } from "./TransactionProduct"; +import { Address } from "./Address"; + +export const Transaction: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + locationId: core.serialization.property("location_id", core.serialization.string().optionalNullable()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + tenders: core.serialization.list(Tender).optionalNullable(), + refunds: core.serialization.list(Refund).optionalNullable(), + referenceId: core.serialization.property("reference_id", core.serialization.string().optionalNullable()), + product: TransactionProduct.optional(), + clientId: core.serialization.property("client_id", core.serialization.string().optionalNullable()), + shippingAddress: core.serialization.property("shipping_address", Address.optional()), + orderId: core.serialization.property("order_id", core.serialization.string().optionalNullable()), + }); + +export declare namespace Transaction { + export interface Raw { + id?: string | null; + location_id?: (string | null) | null; + created_at?: string | null; + tenders?: (Tender.Raw[] | null) | null; + refunds?: (Refund.Raw[] | null) | null; + reference_id?: (string | null) | null; + product?: TransactionProduct.Raw | null; + client_id?: (string | null) | null; + shipping_address?: Address.Raw | null; + order_id?: (string | null) | null; + } +} diff --git a/src/serialization/types/TransactionProduct.ts b/src/serialization/types/TransactionProduct.ts new file mode 100644 index 000000000..681f59456 --- /dev/null +++ b/src/serialization/types/TransactionProduct.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const TransactionProduct: core.serialization.Schema< + serializers.TransactionProduct.Raw, + Square.TransactionProduct +> = core.serialization.enum_([ + "REGISTER", + "EXTERNAL_API", + "BILLING", + "APPOINTMENTS", + "INVOICES", + "ONLINE_STORE", + "PAYROLL", + "OTHER", +]); + +export declare namespace TransactionProduct { + export type Raw = + | "REGISTER" + | "EXTERNAL_API" + | "BILLING" + | "APPOINTMENTS" + | "INVOICES" + | "ONLINE_STORE" + | "PAYROLL" + | "OTHER"; +} diff --git a/src/serialization/types/UnlinkCustomerFromGiftCardResponse.ts b/src/serialization/types/UnlinkCustomerFromGiftCardResponse.ts new file mode 100644 index 000000000..0314b5829 --- /dev/null +++ b/src/serialization/types/UnlinkCustomerFromGiftCardResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { GiftCard } from "./GiftCard"; + +export const UnlinkCustomerFromGiftCardResponse: core.serialization.ObjectSchema< + serializers.UnlinkCustomerFromGiftCardResponse.Raw, + Square.UnlinkCustomerFromGiftCardResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + giftCard: core.serialization.property("gift_card", GiftCard.optional()), +}); + +export declare namespace UnlinkCustomerFromGiftCardResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + gift_card?: GiftCard.Raw | null; + } +} diff --git a/src/serialization/types/UpdateBookingCustomAttributeDefinitionResponse.ts b/src/serialization/types/UpdateBookingCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..06659cf5b --- /dev/null +++ b/src/serialization/types/UpdateBookingCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const UpdateBookingCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.UpdateBookingCustomAttributeDefinitionResponse.Raw, + Square.UpdateBookingCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateBookingCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateBookingResponse.ts b/src/serialization/types/UpdateBookingResponse.ts new file mode 100644 index 000000000..864c93f81 --- /dev/null +++ b/src/serialization/types/UpdateBookingResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Booking } from "./Booking"; +import { Error_ } from "./Error_"; + +export const UpdateBookingResponse: core.serialization.ObjectSchema< + serializers.UpdateBookingResponse.Raw, + Square.UpdateBookingResponse +> = core.serialization.object({ + booking: Booking.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateBookingResponse { + export interface Raw { + booking?: Booking.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateBreakTypeResponse.ts b/src/serialization/types/UpdateBreakTypeResponse.ts new file mode 100644 index 000000000..28bd76133 --- /dev/null +++ b/src/serialization/types/UpdateBreakTypeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { BreakType } from "./BreakType"; +import { Error_ } from "./Error_"; + +export const UpdateBreakTypeResponse: core.serialization.ObjectSchema< + serializers.UpdateBreakTypeResponse.Raw, + Square.UpdateBreakTypeResponse +> = core.serialization.object({ + breakType: core.serialization.property("break_type", BreakType.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateBreakTypeResponse { + export interface Raw { + break_type?: BreakType.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateCatalogImageRequest.ts b/src/serialization/types/UpdateCatalogImageRequest.ts new file mode 100644 index 000000000..bab461bbd --- /dev/null +++ b/src/serialization/types/UpdateCatalogImageRequest.ts @@ -0,0 +1,20 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const UpdateCatalogImageRequest: core.serialization.ObjectSchema< + serializers.UpdateCatalogImageRequest.Raw, + Square.UpdateCatalogImageRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string()), +}); + +export declare namespace UpdateCatalogImageRequest { + export interface Raw { + idempotency_key: string; + } +} diff --git a/src/serialization/types/UpdateCatalogImageResponse.ts b/src/serialization/types/UpdateCatalogImageResponse.ts new file mode 100644 index 000000000..e51a1c853 --- /dev/null +++ b/src/serialization/types/UpdateCatalogImageResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const UpdateCatalogImageResponse: core.serialization.ObjectSchema< + serializers.UpdateCatalogImageResponse.Raw, + Square.UpdateCatalogImageResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + image: core.serialization.lazy(() => serializers.CatalogObject).optional(), +}); + +export declare namespace UpdateCatalogImageResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + image?: serializers.CatalogObject.Raw | null; + } +} diff --git a/src/serialization/types/UpdateCustomerCustomAttributeDefinitionResponse.ts b/src/serialization/types/UpdateCustomerCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..bff994b91 --- /dev/null +++ b/src/serialization/types/UpdateCustomerCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const UpdateCustomerCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.UpdateCustomerCustomAttributeDefinitionResponse.Raw, + Square.UpdateCustomerCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateCustomerCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateCustomerGroupResponse.ts b/src/serialization/types/UpdateCustomerGroupResponse.ts new file mode 100644 index 000000000..01d38d9d3 --- /dev/null +++ b/src/serialization/types/UpdateCustomerGroupResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CustomerGroup } from "./CustomerGroup"; + +export const UpdateCustomerGroupResponse: core.serialization.ObjectSchema< + serializers.UpdateCustomerGroupResponse.Raw, + Square.UpdateCustomerGroupResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + group: CustomerGroup.optional(), +}); + +export declare namespace UpdateCustomerGroupResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + group?: CustomerGroup.Raw | null; + } +} diff --git a/src/serialization/types/UpdateCustomerResponse.ts b/src/serialization/types/UpdateCustomerResponse.ts new file mode 100644 index 000000000..8de103282 --- /dev/null +++ b/src/serialization/types/UpdateCustomerResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Customer } from "./Customer"; + +export const UpdateCustomerResponse: core.serialization.ObjectSchema< + serializers.UpdateCustomerResponse.Raw, + Square.UpdateCustomerResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + customer: Customer.optional(), +}); + +export declare namespace UpdateCustomerResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + customer?: Customer.Raw | null; + } +} diff --git a/src/serialization/types/UpdateInvoiceResponse.ts b/src/serialization/types/UpdateInvoiceResponse.ts new file mode 100644 index 000000000..3de8309ef --- /dev/null +++ b/src/serialization/types/UpdateInvoiceResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Invoice } from "./Invoice"; +import { Error_ } from "./Error_"; + +export const UpdateInvoiceResponse: core.serialization.ObjectSchema< + serializers.UpdateInvoiceResponse.Raw, + Square.UpdateInvoiceResponse +> = core.serialization.object({ + invoice: Invoice.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateInvoiceResponse { + export interface Raw { + invoice?: Invoice.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateItemModifierListsResponse.ts b/src/serialization/types/UpdateItemModifierListsResponse.ts new file mode 100644 index 000000000..19e63ec7e --- /dev/null +++ b/src/serialization/types/UpdateItemModifierListsResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const UpdateItemModifierListsResponse: core.serialization.ObjectSchema< + serializers.UpdateItemModifierListsResponse.Raw, + Square.UpdateItemModifierListsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), +}); + +export declare namespace UpdateItemModifierListsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/UpdateItemTaxesResponse.ts b/src/serialization/types/UpdateItemTaxesResponse.ts new file mode 100644 index 000000000..400178bb0 --- /dev/null +++ b/src/serialization/types/UpdateItemTaxesResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const UpdateItemTaxesResponse: core.serialization.ObjectSchema< + serializers.UpdateItemTaxesResponse.Raw, + Square.UpdateItemTaxesResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), +}); + +export declare namespace UpdateItemTaxesResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/UpdateJobResponse.ts b/src/serialization/types/UpdateJobResponse.ts new file mode 100644 index 000000000..43ad59fa7 --- /dev/null +++ b/src/serialization/types/UpdateJobResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Job } from "./Job"; +import { Error_ } from "./Error_"; + +export const UpdateJobResponse: core.serialization.ObjectSchema< + serializers.UpdateJobResponse.Raw, + Square.UpdateJobResponse +> = core.serialization.object({ + job: Job.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateJobResponse { + export interface Raw { + job?: Job.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateLocationCustomAttributeDefinitionResponse.ts b/src/serialization/types/UpdateLocationCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..946412d40 --- /dev/null +++ b/src/serialization/types/UpdateLocationCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const UpdateLocationCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.UpdateLocationCustomAttributeDefinitionResponse.Raw, + Square.UpdateLocationCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateLocationCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateLocationResponse.ts b/src/serialization/types/UpdateLocationResponse.ts new file mode 100644 index 000000000..36409929b --- /dev/null +++ b/src/serialization/types/UpdateLocationResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Location } from "./Location"; + +export const UpdateLocationResponse: core.serialization.ObjectSchema< + serializers.UpdateLocationResponse.Raw, + Square.UpdateLocationResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + location: Location.optional(), +}); + +export declare namespace UpdateLocationResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + location?: Location.Raw | null; + } +} diff --git a/src/serialization/types/UpdateLocationSettingsResponse.ts b/src/serialization/types/UpdateLocationSettingsResponse.ts new file mode 100644 index 000000000..25467d2b6 --- /dev/null +++ b/src/serialization/types/UpdateLocationSettingsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CheckoutLocationSettings } from "./CheckoutLocationSettings"; + +export const UpdateLocationSettingsResponse: core.serialization.ObjectSchema< + serializers.UpdateLocationSettingsResponse.Raw, + Square.UpdateLocationSettingsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + locationSettings: core.serialization.property("location_settings", CheckoutLocationSettings.optional()), +}); + +export declare namespace UpdateLocationSettingsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + location_settings?: CheckoutLocationSettings.Raw | null; + } +} diff --git a/src/serialization/types/UpdateMerchantCustomAttributeDefinitionResponse.ts b/src/serialization/types/UpdateMerchantCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..747cc108f --- /dev/null +++ b/src/serialization/types/UpdateMerchantCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const UpdateMerchantCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.UpdateMerchantCustomAttributeDefinitionResponse.Raw, + Square.UpdateMerchantCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateMerchantCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateMerchantSettingsResponse.ts b/src/serialization/types/UpdateMerchantSettingsResponse.ts new file mode 100644 index 000000000..e474798e0 --- /dev/null +++ b/src/serialization/types/UpdateMerchantSettingsResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CheckoutMerchantSettings } from "./CheckoutMerchantSettings"; + +export const UpdateMerchantSettingsResponse: core.serialization.ObjectSchema< + serializers.UpdateMerchantSettingsResponse.Raw, + Square.UpdateMerchantSettingsResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + merchantSettings: core.serialization.property("merchant_settings", CheckoutMerchantSettings.optional()), +}); + +export declare namespace UpdateMerchantSettingsResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + merchant_settings?: CheckoutMerchantSettings.Raw | null; + } +} diff --git a/src/serialization/types/UpdateOrderCustomAttributeDefinitionResponse.ts b/src/serialization/types/UpdateOrderCustomAttributeDefinitionResponse.ts new file mode 100644 index 000000000..5054f4374 --- /dev/null +++ b/src/serialization/types/UpdateOrderCustomAttributeDefinitionResponse.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttributeDefinition } from "./CustomAttributeDefinition"; +import { Error_ } from "./Error_"; + +export const UpdateOrderCustomAttributeDefinitionResponse: core.serialization.ObjectSchema< + serializers.UpdateOrderCustomAttributeDefinitionResponse.Raw, + Square.UpdateOrderCustomAttributeDefinitionResponse +> = core.serialization.object({ + customAttributeDefinition: core.serialization.property( + "custom_attribute_definition", + CustomAttributeDefinition.optional(), + ), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateOrderCustomAttributeDefinitionResponse { + export interface Raw { + custom_attribute_definition?: CustomAttributeDefinition.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateOrderResponse.ts b/src/serialization/types/UpdateOrderResponse.ts new file mode 100644 index 000000000..3d8fc8385 --- /dev/null +++ b/src/serialization/types/UpdateOrderResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Order } from "./Order"; +import { Error_ } from "./Error_"; + +export const UpdateOrderResponse: core.serialization.ObjectSchema< + serializers.UpdateOrderResponse.Raw, + Square.UpdateOrderResponse +> = core.serialization.object({ + order: Order.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateOrderResponse { + export interface Raw { + order?: Order.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdatePaymentLinkResponse.ts b/src/serialization/types/UpdatePaymentLinkResponse.ts new file mode 100644 index 000000000..a8e948ea5 --- /dev/null +++ b/src/serialization/types/UpdatePaymentLinkResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { PaymentLink } from "./PaymentLink"; + +export const UpdatePaymentLinkResponse: core.serialization.ObjectSchema< + serializers.UpdatePaymentLinkResponse.Raw, + Square.UpdatePaymentLinkResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + paymentLink: core.serialization.property("payment_link", PaymentLink.optional()), +}); + +export declare namespace UpdatePaymentLinkResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment_link?: PaymentLink.Raw | null; + } +} diff --git a/src/serialization/types/UpdatePaymentResponse.ts b/src/serialization/types/UpdatePaymentResponse.ts new file mode 100644 index 000000000..a5c33178b --- /dev/null +++ b/src/serialization/types/UpdatePaymentResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Payment } from "./Payment"; + +export const UpdatePaymentResponse: core.serialization.ObjectSchema< + serializers.UpdatePaymentResponse.Raw, + Square.UpdatePaymentResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + payment: Payment.optional(), +}); + +export declare namespace UpdatePaymentResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + payment?: Payment.Raw | null; + } +} diff --git a/src/serialization/types/UpdateShiftResponse.ts b/src/serialization/types/UpdateShiftResponse.ts new file mode 100644 index 000000000..fa63dd4eb --- /dev/null +++ b/src/serialization/types/UpdateShiftResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Shift } from "./Shift"; +import { Error_ } from "./Error_"; + +export const UpdateShiftResponse: core.serialization.ObjectSchema< + serializers.UpdateShiftResponse.Raw, + Square.UpdateShiftResponse +> = core.serialization.object({ + shift: Shift.optional(), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateShiftResponse { + export interface Raw { + shift?: Shift.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateSubscriptionResponse.ts b/src/serialization/types/UpdateSubscriptionResponse.ts new file mode 100644 index 000000000..3e7bc8d78 --- /dev/null +++ b/src/serialization/types/UpdateSubscriptionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Subscription } from "./Subscription"; + +export const UpdateSubscriptionResponse: core.serialization.ObjectSchema< + serializers.UpdateSubscriptionResponse.Raw, + Square.UpdateSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: Subscription.optional(), +}); + +export declare namespace UpdateSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: Subscription.Raw | null; + } +} diff --git a/src/serialization/types/UpdateTeamMemberRequest.ts b/src/serialization/types/UpdateTeamMemberRequest.ts new file mode 100644 index 000000000..90f379625 --- /dev/null +++ b/src/serialization/types/UpdateTeamMemberRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMember } from "./TeamMember"; + +export const UpdateTeamMemberRequest: core.serialization.ObjectSchema< + serializers.UpdateTeamMemberRequest.Raw, + Square.UpdateTeamMemberRequest +> = core.serialization.object({ + teamMember: core.serialization.property("team_member", TeamMember.optional()), +}); + +export declare namespace UpdateTeamMemberRequest { + export interface Raw { + team_member?: TeamMember.Raw | null; + } +} diff --git a/src/serialization/types/UpdateTeamMemberResponse.ts b/src/serialization/types/UpdateTeamMemberResponse.ts new file mode 100644 index 000000000..5be3fd748 --- /dev/null +++ b/src/serialization/types/UpdateTeamMemberResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { TeamMember } from "./TeamMember"; +import { Error_ } from "./Error_"; + +export const UpdateTeamMemberResponse: core.serialization.ObjectSchema< + serializers.UpdateTeamMemberResponse.Raw, + Square.UpdateTeamMemberResponse +> = core.serialization.object({ + teamMember: core.serialization.property("team_member", TeamMember.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateTeamMemberResponse { + export interface Raw { + team_member?: TeamMember.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateVendorRequest.ts b/src/serialization/types/UpdateVendorRequest.ts new file mode 100644 index 000000000..1517797f5 --- /dev/null +++ b/src/serialization/types/UpdateVendorRequest.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Vendor } from "./Vendor"; + +export const UpdateVendorRequest: core.serialization.ObjectSchema< + serializers.UpdateVendorRequest.Raw, + Square.UpdateVendorRequest +> = core.serialization.object({ + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optionalNullable()), + vendor: Vendor, +}); + +export declare namespace UpdateVendorRequest { + export interface Raw { + idempotency_key?: (string | null) | null; + vendor: Vendor.Raw; + } +} diff --git a/src/serialization/types/UpdateVendorResponse.ts b/src/serialization/types/UpdateVendorResponse.ts new file mode 100644 index 000000000..ee6505e5e --- /dev/null +++ b/src/serialization/types/UpdateVendorResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Vendor } from "./Vendor"; + +export const UpdateVendorResponse: core.serialization.ObjectSchema< + serializers.UpdateVendorResponse.Raw, + Square.UpdateVendorResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + vendor: Vendor.optional(), +}); + +export declare namespace UpdateVendorResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + vendor?: Vendor.Raw | null; + } +} diff --git a/src/serialization/types/UpdateWageSettingResponse.ts b/src/serialization/types/UpdateWageSettingResponse.ts new file mode 100644 index 000000000..c7c16b35a --- /dev/null +++ b/src/serialization/types/UpdateWageSettingResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { WageSetting } from "./WageSetting"; +import { Error_ } from "./Error_"; + +export const UpdateWageSettingResponse: core.serialization.ObjectSchema< + serializers.UpdateWageSettingResponse.Raw, + Square.UpdateWageSettingResponse +> = core.serialization.object({ + wageSetting: core.serialization.property("wage_setting", WageSetting.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateWageSettingResponse { + export interface Raw { + wage_setting?: WageSetting.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpdateWebhookSubscriptionResponse.ts b/src/serialization/types/UpdateWebhookSubscriptionResponse.ts new file mode 100644 index 000000000..a15ce6e6f --- /dev/null +++ b/src/serialization/types/UpdateWebhookSubscriptionResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { WebhookSubscription } from "./WebhookSubscription"; + +export const UpdateWebhookSubscriptionResponse: core.serialization.ObjectSchema< + serializers.UpdateWebhookSubscriptionResponse.Raw, + Square.UpdateWebhookSubscriptionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + subscription: WebhookSubscription.optional(), +}); + +export declare namespace UpdateWebhookSubscriptionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + subscription?: WebhookSubscription.Raw | null; + } +} diff --git a/src/serialization/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts b/src/serialization/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts new file mode 100644 index 000000000..38ac5a31e --- /dev/null +++ b/src/serialization/types/UpdateWebhookSubscriptionSignatureKeyResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const UpdateWebhookSubscriptionSignatureKeyResponse: core.serialization.ObjectSchema< + serializers.UpdateWebhookSubscriptionSignatureKeyResponse.Raw, + Square.UpdateWebhookSubscriptionSignatureKeyResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + signatureKey: core.serialization.property("signature_key", core.serialization.string().optional()), +}); + +export declare namespace UpdateWebhookSubscriptionSignatureKeyResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + signature_key?: string | null; + } +} diff --git a/src/serialization/types/UpdateWorkweekConfigResponse.ts b/src/serialization/types/UpdateWorkweekConfigResponse.ts new file mode 100644 index 000000000..552811bb0 --- /dev/null +++ b/src/serialization/types/UpdateWorkweekConfigResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { WorkweekConfig } from "./WorkweekConfig"; +import { Error_ } from "./Error_"; + +export const UpdateWorkweekConfigResponse: core.serialization.ObjectSchema< + serializers.UpdateWorkweekConfigResponse.Raw, + Square.UpdateWorkweekConfigResponse +> = core.serialization.object({ + workweekConfig: core.serialization.property("workweek_config", WorkweekConfig.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpdateWorkweekConfigResponse { + export interface Raw { + workweek_config?: WorkweekConfig.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpsertBookingCustomAttributeResponse.ts b/src/serialization/types/UpsertBookingCustomAttributeResponse.ts new file mode 100644 index 000000000..50e3aefaa --- /dev/null +++ b/src/serialization/types/UpsertBookingCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const UpsertBookingCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.UpsertBookingCustomAttributeResponse.Raw, + Square.UpsertBookingCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpsertBookingCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpsertCatalogObjectResponse.ts b/src/serialization/types/UpsertCatalogObjectResponse.ts new file mode 100644 index 000000000..3b4dced9c --- /dev/null +++ b/src/serialization/types/UpsertCatalogObjectResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { CatalogIdMapping } from "./CatalogIdMapping"; + +export const UpsertCatalogObjectResponse: core.serialization.ObjectSchema< + serializers.UpsertCatalogObjectResponse.Raw, + Square.UpsertCatalogObjectResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + catalogObject: core.serialization.property( + "catalog_object", + core.serialization.lazy(() => serializers.CatalogObject).optional(), + ), + idMappings: core.serialization.property("id_mappings", core.serialization.list(CatalogIdMapping).optional()), +}); + +export declare namespace UpsertCatalogObjectResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + catalog_object?: serializers.CatalogObject.Raw | null; + id_mappings?: CatalogIdMapping.Raw[] | null; + } +} diff --git a/src/serialization/types/UpsertCustomerCustomAttributeResponse.ts b/src/serialization/types/UpsertCustomerCustomAttributeResponse.ts new file mode 100644 index 000000000..d6706a9fe --- /dev/null +++ b/src/serialization/types/UpsertCustomerCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const UpsertCustomerCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.UpsertCustomerCustomAttributeResponse.Raw, + Square.UpsertCustomerCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpsertCustomerCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpsertLocationCustomAttributeResponse.ts b/src/serialization/types/UpsertLocationCustomAttributeResponse.ts new file mode 100644 index 000000000..6d03388b9 --- /dev/null +++ b/src/serialization/types/UpsertLocationCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const UpsertLocationCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.UpsertLocationCustomAttributeResponse.Raw, + Square.UpsertLocationCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpsertLocationCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpsertMerchantCustomAttributeResponse.ts b/src/serialization/types/UpsertMerchantCustomAttributeResponse.ts new file mode 100644 index 000000000..05a72a090 --- /dev/null +++ b/src/serialization/types/UpsertMerchantCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const UpsertMerchantCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.UpsertMerchantCustomAttributeResponse.Raw, + Square.UpsertMerchantCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpsertMerchantCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpsertOrderCustomAttributeResponse.ts b/src/serialization/types/UpsertOrderCustomAttributeResponse.ts new file mode 100644 index 000000000..5710d512a --- /dev/null +++ b/src/serialization/types/UpsertOrderCustomAttributeResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { CustomAttribute } from "./CustomAttribute"; +import { Error_ } from "./Error_"; + +export const UpsertOrderCustomAttributeResponse: core.serialization.ObjectSchema< + serializers.UpsertOrderCustomAttributeResponse.Raw, + Square.UpsertOrderCustomAttributeResponse +> = core.serialization.object({ + customAttribute: core.serialization.property("custom_attribute", CustomAttribute.optional()), + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace UpsertOrderCustomAttributeResponse { + export interface Raw { + custom_attribute?: CustomAttribute.Raw | null; + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/UpsertSnippetResponse.ts b/src/serialization/types/UpsertSnippetResponse.ts new file mode 100644 index 000000000..637152d31 --- /dev/null +++ b/src/serialization/types/UpsertSnippetResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { Snippet } from "./Snippet"; + +export const UpsertSnippetResponse: core.serialization.ObjectSchema< + serializers.UpsertSnippetResponse.Raw, + Square.UpsertSnippetResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), + snippet: Snippet.optional(), +}); + +export declare namespace UpsertSnippetResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + snippet?: Snippet.Raw | null; + } +} diff --git a/src/serialization/types/V1Money.ts b/src/serialization/types/V1Money.ts new file mode 100644 index 000000000..f3b326f32 --- /dev/null +++ b/src/serialization/types/V1Money.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Currency } from "./Currency"; + +export const V1Money: core.serialization.ObjectSchema = + core.serialization.object({ + amount: core.serialization.number().optionalNullable(), + currencyCode: core.serialization.property("currency_code", Currency.optional()), + }); + +export declare namespace V1Money { + export interface Raw { + amount?: (number | null) | null; + currency_code?: Currency.Raw | null; + } +} diff --git a/src/serialization/types/V1Order.ts b/src/serialization/types/V1Order.ts new file mode 100644 index 000000000..df12320f3 --- /dev/null +++ b/src/serialization/types/V1Order.ts @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; +import { V1OrderState } from "./V1OrderState"; +import { Address } from "./Address"; +import { V1Money } from "./V1Money"; +import { V1Tender } from "./V1Tender"; +import { V1OrderHistoryEntry } from "./V1OrderHistoryEntry"; + +export const V1Order: core.serialization.ObjectSchema = + core.serialization.object({ + errors: core.serialization.list(Error_).optionalNullable(), + id: core.serialization.string().optional(), + buyerEmail: core.serialization.property("buyer_email", core.serialization.string().optionalNullable()), + recipientName: core.serialization.property("recipient_name", core.serialization.string().optionalNullable()), + recipientPhoneNumber: core.serialization.property( + "recipient_phone_number", + core.serialization.string().optionalNullable(), + ), + state: V1OrderState.optional(), + shippingAddress: core.serialization.property("shipping_address", Address.optional()), + subtotalMoney: core.serialization.property("subtotal_money", V1Money.optional()), + totalShippingMoney: core.serialization.property("total_shipping_money", V1Money.optional()), + totalTaxMoney: core.serialization.property("total_tax_money", V1Money.optional()), + totalPriceMoney: core.serialization.property("total_price_money", V1Money.optional()), + totalDiscountMoney: core.serialization.property("total_discount_money", V1Money.optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + expiresAt: core.serialization.property("expires_at", core.serialization.string().optionalNullable()), + paymentId: core.serialization.property("payment_id", core.serialization.string().optionalNullable()), + buyerNote: core.serialization.property("buyer_note", core.serialization.string().optionalNullable()), + completedNote: core.serialization.property("completed_note", core.serialization.string().optionalNullable()), + refundedNote: core.serialization.property("refunded_note", core.serialization.string().optionalNullable()), + canceledNote: core.serialization.property("canceled_note", core.serialization.string().optionalNullable()), + tender: V1Tender.optional(), + orderHistory: core.serialization.property( + "order_history", + core.serialization.list(V1OrderHistoryEntry).optionalNullable(), + ), + promoCode: core.serialization.property("promo_code", core.serialization.string().optionalNullable()), + btcReceiveAddress: core.serialization.property( + "btc_receive_address", + core.serialization.string().optionalNullable(), + ), + btcPriceSatoshi: core.serialization.property( + "btc_price_satoshi", + core.serialization.number().optionalNullable(), + ), + }); + +export declare namespace V1Order { + export interface Raw { + errors?: (Error_.Raw[] | null) | null; + id?: string | null; + buyer_email?: (string | null) | null; + recipient_name?: (string | null) | null; + recipient_phone_number?: (string | null) | null; + state?: V1OrderState.Raw | null; + shipping_address?: Address.Raw | null; + subtotal_money?: V1Money.Raw | null; + total_shipping_money?: V1Money.Raw | null; + total_tax_money?: V1Money.Raw | null; + total_price_money?: V1Money.Raw | null; + total_discount_money?: V1Money.Raw | null; + created_at?: string | null; + updated_at?: string | null; + expires_at?: (string | null) | null; + payment_id?: (string | null) | null; + buyer_note?: (string | null) | null; + completed_note?: (string | null) | null; + refunded_note?: (string | null) | null; + canceled_note?: (string | null) | null; + tender?: V1Tender.Raw | null; + order_history?: (V1OrderHistoryEntry.Raw[] | null) | null; + promo_code?: (string | null) | null; + btc_receive_address?: (string | null) | null; + btc_price_satoshi?: (number | null) | null; + } +} diff --git a/src/serialization/types/V1OrderHistoryEntry.ts b/src/serialization/types/V1OrderHistoryEntry.ts new file mode 100644 index 000000000..689dd52e0 --- /dev/null +++ b/src/serialization/types/V1OrderHistoryEntry.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { V1OrderHistoryEntryAction } from "./V1OrderHistoryEntryAction"; + +export const V1OrderHistoryEntry: core.serialization.ObjectSchema< + serializers.V1OrderHistoryEntry.Raw, + Square.V1OrderHistoryEntry +> = core.serialization.object({ + action: V1OrderHistoryEntryAction.optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), +}); + +export declare namespace V1OrderHistoryEntry { + export interface Raw { + action?: V1OrderHistoryEntryAction.Raw | null; + created_at?: string | null; + } +} diff --git a/src/serialization/types/V1OrderHistoryEntryAction.ts b/src/serialization/types/V1OrderHistoryEntryAction.ts new file mode 100644 index 000000000..bf3e246b9 --- /dev/null +++ b/src/serialization/types/V1OrderHistoryEntryAction.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const V1OrderHistoryEntryAction: core.serialization.Schema< + serializers.V1OrderHistoryEntryAction.Raw, + Square.V1OrderHistoryEntryAction +> = core.serialization.enum_([ + "ORDER_PLACED", + "DECLINED", + "PAYMENT_RECEIVED", + "CANCELED", + "COMPLETED", + "REFUNDED", + "EXPIRED", +]); + +export declare namespace V1OrderHistoryEntryAction { + export type Raw = + | "ORDER_PLACED" + | "DECLINED" + | "PAYMENT_RECEIVED" + | "CANCELED" + | "COMPLETED" + | "REFUNDED" + | "EXPIRED"; +} diff --git a/src/serialization/types/V1OrderState.ts b/src/serialization/types/V1OrderState.ts new file mode 100644 index 000000000..5c9de8c61 --- /dev/null +++ b/src/serialization/types/V1OrderState.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const V1OrderState: core.serialization.Schema = + core.serialization.enum_(["PENDING", "OPEN", "COMPLETED", "CANCELED", "REFUNDED", "REJECTED"]); + +export declare namespace V1OrderState { + export type Raw = "PENDING" | "OPEN" | "COMPLETED" | "CANCELED" | "REFUNDED" | "REJECTED"; +} diff --git a/src/serialization/types/V1Tender.ts b/src/serialization/types/V1Tender.ts new file mode 100644 index 000000000..ad0144d56 --- /dev/null +++ b/src/serialization/types/V1Tender.ts @@ -0,0 +1,52 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { V1TenderType } from "./V1TenderType"; +import { V1TenderCardBrand } from "./V1TenderCardBrand"; +import { V1TenderEntryMethod } from "./V1TenderEntryMethod"; +import { V1Money } from "./V1Money"; + +export const V1Tender: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + type: V1TenderType.optional(), + name: core.serialization.string().optionalNullable(), + employeeId: core.serialization.property("employee_id", core.serialization.string().optionalNullable()), + receiptUrl: core.serialization.property("receipt_url", core.serialization.string().optionalNullable()), + cardBrand: core.serialization.property("card_brand", V1TenderCardBrand.optional()), + panSuffix: core.serialization.property("pan_suffix", core.serialization.string().optionalNullable()), + entryMethod: core.serialization.property("entry_method", V1TenderEntryMethod.optional()), + paymentNote: core.serialization.property("payment_note", core.serialization.string().optionalNullable()), + totalMoney: core.serialization.property("total_money", V1Money.optional()), + tenderedMoney: core.serialization.property("tendered_money", V1Money.optional()), + tenderedAt: core.serialization.property("tendered_at", core.serialization.string().optionalNullable()), + settledAt: core.serialization.property("settled_at", core.serialization.string().optionalNullable()), + changeBackMoney: core.serialization.property("change_back_money", V1Money.optional()), + refundedMoney: core.serialization.property("refunded_money", V1Money.optional()), + isExchange: core.serialization.property("is_exchange", core.serialization.boolean().optionalNullable()), + }); + +export declare namespace V1Tender { + export interface Raw { + id?: string | null; + type?: V1TenderType.Raw | null; + name?: (string | null) | null; + employee_id?: (string | null) | null; + receipt_url?: (string | null) | null; + card_brand?: V1TenderCardBrand.Raw | null; + pan_suffix?: (string | null) | null; + entry_method?: V1TenderEntryMethod.Raw | null; + payment_note?: (string | null) | null; + total_money?: V1Money.Raw | null; + tendered_money?: V1Money.Raw | null; + tendered_at?: (string | null) | null; + settled_at?: (string | null) | null; + change_back_money?: V1Money.Raw | null; + refunded_money?: V1Money.Raw | null; + is_exchange?: (boolean | null) | null; + } +} diff --git a/src/serialization/types/V1TenderCardBrand.ts b/src/serialization/types/V1TenderCardBrand.ts new file mode 100644 index 000000000..d66f19db3 --- /dev/null +++ b/src/serialization/types/V1TenderCardBrand.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const V1TenderCardBrand: core.serialization.Schema = + core.serialization.enum_([ + "OTHER_BRAND", + "VISA", + "MASTER_CARD", + "AMERICAN_EXPRESS", + "DISCOVER", + "DISCOVER_DINERS", + "JCB", + "CHINA_UNIONPAY", + "SQUARE_GIFT_CARD", + ]); + +export declare namespace V1TenderCardBrand { + export type Raw = + | "OTHER_BRAND" + | "VISA" + | "MASTER_CARD" + | "AMERICAN_EXPRESS" + | "DISCOVER" + | "DISCOVER_DINERS" + | "JCB" + | "CHINA_UNIONPAY" + | "SQUARE_GIFT_CARD"; +} diff --git a/src/serialization/types/V1TenderEntryMethod.ts b/src/serialization/types/V1TenderEntryMethod.ts new file mode 100644 index 000000000..86ee07d8e --- /dev/null +++ b/src/serialization/types/V1TenderEntryMethod.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const V1TenderEntryMethod: core.serialization.Schema< + serializers.V1TenderEntryMethod.Raw, + Square.V1TenderEntryMethod +> = core.serialization.enum_(["MANUAL", "SCANNED", "SQUARE_CASH", "SQUARE_WALLET", "SWIPED", "WEB_FORM", "OTHER"]); + +export declare namespace V1TenderEntryMethod { + export type Raw = "MANUAL" | "SCANNED" | "SQUARE_CASH" | "SQUARE_WALLET" | "SWIPED" | "WEB_FORM" | "OTHER"; +} diff --git a/src/serialization/types/V1TenderType.ts b/src/serialization/types/V1TenderType.ts new file mode 100644 index 000000000..838d697b5 --- /dev/null +++ b/src/serialization/types/V1TenderType.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const V1TenderType: core.serialization.Schema = + core.serialization.enum_([ + "CREDIT_CARD", + "CASH", + "THIRD_PARTY_CARD", + "NO_SALE", + "SQUARE_WALLET", + "SQUARE_GIFT_CARD", + "UNKNOWN", + "OTHER", + ]); + +export declare namespace V1TenderType { + export type Raw = + | "CREDIT_CARD" + | "CASH" + | "THIRD_PARTY_CARD" + | "NO_SALE" + | "SQUARE_WALLET" + | "SQUARE_GIFT_CARD" + | "UNKNOWN" + | "OTHER"; +} diff --git a/src/serialization/types/V1UpdateOrderRequestAction.ts b/src/serialization/types/V1UpdateOrderRequestAction.ts new file mode 100644 index 000000000..34636e4f1 --- /dev/null +++ b/src/serialization/types/V1UpdateOrderRequestAction.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const V1UpdateOrderRequestAction: core.serialization.Schema< + serializers.V1UpdateOrderRequestAction.Raw, + Square.V1UpdateOrderRequestAction +> = core.serialization.enum_(["COMPLETE", "CANCEL", "REFUND"]); + +export declare namespace V1UpdateOrderRequestAction { + export type Raw = "COMPLETE" | "CANCEL" | "REFUND"; +} diff --git a/src/serialization/types/Vendor.ts b/src/serialization/types/Vendor.ts new file mode 100644 index 000000000..bc4e3d0ae --- /dev/null +++ b/src/serialization/types/Vendor.ts @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Address } from "./Address"; +import { VendorContact } from "./VendorContact"; +import { VendorStatus } from "./VendorStatus"; + +export const Vendor: core.serialization.ObjectSchema = core.serialization.object( + { + id: core.serialization.string().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + name: core.serialization.string().optionalNullable(), + address: Address.optional(), + contacts: core.serialization.list(VendorContact).optionalNullable(), + accountNumber: core.serialization.property("account_number", core.serialization.string().optionalNullable()), + note: core.serialization.string().optionalNullable(), + version: core.serialization.number().optional(), + status: VendorStatus.optional(), + }, +); + +export declare namespace Vendor { + export interface Raw { + id?: string | null; + created_at?: string | null; + updated_at?: string | null; + name?: (string | null) | null; + address?: Address.Raw | null; + contacts?: (VendorContact.Raw[] | null) | null; + account_number?: (string | null) | null; + note?: (string | null) | null; + version?: number | null; + status?: VendorStatus.Raw | null; + } +} diff --git a/src/serialization/types/VendorContact.ts b/src/serialization/types/VendorContact.ts new file mode 100644 index 000000000..3ff4ff0e3 --- /dev/null +++ b/src/serialization/types/VendorContact.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const VendorContact: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string().optionalNullable(), + emailAddress: core.serialization.property("email_address", core.serialization.string().optionalNullable()), + phoneNumber: core.serialization.property("phone_number", core.serialization.string().optionalNullable()), + removed: core.serialization.boolean().optionalNullable(), + ordinal: core.serialization.number(), + }); + +export declare namespace VendorContact { + export interface Raw { + id?: string | null; + name?: (string | null) | null; + email_address?: (string | null) | null; + phone_number?: (string | null) | null; + removed?: (boolean | null) | null; + ordinal: number; + } +} diff --git a/src/serialization/types/VendorStatus.ts b/src/serialization/types/VendorStatus.ts new file mode 100644 index 000000000..11711db8e --- /dev/null +++ b/src/serialization/types/VendorStatus.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const VendorStatus: core.serialization.Schema = + core.serialization.enum_(["ACTIVE", "INACTIVE"]); + +export declare namespace VendorStatus { + export type Raw = "ACTIVE" | "INACTIVE"; +} diff --git a/src/serialization/types/VisibilityFilter.ts b/src/serialization/types/VisibilityFilter.ts new file mode 100644 index 000000000..c0ff5cf9e --- /dev/null +++ b/src/serialization/types/VisibilityFilter.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const VisibilityFilter: core.serialization.Schema = + core.serialization.enum_(["ALL", "READ", "READ_WRITE"]); + +export declare namespace VisibilityFilter { + export type Raw = "ALL" | "READ" | "READ_WRITE"; +} diff --git a/src/serialization/types/VoidTransactionResponse.ts b/src/serialization/types/VoidTransactionResponse.ts new file mode 100644 index 000000000..963f7b427 --- /dev/null +++ b/src/serialization/types/VoidTransactionResponse.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Error_ } from "./Error_"; + +export const VoidTransactionResponse: core.serialization.ObjectSchema< + serializers.VoidTransactionResponse.Raw, + Square.VoidTransactionResponse +> = core.serialization.object({ + errors: core.serialization.list(Error_).optional(), +}); + +export declare namespace VoidTransactionResponse { + export interface Raw { + errors?: Error_.Raw[] | null; + } +} diff --git a/src/serialization/types/WageSetting.ts b/src/serialization/types/WageSetting.ts new file mode 100644 index 000000000..cc5b4dcd4 --- /dev/null +++ b/src/serialization/types/WageSetting.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { JobAssignment } from "./JobAssignment"; + +export const WageSetting: core.serialization.ObjectSchema = + core.serialization.object({ + teamMemberId: core.serialization.property("team_member_id", core.serialization.string().optionalNullable()), + jobAssignments: core.serialization.property( + "job_assignments", + core.serialization.list(JobAssignment).optionalNullable(), + ), + isOvertimeExempt: core.serialization.property( + "is_overtime_exempt", + core.serialization.boolean().optionalNullable(), + ), + version: core.serialization.number().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + }); + +export declare namespace WageSetting { + export interface Raw { + team_member_id?: (string | null) | null; + job_assignments?: (JobAssignment.Raw[] | null) | null; + is_overtime_exempt?: (boolean | null) | null; + version?: number | null; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/WebhookSubscription.ts b/src/serialization/types/WebhookSubscription.ts new file mode 100644 index 000000000..6e8af5771 --- /dev/null +++ b/src/serialization/types/WebhookSubscription.ts @@ -0,0 +1,39 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const WebhookSubscription: core.serialization.ObjectSchema< + serializers.WebhookSubscription.Raw, + Square.WebhookSubscription +> = core.serialization.object({ + id: core.serialization.string().optional(), + name: core.serialization.string().optionalNullable(), + enabled: core.serialization.boolean().optionalNullable(), + eventTypes: core.serialization.property( + "event_types", + core.serialization.list(core.serialization.string()).optionalNullable(), + ), + notificationUrl: core.serialization.property("notification_url", core.serialization.string().optionalNullable()), + apiVersion: core.serialization.property("api_version", core.serialization.string().optionalNullable()), + signatureKey: core.serialization.property("signature_key", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), +}); + +export declare namespace WebhookSubscription { + export interface Raw { + id?: string | null; + name?: (string | null) | null; + enabled?: (boolean | null) | null; + event_types?: (string[] | null) | null; + notification_url?: (string | null) | null; + api_version?: (string | null) | null; + signature_key?: string | null; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/Weekday.ts b/src/serialization/types/Weekday.ts new file mode 100644 index 000000000..e7b024da9 --- /dev/null +++ b/src/serialization/types/Weekday.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; + +export const Weekday: core.serialization.Schema = core.serialization.enum_([ + "MON", + "TUE", + "WED", + "THU", + "FRI", + "SAT", + "SUN", +]); + +export declare namespace Weekday { + export type Raw = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN"; +} diff --git a/src/serialization/types/WorkweekConfig.ts b/src/serialization/types/WorkweekConfig.ts new file mode 100644 index 000000000..e566ce1c1 --- /dev/null +++ b/src/serialization/types/WorkweekConfig.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../index"; +import * as Square from "../../api/index"; +import * as core from "../../core"; +import { Weekday } from "./Weekday"; + +export const WorkweekConfig: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string().optional(), + startOfWeek: core.serialization.property("start_of_week", Weekday), + startOfDayLocalTime: core.serialization.property("start_of_day_local_time", core.serialization.string()), + version: core.serialization.number().optional(), + createdAt: core.serialization.property("created_at", core.serialization.string().optional()), + updatedAt: core.serialization.property("updated_at", core.serialization.string().optional()), + }); + +export declare namespace WorkweekConfig { + export interface Raw { + id?: string | null; + start_of_week: Weekday.Raw; + start_of_day_local_time: string; + version?: number | null; + created_at?: string | null; + updated_at?: string | null; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts new file mode 100644 index 000000000..af8e87c8a --- /dev/null +++ b/src/serialization/types/index.ts @@ -0,0 +1,913 @@ +export * from "./AchDetails"; +export * from "./AcceptDisputeResponse"; +export * from "./AcceptedPaymentMethods"; +export * from "./AccumulateLoyaltyPointsResponse"; +export * from "./ActionCancelReason"; +export * from "./ActivityType"; +export * from "./AddGroupToCustomerResponse"; +export * from "./AdditionalRecipient"; +export * from "./Address"; +export * from "./AdjustLoyaltyPointsResponse"; +export * from "./AfterpayDetails"; +export * from "./ApplicationDetails"; +export * from "./ApplicationDetailsExternalSquareProduct"; +export * from "./ApplicationType"; +export * from "./AppointmentSegment"; +export * from "./ArchivedState"; +export * from "./Availability"; +export * from "./BankAccount"; +export * from "./BankAccountPaymentDetails"; +export * from "./BankAccountStatus"; +export * from "./BankAccountType"; +export * from "./BatchChangeInventoryRequest"; +export * from "./BatchChangeInventoryResponse"; +export * from "./BatchDeleteCatalogObjectsResponse"; +export * from "./BatchGetCatalogObjectsResponse"; +export * from "./BatchRetrieveInventoryChangesRequest"; +export * from "./BatchGetInventoryChangesResponse"; +export * from "./BatchGetInventoryCountsRequest"; +export * from "./BatchGetInventoryCountsResponse"; +export * from "./BatchGetOrdersResponse"; +export * from "./BatchUpsertCatalogObjectsResponse"; +export * from "./Booking"; +export * from "./BookingBookingSource"; +export * from "./BookingCreatorDetails"; +export * from "./BookingCreatorDetailsCreatorType"; +export * from "./BookingCustomAttributeDeleteRequest"; +export * from "./BookingCustomAttributeDeleteResponse"; +export * from "./BookingCustomAttributeUpsertRequest"; +export * from "./BookingCustomAttributeUpsertResponse"; +export * from "./BookingStatus"; +export * from "./Break"; +export * from "./BreakType"; +export * from "./BulkCreateCustomerData"; +export * from "./BulkCreateCustomersResponse"; +export * from "./BatchCreateTeamMembersResponse"; +export * from "./BatchCreateVendorsResponse"; +export * from "./BulkDeleteBookingCustomAttributesResponse"; +export * from "./BulkDeleteCustomersResponse"; +export * from "./BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest"; +export * from "./BulkDeleteLocationCustomAttributesResponse"; +export * from "./BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse"; +export * from "./BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest"; +export * from "./BulkDeleteMerchantCustomAttributesResponse"; +export * from "./BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse"; +export * from "./BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute"; +export * from "./BulkDeleteOrderCustomAttributesResponse"; +export * from "./BulkRetrieveBookingsResponse"; +export * from "./BulkRetrieveCustomersResponse"; +export * from "./BulkRetrieveTeamMemberBookingProfilesResponse"; +export * from "./BatchGetVendorsResponse"; +export * from "./BulkSwapPlanResponse"; +export * from "./BulkUpdateCustomerData"; +export * from "./BulkUpdateCustomersResponse"; +export * from "./BatchUpdateTeamMembersResponse"; +export * from "./BatchUpdateVendorsResponse"; +export * from "./BulkUpsertBookingCustomAttributesResponse"; +export * from "./BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest"; +export * from "./BatchUpsertCustomerCustomAttributesResponse"; +export * from "./BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse"; +export * from "./BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest"; +export * from "./BulkUpsertLocationCustomAttributesResponse"; +export * from "./BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse"; +export * from "./BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest"; +export * from "./BulkUpsertMerchantCustomAttributesResponse"; +export * from "./BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse"; +export * from "./BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute"; +export * from "./BulkUpsertOrderCustomAttributesResponse"; +export * from "./BusinessAppointmentSettings"; +export * from "./BusinessAppointmentSettingsAlignmentTime"; +export * from "./BusinessAppointmentSettingsBookingLocationType"; +export * from "./BusinessAppointmentSettingsCancellationPolicy"; +export * from "./BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType"; +export * from "./BusinessBookingProfile"; +export * from "./BusinessBookingProfileBookingPolicy"; +export * from "./BusinessBookingProfileCustomerTimezoneChoice"; +export * from "./BusinessHours"; +export * from "./BusinessHoursPeriod"; +export * from "./BuyNowPayLaterDetails"; +export * from "./CalculateLoyaltyPointsResponse"; +export * from "./CalculateOrderResponse"; +export * from "./CancelBookingResponse"; +export * from "./CancelInvoiceResponse"; +export * from "./CancelLoyaltyPromotionResponse"; +export * from "./CancelPaymentByIdempotencyKeyResponse"; +export * from "./CancelPaymentResponse"; +export * from "./CancelSubscriptionResponse"; +export * from "./CancelTerminalActionResponse"; +export * from "./CancelTerminalCheckoutResponse"; +export * from "./CancelTerminalRefundResponse"; +export * from "./CaptureTransactionResponse"; +export * from "./Card"; +export * from "./CardBrand"; +export * from "./CardCoBrand"; +export * from "./CardPaymentDetails"; +export * from "./CardPaymentTimeline"; +export * from "./CardPrepaidType"; +export * from "./CardType"; +export * from "./CashAppDetails"; +export * from "./CashDrawerDevice"; +export * from "./CashDrawerEventType"; +export * from "./CashDrawerShift"; +export * from "./CashDrawerShiftEvent"; +export * from "./CashDrawerShiftState"; +export * from "./CashDrawerShiftSummary"; +export * from "./CashPaymentDetails"; +export * from "./CatalogCategory"; +export * from "./CatalogCategoryType"; +export * from "./CatalogCustomAttributeDefinition"; +export * from "./CatalogCustomAttributeDefinitionAppVisibility"; +export * from "./CatalogCustomAttributeDefinitionNumberConfig"; +export * from "./CatalogCustomAttributeDefinitionSelectionConfig"; +export * from "./CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection"; +export * from "./CatalogCustomAttributeDefinitionSellerVisibility"; +export * from "./CatalogCustomAttributeDefinitionStringConfig"; +export * from "./CatalogCustomAttributeDefinitionType"; +export * from "./CatalogCustomAttributeValue"; +export * from "./CatalogDiscount"; +export * from "./CatalogDiscountModifyTaxBasis"; +export * from "./CatalogDiscountType"; +export * from "./CatalogEcomSeoData"; +export * from "./CatalogIdMapping"; +export * from "./CatalogImage"; +export * from "./CatalogInfoResponse"; +export * from "./CatalogInfoResponseLimits"; +export * from "./CatalogItem"; +export * from "./CatalogItemFoodAndBeverageDetails"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreference"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference"; +export * from "./CatalogItemFoodAndBeverageDetailsDietaryPreferenceType"; +export * from "./CatalogItemFoodAndBeverageDetailsIngredient"; +export * from "./CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient"; +export * from "./CatalogItemModifierListInfo"; +export * from "./CatalogItemOption"; +export * from "./CatalogItemOptionForItem"; +export * from "./CatalogItemOptionValue"; +export * from "./CatalogItemOptionValueForItemVariation"; +export * from "./CatalogItemProductType"; +export * from "./CatalogItemVariation"; +export * from "./CatalogMeasurementUnit"; +export * from "./CatalogModifier"; +export * from "./CatalogModifierList"; +export * from "./CatalogModifierListModifierType"; +export * from "./CatalogModifierListSelectionType"; +export * from "./CatalogModifierOverride"; +export * from "./CatalogObject"; +export * from "./CatalogObjectBatch"; +export * from "./CatalogObjectCategory"; +export * from "./CatalogObjectBase"; +export * from "./CatalogObjectReference"; +export * from "./CatalogObjectType"; +export * from "./CatalogPricingRule"; +export * from "./CatalogPricingType"; +export * from "./CatalogProductSet"; +export * from "./CatalogQuery"; +export * from "./CatalogQueryExact"; +export * from "./CatalogQueryItemVariationsForItemOptionValues"; +export * from "./CatalogQueryItemsForItemOptions"; +export * from "./CatalogQueryItemsForModifierList"; +export * from "./CatalogQueryItemsForTax"; +export * from "./CatalogQueryPrefix"; +export * from "./CatalogQueryRange"; +export * from "./CatalogQuerySet"; +export * from "./CatalogQuerySortedAttribute"; +export * from "./CatalogQueryText"; +export * from "./CatalogQuickAmount"; +export * from "./CatalogQuickAmountType"; +export * from "./CatalogQuickAmountsSettings"; +export * from "./CatalogQuickAmountsSettingsOption"; +export * from "./CatalogStockConversion"; +export * from "./CatalogSubscriptionPlan"; +export * from "./CatalogTax"; +export * from "./CatalogTimePeriod"; +export * from "./CatalogV1Id"; +export * from "./CategoryPathToRootNode"; +export * from "./ChangeBillingAnchorDateResponse"; +export * from "./ChangeTiming"; +export * from "./ChargeRequestAdditionalRecipient"; +export * from "./Checkout"; +export * from "./CheckoutLocationSettings"; +export * from "./CheckoutLocationSettingsBranding"; +export * from "./CheckoutLocationSettingsBrandingButtonShape"; +export * from "./CheckoutLocationSettingsBrandingHeaderType"; +export * from "./CheckoutLocationSettingsCoupons"; +export * from "./CheckoutLocationSettingsPolicy"; +export * from "./CheckoutLocationSettingsTipping"; +export * from "./CheckoutMerchantSettings"; +export * from "./CheckoutMerchantSettingsPaymentMethods"; +export * from "./CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay"; +export * from "./CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange"; +export * from "./CheckoutMerchantSettingsPaymentMethodsPaymentMethod"; +export * from "./CheckoutOptions"; +export * from "./CheckoutOptionsPaymentType"; +export * from "./ClearpayDetails"; +export * from "./CloneOrderResponse"; +export * from "./CollectedData"; +export * from "./CompletePaymentResponse"; +export * from "./Component"; +export * from "./ComponentComponentType"; +export * from "./ConfirmationDecision"; +export * from "./ConfirmationOptions"; +export * from "./Coordinates"; +export * from "./Country"; +export * from "./CreateBookingCustomAttributeDefinitionResponse"; +export * from "./CreateBookingResponse"; +export * from "./CreateBreakTypeResponse"; +export * from "./CreateCardResponse"; +export * from "./CreateCatalogImageRequest"; +export * from "./CreateCatalogImageResponse"; +export * from "./CreateCheckoutResponse"; +export * from "./CreateCustomerCardResponse"; +export * from "./CreateCustomerCustomAttributeDefinitionResponse"; +export * from "./CreateCustomerGroupResponse"; +export * from "./CreateCustomerResponse"; +export * from "./CreateDeviceCodeResponse"; +export * from "./CreateDisputeEvidenceFileRequest"; +export * from "./CreateDisputeEvidenceFileResponse"; +export * from "./CreateDisputeEvidenceTextResponse"; +export * from "./CreateGiftCardActivityResponse"; +export * from "./CreateGiftCardResponse"; +export * from "./CreateInvoiceAttachmentResponse"; +export * from "./CreateInvoiceResponse"; +export * from "./CreateJobResponse"; +export * from "./CreateLocationCustomAttributeDefinitionResponse"; +export * from "./CreateLocationResponse"; +export * from "./CreateLoyaltyAccountResponse"; +export * from "./CreateLoyaltyPromotionResponse"; +export * from "./CreateLoyaltyRewardResponse"; +export * from "./CreateMerchantCustomAttributeDefinitionResponse"; +export * from "./CreateMobileAuthorizationCodeResponse"; +export * from "./CreateOrderCustomAttributeDefinitionResponse"; +export * from "./CreateOrderRequest"; +export * from "./CreateOrderResponse"; +export * from "./CreatePaymentLinkResponse"; +export * from "./CreatePaymentResponse"; +export * from "./CreateShiftResponse"; +export * from "./CreateSubscriptionResponse"; +export * from "./CreateTeamMemberRequest"; +export * from "./CreateTeamMemberResponse"; +export * from "./CreateTerminalActionResponse"; +export * from "./CreateTerminalCheckoutResponse"; +export * from "./CreateTerminalRefundResponse"; +export * from "./CreateVendorResponse"; +export * from "./CreateWebhookSubscriptionResponse"; +export * from "./Currency"; +export * from "./CustomAttribute"; +export * from "./CustomAttributeDefinition"; +export * from "./CustomAttributeDefinitionVisibility"; +export * from "./CustomAttributeFilter"; +export * from "./CustomField"; +export * from "./Customer"; +export * from "./CustomerAddressFilter"; +export * from "./CustomerCreationSource"; +export * from "./CustomerCreationSourceFilter"; +export * from "./CustomerCustomAttributeFilter"; +export * from "./CustomerCustomAttributeFilterValue"; +export * from "./CustomerCustomAttributeFilters"; +export * from "./CustomerDetails"; +export * from "./CustomerFilter"; +export * from "./CustomerGroup"; +export * from "./CustomerInclusionExclusion"; +export * from "./CustomerPreferences"; +export * from "./CustomerQuery"; +export * from "./CustomerSegment"; +export * from "./CustomerSort"; +export * from "./CustomerSortField"; +export * from "./CustomerTaxIds"; +export * from "./CustomerTextFilter"; +export * from "./DataCollectionOptions"; +export * from "./DataCollectionOptionsInputType"; +export * from "./DateRange"; +export * from "./DayOfWeek"; +export * from "./DeleteBookingCustomAttributeDefinitionResponse"; +export * from "./DeleteBookingCustomAttributeResponse"; +export * from "./DeleteBreakTypeResponse"; +export * from "./DeleteCatalogObjectResponse"; +export * from "./DeleteCustomerCardResponse"; +export * from "./DeleteCustomerCustomAttributeDefinitionResponse"; +export * from "./DeleteCustomerCustomAttributeResponse"; +export * from "./DeleteCustomerGroupResponse"; +export * from "./DeleteCustomerResponse"; +export * from "./DeleteDisputeEvidenceResponse"; +export * from "./DeleteInvoiceAttachmentResponse"; +export * from "./DeleteInvoiceResponse"; +export * from "./DeleteLocationCustomAttributeDefinitionResponse"; +export * from "./DeleteLocationCustomAttributeResponse"; +export * from "./DeleteLoyaltyRewardResponse"; +export * from "./DeleteMerchantCustomAttributeDefinitionResponse"; +export * from "./DeleteMerchantCustomAttributeResponse"; +export * from "./DeleteOrderCustomAttributeDefinitionResponse"; +export * from "./DeleteOrderCustomAttributeResponse"; +export * from "./DeletePaymentLinkResponse"; +export * from "./DeleteShiftResponse"; +export * from "./DeleteSnippetResponse"; +export * from "./DeleteSubscriptionActionResponse"; +export * from "./DeleteWebhookSubscriptionResponse"; +export * from "./Destination"; +export * from "./DestinationDetails"; +export * from "./DestinationDetailsCardRefundDetails"; +export * from "./DestinationDetailsCashRefundDetails"; +export * from "./DestinationDetailsExternalRefundDetails"; +export * from "./DestinationType"; +export * from "./Device"; +export * from "./DeviceAttributes"; +export * from "./DeviceAttributesDeviceType"; +export * from "./DeviceCheckoutOptions"; +export * from "./DeviceCode"; +export * from "./DeviceCodeStatus"; +export * from "./DeviceComponentDetailsApplicationDetails"; +export * from "./DeviceComponentDetailsBatteryDetails"; +export * from "./DeviceComponentDetailsCardReaderDetails"; +export * from "./DeviceComponentDetailsEthernetDetails"; +export * from "./DeviceComponentDetailsExternalPower"; +export * from "./DeviceComponentDetailsMeasurement"; +export * from "./DeviceComponentDetailsWiFiDetails"; +export * from "./DeviceDetails"; +export * from "./DeviceMetadata"; +export * from "./DeviceStatus"; +export * from "./DeviceStatusCategory"; +export * from "./DigitalWalletDetails"; +export * from "./DisableCardResponse"; +export * from "./DisableEventsResponse"; +export * from "./DismissTerminalActionResponse"; +export * from "./DismissTerminalCheckoutResponse"; +export * from "./DismissTerminalRefundResponse"; +export * from "./Dispute"; +export * from "./DisputeEvidence"; +export * from "./DisputeEvidenceFile"; +export * from "./DisputeEvidenceType"; +export * from "./DisputeReason"; +export * from "./DisputeState"; +export * from "./DisputedPayment"; +export * from "./Employee"; +export * from "./EmployeeStatus"; +export * from "./EmployeeWage"; +export * from "./EnableEventsResponse"; +export * from "./Error_"; +export * from "./ErrorCategory"; +export * from "./ErrorCode"; +export * from "./Event"; +export * from "./EventData"; +export * from "./EventMetadata"; +export * from "./EventTypeMetadata"; +export * from "./ExcludeStrategy"; +export * from "./ExternalPaymentDetails"; +export * from "./FilterValue"; +export * from "./FloatNumberRange"; +export * from "./Fulfillment"; +export * from "./FulfillmentDeliveryDetails"; +export * from "./FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType"; +export * from "./FulfillmentFulfillmentEntry"; +export * from "./FulfillmentFulfillmentLineItemApplication"; +export * from "./FulfillmentPickupDetails"; +export * from "./FulfillmentPickupDetailsCurbsidePickupDetails"; +export * from "./FulfillmentPickupDetailsScheduleType"; +export * from "./FulfillmentRecipient"; +export * from "./FulfillmentShipmentDetails"; +export * from "./FulfillmentState"; +export * from "./FulfillmentType"; +export * from "./GetBankAccountByV1IdResponse"; +export * from "./GetBankAccountResponse"; +export * from "./GetBreakTypeResponse"; +export * from "./GetDeviceCodeResponse"; +export * from "./GetDeviceResponse"; +export * from "./GetEmployeeWageResponse"; +export * from "./GetInvoiceResponse"; +export * from "./GetPaymentRefundResponse"; +export * from "./GetPaymentResponse"; +export * from "./GetPayoutResponse"; +export * from "./GetShiftResponse"; +export * from "./GetTeamMemberWageResponse"; +export * from "./GetTerminalActionResponse"; +export * from "./GetTerminalCheckoutResponse"; +export * from "./GetTerminalRefundResponse"; +export * from "./GiftCard"; +export * from "./GiftCardActivity"; +export * from "./GiftCardActivityActivate"; +export * from "./GiftCardActivityAdjustDecrement"; +export * from "./GiftCardActivityAdjustDecrementReason"; +export * from "./GiftCardActivityAdjustIncrement"; +export * from "./GiftCardActivityAdjustIncrementReason"; +export * from "./GiftCardActivityBlock"; +export * from "./GiftCardActivityBlockReason"; +export * from "./GiftCardActivityClearBalance"; +export * from "./GiftCardActivityClearBalanceReason"; +export * from "./GiftCardActivityDeactivate"; +export * from "./GiftCardActivityDeactivateReason"; +export * from "./GiftCardActivityImport"; +export * from "./GiftCardActivityImportReversal"; +export * from "./GiftCardActivityLoad"; +export * from "./GiftCardActivityRedeem"; +export * from "./GiftCardActivityRedeemStatus"; +export * from "./GiftCardActivityRefund"; +export * from "./GiftCardActivityTransferBalanceFrom"; +export * from "./GiftCardActivityTransferBalanceTo"; +export * from "./GiftCardActivityType"; +export * from "./GiftCardActivityUnblock"; +export * from "./GiftCardActivityUnblockReason"; +export * from "./GiftCardActivityUnlinkedActivityRefund"; +export * from "./GiftCardGanSource"; +export * from "./GiftCardStatus"; +export * from "./GiftCardType"; +export * from "./InventoryAdjustment"; +export * from "./InventoryAdjustmentGroup"; +export * from "./InventoryAlertType"; +export * from "./InventoryChange"; +export * from "./InventoryChangeType"; +export * from "./InventoryCount"; +export * from "./InventoryPhysicalCount"; +export * from "./InventoryState"; +export * from "./InventoryTransfer"; +export * from "./Invoice"; +export * from "./InvoiceAcceptedPaymentMethods"; +export * from "./InvoiceAttachment"; +export * from "./InvoiceAutomaticPaymentSource"; +export * from "./InvoiceCustomField"; +export * from "./InvoiceCustomFieldPlacement"; +export * from "./InvoiceDeliveryMethod"; +export * from "./InvoiceFilter"; +export * from "./InvoicePaymentReminder"; +export * from "./InvoicePaymentReminderStatus"; +export * from "./InvoicePaymentRequest"; +export * from "./InvoiceQuery"; +export * from "./InvoiceRecipient"; +export * from "./InvoiceRecipientTaxIds"; +export * from "./InvoiceRequestMethod"; +export * from "./InvoiceRequestType"; +export * from "./InvoiceSort"; +export * from "./InvoiceSortField"; +export * from "./InvoiceStatus"; +export * from "./ItemVariationLocationOverrides"; +export * from "./Job"; +export * from "./JobAssignment"; +export * from "./JobAssignmentPayType"; +export * from "./LinkCustomerToGiftCardResponse"; +export * from "./ListBankAccountsResponse"; +export * from "./ListBookingCustomAttributeDefinitionsResponse"; +export * from "./ListBookingCustomAttributesResponse"; +export * from "./ListBookingsResponse"; +export * from "./ListBreakTypesResponse"; +export * from "./ListCardsResponse"; +export * from "./ListCashDrawerShiftEventsResponse"; +export * from "./ListCashDrawerShiftsResponse"; +export * from "./ListCatalogResponse"; +export * from "./ListCustomerCustomAttributeDefinitionsResponse"; +export * from "./ListCustomerCustomAttributesResponse"; +export * from "./ListCustomerGroupsResponse"; +export * from "./ListCustomerSegmentsResponse"; +export * from "./ListCustomersResponse"; +export * from "./ListDeviceCodesResponse"; +export * from "./ListDevicesResponse"; +export * from "./ListDisputeEvidenceResponse"; +export * from "./ListDisputesResponse"; +export * from "./ListEmployeeWagesResponse"; +export * from "./ListEmployeesResponse"; +export * from "./ListEventTypesResponse"; +export * from "./ListGiftCardActivitiesResponse"; +export * from "./ListGiftCardsResponse"; +export * from "./ListInvoicesResponse"; +export * from "./ListJobsResponse"; +export * from "./ListLocationBookingProfilesResponse"; +export * from "./ListLocationCustomAttributeDefinitionsResponse"; +export * from "./ListLocationCustomAttributesResponse"; +export * from "./ListLocationsResponse"; +export * from "./ListLoyaltyProgramsResponse"; +export * from "./ListLoyaltyPromotionsResponse"; +export * from "./ListMerchantCustomAttributeDefinitionsResponse"; +export * from "./ListMerchantCustomAttributesResponse"; +export * from "./ListMerchantsResponse"; +export * from "./ListOrderCustomAttributeDefinitionsResponse"; +export * from "./ListOrderCustomAttributesResponse"; +export * from "./ListPaymentLinksResponse"; +export * from "./ListPaymentRefundsResponse"; +export * from "./ListPaymentsResponse"; +export * from "./ListPayoutEntriesResponse"; +export * from "./ListPayoutsResponse"; +export * from "./ListSitesResponse"; +export * from "./ListSubscriptionEventsResponse"; +export * from "./ListTeamMemberBookingProfilesResponse"; +export * from "./ListTeamMemberWagesResponse"; +export * from "./ListTransactionsResponse"; +export * from "./ListWebhookEventTypesResponse"; +export * from "./ListWebhookSubscriptionsResponse"; +export * from "./ListWorkweekConfigsResponse"; +export * from "./Location"; +export * from "./LocationBookingProfile"; +export * from "./LocationCapability"; +export * from "./LocationStatus"; +export * from "./LocationType"; +export * from "./LoyaltyAccount"; +export * from "./LoyaltyAccountExpiringPointDeadline"; +export * from "./LoyaltyAccountMapping"; +export * from "./LoyaltyEvent"; +export * from "./LoyaltyEventAccumulatePoints"; +export * from "./LoyaltyEventAccumulatePromotionPoints"; +export * from "./LoyaltyEventAdjustPoints"; +export * from "./LoyaltyEventCreateReward"; +export * from "./LoyaltyEventDateTimeFilter"; +export * from "./LoyaltyEventDeleteReward"; +export * from "./LoyaltyEventExpirePoints"; +export * from "./LoyaltyEventFilter"; +export * from "./LoyaltyEventLocationFilter"; +export * from "./LoyaltyEventLoyaltyAccountFilter"; +export * from "./LoyaltyEventOrderFilter"; +export * from "./LoyaltyEventOther"; +export * from "./LoyaltyEventQuery"; +export * from "./LoyaltyEventRedeemReward"; +export * from "./LoyaltyEventSource"; +export * from "./LoyaltyEventType"; +export * from "./LoyaltyEventTypeFilter"; +export * from "./LoyaltyProgram"; +export * from "./LoyaltyProgramAccrualRule"; +export * from "./LoyaltyProgramAccrualRuleCategoryData"; +export * from "./LoyaltyProgramAccrualRuleItemVariationData"; +export * from "./LoyaltyProgramAccrualRuleSpendData"; +export * from "./LoyaltyProgramAccrualRuleTaxMode"; +export * from "./LoyaltyProgramAccrualRuleType"; +export * from "./LoyaltyProgramAccrualRuleVisitData"; +export * from "./LoyaltyProgramExpirationPolicy"; +export * from "./LoyaltyProgramRewardDefinition"; +export * from "./LoyaltyProgramRewardDefinitionScope"; +export * from "./LoyaltyProgramRewardDefinitionType"; +export * from "./LoyaltyProgramRewardTier"; +export * from "./LoyaltyProgramStatus"; +export * from "./LoyaltyProgramTerminology"; +export * from "./LoyaltyPromotion"; +export * from "./LoyaltyPromotionAvailableTimeData"; +export * from "./LoyaltyPromotionIncentive"; +export * from "./LoyaltyPromotionIncentivePointsAdditionData"; +export * from "./LoyaltyPromotionIncentivePointsMultiplierData"; +export * from "./LoyaltyPromotionIncentiveType"; +export * from "./LoyaltyPromotionStatus"; +export * from "./LoyaltyPromotionTriggerLimit"; +export * from "./LoyaltyPromotionTriggerLimitInterval"; +export * from "./LoyaltyReward"; +export * from "./LoyaltyRewardStatus"; +export * from "./MeasurementUnit"; +export * from "./MeasurementUnitArea"; +export * from "./MeasurementUnitCustom"; +export * from "./MeasurementUnitGeneric"; +export * from "./MeasurementUnitLength"; +export * from "./MeasurementUnitTime"; +export * from "./MeasurementUnitUnitType"; +export * from "./MeasurementUnitVolume"; +export * from "./MeasurementUnitWeight"; +export * from "./Merchant"; +export * from "./MerchantStatus"; +export * from "./ModifierLocationOverrides"; +export * from "./Money"; +export * from "./ObtainTokenResponse"; +export * from "./OfflinePaymentDetails"; +export * from "./Order"; +export * from "./OrderEntry"; +export * from "./OrderLineItem"; +export * from "./OrderLineItemAppliedDiscount"; +export * from "./OrderLineItemAppliedServiceCharge"; +export * from "./OrderLineItemAppliedTax"; +export * from "./OrderLineItemDiscount"; +export * from "./OrderLineItemDiscountScope"; +export * from "./OrderLineItemDiscountType"; +export * from "./OrderLineItemItemType"; +export * from "./OrderLineItemModifier"; +export * from "./OrderLineItemPricingBlocklists"; +export * from "./OrderLineItemPricingBlocklistsBlockedDiscount"; +export * from "./OrderLineItemPricingBlocklistsBlockedTax"; +export * from "./OrderLineItemTax"; +export * from "./OrderLineItemTaxScope"; +export * from "./OrderLineItemTaxType"; +export * from "./OrderMoneyAmounts"; +export * from "./OrderPricingOptions"; +export * from "./OrderQuantityUnit"; +export * from "./OrderReturn"; +export * from "./OrderReturnDiscount"; +export * from "./OrderReturnLineItem"; +export * from "./OrderReturnLineItemModifier"; +export * from "./OrderReturnServiceCharge"; +export * from "./OrderReturnTax"; +export * from "./OrderReturnTip"; +export * from "./OrderReward"; +export * from "./OrderRoundingAdjustment"; +export * from "./OrderServiceCharge"; +export * from "./OrderServiceChargeCalculationPhase"; +export * from "./OrderServiceChargeScope"; +export * from "./OrderServiceChargeTreatmentType"; +export * from "./OrderServiceChargeType"; +export * from "./OrderSource"; +export * from "./OrderState"; +export * from "./PauseSubscriptionResponse"; +export * from "./PayOrderResponse"; +export * from "./Payment"; +export * from "./PaymentBalanceActivityAppFeeRefundDetail"; +export * from "./PaymentBalanceActivityAppFeeRevenueDetail"; +export * from "./PaymentBalanceActivityAutomaticSavingsDetail"; +export * from "./PaymentBalanceActivityAutomaticSavingsReversedDetail"; +export * from "./PaymentBalanceActivityChargeDetail"; +export * from "./PaymentBalanceActivityDepositFeeDetail"; +export * from "./PaymentBalanceActivityDepositFeeReversedDetail"; +export * from "./PaymentBalanceActivityDisputeDetail"; +export * from "./PaymentBalanceActivityFeeDetail"; +export * from "./PaymentBalanceActivityFreeProcessingDetail"; +export * from "./PaymentBalanceActivityHoldAdjustmentDetail"; +export * from "./PaymentBalanceActivityOpenDisputeDetail"; +export * from "./PaymentBalanceActivityOtherAdjustmentDetail"; +export * from "./PaymentBalanceActivityOtherDetail"; +export * from "./PaymentBalanceActivityRefundDetail"; +export * from "./PaymentBalanceActivityReleaseAdjustmentDetail"; +export * from "./PaymentBalanceActivityReserveHoldDetail"; +export * from "./PaymentBalanceActivityReserveReleaseDetail"; +export * from "./PaymentBalanceActivitySquareCapitalPaymentDetail"; +export * from "./PaymentBalanceActivitySquareCapitalReversedPaymentDetail"; +export * from "./PaymentBalanceActivitySquarePayrollTransferDetail"; +export * from "./PaymentBalanceActivitySquarePayrollTransferReversedDetail"; +export * from "./PaymentBalanceActivityTaxOnFeeDetail"; +export * from "./PaymentBalanceActivityThirdPartyFeeDetail"; +export * from "./PaymentBalanceActivityThirdPartyFeeRefundDetail"; +export * from "./PaymentLink"; +export * from "./PaymentLinkRelatedResources"; +export * from "./PaymentOptions"; +export * from "./PaymentOptionsDelayAction"; +export * from "./PaymentRefund"; +export * from "./PaymentSortField"; +export * from "./Payout"; +export * from "./PayoutEntry"; +export * from "./PayoutFee"; +export * from "./PayoutFeeType"; +export * from "./PayoutStatus"; +export * from "./PayoutType"; +export * from "./Phase"; +export * from "./PhaseInput"; +export * from "./PrePopulatedData"; +export * from "./ProcessingFee"; +export * from "./Product"; +export * from "./ProductType"; +export * from "./PublishInvoiceResponse"; +export * from "./QrCodeOptions"; +export * from "./QuickPay"; +export * from "./Range"; +export * from "./ReceiptOptions"; +export * from "./RedeemLoyaltyRewardResponse"; +export * from "./Refund"; +export * from "./RefundPaymentResponse"; +export * from "./RefundStatus"; +export * from "./RegisterDomainResponse"; +export * from "./RegisterDomainResponseStatus"; +export * from "./RemoveGroupFromCustomerResponse"; +export * from "./ResumeSubscriptionResponse"; +export * from "./RetrieveBookingCustomAttributeDefinitionResponse"; +export * from "./RetrieveBookingCustomAttributeResponse"; +export * from "./GetBookingResponse"; +export * from "./GetBusinessBookingProfileResponse"; +export * from "./GetCardResponse"; +export * from "./GetCashDrawerShiftResponse"; +export * from "./GetCatalogObjectResponse"; +export * from "./GetCustomerCustomAttributeDefinitionResponse"; +export * from "./GetCustomerCustomAttributeResponse"; +export * from "./GetCustomerGroupResponse"; +export * from "./GetCustomerResponse"; +export * from "./GetCustomerSegmentResponse"; +export * from "./GetDisputeEvidenceResponse"; +export * from "./GetDisputeResponse"; +export * from "./GetEmployeeResponse"; +export * from "./GetGiftCardFromGanResponse"; +export * from "./GetGiftCardFromNonceResponse"; +export * from "./GetGiftCardResponse"; +export * from "./GetInventoryAdjustmentResponse"; +export * from "./GetInventoryChangesResponse"; +export * from "./GetInventoryCountResponse"; +export * from "./GetInventoryPhysicalCountResponse"; +export * from "./GetInventoryTransferResponse"; +export * from "./RetrieveJobResponse"; +export * from "./RetrieveLocationBookingProfileResponse"; +export * from "./RetrieveLocationCustomAttributeDefinitionResponse"; +export * from "./RetrieveLocationCustomAttributeResponse"; +export * from "./GetLocationResponse"; +export * from "./RetrieveLocationSettingsResponse"; +export * from "./GetLoyaltyAccountResponse"; +export * from "./GetLoyaltyProgramResponse"; +export * from "./GetLoyaltyPromotionResponse"; +export * from "./GetLoyaltyRewardResponse"; +export * from "./RetrieveMerchantCustomAttributeDefinitionResponse"; +export * from "./RetrieveMerchantCustomAttributeResponse"; +export * from "./GetMerchantResponse"; +export * from "./RetrieveMerchantSettingsResponse"; +export * from "./RetrieveOrderCustomAttributeDefinitionResponse"; +export * from "./RetrieveOrderCustomAttributeResponse"; +export * from "./GetOrderResponse"; +export * from "./GetPaymentLinkResponse"; +export * from "./GetSnippetResponse"; +export * from "./GetSubscriptionResponse"; +export * from "./GetTeamMemberBookingProfileResponse"; +export * from "./GetTeamMemberResponse"; +export * from "./RetrieveTokenStatusResponse"; +export * from "./GetTransactionResponse"; +export * from "./GetVendorResponse"; +export * from "./GetWageSettingResponse"; +export * from "./GetWebhookSubscriptionResponse"; +export * from "./RevokeTokenResponse"; +export * from "./RiskEvaluation"; +export * from "./RiskEvaluationRiskLevel"; +export * from "./SaveCardOptions"; +export * from "./SearchAvailabilityFilter"; +export * from "./SearchAvailabilityQuery"; +export * from "./SearchAvailabilityResponse"; +export * from "./SearchCatalogItemsRequestStockLevel"; +export * from "./SearchCatalogItemsResponse"; +export * from "./SearchCatalogObjectsResponse"; +export * from "./SearchCustomersResponse"; +export * from "./SearchEventsFilter"; +export * from "./SearchEventsQuery"; +export * from "./SearchEventsResponse"; +export * from "./SearchEventsSort"; +export * from "./SearchEventsSortField"; +export * from "./SearchInvoicesResponse"; +export * from "./SearchLoyaltyAccountsRequestLoyaltyAccountQuery"; +export * from "./SearchLoyaltyAccountsResponse"; +export * from "./SearchLoyaltyEventsResponse"; +export * from "./SearchLoyaltyRewardsRequestLoyaltyRewardQuery"; +export * from "./SearchLoyaltyRewardsResponse"; +export * from "./SearchOrdersCustomerFilter"; +export * from "./SearchOrdersDateTimeFilter"; +export * from "./SearchOrdersFilter"; +export * from "./SearchOrdersFulfillmentFilter"; +export * from "./SearchOrdersQuery"; +export * from "./SearchOrdersResponse"; +export * from "./SearchOrdersSort"; +export * from "./SearchOrdersSortField"; +export * from "./SearchOrdersSourceFilter"; +export * from "./SearchOrdersStateFilter"; +export * from "./SearchShiftsResponse"; +export * from "./SearchSubscriptionsFilter"; +export * from "./SearchSubscriptionsQuery"; +export * from "./SearchSubscriptionsResponse"; +export * from "./SearchTeamMembersFilter"; +export * from "./SearchTeamMembersQuery"; +export * from "./SearchTeamMembersResponse"; +export * from "./SearchTerminalActionsResponse"; +export * from "./SearchTerminalCheckoutsResponse"; +export * from "./SearchTerminalRefundsResponse"; +export * from "./SearchVendorsRequestFilter"; +export * from "./SearchVendorsRequestSort"; +export * from "./SearchVendorsRequestSortField"; +export * from "./SearchVendorsResponse"; +export * from "./SegmentFilter"; +export * from "./SelectOption"; +export * from "./SelectOptions"; +export * from "./Shift"; +export * from "./ShiftFilter"; +export * from "./ShiftFilterStatus"; +export * from "./ShiftQuery"; +export * from "./ShiftSort"; +export * from "./ShiftSortField"; +export * from "./ShiftStatus"; +export * from "./ShiftWage"; +export * from "./ShiftWorkday"; +export * from "./ShiftWorkdayMatcher"; +export * from "./ShippingFee"; +export * from "./SignatureImage"; +export * from "./SignatureOptions"; +export * from "./Site"; +export * from "./Snippet"; +export * from "./SortOrder"; +export * from "./SourceApplication"; +export * from "./SquareAccountDetails"; +export * from "./StandardUnitDescription"; +export * from "./StandardUnitDescriptionGroup"; +export * from "./SubmitEvidenceResponse"; +export * from "./Subscription"; +export * from "./SubscriptionAction"; +export * from "./SubscriptionActionType"; +export * from "./SubscriptionCadence"; +export * from "./SubscriptionEvent"; +export * from "./SubscriptionEventInfo"; +export * from "./SubscriptionEventInfoCode"; +export * from "./SubscriptionEventSubscriptionEventType"; +export * from "./SubscriptionPhase"; +export * from "./SubscriptionPricing"; +export * from "./SubscriptionPricingType"; +export * from "./SubscriptionSource"; +export * from "./SubscriptionStatus"; +export * from "./SubscriptionTestResult"; +export * from "./SwapPlanResponse"; +export * from "./TaxCalculationPhase"; +export * from "./TaxIds"; +export * from "./TaxInclusionType"; +export * from "./TeamMember"; +export * from "./TeamMemberAssignedLocations"; +export * from "./TeamMemberAssignedLocationsAssignmentType"; +export * from "./TeamMemberBookingProfile"; +export * from "./TeamMemberStatus"; +export * from "./TeamMemberWage"; +export * from "./Tender"; +export * from "./TenderBankAccountDetails"; +export * from "./TenderBankAccountDetailsStatus"; +export * from "./TenderBuyNowPayLaterDetails"; +export * from "./TenderBuyNowPayLaterDetailsBrand"; +export * from "./TenderBuyNowPayLaterDetailsStatus"; +export * from "./TenderCardDetails"; +export * from "./TenderCardDetailsEntryMethod"; +export * from "./TenderCardDetailsStatus"; +export * from "./TenderCashDetails"; +export * from "./TenderSquareAccountDetails"; +export * from "./TenderSquareAccountDetailsStatus"; +export * from "./TenderType"; +export * from "./TerminalAction"; +export * from "./TerminalActionActionType"; +export * from "./TerminalActionQuery"; +export * from "./TerminalActionQueryFilter"; +export * from "./TerminalActionQuerySort"; +export * from "./TerminalCheckout"; +export * from "./TerminalCheckoutQuery"; +export * from "./TerminalCheckoutQueryFilter"; +export * from "./TerminalCheckoutQuerySort"; +export * from "./TerminalRefund"; +export * from "./TerminalRefundQuery"; +export * from "./TerminalRefundQueryFilter"; +export * from "./TerminalRefundQuerySort"; +export * from "./TestWebhookSubscriptionResponse"; +export * from "./TimeRange"; +export * from "./TipSettings"; +export * from "./Transaction"; +export * from "./TransactionProduct"; +export * from "./UnlinkCustomerFromGiftCardResponse"; +export * from "./UpdateBookingCustomAttributeDefinitionResponse"; +export * from "./UpdateBookingResponse"; +export * from "./UpdateBreakTypeResponse"; +export * from "./UpdateCatalogImageRequest"; +export * from "./UpdateCatalogImageResponse"; +export * from "./UpdateCustomerCustomAttributeDefinitionResponse"; +export * from "./UpdateCustomerGroupResponse"; +export * from "./UpdateCustomerResponse"; +export * from "./UpdateInvoiceResponse"; +export * from "./UpdateItemModifierListsResponse"; +export * from "./UpdateItemTaxesResponse"; +export * from "./UpdateJobResponse"; +export * from "./UpdateLocationCustomAttributeDefinitionResponse"; +export * from "./UpdateLocationResponse"; +export * from "./UpdateLocationSettingsResponse"; +export * from "./UpdateMerchantCustomAttributeDefinitionResponse"; +export * from "./UpdateMerchantSettingsResponse"; +export * from "./UpdateOrderCustomAttributeDefinitionResponse"; +export * from "./UpdateOrderResponse"; +export * from "./UpdatePaymentLinkResponse"; +export * from "./UpdatePaymentResponse"; +export * from "./UpdateShiftResponse"; +export * from "./UpdateSubscriptionResponse"; +export * from "./UpdateTeamMemberRequest"; +export * from "./UpdateTeamMemberResponse"; +export * from "./UpdateVendorRequest"; +export * from "./UpdateVendorResponse"; +export * from "./UpdateWageSettingResponse"; +export * from "./UpdateWebhookSubscriptionResponse"; +export * from "./UpdateWebhookSubscriptionSignatureKeyResponse"; +export * from "./UpdateWorkweekConfigResponse"; +export * from "./UpsertBookingCustomAttributeResponse"; +export * from "./UpsertCatalogObjectResponse"; +export * from "./UpsertCustomerCustomAttributeResponse"; +export * from "./UpsertLocationCustomAttributeResponse"; +export * from "./UpsertMerchantCustomAttributeResponse"; +export * from "./UpsertOrderCustomAttributeResponse"; +export * from "./UpsertSnippetResponse"; +export * from "./V1Money"; +export * from "./V1Order"; +export * from "./V1OrderHistoryEntry"; +export * from "./V1OrderHistoryEntryAction"; +export * from "./V1OrderState"; +export * from "./V1Tender"; +export * from "./V1TenderCardBrand"; +export * from "./V1TenderEntryMethod"; +export * from "./V1TenderType"; +export * from "./V1UpdateOrderRequestAction"; +export * from "./Vendor"; +export * from "./VendorContact"; +export * from "./VendorStatus"; +export * from "./VisibilityFilter"; +export * from "./VoidTransactionResponse"; +export * from "./WageSetting"; +export * from "./WebhookSubscription"; +export * from "./Weekday"; +export * from "./WorkweekConfig"; +export * from "./CatalogObjectItem"; +export * from "./CatalogObjectItemVariation"; +export * from "./CatalogObjectTax"; +export * from "./CatalogObjectDiscount"; +export * from "./CatalogObjectModifierList"; +export * from "./CatalogObjectModifier"; +export * from "./CatalogObjectDiningOption"; +export * from "./CatalogObjectTaxExemption"; +export * from "./CatalogObjectServiceCharge"; +export * from "./CatalogObjectTimePeriod"; +export * from "./CatalogObjectProductSet"; +export * from "./CatalogObjectPricingRule"; +export * from "./CatalogObjectImage"; +export * from "./CatalogObjectMeasurementUnit"; +export * from "./CatalogObjectSubscriptionPlan"; +export * from "./CatalogObjectItemOption"; +export * from "./CatalogObjectItemOptionValue"; +export * from "./CatalogObjectCustomAttributeDefinition"; +export * from "./CatalogObjectQuickAmountsSettings"; +export * from "./CatalogObjectComponent"; +export * from "./CatalogObjectComposition"; +export * from "./CatalogObjectResource"; +export * from "./CatalogObjectCheckoutLink"; +export * from "./CatalogObjectAddress"; +export * from "./CatalogObjectSubscriptionProduct"; diff --git a/src/utilities/webhooksHelper.ts b/src/utilities/webhooksHelper.ts deleted file mode 100644 index f9a26ea32..000000000 --- a/src/utilities/webhooksHelper.ts +++ /dev/null @@ -1,45 +0,0 @@ -import crypto from 'crypto'; - -/** - * Utility to help with {@link https://developer.squareup.com/docs/webhooks/overview Square Webhooks } - */ -export class WebhooksHelper { - /** - * Verifies and validates an event notification. - * See the {@link https://developer.squareup.com/docs/webhooks/step3validate documentation} for more details. - * - * @param requestBody The JSON body of the request. - * @param signatureHeader The value for the `x-square-hmacsha256-signature` header. - * @param signatureKey The signature key from the {@link https://developer.squareup.com/apps Square Developer portal} for the webhook subscription. - * @param notificationUrl The notification endpoint URL as defined in the {@link https://developer.squareup.com/apps Square Developer portal} for the webhook subscription. - * @returns `true` if the signature is valid, indicating that the event can be trusted as it came from Square. `false` if the signature validation fails, indicating that the event did not come from Square, so it may be malicious and should be discarded. - */ - static isValidWebhookEventSignature( - requestBody: string, - signatureHeader: string, - signatureKey: string, - notificationUrl: string - ): boolean { - if (requestBody == null) { - return false; - } - if (signatureKey == null || signatureKey.length == 0) { - throw new Error('signatureKey is null or empty'); - } - if (notificationUrl == null || notificationUrl.length == 0) { - throw new Error('notificationUrl is null or empty'); - } - - // Perform UTF-8 encoding to bytes - let payloadBytes = Buffer.from(notificationUrl + requestBody, 'utf-8'); - let signatureKeyBytes = Buffer.from(signatureKey, 'utf-8'); - - // Compute the hash value - const hmac = crypto.createHmac('sha256', signatureKeyBytes); - hmac.update(payloadBytes); - - // Compare the computed hash vs the value in the signature header - const hashBase64 = hmac.digest('base64'); - return hashBase64 === signatureHeader; - } -} \ No newline at end of file diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 000000000..5ea7496a5 --- /dev/null +++ b/src/version.ts @@ -0,0 +1 @@ +export const SDK_VERSION = "40.0.0"; diff --git a/test/controllers/cashDrawersApi.test.ts b/test/controllers/cashDrawersApi.test.ts deleted file mode 100644 index 3808b63ab..000000000 --- a/test/controllers/cashDrawersApi.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { CashDrawersApi, LocationsApi } from "../../src" -import { testClient } from "../testClient" - -describe('CashDrawers API', () => { - let cashDrawersApi : CashDrawersApi - let locationsApi : LocationsApi - - let locationId : string - - beforeAll(async () => { - cashDrawersApi = testClient.cashDrawersApi - locationsApi = testClient.locationsApi - - let { result: { locations } } = await locationsApi.listLocations() - - locationId = (locations!)[0].id! - }) - - it('should testListCashDrawerShiftEvents', async () => { - const nowMs = Date.now() - const start = (new Date(nowMs - (1000 * 60 * 60))).toISOString() - const end = (new Date()).toISOString() - let { statusCode } = await cashDrawersApi.listCashDrawerShifts(locationId, undefined, start, end) - expect(statusCode).toBe(200) - }) -}) diff --git a/test/controllers/catalogApi.test.ts b/test/controllers/catalogApi.test.ts deleted file mode 100644 index b4296ab26..000000000 --- a/test/controllers/catalogApi.test.ts +++ /dev/null @@ -1,293 +0,0 @@ - -import { CatalogApi, CatalogItemVariation, CatalogObject, CatalogItem, UpsertCatalogObjectRequest, ApiResponse, RetrieveCatalogObjectResponse, SearchCatalogItemsResponse, SearchCatalogObjectsRequest, SearchCatalogObjectsResponse, DeleteCatalogObjectResponse, UpdateItemTaxesRequest, BatchUpsertCatalogObjectsRequest, BatchUpsertCatalogObjectsResponse, CatalogObjectBatch, BatchRetrieveCatalogObjectsRequest, BatchRetrieveCatalogObjectsResponse, CatalogIdMapping, BatchDeleteCatalogObjectsRequest, BatchDeleteCatalogObjectsResponse, UpdateItemModifierListsRequest, UpdateItemTaxesResponse, UpdateItemModifierListsResponse, SearchCatalogItemsRequest, CreateCatalogImageRequest, CreateCatalogImageResponse, FileWrapper, CatalogImage } from '../../src' -import { testClient } from '../testClient' -import { v4 as uuidv4 } from 'uuid' -import { createReadStream } from 'fs' - - -describe('Catalog API', () => { - let catalogApi : CatalogApi; - - let catalogObjectId : string - let catalogModifierListId : string - let catalogModifierId : string - let catalogTaxId : string - - beforeAll(() => { - catalogApi = testClient.catalogApi - }) - - it('should test UpsertCatalogObject', async () => { - let colombianCoffeeData: CatalogItemVariation = { - name: 'Colombian Fair Trade', - trackInventory: true, - pricingType: 'FIXED_PRICING', - priceMoney: { - amount: BigInt(100), - currency: 'USD' - } - } - - let colombianCoffee: CatalogObject = { - id: '#colombian-coffee', - type: 'ITEM_VARIATION', - presentAtAllLocations: true, - itemVariationData: colombianCoffeeData - - } - - let coffeeData: CatalogItem = { - name: 'Coffee', - description: 'Strong coffee', - abbreviation: 'C', - availableOnline: true, - availableForPickup: true, - availableElectronically: false, - variations: [colombianCoffee] - } - - let coffee: CatalogObject = { - id: '#single-item', - type: 'ITEM', - presentAtAllLocations: true, - itemData: coffeeData, - } - - let body: UpsertCatalogObjectRequest = { - object: coffee, - idempotencyKey: uuidv4(), - } - - // Expected contents of response - let { result, statusCode } = await catalogApi.upsertCatalogObject(body) - expect(statusCode).toBe(200) - // expect(result.catalogObject).toEqual(expect.objectContaining({ - // ...expectedObject, - // itemData: expect.objectContaining({ - // ...coffeeData, - // variations: expect.arrayContaining([ - // expect.objectContaining({ - // ...expectedVariation, - // itemVariationData: expect.objectContaining(colombianCoffeeData) - // }) - // ]) - // }) - // })) - - catalogObjectId = result.catalogObject?.id!; - }); - - it('should testCatalogInfo', async () => { - let { statusCode }: ApiResponse = await catalogApi.catalogInfo() - expect(statusCode).toBe(200) - // expect(result).toHaveProperty("limits") - }) - - it('should testListCatalog', async () => { - let { statusCode }: ApiResponse = await catalogApi.listCatalog() - expect(statusCode).toBe(200) - }) - - it('should testRetrieveCatalogObject', async () => { - let {statusCode} : ApiResponse = await catalogApi.retrieveCatalogObject(catalogObjectId) - expect(statusCode).toBe(200) - }) - - it('should testSearchCatalogObjects', async () => { - let body: SearchCatalogObjectsRequest = { - limit: 1 - } - - let { statusCode }: ApiResponse = await catalogApi.searchCatalogObjects(body) - expect(statusCode).toBe(200) - }) - - it('should testSearchCatalogItems', async () => { - let body: SearchCatalogItemsRequest = { - limit: 1 - } - - let { statusCode }: ApiResponse = await catalogApi.searchCatalogItems(body) - expect(statusCode).toBe(200) - }) - - it('should testBatchUpsertCatalogObjects', async () => { - - let modifier : CatalogObject = { - id: "#temp-modifier-id", - type : "MODIFIER", - modifierData: { - name: "Limited Time Only Price", - priceMoney: { - amount: BigInt(200), - currency: "USD" - } - } - } - - let modifierList: CatalogObject = { - id: "#temp-modifier-list-id", - type: "MODIFIER_LIST", - modifierListData: { - name: 'Special weekend deals', - modifiers: [ modifier ] - } - } - - let tax : CatalogObject = { - id: "#temp-tax-id", - type: "TAX", - taxData: { - name: "Online only Tax", - calculationPhase: 'TAX_SUBTOTAL_PHASE', - inclusionType: 'ADDITIVE', - percentage: '5.0', - appliesToCustomAmounts: true, - enabled: true, - } - } - - let batch: CatalogObjectBatch = { - objects:[tax, modifierList] - } - let body: BatchUpsertCatalogObjectsRequest = { - idempotencyKey: uuidv4(), - batches: [batch] - } - - try { - - let { id: taxTempId, ...expectedTax } = tax - let { id: modTempId, ...expectedModifier } = modifier - let { id: listTempId, ...expectedModifierList } = modifierList - - let { result, statusCode }: ApiResponse = await catalogApi.batchUpsertCatalogObjects(body) - expect(statusCode).toBe(200) - expect(result).toEqual( - expect.objectContaining({ - idMappings: expect.arrayContaining([taxTempId, modTempId, listTempId].map(id => expect.objectContaining({ clientObjectId: id}))), - objects: expect.arrayContaining([ - expect.objectContaining(expectedTax), - expect.objectContaining({ - ...expectedModifierList, - modifierListData: expect.objectContaining({ - ...expectedModifierList.modifierListData, - modifiers: expect.arrayContaining([ - expect.objectContaining({ - ...expectedModifier, - modifierData: expect.objectContaining(expectedModifier.modifierData) - }) - ]) - }) - }), - ]) - }) - ) - - // Capture Ids of created Catalog Objects - ;(result.idMappings!).forEach(({ clientObjectId, objectId }: CatalogIdMapping) => { - if (clientObjectId! === taxTempId) catalogTaxId = objectId! - if (clientObjectId! === modifier.id) catalogModifierId = objectId! - if (clientObjectId! === listTempId) catalogModifierListId = objectId! - }) - - } catch (error) { - console.log(error) - } - }) - - it('should test BatchRetrieveCatalogObjects', async () => { - - let ids: string[] = [catalogModifierId, catalogModifierListId, catalogTaxId] - let body: BatchRetrieveCatalogObjectsRequest = { - objectIds: ids - } - try { - - let {result, statusCode}: ApiResponse = await catalogApi.batchRetrieveCatalogObjects(body) - expect(statusCode).toBe(200) - expect(result).toEqual(expect.objectContaining({ - objects: expect.arrayContaining(ids.map(id => expect.objectContaining({id}))) - })) - } catch (error) { - console.log(error) - } - - }) - - - it('should testUpdateItemTaxes', async () => { - let body: UpdateItemTaxesRequest = { - itemIds: [ catalogObjectId ], - taxesToEnable: [catalogTaxId] - } - - let { statusCode }: ApiResponse = await catalogApi.updateItemTaxes(body) - expect(statusCode).toBe(200) - }) - - it('should testUpdateItemModifierLists', async () => { - let body: UpdateItemModifierListsRequest = { - itemIds: [catalogObjectId], - modifierListsToEnable: [catalogModifierListId] - } - - let { statusCode }: ApiResponse = await catalogApi.updateItemModifierLists(body) - expect(statusCode).toBe(200) - }) - - it('should test BatchDeleteCatalogObjects', async () => { - - let ids: string[] = [catalogModifierId, catalogModifierListId, catalogTaxId] - let body: BatchDeleteCatalogObjectsRequest = { - objectIds: ids - } - try { - - let { result, statusCode }: ApiResponse = await catalogApi.batchDeleteCatalogObjects(body) - expect(statusCode).toBe(200) - expect(result).toEqual(expect.objectContaining({ - deletedObjectIds: expect.arrayContaining(ids) - })) - } catch (error) { - console.log(error) - } - - }) - it('should testDeleteCatalogObject', async () => { - - let { statusCode }: ApiResponse = await catalogApi.deleteCatalogObject(catalogObjectId) - expect(statusCode).toBe(200) - }) - - it('should testCreateCatalogImage', async () => { - - let imageData : CatalogImage = { - name: 'Square logo', - caption: 'Square within a square' - } - - let image: CatalogObject = { - id: '#temp-logo-id', - type: 'IMAGE', - imageData: imageData - } - - let request: CreateCatalogImageRequest = { - image, - idempotencyKey: uuidv4(), - - } - let readStream = createReadStream('./test/resources/square.png') - let imageFile = new FileWrapper(readStream) - - let {result, statusCode} : ApiResponse = await catalogApi.createCatalogImage(request, imageFile) - expect(statusCode).toBe(200) - expect(result).toEqual(expect.objectContaining({ - image: expect.objectContaining({ - type: 'IMAGE', - imageData: expect.objectContaining(imageData) - }) - })) - }) -}) diff --git a/test/controllers/customerGroups.test.ts b/test/controllers/customerGroups.test.ts deleted file mode 100644 index 5d91d7812..000000000 --- a/test/controllers/customerGroups.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { CustomerGroupsApi, CreateCustomerGroupRequest, UpdateCustomerGroupRequest } from '../../src'; -import { testClient } from '../testClient'; -import { v4 as uuidV4 } from 'uuid' - -describe('CustomerGroups API', () => { - let customersGroupsController: CustomerGroupsApi; - let newcustomerGroupId: string; - - beforeAll(async () => { - customersGroupsController = testClient.customerGroupsApi; - }); - - it('should testListCustomer response', async () => { - const { statusCode } = await customersGroupsController.listCustomerGroups(); - - expect(statusCode).toBe(200); - }); - - it('should testCreateCustomerGroup response', async () => { - // Some tests depend on a Customer Group resource - let body: CreateCustomerGroupRequest = { - idempotencyKey: uuidV4(), - group: { - name: `Default-${uuidV4()}` - } - }; - - let { result, statusCode } = await customersGroupsController.createCustomerGroup(body); - - expect(statusCode).toBe(200); - expect(result.group).toEqual(expect.objectContaining(body.group)) - - newcustomerGroupId = result.group?.id!; - }); - - it('should testRetrieveCustomerGroup response', async () => { - - let {statusCode} = await customersGroupsController.retrieveCustomerGroup(newcustomerGroupId) - expect(statusCode).toBe(200); - }) - - it('should testUpdateCustomerGroup response', async () => { - - let body :UpdateCustomerGroupRequest ={ - group: { - name: `Updated-${uuidV4()}` - } - } - - let { result, statusCode } = await customersGroupsController.updateCustomerGroup(newcustomerGroupId, body) - expect(statusCode).toBe(200); - expect(result.group).toEqual(expect.objectContaining(body.group)) - }) - - it('should testDeleteCustomerGroup response', async () => { - - let { statusCode } = await customersGroupsController.deleteCustomerGroup(newcustomerGroupId) - expect(statusCode).toBe(200); - }) - - -}); diff --git a/test/controllers/customerSegments.test.ts b/test/controllers/customerSegments.test.ts deleted file mode 100644 index 62cca9a1b..000000000 --- a/test/controllers/customerSegments.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { CustomerSegmentsApi } from '../../src'; -import { testClient } from '../testClient'; - -describe('CustomerSegments API', () => { - let customerSegmentsApi: CustomerSegmentsApi; - let customerSegmentId: string | null = null; - - beforeAll(async () => { - customerSegmentsApi = testClient.customerSegmentsApi; - }); - - it('should testListCustomerSegments response', async () => { - const { result, statusCode } = await customerSegmentsApi.listCustomerSegments(); - - expect(statusCode).toBe(200); - - if (result.segments?.length) customerSegmentId = result.segments[0].id! - }); - - it('should testRetreiveCustomerSegment response', async () => { - - if (customerSegmentId) { - let { statusCode } = await customerSegmentsApi.retrieveCustomerSegment(customerSegmentId) - expect(statusCode).toBe(200); - } - - }); -}); diff --git a/test/controllers/customersApi.test.ts b/test/controllers/customersApi.test.ts deleted file mode 100644 index 43a9e7d3f..000000000 --- a/test/controllers/customersApi.test.ts +++ /dev/null @@ -1,267 +0,0 @@ -import { - Address, - CreateCustomerCardRequest, - CreateCustomerCustomAttributeDefinitionRequest, - CreateCustomerGroupRequest, - CreateCustomerRequest, - CustomerCustomAttributesApi, - CustomerGroupsApi, - CustomersApi, - UpdateCustomerCustomAttributeDefinitionRequest, - UpdateCustomerRequest, - UpsertCustomerCustomAttributeRequest -} from '../../src'; -import { testClient } from '../testClient'; -import { v4 as uuidV4 } from 'uuid' - -describe('Customer API', () => { - let customersController: CustomersApi; - let customersGroupsController: CustomerGroupsApi; - let customersCustomAttributesController: CustomerCustomAttributesApi; - let originalRequest: CreateCustomerRequest; - - let newCustomerId : string; - let newCustomerCardId : string; - let newcustomerGroupId: string; - let customAttributeDefinitionKey: string = `favorite-drink_${uuidV4()}`; - let customAttributeDefinitionName: string = `Favorite Drink_${uuidV4()}`; // name must be unique - let customAttributeDefinitionUpdatedName: string = `Preferred Drink_${uuidV4()}`; // name must be unique - - beforeAll(async () => { - customersController = testClient.customersApi; - customersGroupsController = testClient.customerGroupsApi; - customersCustomAttributesController = testClient.customerCustomAttributesApi; - - // Some tests depend on a Customer Group resource - let body: CreateCustomerGroupRequest = { - idempotencyKey: uuidV4(), - group: { - name: `Default-${uuidV4}` - } - }; - - let { result } = await customersGroupsController.createCustomerGroup(body); - newcustomerGroupId = result.group?.id!; - - // Some tests depend on a Custom Attribute Definition resource - // Delete it if it exists, then create it. - console.log('Deleting any existing custom attribute test data'); - let deleteCadResult = await customersCustomAttributesController.deleteCustomerCustomAttributeDefinition(customAttributeDefinitionKey); - console.log('Creating custom attribute test data'); - expect(deleteCadResult.statusCode).toBe(200); - let cadBody: CreateCustomerCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - key: customAttributeDefinitionKey, - name: customAttributeDefinitionName, - description: 'A customer\'s favorite drink', - visibility: 'VISIBILITY_READ_WRITE_VALUES', - schema: { - '$ref': 'https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String' - } - } - }; - let cadResult = await customersCustomAttributesController.createCustomerCustomAttributeDefinition(cadBody); - expect(cadResult.statusCode).toBe(200); - }); - - afterAll(async () => { - // Clean up created customer Group resource - let deleteCgResult = await customersGroupsController.deleteCustomerGroup(newcustomerGroupId); - expect(deleteCgResult.statusCode).toBe(200); - console.log('Cleaning up custom attribute test data'); - let deleteCadResult = await customersCustomAttributesController.deleteCustomerCustomAttributeDefinition(customAttributeDefinitionKey); - expect(deleteCadResult.statusCode).toBe(200); - }) - - it('should list customers', async () => { - const { statusCode } = await customersController.listCustomers(); - - expect(statusCode).toBe(200); - }); - - it('should create a customer', async () => { - const phoneNumber = '1-212-555-4240'; - const postalCode = '10003'; - - const address: Address = { - addressLine1: '500 Electric Ave', - addressLine2: 'Suite 600', - locality: 'New York', - administrativeDistrictLevel1: 'NY', - postalCode: postalCode, - country: 'US', - }; - - const requst: CreateCustomerRequest = { - givenName: 'Amelia', - familyName: 'Earhart', - phoneNumber: phoneNumber, - note: 'a customer', - address: address, - }; - - const { result, statusCode } = await customersController.createCustomer(requst); - - expect(statusCode).toBe(200); - - newCustomerId = result.customer?.id! - originalRequest = requst - }); - - it('should retrieve a customer', async () => { - const { result, statusCode } = await customersController.retrieveCustomer(newCustomerId); - - expect(statusCode).toBe(200); - expect(result.customer).toEqual(expect.objectContaining(originalRequest)) - }); - - it('should update a customer', async () => { - - let updateCustomerRequest: UpdateCustomerRequest = { - ...originalRequest, - phoneNumber: '1-917-500-1000', - note: 'An Updated Customer' - } - - const { result, statusCode } = await customersController.updateCustomer(newCustomerId, updateCustomerRequest); - - expect(statusCode).toBe(200); - expect(result.customer?.id!).toBe(newCustomerId); - expect(result.customer).toEqual(expect.objectContaining(updateCustomerRequest)) - }); - - it('should create a customer card', async () => { - - let createCustomerCardRequest : CreateCustomerCardRequest = { - cardNonce: 'cnon:card-nonce-ok' // Sandboc card nonce - } - - const { result, statusCode } = await customersController.createCustomerCard(newCustomerId,createCustomerCardRequest ); - - expect(statusCode).toBe(200); - - newCustomerCardId = result.card?.id! - }); - - it('should delete a customer card', async () => { - - const { statusCode } = await customersController.deleteCustomerCard(newCustomerId,newCustomerCardId); - - expect(statusCode).toBe(200); - }); - - it('should add a group to a customer', async () => { - - const { statusCode } = await customersController.addGroupToCustomer(newCustomerId, newcustomerGroupId); - - expect(statusCode).toBe(200); - }); - - it('should remove a group from a customer', async () => { - - const { statusCode } = await customersController.removeGroupFromCustomer(newCustomerId, newcustomerGroupId); - - expect(statusCode).toBe(200); - }); - - it('should retrieve a customer custom attribute definition', async () => { - let response = await customersCustomAttributesController.retrieveCustomerCustomAttributeDefinition(customAttributeDefinitionKey); - expect(response.result.errors).toBeUndefined(); - expect(response.statusCode).toBe(200); - expect(response.result.customAttributeDefinition?.key).toBe(customAttributeDefinitionKey); - expect(response.result.customAttributeDefinition?.description).toBe('A customer\'s favorite drink'); - expect(response.result.customAttributeDefinition?.name).toBe(customAttributeDefinitionName); - expect(response.result.customAttributeDefinition?.schema).toEqual({ - '$ref': 'https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String' - }); - expect(response.result.customAttributeDefinition?.version).toBe(1); - expect(response.result.customAttributeDefinition?.visibility).toBe('VISIBILITY_READ_WRITE_VALUES'); - }); - - it('should update a customer custom attribute definition', async () => { - let body: UpdateCustomerCustomAttributeDefinitionRequest = { - customAttributeDefinition: { - version: 1, - name: customAttributeDefinitionUpdatedName - } - }; - let response = await customersCustomAttributesController.updateCustomerCustomAttributeDefinition(customAttributeDefinitionKey, body); - expect(response.result.errors).toBeUndefined(); - expect(response.statusCode).toBe(200); - expect(response.result.customAttributeDefinition?.key).toBe(customAttributeDefinitionKey); - expect(response.result.customAttributeDefinition?.description).toBe('A customer\'s favorite drink'); - expect(response.result.customAttributeDefinition?.name).toBe(customAttributeDefinitionUpdatedName); - expect(response.result.customAttributeDefinition?.schema).toEqual({ - '$ref': 'https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String' - }); - expect(response.result.customAttributeDefinition?.version).toBe(2); - expect(response.result.customAttributeDefinition?.visibility).toBe('VISIBILITY_READ_WRITE_VALUES'); - }); - - it('should list customer custom attribute definitions', async () => { - let response = await customersCustomAttributesController.listCustomerCustomAttributeDefinitions(); - expect(response.result.errors).toBeUndefined(); - expect(response.statusCode).toBe(200); - }); - - it('should add a custom attribute to a customer', async () => { - let body: UpsertCustomerCustomAttributeRequest = { - customAttribute: { - value: 'Double-shot breve' - } - }; - let response = await customersCustomAttributesController.upsertCustomerCustomAttribute(newCustomerId, customAttributeDefinitionKey, body); - expect(response.result.errors).toBeUndefined(); - expect(response.statusCode).toBe(200); - expect(response.result.customAttribute?.key).toBe(customAttributeDefinitionKey); - expect(response.result.customAttribute?.value).toBe('Double-shot breve'); - expect(response.result.customAttribute?.version).toBe(1); - expect(response.result.customAttribute?.visibility).toBe('VISIBILITY_READ_WRITE_VALUES'); - }); - - it('should update a custom attribute for a customer', async () => { - let body: UpsertCustomerCustomAttributeRequest = { - customAttribute: { - value: 'Black coffee', - version: 1 - } - }; - let response = await customersCustomAttributesController.upsertCustomerCustomAttribute(newCustomerId, customAttributeDefinitionKey, body); - expect(response.result.errors).toBeUndefined(); - expect(response.statusCode).toBe(200); - expect(response.result.customAttribute?.key).toBe(customAttributeDefinitionKey); - expect(response.result.customAttribute?.value).toBe('Black coffee'); - expect(response.result.customAttribute?.version).toBe(2); - expect(response.result.customAttribute?.visibility).toBe('VISIBILITY_READ_WRITE_VALUES'); - }) - - it('should list custom attributes for a customer', async () => { - let response = await customersCustomAttributesController.listCustomerCustomAttributes(newCustomerId, undefined, undefined, true); - expect(response.result.errors).toBeUndefined(); - expect(response.statusCode).toBe(200); - expect(response.result.customAttributes?.length).toBe(1); - expect(response.result.customAttributes!![0].key).toBe(customAttributeDefinitionKey); - expect(response.result.customAttributes!![0].value).toBe('Black coffee'); - expect(response.result.customAttributes!![0].version).toBe(2); - expect(response.result.customAttributes!![0].visibility).toBe('VISIBILITY_READ_WRITE_VALUES'); - expect(response.result.customAttributes!![0].definition?.key).toBe(customAttributeDefinitionKey); - }) - - it('should delete a custom attribute for a customer', async () => { - let response = await customersCustomAttributesController.deleteCustomerCustomAttribute(newCustomerId, customAttributeDefinitionKey); - expect(response.result.errors).toBeUndefined(); - expect(response.statusCode).toBe(200); - }) - - it('should delete a customer', async () => { - const { statusCode } = await customersController.deleteCustomer(newCustomerId); - - expect(statusCode).toBe(200); - }); - - it('should delete a custom attribute definition', async () => { - let response = await customersCustomAttributesController.deleteCustomerCustomAttributeDefinition(customAttributeDefinitionKey); - expect(response.result.errors).toBeUndefined(); - expect(response.statusCode).toBe(200); - }) -}); diff --git a/test/controllers/devicesApi.test.ts b/test/controllers/devicesApi.test.ts deleted file mode 100644 index 71214a90e..000000000 --- a/test/controllers/devicesApi.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { DevicesApi, CreateDeviceCodeRequest } from "../../src" -import { testClient } from "../testClient" -import { v4 as uuidv4 } from "uuid" - -describe('Devices API', () => { - let devicesApi : DevicesApi - - let deviceCodeId : string - - beforeAll(() => { - devicesApi = testClient.devicesApi - }) - - it('should testListDevicesCodes', async () => { - let { statusCode } = await devicesApi.listDeviceCodes() - expect(statusCode).toBe(200) - }) - - it('should testCreateDeviceCode', async () => { - let body : CreateDeviceCodeRequest = { - idempotencyKey: uuidv4(), - deviceCode: { - productType: 'TERMINAL_API' - } - } - let { result, statusCode } = await devicesApi.createDeviceCode(body) - expect(statusCode).toBe(200) - expect(result).toEqual(expect.objectContaining({ - deviceCode : expect.objectContaining({ - productType: 'TERMINAL_API' - }) - })) - - deviceCodeId = result.deviceCode?.id! - }) - - it('should testListDevicesCodes', async () => { - let { result : { deviceCode },statusCode } = await devicesApi.getDeviceCode(deviceCodeId) - expect(statusCode).toBe(200) - expect(deviceCode?.id!).toBe(deviceCodeId) - }) -}) diff --git a/test/controllers/disputesApi.test.ts b/test/controllers/disputesApi.test.ts deleted file mode 100644 index 06e6b1ba6..000000000 --- a/test/controllers/disputesApi.test.ts +++ /dev/null @@ -1,139 +0,0 @@ -import {DisputesApi, ApiResponse, ListDisputesResponse, CreateDisputeEvidenceTextRequest, CreatePaymentRequest, PaymentsApi, CreateDisputeEvidenceFileRequest, FileWrapper} from '../../src' -import { testClient } from '../testClient'; -import { v4 as uuidv4 } from 'uuid' -import fs from 'fs'; - -jest.setTimeout(1000 * 10); // Extends timeout by the milliseconds we wait in the before all hook -describe('Disputes API', () => { - let disputeApi : DisputesApi; - let paymentsApi : PaymentsApi - let disputeId : string - let textEvidenceId : string - - beforeAll( async () => { - disputeApi = testClient.disputesApi - paymentsApi = testClient.paymentsApi - - let duplicatePayment: CreatePaymentRequest = { - idempotencyKey: uuidv4(), - autocomplete: true, - sourceId: 'cnon:card-nonce-ok', - amountMoney: { - amount: BigInt(8803), // In sandbox amount of 88.03 USD automatically generates a dispute with the reason DUPLICATE. - currency: 'USD' - } - } - - await paymentsApi.createPayment(duplicatePayment) - - await new Promise((res) => { - setTimeout(() =>{res(true)},5000) - }) - }) - - it('should testListDisputes', async () => { - let { result, statusCode }: ApiResponse = await disputeApi.listDisputes(undefined,'EVIDENCE_REQUIRED') - expect(statusCode).toBe(200) - expect(result).toEqual(expect.objectContaining({ - disputes : expect.arrayContaining([ - expect.objectContaining({ - reason: 'DUPLICATE', - state: 'EVIDENCE_REQUIRED', - cardBrand: 'VISA' - }) - ]) - })) - - const firstDispute = result.disputes![0]; - disputeId = firstDispute.id! || firstDispute.disputeId!; - }) - - it('should testRetrieveDispute', async () => { - let {result, statusCode} = await disputeApi.retrieveDispute(disputeId) - const localDisputeId = result.dispute?.id! || result.dispute?.disputeId!; - expect(statusCode).toBe(200) - expect(localDisputeId).toBe(disputeId); - }) - - it('should testCreateDisputeEvidenceText', async () => { - - const evidenceType = 'GENERIC_EVIDENCE' - let body: CreateDisputeEvidenceTextRequest = { - evidenceType, - idempotencyKey: uuidv4(), - evidenceText: 'Thi is not a duplicate', - - } - let { result, statusCode } = await disputeApi.createDisputeEvidenceText(disputeId, body) - expect(statusCode).toBe(200) - - const evidence = result.evidence; - textEvidenceId = evidence?.evidenceId! || evidence?.id!; - }) - - it('should testRetrieveDisputeEvidence', async () => { - - try { - let { result, statusCode } = await disputeApi.retrieveDisputeEvidence(disputeId, textEvidenceId) - expect(statusCode).toBe(200) - expect(result).toEqual(expect.objectContaining({ - evidence: expect.objectContaining({ - id: textEvidenceId - }) - })) - } catch (error) { - console.log(error) - } - }) - - it('should testListDisputeEvidence', async () => { - let { statusCode } = await disputeApi.listDisputeEvidence(disputeId) - expect(statusCode).toBe(200) - }) - - it('should test DeleteDisputeEvidence', async () => { - - try { - let { statusCode } = await disputeApi.deleteDisputeEvidence(disputeId, textEvidenceId) - expect(statusCode).toBe(200) - - } catch (error) { - console.log(error) - } - }) - - it('should testCreateDisputeEvidenceFile', async () => { - - let body : CreateDisputeEvidenceFileRequest = { - idempotencyKey: uuidv4(), - evidenceType: 'GENERIC_EVIDENCE', - contentType: 'image/jpeg' - } - - let imageFile = new FileWrapper( - fs.createReadStream('./test/resources/square.png'), { - filename: 'Doggy' - }) - - let { result, statusCode } = await disputeApi.createDisputeEvidenceFile(disputeId, body, imageFile) - expect(statusCode).toBe(201) - expect(result.evidence?.disputeId!).toBe(disputeId); - }) - - it('should testSubmitEvidence', async () => { - - try { - let { statusCode } = await disputeApi.submitEvidence(disputeId) - expect(statusCode).toBe(200) - - } catch (error) { - console.log(error) - } - }) - - it('should testAcceptDispute', async () => { - let { statusCode } = await disputeApi.acceptDispute(disputeId) - expect(statusCode).toBe(200) - }) - -}) diff --git a/test/controllers/inventoryApi.test.ts b/test/controllers/inventoryApi.test.ts deleted file mode 100644 index b976f9fcf..000000000 --- a/test/controllers/inventoryApi.test.ts +++ /dev/null @@ -1,181 +0,0 @@ -import { CatalogApi, UpsertCatalogObjectRequest, CatalogObject, CatalogItem, InventoryApi, ApiResponse, RetrieveInventoryCountResponse, CatalogItemVariation, BatchChangeInventoryRequest, BatchChangeInventoryResponse, InventoryChange, LocationsApi, ListLocationsResponse, InventoryAdjustment, BatchRetrieveInventoryChangesRequest, BatchRetrieveInventoryChangesResponse, RetrieveInventoryAdjustmentResponse, BatchRetrieveInventoryCountsRequest, BatchRetrieveInventoryCountsResponse, RetrieveInventoryChangesResponse, InventoryPhysicalCount } from '../../src' -import { testClient } from '../testClient' -import { v4 as uuidv4} from 'uuid' - -describe('Inventory API', () => { - let inventoryApi : InventoryApi; - let catalogApi : CatalogApi; - let locationsApi : LocationsApi - - let locationId : string; - let itemVariationId : string; - let inventoryAdjustId : string; - - beforeAll(async () => { - inventoryApi = testClient.inventoryApi; - catalogApi = testClient.catalogApi; - locationsApi = testClient.locationsApi - - let list: ApiResponse = await locationsApi.listLocations() - - locationId = (list.result?.locations!)[0].id!; - - let colombianCoffeeData : CatalogItemVariation = { - name: 'Colombian Fair Trade', - trackInventory: true, - pricingType:'FIXED_PRICING', - priceMoney: { - amount: BigInt(100), - currency:'USD' - } - } - - let colombianCoffee: CatalogObject = { - id: '#colombian-coffee', - type: 'ITEM_VARIATION', - presentAtAllLocations: true, - itemVariationData: colombianCoffeeData - - } - - let coffeeData : CatalogItem = { - name: 'Coffee', - description: 'Strong coffee', - abbreviation: 'C', - availableOnline: true, - availableForPickup: true, - availableElectronically: false, - variations: [colombianCoffee] - } - - let coffee : CatalogObject = { - id: '#single-item', - type: 'ITEM', - presentAtAllLocations: true, - itemData: coffeeData, - } - - let body: UpsertCatalogObjectRequest = { - object: coffee, - idempotencyKey: uuidv4(), - } - let { result } = await catalogApi.upsertCatalogObject(body) - - itemVariationId = (result.catalogObject?.itemData?.variations!)[0].id! - }, 30000); // Set a hook timeout of 30 seconds. - - xit('should testBatchChangeInventory', async () => { - - const eightHours = 1000 * 60 * 60 * 8 - - let stockCoffee: InventoryAdjustment = { - quantity: '100', - catalogObjectId: itemVariationId, - locationId: locationId, - fromState: 'NONE', - toState: 'IN_STOCK', - occurredAt: new Date(Date.now() - eightHours).toISOString() - } - - let coffeeAdjustment : InventoryChange = { - type: 'ADJUSTMENT', - adjustment: stockCoffee - } - - let body : BatchChangeInventoryRequest = { - idempotencyKey: uuidv4(), - changes:[ - coffeeAdjustment, - ] - } - - let { toState, fromState, occurredAt, ...expectedResponse } = stockCoffee - - let { result, statusCode }: ApiResponse = await inventoryApi.batchChangeInventory(body) - expect(statusCode).toBe(200); - expect(result.counts).toEqual(expect.arrayContaining([ - expect.objectContaining(expectedResponse) - ])) - }) - - xit('should testBatchRetrieveInventoryChanges', async () => { - - let body: BatchRetrieveInventoryChangesRequest = { - types: ['ADJUSTMENT'], - catalogObjectIds: [itemVariationId], - locationIds: [locationId] - } - - let { result, statusCode }: ApiResponse = await inventoryApi.batchRetrieveInventoryChanges(body) - expect(statusCode).toBe(200); - - inventoryAdjustId = (result.changes!)[0].adjustment?.id!; - }) - - it('should testRetreiveInventoryChanges', async () => { - - let { statusCode }: ApiResponse = await inventoryApi.retrieveInventoryChanges(itemVariationId) - expect(statusCode).toBe(200); - }) - - xit('should testRetrieveInventoryAdjustment', async () => { - - let { statusCode }: ApiResponse = await inventoryApi.retrieveInventoryAdjustment(inventoryAdjustId) - expect(statusCode).toBe(200); - }) - - it('should testRetrieveInventoryCount', async () => { - - let { statusCode }: ApiResponse = await inventoryApi.retrieveInventoryCount(itemVariationId) - expect(statusCode).toBe(200); - }) - - xit('should testBatchRetrieveInventoryCounts', async () => { - - let body: BatchRetrieveInventoryCountsRequest = { - catalogObjectIds: [itemVariationId], - locationIds: [locationId], - } - let { statusCode }: ApiResponse = await inventoryApi.batchRetrieveInventoryCounts(body); - expect(statusCode).toBe(200); - }) - - xit('should testRetrieveInventoryPhysicalCount', async () => { - let sellCoffee: InventoryPhysicalCount = { - quantity: '1', - catalogObjectId: itemVariationId, - locationId: locationId, - state: 'IN_STOCK', - occurredAt: new Date().toISOString() - } - - let coffeeCount: InventoryChange = { - type: 'PHYSICAL_COUNT', - physicalCount: sellCoffee - } - - let body: BatchChangeInventoryRequest = { - idempotencyKey: uuidv4(), - changes: [ - coffeeCount, - ] - } - - let { statusCode }: ApiResponse = await inventoryApi.batchChangeInventory(body) - expect(statusCode).toBe(200); - - let request: BatchRetrieveInventoryChangesRequest = { - types: ['PHYSICAL_COUNT'], - catalogObjectIds: [itemVariationId], - locationIds: [locationId] - } - - let { result:{ changes } , statusCode: retrieveStatusCode }: ApiResponse = await inventoryApi.batchRetrieveInventoryChanges(request) - expect(retrieveStatusCode).toBe(200); - - let physicalCountId : string = (changes!)[0].physicalCount?.id!; - let { statusCode: physicalCountStatus }: ApiResponse = await inventoryApi.retrieveInventoryPhysicalCount(physicalCountId); - expect(physicalCountStatus).toBe(200) - }) - -}) diff --git a/test/controllers/invoicesApi.test.ts b/test/controllers/invoicesApi.test.ts deleted file mode 100644 index f4891301d..000000000 --- a/test/controllers/invoicesApi.test.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { InvoicesApi,CustomersApi, LocationsApi, SearchInvoicesRequest, CreateInvoiceRequest, Invoice, OrdersApi, CreateOrderResponse, ApiResponse, SearchInvoicesResponse, CreateInvoiceResponse, InvoicePaymentRequest, DeleteInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, PublishInvoiceResponse, PublishInvoiceRequest, CreateCustomerRequest, Address, CancelInvoiceRequest } from '../../src'; -import { testClient } from '../testClient' -import { v4 as uuidv4 } from 'uuid' - -describe('Invoices API', () => { - let invoicesApi : InvoicesApi; - let locationsApi : LocationsApi; - let customersApi : CustomersApi; - let ordersApi : OrdersApi; - - let locationId : string; - let newCustomerId : string - let newOrderId : string; - let newInvoiceId : string; - let paymentRequestUid : string; - beforeAll(async () => { - invoicesApi = testClient.invoicesApi; - locationsApi = testClient.locationsApi; - ordersApi = testClient.ordersApi; - customersApi = testClient.customersApi; - - let { result } = await locationsApi.listLocations(); - locationId = (result.locations!)[0].id!; - - let createOrderResponse: ApiResponse = await ordersApi.createOrder({ - idempotencyKey: uuidv4(), - order: { - locationId: locationId, - lineItems: [ - { - name: 'New Item', - quantity: '1', - basePriceMoney: { - amount: BigInt(100), - currency: 'USD' - } - } - ] - } - }); - - newOrderId = createOrderResponse.result?.order?.id!; - - const address: Address = { - addressLine1: '500 Electric Ave', - addressLine2: 'Suite 600', - locality: 'New York', - administrativeDistrictLevel1: 'NY', - postalCode: '10003', - country: 'US', - }; - - const body: CreateCustomerRequest = { - givenName: 'Amelia', - familyName: 'Earhart', - phoneNumber: '1-212-555-4240', - note: 'a customer', - address: address, - }; - let customerResponse = await customersApi.createCustomer(body); - - newCustomerId = customerResponse.result?.customer?.id!; - }) - - afterAll( async () => { - await customersApi.deleteCustomer(newCustomerId); - }) - - it('should testListInvoices', async () => { - let { statusCode } = await invoicesApi.listInvoices(locationId); - - expect(statusCode).toBe(200); - }) - - it('should testSearchInvoices', async () => { - - let body: SearchInvoicesRequest = { - limit: 1, - query: { - filter: { - locationIds: [locationId] - } - }, - } - - let { statusCode }: ApiResponse = await invoicesApi.searchInvoices(body); - expect(statusCode).toBe(200); - }) - - it('should testCreateInvoice', async () => { - - let paymentRequest: InvoicePaymentRequest = { - requestType: 'BALANCE', - dueDate: (new Date()).toISOString().slice(0, 10) - } - - // Accepted Payment Methods are optional on the request, but all methods of payments are returned - // in the response, therefore, we ensure that at least the payment methods we specified are returned - // accordingly in the response. - const acceptedPaymentMethods = { - card: true, - bankAccount: true, - squareGiftCard: false - } - - let invoice: Invoice = { - title: 'Brand New Invoice', - description: 'A Blank Invoice', - orderId: newOrderId, - locationId: locationId, - paymentRequests: [paymentRequest], - invoiceNumber: createInvoiceNumber(), - deliveryMethod: 'SHARE_MANUALLY', - acceptedPaymentMethods: acceptedPaymentMethods, - primaryRecipient:{ - customerId: newCustomerId - } - } - - let body: CreateInvoiceRequest = { - invoice, - idempotencyKey: uuidv4(), - } - - let { result, statusCode }: ApiResponse = await invoicesApi.createInvoice(body); - expect(statusCode).toBe(200); - expect(result.invoice).toEqual(expect.objectContaining({ - ...invoice, - acceptedPaymentMethods: expect.objectContaining(acceptedPaymentMethods), - paymentRequests: [expect.objectContaining(paymentRequest)], - primaryRecipient: expect.objectContaining({ - customerId: newCustomerId - }) - })) - - newInvoiceId = result.invoice?.id!; - paymentRequestUid = (result.invoice?.paymentRequests!)[0].uid! - }) - - it('should testGetInvoice', async () => { - - let { statusCode }: ApiResponse = await invoicesApi.getInvoice(newInvoiceId); - expect(statusCode).toBe(200) - }) - - it('should testUpdateInvoice', async () => { - - let paymentRequest: InvoicePaymentRequest = { - requestMethod: 'SHARE_MANUALLY', - requestType: 'BALANCE', - dueDate: (new Date()).toISOString().slice(0, 10) - } - - let invoice: Invoice = { - version: 0, - title: 'Updated Invoice', - description: 'A Blank Invoice', - orderId: newOrderId, - locationId: locationId, - acceptedPaymentMethods: { - card: true, - bankAccount: true, - squareGiftCard: false, - }, - paymentRequests: [paymentRequest] - } - - let body: UpdateInvoiceRequest = { - invoice, - idempotencyKey: uuidv4(), - fieldsToClear: [`payment_requests[${paymentRequestUid}]`] - } - - let { statusCode }: ApiResponse = await invoicesApi.updateInvoice(newInvoiceId, body); - expect(statusCode).toBe(200); - }) - - it('should testPublishInvoice', async () => { - let body : PublishInvoiceRequest = { - version: 1, - idempotencyKey: uuidv4() - } - let { statusCode }: ApiResponse = await invoicesApi.publishInvoice(newInvoiceId, body); - expect(statusCode).toBe(200); - }) - - it('should testCancelInvoice', async () => { - let body : CancelInvoiceRequest = { - version: 2 - }; - let { statusCode }: ApiResponse = await invoicesApi.cancelInvoice(newInvoiceId, body); - expect(statusCode).toBe(200); - }) - - - it('should testDeleteInvoice', async () => { - - try { - - let createOrderResponse: ApiResponse = await ordersApi.createOrder({ - idempotencyKey: uuidv4(), - order: { - locationId: locationId, - lineItems: [ - { - name: 'New Item', - quantity: '1', - basePriceMoney: { - amount: BigInt(100), - currency: 'USD' - } - } - ] - } - }); - - expect(createOrderResponse.statusCode!).toBe(200); - - let paymentRequest: InvoicePaymentRequest = { - requestMethod: 'SHARE_MANUALLY', - requestType: 'BALANCE', - dueDate: (new Date()).toISOString().slice(0, 10) - } - - let invoice: Invoice = { - title: 'Brand New Invoice', - description: 'A Blank Invoice', - locationId: locationId, - paymentRequests: [paymentRequest], - acceptedPaymentMethods: { - card: true, - bankAccount: true, - squareGiftCard: false, - }, - orderId: createOrderResponse.result?.order?.id! - } - - let body: CreateInvoiceRequest = { - invoice, - idempotencyKey: uuidv4(), - } - - let {result, statusCode }: ApiResponse = await invoicesApi.createInvoice(body); - expect(statusCode).toBe(200); - - let version: number = 0; - let deleteResponse = await invoicesApi.deleteInvoice(result.invoice?.id!,version); - expect(deleteResponse.statusCode).toBe(200); - } catch (error) { - console.log(error.result) - } - - }) -}) - - -const createInvoiceNumber = () => { - const MAX: number = 100000000 - const MIN: number = 10000000 - - return String(Math.floor(Math.random() * (MAX - MIN) + MIN)) -} diff --git a/test/controllers/laborApi.test.ts b/test/controllers/laborApi.test.ts deleted file mode 100644 index 22bfbab52..000000000 --- a/test/controllers/laborApi.test.ts +++ /dev/null @@ -1,164 +0,0 @@ -import { LaborApi, CreateBreakTypeRequest, BreakType, LocationsApi, UpdateBreakTypeRequest, CreateShiftRequest, Shift, TeamApi, TeamMember, CreateTeamMemberRequest, UpdateShiftRequest, ShiftWage } from "../../src" -import { testClient } from "../testClient" -import { v4 as uuidv4 } from 'uuid' - -function formatDateString(date: Date): string { - let result: string = ''; - result += date.getUTCFullYear().toString(); - result += '-'; - result += (date.getUTCMonth() + 1).toString().padStart(2, '0'); - result += '-'; - result += date.getUTCDate().toString().padStart(2, '0'); - result += 'T'; - result += date.getUTCHours().toString().padStart(2, '0'); - result += ':'; - result += date.getUTCMinutes().toString().padStart(2, '0'); - result += ':00Z'; - return result; -} - -describe('Labor API', () => { - let laborApi : LaborApi - let locationsApi : LocationsApi - let teamApi : TeamApi - - let locationId : string - let memberId : string - let breakId : string - let shiftId : string - beforeAll( async () => { - laborApi = testClient.laborApi - locationsApi = testClient.locationsApi - teamApi = testClient.teamApi - - let {result : {locations}} = await locationsApi.listLocations() - locationId = (locations!)[0].id! - - let teamMember1: TeamMember = { - givenName: "Sherlock", - familyName: "Holmes" - } - let body: CreateTeamMemberRequest = { - idempotencyKey: uuidv4(), - teamMember: teamMember1 - } - let { result: { teamMember } } = await teamApi.createTeamMember(body) - memberId = teamMember?.id! - }) - it('should testListBreakTypes', async () => { - let { statusCode } = await laborApi.listBreakTypes() - expect(statusCode).toBe(200) - }) - it('should testCreateBreakType', async () => { - let breakType : BreakType = { - locationId: locationId, - expectedDuration: "PT0H30M0S", // 30 min duration in RFC 3339 format (https://tools.ietf.org/html/rfc3339) - breakName: `Lunch_${uuidv4()}`, - isPaid: true - } - let body : CreateBreakTypeRequest = { - idempotencyKey: uuidv4(), - breakType: breakType - } - try { - - let { result, statusCode } = await laborApi.createBreakType(body) - expect(statusCode).toBe(200) - - breakId = result.breakType?.id! - } catch (error) { - console.log(error) - } - }) - it('should testGetBreakType', async () => { - let { result: { breakType },statusCode } = await laborApi.getBreakType(breakId) - expect(statusCode).toBe(200) - expect(breakType?.id!).toBe(breakId) - }) - - it('should testUpdateBreakType', async () => { - let updtedBreakType: BreakType = { - locationId: locationId, - expectedDuration: "PT1H0M0S", // 1 hour duration in RFC 3339 format (https://tools.ietf.org/html/rfc3339) - breakName: `Lunch_${uuidv4()}`, - isPaid: true - } - const body : UpdateBreakTypeRequest = { - breakType: updtedBreakType - } - const { result: { breakType }, statusCode } = await laborApi.updateBreakType(breakId, body) - expect(statusCode).toBe(200) - expect(breakType?.id!).toBe(breakId) - expect(breakType?.expectedDuration!).toBe('PT1H') - }) - it('should testSearchShifts', async () => { - let { statusCode } = await laborApi.searchShifts({ - limit: 1 - }) - expect(statusCode).toBe(200) - }) - - it('should testCreateShift', async () => { - let newShift : Shift = { - startAt: formatDateString(new Date()), - locationId: locationId, - teamMemberId: memberId - } - let body : CreateShiftRequest = { - shift: newShift, - idempotencyKey: uuidv4(), - } - let { result : { shift }, statusCode } = await laborApi.createShift(body) - expect(statusCode).toBe(200) - expect(shift).toEqual(expect.objectContaining(shift)) - - shiftId = shift?.id! - }) - - it('should testGetShift', async () => { - let { result: {shift}, statusCode } = await laborApi.getShift(shiftId) - expect(statusCode).toBe(200) - expect(shift?.id!).toBe(shiftId) - }) - - it('should testUpdateShift', async () => { - let wage: ShiftWage = { - title: "Manager", - hourlyRate: { - amount: BigInt(2500), - currency: 'USD' - } - } - - let updateShift: Shift = { - wage, - locationId: locationId, - teamMemberId: memberId, - startAt: formatDateString(new Date(Date.now() - 6000)), - } - - let body : UpdateShiftRequest = { - shift: updateShift - } - - let { result: { shift }, statusCode } = await laborApi.updateShift(shiftId, body) - expect(statusCode).toBe(200) - expect(shift).toEqual(expect.objectContaining({ - ...updateShift, - wage: expect.objectContaining(wage) - })) - }) - - it('should testDeleteShift', async () => { - let { statusCode } = await laborApi.deleteShift(shiftId) - expect(statusCode).toBe(200) - }) - it('should testDeleteBreakType', async () => { - let { statusCode } = await laborApi.deleteBreakType(breakId) - expect(statusCode).toBe(200) - }) - it('should testListWorkWeekConfigs', async () => { - let { statusCode } = await laborApi.listWorkweekConfigs() - expect(statusCode).toBe(200) - }) -}) diff --git a/test/controllers/locationsApi.test.ts b/test/controllers/locationsApi.test.ts deleted file mode 100644 index 9987b62e2..000000000 --- a/test/controllers/locationsApi.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { LocationsApi } from '../../src'; -import { testClient } from '../testClient'; - -describe('Locations API', () => { - let locationsController: LocationsApi; - - beforeAll(() => { - locationsController = testClient.locationsApi; - }); - - it('should testlistlocations response', async () => { - const response = await locationsController.listLocations(); - expect(response.statusCode).toBe(200); - }); -}); diff --git a/test/controllers/merchantsApi.test.ts b/test/controllers/merchantsApi.test.ts deleted file mode 100644 index ff280fc80..000000000 --- a/test/controllers/merchantsApi.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MerchantsApi } from '../../src'; -import { testClient } from '../testClient'; - -describe('Merchants API', () => { - let merchantsApi: MerchantsApi; - let merchantId: string; - - beforeAll(() => { - merchantsApi = testClient.merchantsApi; - }); - - it('should testListMerchants response', async () => { - const {result, statusCode} = await merchantsApi.listMerchants(); - expect(statusCode).toBe(200); - - merchantId = (result.merchant!)[0].id!; - }); - - it('should testRetrieveMerchant response', async () => { - const response = await merchantsApi.retrieveMerchant(merchantId); - expect(response.statusCode).toBe(200); - }); -}); diff --git a/test/controllers/mobileAuthorizationApi.test.ts b/test/controllers/mobileAuthorizationApi.test.ts deleted file mode 100644 index 8e461e252..000000000 --- a/test/controllers/mobileAuthorizationApi.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { - CreateMobileAuthorizationCodeRequest, - LocationsApi, - MobileAuthorizationApi, -} from '../../src'; -import { testClient } from '../testClient'; - -describe('MobileAuthorization API', () => { - let mobileAuthorizationApi: MobileAuthorizationApi; - let locationsApi: LocationsApi; - - beforeAll(() => { - mobileAuthorizationApi = testClient.mobileAuthorizationApi; - locationsApi = testClient.locationsApi; - }); - - it('should testCreateMobileAuthorizationCode response', async () => { - const locationResult = await locationsApi.listLocations(); - expect(locationResult.statusCode).toBe(200); - - const locationId = locationResult.result.locations?.[0]?.id; - expect(locationId).toBeTruthy(); - - const body: CreateMobileAuthorizationCodeRequest = { - locationId: locationId, - }; - - const response = await mobileAuthorizationApi.createMobileAuthorizationCode( - body - ); - expect(response.statusCode).toBe(200); - }); -}); diff --git a/test/controllers/ordersApi.test.ts b/test/controllers/ordersApi.test.ts deleted file mode 100644 index 652d84b19..000000000 --- a/test/controllers/ordersApi.test.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { - OrdersApi, - LocationsApi, - CreateOrderRequest, - SearchOrdersRequest, - UpdateOrderRequest, - OrderLineItem, - PayOrderRequest, - CalculateOrderRequest, -} from '../../src'; -import { testClient } from '../testClient'; -import {v4 as uuidv4} from 'uuid' - -describe('Orders API', () => { - let ordersApi : OrdersApi; - let locationsApi : LocationsApi; - let locationId : string; - let newOrderId : string; - let lineItemUid : string; - - beforeAll(async () => { - ordersApi = testClient.ordersApi; - locationsApi = testClient.locationsApi; - - let listLocationsResponse = await locationsApi.listLocations(); - let locations = listLocationsResponse.result?.locations! - locationId = locations[0].id! - }); - - it('should testCreateOrder response', async () => { - let lineItem: OrderLineItem = { - name: 'New Item', - quantity: '1', - basePriceMoney: { - amount: BigInt(100), - currency: 'USD' - } - } - - let body: CreateOrderRequest = { - idempotencyKey: uuidv4(), - order: { - locationId: locationId, - lineItems: [lineItem], - } - }; - - let { result, statusCode } = await ordersApi.createOrder(body) - expect(statusCode).toBe(200); - expect(result.order).toEqual(expect.objectContaining({ - locationId: locationId, - lineItems: expect.arrayContaining([ - expect.objectContaining(lineItem) - ]) - })) - - newOrderId = result.order?.id! - lineItemUid = (result.order?.lineItems!)[0].uid! - }); - - it('should testBatchRetrieveOrders response', async () => { - - let { result, statusCode } = await ordersApi.batchRetrieveOrders({ - orderIds: [newOrderId], - }) - - expect(statusCode).toBe(200); - expect(result.orders).toEqual(expect.arrayContaining([ - expect.objectContaining({ - id: newOrderId - }) - ])) - - }); - - it('should testSearchOrders response', async () => { - - let body: SearchOrdersRequest = { - limit: 1, - locationIds: [locationId] - } - let { statusCode } = await ordersApi.searchOrders(body) - expect(statusCode).toBe(200); - }) - - it('should testUpdateOrder response', async () => { - - let lineItem: OrderLineItem = { - name: 'Updated Item', - quantity: '1', - basePriceMoney: { - amount: BigInt(0), - currency: 'USD' - } - } - - let body : UpdateOrderRequest = { - idempotencyKey: uuidv4(), - order: { - version: 1, - locationId: locationId, - lineItems: [lineItem], - }, - fieldsToClear: [`line_items[${lineItemUid}]`], - } - - let { result, statusCode } = await ordersApi.updateOrder(newOrderId, body); - expect(statusCode).toBe(200); - expect(result.order).toEqual(expect.objectContaining({ - id: newOrderId, - lineItems: expect.arrayContaining([expect.objectContaining(lineItem)]) - })) - }) - - it('should testPayOrder response', async () => { - - let body: PayOrderRequest = { - idempotencyKey: uuidv4(), - orderVersion: 2, - paymentIds:[] - } - - let { statusCode} = await ordersApi.payOrder(newOrderId, body); - - expect(statusCode).toBe(200); - }); - - - it('should testCalculateOrder response', async () => { - let lineItem: OrderLineItem = { - name: 'New Item', - quantity: '1', - basePriceMoney: { - amount: BigInt(100), - currency: 'USD' - } - } - - let body: CalculateOrderRequest = { - order: { - locationId: locationId, - lineItems: [lineItem], - } - }; - let { result, statusCode } = await ordersApi.calculateOrder(body); - expect(statusCode).toBe(200); - expect(result).toHaveProperty('order') - }); -}); diff --git a/test/controllers/paymentsApi.test.ts b/test/controllers/paymentsApi.test.ts deleted file mode 100644 index 44f5ff039..000000000 --- a/test/controllers/paymentsApi.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { CreatePaymentRequest, Money, PaymentsApi, CancelPaymentByIdempotencyKeyRequest } from '../../src'; -import { testClient } from '../testClient'; -import { v4 as uuidv4 } from 'uuid' - -describe('Payments API', () => { - let paymentsApi: PaymentsApi; - let paymentId: string; - - beforeAll(() => { - paymentsApi = testClient.paymentsApi; - }); - - it('should testListPayments response', async () => { - const result = await paymentsApi.listPayments(); - expect(result.statusCode).toBe(200); - }); - - it('should testCreatePayment response', async () => { - const sourceId = 'cnon:card-nonce-ok'; - const money: Money = { - amount: BigInt(200), - currency: 'USD', - }; - - const body: CreatePaymentRequest = { - sourceId: sourceId, - idempotencyKey: uuidv4(), - amountMoney: money, - appFeeMoney: { - amount: BigInt(10), - currency: 'USD', - }, - autocomplete: true, - }; - - const result = await paymentsApi.createPayment(body); - expect(result.statusCode).toBe(200); - expect(result.result.payment?.appFeeMoney?.currency).toBe( - body.appFeeMoney?.currency - ); - expect(result.result.payment?.appFeeMoney?.amount).toBe( - body.appFeeMoney?.amount - ); - expect(result.result.payment?.amountMoney?.currency).toBe( - body.amountMoney?.currency - ); - expect(result.result.payment?.amountMoney?.amount).toBe( - body.amountMoney?.amount - ); - }); - it('should testCreatePaymentDelayed response', async () => { - const sourceId = 'cnon:card-nonce-ok'; - const money: Money = { - amount: BigInt(200), - currency: 'USD', - }; - - const body: CreatePaymentRequest = { - sourceId: sourceId, - idempotencyKey: uuidv4(), - amountMoney: money, - autocomplete: false, - appFeeMoney: { - amount: BigInt(10), - currency: 'USD', - }, - }; - - const result = await paymentsApi.createPayment(body); - expect(result.statusCode).toBe(200); - - paymentId = result.result.payment?.id!; - }); - - it('should testGetPayment response', async () => { - const result = await paymentsApi.getPayment(paymentId); - expect(result.statusCode).toBe(200); - expect(result.result.payment?.id).toBe(paymentId); - }); - - it('should testCancelPaymentresponse', async () => { - const result = await paymentsApi.cancelPayment(paymentId); - expect(result.statusCode).toBe(200); - expect(result.result.payment?.id).toBe(paymentId); - }); - - - - it('should testCreatePaymentDelayed response', async () => { - const sourceId = 'cnon:card-nonce-ok'; - const money: Money = { - amount: BigInt(200), - currency: 'USD', - }; - - const idempotencyKey = uuidv4() - const body: CreatePaymentRequest = { - idempotencyKey, - sourceId: sourceId, - amountMoney: money, - autocomplete: false, - appFeeMoney: { - amount: BigInt(10), - currency: 'USD', - }, - }; - - const { statusCode: createStatusCode } = await paymentsApi.createPayment(body); - expect(createStatusCode).toBe(200); - - let request : CancelPaymentByIdempotencyKeyRequest = { - idempotencyKey - } - - const { statusCode: cancelStatusCode } = await paymentsApi.cancelPaymentByIdempotencyKey(request); - expect(cancelStatusCode).toBe(200); - }); - - it('should testCompletePayment response', async () => { - const sourceId = 'cnon:card-nonce-ok'; - const money: Money = { - amount: BigInt(200), - currency: 'USD', - }; - - const body: CreatePaymentRequest = { - idempotencyKey: uuidv4(), - sourceId: sourceId, - amountMoney: money, - autocomplete: false, - appFeeMoney: { - amount: BigInt(10), - currency: 'USD', - }, - }; - - const { result: { payment }, statusCode: createStatusCode } = await paymentsApi.createPayment(body); - expect(createStatusCode).toBe(200); - - const { statusCode} = await paymentsApi.completePayment(payment?.id!, {}); - expect(statusCode).toBe(200); - }); -}); diff --git a/test/controllers/refundsApi.test.ts b/test/controllers/refundsApi.test.ts deleted file mode 100644 index 5f26bbe26..000000000 --- a/test/controllers/refundsApi.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { CreatePaymentRequest, Money, PaymentsApi, RefundsApi, RefundPaymentRequest, ApiResponse, RefundPaymentResponse } from '../../src'; -import { testClient } from '../testClient'; -import { v4 as uuidv4 } from 'uuid' - -const paymentsApi : PaymentsApi = testClient.paymentsApi; -const refundApi : RefundsApi = testClient.refundsApi; - -// Returns the payment.id from the payment call -async function makePaymentsCall (): Promise { - const sourceId = 'cnon:card-nonce-ok'; - const money: Money = { - amount: BigInt(200), - currency: 'USD', - }; - - const body: CreatePaymentRequest = { - sourceId: sourceId, - idempotencyKey: uuidv4(), - amountMoney: money, - appFeeMoney: { - amount: BigInt(10), - currency: 'USD', - }, - autocomplete: true, - }; - - const { result : { payment } } = await paymentsApi.createPayment(body); - const paymentId = payment?.id! - return paymentId; -}; - -describe('Refunds API', () => { - let paymentId : string; - let refundId : string; - - beforeAll(async () => { - // This will run once before all tests - try { - paymentId = await makePaymentsCall(); - } catch (e) { - fail(`Failed to make payment call: ${e.message}`); - } - }); - - it('should testListPaymentRefunds response', async () => { - const result = await refundApi.listPaymentRefunds(); - expect(result.statusCode).toBe(200); - }); - - it('should testRefundPayment response', async () => { - const body: RefundPaymentRequest = { - idempotencyKey: uuidv4(), - amountMoney: { - amount: BigInt(200), - currency: 'USD' - }, - paymentId: paymentId, - }; - - const { result: { refund }, statusCode }: ApiResponse = await refundApi.refundPayment(body); - expect(statusCode).toBe(200); - expect(refund?.paymentId).toBe(paymentId); - - refundId = refund?.id!; - }); - - it('should testGetPaymentRefund response', async () => { - if (!refundId) { - fail('Refund ID not set. Run the refund test first.'); - } - - const { result: { refund }, statusCode } = await refundApi.getPaymentRefund(refundId); - expect(statusCode).toBe(200); - expect(refund?.paymentId).toBe(paymentId); - }); -}); diff --git a/test/controllers/teamApi.test.ts b/test/controllers/teamApi.test.ts deleted file mode 100644 index 05782b717..000000000 --- a/test/controllers/teamApi.test.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { TeamApi, CreateTeamMemberRequest, TeamMember, UpdateTeamMemberRequest, UpdateWageSettingRequest, WageSetting, JobAssignment, BulkCreateTeamMembersRequest, BulkUpdateTeamMembersRequest } from "../../src" -import { testClient } from "../testClient" -import { v4 as uuidv4} from 'uuid' - -describe('Team API', () => { - let teamApi : TeamApi - - let memberId : string - const bulkIds : string[] = [] - beforeAll(() => { - teamApi = testClient.teamApi - }) - - it('should testSearchTeamMembers', async () => { - let { statusCode } = await teamApi.searchTeamMembers({ - limit: 1 - }) - expect(statusCode).toBe(200) - }) - - it('should testCreateTeamMember', async () => { - let teamMember1 : TeamMember = { - givenName: "Sherlock", - familyName: "Holmes" - } - let body : CreateTeamMemberRequest = { - idempotencyKey: uuidv4(), - teamMember: teamMember1 - } - let { result: {teamMember}, statusCode } = await teamApi.createTeamMember(body) - expect(statusCode).toBe(200) - - memberId = teamMember?.id! - }) - - it('should testRetrieveTeamMember', async () => { - let { result: { teamMember }, statusCode } = await teamApi.retrieveTeamMember(memberId) - expect(statusCode).toBe(200) - expect(teamMember?.id!).toBe(memberId) - }) - - - it('should testRetrieveWageSetting', async () => { - let { result: { wageSetting }, statusCode } = await teamApi.retrieveWageSetting(memberId) - expect(statusCode).toBe(200) - expect(wageSetting?.teamMemberId!).toBe(memberId) - }) - - it('should testUpdateTeamMember', async () => { - let teamMember1: TeamMember = { - givenName: "Agent", - familyName: "Smith" - } - let body: UpdateTeamMemberRequest = { - teamMember: teamMember1 - } - let { result: {teamMember}, statusCode } = await teamApi.updateTeamMember(memberId, body) - expect(statusCode).toBe(200) - expect(teamMember).toEqual(expect.objectContaining({ - ...teamMember, - id: memberId - })) - }) - - xit('should testUpdateWageSetting', async () => { - const assignment: JobAssignment = { - jobTitle: "Math tutor", - payType: "HOURLY", - hourlyRate: { - amount: BigInt(2500), - currency: 'USD' - } - } - const setting: WageSetting = { - jobAssignments: [ assignment] - } - let body: UpdateWageSettingRequest = { - wageSetting:setting - } - let { result: { wageSetting }, statusCode } = await teamApi.updateWageSetting(memberId, body) - expect(statusCode).toBe(200) - expect(wageSetting).toEqual(expect.objectContaining({ - jobAssignments: expect.arrayContaining([ - expect.objectContaining({ - ...assignment, - hourlyRate: expect.objectContaining({...assignment.hourlyRate}) - }) - ]) - })) - }) - - it('should testBatchCreateTeamMembers', async () => { - const idempotencyKey1 = uuidv4() - const idempotencyKey2 = uuidv4() - - let don : TeamMember = { - givenName: "Donatello", - familyName: "Splinter" - } - - let mike: TeamMember = { - givenName: "Michaelangelo", - familyName: "Splinter" - } - - let body : BulkCreateTeamMembersRequest = { - teamMembers:{ - [idempotencyKey1] : { - teamMember: don - }, - [idempotencyKey2] : { - teamMember: mike - } - } - } - - let { result, statusCode} = await teamApi.bulkCreateTeamMembers(body) - expect(statusCode).toBe(200) - expect(result).toEqual(expect.objectContaining({ - teamMembers: expect.objectContaining({ - [idempotencyKey1]: expect.objectContaining({ - teamMember: expect.objectContaining({ ...don }) - }), - [idempotencyKey2]: expect.objectContaining({ - teamMember: expect.objectContaining({ ...mike }) - }) - }) - })) - - for(let key in result.teamMembers!) { - let {teamMember}: CreateTeamMemberRequest = (result.teamMembers!)[key] - bulkIds.push(teamMember?.id!) - } - - }) - - it('should testBulkUpdateTeamMember', async () => { - - let raph: TeamMember = { - givenName: "Raphael", - familyName: "Splinter" - } - - let leo: TeamMember = { - givenName: "Leonardo", - familyName: "Splinter" - } - - let body: BulkUpdateTeamMembersRequest = { - teamMembers:{ - [bulkIds[0]]:{ - teamMember: raph - }, - [bulkIds[1]] : { - teamMember: leo - } - } - } - let {statusCode} = await teamApi.bulkUpdateTeamMembers(body) - expect(statusCode).toBe(200) - }) -}) diff --git a/test/controllers/terminalApi.test.ts b/test/controllers/terminalApi.test.ts deleted file mode 100644 index b697bff99..000000000 --- a/test/controllers/terminalApi.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { TerminalApi, CreateTerminalCheckoutRequest, TerminalCheckout, SearchTerminalCheckoutsRequest } from "../../src" -import { testClient } from "../testClient" -import { v4 as uuidv4 } from 'uuid' - -describe('Terminal API', () => { - let terminalApi : TerminalApi - let checkoutId : string - - beforeAll(() => { - terminalApi = testClient.terminalApi - }) - - it('should testCreateTerminalCheckout', async () => { - const sandboxDeviceId = 'da40d603-c2ea-4a65-8cfd-f42e36dab0c7' - const checkout: TerminalCheckout = { - deviceOptions:{ - deviceId: sandboxDeviceId - }, - amountMoney: { - amount: BigInt(100), - currency: 'USD' - } - } - const body : CreateTerminalCheckoutRequest = { - checkout, - idempotencyKey: uuidv4(), - } - let {result, statusCode} = await terminalApi.createTerminalCheckout(body) - expect(statusCode).toBe(200) - - - checkoutId = result.checkout?.id! - }) - - it('should testSearchTerminalCheckouts', async () => { - let body: SearchTerminalCheckoutsRequest = { - limit: 1 - } - let {statusCode} = await terminalApi.searchTerminalCheckouts(body) - expect(statusCode).toBe(200) - }) - - it('should testGetTerminalCheckouts', async () => { - let { result, statusCode } = await terminalApi.getTerminalCheckout(checkoutId) - expect(statusCode).toBe(200) - expect(result.checkout?.id!).toBe(checkoutId) - }) - - it('should testCancelTerminalCheckouts', async () => { - - let { statusCode } = await terminalApi.cancelTerminalCheckout(checkoutId) - expect(statusCode).toBe(200) - }) -}) diff --git a/test/locationsApi.test.ts b/test/locationsApi.test.ts deleted file mode 100644 index 0be56c0c9..000000000 --- a/test/locationsApi.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { LocationsApi } from '../src'; -import { testClient } from './testClient'; -import { makeApiCall } from './testHelper'; - -describe('LocationsApi', () => { - let controller : LocationsApi; - - beforeAll(() => { - controller = new LocationsApi(testClient); - }); - - it('should ListLocations', async () => { - const response = await makeApiCall( - () => controller.listLocations() - ); - - expect(response.statusCode).toBe(200); - }); -}); diff --git a/test/models/customAttribute.test.ts b/test/models/customAttribute.test.ts deleted file mode 100644 index 158bec589..000000000 --- a/test/models/customAttribute.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { CustomAttribute } from '../../src/models/customAttribute'; -import { CustomAttributeTestApi } from './customAttributeTestApi'; -import { testClient } from '../testClient'; - -describe('CustomAttribute model', () => { - let testApi: CustomAttributeTestApi; - - beforeAll(() => { - testApi = new CustomAttributeTestApi(testClient); - }); - - describe('serializes', () => { - function doTest(value: any) { - let customAttribute: CustomAttribute = { - key: 'test key', - value: value, - }; - let requestBody = testApi.createCustomAttributeRequest( - customAttribute - ) as { key: string; value: string }[]; - expect(requestBody[0].value).toEqual( - JSON.stringify({ - key: 'test key', - value: value, - }) - ); - } - - it('string value', () => { - doTest('hello world'); - }); - - it('number value', () => { - doTest('-12.345'); - }); - - it('boolean value', () => { - doTest(true); - }); - - it('phone number value', () => { - doTest('+16175551212'); - }); - - it('email value', () => { - doTest('example@squareup.com'); - }); - - it('date value', () => { - doTest('2020-02-08'); - }); - - it('datetime value', () => { - doTest('2020-02-08T09:30:26.123'); - }); - - it('duration value', () => { - doTest('P3Y6M4DT12H30M5S'); - }); - - it('address value', () => { - doTest({ - first_name: 'Elmo', - address_line_1: '123 Sesame St.', - locality: 'San Francisco', - administrative_district_level_1: 'CA', - postal_code: '12345', - country: 'US' - }); - }); - - it('selection value', () => { - doTest(['a740bb60-1002-4a4f-8280-914eb351f53d', '5ce4be85-16e6-4038-92a8-b7e7aef1c752']); - }); - }); -}); \ No newline at end of file diff --git a/test/models/customAttributeDefinition.test.ts b/test/models/customAttributeDefinition.test.ts deleted file mode 100644 index 33c578e84..000000000 --- a/test/models/customAttributeDefinition.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { CustomAttributeDefinition } from '../../src/models/customAttributeDefinition'; -import { CustomAttributeTestApi } from './customAttributeTestApi'; -import { testClient } from '../testClient'; - -describe('CustomAttributeDefinition model', () => { - let testApi: CustomAttributeTestApi; - - beforeAll(() => { - testApi = new CustomAttributeTestApi(testClient); - }); - - describe('serializes', () => { - it('string definition', () => { - let definition: CustomAttributeDefinition = { - key: 'test key', - schema: { - $ref: - 'https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String', - }, - name: 'Test Custom Attribute', - description: 'this is a test', - visibility: 'VISIBILITY_READ_WRITE_VALUES', - }; - let requestBody = testApi.createCustomAttributeDefinitionRequest( - definition - ) as { key: string; value: string }[]; - expect(requestBody[0].value).toEqual( - JSON.stringify({ - key: 'test key', - schema: { - $ref: - 'https://developer-production-s.squarecdn.com/schemas/v1/common.json#squareup.common.String', - }, - name: 'Test Custom Attribute', - description: 'this is a test', - visibility: 'VISIBILITY_READ_WRITE_VALUES', - }) - ); - }); - - it('selection definition', () => { - let definition: CustomAttributeDefinition = { - key: 'test key', - schema: { - $schema: - 'https://developer-production-s.squarecdn.com/meta-schemas/v1/selection.json', - maxItems: 2, - uniqueItems: true, - type: 'array', - items: { - names: ['Red', 'Yellow', 'Blue'], - }, - }, - name: 'Test Custom Attribute', - description: 'this is a test', - visibility: 'VISIBILITY_READ_WRITE_VALUES', - }; - let requestBody = testApi.createCustomAttributeDefinitionRequest( - definition - ) as { key: string; value: string }[]; - expect(requestBody[0].value).toEqual( - JSON.stringify({ - key: 'test key', - schema: { - $schema: - 'https://developer-production-s.squarecdn.com/meta-schemas/v1/selection.json', - maxItems: 2, - uniqueItems: true, - type: 'array', - items: { - names: ['Red', 'Yellow', 'Blue'], - }, - }, - name: 'Test Custom Attribute', - description: 'this is a test', - visibility: 'VISIBILITY_READ_WRITE_VALUES', - }) - ); - }); - }); -}); \ No newline at end of file diff --git a/test/models/customAttributeTestApi.ts b/test/models/customAttributeTestApi.ts deleted file mode 100644 index b34283b84..000000000 --- a/test/models/customAttributeTestApi.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { optional } from '../../src/schema'; -import { - CustomAttribute, - customAttributeSchema, -} from '../../src/models/customAttribute'; -import { BaseApi } from '../../src/api/baseApi'; -import { - CustomAttributeDefinition, - customAttributeDefinitionSchema, -} from '../../src/models/customAttributeDefinition'; - -export class CustomAttributeTestApi extends BaseApi { - createCustomAttributeDefinitionRequest( - definition: CustomAttributeDefinition - ): any { - const req = this.createRequest( - 'POST', - '/v2/test/custom-attribute-definitions' - ); - const mapped = req.prepareArgs({ - request: [definition, optional(customAttributeDefinitionSchema)], - }); - req.formData({ - request: JSON.stringify(mapped.request), - }); - return req.toRequest().body?.content; - } - - createCustomAttributeRequest(customAttribute: CustomAttribute): any { - const req = this.createRequest('POST', '/v2/test/custom-attributes'); - const mapped = req.prepareArgs({ - request: [customAttribute, optional(customAttributeSchema)], - }); - req.formData({ - request: JSON.stringify(mapped.request), - }); - return req.toRequest().body?.content; - } -} \ No newline at end of file diff --git a/test/resources/square.png b/test/resources/square.png deleted file mode 100644 index ba0264056..000000000 Binary files a/test/resources/square.png and /dev/null differ diff --git a/test/testClient.ts b/test/testClient.ts deleted file mode 100644 index c617e7fdb..000000000 --- a/test/testClient.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Client, Configuration, Environment } from '../src'; - -const defaultTestConfiguration: Partial = { - environment: Environment.Sandbox, - timeout: 30000, -}; - -export const testClient = new Client({ - ...defaultTestConfiguration, - ...createConfigurationFromEnvironment(), -}); - -function createConfigurationFromEnvironment(): Partial { - const config: Partial = {}; - - const timeout = process.env.SQUARE_TIMEOUT; - const accessToken = process.env.SQUARE_SANDBOX_TOKEN; - - if (timeout !== undefined && timeout !== '') { - config.timeout = parseInt(timeout); - } - - if (accessToken !== undefined && accessToken !== '') { - config.accessToken = accessToken; - } - - return config; -} diff --git a/test/testHelper.ts b/test/testHelper.ts deleted file mode 100644 index b130785e4..000000000 --- a/test/testHelper.ts +++ /dev/null @@ -1,30 +0,0 @@ -export * from '@apimatic/test-utilities'; - -import { HttpClient } from '../src/clientAdapter'; -import { HttpClientInterface } from '../src/core'; -import { ApiError, ApiResponse, AbortError } from '../src'; - -export function httpClientInterface(): HttpClientInterface { - return async (request, requestOptions) => { - return await new HttpClient(AbortError).executeRequest(request, requestOptions); - }; -} - -export async function makeApiCall( - caller: () => Promise> -): Promise> { - try { - return await caller(); - } catch (error) { - if (error instanceof ApiError) { - return { - request: error.request, - statusCode: error.statusCode, - headers: error.headers, - result: error.result, - body: error.body - }; - } - throw error; - } -} diff --git a/test/utilities/webhooksHelper.test.ts b/test/utilities/webhooksHelper.test.ts deleted file mode 100644 index dd4e19131..000000000 --- a/test/utilities/webhooksHelper.test.ts +++ /dev/null @@ -1,160 +0,0 @@ -import { WebhooksHelper } from '../../src/utilities/webhooksHelper'; - -describe('Test webhooks signature validation', () => { - const requestBody = '{"merchant_id":"MLEFBHHSJGVHD","type":"webhooks.test_notification","event_id":"ac3ac95b-f97d-458c-a6e6-18981597e05f","created_at":"2022-07-13T20:30:59.037339943Z","data":{"type":"webhooks","id":"bc368e64-01aa-407e-b46e-3231809b1129"}}'; - - const signatureHeader = 'GF4YkrJgGBDZ9NIYbNXBnMzqb2HoL4RW/S6vkZ9/2N4='; - - const signatureKey = 'Ibxx_5AKakO-3qeNVR61Dw'; - - const notificationUrl = 'https://webhook.site/679a4f3a-dcfa-49ee-bac5-9d0edad886b9'; - - test('test signature validation pass', () => { - const isValid = WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - signatureKey, - notificationUrl - ); - expect(isValid).toBe(true); - }); - - test('test signature unescaped chars validation pass', () => { - const url = "https://webhook.site/webhooks" - const sigKey = 'signature-key'; - const specialCharacterBody = '{"data":{"type":"webhooks","id":"fake_id"}}'; - const expectedSignatureHeader = 'W3FlCNk5IA3ZQ2LHTWoajvzfaDu/OwY2tNHIHC3IUOA='; - - const isValid = WebhooksHelper.isValidWebhookEventSignature( - specialCharacterBody, - expectedSignatureHeader, - sigKey, - url - ); - expect(isValid).toBe(true); - }); - - test('test signature with escaped characters', () => { - const url = "https://webhook.site/webhooks" - const sigKey = 'signature-key'; - const specialCharacterBody = '{"data":{"type":"webhooks","id":">id<"}}'; - const expectedSignatureHeader = 'Cxt7+aTi4rKgcA0bC4g9EHdVtLSDWdqccmL5MvihU4U='; - - const isValid = WebhooksHelper.isValidWebhookEventSignature( - specialCharacterBody, - expectedSignatureHeader, - sigKey, - url - ); - expect(isValid).toBe(true); - }); - - test('test signature validation fails on notification url mismatch', () => { - const isValid = WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - signatureKey, - 'https://webhook.site/79a4f3a-dcfa-49ee-bac5-9d0edad886b9' - ); - expect(isValid).toBe(false); - }); - - test('test signature validation fails on invalid signature key', () => { - const isValid = WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - 'MCmhFRxGX82xMwg5FsaoQA', - notificationUrl - ); - expect(isValid).toBe(false); - }); - - test('test signature validation fails on invalida signature header', () => { - const isValid = WebhooksHelper.isValidWebhookEventSignature( - requestBody, - '1z2n3DEJJiUPKcPzQo1ftvbxGdw=', - signatureKey, - notificationUrl - ); - expect(isValid).toBe(false); - }); - - test('test signature validation fails on request body mismatch', () => { - let requestBody = '{"merchant_id":"MLEFBHHSJGVHD","type":"webhooks.test_notification","event_id":"ac3ac95b-f97d-458c-a6e6-18981597e05f","created_at":"2022-06-13T20:30:59.037339943Z","data":{"type":"webhooks","id":"bc368e64-01aa-407e-b46e-3231809b1129"}}'; - const isValid = WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - signatureKey, - notificationUrl - ); - expect(isValid).toBe(false); - }); - - test('test signature validation fails on request body formatted', () => { - let requestBody = '{\n' - + ' "merchant_id": "MLEFBHHSJGVHD",\n' - + ' "type": "webhooks.test_notification",\n' - + ' "event_id": "ac3ac95b-f97d-458c-a6e6-18981597e05f",\n' - + ' "created_at": "2022-07-13T20:30:59.037339943Z",\n' - + ' "data": {\n' - + ' "type": "webhooks",\n' - + ' "id": "bc368e64-01aa-407e-b46e-3231809b1129"\n' - + ' }\n' - + '}'; - const isValid = WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - signatureKey, - notificationUrl - ); - expect(isValid).toBe(false); - }); - - it('throws an error on empty signature key', () => { - expect(() => { - WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - '', - notificationUrl - ); - } - ).toThrowError('signatureKey is null or empty'); - }); - - it('throws error on signature key not configured', () => { - expect(() => { - WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - null!, - notificationUrl - ); - } - ).toThrowError('signatureKey is null or empty'); - }); - - it('throws error on empty notification url', () => { - expect(() => { - WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - signatureKey, - '' - ); - } - ).toThrowError('notificationUrl is null or empty'); - }); - - it('throws error on notification url not configured', () => { - expect(() => { - WebhooksHelper.isValidWebhookEventSignature( - requestBody, - signatureHeader, - signatureKey, - null! - ); - } - ).toThrowError('notificationUrl is null or empty'); - }); -}); \ No newline at end of file diff --git a/tests/custom.test.ts b/tests/custom.test.ts new file mode 100644 index 000000000..7f5e031c8 --- /dev/null +++ b/tests/custom.test.ts @@ -0,0 +1,13 @@ +/** + * This is a custom test file, if you wish to add more tests + * to your SDK. + * Be sure to mark this file in `.fernignore`. + * + * If you include example requests/responses in your fern definition, + * you will have tests automatically generated for you. + */ +describe("test", () => { + it("default", () => { + expect(true).toBe(true); + }); +}); diff --git a/tests/unit/auth/BasicAuth.test.ts b/tests/unit/auth/BasicAuth.test.ts new file mode 100644 index 000000000..79ef97993 --- /dev/null +++ b/tests/unit/auth/BasicAuth.test.ts @@ -0,0 +1,22 @@ +import { BasicAuth } from "../../../src/core/auth/BasicAuth"; + +describe("BasicAuth", () => { + describe("toAuthorizationHeader", () => { + it("correctly converts to header", () => { + expect( + BasicAuth.toAuthorizationHeader({ + username: "username", + password: "password", + }), + ).toBe("Basic dXNlcm5hbWU6cGFzc3dvcmQ="); + }); + }); + describe("fromAuthorizationHeader", () => { + it("correctly parses header", () => { + expect(BasicAuth.fromAuthorizationHeader("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")).toEqual({ + username: "username", + password: "password", + }); + }); + }); +}); diff --git a/tests/unit/auth/BearerToken.test.ts b/tests/unit/auth/BearerToken.test.ts new file mode 100644 index 000000000..7757b87cb --- /dev/null +++ b/tests/unit/auth/BearerToken.test.ts @@ -0,0 +1,14 @@ +import { BearerToken } from "../../../src/core/auth/BearerToken"; + +describe("BearerToken", () => { + describe("toAuthorizationHeader", () => { + it("correctly converts to header", () => { + expect(BearerToken.toAuthorizationHeader("my-token")).toBe("Bearer my-token"); + }); + }); + describe("fromAuthorizationHeader", () => { + it("correctly parses header", () => { + expect(BearerToken.fromAuthorizationHeader("Bearer my-token")).toBe("my-token"); + }); + }); +}); diff --git a/tests/unit/fetcher/Fetcher.test.ts b/tests/unit/fetcher/Fetcher.test.ts new file mode 100644 index 000000000..a32945e94 --- /dev/null +++ b/tests/unit/fetcher/Fetcher.test.ts @@ -0,0 +1,74 @@ +import fs from "fs"; +import { join } from "path"; + +import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + +describe("Test fetcherImpl", () => { + it("should handle successful request", async () => { + const mockArgs: Fetcher.Args = { + url: "https://httpbin.org/post", + method: "POST", + headers: { "X-Test": "x-test-header" }, + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + }; + + global.fetch = jest.fn().mockResolvedValue({ + ok: true, + status: 200, + text: () => Promise.resolve(JSON.stringify({ data: "test" })), + json: () => ({ data: "test" }), + }); + + const result = await fetcherImpl(mockArgs); + expect(result.ok).toBe(true); + if (result.ok) { + expect(result.body).toEqual({ data: "test" }); + } + + expect(global.fetch).toHaveBeenCalledWith( + "https://httpbin.org/post", + expect.objectContaining({ + method: "POST", + headers: expect.objectContaining({ "X-Test": "x-test-header" }), + body: JSON.stringify({ data: "test" }), + }), + ); + }); + + it("should send octet stream", async () => { + const url = "https://httpbin.org/post/file"; + const mockArgs: Fetcher.Args = { + url, + method: "POST", + headers: { "X-Test": "x-test-header" }, + contentType: "application/octet-stream", + requestType: "bytes", + duplex: "half", + body: fs.createReadStream(join(__dirname, "test-file.txt")), + }; + + global.fetch = jest.fn().mockResolvedValue({ + ok: true, + status: 200, + text: () => Promise.resolve(JSON.stringify({ data: "test" })), + json: () => Promise.resolve({ data: "test" }), + }); + + const result = await fetcherImpl(mockArgs); + + expect(global.fetch).toHaveBeenCalledWith( + url, + expect.objectContaining({ + method: "POST", + headers: expect.objectContaining({ "X-Test": "x-test-header" }), + body: expect.any(fs.ReadStream), + }), + ); + expect(result.ok).toBe(true); + if (result.ok) { + expect(result.body).toEqual({ data: "test" }); + } + }); +}); diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts new file mode 100644 index 000000000..486e1e614 --- /dev/null +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -0,0 +1,51 @@ +import { createRequestUrl } from "../../../src/core/fetcher/createRequestUrl"; + +describe("Test createRequestUrl", () => { + it("should return the base URL when no query parameters are provided", () => { + const baseUrl = "https://api.example.com"; + expect(createRequestUrl(baseUrl)).toBe(baseUrl); + }); + + it("should append simple query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { key: "value", another: "param" }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?key=value&another=param"); + }); + + it("should handle array query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { items: ["a", "b", "c"] }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?items=a&items=b&items=c"); + }); + + it("should handle object query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { filter: { name: "John", age: 30 } }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30", + ); + }); + + it("should handle mixed types of query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { + simple: "value", + array: ["x", "y"], + object: { key: "value" }, + }; + expect(createRequestUrl(baseUrl, queryParams)).toBe( + "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value", + ); + }); + + it("should handle empty query parameters object", () => { + const baseUrl = "https://api.example.com"; + expect(createRequestUrl(baseUrl, {})).toBe(baseUrl); + }); + + it("should encode special characters in query parameters", () => { + const baseUrl = "https://api.example.com"; + const queryParams = { special: "a&b=c d" }; + expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?special=a%26b%3Dc%20d"); + }); +}); diff --git a/tests/unit/fetcher/getFetchFn.test.ts b/tests/unit/fetcher/getFetchFn.test.ts new file mode 100644 index 000000000..9b315ad09 --- /dev/null +++ b/tests/unit/fetcher/getFetchFn.test.ts @@ -0,0 +1,22 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getFetchFn } from "../../../src/core/fetcher/getFetchFn"; + +describe("Test for getFetchFn", () => { + it("should get node-fetch function", async () => { + if (RUNTIME.type == "node") { + if (RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + expect(await getFetchFn()).toBe(fetch); + } else { + expect(await getFetchFn()).toEqual((await import("node-fetch")).default as any); + } + } + }); + + it("should get fetch function", async () => { + if (RUNTIME.type == "browser") { + const fetchFn = await getFetchFn(); + expect(typeof fetchFn).toBe("function"); + expect(fetchFn.name).toBe("fetch"); + } + }); +}); diff --git a/tests/unit/fetcher/getRequestBody.test.ts b/tests/unit/fetcher/getRequestBody.test.ts new file mode 100644 index 000000000..919604c2e --- /dev/null +++ b/tests/unit/fetcher/getRequestBody.test.ts @@ -0,0 +1,77 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getRequestBody } from "../../../src/core/fetcher/getRequestBody"; + +describe("Test getRequestBody", () => { + it("should return FormData as is in Node environment", async () => { + if (RUNTIME.type === "node") { + const formData = new (await import("formdata-node")).FormData(); + formData.append("key", "value"); + const result = await getRequestBody({ + body: formData, + type: "file", + }); + expect(result).toBe(formData); + } + }); + + it("should stringify body if not FormData in Node environment", async () => { + if (RUNTIME.type === "node") { + const body = { key: "value" }; + const result = await getRequestBody({ + body, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + } + }); + + it("should return FormData in browser environment", async () => { + if (RUNTIME.type === "browser") { + const formData = new (await import("form-data")).default(); + formData.append("key", "value"); + const result = await getRequestBody({ + body: formData, + type: "file", + }); + expect(result).toBe(formData); + } + }); + + it("should stringify body if not FormData in browser environment", async () => { + if (RUNTIME.type === "browser") { + const body = { key: "value" }; + const result = await getRequestBody({ + body, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + } + }); + + it("should return the Uint8Array", async () => { + const input = new Uint8Array([1, 2, 3]); + const result = await getRequestBody({ + body: input, + type: "bytes", + }); + expect(result).toBe(input); + }); + + it("should return the input for content-type 'application/x-www-form-urlencoded'", async () => { + const input = "key=value&another=param"; + const result = await getRequestBody({ + body: input, + type: "other", + }); + expect(result).toBe(input); + }); + + it("should JSON stringify objects", async () => { + const input = { key: "value" }; + const result = await getRequestBody({ + body: input, + type: "json", + }); + expect(result).toBe('{"key":"value"}'); + }); +}); diff --git a/tests/unit/fetcher/getResponseBody.test.ts b/tests/unit/fetcher/getResponseBody.test.ts new file mode 100644 index 000000000..1030c517c --- /dev/null +++ b/tests/unit/fetcher/getResponseBody.test.ts @@ -0,0 +1,64 @@ +import { RUNTIME } from "../../../src/core/runtime"; +import { getResponseBody } from "../../../src/core/fetcher/getResponseBody"; +import { chooseStreamWrapper } from "../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; + +describe("Test getResponseBody", () => { + it("should handle blob response type", async () => { + const mockBlob = new Blob(["test"], { type: "text/plain" }); + const mockResponse = new Response(mockBlob); + const result = await getResponseBody(mockResponse, "blob"); + // @ts-expect-error + expect(result.constructor.name).toBe("Blob"); + }); + + it("should handle sse response type", async () => { + if (RUNTIME.type === "node") { + const mockStream = new ReadableStream(); + const mockResponse = new Response(mockStream); + const result = await getResponseBody(mockResponse, "sse"); + expect(result).toBe(mockStream); + } + }); + + it("should handle streaming response type", async () => { + if (RUNTIME.type === "node") { + const mockStream = new ReadableStream(); + const mockResponse = new Response(mockStream); + const result = await getResponseBody(mockResponse, "streaming"); + // need to reinstantiate string as a result of locked state in Readable Stream after registration with Response + expect(JSON.stringify(result)).toBe(JSON.stringify(await chooseStreamWrapper(new ReadableStream()))); + } + }); + + it("should handle text response type", async () => { + const mockResponse = new Response("test text"); + const result = await getResponseBody(mockResponse, "text"); + expect(result).toBe("test text"); + }); + + it("should handle JSON response", async () => { + const mockJson = { key: "value" }; + const mockResponse = new Response(JSON.stringify(mockJson)); + const result = await getResponseBody(mockResponse); + expect(result).toEqual(mockJson); + }); + + it("should handle empty response", async () => { + const mockResponse = new Response(""); + const result = await getResponseBody(mockResponse); + expect(result).toBeUndefined(); + }); + + it("should handle non-JSON response", async () => { + const mockResponse = new Response("invalid json"); + const result = await getResponseBody(mockResponse); + expect(result).toEqual({ + ok: false, + error: { + reason: "non-json", + statusCode: 200, + rawBody: "invalid json", + }, + }); + }); +}); diff --git a/tests/unit/fetcher/makeRequest.test.ts b/tests/unit/fetcher/makeRequest.test.ts new file mode 100644 index 000000000..43ed9d11b --- /dev/null +++ b/tests/unit/fetcher/makeRequest.test.ts @@ -0,0 +1,53 @@ +import { makeRequest } from "../../../src/core/fetcher/makeRequest"; + +describe("Test makeRequest", () => { + const mockPostUrl = "https://httpbin.org/post"; + const mockGetUrl = "https://httpbin.org/get"; + const mockHeaders = { "Content-Type": "application/json" }; + const mockBody = JSON.stringify({ key: "value" }); + + let mockFetch: jest.Mock; + + beforeEach(() => { + mockFetch = jest.fn(); + mockFetch.mockResolvedValue(new Response(JSON.stringify({ test: "successful" }), { status: 200 })); + }); + + it("should handle POST request correctly", async () => { + const response = await makeRequest(mockFetch, mockPostUrl, "POST", mockHeaders, mockBody); + const responseBody = await response.json(); + expect(responseBody).toEqual({ test: "successful" }); + expect(mockFetch).toHaveBeenCalledTimes(1); + const [calledUrl, calledOptions] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe(mockPostUrl); + expect(calledOptions).toEqual( + expect.objectContaining({ + method: "POST", + headers: mockHeaders, + body: mockBody, + credentials: undefined, + }), + ); + expect(calledOptions.signal).toBeDefined(); + expect(calledOptions.signal).toBeInstanceOf(AbortSignal); + }); + + it("should handle GET request correctly", async () => { + const response = await makeRequest(mockFetch, mockGetUrl, "GET", mockHeaders, undefined); + const responseBody = await response.json(); + expect(responseBody).toEqual({ test: "successful" }); + expect(mockFetch).toHaveBeenCalledTimes(1); + const [calledUrl, calledOptions] = mockFetch.mock.calls[0]; + expect(calledUrl).toBe(mockGetUrl); + expect(calledOptions).toEqual( + expect.objectContaining({ + method: "GET", + headers: mockHeaders, + body: undefined, + credentials: undefined, + }), + ); + expect(calledOptions.signal).toBeDefined(); + expect(calledOptions.signal).toBeInstanceOf(AbortSignal); + }); +}); diff --git a/tests/unit/fetcher/requestWithRetries.test.ts b/tests/unit/fetcher/requestWithRetries.test.ts new file mode 100644 index 000000000..3cdaa40a5 --- /dev/null +++ b/tests/unit/fetcher/requestWithRetries.test.ts @@ -0,0 +1,132 @@ +import { requestWithRetries } from "../../../src/core/fetcher/requestWithRetries"; + +describe("requestWithRetries", () => { + let mockFetch: jest.Mock; + let originalMathRandom: typeof Math.random; + let setTimeoutSpy: jest.SpyInstance; + + beforeEach(() => { + mockFetch = jest.fn(); + originalMathRandom = Math.random; + + // Mock Math.random for consistent jitter + Math.random = jest.fn(() => 0.5); + + jest.useFakeTimers({ doNotFake: ["nextTick"] }); + }); + + afterEach(() => { + Math.random = originalMathRandom; + jest.clearAllMocks(); + jest.clearAllTimers(); + }); + + it("should retry on retryable status codes", async () => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + const retryableStatuses = [408, 429, 500, 502]; + let callCount = 0; + + mockFetch.mockImplementation(async () => { + if (callCount < retryableStatuses.length) { + return new Response("", { status: retryableStatuses[callCount++] }); + } + return new Response("", { status: 200 }); + }); + + const responsePromise = requestWithRetries(() => mockFetch(), retryableStatuses.length); + await jest.runAllTimersAsync(); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(retryableStatuses.length + 1); + expect(response.status).toBe(200); + }); + + it("should respect maxRetries limit", async () => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + const maxRetries = 2; + mockFetch.mockResolvedValue(new Response("", { status: 500 })); + + const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); + await jest.runAllTimersAsync(); + const response = await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(maxRetries + 1); + expect(response.status).toBe(500); + }); + + it("should not retry on success status codes", async () => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + const successStatuses = [200, 201, 202]; + + for (const status of successStatuses) { + mockFetch.mockReset(); + setTimeoutSpy.mockClear(); + mockFetch.mockResolvedValueOnce(new Response("", { status })); + + const responsePromise = requestWithRetries(() => mockFetch(), 3); + await jest.runAllTimersAsync(); + await responsePromise; + + expect(mockFetch).toHaveBeenCalledTimes(1); + expect(setTimeoutSpy).not.toHaveBeenCalled(); + } + }); + + it("should apply correct exponential backoff with jitter", async () => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + mockFetch.mockResolvedValue(new Response("", { status: 500 })); + const maxRetries = 3; + const expectedDelays = [1000, 2000, 4000]; + + const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); + await jest.runAllTimersAsync(); + await responsePromise; + + // Verify setTimeout calls + expect(setTimeoutSpy).toHaveBeenCalledTimes(expectedDelays.length); + + expectedDelays.forEach((delay, index) => { + expect(setTimeoutSpy).toHaveBeenNthCalledWith(index + 1, expect.any(Function), delay); + }); + + expect(mockFetch).toHaveBeenCalledTimes(maxRetries + 1); + }); + + it("should handle concurrent retries independently", async () => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + mockFetch + .mockResolvedValueOnce(new Response("", { status: 500 })) + .mockResolvedValueOnce(new Response("", { status: 500 })) + .mockResolvedValueOnce(new Response("", { status: 200 })) + .mockResolvedValueOnce(new Response("", { status: 200 })); + + const promise1 = requestWithRetries(() => mockFetch(), 1); + const promise2 = requestWithRetries(() => mockFetch(), 1); + + await jest.runAllTimersAsync(); + const [response1, response2] = await Promise.all([promise1, promise2]); + + expect(response1.status).toBe(200); + expect(response2.status).toBe(200); + }); +}); diff --git a/tests/unit/fetcher/signals.test.ts b/tests/unit/fetcher/signals.test.ts new file mode 100644 index 000000000..9cabfa074 --- /dev/null +++ b/tests/unit/fetcher/signals.test.ts @@ -0,0 +1,69 @@ +import { anySignal, getTimeoutSignal } from "../../../src/core/fetcher/signals"; + +describe("Test getTimeoutSignal", () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + + afterEach(() => { + jest.useRealTimers(); + }); + + it("should return an object with signal and abortId", () => { + const { signal, abortId } = getTimeoutSignal(1000); + + expect(signal).toBeDefined(); + expect(abortId).toBeDefined(); + expect(signal).toBeInstanceOf(AbortSignal); + expect(signal.aborted).toBe(false); + }); + + it("should create a signal that aborts after the specified timeout", () => { + const timeoutMs = 5000; + const { signal } = getTimeoutSignal(timeoutMs); + + expect(signal.aborted).toBe(false); + + jest.advanceTimersByTime(timeoutMs - 1); + expect(signal.aborted).toBe(false); + + jest.advanceTimersByTime(1); + expect(signal.aborted).toBe(true); + }); +}); + +describe("Test anySignal", () => { + it("should return an AbortSignal", () => { + const signal = anySignal(new AbortController().signal); + expect(signal).toBeInstanceOf(AbortSignal); + }); + + it("should abort when any of the input signals is aborted", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + const signal = anySignal(controller1.signal, controller2.signal); + + expect(signal.aborted).toBe(false); + controller1.abort(); + expect(signal.aborted).toBe(true); + }); + + it("should handle an array of signals", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + const signal = anySignal([controller1.signal, controller2.signal]); + + expect(signal.aborted).toBe(false); + controller2.abort(); + expect(signal.aborted).toBe(true); + }); + + it("should abort immediately if one of the input signals is already aborted", () => { + const controller1 = new AbortController(); + const controller2 = new AbortController(); + controller1.abort(); + + const signal = anySignal(controller1.signal, controller2.signal); + expect(signal.aborted).toBe(true); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts new file mode 100644 index 000000000..1dc9be0cc --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts @@ -0,0 +1,178 @@ +import { Node18UniversalStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper"; + +describe("Node18UniversalStreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const dest = new WritableStream({ + write(chunk) { + expect(chunk).toEqual(new TextEncoder().encode("test")); + }, + }); + + stream.pipe(dest); + }); + + it("should write to dest when calling pipe to node writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const dest = new (await import("readable-stream")).Writable({ + write(chunk, encoding, callback) { + expect(chunk.toString()).toEqual("test"); + callback(); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new WritableStream({ + write(chunk) { + buffer.push(chunk); + }, + }); + + stream.pipe(dest); + stream.unpipe(dest); + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalled(); + }); + + it("should pause and resume the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new Node18UniversalStreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + const resumeSpy = jest.spyOn(stream, "resume"); + + expect(stream.isPaused).toBe(false); + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + + expect(pauseSpy).toHaveBeenCalled(); + expect(resumeSpy).toHaveBeenCalled(); + }); + + it("should read the stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + expect(await stream.read()).toEqual(new TextEncoder().encode("test")); + expect(await stream.read()).toEqual(new TextEncoder().encode("test")); + }); + + it("should read the stream as text", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("testtest"); + }); + + it("should read the stream as json", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode(JSON.stringify({ test: "test" }))); + controller.close(); + }, + }); + const stream = new Node18UniversalStreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); + + it("should allow use with async iteratable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + let data = ""; + const stream = new Node18UniversalStreamWrapper(rawStream); + for await (const chunk of stream) { + data += new TextDecoder().decode(chunk); + } + + expect(data).toEqual("testtest"); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts new file mode 100644 index 000000000..0c99d3b26 --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts @@ -0,0 +1,124 @@ +import { NodePre18StreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/NodePre18StreamWrapper"; + +describe("NodePre18StreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to node writable stream", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const dest = new (await import("readable-stream")).Writable({ + write(chunk, encoding, callback) { + expect(chunk.toString()).toEqual("test"); + callback(); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new (await import("readable-stream")).Writable({ + write(chunk, encoding, callback) { + buffer.push(chunk); + callback(); + }, + }); + stream.pipe(dest); + stream.unpipe(); + + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalledWith(); + }); + + it("should pause the stream and resume", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + expect(stream.isPaused).toBe(false); + + expect(pauseSpy).toHaveBeenCalledWith(); + }); + + it("should read the stream", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + + expect(await stream.read()).toEqual("test"); + expect(await stream.read()).toEqual("test"); + }); + + it("should read the stream as text", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + const stream = new NodePre18StreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("testtest"); + }); + + it("should read the stream as json", async () => { + const rawStream = (await import("readable-stream")).Readable.from([JSON.stringify({ test: "test" })]); + const stream = new NodePre18StreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); + + it("should allow use with async iteratable stream", async () => { + const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); + let data = ""; + const stream = new NodePre18StreamWrapper(rawStream); + for await (const chunk of stream) { + data += chunk; + } + + expect(data).toEqual("testtest"); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts new file mode 100644 index 000000000..1d171ce6c --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts @@ -0,0 +1,153 @@ +import { UndiciStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/UndiciStreamWrapper"; + +describe("UndiciStreamWrapper", () => { + it("should set encoding to utf-8", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const setEncodingSpy = jest.spyOn(stream, "setEncoding"); + + stream.setEncoding("utf-8"); + + expect(setEncodingSpy).toHaveBeenCalledWith("utf-8"); + }); + + it("should register an event listener for readable", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const onSpy = jest.spyOn(stream, "on"); + + stream.on("readable", () => {}); + + expect(onSpy).toHaveBeenCalledWith("readable", expect.any(Function)); + }); + + it("should remove an event listener for data", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const offSpy = jest.spyOn(stream, "off"); + + const fn = () => {}; + stream.on("data", fn); + stream.off("data", fn); + + expect(offSpy).toHaveBeenCalledWith("data", expect.any(Function)); + }); + + it("should write to dest when calling pipe to writable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + const dest = new WritableStream({ + write(chunk) { + expect(chunk).toEqual(new TextEncoder().encode("test")); + }, + }); + + stream.pipe(dest); + }); + + it("should write nothing when calling pipe and unpipe", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const buffer: Uint8Array[] = []; + const dest = new WritableStream({ + write(chunk) { + buffer.push(chunk); + }, + }); + stream.pipe(dest); + stream.unpipe(dest); + + expect(buffer).toEqual([]); + }); + + it("should destroy the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const destroySpy = jest.spyOn(stream, "destroy"); + + stream.destroy(); + + expect(destroySpy).toHaveBeenCalled(); + }); + + it("should pause and resume the stream", async () => { + const rawStream = new ReadableStream(); + const stream = new UndiciStreamWrapper(rawStream); + const pauseSpy = jest.spyOn(stream, "pause"); + const resumeSpy = jest.spyOn(stream, "resume"); + + expect(stream.isPaused).toBe(false); + stream.pause(); + expect(stream.isPaused).toBe(true); + stream.resume(); + + expect(pauseSpy).toHaveBeenCalled(); + expect(resumeSpy).toHaveBeenCalled(); + }); + + it("should read the stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + expect(await stream.read()).toEqual(new TextEncoder().encode("test")); + expect(await stream.read()).toEqual(new TextEncoder().encode("test")); + }); + + it("should read the stream as text", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + const data = await stream.text(); + + expect(data).toEqual("testtest"); + }); + + it("should read the stream as json", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode(JSON.stringify({ test: "test" }))); + controller.close(); + }, + }); + const stream = new UndiciStreamWrapper(rawStream); + + const data = await stream.json(); + + expect(data).toEqual({ test: "test" }); + }); + + it("should allow use with async iteratable stream", async () => { + const rawStream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("test")); + controller.enqueue(new TextEncoder().encode("test")); + controller.close(); + }, + }); + let data = ""; + const stream = new UndiciStreamWrapper(rawStream); + for await (const chunk of stream) { + data += new TextDecoder().decode(chunk); + } + + expect(data).toEqual("testtest"); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts new file mode 100644 index 000000000..8004e9abb --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts @@ -0,0 +1,43 @@ +import { RUNTIME } from "../../../../src/core/runtime"; +import { Node18UniversalStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper"; +import { NodePre18StreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/NodePre18StreamWrapper"; +import { UndiciStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/UndiciStreamWrapper"; +import { chooseStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; + +describe("chooseStreamWrapper", () => { + beforeEach(() => { + RUNTIME.type = "unknown"; + RUNTIME.parsedVersion = 0; + }); + + it('should return a Node18UniversalStreamWrapper when RUNTIME.type is "node" and RUNTIME.parsedVersion is not null and RUNTIME.parsedVersion is greater than or equal to 18', async () => { + const expected = new Node18UniversalStreamWrapper(new ReadableStream()); + RUNTIME.type = "node"; + RUNTIME.parsedVersion = 18; + + const result = await chooseStreamWrapper(new ReadableStream()); + + expect(JSON.stringify(result)).toBe(JSON.stringify(expected)); + }); + + it('should return a NodePre18StreamWrapper when RUNTIME.type is "node" and RUNTIME.parsedVersion is not null and RUNTIME.parsedVersion is less than 18', async () => { + const stream = await import("readable-stream"); + const expected = new NodePre18StreamWrapper(new stream.Readable()); + + RUNTIME.type = "node"; + RUNTIME.parsedVersion = 16; + + const result = await chooseStreamWrapper(new stream.Readable()); + + expect(JSON.stringify(result)).toEqual(JSON.stringify(expected)); + }); + + it('should return a Undici when RUNTIME.type is not "node"', async () => { + const expected = new UndiciStreamWrapper(new ReadableStream()); + RUNTIME.type = "browser"; + + const result = await chooseStreamWrapper(new ReadableStream()); + + expect(JSON.stringify(result)).toEqual(JSON.stringify(expected)); + }); +}); diff --git a/tests/unit/fetcher/stream-wrappers/webpack.test.ts b/tests/unit/fetcher/stream-wrappers/webpack.test.ts new file mode 100644 index 000000000..ccd07b05e --- /dev/null +++ b/tests/unit/fetcher/stream-wrappers/webpack.test.ts @@ -0,0 +1,42 @@ +import webpack from "webpack"; + +describe("test env compatibility", () => { + test("webpack", () => { + return new Promise((resolve, reject) => { + webpack( + { + mode: "production", + entry: "./src/index.ts", + module: { + rules: [ + { + test: /\.tsx?$/, + use: "ts-loader", + exclude: /node_modules/, + }, + ], + }, + resolve: { + extensions: [".tsx", ".ts", ".jsx", ".js"], + extensionAlias: { + ".js": [".ts", ".js"], + ".jsx": [".tsx", ".jsx"], + }, + }, + }, + (err, stats) => { + try { + expect(err).toBe(null); + if (stats?.hasErrors()) { + console.log(stats?.toString()); + } + expect(stats?.hasErrors()).toBe(false); + resolve(); + } catch (error) { + reject(error); + } + }, + ); + }); + }, 60_000); +}); diff --git a/tests/unit/fetcher/test-file.txt b/tests/unit/fetcher/test-file.txt new file mode 100644 index 000000000..c66d471e3 --- /dev/null +++ b/tests/unit/fetcher/test-file.txt @@ -0,0 +1 @@ +This is a test file! diff --git a/tests/unit/form-data-utils/formDataWrapper.test.ts b/tests/unit/form-data-utils/formDataWrapper.test.ts new file mode 100644 index 000000000..61fd5bfc1 --- /dev/null +++ b/tests/unit/form-data-utils/formDataWrapper.test.ts @@ -0,0 +1,123 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { Node18FormData, WebFormData } from "../../../src/core/form-data-utils/FormDataWrapper"; + +describe("CrossPlatformFormData", () => { + describe("Node18FormData", () => { + let formData: any; + + beforeEach(async () => { + formData = new Node18FormData(); + await formData.setup(); + }); + + it("should append a Readable stream with a specified filename", async () => { + const value = (await import("readable-stream")).Readable.from(["file content"]); + const filename = "testfile.txt"; + + await formData.appendFile("file", value, filename); + + const request = await formData.getRequest(); + const decoder = new TextDecoder("utf-8"); + let data = ""; + for await (const chunk of request.body) { + data += decoder.decode(chunk); + } + expect(data).toContain(filename); + }); + + it("should append a Blob with a specified filename", async () => { + const value = new Blob(["file content"], { type: "text/plain" }); + const filename = "testfile.txt"; + + await formData.appendFile("file", value, filename); + + const request = await formData.getRequest(); + const decoder = new TextDecoder("utf-8"); + let data = ""; + for await (const chunk of request.body) { + data += decoder.decode(chunk); + } + expect(data).toContain(filename); + }); + + it("should append a File with a specified filename", async () => { + const filename = "testfile.txt"; + const value = new (await import("buffer")).File(["file content"], filename); + + await formData.appendFile("file", value); + + const request = await formData.getRequest(); + const decoder = new TextDecoder("utf-8"); + let data = ""; + for await (const chunk of request.body) { + data += decoder.decode(chunk); + } + expect(data).toContain("testfile.txt"); + }); + + it("should append a File with an explicit filename", async () => { + const filename = "testfile.txt"; + const value = new (await import("buffer")).File(["file content"], filename); + + await formData.appendFile("file", value, "test.txt"); + + const request = await formData.getRequest(); + const decoder = new TextDecoder("utf-8"); + let data = ""; + for await (const chunk of request.body) { + data += decoder.decode(chunk); + } + expect(data).toContain("test.txt"); + }); + }); + + describe("WebFormData", () => { + let formData: any; + + beforeEach(async () => { + formData = new WebFormData(); + await formData.setup(); + }); + + it("should append a Readable stream with a specified filename", async () => { + const value = (await import("readable-stream")).Readable.from(["file content"]); + const filename = "testfile.txt"; + + await formData.appendFile("file", value, filename); + + const request = formData.getRequest(); + expect(request.body.get("file").name).toBe(filename); + }); + + it("should append a Blob with a specified filename", async () => { + const value = new Blob(["file content"], { type: "text/plain" }); + const filename = "testfile.txt"; + + await formData.appendFile("file", value, filename); + + const request = formData.getRequest(); + + expect(request.body.get("file").name).toBe(filename); + }); + + it("should append a File with a specified filename", async () => { + const filename = "testfile.txt"; + const value = new (await import("buffer")).File(["file content"], filename); + + await formData.appendFile("file", value); + + const request = formData.getRequest(); + expect(request.body.get("file").name).toBe(filename); + }); + + it("should append a File with an explicit filename", async () => { + const filename = "testfile.txt"; + const value = new (await import("buffer")).File(["file content"], filename); + + await formData.appendFile("file", value, "test.txt"); + + const request = formData.getRequest(); + expect(request.body.get("file").name).toBe("test.txt"); + }); + }); +}); diff --git a/tests/unit/zurg/bigint/bigint.test.ts b/tests/unit/zurg/bigint/bigint.test.ts new file mode 100644 index 000000000..498f143c7 --- /dev/null +++ b/tests/unit/zurg/bigint/bigint.test.ts @@ -0,0 +1,46 @@ +import { bigint } from "../../../../src/core/schemas/builders/bigint"; +import { itJson, itParse, itSchema } from "../utils/itSchema"; +import { itValidateJson, itValidateParse } from "../utils/itValidate"; + +describe("bigint", () => { + itSchema("converts between raw bigint and parsed bigint", bigint(), { + raw: BigInt("9007199254740992"), + parsed: BigInt("9007199254740992"), + }); + + itParse("converts between raw number and parsed bigint", bigint(), { + raw: 10, + parsed: BigInt("10"), + }); + + itParse("converts between raw number and parsed bigint", bigint(), { + raw: BigInt("10"), + parsed: BigInt("10"), + }); + + itJson("converts raw bigint to parsed bigint", bigint(), { + parsed: BigInt("10"), + raw: BigInt("10"), + }); + + itValidateParse("string", bigint(), "42", [ + { + message: 'Expected bigint | number. Received "42".', + path: [], + }, + ]); + + itValidateJson("number", bigint(), 42, [ + { + message: "Expected bigint. Received 42.", + path: [], + }, + ]); + + itValidateJson("string", bigint(), "42", [ + { + message: 'Expected bigint. Received "42".', + path: [], + }, + ]); +}); diff --git a/tests/unit/zurg/date/date.test.ts b/tests/unit/zurg/date/date.test.ts new file mode 100644 index 000000000..2790268a0 --- /dev/null +++ b/tests/unit/zurg/date/date.test.ts @@ -0,0 +1,31 @@ +import { date } from "../../../../src/core/schemas/builders/date"; +import { itSchema } from "../utils/itSchema"; +import { itValidateJson, itValidateParse } from "../utils/itValidate"; + +describe("date", () => { + itSchema("converts between raw ISO string and parsed Date", date(), { + raw: "2022-09-29T05:41:21.939Z", + parsed: new Date("2022-09-29T05:41:21.939Z"), + }); + + itValidateParse("non-string", date(), 42, [ + { + message: "Expected string. Received 42.", + path: [], + }, + ]); + + itValidateParse("non-ISO", date(), "hello world", [ + { + message: 'Expected ISO 8601 date string. Received "hello world".', + path: [], + }, + ]); + + itValidateJson("non-Date", date(), "hello", [ + { + message: 'Expected Date object. Received "hello".', + path: [], + }, + ]); +}); diff --git a/tests/unit/zurg/enum/enum.test.ts b/tests/unit/zurg/enum/enum.test.ts new file mode 100644 index 000000000..d1707325b --- /dev/null +++ b/tests/unit/zurg/enum/enum.test.ts @@ -0,0 +1,30 @@ +import { enum_ } from "../../../../src/core/schemas/builders/enum"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("enum", () => { + itSchemaIdentity(enum_(["A", "B", "C"]), "A"); + + itSchemaIdentity(enum_(["A", "B", "C"]), "D" as any, { + opts: { allowUnrecognizedEnumValues: true }, + }); + + itValidate("invalid enum", enum_(["A", "B", "C"]), "D", [ + { + message: 'Expected enum. Received "D".', + path: [], + }, + ]); + + itValidate( + "non-string", + enum_(["A", "B", "C"]), + [], + [ + { + message: "Expected string. Received list.", + path: [], + }, + ], + ); +}); diff --git a/tests/unit/zurg/lazy/lazy.test.ts b/tests/unit/zurg/lazy/lazy.test.ts new file mode 100644 index 000000000..3a5a338d6 --- /dev/null +++ b/tests/unit/zurg/lazy/lazy.test.ts @@ -0,0 +1,57 @@ +import { Schema } from "../../../../src/core/schemas/Schema"; +import { lazy, list, object, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("lazy", () => { + it("doesn't run immediately", () => { + let wasRun = false; + lazy(() => { + wasRun = true; + return string(); + }); + expect(wasRun).toBe(false); + }); + + it("only runs first time", async () => { + let count = 0; + const schema = lazy(() => { + count++; + return string(); + }); + await schema.parse("hello"); + await schema.json("world"); + expect(count).toBe(1); + }); + + itSchemaIdentity( + lazy(() => object({})), + { foo: "hello" }, + { + title: "passes opts through", + opts: { unrecognizedObjectKeys: "passthrough" }, + }, + ); + + itSchemaIdentity( + lazy(() => object({ foo: string() })), + { foo: "hello" }, + ); + + // eslint-disable-next-line jest/expect-expect + it("self-referencial schema doesn't compile", () => { + () => { + // @ts-expect-error + const a = lazy(() => object({ foo: a })); + }; + }); + + // eslint-disable-next-line jest/expect-expect + it("self-referencial compiles with explicit type", () => { + () => { + interface TreeNode { + children: TreeNode[]; + } + const TreeNode: Schema = lazy(() => object({ children: list(TreeNode) })); + }; + }); +}); diff --git a/tests/unit/zurg/lazy/lazyObject.test.ts b/tests/unit/zurg/lazy/lazyObject.test.ts new file mode 100644 index 000000000..9b443671a --- /dev/null +++ b/tests/unit/zurg/lazy/lazyObject.test.ts @@ -0,0 +1,18 @@ +import { lazyObject, number, object, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("lazy", () => { + itSchemaIdentity( + lazyObject(() => object({ foo: string() })), + { foo: "hello" }, + ); + + itSchemaIdentity( + lazyObject(() => object({ foo: string() })).extend(object({ bar: number() })), + { + foo: "hello", + bar: 42, + }, + { title: "returned schema has object utils" }, + ); +}); diff --git a/tests/unit/zurg/lazy/recursive/a.ts b/tests/unit/zurg/lazy/recursive/a.ts new file mode 100644 index 000000000..8b7d5e40c --- /dev/null +++ b/tests/unit/zurg/lazy/recursive/a.ts @@ -0,0 +1,7 @@ +import { object } from "../../../../../src/core/schemas/builders/object"; +import { schemaB } from "./b"; + +// @ts-expect-error +export const schemaA = object({ + b: schemaB, +}); diff --git a/tests/unit/zurg/lazy/recursive/b.ts b/tests/unit/zurg/lazy/recursive/b.ts new file mode 100644 index 000000000..fb219d54c --- /dev/null +++ b/tests/unit/zurg/lazy/recursive/b.ts @@ -0,0 +1,8 @@ +import { object } from "../../../../../src/core/schemas/builders/object"; +import { optional } from "../../../../../src/core/schemas/builders/schema-utils"; +import { schemaA } from "./a"; + +// @ts-expect-error +export const schemaB = object({ + a: optional(schemaA), +}); diff --git a/tests/unit/zurg/list/list.test.ts b/tests/unit/zurg/list/list.test.ts new file mode 100644 index 000000000..108789b73 --- /dev/null +++ b/tests/unit/zurg/list/list.test.ts @@ -0,0 +1,41 @@ +import { list, object, property, string } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("list", () => { + itSchemaIdentity(list(string()), ["hello", "world"], { + title: "functions as identity when item type is primitive", + }); + + itSchema( + "converts objects correctly", + list( + object({ + helloWorld: property("hello_world", string()), + }), + ), + { + raw: [{ hello_world: "123" }], + parsed: [{ helloWorld: "123" }], + }, + ); + + itValidate("not a list", list(string()), 42, [ + { + path: [], + message: "Expected list. Received 42.", + }, + ]); + + itValidate( + "invalid item type", + list(string()), + [42], + [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ], + ); +}); diff --git a/tests/unit/zurg/literals/stringLiteral.test.ts b/tests/unit/zurg/literals/stringLiteral.test.ts new file mode 100644 index 000000000..fa6c88873 --- /dev/null +++ b/tests/unit/zurg/literals/stringLiteral.test.ts @@ -0,0 +1,21 @@ +import { stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("stringLiteral", () => { + itSchemaIdentity(stringLiteral("A"), "A"); + + itValidate("incorrect string", stringLiteral("A"), "B", [ + { + path: [], + message: 'Expected "A". Received "B".', + }, + ]); + + itValidate("non-string", stringLiteral("A"), 42, [ + { + path: [], + message: 'Expected "A". Received 42.', + }, + ]); +}); diff --git a/tests/unit/zurg/object-like/withParsedProperties.test.ts b/tests/unit/zurg/object-like/withParsedProperties.test.ts new file mode 100644 index 000000000..9f5dd0ed3 --- /dev/null +++ b/tests/unit/zurg/object-like/withParsedProperties.test.ts @@ -0,0 +1,57 @@ +import { object, property, string, stringLiteral } from "../../../../src/core/schemas/builders"; + +describe("withParsedProperties", () => { + it("Added properties included on parsed object", async () => { + const schema = object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }).withParsedProperties({ + printFoo: (parsed) => () => parsed.foo, + printHelloWorld: () => () => "Hello world", + helloWorld: "Hello world", + }); + + const parsed = await schema.parse({ raw_foo: "value of foo", bar: "bar" }); + if (!parsed.ok) { + throw new Error("Failed to parse"); + } + expect(parsed.value.printFoo()).toBe("value of foo"); + expect(parsed.value.printHelloWorld()).toBe("Hello world"); + expect(parsed.value.helloWorld).toBe("Hello world"); + }); + + it("Added property is removed on raw object", async () => { + const schema = object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }).withParsedProperties({ + printFoo: (parsed) => () => parsed.foo, + }); + + const original = { raw_foo: "value of foo", bar: "bar" } as const; + const parsed = await schema.parse(original); + if (!parsed.ok) { + throw new Error("Failed to parse()"); + } + + const raw = await schema.json(parsed.value); + + if (!raw.ok) { + throw new Error("Failed to json()"); + } + + expect(raw.value).toEqual(original); + }); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with non-object schema", () => { + () => + object({ + foo: string(), + }) + // @ts-expect-error + .withParsedProperties(42); + }); + }); +}); diff --git a/tests/unit/zurg/object/extend.test.ts b/tests/unit/zurg/object/extend.test.ts new file mode 100644 index 000000000..109547137 --- /dev/null +++ b/tests/unit/zurg/object/extend.test.ts @@ -0,0 +1,89 @@ +import { boolean, object, property, string, stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; + +describe("extend", () => { + itSchemaIdentity( + object({ + foo: string(), + }).extend( + object({ + bar: stringLiteral("bar"), + }), + ), + { + foo: "", + bar: "bar", + } as const, + { + title: "extended properties are included in schema", + }, + ); + + itSchemaIdentity( + object({ + foo: string(), + }) + .extend( + object({ + bar: stringLiteral("bar"), + }), + ) + .extend( + object({ + baz: boolean(), + }), + ), + { + foo: "", + bar: "bar", + baz: true, + } as const, + { + title: "extensions can be extended", + }, + ); + + itSchema( + "converts nested object", + object({ + item: object({ + helloWorld: property("hello_world", string()), + }), + }).extend( + object({ + goodbye: property("goodbye_raw", string()), + }), + ), + { + raw: { item: { hello_world: "yo" }, goodbye_raw: "peace" }, + parsed: { item: { helloWorld: "yo" }, goodbye: "peace" }, + }, + ); + + itSchema( + "extensions work with raw/parsed property name conversions", + object({ + item: property("item_raw", string()), + }).extend( + object({ + goodbye: property("goodbye_raw", string()), + }), + ), + { + raw: { item_raw: "hi", goodbye_raw: "peace" }, + parsed: { item: "hi", goodbye: "peace" }, + }, + ); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with non-object schema", () => { + () => + object({ + foo: string(), + }) + // @ts-expect-error + .extend([]); + }); + }); +}); diff --git a/tests/unit/zurg/object/object.test.ts b/tests/unit/zurg/object/object.test.ts new file mode 100644 index 000000000..a8d9fe0a1 --- /dev/null +++ b/tests/unit/zurg/object/object.test.ts @@ -0,0 +1,255 @@ +import { any, number, object, property, string, stringLiteral, unknown } from "../../../../src/core/schemas/builders"; +import { itJson, itParse, itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("object", () => { + itSchemaIdentity( + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { + foo: "", + bar: "bar", + }, + { + title: "functions as identity when values are primitives and property() isn't used", + }, + ); + + itSchema( + "uses raw key from property()", + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { raw_foo: "foo", bar: "bar" }, + parsed: { foo: "foo", bar: "bar" }, + }, + ); + + itSchema( + "keys with unknown type can be omitted", + object({ + foo: unknown(), + }), + { + raw: {}, + parsed: {}, + }, + ); + + itSchema( + "keys with any type can be omitted", + object({ + foo: any(), + }), + { + raw: {}, + parsed: {}, + }, + ); + + describe("unrecognizedObjectKeys", () => { + describe("parse", () => { + itParse( + 'includes unknown values when unrecognizedObjectKeys === "passthrough"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "passthrough", + }, + }, + ); + + itParse( + 'strips unknown values when unrecognizedObjectKeys === "strip"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + }, + opts: { + unrecognizedObjectKeys: "strip", + }, + }, + ); + }); + + describe("json", () => { + itJson( + 'includes unknown values when unrecognizedObjectKeys === "passthrough"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "passthrough", + }, + }, + ); + + itJson( + 'strips unknown values when unrecognizedObjectKeys === "strip"', + object({ + foo: property("raw_foo", string()), + bar: stringLiteral("bar"), + }), + { + raw: { + raw_foo: "foo", + bar: "bar", + }, + parsed: { + foo: "foo", + bar: "bar", + // @ts-expect-error + baz: "yoyo", + }, + opts: { + unrecognizedObjectKeys: "strip", + }, + }, + ); + }); + }); + + describe("nullish properties", () => { + itSchema("missing properties are not added", object({ foo: property("raw_foo", string().optional()) }), { + raw: {}, + parsed: {}, + }); + + itSchema("undefined properties are not dropped", object({ foo: property("raw_foo", string().optional()) }), { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + }); + + itSchema("null properties are not dropped", object({ foo: property("raw_foo", string().optional()) }), { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + }); + + describe("extensions", () => { + itSchema( + "undefined properties are not dropped", + object({}).extend(object({ foo: property("raw_foo", string().optional()) })), + { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + }, + ); + + describe("parse()", () => { + itParse( + "null properties are not dropped", + object({}).extend(object({ foo: property("raw_foo", string().optional()) })), + { + raw: { raw_foo: null }, + parsed: { foo: undefined }, + }, + ); + }); + }); + }); + + itValidate( + "missing property", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { foo: "hello" }, + [ + { + path: [], + message: 'Missing required key "bar"', + }, + ], + ); + + itValidate( + "extra property", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + { foo: "hello", bar: "bar", baz: 42 }, + [ + { + path: ["baz"], + message: 'Unexpected key "baz"', + }, + ], + ); + + itValidate( + "not an object", + object({ + foo: string(), + bar: stringLiteral("bar"), + }), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ], + ); + + itValidate( + "nested validation error", + object({ + foo: object({ + bar: number(), + }), + }), + { foo: { bar: "hello" } }, + [ + { + path: ["foo", "bar"], + message: 'Expected number. Received "hello".', + }, + ], + ); +}); diff --git a/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts b/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts new file mode 100644 index 000000000..efcd83afa --- /dev/null +++ b/tests/unit/zurg/object/objectWithoutOptionalProperties.test.ts @@ -0,0 +1,21 @@ +import { objectWithoutOptionalProperties, string, stringLiteral } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; + +describe("objectWithoutOptionalProperties", () => { + itSchema( + "all properties are required", + objectWithoutOptionalProperties({ + foo: string(), + bar: stringLiteral("bar").optional(), + }), + { + raw: { + foo: "hello", + }, + // @ts-expect-error + parsed: { + foo: "hello", + }, + }, + ); +}); diff --git a/tests/unit/zurg/object/passthrough.test.ts b/tests/unit/zurg/object/passthrough.test.ts new file mode 100644 index 000000000..c8770fca1 --- /dev/null +++ b/tests/unit/zurg/object/passthrough.test.ts @@ -0,0 +1,87 @@ +import { object, string, stringLiteral } from "../../../../src/core/schemas/builders"; +import { itJson, itParse, itSchema } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("passthrough", () => { + const baseSchema = object({ + foo: string(), + bar: stringLiteral("bar"), + }); + + describe("parse", () => { + itParse("includes unknown values", baseSchema.passthrough(), { + raw: { + foo: "hello", + bar: "bar", + baz: "extra", + }, + parsed: { + foo: "hello", + bar: "bar", + baz: "extra", + }, + }); + + itValidate( + "preserves schema validation", + baseSchema.passthrough(), + { + foo: 123, + bar: "bar", + baz: "extra", + }, + [ + { + path: ["foo"], + message: "Expected string. Received 123.", + }, + ], + ); + }); + + describe("json", () => { + itJson("includes unknown values", baseSchema.passthrough(), { + raw: { + foo: "hello", + bar: "bar", + + baz: "extra", + }, + parsed: { + foo: "hello", + bar: "bar", + + baz: "extra", + }, + }); + + itValidate( + "preserves schema validation", + baseSchema.passthrough(), + { + foo: "hello", + bar: "wrong", + baz: "extra", + }, + [ + { + path: ["bar"], + message: 'Expected "bar". Received "wrong".', + }, + ], + ); + }); + + itSchema("preserves schema validation in both directions", baseSchema.passthrough(), { + raw: { + foo: "hello", + bar: "bar", + extra: 42, + }, + parsed: { + foo: "hello", + bar: "bar", + extra: 42, + }, + }); +}); diff --git a/tests/unit/zurg/primitives/any.test.ts b/tests/unit/zurg/primitives/any.test.ts new file mode 100644 index 000000000..1adbbe2a8 --- /dev/null +++ b/tests/unit/zurg/primitives/any.test.ts @@ -0,0 +1,6 @@ +import { any } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("any", () => { + itSchemaIdentity(any(), true); +}); diff --git a/tests/unit/zurg/primitives/boolean.test.ts b/tests/unit/zurg/primitives/boolean.test.ts new file mode 100644 index 000000000..897a8295d --- /dev/null +++ b/tests/unit/zurg/primitives/boolean.test.ts @@ -0,0 +1,14 @@ +import { boolean } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("boolean", () => { + itSchemaIdentity(boolean(), true); + + itValidate("non-boolean", boolean(), {}, [ + { + path: [], + message: "Expected boolean. Received object.", + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/number.test.ts b/tests/unit/zurg/primitives/number.test.ts new file mode 100644 index 000000000..2d01415a6 --- /dev/null +++ b/tests/unit/zurg/primitives/number.test.ts @@ -0,0 +1,14 @@ +import { number } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("number", () => { + itSchemaIdentity(number(), 42); + + itValidate("non-number", number(), "hello", [ + { + path: [], + message: 'Expected number. Received "hello".', + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/string.test.ts b/tests/unit/zurg/primitives/string.test.ts new file mode 100644 index 000000000..57b236878 --- /dev/null +++ b/tests/unit/zurg/primitives/string.test.ts @@ -0,0 +1,14 @@ +import { string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("string", () => { + itSchemaIdentity(string(), "hello"); + + itValidate("non-string", string(), 42, [ + { + path: [], + message: "Expected string. Received 42.", + }, + ]); +}); diff --git a/tests/unit/zurg/primitives/unknown.test.ts b/tests/unit/zurg/primitives/unknown.test.ts new file mode 100644 index 000000000..4d17a7dbd --- /dev/null +++ b/tests/unit/zurg/primitives/unknown.test.ts @@ -0,0 +1,6 @@ +import { unknown } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; + +describe("unknown", () => { + itSchemaIdentity(unknown(), true); +}); diff --git a/tests/unit/zurg/record/record.test.ts b/tests/unit/zurg/record/record.test.ts new file mode 100644 index 000000000..e07f3e7cb --- /dev/null +++ b/tests/unit/zurg/record/record.test.ts @@ -0,0 +1,34 @@ +import { number, record, string } from "../../../../src/core/schemas/builders"; +import { itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("record", () => { + itSchemaIdentity(record(string(), string()), { hello: "world" }); + itSchemaIdentity(record(number(), string()), { 42: "world" }); + + itValidate( + "non-record", + record(number(), string()), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ], + ); + + itValidate("invalid key type", record(number(), string()), { hello: "world" }, [ + { + path: ["hello (key)"], + message: 'Expected number. Received "hello".', + }, + ]); + + itValidate("invalid value type", record(string(), number()), { hello: "world" }, [ + { + path: ["hello"], + message: 'Expected number. Received "world".', + }, + ]); +}); diff --git a/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts b/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts new file mode 100644 index 000000000..2cd9b1251 --- /dev/null +++ b/tests/unit/zurg/schema-utils/getSchemaUtils.test.ts @@ -0,0 +1,83 @@ +import { object, string } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; + +describe("getSchemaUtils", () => { + describe("optional()", () => { + itSchema("optional fields allow original schema", string().optional(), { + raw: "hello", + parsed: "hello", + }); + + itSchema("optional fields are not required", string().optional(), { + raw: null, + parsed: undefined, + }); + }); + + describe("transform()", () => { + itSchema( + "transorm and untransform run correctly", + string().transform({ + transform: (x) => x + "X", + untransform: (x) => (x as string).slice(0, -1), + }), + { + raw: "hello", + parsed: "helloX", + }, + ); + }); + + describe("parseOrThrow()", () => { + it("parses valid value", async () => { + const value = string().parseOrThrow("hello"); + expect(value).toBe("hello"); + }); + + it("throws on invalid value", async () => { + const value = () => object({ a: string(), b: string() }).parseOrThrow({ a: 24 }); + expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); + }); + }); + + describe("jsonOrThrow()", () => { + it("serializes valid value", async () => { + const value = string().jsonOrThrow("hello"); + expect(value).toBe("hello"); + }); + + it("throws on invalid value", async () => { + const value = () => object({ a: string(), b: string() }).jsonOrThrow({ a: 24 }); + expect(value).toThrowError(new Error('a: Expected string. Received 24.; Missing required key "b"')); + }); + }); + + describe("omitUndefined", () => { + it("serializes undefined as null", async () => { + const value = object({ + a: string().optional(), + b: string().optional(), + }).jsonOrThrow({ + a: "hello", + b: undefined, + }); + expect(value).toEqual({ a: "hello", b: null }); + }); + + it("omits undefined values", async () => { + const value = object({ + a: string().optional(), + b: string().optional(), + }).jsonOrThrow( + { + a: "hello", + b: undefined, + }, + { + omitUndefined: true, + }, + ); + expect(value).toEqual({ a: "hello" }); + }); + }); +}); diff --git a/tests/unit/zurg/schema.test.ts b/tests/unit/zurg/schema.test.ts new file mode 100644 index 000000000..13842ff40 --- /dev/null +++ b/tests/unit/zurg/schema.test.ts @@ -0,0 +1,78 @@ +import { + boolean, + discriminant, + list, + number, + object, + string, + stringLiteral, + union, +} from "../../../src/core/schemas/builders"; +import { booleanLiteral } from "../../../src/core/schemas/builders/literals/booleanLiteral"; +import { property } from "../../../src/core/schemas/builders/object/property"; +import { itSchema } from "./utils/itSchema"; + +describe("Schema", () => { + itSchema( + "large nested object", + object({ + a: string(), + b: stringLiteral("b value"), + c: property( + "raw_c", + list( + object({ + animal: union(discriminant("type", "_type"), { + dog: object({ value: boolean() }), + cat: object({ value: property("raw_cat", number()) }), + }), + }), + ), + ), + d: property("raw_d", boolean()), + e: booleanLiteral(true), + }), + { + raw: { + a: "hello", + b: "b value", + raw_c: [ + { + animal: { + _type: "dog", + value: true, + }, + }, + { + animal: { + _type: "cat", + raw_cat: 42, + }, + }, + ], + raw_d: false, + e: true, + }, + parsed: { + a: "hello", + b: "b value", + c: [ + { + animal: { + type: "dog", + value: true, + }, + }, + { + animal: { + type: "cat", + value: 42, + }, + }, + ], + d: false, + e: true, + }, + }, + ); +}); diff --git a/tests/unit/zurg/set/set.test.ts b/tests/unit/zurg/set/set.test.ts new file mode 100644 index 000000000..53a1652c8 --- /dev/null +++ b/tests/unit/zurg/set/set.test.ts @@ -0,0 +1,48 @@ +import { set, string } from "../../../../src/core/schemas/builders"; +import { itSchema } from "../utils/itSchema"; +import { itValidateJson, itValidateParse } from "../utils/itValidate"; + +describe("set", () => { + itSchema("converts between raw list and parsed Set", set(string()), { + raw: ["A", "B"], + parsed: new Set(["A", "B"]), + }); + + itValidateParse("not a list", set(string()), 42, [ + { + path: [], + message: "Expected list. Received 42.", + }, + ]); + + itValidateJson( + "not a Set", + set(string()), + [], + [ + { + path: [], + message: "Expected Set. Received list.", + }, + ], + ); + + itValidateParse( + "invalid item type", + set(string()), + [42], + [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ], + ); + + itValidateJson("invalid item type", set(string()), new Set([42]), [ + { + path: ["[0]"], + message: "Expected string. Received 42.", + }, + ]); +}); diff --git a/tests/unit/zurg/skipValidation.test.ts b/tests/unit/zurg/skipValidation.test.ts new file mode 100644 index 000000000..328355594 --- /dev/null +++ b/tests/unit/zurg/skipValidation.test.ts @@ -0,0 +1,44 @@ +/* eslint-disable no-console */ +import { boolean, number, object, property, string, undiscriminatedUnion } from "../../../src/core/schemas/builders"; + +describe("skipValidation", () => { + it("allows data that doesn't conform to the schema", async () => { + const warningLogs: string[] = []; + const originalConsoleWarn = console.warn; + console.warn = (...args) => warningLogs.push(args.join(" ")); + + const schema = object({ + camelCase: property("snake_case", string()), + numberProperty: number(), + requiredProperty: boolean(), + anyPrimitive: undiscriminatedUnion([string(), number(), boolean()]), + }); + + const parsed = await schema.parse( + { + snake_case: "hello", + numberProperty: "oops", + anyPrimitive: true, + }, + { + skipValidation: true, + }, + ); + + expect(parsed).toEqual({ + ok: true, + value: { + camelCase: "hello", + numberProperty: "oops", + anyPrimitive: true, + }, + }); + + expect(warningLogs).toEqual([ + `Failed to validate. + - numberProperty: Expected number. Received "oops".`, + ]); + + console.warn = originalConsoleWarn; + }); +}); diff --git a/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts b/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts new file mode 100644 index 000000000..e0ddb21b4 --- /dev/null +++ b/tests/unit/zurg/undiscriminated-union/undiscriminatedUnion.test.ts @@ -0,0 +1,44 @@ +import { number, object, property, string, undiscriminatedUnion } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; + +describe("undiscriminatedUnion", () => { + itSchemaIdentity(undiscriminatedUnion([string(), number()]), "hello world"); + + itSchemaIdentity(undiscriminatedUnion([object({ hello: string() }), object({ goodbye: string() })]), { + goodbye: "foo", + }); + + itSchema( + "Correctly transforms", + undiscriminatedUnion([object({ hello: string() }), object({ helloWorld: property("hello_world", string()) })]), + { + raw: { hello_world: "foo " }, + parsed: { helloWorld: "foo " }, + }, + ); + + it("Returns errors for all variants", async () => { + const result = await undiscriminatedUnion([string(), number()]).parse(true); + if (result.ok) { + throw new Error("Unexpectedly passed validation"); + } + expect(result.errors).toEqual([ + { + message: "[Variant 0] Expected string. Received true.", + path: [], + }, + { + message: "[Variant 1] Expected number. Received true.", + path: [], + }, + ]); + }); + + describe("compile", () => { + // eslint-disable-next-line jest/expect-expect + it("doesn't compile with zero members", () => { + // @ts-expect-error + () => undiscriminatedUnion([]); + }); + }); +}); diff --git a/tests/unit/zurg/union/union.test.ts b/tests/unit/zurg/union/union.test.ts new file mode 100644 index 000000000..1f5d7a8fa --- /dev/null +++ b/tests/unit/zurg/union/union.test.ts @@ -0,0 +1,113 @@ +import { boolean, discriminant, number, object, string, union } from "../../../../src/core/schemas/builders"; +import { itSchema, itSchemaIdentity } from "../utils/itSchema"; +import { itValidate } from "../utils/itValidate"; + +describe("union", () => { + itSchemaIdentity( + union("type", { + lion: object({ + meows: boolean(), + }), + giraffe: object({ + heightInInches: number(), + }), + }), + { type: "lion", meows: true }, + { title: "doesn't transform discriminant when it's a string" }, + ); + + itSchema( + "transforms discriminant when it's a discriminant()", + union(discriminant("type", "_type"), { + lion: object({ meows: boolean() }), + giraffe: object({ heightInInches: number() }), + }), + { + raw: { _type: "lion", meows: true }, + parsed: { type: "lion", meows: true }, + }, + ); + + describe("allowUnrecognizedUnionMembers", () => { + itSchema( + "transforms discriminant & passes through values when discriminant value is unrecognized", + union(discriminant("type", "_type"), { + lion: object({ meows: boolean() }), + giraffe: object({ heightInInches: number() }), + }), + { + // @ts-expect-error + raw: { _type: "moose", isAMoose: true }, + // @ts-expect-error + parsed: { type: "moose", isAMoose: true }, + opts: { + allowUnrecognizedUnionMembers: true, + }, + }, + ); + }); + + describe("withParsedProperties", () => { + it("Added property is included on parsed object", async () => { + const schema = union("type", { + lion: object({}), + tiger: object({ value: string() }), + }).withParsedProperties({ + printType: (parsed) => () => parsed.type, + }); + + const parsed = await schema.parse({ type: "lion" }); + if (!parsed.ok) { + throw new Error("Failed to parse"); + } + expect(parsed.value.printType()).toBe("lion"); + }); + }); + + itValidate( + "non-object", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + [], + [ + { + path: [], + message: "Expected object. Received list.", + }, + ], + ); + + itValidate( + "missing discriminant", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + {}, + [ + { + path: [], + message: 'Missing discriminant ("type")', + }, + ], + ); + + itValidate( + "unrecognized discriminant value", + union("type", { + lion: object({}), + tiger: object({ value: string() }), + }), + { + type: "bear", + }, + [ + { + path: ["type"], + message: 'Expected enum. Received "bear".', + }, + ], + ); +}); diff --git a/tests/unit/zurg/utils/itSchema.ts b/tests/unit/zurg/utils/itSchema.ts new file mode 100644 index 000000000..82a538878 --- /dev/null +++ b/tests/unit/zurg/utils/itSchema.ts @@ -0,0 +1,78 @@ +/* eslint-disable jest/no-export */ +import { Schema, SchemaOptions } from "../../../../src/core/schemas/Schema"; + +export function itSchemaIdentity( + schema: Schema, + value: T, + { title = "functions as identity", opts }: { title?: string; opts?: SchemaOptions } = {}, +): void { + itSchema(title, schema, { raw: value, parsed: value, opts }); +} + +export function itSchema( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + only = false, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + only?: boolean; + }, +): void { + // eslint-disable-next-line jest/valid-title + (only ? describe.only : describe)(title, () => { + itParse("parse()", schema, { raw, parsed, opts }); + itJson("json()", schema, { raw, parsed, opts }); + }); +} + +export function itParse( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + }, +): void { + // eslint-disable-next-line jest/valid-title + it(title, () => { + const maybeValid = schema.parse(raw, opts); + if (!maybeValid.ok) { + throw new Error("Failed to parse() " + JSON.stringify(maybeValid.errors, undefined, 4)); + } + expect(maybeValid.value).toStrictEqual(parsed); + }); +} + +export function itJson( + title: string, + schema: Schema, + { + raw, + parsed, + opts, + }: { + raw: Raw; + parsed: Parsed; + opts?: SchemaOptions; + }, +): void { + // eslint-disable-next-line jest/valid-title + it(title, () => { + const maybeValid = schema.json(parsed, opts); + if (!maybeValid.ok) { + throw new Error("Failed to json() " + JSON.stringify(maybeValid.errors, undefined, 4)); + } + expect(maybeValid.value).toStrictEqual(raw); + }); +} diff --git a/tests/unit/zurg/utils/itValidate.ts b/tests/unit/zurg/utils/itValidate.ts new file mode 100644 index 000000000..ead1ca70b --- /dev/null +++ b/tests/unit/zurg/utils/itValidate.ts @@ -0,0 +1,56 @@ +/* eslint-disable jest/no-export */ +import { Schema, SchemaOptions, ValidationError } from "../../../../src/core/schemas/Schema"; + +export function itValidate( + title: string, + schema: Schema, + input: unknown, + errors: ValidationError[], + opts?: SchemaOptions, +): void { + // eslint-disable-next-line jest/valid-title + describe("parse()", () => { + itValidateParse(title, schema, input, errors, opts); + }); + describe("json()", () => { + itValidateJson(title, schema, input, errors, opts); + }); +} + +export function itValidateParse( + title: string, + schema: Schema, + raw: unknown, + errors: ValidationError[], + opts?: SchemaOptions, +): void { + describe("parse", () => { + // eslint-disable-next-line jest/valid-title + it(title, async () => { + const maybeValid = await schema.parse(raw, opts); + if (maybeValid.ok) { + throw new Error("Value passed validation"); + } + expect(maybeValid.errors).toStrictEqual(errors); + }); + }); +} + +export function itValidateJson( + title: string, + schema: Schema, + parsed: unknown, + errors: ValidationError[], + opts?: SchemaOptions, +): void { + describe("json", () => { + // eslint-disable-next-line jest/valid-title + it(title, async () => { + const maybeValid = await schema.json(parsed, opts); + if (maybeValid.ok) { + throw new Error("Value passed validation"); + } + expect(maybeValid.errors).toStrictEqual(errors); + }); + }); +} diff --git a/tsconfig.base.json b/tsconfig.base.json deleted file mode 100644 index ed7c2121b..000000000 --- a/tsconfig.base.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "include": ["src", "types"], - "compilerOptions": { - "importHelpers": true, - "declaration": true, - "sourceMap": true, - "rootDir": "./src", - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "moduleResolution": "node", - "jsx": "react", - "esModuleInterop": true, - "useUnknownInCatchVariables": false - } -} diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json deleted file mode 100644 index 3459ff47e..000000000 --- a/tsconfig.cjs.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "CommonJS", - "outDir": "dist/cjs", - "declarationDir": "dist/types" - } -} diff --git a/tsconfig.esm.json b/tsconfig.esm.json deleted file mode 100644 index 2da6959d8..000000000 --- a/tsconfig.esm.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "esnext", - "lib": ["esnext"], - "outDir": "dist/esm", - "declarationDir": "dist/types", - "target": "ES2017" - } -} - diff --git a/tsconfig.json b/tsconfig.json index 57d362c9a..1ec87dd77 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,17 @@ { - "include": ["src", "types"], - "compilerOptions": { - "module": "esnext", - "lib": ["esnext"], - "importHelpers": true, - "declaration": true, - "sourceMap": true, - "rootDir": "./src", - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "moduleResolution": "node", - "target": "ES2017", - "jsx": "react", - "esModuleInterop": true - } + "compilerOptions": { + "extendedDiagnostics": true, + "strict": true, + "target": "ES6", + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "baseUrl": "src", + "module": "CommonJS" + }, + "include": ["src"], + "exclude": [] } diff --git a/tsdx.config.js b/tsdx.config.js deleted file mode 100644 index 3072760cb..000000000 --- a/tsdx.config.js +++ /dev/null @@ -1,11 +0,0 @@ -// Not transpiled with TypeScript or Babel, so use plain Es6/Node.js! -module.exports = { - // This function will run for each entry/format/env combination - rollup(config, options) { - config.onwarn = ( warning, next ) => { - if ( warning.code === 'CIRCULAR_DEPENDENCY' ) return; - next( warning ); - }; - return config; // always return a config. - }, -}; diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 000000000..a1e21bea5 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,3405 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ampproject/remapping@^2.2.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" + integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + +"@apimatic/authentication-adapters@^0.5.4": + version "0.5.6" + resolved "https://registry.yarnpkg.com/@apimatic/authentication-adapters/-/authentication-adapters-0.5.6.tgz#47ab7bb3a30055345aa39b22272e4a0f55e8bb6a" + integrity sha512-7/m+KLIpsiO83uWtCBRZKmpDtCLBoW5yIM9sOsHslI6RKbGWXu/cTnIE07nlrePLQhfX0+dO/Jl9vfFKIoLYzw== + dependencies: + "@apimatic/core-interfaces" "^0.2.8" + "@apimatic/http-headers" "^0.3.4" + "@apimatic/http-query" "^0.3.4" + tslib "^2.8.1" + +"@apimatic/axios-client-adapter@^0.3.7": + version "0.3.8" + resolved "https://registry.yarnpkg.com/@apimatic/axios-client-adapter/-/axios-client-adapter-0.3.8.tgz#14eb8af00da12476f602be8e398e39d53621b681" + integrity sha512-nwarzOH9f3O28zRC2HCiP9jLisKIFMDnSFjkFXio/P7X9SOPyTaeTN4K5jiHlpq5O3gChSk26LXiyDIvG1JqVw== + dependencies: + "@apimatic/convert-to-stream" "^0.1.4" + "@apimatic/core-interfaces" "^0.2.8" + "@apimatic/file-wrapper" "^0.3.4" + "@apimatic/http-headers" "^0.3.4" + "@apimatic/http-query" "^0.3.4" + "@apimatic/json-bigint" "^1.2.0" + "@apimatic/schema" "^0.7.15" + axios "^1.7.9" + detect-browser "^5.3.0" + detect-node "^2.1.0" + form-data "^4.0.1" + lodash.flatmap "^4.5.0" + tiny-warning "^1.0.3" + tslib "^2.8.1" + +"@apimatic/convert-to-stream@^0.0.2": + version "0.0.2" + resolved "https://registry.yarnpkg.com/@apimatic/convert-to-stream/-/convert-to-stream-0.0.2.tgz#7d9942071291011c4576de97619d974face8acaa" + integrity sha512-1DRg17ItExfMYsXwjt6WIjJSCgV5RGg3fHPLgYD44/YmiU+7suWj7YfPKKUqmNcnJ/AvMh4lG1+tHrfOT01zXw== + +"@apimatic/convert-to-stream@^0.1.4": + version "0.1.4" + resolved "https://registry.yarnpkg.com/@apimatic/convert-to-stream/-/convert-to-stream-0.1.4.tgz#a5c89173ec65075442d98ad5e57327fe66c4f480" + integrity sha512-QlAUUN/NT4IbajpnFw+w+4GAPwuTtPAEUMBGGKX4M2XLuv8QA4Asag6V19gLsnWFdzcu7mwpjGn+O4tsOlArMQ== + dependencies: + tslib "2.8.1" + +"@apimatic/core-interfaces@^0.2.8": + version "0.2.8" + resolved "https://registry.yarnpkg.com/@apimatic/core-interfaces/-/core-interfaces-0.2.8.tgz#31f7cd624eba50f711435e0a17cc0f4d079bdf24" + integrity sha512-3o9CkUMeRrg8uE1dDqcvh3MOFIOPqdNRmpFEzhJa5oc0IqHHVhCSU21V9jBe0jB1+Zxc9uHWsq55QXFpliFq8Q== + dependencies: + "@apimatic/file-wrapper" "^0.3.4" + tslib "^2.8.1" + +"@apimatic/core@^0.10.16": + version "0.10.17" + resolved "https://registry.yarnpkg.com/@apimatic/core/-/core-0.10.17.tgz#c011f00da0177697c474522d2af75ee989d8495f" + integrity sha512-8AHBm0Y0cjDDtJBgx+TkGXWLWadG+zltMiew7vmrADT8GGhKX/JfMV0R9ae+E1kmnF+C2g/IH/muNx6+HH15pA== + dependencies: + "@apimatic/convert-to-stream" "^0.0.2" + "@apimatic/core-interfaces" "^0.2.8" + "@apimatic/file-wrapper" "^0.3.4" + "@apimatic/http-headers" "^0.3.4" + "@apimatic/http-query" "^0.3.4" + "@apimatic/json-bigint" "^1.2.0" + "@apimatic/schema" "^0.7.15" + detect-browser "^5.3.0" + detect-node "^2.1.0" + form-data "^4.0.1" + json-ptr "^3.1.1" + lodash.defaultsdeep "^4.6.1" + lodash.flatmap "^4.5.0" + tiny-warning "^1.0.3" + tslib "^2.8.1" + +"@apimatic/file-wrapper@^0.3.4": + version "0.3.4" + resolved "https://registry.yarnpkg.com/@apimatic/file-wrapper/-/file-wrapper-0.3.4.tgz#dd50de21bbe5b08c6ddfb0b21886d54e1ce7d8ce" + integrity sha512-XMY2Zh1pMOY1mGoz9axxR5Q5MDhdyArh2BxSfdJkRe76t2CiXdmw/+kPgBiX9QvXJXc0rcsDClqg4WMxamDepw== + dependencies: + tslib "2.8.1" + +"@apimatic/http-headers@^0.3.4": + version "0.3.4" + resolved "https://registry.yarnpkg.com/@apimatic/http-headers/-/http-headers-0.3.4.tgz#15289061996e6b6536e5d0f657724a2f192e2c8e" + integrity sha512-ECKyQt9QaRu8nwFJS50HMKKhs+lO191URDUQ5CRzgtGPudmrrmB35I1lz3oVjXelyoJANog2IEGhx3nqoSYD7Q== + dependencies: + tslib "2.8.1" + +"@apimatic/http-query@^0.3.4": + version "0.3.4" + resolved "https://registry.yarnpkg.com/@apimatic/http-query/-/http-query-0.3.4.tgz#e35a46efe531fe7bf4df739ab08298fc2b1fbca1" + integrity sha512-6s5DS7dMq1lEJ+9AsTIiMyTXGX9xX5vOnduNSw8csSaQJ5lwMP4O4QzHFT3IFrvctKp/pfS75P0HYGV+9ciltg== + dependencies: + "@apimatic/file-wrapper" "^0.3.4" + tslib "^2.8.1" + +"@apimatic/json-bigint@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@apimatic/json-bigint/-/json-bigint-1.2.0.tgz#05223455ec135976fe7a55456c2d21a3bbde56d8" + integrity sha512-+bmVzYMdZu0Ya5L+my4FXFUih54OvQA/qlZsFOYdOoostyUuB27UDrVWQs/WVCmS0ADdo5vTU0eeTrrBkHoySw== + +"@apimatic/schema@^0.7.14", "@apimatic/schema@^0.7.15": + version "0.7.15" + resolved "https://registry.yarnpkg.com/@apimatic/schema/-/schema-0.7.15.tgz#35c1a11d5d0b8dec74906cb72710e323605f002c" + integrity sha512-wJVQPYYJwG9TuMJLvddH7VJ7x5tRK3ycZvcsheeEL9xD2BmTIV5w5ni14gjvmLIbivRsHmMcUkCVhIEssjg+Zg== + dependencies: + tslib "^2.8.1" + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.0", "@babel/code-frame@^7.26.2": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" + integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== + dependencies: + "@babel/helper-validator-identifier" "^7.25.9" + js-tokens "^4.0.0" + picocolors "^1.0.0" + +"@babel/compat-data@^7.26.5": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.5.tgz#df93ac37f4417854130e21d72c66ff3d4b897fc7" + integrity sha512-XvcZi1KWf88RVbF9wn8MN6tYFloU5qX8KjuF3E1PVBmJ9eypXfs4GRiJwLuTZL0iSnJUKn1BFPa5BPZZJyFzPg== + +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.0.tgz#d78b6023cc8f3114ccf049eb219613f74a747b40" + integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.26.0" + "@babel/generator" "^7.26.0" + "@babel/helper-compilation-targets" "^7.25.9" + "@babel/helper-module-transforms" "^7.26.0" + "@babel/helpers" "^7.26.0" + "@babel/parser" "^7.26.0" + "@babel/template" "^7.25.9" + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.26.0" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.26.0", "@babel/generator@^7.26.5", "@babel/generator@^7.7.2": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.5.tgz#e44d4ab3176bbcaf78a5725da5f1dc28802a9458" + integrity sha512-2caSP6fN9I7HOe6nqhtft7V4g7/V/gfDsC3Ag4W7kEzzvRGKqiv0pu0HogPiZ3KaVSoNDhUws6IJjDjpfmYIXw== + dependencies: + "@babel/parser" "^7.26.5" + "@babel/types" "^7.26.5" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^3.0.2" + +"@babel/helper-compilation-targets@^7.25.9": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz#75d92bb8d8d51301c0d49e52a65c9a7fe94514d8" + integrity sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA== + dependencies: + "@babel/compat-data" "^7.26.5" + "@babel/helper-validator-option" "^7.25.9" + browserslist "^4.24.0" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-module-imports@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" + integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== + dependencies: + "@babel/traverse" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/helper-module-transforms@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz#8ce54ec9d592695e58d84cd884b7b5c6a2fdeeae" + integrity sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw== + dependencies: + "@babel/helper-module-imports" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@babel/traverse" "^7.25.9" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.8.0": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz#18580d00c9934117ad719392c4f6585c9333cc35" + integrity sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg== + +"@babel/helper-string-parser@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" + integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== + +"@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + +"@babel/helper-validator-option@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" + integrity sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw== + +"@babel/helpers@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.0.tgz#30e621f1eba5aa45fe6f4868d2e9154d884119a4" + integrity sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw== + dependencies: + "@babel/template" "^7.25.9" + "@babel/types" "^7.26.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.9", "@babel/parser@^7.26.0", "@babel/parser@^7.26.5": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.5.tgz#6fec9aebddef25ca57a935c86dbb915ae2da3e1f" + integrity sha512-SRJ4jYmXRqV1/Xc+TIVG84WjHBXKlxO9sHQnA2Pf12QQEAp1LOh6kDzNHXcUnbH1QI0FDoPPVOt+vyUDucxpaw== + dependencies: + "@babel/types" "^7.26.5" + +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-bigint@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-class-static-block@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" + integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-import-attributes@^7.24.7": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz#3b1412847699eea739b4f2602c74ce36f6b0b0f7" + integrity sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-syntax-import-meta@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-jsx@^7.7.2": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz#a34313a178ea56f1951599b929c1ceacee719290" + integrity sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-private-property-in-object@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" + integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-top-level-await@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-typescript@^7.7.2": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz#67dda2b74da43727cf21d46cf9afef23f4365399" + integrity sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ== + dependencies: + "@babel/helper-plugin-utils" "^7.25.9" + +"@babel/template@^7.25.9", "@babel/template@^7.3.3": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" + integrity sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/types" "^7.25.9" + +"@babel/traverse@^7.25.9": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.5.tgz#6d0be3e772ff786456c1a37538208286f6e79021" + integrity sha512-rkOSPOw+AXbgtwUga3U4u8RpoK9FEFWBNAlTpcnkLFjL5CT+oyHNuUUC/xx6XefEJ16r38r8Bc/lfp6rYuHeJQ== + dependencies: + "@babel/code-frame" "^7.26.2" + "@babel/generator" "^7.26.5" + "@babel/parser" "^7.26.5" + "@babel/template" "^7.25.9" + "@babel/types" "^7.26.5" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.5", "@babel/types@^7.3.3": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.5.tgz#7a1e1c01d28e26d1fe7f8ec9567b3b92b9d07747" + integrity sha512-L6mZmwFDK6Cjh1nRCLXpa6no13ZIioJDz7mdkzHv399pThrTa/k0nUlNaenOeh2kWu/iaOQYElEpKPUswUa9Vg== + dependencies: + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + +"@jest/console@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" + integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + +"@jest/core@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" + integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== + dependencies: + "@jest/console" "^29.7.0" + "@jest/reporters" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + ci-info "^3.2.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-changed-files "^29.7.0" + jest-config "^29.7.0" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-resolve-dependencies "^29.7.0" + jest-runner "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + jest-watcher "^29.7.0" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + strip-ansi "^6.0.0" + +"@jest/environment@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" + integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== + dependencies: + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== + dependencies: + jest-get-type "^29.6.3" + +"@jest/expect@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" + integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== + dependencies: + expect "^29.7.0" + jest-snapshot "^29.7.0" + +"@jest/fake-timers@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" + integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== + dependencies: + "@jest/types" "^29.6.3" + "@sinonjs/fake-timers" "^10.0.2" + "@types/node" "*" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +"@jest/globals@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" + integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/types" "^29.6.3" + jest-mock "^29.7.0" + +"@jest/reporters@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" + integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + "@types/node" "*" + chalk "^4.0.0" + collect-v8-coverage "^1.0.0" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^6.0.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.1.3" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + jest-worker "^29.7.0" + slash "^3.0.0" + string-length "^4.0.1" + strip-ansi "^6.0.0" + v8-to-istanbul "^9.0.1" + +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" + +"@jest/source-map@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" + integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== + dependencies: + "@jridgewell/trace-mapping" "^0.3.18" + callsites "^3.0.0" + graceful-fs "^4.2.9" + +"@jest/test-result@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" + integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== + dependencies: + "@jest/console" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + +"@jest/test-sequencer@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" + integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== + dependencies: + "@jest/test-result" "^29.7.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + slash "^3.0.0" + +"@jest/transform@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" + integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== + dependencies: + "@babel/core" "^7.11.6" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + babel-plugin-istanbul "^6.1.1" + chalk "^4.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + micromatch "^4.0.4" + pirates "^4.0.4" + slash "^3.0.0" + write-file-atomic "^4.0.2" + +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== + dependencies: + "@jest/schemas" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.8" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz#4f0e06362e01362f823d348f1872b08f666d8142" + integrity sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/source-map@^0.3.3": + version "0.3.6" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.6.tgz#9d71ca886e32502eb9362c9a74a46787c36df81a" + integrity sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + +"@sinclair/typebox@^0.27.8": + version "0.27.8" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" + integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== + +"@sinonjs/commons@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" + integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== + dependencies: + type-detect "4.0.8" + +"@sinonjs/fake-timers@^10.0.2": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" + integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== + dependencies: + "@sinonjs/commons" "^3.0.0" + +"@tootallnate/once@2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" + integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== + +"@types/babel__core@^7.1.14": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" + integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== + dependencies: + "@babel/parser" "^7.20.7" + "@babel/types" "^7.20.7" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.8" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" + integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" + integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.20.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.6.tgz#8dc9f0ae0f202c08d8d4dab648912c8d6038e3f7" + integrity sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg== + dependencies: + "@babel/types" "^7.20.7" + +"@types/eslint-scope@^3.7.7": + version "3.7.7" + resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" + integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== + dependencies: + "@types/eslint" "*" + "@types/estree" "*" + +"@types/eslint@*": + version "9.6.1" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-9.6.1.tgz#d5795ad732ce81715f27f75da913004a56751584" + integrity sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*", "@types/estree@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" + integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== + +"@types/graceful-fs@^4.1.3": + version "4.1.9" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" + integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== + dependencies: + "@types/node" "*" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== + +"@types/istanbul-lib-report@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@^29.5.14": + version "29.5.14" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" + integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== + dependencies: + expect "^29.0.0" + pretty-format "^29.0.0" + +"@types/jsdom@^20.0.0": + version "20.0.1" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" + integrity sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ== + dependencies: + "@types/node" "*" + "@types/tough-cookie" "*" + parse5 "^7.0.0" + +"@types/json-schema@*", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + +"@types/node-fetch@^2.6.12": + version "2.6.12" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.12.tgz#8ab5c3ef8330f13100a7479e2cd56d3386830a03" + integrity sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + +"@types/node@*": + version "22.10.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.10.7.tgz#14a1ca33fd0ebdd9d63593ed8d3fbc882a6d28d7" + integrity sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg== + dependencies: + undici-types "~6.20.0" + +"@types/node@^14.14.30": + version "14.18.63" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.63.tgz#1788fa8da838dbb5f9ea994b834278205db6ca2b" + integrity sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ== + +"@types/node@^18.19.70": + version "18.19.71" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.71.tgz#96d4f0a0be735ead6c8998c62a4b2c0012a5d09a" + integrity sha512-evXpcgtZm8FY4jqBSN8+DmOTcVkkvTmAayeo4Wf3m1xAruyVGzGuDh/Fb/WWX2yLItUiho42ozyJjB0dw//Tkw== + dependencies: + undici-types "~5.26.4" + +"@types/qs@^6.9.17": + version "6.9.18" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.18.tgz#877292caa91f7c1b213032b34626505b746624c2" + integrity sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA== + +"@types/readable-stream@^4.0.18": + version "4.0.18" + resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-4.0.18.tgz#5d8d15d26c776500ce573cae580787d149823bfc" + integrity sha512-21jK/1j+Wg+7jVw1xnSwy/2Q1VgVjWuFssbYGTREPUBeZ+rqVFl2udq0IkxzPC0ZhOzVceUbyIACFZKLqKEBlA== + dependencies: + "@types/node" "*" + safe-buffer "~5.1.1" + +"@types/stack-utils@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== + +"@types/tough-cookie@*": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" + integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== + +"@types/url-join@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/url-join/-/url-join-4.0.1.tgz#4989c97f969464647a8586c7252d97b449cdc045" + integrity sha512-wDXw9LEEUHyV+7UWy7U315nrJGJ7p1BzaCxDpEoLr789Dk1WDVMMlf3iBfbG2F8NdWnYyFbtTxUn2ZNbm1Q4LQ== + +"@types/yargs-parser@*": + version "21.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== + +"@types/yargs@^17.0.8": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" + integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== + dependencies: + "@types/yargs-parser" "*" + +"@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.14.1.tgz#a9f6a07f2b03c95c8d38c4536a1fdfb521ff55b6" + integrity sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ== + dependencies: + "@webassemblyjs/helper-numbers" "1.13.2" + "@webassemblyjs/helper-wasm-bytecode" "1.13.2" + +"@webassemblyjs/floating-point-hex-parser@1.13.2": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz#fcca1eeddb1cc4e7b6eed4fc7956d6813b21b9fb" + integrity sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA== + +"@webassemblyjs/helper-api-error@1.13.2": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz#e0a16152248bc38daee76dd7e21f15c5ef3ab1e7" + integrity sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ== + +"@webassemblyjs/helper-buffer@1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz#822a9bc603166531f7d5df84e67b5bf99b72b96b" + integrity sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA== + +"@webassemblyjs/helper-numbers@1.13.2": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz#dbd932548e7119f4b8a7877fd5a8d20e63490b2d" + integrity sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA== + dependencies: + "@webassemblyjs/floating-point-hex-parser" "1.13.2" + "@webassemblyjs/helper-api-error" "1.13.2" + "@xtuc/long" "4.2.2" + +"@webassemblyjs/helper-wasm-bytecode@1.13.2": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz#e556108758f448aae84c850e593ce18a0eb31e0b" + integrity sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA== + +"@webassemblyjs/helper-wasm-section@1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz#9629dda9c4430eab54b591053d6dc6f3ba050348" + integrity sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw== + dependencies: + "@webassemblyjs/ast" "1.14.1" + "@webassemblyjs/helper-buffer" "1.14.1" + "@webassemblyjs/helper-wasm-bytecode" "1.13.2" + "@webassemblyjs/wasm-gen" "1.14.1" + +"@webassemblyjs/ieee754@1.13.2": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz#1c5eaace1d606ada2c7fd7045ea9356c59ee0dba" + integrity sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw== + dependencies: + "@xtuc/ieee754" "^1.2.0" + +"@webassemblyjs/leb128@1.13.2": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.13.2.tgz#57c5c3deb0105d02ce25fa3fd74f4ebc9fd0bbb0" + integrity sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw== + dependencies: + "@xtuc/long" "4.2.2" + +"@webassemblyjs/utf8@1.13.2": + version "1.13.2" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.13.2.tgz#917a20e93f71ad5602966c2d685ae0c6c21f60f1" + integrity sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ== + +"@webassemblyjs/wasm-edit@^1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz#ac6689f502219b59198ddec42dcd496b1004d597" + integrity sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ== + dependencies: + "@webassemblyjs/ast" "1.14.1" + "@webassemblyjs/helper-buffer" "1.14.1" + "@webassemblyjs/helper-wasm-bytecode" "1.13.2" + "@webassemblyjs/helper-wasm-section" "1.14.1" + "@webassemblyjs/wasm-gen" "1.14.1" + "@webassemblyjs/wasm-opt" "1.14.1" + "@webassemblyjs/wasm-parser" "1.14.1" + "@webassemblyjs/wast-printer" "1.14.1" + +"@webassemblyjs/wasm-gen@1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz#991e7f0c090cb0bb62bbac882076e3d219da9570" + integrity sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg== + dependencies: + "@webassemblyjs/ast" "1.14.1" + "@webassemblyjs/helper-wasm-bytecode" "1.13.2" + "@webassemblyjs/ieee754" "1.13.2" + "@webassemblyjs/leb128" "1.13.2" + "@webassemblyjs/utf8" "1.13.2" + +"@webassemblyjs/wasm-opt@1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz#e6f71ed7ccae46781c206017d3c14c50efa8106b" + integrity sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw== + dependencies: + "@webassemblyjs/ast" "1.14.1" + "@webassemblyjs/helper-buffer" "1.14.1" + "@webassemblyjs/wasm-gen" "1.14.1" + "@webassemblyjs/wasm-parser" "1.14.1" + +"@webassemblyjs/wasm-parser@1.14.1", "@webassemblyjs/wasm-parser@^1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz#b3e13f1893605ca78b52c68e54cf6a865f90b9fb" + integrity sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ== + dependencies: + "@webassemblyjs/ast" "1.14.1" + "@webassemblyjs/helper-api-error" "1.13.2" + "@webassemblyjs/helper-wasm-bytecode" "1.13.2" + "@webassemblyjs/ieee754" "1.13.2" + "@webassemblyjs/leb128" "1.13.2" + "@webassemblyjs/utf8" "1.13.2" + +"@webassemblyjs/wast-printer@1.14.1": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz#3bb3e9638a8ae5fdaf9610e7a06b4d9f9aa6fe07" + integrity sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw== + dependencies: + "@webassemblyjs/ast" "1.14.1" + "@xtuc/long" "4.2.2" + +"@xtuc/ieee754@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" + integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== + +"@xtuc/long@4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" + integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== + +abab@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" + integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== + +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + +acorn-globals@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" + integrity sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q== + dependencies: + acorn "^8.1.0" + acorn-walk "^8.0.2" + +acorn-walk@^8.0.2: + version "8.3.4" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" + integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + dependencies: + acorn "^8.11.0" + +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.14.0, acorn@^8.8.1, acorn@^8.8.2: + version "8.14.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" + integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== + +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +ajv-formats@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" + integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== + dependencies: + ajv "^8.0.0" + +ajv-keywords@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" + integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== + +ajv-keywords@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz#69d4d385a4733cdbeab44964a1170a88f87f0e16" + integrity sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw== + dependencies: + fast-deep-equal "^3.1.3" + +ajv@^6.12.5: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ajv@^8.0.0, ajv@^8.9.0: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" + integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== + dependencies: + fast-deep-equal "^3.1.3" + fast-uri "^3.0.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + +ansi-escapes@^4.2.1: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + +anymatch@^3.0.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +async@^3.2.3: + version "3.2.6" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" + integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +axios@^1.7.9: + version "1.7.9" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.9.tgz#d7d071380c132a24accda1b2cfc1535b79ec650a" + integrity sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + +babel-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" + integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== + dependencies: + "@jest/transform" "^29.7.0" + "@types/babel__core" "^7.1.14" + babel-plugin-istanbul "^6.1.1" + babel-preset-jest "^29.6.3" + chalk "^4.0.0" + graceful-fs "^4.2.9" + slash "^3.0.0" + +babel-plugin-istanbul@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" + integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-instrument "^5.0.4" + test-exclude "^6.0.0" + +babel-plugin-jest-hoist@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" + integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== + dependencies: + "@babel/template" "^7.3.3" + "@babel/types" "^7.3.3" + "@types/babel__core" "^7.1.14" + "@types/babel__traverse" "^7.0.6" + +babel-preset-current-node-syntax@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" + integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.12.13" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-syntax-import-attributes" "^7.24.7" + "@babel/plugin-syntax-import-meta" "^7.10.4" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-syntax-top-level-await" "^7.14.5" + +babel-preset-jest@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" + integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== + dependencies: + babel-plugin-jest-hoist "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" + +browserslist@^4.24.0: + version "4.24.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.4.tgz#c6b2865a3f08bcb860a0e827389003b9fe686e4b" + integrity sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A== + dependencies: + caniuse-lite "^1.0.30001688" + electron-to-chromium "^1.5.73" + node-releases "^2.0.19" + update-browserslist-db "^1.1.1" + +bs-logger@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + +buffer-from@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== + +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + +call-bind-apply-helpers@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz#32e5892e6361b29b0b545ba6f7763378daca2840" + integrity sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + +call-bound@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.3.tgz#41cfd032b593e39176a71533ab4f384aa04fd681" + integrity sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA== + dependencies: + call-bind-apply-helpers "^1.0.1" + get-intrinsic "^1.2.6" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.2.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001688: + version "1.0.30001695" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001695.tgz#39dfedd8f94851132795fdf9b79d29659ad9c4d4" + integrity sha512-vHyLade6wTgI2u1ec3WQBxv+2BrTERV28UXQu9LO6lZ9pYeMk34vjXFLOxo1A4UBA8XTL4njRQZdno/yYaSmWw== + +chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +char-regex@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== + +chrome-trace-event@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b" + integrity sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ== + +ci-info@^3.2.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== + +cjs-module-lexer@^1.0.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz#707413784dbb3a72aa11c2f2b042a0bef4004170" + integrity sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA== + +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== + +collect-v8-coverage@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" + integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + +create-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" + integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-config "^29.7.0" + jest-util "^29.7.0" + prompts "^2.0.1" + +cross-spawn@^7.0.3: + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +cssom@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" + integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== + +cssom@~0.3.6: + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" + integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== + dependencies: + cssom "~0.3.6" + +data-urls@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" + integrity sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ== + dependencies: + abab "^2.0.6" + whatwg-mimetype "^3.0.0" + whatwg-url "^11.0.0" + +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: + version "4.4.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" + integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== + dependencies: + ms "^2.1.3" + +decimal.js@^10.4.2: + version "10.4.3" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" + integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== + +dedent@^1.0.0: + version "1.5.3" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.3.tgz#99aee19eb9bae55a67327717b6e848d0bf777e5a" + integrity sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ== + +deepmerge@^4.2.2: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +detect-browser@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/detect-browser/-/detect-browser-5.3.0.tgz#9705ef2bddf46072d0f7265a1fe300e36fe7ceca" + integrity sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w== + +detect-newline@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== + +detect-node@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" + integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== + +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== + +domexception@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" + integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== + dependencies: + webidl-conversions "^7.0.0" + +dunder-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" + integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== + dependencies: + call-bind-apply-helpers "^1.0.1" + es-errors "^1.3.0" + gopd "^1.2.0" + +ejs@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b" + integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA== + dependencies: + jake "^10.8.5" + +electron-to-chromium@^1.5.73: + version "1.5.84" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.84.tgz#8e334ca206bb293a20b16418bf454783365b0a95" + integrity sha512-I+DQ8xgafao9Ha6y0qjHHvpZ9OfyA1qKlkHkjywxzniORU2awxyz7f/iVJcULmrF2yrM3nHQf+iDjJtbbexd/g== + +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.1: + version "5.18.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.18.0.tgz#91eb1db193896b9801251eeff1c6980278b1e404" + integrity sha512-0/r0MySGYG8YqlayBZ6MuCfECmHFdJ5qyPh8s8wa5Hnm6SaFLSK1VYCbj+NKp090Nm1caZhD+QTnmxO7esYGyQ== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + +entities@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" + integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== + +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-define-property@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" + integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +es-module-lexer@^1.2.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.6.0.tgz#da49f587fd9e68ee2404fe4e256c0c7d3a81be21" + integrity sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ== + +es-object-atoms@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" + integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + dependencies: + es-errors "^1.3.0" + +escalade@^3.1.1, escalade@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== + +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + +escodegen@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" + integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== + dependencies: + esprima "^4.0.1" + estraverse "^5.2.0" + esutils "^2.0.2" + optionalDependencies: + source-map "~0.6.1" + +eslint-scope@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +esprima@^4.0.0, esprima@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +events@^3.2.0, events@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== + +expect@^29.0.0, expect@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== + dependencies: + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-uri@^3.0.1: + version "3.0.6" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.6.tgz#88f130b77cfaea2378d56bf970dea21257a68748" + integrity sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw== + +fb-watchman@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== + dependencies: + bser "2.1.1" + +filelist@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" + integrity sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q== + dependencies: + minimatch "^5.0.1" + +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + +find-up@^4.0.0, find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +follow-redirects@^1.15.6: + version "1.15.9" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" + integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== + +form-data-encoder@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-4.0.2.tgz#dd286fd5f9049e8ded1d44ce427f5e29185c7c12" + integrity sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw== + +form-data@^4.0.0, form-data@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48" + integrity sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +formdata-node@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-6.0.3.tgz#48f8e2206ae2befded82af621ef015f08168dc6d" + integrity sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +fsevents@^2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-intrinsic@^1.2.5, get-intrinsic@^1.2.6: + version "1.2.7" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.7.tgz#dcfcb33d3272e15f445d15124bc0a216189b9044" + integrity sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA== + dependencies: + call-bind-apply-helpers "^1.0.1" + es-define-property "^1.0.1" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + function-bind "^1.1.2" + get-proto "^1.0.0" + gopd "^1.2.0" + has-symbols "^1.1.0" + hasown "^2.0.2" + math-intrinsics "^1.1.0" + +get-package-type@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== + +get-proto@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" + integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== + dependencies: + dunder-proto "^1.0.1" + es-object-atoms "^1.0.0" + +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== + +glob@^7.1.3, glob@^7.1.4: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +gopd@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" + integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== + +graceful-fs@^4.1.2, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-symbols@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" + integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== + +hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +html-encoding-sniffer@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" + integrity sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA== + dependencies: + whatwg-encoding "^2.0.0" + +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +http-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" + integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== + dependencies: + "@tootallnate/once" "2" + agent-base "6" + debug "4" + +https-proxy-agent@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +iconv-lite@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + +ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +import-local@^3.0.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" + integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== + +is-core-module@^2.16.0: + version "2.16.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" + integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== + dependencies: + hasown "^2.0.2" + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-potential-custom-element-name@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" + integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" + integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== + +istanbul-lib-instrument@^5.0.4: + version "5.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" + integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== + dependencies: + "@babel/core" "^7.12.3" + "@babel/parser" "^7.14.7" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-coverage "^3.2.0" + semver "^6.3.0" + +istanbul-lib-instrument@^6.0.0: + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + +istanbul-lib-report@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^4.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + source-map "^0.6.1" + +istanbul-reports@^3.1.3: + version "3.1.7" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" + integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== + dependencies: + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" + +jake@^10.8.5: + version "10.9.2" + resolved "https://registry.yarnpkg.com/jake/-/jake-10.9.2.tgz#6ae487e6a69afec3a5e167628996b59f35ae2b7f" + integrity sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA== + dependencies: + async "^3.2.3" + chalk "^4.0.2" + filelist "^1.0.4" + minimatch "^3.1.2" + +jest-changed-files@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" + integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== + dependencies: + execa "^5.0.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + +jest-circus@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" + integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^1.0.0" + is-generator-fn "^2.0.0" + jest-each "^29.7.0" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + p-limit "^3.1.0" + pretty-format "^29.7.0" + pure-rand "^6.0.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-cli@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" + integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== + dependencies: + "@jest/core" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + chalk "^4.0.0" + create-jest "^29.7.0" + exit "^0.1.2" + import-local "^3.0.2" + jest-config "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + yargs "^17.3.1" + +jest-config@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" + integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== + dependencies: + "@babel/core" "^7.11.6" + "@jest/test-sequencer" "^29.7.0" + "@jest/types" "^29.6.3" + babel-jest "^29.7.0" + chalk "^4.0.0" + ci-info "^3.2.0" + deepmerge "^4.2.2" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-circus "^29.7.0" + jest-environment-node "^29.7.0" + jest-get-type "^29.6.3" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-runner "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + micromatch "^4.0.4" + parse-json "^5.2.0" + pretty-format "^29.7.0" + slash "^3.0.0" + strip-json-comments "^3.1.1" + +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-docblock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" + integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== + dependencies: + detect-newline "^3.0.0" + +jest-each@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" + integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + jest-get-type "^29.6.3" + jest-util "^29.7.0" + pretty-format "^29.7.0" + +jest-environment-jsdom@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" + integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/jsdom" "^20.0.0" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + jsdom "^20.0.0" + +jest-environment-node@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" + integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== + dependencies: + "@jest/types" "^29.6.3" + "@types/graceful-fs" "^4.1.3" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + jest-worker "^29.7.0" + micromatch "^4.0.4" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.2" + +jest-leak-detector@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" + integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== + dependencies: + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== + dependencies: + chalk "^4.0.0" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-util "^29.7.0" + +jest-pnp-resolver@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== + +jest-regex-util@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" + integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== + +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== + dependencies: + jest-regex-util "^29.6.3" + jest-snapshot "^29.7.0" + +jest-resolve@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" + integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== + dependencies: + chalk "^4.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-pnp-resolver "^1.2.2" + jest-util "^29.7.0" + jest-validate "^29.7.0" + resolve "^1.20.0" + resolve.exports "^2.0.0" + slash "^3.0.0" + +jest-runner@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" + integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== + dependencies: + "@jest/console" "^29.7.0" + "@jest/environment" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + emittery "^0.13.1" + graceful-fs "^4.2.9" + jest-docblock "^29.7.0" + jest-environment-node "^29.7.0" + jest-haste-map "^29.7.0" + jest-leak-detector "^29.7.0" + jest-message-util "^29.7.0" + jest-resolve "^29.7.0" + jest-runtime "^29.7.0" + jest-util "^29.7.0" + jest-watcher "^29.7.0" + jest-worker "^29.7.0" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" + integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/globals" "^29.7.0" + "@jest/source-map" "^29.6.3" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + cjs-module-lexer "^1.0.0" + collect-v8-coverage "^1.0.0" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + strip-bom "^4.0.0" + +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== + dependencies: + "@babel/core" "^7.11.6" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^29.7.0" + graceful-fs "^4.2.9" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + natural-compare "^1.4.0" + pretty-format "^29.7.0" + semver "^7.5.3" + +jest-util@^29.0.0, jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + +jest-validate@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" + integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== + dependencies: + "@jest/types" "^29.6.3" + camelcase "^6.2.0" + chalk "^4.0.0" + jest-get-type "^29.6.3" + leven "^3.1.0" + pretty-format "^29.7.0" + +jest-watcher@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" + integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== + dependencies: + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + emittery "^0.13.1" + jest-util "^29.7.0" + string-length "^4.0.1" + +jest-worker@^27.4.5: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== + dependencies: + "@types/node" "*" + jest-util "^29.7.0" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== + dependencies: + "@jest/core" "^29.7.0" + "@jest/types" "^29.6.3" + import-local "^3.0.2" + jest-cli "^29.7.0" + +js-base64@3.7.7: + version "3.7.7" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.7.tgz#e51b84bf78fbf5702b9541e2cb7bfcb893b43e79" + integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw== + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsdom@^20.0.0: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db" + integrity sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ== + dependencies: + abab "^2.0.6" + acorn "^8.8.1" + acorn-globals "^7.0.0" + cssom "^0.5.0" + cssstyle "^2.3.0" + data-urls "^3.0.2" + decimal.js "^10.4.2" + domexception "^4.0.0" + escodegen "^2.0.0" + form-data "^4.0.0" + html-encoding-sniffer "^3.0.0" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.1" + is-potential-custom-element-name "^1.0.1" + nwsapi "^2.2.2" + parse5 "^7.1.1" + saxes "^6.0.0" + symbol-tree "^3.2.4" + tough-cookie "^4.1.2" + w3c-xmlserializer "^4.0.0" + webidl-conversions "^7.0.0" + whatwg-encoding "^2.0.0" + whatwg-mimetype "^3.0.0" + whatwg-url "^11.0.0" + ws "^8.11.0" + xml-name-validator "^4.0.0" + +jsesc@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" + integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== + +json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-ptr@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/json-ptr/-/json-ptr-3.1.1.tgz#184c3d48db659fa9bbc1519f7db6f390ddffb659" + integrity sha512-SiSJQ805W1sDUCD1+/t1/1BIrveq2Fe9HJqENxZmMCILmrPI7WhS/pePpIOx85v6/H2z1Vy7AI08GV2TzfXocg== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +json5@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +loader-runner@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" + integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +lodash.defaultsdeep@^4.6.1: + version "4.6.1" + resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6" + integrity sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA== + +lodash.flatmap@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.flatmap/-/lodash.flatmap-4.5.0.tgz#ef8cbf408f6e48268663345305c6acc0b778702e" + integrity sha512-/OcpcAGWlrZyoHGeHh3cAoa6nGdX6QYtmzNP84Jqol6UEQQ2gIaU3H+0eICcjcKGl0/XF8LWOujNn9lffsnaOg== + +lodash.memoize@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== + +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + +make-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== + dependencies: + semver "^7.5.3" + +make-error@^1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +makeerror@1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== + dependencies: + tmpl "1.0.5" + +math-intrinsics@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" + integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +micromatch@^4.0.0, micromatch@^4.0.4: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12, mime-types@^2.1.27: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^5.0.1: + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== + dependencies: + brace-expansion "^2.0.1" + +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + +neo-async@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + +node-fetch@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== + +node-releases@^2.0.19: + version "2.0.19" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314" + integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw== + +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +nwsapi@^2.2.2: + version "2.2.16" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.16.tgz#177760bba02c351df1d2644e220c31dfec8cdb43" + integrity sha512-F1I/bimDpj3ncaNDhfyMWuFqmQDBwDB0Fogc2qpL3BWvkQteFD/8BzWuIRl83rq0DXfm8SGt/HFhLXZyljTXcQ== + +object-inspect@^1.13.3: + version "1.13.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.3.tgz#f14c183de51130243d6d18ae149375ff50ea488a" + integrity sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA== + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +parse5@^7.0.0, parse5@^7.1.1: + version "7.2.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.2.1.tgz#8928f55915e6125f430cc44309765bf17556a33a" + integrity sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ== + dependencies: + entities "^4.5.0" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +picocolors@^1.0.0, picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + +picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pirates@^4.0.4: + version "4.0.6" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" + integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== + +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + +prettier@^3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f" + integrity sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ== + +pretty-format@^29.0.0, pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== + dependencies: + "@jest/schemas" "^29.6.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + +prompts@^2.0.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.5" + +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + +psl@^1.1.33: + version "1.15.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.15.0.tgz#bdace31896f1d97cec6a79e8224898ce93d974c6" + integrity sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w== + dependencies: + punycode "^2.3.1" + +punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + +pure-rand@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" + integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== + +qs@^6.13.1: + version "6.14.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.0.tgz#c63fa40680d2c5c941412a0e899c89af60c0a930" + integrity sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w== + dependencies: + side-channel "^1.1.0" + +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +react-is@^18.0.0: + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== + +readable-stream@^4.5.2: + version "4.7.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.7.0.tgz#cedbd8a1146c13dfff8dab14068028d58c15ac91" + integrity sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg== + dependencies: + abort-controller "^3.0.0" + buffer "^6.0.3" + events "^3.3.0" + process "^0.11.10" + string_decoder "^1.3.0" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" + +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + +resolve.exports@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.3.tgz#41955e6f1b4013b7586f873749a635dea07ebe3f" + integrity sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A== + +resolve@^1.20.0: + version "1.22.10" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" + integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== + dependencies: + is-core-module "^2.16.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +safe-buffer@^5.1.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +"safer-buffer@>= 2.1.2 < 3.0.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +saxes@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" + integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== + dependencies: + xmlchars "^2.2.0" + +schema-utils@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== + dependencies: + "@types/json-schema" "^7.0.8" + ajv "^6.12.5" + ajv-keywords "^3.5.2" + +schema-utils@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.0.tgz#3b669f04f71ff2dfb5aba7ce2d5a9d79b35622c0" + integrity sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g== + dependencies: + "@types/json-schema" "^7.0.9" + ajv "^8.9.0" + ajv-formats "^2.1.1" + ajv-keywords "^5.1.0" + +semver@^6.3.0, semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + +semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.6.3: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + +serialize-javascript@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" + integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== + dependencies: + randombytes "^2.1.0" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +side-channel-list@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" + integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== + dependencies: + es-errors "^1.3.0" + object-inspect "^1.13.3" + +side-channel-map@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42" + integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + get-intrinsic "^1.2.5" + object-inspect "^1.13.3" + +side-channel-weakmap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea" + integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + get-intrinsic "^1.2.5" + object-inspect "^1.13.3" + side-channel-map "^1.0.1" + +side-channel@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" + integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== + dependencies: + es-errors "^1.3.0" + object-inspect "^1.13.3" + side-channel-list "^1.0.0" + side-channel-map "^1.0.1" + side-channel-weakmap "^1.0.2" + +signal-exit@^3.0.3, signal-exit@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +sisteransi@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +source-map@^0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" + integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== + +"square-legacy@npm:square@^39.1.1": + version "39.1.1" + resolved "https://registry.yarnpkg.com/square/-/square-39.1.1.tgz#d032b2101f219bb0010a6a704819665d3f01d97b" + integrity sha512-75b/UWbXl6xk1cG0jEWeWTRHAbDseF78kdPa3N4Cm57KMkDwOS2qGSLfooyqMDmFEKhQAfTA0WSiMkw40hQ/2A== + dependencies: + "@apimatic/authentication-adapters" "^0.5.4" + "@apimatic/axios-client-adapter" "^0.3.7" + "@apimatic/core" "^0.10.16" + "@apimatic/json-bigint" "^1.2.0" + "@apimatic/schema" "^0.7.14" + "@types/node" "^14.14.30" + +stack-utils@^2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== + dependencies: + escape-string-regexp "^2.0.0" + +string-length@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== + dependencies: + char-regex "^1.0.2" + strip-ansi "^6.0.0" + +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string_decoder@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +symbol-tree@^3.2.4: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +tapable@^2.1.1, tapable@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" + integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + +terser-webpack-plugin@^5.3.10: + version "5.3.11" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.11.tgz#93c21f44ca86634257cac176f884f942b7ba3832" + integrity sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ== + dependencies: + "@jridgewell/trace-mapping" "^0.3.25" + jest-worker "^27.4.5" + schema-utils "^4.3.0" + serialize-javascript "^6.0.2" + terser "^5.31.1" + +terser@^5.31.1: + version "5.37.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.37.0.tgz#38aa66d1cfc43d0638fab54e43ff8a4f72a21ba3" + integrity sha512-B8wRRkmre4ERucLM/uXx4MOV5cbnOlVAqUst+1+iLKPI0dOgFO28f84ptoQt9HEI537PMzfYa/d+GEPKTRXmYA== + dependencies: + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" + commander "^2.20.0" + source-map-support "~0.5.20" + +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" + +tiny-warning@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" + integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== + +tmpl@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tough-cookie@^4.1.2: + version "4.1.4" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" + integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.2.0" + url-parse "^1.5.3" + +tr46@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" + integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA== + dependencies: + punycode "^2.1.1" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + +ts-jest@^29.1.1: + version "29.2.5" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.2.5.tgz#591a3c108e1f5ebd013d3152142cb5472b399d63" + integrity sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA== + dependencies: + bs-logger "^0.2.6" + ejs "^3.1.10" + fast-json-stable-stringify "^2.1.0" + jest-util "^29.0.0" + json5 "^2.2.3" + lodash.memoize "^4.1.2" + make-error "^1.3.6" + semver "^7.6.3" + yargs-parser "^21.1.1" + +ts-loader@^9.5.1: + version "9.5.2" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.2.tgz#1f3d7f4bb709b487aaa260e8f19b301635d08020" + integrity sha512-Qo4piXvOTWcMGIgRiuFa6nHNm+54HbYaZCKqc9eeZCLRy3XqafQgwX2F7mofrbJG3g7EEb+lkiR+z2Lic2s3Zw== + dependencies: + chalk "^4.1.0" + enhanced-resolve "^5.0.0" + micromatch "^4.0.0" + semver "^7.3.4" + source-map "^0.7.4" + +tslib@2.8.1, tslib@^2.8.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +typescript@~5.7.2: + version "5.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" + integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + +undici-types@~6.20.0: + version "6.20.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433" + integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg== + +universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== + +update-browserslist-db@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz#97e9c96ab0ae7bcac08e9ae5151d26e6bc6b5580" + integrity sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg== + dependencies: + escalade "^3.2.0" + picocolors "^1.1.1" + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +url-join@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" + integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== + +url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + +v8-to-istanbul@^9.0.1: + version "9.3.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" + integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== + dependencies: + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^2.0.0" + +w3c-xmlserializer@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073" + integrity sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw== + dependencies: + xml-name-validator "^4.0.0" + +walker@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== + dependencies: + makeerror "1.0.12" + +watchpack@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" + integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== + dependencies: + glob-to-regexp "^0.4.1" + graceful-fs "^4.1.2" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +webidl-conversions@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" + integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== + +webpack-sources@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" + integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== + +webpack@^5.97.1: + version "5.97.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.97.1.tgz#972a8320a438b56ff0f1d94ade9e82eac155fa58" + integrity sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg== + dependencies: + "@types/eslint-scope" "^3.7.7" + "@types/estree" "^1.0.6" + "@webassemblyjs/ast" "^1.14.1" + "@webassemblyjs/wasm-edit" "^1.14.1" + "@webassemblyjs/wasm-parser" "^1.14.1" + acorn "^8.14.0" + browserslist "^4.24.0" + chrome-trace-event "^1.0.2" + enhanced-resolve "^5.17.1" + es-module-lexer "^1.2.1" + eslint-scope "5.1.1" + events "^3.2.0" + glob-to-regexp "^0.4.1" + graceful-fs "^4.2.11" + json-parse-even-better-errors "^2.3.1" + loader-runner "^4.2.0" + mime-types "^2.1.27" + neo-async "^2.6.2" + schema-utils "^3.2.0" + tapable "^2.1.1" + terser-webpack-plugin "^5.3.10" + watchpack "^2.4.1" + webpack-sources "^3.2.3" + +whatwg-encoding@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" + integrity sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg== + dependencies: + iconv-lite "0.6.3" + +whatwg-mimetype@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" + integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== + +whatwg-url@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018" + integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ== + dependencies: + tr46 "^3.0.0" + webidl-conversions "^7.0.0" + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +write-file-atomic@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== + dependencies: + imurmurhash "^0.1.4" + signal-exit "^3.0.7" + +ws@^8.11.0: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== + +xml-name-validator@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" + integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== + +xmlchars@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs@^17.3.1: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==